:root {
  --bg: #f3f7fb;
  --bg-elevated: #edf4fb;
  --surface: #ffffff;
  --surface-soft: #f7f9fc;
  --surface-alt: #eefaf6;
  --navy: #0f1d2e;
  --navy-2: #1b2f45;
  --primary: #0d7a73;
  --primary-strong: #0a665f;
  --primary-soft: #dff6f2;
  --accent: #1a8ea5;
  --accent-soft: #eaf8fb;
  --danger: #d94d5f;
  --danger-soft: #fdecef;
  --warning: #d69a2d;
  --warning-soft: #fff6df;
  --success: #1b9c72;
  --success-soft: #eafaf4;
  --text: #1e2d3d;
  --muted: #627287;
  --line: #e5edf5;
  --shadow: 0 18px 38px rgba(15, 29, 46, 0.08);
  --shadow-soft: 0 10px 22px rgba(15, 29, 46, 0.05);
  font-family: "Segoe UI", Inter, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: linear-gradient(180deg, #f6f8fb 0%, #eef4fa 100%);
  color: var(--text);
}
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; color: inherit; }
button:disabled { opacity: .5; cursor: wait; }
button:focus-visible, a:focus-visible { outline: 3px solid rgba(13, 122, 115, 0.35); outline-offset: 3px; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(13, 122, 115, 0.42); outline-offset: 1px; }

.icon { width: 20px; height: 20px; flex-shrink: 0; vertical-align: middle; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

h1, h2, h3, p { margin: 0; }
h1 { font-size: 30px; line-height: 1.2; letter-spacing: -1.1px; font-weight: 700; }
h2 { font-size: 17px; letter-spacing: -0.3px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 650; }
p { line-height: 1.65; }

.section-kicker {
  display: block; font-size: 10px; letter-spacing: 1.5px; font-weight: 700;
  color: #7d8ea1; margin-bottom: 10px; text-transform: uppercase;
}
.eyebrow {
  font-size: 10px; letter-spacing: 1.9px; font-weight: 700; color: #78bfb7;
  text-transform: uppercase;
}
.loading { padding: 100px 32px; text-align: center; color: var(--muted); }

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 238px; background: linear-gradient(180deg, var(--navy) 0%, #12273a 100%);
  color: #a8bac7; position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column;
  padding: 28px 18px 16px; z-index: 10; border-right: 1px solid rgba(255,255,255,0.06);
  box-shadow: 18px 0 30px rgba(8, 16, 25, 0.08);
}
.brand {
  display: flex; gap: 12px; align-items: center; color: #fff; text-decoration: none;
  padding: 4px 12px 18px; border-bottom: 1px solid rgba(255,255,255,0.08);
}
.brand-mark {
  position: relative; font-family: Arial, sans-serif; font-weight: 800; font-size: 42px;
  line-height: 40px; color: #7fe1cf; letter-spacing: -5px; width: 36px;
  text-shadow: 0 0 18px rgba(127, 225, 207, 0.45);
}
.brand-mark > span {
  position: absolute; width: 7px; height: 7px; background: #7fe1cf; border-radius: 50%;
  top: 2px; right: 2px; box-shadow: 0 0 10px rgba(127, 225, 207, 0.8);
}
.brand-word {
  font-size: 27px; font-weight: 700; letter-spacing: -1.1px; line-height: 1;
}
.brand-word > span {
  display: block; font-size: 8px; font-weight: 600; letter-spacing: 2px;
  line-height: 2.6; color: #9ab5c7; text-transform: uppercase;
}

.nav-caption {
  font-size: 9px; letter-spacing: 1.6px; font-weight: 700; margin: 30px 14px 12px; color: #7691a8;
  text-transform: uppercase;
}
.nav-caption.second { margin-top: 26px; }
.nav-item {
  border: 0; background: transparent; width: 100%; padding: 12px 14px; display: flex; gap: 12px;
  align-items: center; color: #b9c6d4; border-radius: 10px; margin: 4px 0; font-size: 12px;
  text-align: left; transition: all 0.2s ease; position: relative; overflow: hidden;
}
.nav-item .icon { width: 18px; height: 18px; }
.nav-item:hover {
  background: rgba(255, 255, 255, 0.05); color: #fff; transform: translateX(2px);
}
.nav-item.active {
  background: linear-gradient(90deg, rgba(12, 122, 115, 0.32), rgba(28, 142, 165, 0.12));
  color: #dbfaf2; box-shadow: inset 0 0 0 1px rgba(127, 225, 207, 0.2);
}
.nav-item.active::before {
  content: ""; position: absolute; left: 0; top: 10%; bottom: 10%; width: 3px; border-radius: 999px;
  background: #7fe1cf; box-shadow: 0 0 12px rgba(127, 225, 207, 0.8);
}
.nav-count {
  margin-left: auto; font-size: 10px; padding: 3px 7px; border-radius: 999px;
  background: rgba(197, 48, 66, 0.18); color: #ffd7de; border: 1px solid rgba(255,255,255,0.06);
}

.sidebar-bottom { margin-top: auto; padding-top: 20px; }
.connection-note {
  display: flex; gap: 10px; padding: 16px 12px 18px; margin-bottom: 18px; border-bottom: 1px solid rgba(255,255,255,0.08);
  font-size: 11px; align-items: center; color: #d9e7ef; background: rgba(255,255,255,0.02); border-radius: 10px;
}
.connection-note > .icon { color: #92aab9; }
.connection-note small {
  display: block; color: #a0b2bf; font-size: 10px; margin-top: 5px;
}
.connection-note > .dot { margin-left: auto; width: 8px; height: 8px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 12px rgba(74, 222, 128, 0.8); }
.user-block {
  display: flex; gap: 9px; align-items: center; padding: 5px 4px 0; color: #dfeaf5;
}
.avatar {
  display: grid; place-items: center; background: linear-gradient(135deg, #24435e, #1a3247); color: #dfeefa;
  border: 1px solid rgba(184, 201, 221, 0.24); border-radius: 50%; width: 34px; height: 34px;
  font-size: 10px; flex-shrink: 0; font-weight: 700; letter-spacing: 0.08em;
}
.user-info { font-size: 10px; color: #eaf1f8; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-info small { display: block; color: #8ea1b1; font-size: 8px; margin-top: 4px; }
.user-block .icon-button { margin-left: auto; color: #b2c2ce; }

.main-shell {
  margin-left: 238px; flex: 1; min-width: 0; display: flex; flex-direction: column;
}
.topbar {
  height: 78px; display: flex; align-items: center; justify-content: space-between; padding: 0 38px;
  background: rgba(255,255,255,0.8); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line);
  gap: 16px; position: sticky; top: 0; z-index: 5;
}
.breadcrumb {
  font-size: 9px; letter-spacing: 1px; color: #8e9daf; white-space: nowrap; text-transform: uppercase;
}
.breadcrumb span { padding: 0 14px; color: #ced7df; }
.breadcrumb strong { font-weight: 700; color: #43627d; }
.topbar-right { display: flex; align-items: center; gap: 20px; }
.company-picker {
  display: flex; align-items: center; gap: 10px; color: #6a7b8c; background: rgba(243,247,251,0.8);
  border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px;
}
.company-picker .icon { width: 16px; height: 16px; }
.company-picker select {
  background: transparent; border: 0; color: var(--text); font-size: 11px; width: 210px; padding: 9px 4px;
  max-width: 100%; cursor: pointer; appearance: none;
}
.local-label {
  font-size: 8px; font-weight: 700; letter-spacing: 0.8px; color: #6d8192; background: #eff5fa;
  border: 1px solid #dfeaf5; padding: 6px 8px; border-radius: 999px; white-space: nowrap;
}

#main {
  padding: 34px 38px 28px; flex: 1; outline: 0;
}
.page-heading {
  display: flex; justify-content: space-between; gap: 24px; align-items: center; margin-bottom: 26px;
}
.page-heading .muted { font-size: 12px; margin-top: 10px; }
.page-actions { flex-shrink: 0; }

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 16px;
  border-radius: 10px; font-size: 11px; font-weight: 700; line-height: 18px; text-decoration: none;
  border: 1px solid transparent; transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.button:hover { transform: translateY(-1px); }
.button .icon { width: 16px; height: 16px; }
.button.primary {
  background: linear-gradient(135deg, var(--primary) 0%, #0f8f8a 100%); color: #fff;
  box-shadow: 0 10px 18px rgba(13, 122, 115, 0.18);
}
.button.primary:hover { background: linear-gradient(135deg, var(--primary-strong) 0%, #0d7f7a 100%); }
.button.secondary {
  background: var(--surface); border-color: var(--line); color: #425a73; box-shadow: var(--shadow-soft);
}
.button.secondary:hover { background: #f6f9fc; }
.text-button {
  display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; color: var(--primary);
  font-size: 10px; font-weight: 700; padding: 7px 0; white-space: nowrap; transition: opacity 0.2s ease;
}
.text-button .icon { width: 14px; height: 14px; }
.text-button:hover { opacity: 0.8; text-decoration: underline; }
.icon-button {
  display: inline-flex; align-items: center; justify-content: center; background: rgba(13, 122, 115, 0.06);
  border: 1px solid rgba(13, 122, 115, 0.06); border-radius: 8px; padding: 7px; color: #51667b;
  transition: all 0.2s ease;
}
.icon-button .icon { width: 17px; height: 17px; }
.icon-button:hover { background: rgba(13, 122, 115, 0.1); color: var(--primary); }

.notice {
  display: flex; gap: 10px; align-items: center; border: 1px solid rgba(214, 154, 45, 0.25);
  background: linear-gradient(180deg, #fffaf0 0%, #fff7e1 100%); color: #83642d; border-radius: 12px;
  padding: 12px 16px; font-size: 10px; line-height: 1.7; box-shadow: var(--shadow-soft);
}
.notice > .icon { width: 16px; height: 16px; }
.notice strong { font-weight: 700; }
.demo-notice { margin-bottom: 22px; }
.demo-label {
  display: inline-block; padding: 2px 5px; background: rgba(214, 154, 45, 0.12);
  border: 1px solid rgba(214, 154, 45, 0.25); border-radius: 6px; font-size: 7px; letter-spacing: 0.7px;
  color: #8f6928; vertical-align: middle; font-weight: 700; line-height: 13px; white-space: nowrap;
}
.integration-notice {
  margin-top: 26px; border-color: rgba(13, 122, 115, 0.18); background: linear-gradient(180deg, #f2fbfa 0%, #ebf8f6 100%);
  color: #4e7c74;
}
.integration-notice > .text-button { margin-left: auto; color: var(--primary); }

.metrics {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin-bottom: 26px;
}
.metric {
  background: linear-gradient(180deg, #fff 0%, #fafcff 100%); border: 1px solid var(--line);
  border-radius: 16px; padding: 18px 20px 16px; box-shadow: var(--shadow-soft);
}
.metric-label {
  display: flex; align-items: center; justify-content: space-between; font-size: 10px; color: #72829a; gap: 6px;
  text-transform: uppercase; letter-spacing: 0.08em;
}
.metric-icon {
  display: grid; place-items: center; background: linear-gradient(135deg, #edf4ff, #ecf9f7);
  color: #446b88; width: 32px; height: 32px; border-radius: 10px; box-shadow: inset 0 0 0 1px rgba(92, 126, 155, 0.08);
}
.metric-icon .icon { width: 15px; height: 15px; }
.metric-2 { background: linear-gradient(180deg, #fff9fa 0%, #fff5f6 100%); }
.metric-2 .metric-icon { background: linear-gradient(135deg, #ffe8ed, #fff0f4); color: #b64d63; }
.metric-3 { background: linear-gradient(180deg, #fffaf0 0%, #fff7e4 100%); }
.metric-3 .metric-icon { background: linear-gradient(135deg, #fff1cc, #fff7de); color: #c58a2d; }
.metric > strong {
  display: block; font-size: 32px; font-weight: 700; letter-spacing: -1.2px; margin-top: 14px;
  line-height: 1.2; color: #223753;
}
.metric p {
  font-size: 9px; color: #8f9bac; margin-top: 6px; line-height: 1.5;
}
.metric p.critical-text { color: #b86173; }

.panel {
  background: linear-gradient(180deg, #fff 0%, #fbfdff 100%); border: 1px solid var(--line);
  border-radius: 18px; overflow: hidden; box-shadow: var(--shadow-soft);
}
.panel-heading {
  padding: 21px 22px 19px; display: flex; align-items: center; justify-content: space-between; gap: 14px;
  border-bottom: 1px solid rgba(229, 237, 245, 0.9);
}
.panel-heading h2 { font-size: 14px; display: flex; gap: 9px; align-items: center; }
.panel-heading p { font-size: 10px; margin-top: 5px; color: var(--muted); }
.count-pill {
  display: inline-grid; place-items: center; font-size: 9px; color: #8a6735; background: #fff0d1;
  min-width: 22px; height: 22px; border-radius: 999px; font-weight: 700; border: 1px solid rgba(214,154,45,0.2);
}

.table-wrap { overflow: auto; }
.netsdk-panel > .dialog-body { padding: 20px 22px; font-size: 12px; line-height: 1.7; }
.netsdk-panel h3 { margin: 20px 0 10px; font-size: 13px; }
:is(.netsdk-dialog,.device-registration-dialog,.media-dialog) { width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 40px); padding: 0; border: 1px solid var(--line); border-radius: 16px; color: var(--text); box-shadow: var(--shadow); }
:is(.netsdk-dialog,.device-registration-dialog,.media-dialog)::backdrop { background: #10223566; }
:is(.netsdk-dialog,.device-registration-dialog,.media-dialog) .dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 22px 24px 18px; border-bottom: 1px solid var(--line); }
:is(.netsdk-dialog,.device-registration-dialog,.media-dialog) h2 { margin: 8px 0 0; font-size: 17px; }
:is(.netsdk-dialog,.device-registration-dialog,.media-dialog) .dialog-body { padding: 20px 24px; font-size: 12px; line-height: 1.7; }
:is(.netsdk-dialog,.device-registration-dialog,.media-dialog) label { display: block; font-weight: 600; font-size: 12px; }
:is(.netsdk-dialog,.device-registration-dialog,.media-dialog) input:not([type=checkbox]), :is(.netsdk-dialog,.device-registration-dialog,.media-dialog) select, :is(.netsdk-dialog,.device-registration-dialog,.media-dialog) textarea { display: block; width: 100%; border: 1px solid #d4dfe6; border-radius: 8px; padding: 10px 12px; margin: 7px 0 16px; color: var(--text); background: #fafcfd; font-size: 12px; }
:is(.netsdk-dialog,.device-registration-dialog,.media-dialog) textarea { resize: vertical; font-family: Consolas, monospace; min-height: 100px; }
:is(.netsdk-dialog,.device-registration-dialog,.media-dialog) .field-help { font-size: 11px; color: var(--muted); margin: 12px 0; }
:is(.netsdk-dialog,.device-registration-dialog,.media-dialog) .dialog-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--line); }
:is(.netsdk-dialog,.device-registration-dialog,.media-dialog) .form-error { color: var(--danger); padding: 0 24px; font-size: 12px; }
table { border-collapse: collapse; width: 100%; text-align: left; white-space: nowrap; }
th {
  font-size: 9px; font-weight: 700; color: #7a8b9c; background: #f7fafc; padding: 11px 19px;
  border-top: 1px solid #eef3f8; border-bottom: 1px solid #eef3f8; letter-spacing: 0.08em; text-transform: uppercase;
}
td {
  padding: 17px 19px; border-bottom: 1px solid #edf2f8; font-size: 10px; color: #52657b; background: rgba(255,255,255,0.35);
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(13, 122, 115, 0.02); }
td strong { font-size: 10px; font-weight: 700; color: #374d67; }
td small { display: block; color: #8ea0af; font-size: 9px; margin-top: 5px; }
td .firmware { font-size: 8px; max-width: 220px; white-space: normal; overflow-wrap: anywhere; }

@media (max-width: 1100px) {
  .sidebar { width: 210px; }
  .main-shell { margin-left: 210px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .sidebar { position: static; width: 100%; border-right: 0; border-bottom: 1px solid rgba(255,255,255,0.06); }
  .shell { display: block; }
  .main-shell { margin-left: 0; }
  .topbar { padding: 0 20px; }
  #main { padding: 24px 20px 28px; }
  .page-heading { flex-direction: column; align-items: flex-start; }
  .metrics { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .topbar { height: auto; padding: 16px 18px; flex-wrap: wrap; }
  .topbar-right { width: 100%; justify-content: space-between; }
  .company-picker { width: 100%; justify-content: space-between; }
  .company-picker select { width: 100%; }
  .brand { padding-left: 8px; }
}
.event-media-image{display:block;max-width:100%;max-height:360px;object-fit:contain;border-radius:8px;margin:12px 0}.media-item{padding:16px 0;border-bottom:1px solid #dce5eb}.access-device{display:block;padding:8px 0}

.media-dialog{width:min(760px,calc(100vw - 32px))}.media-dialog .dialog-body{overflow-wrap:anywhere}.media-dialog .event-media-image{margin:12px auto}.media-dialog label:has(input[type=checkbox]){display:flex;gap:8px;align-items:center}
.event-rules-history{max-height:440px;overflow:auto}.event-rules-history table{table-layout:fixed;white-space:normal}.event-rules-history th{position:sticky;top:0;background:#f5f8fb;z-index:1}.event-rules-history td,.event-rules-history th{padding:12px 8px;overflow-wrap:anywhere}.event-rules-history th:nth-child(1){width:18%}.event-rules-history th:nth-child(2){width:21%}.event-rules-history th:nth-child(3){width:43%}.event-rules-history th:nth-child(4){width:18%}.rule-weekdays{display:flex;flex-wrap:wrap;gap:8px;margin:12px 0;min-width:0}.rule-weekdays .access-device{display:inline-flex;padding:4px}.rule-weekdays legend{padding:0 6px}
@media(max-width:560px){.event-rules-history table{min-width:620px}}
