:root {
  color-scheme: light;
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
  color: #241a38;
  background: #f5effc;
  font-synthesis: none;
  --bg: #f5effc;
  --bg-soft: #efe6fa;
  --panel: #ffffff;
  --panel-alt: #faf6ff;
  --border: #e2d6f5;
  --border-strong: #cdbbe9;
  --text: #241a38;
  --text-soft: #3a2d55;
  --text-muted: #5a4b78;
  --text-faint: #6b5d8a;
  --accent: #7c4fd0;
  --accent-strong: #6639b8;
  --accent-deep: #4f2f8f;
  --accent-soft: #ece1fb;
  --accent-softer: #f6f1fe;
  --ok: #1f7a52;
  --warn: #9a4a05;
  --danger: #a1190f;
  --shadow: 0 8px 24px rgba(104, 63, 170, 0.08);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
button, input { font: inherit; }
button { font-weight: 600; }
.shell { min-height: 100vh; display: grid; grid-template-columns: 220px 1fr; }
.sidebar { background: var(--bg-soft); border-right: 1px solid var(--border); padding: 25px 16px; display: flex; flex-direction: column; }
.brand { display: flex; gap: 10px; align-items: center; margin: 0 9px 38px; }
.brand-mark { min-width: 30px; height: 30px; padding: 0 8px; border-radius: 9px; background: linear-gradient(135deg, #c4b5fd, #a78bfa); color: #2b1a4a; display: grid; place-items: center; font-weight: 900; font-size: 14px; letter-spacing: .02em; white-space: nowrap; box-shadow: 0 4px 10px rgba(108, 63, 184, 0.28); }
.brand b { font-size: 15px; letter-spacing: .08em; color: var(--text); }
.brand small { display: block; color: var(--text-faint); font-size: 11px; margin-top: 3px; }
.nav { display: grid; gap: 5px; }
.nav button { border: 0; color: #4a3d63; background: transparent; text-align: left; padding: 12px 13px; border-radius: 8px; cursor: pointer; display: flex; gap: 11px; align-items: center; font-size: 14px; transition: background .15s ease, color .15s ease; }
.nav button.active, .nav button:hover { background: #e9defb; color: #33205a; }
.nav button.active { box-shadow: inset 3px 0 0 var(--accent); font-weight: 700; }
.nav .ico, .top-actions .ico { width: 20px; height: 20px; display: inline-block; flex: 0 0 20px; text-align: center; background-image: url('/assets/generated/sentinel-icons-16.png'); background-size: 400% 400%; background-repeat: no-repeat; filter: brightness(.6) saturate(1.5) contrast(1.18); }
.sprite-overview { background-position: 0 0; }
.sprite-camera { background-position: 33.333% 0; }
.sprite-alert { background-position: 66.666% 0; }
.sprite-search { background-position: 100% 0; }
.sprite-settings { background-position: 0 33.333%; }
.sprite-system { background-position: 33.333% 33.333%; }
.sprite-vehicle { background-position: 66.666% 33.333%; }
.sprite-fire { background-position: 100% 33.333%; }
.sprite-fall { background-position: 0 66.666%; }
.sprite-shield { background-position: 33.333% 66.666%; }
.sprite-user { background-position: 66.666% 66.666%; }
.sprite-nodes { background-position: 100% 66.666%; }
.sprite-bell { background-position: 0 100%; }
.sprite-play { background-position: 33.333% 100%; }
.sprite-calendar { background-position: 66.666% 100%; }
.sprite-logout { background-position: 100% 100%; }
.sidebar-foot { margin-top: auto; border-top: 1px solid var(--border); padding: 16px 8px; color: var(--text-muted); font-size: 12px; }
.user { display: flex; align-items: center; gap: 9px; margin-top: 13px; color: var(--text-soft); font-size: 12px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: #b9a3e6; color: #2b1a4a; display: grid; place-items: center; font-weight: 700; }
.main { min-width: 0; }
.topbar { height: 72px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 30px; background: rgba(255, 255, 255, .78); backdrop-filter: blur(6px); }
.crumb { color: var(--text-muted); font-size: 13px; }
.crumb strong { color: var(--text); font-size: 17px; margin-right: 14px; }
.top-actions { display: flex; align-items: center; gap: 18px; color: var(--text-muted); font-size: 13px; }
.health { display: flex; align-items: center; gap: 7px; color: var(--ok); font-weight: 600; }
.dot { width: 7px; height: 7px; background: #1f8a5c; border-radius: 50%; box-shadow: 0 0 0 4px rgba(31, 138, 92, .16); }
.content { padding: 27px 30px 42px; max-width: 1700px; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 13px; margin-bottom: 23px; }
.kpi { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 17px 18px; min-height: 105px; box-shadow: var(--shadow); }
.kpi .label { color: var(--text-muted); font-size: 12px; font-weight: 600; }
.kpi .value { font-size: 28px; font-weight: 700; margin-top: 11px; letter-spacing: -.02em; color: var(--text); }
.kpi .hint { font-size: 12px; color: var(--ok); margin-top: 5px; font-weight: 500; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; }
.section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.section-head h2 { font-size: 16px; margin: 0; color: var(--text); }
.section-head span { font-size: 12px; color: var(--text-faint); }
.filters { display: flex; gap: 8px; }
.filters button { border: 1px solid var(--border-strong); background: var(--panel); color: var(--text-muted); border-radius: 6px; padding: 6px 10px; font-size: 12px; cursor: pointer; }
.filters button.active { color: #3f2a7a; border-color: var(--accent); background: var(--accent-soft); font-weight: 700; }
.camera-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.camera { border: 1px solid var(--border); border-radius: 10px; background: var(--panel); overflow: hidden; position: relative; box-shadow: var(--shadow); }
.camera img { display: block; width: 100%; aspect-ratio: 16/9; object-fit: cover; background: #efe6fa; }
.camera-meta { padding: 12px 13px 13px; display: flex; justify-content: space-between; align-items: center; }
.camera-title { font-size: 13px; font-weight: 700; color: var(--text); }
.camera-sub { font-size: 11px; color: var(--text-muted); margin-top: 5px; }
.cam-status { display: flex; align-items: center; gap: 5px; color: var(--ok); font-size: 11px; font-weight: 600; }
.cam-status .dot { width: 6px; height: 6px; box-shadow: none; }
.badge { position: absolute; top: 10px; left: 10px; background: rgba(24, 14, 44, .78); border: 1px solid rgba(255, 255, 255, .35); border-radius: 4px; padding: 4px 7px; color: #ffffff; font-size: 11px; font-weight: 600; backdrop-filter: blur(3px); }
.badge.alert { color: #ffe0b0; border-color: rgba(255, 203, 128, .6); }
.alerts { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; box-shadow: var(--shadow); }
.alert { padding: 15px 15px 13px; border-bottom: 1px solid #f0e8fa; cursor: pointer; }
.alert:last-child { border-bottom: 0; }
.alert:hover { background: var(--accent-softer); }
.alert-row { display: flex; justify-content: space-between; gap: 7px; }
.alert-name { font-size: 13px; font-weight: 700; color: var(--text); }
.alert-time { font-size: 11px; color: var(--text-faint); }
.alert-summary { font-size: 12px; color: var(--text-soft); line-height: 1.6; margin: 8px 0; }
.level { font-size: 10px; padding: 3px 6px; border-radius: 3px; text-transform: uppercase; letter-spacing: .04em; font-weight: 700; }
.level.critical { background: #fbdde1; color: #94150c; }
.level.high { background: #fce9d4; color: #8f3f02; }
.level.medium { background: #eef3d3; color: #4d5c0f; }
.level.low { background: #e8edf7; color: #3d4f6b; }
.alert-actions { display: flex; gap: 6px; }
.alert-actions button { border: 1px solid #d9c8f2; background: #f2eafc; color: #4f2f8f; border-radius: 5px; padding: 5px 9px; font-size: 11px; font-weight: 600; cursor: pointer; }
.alert-actions button:hover { background: var(--accent-soft); border-color: var(--accent); }
.empty { padding: 45px 18px; color: var(--text-faint); text-align: center; font-size: 13px; }
.toast { position: fixed; right: 28px; bottom: 26px; background: #e6d8fb; color: #33205a; padding: 12px 16px; border-radius: 8px; font-size: 13px; font-weight: 600; box-shadow: 0 10px 30px rgba(76, 46, 148, .25); border: 1px solid #c9b3ec; }
.login { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(circle at 60% 18%, #e6d8fa 0, #f5effc 46%, #f1e9fa 100%); }
.login-tabs { display: flex; gap: 8px; margin: 0 0 14px; }
.login-tabs button { flex: 1; padding: 8px 0; border-radius: 9px; border: 1px solid var(--border); background: transparent; color: var(--text-muted); font-size: 13px; cursor: pointer; }
.login-tabs button.on { background: linear-gradient(135deg, #7c5cff, #b44cff); color: #fff; border-color: transparent; }
.login-foot { display: flex; justify-content: center; gap: 22px; margin-top: 18px; }
.login-foot a { font-size: 12.5px; color: #8b7bb8; text-decoration: none; }
.login-foot a:hover { color: #7c5cff; }
.login-box { width: min(410px, calc(100vw - 36px)); background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 34px; box-shadow: 0 24px 60px rgba(104, 63, 170, .14); }
.login-box h1 { font-size: 24px; margin: 0 0 7px; color: var(--text); }
.login-box p { font-size: 13px; color: var(--text-muted); line-height: 1.6; margin: 0 0 25px; }
.login-box label { display: block; color: var(--text-soft); font-size: 12px; font-weight: 600; margin-bottom: 8px; }
.login-box input { width: 100%; border: 1px solid var(--border-strong); border-radius: 7px; background: var(--panel-alt); color: var(--text); padding: 12px; outline: none; font-size: 14px; }
.login-box input::placeholder { color: #7d6f9c; }
.login-box input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124, 79, 208, .18); }
.login-box button { width: 100%; margin-top: 17px; padding: 12px; border: 0; border-radius: 7px; background: var(--accent); color: #ffffff; font-weight: 700; font-size: 14px; cursor: pointer; box-shadow: 0 8px 18px rgba(108, 63, 184, .28); }
.login-box button:hover { background: var(--accent-strong); }
.error { color: var(--danger); font-size: 12px; margin-top: 10px; min-height: 16px; font-weight: 500; }
@media(max-width:1050px) {
  .shell { grid-template-columns: 74px 1fr; }
  .sidebar { padding: 20px 9px; }
  .brand { margin: 0 auto 35px; }
  .brand > div:not(.brand-mark), .nav button span:not(.ico), .sidebar-foot { display: none; }
  .nav button { justify-content: center; }
  .content { padding: 22px 18px; }
  .layout { grid-template-columns: 1fr; }
  .alerts { margin-top: 18px; }
}
@media(max-width:680px) {
  .topbar { padding: 0 16px; }
  .content { padding: 18px 12px; }
  .kpis { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .kpi { min-height: 90px; padding: 12px; }
  .kpi .value { font-size: 22px; }
  .camera-grid { grid-template-columns: 1fr; }
  .top-actions .health { display: none; }
}

.page-card { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 20px; margin-bottom: 22px; box-shadow: var(--shadow); }
.page-card h3 { margin: 0 0 12px; font-size: 15px; color: var(--text); }
.page-card p { font-size: 13px; color: var(--text-soft); line-height: 1.65; }
.page-card small, .form-note { color: var(--text-faint); font-size: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: end; }
.form-grid label { display: grid; gap: 7px; color: var(--text-muted); font-size: 12px; font-weight: 600; }
.form-grid input, .form-grid select { width: 100%; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--panel-alt); color: var(--text); padding: 10px 11px; min-height: 38px; font-size: 13px; }
.form-grid input::placeholder { color: #7d6f9c; }
.form-grid input:focus, .form-grid select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124, 79, 208, .16); }
.form-grid .wide { grid-column: span 2; }
.form-grid .check { display: flex; align-items: center; gap: 8px; color: var(--text-soft); font-weight: 600; }
.form-grid .check input { width: auto; min-height: auto; accent-color: var(--accent); }
.primary { border: 0; border-radius: 6px; background: var(--accent); color: #ffffff; padding: 11px 16px; min-height: 38px; font-weight: 700; font-size: 13px; cursor: pointer; box-shadow: 0 4px 12px rgba(108, 63, 184, .22); transition: background .15s ease, box-shadow .15s ease; }
.primary:hover { background: var(--accent-strong); box-shadow: 0 4px 14px rgba(108, 63, 184, .32); }
.primary:disabled { box-shadow: none; }
.form-note { margin-top: 14px; }
.status-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.ok { color: var(--ok); font-weight: 700; }
.wide-alerts { max-height: calc(100vh - 220px); overflow: auto; }
.table-wrap { overflow: auto; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); }
.table { width: 100%; border-collapse: collapse; font-size: 12px; }
.table th, .table td { text-align: left; padding: 13px 14px; border-bottom: 1px solid #f0e8fa; white-space: nowrap; }
.table th { color: #4f4066; font-weight: 700; background: #f4ecfd; }
.table td { color: var(--text-soft); }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #faf7ff; }
@media(max-width:800px) {
  .form-grid, .status-grid { grid-template-columns: 1fr; }
  .form-grid .wide { grid-column: auto; }
}

.badge.demo { color: #7d5a0d; border-color: #d8bd7e; background: rgba(253, 246, 227, .95); }
.badge.offline { color: #94150c; border-color: #dfa3ad; background: rgba(253, 236, 239, .96); }
.camera-error { font-size: 11px; color: var(--danger); margin-top: 6px; max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.source-actions { display: flex; gap: 8px; }
.secondary { border: 1px solid #b9a3e6; border-radius: 6px; background: #f5effe; color: var(--accent-deep); padding: 11px 15px; min-height: 38px; font-weight: 700; font-size: 13px; cursor: pointer; }
.secondary:hover { background: var(--accent-soft); border-color: var(--accent); }
.primary:disabled { opacity: .45; cursor: not-allowed; }

.cam-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 7px; }
.remove-camera { border: 1px solid #dfa3ad; border-radius: 4px; background: #fdf1f3; color: var(--danger); padding: 5px 9px; font-size: 11px; font-weight: 600; cursor: pointer; }
.remove-camera:hover { background: #fbe3e7; }
.remove-camera:disabled { opacity: .5; cursor: wait; }

.event-type-manager { border-top: 1px solid var(--border); margin-top: 18px; padding-top: 14px; }
.event-type-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 12px; }
.event-type-chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid #cdbbe9; border-radius: 4px; background: #f7f2fe; color: var(--text-soft); padding: 5px 8px; font-size: 12px; font-weight: 500; }
.event-type-chip button { border: 0; background: transparent; color: var(--danger); cursor: pointer; padding: 0; font-size: 14px; line-height: 1; }
.event-type-chip button:hover { color: #7d100a; }
.event-type-manager input { border: 1px solid var(--border-strong); border-radius: 6px; background: var(--panel-alt); color: var(--text); padding: 10px 11px; min-height: 38px; flex: 1; font-size: 13px; }
.event-type-manager input::placeholder { color: #7d6f9c; }
.event-type-manager input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124, 79, 208, .16); }
.report-table td { vertical-align: middle; }
.report-table .secondary { padding: 7px 11px; min-height: 32px; font-size: 12px; }
.report-empty { text-align: center !important; color: var(--text-faint) !important; padding: 30px !important; }
.page-card code { color: var(--accent-deep); overflow-wrap: anywhere; font-size: 12px; background: var(--accent-softer); padding: 1px 5px; border-radius: 3px; }
