
:root {
  --bg: #f7f8fa;
  --white: #fff;
  --text: #111;
  --body: #666;
  --muted: #888;
  --border: #e5e5e5;
  --soft: #f1f2f4;
  --green: #187849;
  --green-bg: #eaf7ef;
  --red: #b54747;
  --red-bg: #fff0f0;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  font-size: 14px;
}
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible,
select:focus-visible { outline: 2px solid #777; outline-offset: 3px; }
[hidden] { display: none !important; }

.app { min-height: 100vh; display: flex; }

.sidebar {
  width: 245px;
  padding: 26px 17px 16px;
  background: var(--white);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -.5px;
}
.brand-mark {
  width: 35px;
  height: 35px;
  display: grid;
  place-items: center;
  background: #111;
  color: #fff;
  border-radius: 9px;
  font-size: 19px;
}
.brand-muted { color: var(--muted); font-weight: 400; }
.side-label {
  margin: 42px 8px 13px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
}
.nav { display: grid; gap: 5px; }
.nav-link {
  min-height: 43px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--body);
  font-size: 13px;
}
.nav-link:hover, .nav-link.active { background: var(--soft); color: #111; }
.nav-link.active { font-weight: 700; }
.nav-link b {
  margin-left: auto;
  color: var(--muted);
  font-size: 11px;
}
.side-bottom { margin-top: auto; }
.security-card {
  margin: 24px 0;
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.security-symbol { display: block; font-size: 22px; margin-bottom: 12px; }
.security-card strong { font-size: 12px; }
.security-card p { color: var(--body); font-size: 11px; line-height: 1.7; }
.admin {
  border-top: 1px solid var(--border);
  padding: 17px 2px 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.avatar {
  width: 35px;
  height: 35px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #eeeef0;
  font-size: 11px;
  font-weight: 800;
}
.admin strong, .admin small { display: block; }
.admin strong { font-size: 12px; }
.admin small { margin-top: 4px; color: var(--muted); font-size: 11px; }

.main { flex: 1; min-width: 0; }
.topbar {
  height: 68px;
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  background: #fff;
  border-bottom: 1px solid var(--border);
}
.breadcrumb { font-size: 12px; color: var(--body); }
.breadcrumb span { margin: 0 10px; color: #bbb; }
.domain-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #555;
  text-decoration: none;
  font-size: 11px;
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: #aaa; }
.menu-toggle { display: none; }

.content { max-width: 1700px; margin: auto; padding: 32px; }
.heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 25px;
}
.eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 13px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 1.5px;
  font-weight: 700;
}
.eyebrow span { width: 23px; height: 1px; background: #aaa; }
h1 { margin: 0; font-size: clamp(26px, 2.5vw, 34px); letter-spacing: -1px; }
.heading > div > p, .section-heading p {
  color: var(--body);
  font-size: 12px;
  line-height: 1.7;
  margin: 9px 0 0;
}
.heading-buttons { display: flex; gap: 9px; flex-shrink: 0; }
.btn {
  min-height: 38px;
  padding: 0 13px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 11px;
  font-weight: 650;
  transition: background .2s, border-color .2s;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.primary { color: #fff; background: #111; border-color: #111; }
.primary:hover:not(:disabled) { background: #333; }
.secondary { color: #333; background: #fff; }
.secondary:hover:not(:disabled) { border-color: #aaa; }

.notice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 15px;
  margin-bottom: 24px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.info-icon {
  width: 20px; height: 20px; flex-shrink: 0;
  display: grid; place-items: center;
  border: 1px solid #ccc; border-radius: 50%;
  font-size: 11px;
}
.notice strong { font-size: 12px; }
.notice p { margin: 5px 0 0; color: var(--body); font-size: 11px; line-height: 1.7; }
.notice-close {
  margin-left: auto; border: 0; background: none;
  color: var(--muted); font-size: 21px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 15px;
  margin-bottom: 34px;
}
.stat {
  min-width: 0;
  padding: 20px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
}
.stat > span { color: var(--body); font-size: 12px; }
.stat strong {
  display: block;
  margin-top: 14px;
  font-size: 30px;
  letter-spacing: -1px;
}
.stat small { display: block; margin-top: 8px; color: var(--muted); font-size: 10px; }

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 17px;
  margin-bottom: 17px;
}
.section-heading h2 { margin: 0; font-size: 18px; letter-spacing: -.4px; }
.filters { display: flex; gap: 9px; }
.filters input, .filters select {
  height: 38px;
  min-width: 0;
  padding: 0 10px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 11px;
}
.filters input { width: 205px; }
.filters select { max-width: 130px; }

.device-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 17px;
}
.device-card {
  min-width: 0;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: border-color .2s, transform .2s;
}
.device-card:hover { border-color: #c5c5c5; transform: translateY(-2px); }
.screen-preview {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #191b20;
  color: #fff;
}
.screen-top {
  height: 30px;
  padding: 0 11px;
  display: flex;
  align-items: center;
  gap: 5px;
  background: #23262b;
  border-bottom: 1px solid #35383e;
}
.screen-dot { width: 6px; height: 6px; background: #626771; border-radius: 50%; }
.screen-caption { margin-left: auto; color: #aeb3bd; font-size: 8px; letter-spacing: 1px; }
.preview-placeholder {
  position: absolute;
  inset: 30px 0 0;
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 8px;
  text-align: center;
}
.monitor-icon { color: #a2a7b0; font-size: 28px; }
.preview-placeholder strong { color: #e4e5e8; font-size: 11px; }
.preview-placeholder span:last-child { color: #9da2ac; font-size: 9px; line-height: 1.5; }
.screen-number { position: absolute; right: 10px; bottom: 8px; color: #777e89; font-size: 9px; }
.device-body { padding: 15px; }
.device-title-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.device-title-row h3 { margin: 0; font-size: 12px; overflow-wrap: anywhere; }
.device-title-row p { margin: 6px 0 0; color: var(--muted); font-size: 10px; }
.status-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 7px; border-radius: 5px;
  white-space: nowrap; font-size: 9px;
}
.status-badge span { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status-badge.online { color: var(--green); background: var(--green-bg); }
.status-badge.offline { color: var(--red); background: var(--red-bg); }
.device-meta {
  display: flex; justify-content: space-between; gap: 8px;
  margin-top: 16px; padding: 11px 0;
  border-top: 1px solid #f0f0f0; border-bottom: 1px solid #f0f0f0;
  color: var(--body); font-size: 10px;
}
.device-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.device-actions .btn { min-width: 0; padding: 0 6px; font-size: 10px; }

.activity-section { margin-top: 38px; }
.activity-list { padding: 4px 16px; background: #fff; border: 1px solid var(--border); border-radius: 10px; }
.empty-activity { padding: 20px 0; text-align: center; color: var(--muted); font-size: 12px; }
.activity-entry { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid #f0f0f0; }
.activity-entry:last-child { border-bottom: 0; }
.activity-symbol { width: 30px; height: 30px; display: grid; place-items: center; background: var(--soft); border-radius: 8px; }
.activity-copy { min-width: 0; }
.activity-copy strong { font-size: 11px; }
.activity-copy p { margin: 4px 0 0; color: var(--muted); font-size: 10px; overflow-wrap: anywhere; }
.activity-time { margin-left: auto; white-space: nowrap; color: var(--muted); font-size: 10px; }
.empty { padding: 35px; border: 1px dashed #ccc; border-radius: 10px; text-align: center; color: var(--body); }

footer {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px;
  margin-top: 40px; padding: 20px 0 8px;
  border-top: 1px solid var(--border); color: var(--muted); font-size: 10px;
}

.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center; padding: 20px;
  background: rgb(0 0 0 / 40%);
}
.modal-backdrop[hidden], .toast[hidden] { display: none; }
.modal {
  position: relative; width: min(100%, 420px); padding: 30px;
  border: 1px solid var(--border); border-radius: 14px;
  background: #fff; box-shadow: 0 18px 60px rgb(0 0 0 / 12%);
}
.modal-x { position: absolute; right: 14px; top: 10px; border: 0; background: none; font-size: 23px; color: var(--muted); }
.modal-mark { font-size: 27px; margin-bottom: 15px; }
.modal h2 { margin: 0; font-size: 21px; }
.modal p { color: var(--body); font-size: 13px; line-height: 1.8; margin: 12px 0 22px; }
.modal-ok { width: 100%; }
.toast {
  position: fixed; z-index: 200; right: 22px; bottom: 22px;
  max-width: min(400px, calc(100vw - 44px)); padding: 14px 18px;
  color: #fff; background: #171717; border-radius: 9px;
  box-shadow: 0 10px 35px rgb(0 0 0 / 15%); font-size: 12px; line-height: 1.6;
}

@media (max-width: 1250px) {
  .content { padding: 26px; }
  .sidebar { width: 220px; }
  .device-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 800px) {
  .topbar { padding: 0 18px; }
  .content { padding: 21px 18px; }
  .heading { flex-direction: column; align-items: flex-start; }
  .heading-buttons { width: 100%; }
  .section-heading { flex-direction: column; align-items: flex-start; }
  .filters { width: 100%; }
  .filters input { flex: 1; width: auto; }
}
@media (max-width: 600px) {
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 80;
    width: 255px; transform: translateX(-105%);
    transition: transform .25s ease;
  }
  .sidebar.open { transform: translateX(0); box-shadow: 12px 0 40px rgb(0 0 0 / 12%); }
  .menu-toggle { display: inline-block; padding: 7px 10px; border: 1px solid var(--border); background: #fff; border-radius: 7px; }
  .topbar { height: 60px; padding: 0 13px; gap: 10px; }
  .breadcrumb { margin-right: auto; font-size: 11px; }
  .domain-pill { font-size: 0; }
  .domain-pill .dot { width: 8px; height: 8px; }
  .content { padding: 22px 14px; }
  .device-grid { grid-template-columns: 1fr; }
  .stats { gap: 10px; }
  .stat { padding: 15px; }
  .stat strong { font-size: 26px; }
  .filters select { max-width: 120px; }
  footer { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; }
}
