/* POLY-LOC — shared liquid finish. No remote fonts or runtime dependencies. */
:root, body.theme-light {
  color-scheme: light;
  --bg: #eef3f5;
  --bg-2: #f6f8fa;
  --panel: #ffffff;
  --panel-2: #f7fafb;
  --surface-1: #f6f9fa;
  --surface-2: #eef3f5;
  --line: #dce5e9;
  --line-soft: #e3eaee;
  --ink: #172d38;
  --ink-soft: #596e7b;
  --brand: #087d70;
  --brand-dim: #07665d;
  --alert: #ba3e4c;
  --warn: #8b6114;
  --ok: #087568;
  --radius: 20px;
  --track-bg: #dcece9;
  --meta-bg: #eef3f5;
  --danger-tint: #fff0f1;
  --warn-tint: #fff8e9;
  --ok-tint: #edf8f4;
  --label: #344e5c;
  --field-bg: #ffffff;
  --field-border: #c8d5dd;
  --glass: rgba(255, 255, 255, .82);
  --shadow: 0 8px 32px rgba(32, 65, 80, .045), 0 1px 3px rgba(32, 65, 80, .03);
  --highlight: rgba(255, 255, 255, .9);
  --accent-wash: #e3f3ef;
  --button-ink: #ffffff;
  --ease: cubic-bezier(.22, 1, .36, 1);
}
body:not(.theme-light) {
  color-scheme: dark;
  --bg: #101c25;
  --bg-2: #14242d;
  --panel: #1b2c36;
  --panel-2: #192932;
  --surface-1: #20343f;
  --surface-2: #1b2e38;
  --line: #354954;
  --line-soft: #2e424e;
  --ink: #eaf2f6;
  --ink-soft: #a6bac6;
  --brand: #76ddc6;
  --brand-dim: #9de9d8;
  --alert: #ff98a1;
  --warn: #edcc84;
  --ok: #83dbc1;
  --track-bg: #2c494c;
  --meta-bg: #20343f;
  --danger-tint: #402d39;
  --warn-tint: #3b382c;
  --ok-tint: #203e3d;
  --label: #ccdde6;
  --field-bg: #162731;
  --field-border: #49606e;
  --glass: rgba(27, 44, 54, .88);
  --shadow: 0 12px 38px rgba(0, 0, 0, .12), 0 1px 3px rgba(0, 0, 0, .08);
  --highlight: rgba(255, 255, 255, .07);
  --accent-wash: #21433f;
  --button-ink: #112e2c;
}
html { scroll-padding-top: 24px; }
body {
  font-family: "Segoe UI Variable", "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  background: radial-gradient(ellipse at 0% 0%, var(--accent-wash), transparent 48%),
    radial-gradient(ellipse at 100% 65%, var(--surface-2), transparent 50%), var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, .brand, .brand-logo-fallback, .kpi-value,
.priority-strip strong, .filter-chip strong, .alert-card .alert-count {
  font-family: inherit;
  text-transform: none;
  letter-spacing: -.035em;
  color: var(--ink);
}
h2, h3 { line-height: 1.3; }
a, button, input, select, textarea, summary {
  -webkit-tap-highlight-color: transparent;
  transition: background-color .2s ease, border-color .2s ease, color .2s ease,
    box-shadow .2s ease, transform .3s var(--ease);
}
:focus-visible { outline: 3px solid var(--brand); outline-offset: 4px; }
[hidden] { display: none !important; }
.shell { width: min(1800px, calc(100% - 40px)); margin: 20px auto 40px; animation: enter .45s var(--ease); }
.app-layout { grid-template-columns: 256px minmax(0, 1fr); gap: 28px; }
main, main > *, .card-grid > *, .form-grid > *, .topbar > div { min-width: 0; }
main:focus { outline: none; }
.card, body.theme-light .card {
  border-color: var(--line);
  background: linear-gradient(135deg, var(--glass), var(--panel-2));
  box-shadow: inset 0 1px 0 var(--highlight), var(--shadow);
  padding: 24px;
}
.card + .card { margin-top: 18px; }
.card-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); gap: 18px; margin-top: 18px; }
.card-grid .card { margin: 0; }
.card-grid + .card { margin-top: 18px; }
.page-header.card { padding: 20px 24px; margin-bottom: 20px; }
.page-title { font-size: clamp(1.4rem, 2vw, 1.9rem); font-weight: 700; line-height: 1.22; }
.subtitle { font-size: .9rem; margin-top: 6px; }
.section-title { font-size: 1.08rem; font-weight: 650; margin-bottom: 14px; }
.section-head { gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.eyebrow { font-size: .7rem; letter-spacing: .13em; font-weight: 700; }
.sidebar.card { top: 20px; padding: 18px 12px; max-height: calc(100dvh - 40px); overflow-y: auto; scrollbar-width: thin; }
.brand-logos { margin: 0 6px; gap: 8px; }
.brand-app-slot { width: 100%; min-height: 74px; padding: 12px; border-radius: 14px; }
.brand-app-logo { max-width: 100%; max-height: 58px; }
.brand-tenant-slot { max-width: 100%; }
.brand-logo-tenant { max-height: 48px; }
.sidebar-user { margin: 16px 8px 0; font-size: .8rem; overflow-wrap: anywhere; }
.sidebar-nav { gap: 8px; margin-top: 20px; }
.nav-group > summary { min-height: 40px; padding: 10px; font-size: .66rem; letter-spacing: .08em; }
.nav-group > summary::after { content: "›"; font-size: 18px; font-weight: 400; }
.sidebar-nav a, .logout-button,
body.theme-light .sidebar-nav a, body.theme-light .logout-button {
  border: 1px solid transparent; background: transparent; color: var(--ink-soft);
  border-radius: 12px; padding: 10px 12px; min-height: 44px; font-size: .85rem;
}
.sidebar-nav a:hover, .logout-button:hover,
body.theme-light .sidebar-nav a:hover, body.theme-light .logout-button:hover {
  background: var(--surface-2); border-color: transparent; color: var(--ink); filter: none;
}
.sidebar-nav a[aria-current], body.theme-light .sidebar-nav a[aria-current] {
  color: var(--brand); background: var(--accent-wash); font-weight: 650; border-color: var(--line);
  box-shadow: inset 3px 0 0 var(--brand);
}
.nav-ico { width: 18px; height: 18px; stroke-width: 1.7; vertical-align: middle; }
.theme-toggle { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 18px; }
.nav-toggle { width: 44px; height: 44px; display: inline-grid; place-items: center; }
.nav-close, .nav-backdrop { display: none; }
.btn, button, .login-button {
  border-radius: 12px; padding: 10px 16px; min-height: 44px; line-height: 1.4;
  background: var(--brand); border: 1px solid transparent; color: var(--button-ink);
  font-size: .88rem; font-weight: 600; box-shadow: inset 0 1px 0 var(--highlight);
  white-space: normal; text-align: center;
}
.btn:hover, button:hover, .login-button:hover { filter: none; background: var(--brand-dim); }
.btn-secondary, body.theme-light .btn-secondary {
  background: var(--panel); border-color: var(--field-border); color: var(--ink); box-shadow: none;
}
.btn-secondary:hover, body.theme-light .btn-secondary:hover { background: var(--surface-2); border-color: var(--brand); }
.btn-danger, body.theme-light .btn-danger { background: var(--danger-tint); color: var(--alert); border-color: var(--alert); }
.btn-danger:hover, body.theme-light .btn-danger:hover { background: var(--danger-tint); filter: brightness(.97); }
button:disabled, input:disabled, select:disabled { cursor: not-allowed; opacity: .55; }
label { font-size: .86rem; font-weight: 600; margin-top: 14px; color: var(--label); }
input, textarea, select, body.theme-light input, body.theme-light textarea, body.theme-light select {
  background: var(--field-bg); border: 1px solid var(--field-border); border-radius: 11px;
  color: var(--ink); padding: 10px 12px; min-height: 44px; max-width: 100%;
}
input::placeholder, textarea::placeholder { color: var(--ink-soft); opacity: .9; }
input:focus, textarea:focus, select:focus,
body.theme-light input:focus, body.theme-light textarea:focus, body.theme-light select:focus {
  outline: 2px solid var(--brand); outline-offset: 2px; border-color: var(--brand);
}
input[type="checkbox"], input[type="radio"], body.theme-light input[type="checkbox"], body.theme-light input[type="radio"] {
  width: 19px; height: 19px; min-height: 0; padding: 0; margin: 0 6px 0 0; vertical-align: middle; accent-color: var(--brand);
}
input[type="file"] { white-space: normal; }
textarea { resize: vertical; }
.form-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: 8px 20px; }
.errorlist { color: var(--alert); padding-left: 20px; }
.dashboard-hero.card { padding: 30px; gap: 28px; align-items: center; background: linear-gradient(115deg, var(--accent-wash), var(--panel) 72%); }
.dashboard-intro h2 { font-size: clamp(1.6rem, 2.5vw, 2.3rem); }
.priority-strip { margin-top: 20px; gap: 10px; }
.priority-strip span { background: var(--glass); border-color: var(--line); padding: 7px 12px; font-size: .8rem; }
.priority-strip strong { color: var(--brand); margin-right: 3px; }
.scan-quick { padding: 20px; border-radius: 16px; background: var(--glass); }
.scan-quick label { color: var(--ink); }
.scan-quick .muted { font-size: .8rem; }
.scan-quick-row > button[type="submit"] { grid-column: 1 / -1; }
.dashboard-section { margin-top: 28px; }
.event-dashboard-grid { gap: 18px; margin-top: 26px; }
.event-dashboard-grid > .card { margin-top: 0; }
.event-row { padding: 12px; border-radius: 12px; background: var(--surface-1); }
.event-row > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.event-row strong { font-size: .86rem; }
.event-row small { font-size: .76rem; }
.event-row .pill { white-space: normal; text-align: center; }
.kpi-grid { grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); gap: 12px; }
.kpi-card { padding: 20px 16px; border-radius: 16px; background: var(--glass); box-shadow: var(--shadow); }
.kpi-label { text-transform: none; letter-spacing: 0; font-size: .8rem; }
.kpi-value { color: var(--ink); font-size: 2rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.action-grid, .alert-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: 14px; }
.action-link { padding: 20px; border-radius: 16px; background: var(--glass); }
.action-link strong { color: var(--ink); font-weight: 600; }
.action-link .muted { font-size: .83rem; }
.alert-card { border-radius: 16px; padding: 18px; }
.alert-card .alert-name { text-transform: none; letter-spacing: 0; font-size: .86rem; }
.alert-card .alert-count { font-size: 1.6rem; }
.alert-card .alert-detail { white-space: normal; overflow-wrap: anywhere; }
.alert-ok, .msg-ok, .msg-err, .msg-warn { padding: 14px 18px; border-radius: 14px; }
.alert-ok { font-size: .88rem; font-weight: 500; }
.filter-chip { padding: 9px 14px; min-height: 44px; background: var(--panel); font-size: .85rem; }
.filter-chip.active { background: var(--accent-wash); }
.table-wrap { max-width: 100%; border-radius: 14px; overscroll-behavior-x: contain; scrollbar-width: thin; }
table { font-size: .86rem; }
th, td { padding: 13px 14px; }
thead th, body.theme-light thead th { background: var(--surface-2); color: var(--ink-soft); border-bottom: 1px solid var(--line); }
th { text-transform: none; font-size: .78rem; font-weight: 650; letter-spacing: 0; }
tbody tr:nth-child(even) td, body.theme-light tbody tr:nth-child(even) td { background: transparent; }
tbody tr:hover td, body.theme-light tbody tr:hover td { background: var(--accent-wash); }
td .btn, td .btn-secondary, td button { min-height: 38px; padding: 8px 12px; font-size: .8rem; }
.table-filter { max-width: 360px; margin-bottom: 12px; }
.pill, body.theme-light .pill { padding: 4px 9px; border-color: var(--line); background: var(--accent-wash); color: var(--brand); font-size: .72rem; }
.pill-danger, body.theme-light .pill-danger { background: var(--danger-tint); border-color: var(--alert); color: var(--alert); }
.chart-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.chart-box { border-radius: 16px; padding: 20px; background: var(--panel); }
.chart-box canvas { max-width: 100%; }
.modal-overlay { background: rgba(10, 25, 34, .5); backdrop-filter: blur(8px); }
.modal-panel, body.theme-light .modal-panel { background: var(--panel); padding: 26px; border-radius: 22px; box-shadow: var(--shadow); max-height: 88dvh; }
.modal-head { flex-wrap: wrap; }
.skip-link { position: fixed; top: -100px; left: 20px; z-index: 150; background: var(--panel); padding: 12px 20px; border-radius: 12px; }
.skip-link:focus { top: 12px; }
@supports (backdrop-filter: blur(16px)) {
  .sidebar.card, .page-header.card { background: var(--glass); backdrop-filter: blur(16px) saturate(130%); }
}
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .kpi-card, .action-link, .alert-card, .event-row { transition: transform .3s var(--ease), box-shadow .3s ease, border-color .2s ease; }
  .kpi-card:hover, .action-link:hover, .alert-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); filter: none; }
  .btn:active, button:active { transform: scale(.98); }
}
@media (max-width: 1180px) {
  .app-layout { grid-template-columns: 232px minmax(0, 1fr); gap: 18px; }
  .dashboard-hero { grid-template-columns: 1fr; }
  .event-dashboard-grid { grid-template-columns: 1fr; }
}
@media (min-width: 761px) {
  .nav-backdrop { display: none !important; }
}
@media (max-width: 760px) {
  .shell { width: calc(100% - 24px); margin: 12px auto 28px; }
  .app-layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .card, body.theme-light .card { padding: 18px; border-radius: 17px; }
  .page-header.card { padding: 18px; margin-bottom: 16px; }
  .topbar { gap: 12px; align-items: flex-start; }
  .nav-toggle { position: static; box-shadow: none; z-index: auto; }
  .page-title { font-size: 1.35rem; padding-top: 2px; overflow-wrap: anywhere; }
  .subtitle { font-size: .8rem; }
  .sidebar.card, body.nav-collapsed .sidebar { display: none; }
  body.nav-open .sidebar.card {
    display: block; position: fixed; inset: 8px auto 8px 8px; z-index: 80;
    width: min(340px, calc(100vw - 24px)); max-height: none; margin: 0;
    padding: 54px 16px 20px; border-radius: 22px; background: var(--panel); overscroll-behavior: contain;
  }
  body.nav-open { overflow: hidden; }
  .nav-close { display: grid; place-items: center; position: absolute; right: 12px; top: 10px; width: 40px; height: 40px; padding: 0; }
  .nav-backdrop { display: block; position: fixed; inset: 0; z-index: 75; background: rgba(10, 25, 34, .48); backdrop-filter: blur(5px); }
  body.nav-open .sidebar { animation: drawer-enter .32s var(--ease); }
  .brand-app-slot { width: 100%; max-width: 100%; }
  .brand-app-logo { max-width: 100%; }
  .sidebar-nav a { min-height: 46px; }
  .dashboard-hero.card { padding: 22px 18px; gap: 22px; }
  .dashboard-hero, .event-dashboard-grid { grid-template-columns: minmax(0, 1fr); }
  .dashboard-section { margin-top: 24px; }
  .scan-quick { padding: 16px; }
  .scan-quick-row { grid-template-columns: minmax(0, 1fr) auto; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi-card { padding: 16px; }
  .kpi-value { font-size: 1.8rem; }
  .kpi-label { min-height: 2.5em; }
  input, select, textarea { font-size: 16px; }
  input[type="date"], input[type="number"], input[type="time"], select { max-width: 100%; }
  .table-wrap { max-height: 65dvh; }
  td .btn, td button { min-height: 44px; }
  .table-filter { max-width: 100%; }
  .modal-panel, body.theme-light .modal-panel { padding: 18px; max-width: 100%; }
  .photo-cols { grid-template-columns: minmax(0, 1fr); }
  .month-row { grid-template-columns: 46px minmax(0, 1fr) 85px; gap: 6px; }
  .offline-banner { position: relative; }
}
@keyframes drawer-enter { from { opacity: .5; transform: translateX(-24px); } to { opacity: 1; transform: translateX(0); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media print {
  body { background: white; color: black; }
  .sidebar, .nav-toggle, .nav-backdrop, .skip-link { display: none !important; }
  .shell { width: 100%; margin: 0; }
  .app-layout { display: block; }
  .card { background: white !important; box-shadow: none !important; backdrop-filter: none !important; }
  .table-wrap { max-height: none; overflow: visible; }
}
/* Login uses the same finish without changing authentication or its fields. */
.login-page .login-shell { min-height: calc(100dvh - 80px); padding: 48px 20px 24px; }
.login-page .login-panel { width: min(440px, 100%); gap: 26px; }
.login-page .logo-frame { width: min(240px, 100%); min-height: 96px; padding: 18px; margin-bottom: 28px; background: white; border-radius: 22px; box-shadow: var(--shadow); }
.login-page .logo-frame::before { display: none; }
.login-page .logo-frame img { max-height: 72px; }
.login-page h1 { font-size: 1.85rem; }
.login-page .card { padding: 28px; }
.login-page label { text-transform: none; letter-spacing: 0; margin: 0 0 6px; }
.login-page .field + .field { margin-top: 20px; }
.login-page .login-button { margin-top: 24px; }
.login-page .err { background: var(--danger-tint); color: var(--alert); }
.login-page .developer-credit { position: static; margin: 20px auto; max-width: calc(100% - 32px); width: fit-content; text-align: center; background: transparent; border: 0; box-shadow: none; font-size: .75rem; }
