/* =========================================================================
   PARKOMAK apps: one design system for HQ (super admin), Business (owners)
   and the resident app. Calm light canvas, white cards, near-black actions,
   the logo red only for what matters. Phones get a bottom tab bar.
   ========================================================================= */
:root {
  --bg: #F5F5F7; --card: #FFFFFF; --line: #E7E8EC; --line-2: #F0F1F4;
  --ink: #111318; --ink-2: #3A3F48; --muted: #6B7280; --faint: #9CA3AF;
  --red: #E3262F; --red-ink: #C8202A; --red-soft: #FDECEC;
  --green: #16A34A; --green-soft: #E9F8EF; --amber: #D97706; --amber-soft: #FEF4E2; --blue: #2563EB; --blue-soft: #EBF1FE;
  --r-sm: 10px; --r: 14px; --r-lg: 20px; --r-xl: 26px;
  --sh: 0 1px 2px rgba(17, 19, 24, .04), 0 1px 1px rgba(17, 19, 24, .02);
  --sh-lg: 0 24px 60px -24px rgba(17, 19, 24, .28), 0 2px 6px rgba(17, 19, 24, .05);
  --ease: cubic-bezier(.22, 1, .36, 1);
  --side: 252px;
  --font: "Inter", -apple-system, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  --display: "Inter Tight", "Inter", -apple-system, "SF Pro Display", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --plate: "Barlow Condensed", "Arial Narrow", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body.pk { min-height: 100vh; background: var(--bg); color: var(--ink); font: 400 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ic { width: 18px; height: 18px; flex: none; }
.ic--sm { width: 15px; height: 15px; } .ic--lg { width: 22px; height: 22px; }
:focus-visible { outline: 2.5px solid rgba(17, 19, 24, .35); outline-offset: 2px; border-radius: 6px; }

/* ---------- boot loader: the logo opens its barrier while data loads ---------- */
.boot { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: var(--bg); transition: opacity .5s var(--ease), visibility .5s; }
.boot.is-out { opacity: 0; visibility: hidden; }
.boot__in { display: flex; flex-direction: column; align-items: center; gap: 22px; }
.boot__mark { width: 76px; height: 76px; color: var(--ink); overflow: visible; }
.boot__mark .pk-arm--anim { transform-box: view-box; transform-origin: 21px 41px; transform: rotate(0deg); transition: transform 1s cubic-bezier(.65, 0, .25, 1); }
.boot__mark .pk-arm-base { fill: var(--red); transition: fill .45s ease .3s; }
.boot__mark .pk-arm-frame { stroke: var(--red); transition: stroke .45s ease .3s; }
.boot__mark .pk-core { transition: fill .45s ease .3s; }
.boot.is-open .boot__mark .pk-arm--anim { transform: rotate(-62deg); }
.boot.is-open .boot__mark .pk-arm-base { fill: var(--green); }
.boot.is-open .boot__mark .pk-arm-frame { stroke: var(--green); }
.boot.is-open .boot__mark .pk-core { fill: var(--green); }
.boot__bar { width: 140px; height: 3px; border-radius: 3px; background: var(--line); overflow: hidden; }
.boot__bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--ink); transition: width 1.1s var(--ease); }
.boot.is-open .boot__bar i { width: 100%; }
.boot__label { font: 500 12px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px; padding: 18px 14px; background: rgba(255, 255, 255, .78);
        border-right: 1px solid var(--line); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); }
.side__brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 16px; color: var(--ink); }
.side__brand .m { width: 30px; height: 30px; } .side__brand .w { height: 15px; width: auto; }
.side__ctx { display: flex; align-items: center; gap: 10px; padding: 10px; margin-bottom: 8px; border-radius: var(--r); background: var(--bg); border: 1px solid var(--line); text-align: left; width: 100%; }
.side__ctx b { display: block; font-size: 13px; line-height: 1.25; } .side__ctx small { display: block; font-size: 12px; color: var(--muted); }
.side__ctx .av { width: 34px; height: 34px; border-radius: 10px; font-size: 12px; }
.side__label { margin: 12px 10px 4px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { position: relative; display: flex; align-items: center; gap: 11px; height: 38px; padding: 0 10px; border-radius: 10px; font-weight: 500; color: var(--ink-2); transition: background .2s, color .2s; }
.nav a:hover { background: rgba(17, 19, 24, .04); color: var(--ink); }
.nav a.is-on { background: var(--ink); color: #fff; }
.nav a .ic { color: currentColor; opacity: .85; }
.nav a .cnt { margin-left: auto; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--line-2); color: var(--muted); font-size: 11.5px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }
.nav a.is-on .cnt { background: rgba(255, 255, 255, .16); color: #fff; }
.nav a .cnt--red { background: var(--red); color: #fff; }
.side__foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.side__user { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--r); }
.side__user b { display: block; font-size: 13px; } .side__user small { display: block; font-size: 12px; color: var(--muted); }
.demo-pill { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; padding: 4px 10px; border-radius: 99px; background: var(--amber-soft); color: #92400E; font-size: 11.5px; font-weight: 600; }

.main { min-width: 0; padding: 26px clamp(16px, 3vw, 40px) 60px; }
.top { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.top__title { margin: 0; font: 700 clamp(24px, 2.4vw, 30px)/1.15 var(--display); letter-spacing: -.025em; }
.top__sub { margin: 4px 0 0; color: var(--muted); }
.top__tools { display: flex; align-items: center; gap: 8px; }
.search { position: relative; display: flex; align-items: center; }
.search .ic { position: absolute; left: 12px; color: var(--faint); pointer-events: none; }
.search input { height: 40px; width: 240px; padding: 0 14px 0 38px; border-radius: 12px; border: 1px solid var(--line); background: #fff; outline: none; transition: border-color .2s, box-shadow .2s, width .3s var(--ease); }
.search input:focus { border-color: var(--ink); box-shadow: 0 0 0 4px rgba(17, 19, 24, .08); width: 280px; }
.iconbtn { position: relative; width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 12px; border: 1px solid var(--line); background: #fff; transition: border-color .2s; }
.iconbtn:hover { border-color: #C9CDD4; }
.iconbtn .dot { position: absolute; top: 8px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 2px #fff; }

/* ---------- primitives ---------- */
.grid { display: grid; gap: 16px; }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } .g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-21 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); } .g-12 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.mt { margin-top: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh); padding: 20px; min-width: 0; }
.card--flush { padding: 0; overflow: hidden; }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card__title { margin: 0; font: 650 15px/1.3 var(--display); letter-spacing: -.01em; }
.card__sub { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.card--flush .card__head { padding: 18px 20px 0; }
.link { font-size: 13px; font-weight: 600; color: var(--ink); display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; padding: 0; }
.link:hover { color: var(--red-ink); }

.kpi { display: flex; flex-direction: column; gap: 6px; }
.kpi__top { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 13px; font-weight: 500; }
.kpi__ico { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--bg); color: var(--ink-2); }
.kpi__val { font: 700 28px/1.1 var(--display); letter-spacing: -.025em; font-variant-numeric: tabular-nums; }
.kpi__val small { font-size: 15px; font-weight: 600; color: var(--faint); margin-left: 3px; }
.kpi__foot { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.up { color: var(--green); font-weight: 600; } .down { color: var(--red-ink); font-weight: 600; }
.kpi__spark { height: 34px; margin-top: 2px; }
.meter { height: 6px; border-radius: 6px; background: var(--line-2); overflow: hidden; } .meter i { display: block; height: 100%; border-radius: inherit; background: var(--ink); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 12px; border: 1px solid transparent; font-weight: 600; font-size: 14px; white-space: nowrap;
       transition: background .2s, border-color .2s, transform .15s, box-shadow .2s; }
.btn:active { transform: scale(.98); }
.btn--pri { background: var(--ink); color: #fff; } .btn--pri:hover { background: #000; }
.btn--sec { background: #fff; border-color: var(--line); color: var(--ink); } .btn--sec:hover { border-color: #C9CDD4; }
.btn--red { background: var(--red); color: #fff; } .btn--red:hover { background: var(--red-ink); }
.btn--green { background: var(--green); color: #fff; }
.btn--ghost { background: none; color: var(--ink-2); } .btn--ghost:hover { background: rgba(17, 19, 24, .05); }
.btn--sm { height: 32px; padding: 0 12px; border-radius: 10px; font-size: 13px; }
.btn--lg { height: 50px; padding: 0 22px; border-radius: 14px; font-size: 15px; }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn.is-busy { pointer-events: none; color: transparent !important; position: relative; }
.btn.is-busy::after { content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%; border: 2.2px solid rgba(255, 255, 255, .35); border-top-color: #fff; animation: spin .7s linear infinite; }
.btn--sec.is-busy::after { border-color: rgba(17, 19, 24, .15); border-top-color: var(--ink); }
@keyframes spin { to { transform: rotate(360deg); } }

.badge { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--line-2); color: var(--ink-2); }
.badge .ic { width: 13px; height: 13px; }
.b-green { background: var(--green-soft); color: #15803D; } .b-red { background: var(--red-soft); color: var(--red-ink); } .b-amber { background: var(--amber-soft); color: #B45309; }
.b-blue { background: var(--blue-soft); color: #1D4ED8; } .b-ink { background: var(--ink); color: #fff; } .b-violet { background: #F1EDFF; color: #6D28D9; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.dot--green { background: var(--green); box-shadow: 0 0 0 3px rgba(22, 163, 74, .15); } .dot--red { background: var(--red); box-shadow: 0 0 0 3px rgba(227, 38, 47, .15); }
.dot--amber { background: var(--amber); box-shadow: 0 0 0 3px rgba(217, 119, 6, .15); } .dot--grey { background: var(--faint); } .dot--blue { background: #2563EB; box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }
.dot--live { animation: live 1.6s ease-in-out infinite; } @keyframes live { 50% { opacity: .45; } }
.av { width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; flex: none; background: var(--ink); color: #fff; font-size: 12px; font-weight: 700; letter-spacing: .02em; }
.av--soft { background: var(--line-2); color: var(--ink-2); }

/* number plate */
.plate { display: inline-flex; align-items: stretch; height: 26px; border-radius: 5px; border: 1.5px solid #1F2937; background: #fff; overflow: hidden; font: 600 15px/1 var(--plate); letter-spacing: .03em; color: #111; white-space: nowrap; flex: none; }
.plate__b { width: 13px; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 2px; background: #1E40AF; color: #fff; font: 700 5.5px/1 var(--font); letter-spacing: 0; }
.plate__n { display: flex; align-items: center; padding: 0 7px 0 6px; }
.plate--lg { height: 40px; font-size: 24px; border-width: 2px; border-radius: 7px; } .plate--lg .plate__b { width: 20px; font-size: 8px; padding-bottom: 3px; } .plate--lg .plate__n { padding: 0 11px; }

/* table → cards on phones */
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; }
.tbl th { position: sticky; top: 0; z-index: 1; text-align: left; padding: 10px 14px; font-size: 12px; font-weight: 600; color: var(--muted); background: #FAFAFB; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background .15s; }
.tbl tbody tr.is-click { cursor: pointer; } .tbl tbody tr.is-click:hover { background: #FAFAFB; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl .who { display: flex; align-items: center; gap: 10px; min-width: 0; } .tbl .who b { display: block; font-weight: 600; } .tbl .who small { display: block; color: var(--muted); font-size: 12px; }
.tbl-wrap { overflow: auto; max-height: 640px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { height: 32px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line); background: #fff; font-size: 13px; font-weight: 600; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; }
.chip span { color: var(--faint); font-weight: 600; }
.chip.is-on { background: var(--ink); border-color: var(--ink); color: #fff; } .chip.is-on span { color: rgba(255, 255, 255, .6); }

.list { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-2); min-width: 0; }
.row:last-child { border-bottom: 0; }
.row__main { flex: 1; min-width: 0; } .row__main b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row__main small { display: block; color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row__end { display: flex; align-items: center; gap: 8px; flex: none; }
.snap { width: 64px; height: 40px; border-radius: 8px; object-fit: cover; background: var(--line-2); flex: none; }
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 36px 16px; color: var(--muted); }
.empty .ic { width: 28px; height: 28px; color: var(--faint); }

/* live camera tile */
.cam { position: relative; border-radius: var(--r); overflow: hidden; background: #0B0C0F; aspect-ratio: 16 / 10; isolation: isolate; }
.cam video, .cam img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cam::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0, 0, 0, .45), transparent 28%, transparent 70%, rgba(0, 0, 0, .55)); pointer-events: none; }
.cam__hud { position: absolute; z-index: 2; inset: 10px 12px; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; color: #fff; font: 500 11px/1 var(--mono); letter-spacing: .06em; }
.cam__row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cam__live { display: inline-flex; align-items: center; gap: 6px; padding: 4px 7px; border-radius: 6px; background: rgba(0, 0, 0, .45); backdrop-filter: blur(6px); }
.cam__live i { width: 7px; height: 7px; border-radius: 50%; background: var(--red); animation: live 1.2s ease-in-out infinite; }
.cam__off { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; background: repeating-linear-gradient(45deg, #15171C 0 10px, #111318 10px 20px); color: #9CA3AF; font: 600 12px/1 var(--mono); letter-spacing: .1em; }
.cam.is-loading::before { content: ""; position: absolute; inset: 0; z-index: 4; background: linear-gradient(100deg, #15171C 30%, #22252C 50%, #15171C 70%) 0 0 / 300% 100%; animation: shimmer 1.4s linear infinite; }

/* skeleton loaders */
.sk { position: relative; overflow: hidden; border-radius: 10px; background: #ECEDF0; }
.sk::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .7) 50%, transparent 70%) 0 0 / 300% 100%; animation: shimmer 1.3s linear infinite; }
@keyframes shimmer { from { background-position: 150% 0; } to { background-position: -50% 0; } }
.sk-line { height: 12px; margin: 8px 0; } .sk-big { height: 30px; width: 55%; margin: 6px 0 10px; }
.view { animation: viewIn .45s var(--ease) both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* charts (SVG built at runtime) */
.chart { width: 100%; height: 220px; display: block; overflow: visible; }
.chart text { font: 500 11px var(--font); fill: var(--faint); }
.chart .grid-l { stroke: var(--line-2); stroke-width: 1; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.5px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.tip { position: fixed; z-index: 80; pointer-events: none; padding: 8px 10px; border-radius: 10px; background: var(--ink); color: #fff; font-size: 12px; box-shadow: var(--sh-lg); transform: translate(-50%, calc(-100% - 10px)); white-space: nowrap; }

/* forms */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field > span em { font-style: normal; font-weight: 400; color: var(--faint); }
.inp { height: 44px; width: 100%; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: #FBFBFC; outline: none; transition: border-color .2s, box-shadow .2s, background .2s; font-size: 15px; }
.inp:focus { border-color: var(--ink); background: #fff; box-shadow: 0 0 0 4px rgba(17, 19, 24, .07); }
.inp.is-bad { border-color: var(--red); background: #FFF8F8; }
.inp--plate { font: 600 20px/1 var(--plate); letter-spacing: .08em; text-transform: uppercase; }
textarea.inp { height: auto; min-height: 90px; padding: 12px 14px; resize: vertical; }
select.inp { appearance: none; -webkit-appearance: none; background: #FBFBFC url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") right 12px center / 14px no-repeat; padding-right: 34px; }
.hint { font-size: 12.5px; color: var(--muted); } .err { font-size: 12.5px; font-weight: 600; color: var(--red-ink); }
.frm { display: grid; gap: 14px; } .frm-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tile { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 14px; border-radius: var(--r); border: 1.5px solid var(--line); background: #FBFBFC; text-align: left; transition: border-color .2s, background .2s, box-shadow .2s; }
.tile b { font-size: 14px; } .tile small { font-size: 12px; color: var(--muted); line-height: 1.35; }
.tile .ic { width: 22px; height: 22px; }
.tile.is-on { border-color: var(--ink); background: #fff; box-shadow: 0 10px 24px -16px rgba(17, 19, 24, .5); }
.tile.is-on::after { content: ""; position: absolute; top: 10px; right: 10px; width: 16px; height: 16px; border-radius: 50%; background: var(--ink) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / 10px no-repeat; }
.tile[disabled] { opacity: .45; cursor: not-allowed; }
.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: #EDEEF1; gap: 2px; }
.seg button { height: 32px; padding: 0 12px; border: 0; border-radius: 9px; background: none; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.seg button.is-on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(17, 19, 24, .12); }
.switch { position: relative; width: 44px; height: 26px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch i { position: absolute; inset: 0; border-radius: 99px; background: #D9DBE0; transition: background .2s; pointer-events: none; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); transition: transform .25s var(--ease); }
.switch input:checked + i { background: var(--green); } .switch input:checked + i::after { transform: translateX(18px); }

/* overlays: modal (desktop) = bottom sheet (phones), drawer, toast */
.ov { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px; background: rgba(17, 19, 24, .36); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: fade .25s ease both; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(560px, 100%); max-height: calc(100vh - 40px); overflow: auto; border-radius: var(--r-xl); background: #fff; box-shadow: var(--sh-lg); animation: pop .35s var(--ease) both; }
.modal--wide { width: min(760px, 100%); }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.98); } }
.modal__head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 12px; background: rgba(255, 255, 255, .94); backdrop-filter: blur(8px); }
.modal__title { margin: 0; font: 700 19px/1.2 var(--display); letter-spacing: -.02em; }
.modal__body { padding: 4px 20px 20px; }
.modal__foot { position: sticky; bottom: 0; display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line-2); background: #fff; }
.steps { display: flex; gap: 6px; margin: 0 0 18px; }
.steps i { flex: 1; height: 4px; border-radius: 4px; background: var(--line); transition: background .3s; } .steps i.is-on { background: var(--ink); }
.drawer-ov { place-items: stretch end; padding: 0; }
.drawer { width: min(520px, 100vw); height: 100%; overflow: auto; background: var(--bg); box-shadow: var(--sh-lg); animation: slide .4s var(--ease) both; }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
.drawer__head { position: sticky; top: 0; z-index: 2; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px; background: rgba(245, 245, 247, .92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.drawer__body { padding: 16px 20px 40px; display: flex; flex-direction: column; gap: 14px; }
.toasts { position: fixed; z-index: 90; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { display: inline-flex; align-items: center; gap: 10px; padding: 11px 16px; border-radius: 14px; background: var(--ink); color: #fff; font-weight: 500; box-shadow: var(--sh-lg); animation: toastIn .35s var(--ease) both; }
.toast .ic { color: #4ADE80; } .toast.is-bad .ic { color: #FCA5A5; }
.toast.is-out { animation: toastOut .3s ease both; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px) scale(.96); } } @keyframes toastOut { to { opacity: 0; transform: translateY(6px); } }

/* gate remote (resident + owner) */
.gate { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 24px 18px; text-align: center; }
.gate__btn { position: relative; width: 148px; height: 148px; border-radius: 50%; border: 0; background: var(--ink); color: #fff; display: grid; place-items: center;
             box-shadow: 0 0 0 12px rgba(17, 19, 24, .05), 0 24px 44px -18px rgba(17, 19, 24, .6); transition: transform .2s var(--ease), background .4s; }
.gate__btn .ic { width: 46px; height: 46px; stroke-width: 1.8; }
.gate__btn:active { transform: scale(.96); }
.gate__btn svg.ring { position: absolute; inset: -8px; width: calc(100% + 16px); height: calc(100% + 16px); transform: rotate(-90deg); pointer-events: none; }
.gate__btn svg.ring circle { fill: none; stroke: var(--green); stroke-width: 4; stroke-linecap: round; stroke-dasharray: 490; stroke-dashoffset: 490; }
.gate__btn.is-opening svg.ring circle { transition: stroke-dashoffset 1.4s var(--ease); stroke-dashoffset: 0; }
.gate__btn.is-open { background: var(--green); box-shadow: 0 0 0 12px rgba(22, 163, 74, .12), 0 24px 44px -18px rgba(22, 163, 74, .7); }
.gate__state { font: 600 15px/1.3 var(--display); }
.gate__meta { font-size: 13px; color: var(--muted); }

/* login (all three apps) */
.auth { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(400px, .85fr); min-height: 100vh; background: #0A0B0E; }
.auth__film { position: relative; overflow: hidden; isolation: isolate; color: #fff; display: flex; flex-direction: column; justify-content: space-between; padding: 34px clamp(24px, 4vw, 56px); }
.auth__film video, .auth__film img.bg { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; object-fit: cover; }
.auth__film::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(10, 11, 14, .55), rgba(10, 11, 14, .15) 35%, rgba(10, 11, 14, .35) 60%, rgba(10, 11, 14, .92)), radial-gradient(70% 60% at 0% 100%, rgba(227, 38, 47, .25), transparent 70%); }
.auth__brand { display: flex; align-items: center; gap: 12px; color: #fff; } .auth__brand .m { width: 40px; height: 40px; } .auth__brand .w { height: 19px; width: auto; }
.auth__pitch { max-width: 520px; }
.auth__kicker { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 99px; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .18); font-size: 12.5px; font-weight: 600; backdrop-filter: blur(10px); }
.auth__h { margin: 16px 0 10px; font: 700 clamp(30px, 3.4vw, 46px)/1.05 var(--display); letter-spacing: -.03em; }
.auth__p { margin: 0; font-size: 16px; line-height: 1.6; color: rgba(230, 235, 245, .8); }
.auth__panel { display: flex; flex-direction: column; justify-content: center; padding: 40px clamp(24px, 4vw, 64px); background: #fff; border-radius: 28px 0 0 28px; position: relative; }
.auth__form { width: 100%; max-width: 380px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.auth__form h1 { margin: 0; font: 700 28px/1.15 var(--display); letter-spacing: -.025em; }
.auth__form > p { margin: -8px 0 6px; color: var(--muted); }
.otp { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.otp input { height: 56px; width: 100%; text-align: center; border-radius: 14px; border: 1.5px solid var(--line); background: #FBFBFC; font: 700 22px/1 var(--display); outline: none; transition: border-color .2s, box-shadow .2s, transform .2s; }
.otp input:focus { border-color: var(--ink); box-shadow: 0 0 0 4px rgba(17, 19, 24, .08); background: #fff; }
.otp.is-bad input { border-color: var(--red); animation: shake .4s; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.demo-box { display: flex; gap: 10px; padding: 12px 14px; border-radius: 14px; background: var(--amber-soft); color: #78350F; font-size: 13px; line-height: 1.45; }
.demo-box .ic { color: #B45309; margin-top: 1px; }
.demo-box b { font-family: var(--mono); font-weight: 600; }
.auth__foot { display: flex; align-items: center; gap: 8px; justify-content: center; font-size: 12.5px; color: var(--faint); }
.auth__credit { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 6px 0 0; padding-top: 16px; border-top: 1px solid var(--line, #eceef2); font-size: 12px; letter-spacing: .01em; color: var(--faint); }
.auth__credit-m { width: 16px; height: 16px; flex: none; }
.auth__credit span { white-space: nowrap; }
.auth__switch { display: flex; gap: 8px; flex-wrap: wrap; }
.auth__switch button { flex: 1 1 100%; min-width: 0; height: auto; min-height: 36px; padding: 8px 12px; white-space: normal; text-align: left; justify-content: flex-start; line-height: 1.3; overflow-wrap: anywhere; }
.auth__ok { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; background: #fff; border-radius: inherit; opacity: 0; visibility: hidden; transition: opacity .4s var(--ease); }
.auth__ok.is-on { opacity: 1; visibility: visible; }

/* ---------- phones: bottom tab bar, cards instead of tables, sheets ---------- */
.tabbar { display: none; }
@media (max-width: 1100px) { .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-21, .g-12, .g-3 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .main { padding: 18px 16px calc(96px + env(safe-area-inset-bottom)); }
  .top { flex-direction: column; align-items: stretch; }
  .top__tools .search { flex: 1; } .search input, .search input:focus { width: 100%; }
  .tabbar { position: fixed; z-index: 50; left: 0; right: 0; bottom: 0; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
            background: rgba(255, 255, 255, .86); border-top: 1px solid var(--line); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 2px; min-height: 50px; justify-content: center; border-radius: 12px; font-size: 10.5px; font-weight: 600; color: var(--faint); }
  .tabbar a .ic { width: 22px; height: 22px; }
  .tabbar a.is-on { color: var(--ink); }
  .mtop { display: flex; align-items: center; justify-content: space-between; margin: -4px 0 14px; }
  .mtop .m { width: 30px; height: 30px; color: var(--ink); }
  .auth { grid-template-columns: 1fr; }
  .auth__film { min-height: 260px; padding: 22px 20px 28px; }
  .auth__h { font-size: 28px; margin-top: 12px; } .auth__p { font-size: 14px; }
  .auth__panel { border-radius: 26px 26px 0 0; margin-top: -26px; padding: 28px 20px 40px; }
  .frm-2 { grid-template-columns: 1fr; }
  .ov { place-items: end center; padding: 0; }
  .modal, .modal--wide { width: 100%; max-height: 92vh; border-radius: 24px 24px 0 0; animation: sheet .4s var(--ease) both; }
  @keyframes sheet { from { transform: translateY(40px); opacity: 0; } }
  .modal__foot { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .tbl--cards thead { display: none; }
  .tbl--cards, .tbl--cards tbody, .tbl--cards tr, .tbl--cards td { display: block; width: 100%; }
  .tbl--cards tr { padding: 12px 14px; border-bottom: 1px solid var(--line-2); }
  .tbl--cards td { padding: 3px 0; border: 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
  .tbl--cards td[data-l]::before { content: attr(data-l); font-size: 12px; color: var(--muted); font-weight: 500; }
  .tbl--cards td.num { text-align: right; }
  .tbl-wrap { max-height: none; }
  .toasts { bottom: calc(90px + env(safe-area-inset-bottom)); }
}
@media (min-width: 901px) { .mtop { display: none; } }
@media (max-width: 520px) { .g-4 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; } .card { padding: 16px; } .kpi__val { font-size: 23px; } .otp input { height: 50px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

.dn-v { font: 700 22px var(--display); fill: var(--ink); } .dn-l { font: 500 11px var(--font); fill: var(--faint); }

.mtop__brand { display: inline-flex; } .mtop__brand .m { width: 32px; height: 32px; color: var(--ink); }
.side__user .av { width: 34px; height: 34px; }
.hq-globe { position: relative; aspect-ratio: 1; max-height: 330px; margin: -6px auto -18px; overflow: hidden; }
.hq-globe .globe__canvas { width: 100%; height: 100%; opacity: 0; transition: opacity 1s var(--ease); cursor: grab; touch-action: pan-y; }
.hq-globe .globe__canvas.is-on { opacity: 1; }
@media (max-width: 700px) {
  .g-2 { grid-template-columns: minmax(0, 1fr); }
  .gate { padding: 18px 14px; gap: 10px; }
  .gate__btn { width: 120px; height: 120px; } .gate__btn .ic { width: 38px; height: 38px; }
}
.row__main b.wrap { white-space: normal; }

/* ---------- touch screens: every control is at least 40 px tall (thumbs, gloves, older eyes). Desktop is unchanged. ---------- */
@media (pointer: coarse), (max-width: 700px) {
  .chip, .seg button { height: 40px; min-width: 44px; justify-content: center; }
  .chips { gap: 8px; }
  .btn--sm { height: 40px; padding: 0 14px; }
  /* text links keep their look; padding + negative margin grows the tap area without moving anything */
  .link { padding: 10px 6px; margin: -10px -6px; min-height: 40px; }
  .tabbar a { font-size: 11.5px; }
}
