/* Executive Slate — dark theme, matching the AmeeraTel HRIS console.
   Deep slate-navy canvas, elevated card surfaces, brand-cyan accent. */
:root {
  --bg: hsl(224 33% 8%);          /* app canvas */
  --map-bg: hsl(224 32% 6%);      /* floor map backdrop (darkest) */
  --panel: hsl(222 27% 12%);      /* cards / bars / sidebar */
  --panel-2: hsl(222 22% 16%);    /* raised: stat cards, inputs */
  --ink: hsl(210 30% 96%);
  --muted: hsl(215 18% 62%);
  --line: hsl(222 18% 22%);
  --line-2: hsl(222 16% 30%);
  --brand: hsl(195 80% 56%);      /* AmeeraTel cyan #1cb2e3 */
  --brand-ink: hsl(222 47% 11%);
  --danger: hsl(0 70% 60%);

  /* Seat states (consumed by app.js too) */
  --avail: hsl(220 16% 26%);      /* empty desk fill */
  --avail-stroke: hsl(218 13% 42%);
  --res: hsl(38 92% 58%);         /* reserved accent */
  --maint: hsl(220 12% 38%);

  --radius: 0.75rem;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system,
    "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--ink); font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
h1, h2, h3 { letter-spacing: -0.01em; }

button {
  cursor: pointer; font: inherit; border-radius: 9px; color: var(--ink);
  border: 1px solid var(--line-2); background: var(--panel-2); padding: 7px 12px;
  transition: background .15s, border-color .15s, transform .05s;
}
button:hover { border-color: var(--brand); }
button:active { transform: translateY(1px); }
button.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); font-weight: 600; }
button.primary:hover { filter: brightness(1.08); }
button.danger { background: transparent; color: var(--danger); border-color: hsl(0 50% 32%); }
button.danger:hover { background: hsl(0 60% 16%); border-color: var(--danger); }
button.ghost { border: none; background: transparent; color: var(--muted); }
button.ghost:hover { color: var(--ink); }
button.mini { padding: 3px 9px; font-size: 12px; }

input, select, textarea {
  background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 9px;
  color: var(--ink); font: inherit; padding: 8px 10px; outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px hsl(195 80% 56% / .18);
}
input::placeholder { color: hsl(215 14% 48%); }
.error { color: var(--danger); min-height: 16px; font-size: 13px; margin: 6px 0 0; }

/* ---- Login ---- */
.login-overlay {
  position: fixed; inset: 0; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(1100px 700px at 16% -10%, hsl(195 80% 22% / .45), transparent 60%),
    radial-gradient(900px 600px at 105% 120%, hsl(222 60% 22% / .55), transparent 60%),
    hsl(224 38% 6%);
}
.login-shell {
  width: min(940px, 100%); display: grid; grid-template-columns: 1.05fr 1fr;
  background: var(--panel); border: 1px solid var(--line); border-radius: 22px;
  overflow: hidden; box-shadow: 0 40px 120px rgb(0 0 0 / .6);
  animation: login-rise .5s cubic-bezier(.2, .7, .2, 1) both;
}
@keyframes login-rise {
  from { opacity: 0; transform: translateY(14px) scale(.99); }
  to { opacity: 1; transform: none; }
}

/* Brand side */
.login-brand {
  position: relative; padding: 40px 38px; display: flex; flex-direction: column;
  gap: 26px; overflow: hidden; border-right: 1px solid var(--line);
  background:
    radial-gradient(620px 320px at -10% 0%, hsl(195 85% 30% / .45), transparent 70%),
    linear-gradient(160deg, hsl(222 35% 14%), hsl(224 42% 9%));
}
.login-logo { height: 40px; width: auto; align-self: flex-start; filter: drop-shadow(0 3px 10px rgb(0 0 0 / .45)); }
.login-form-logo { display: none; }
.login-brand-mid h1 { font-size: 34px; line-height: 1.08; margin: 0 0 14px; font-weight: 800; letter-spacing: -.02em; }
.login-brand-mid p { color: var(--muted); margin: 0 0 24px; max-width: 34ch; line-height: 1.55; }
.login-points { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 11px; }
.login-points li { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 12px; }
.login-points li span {
  color: var(--brand); font-weight: 700; font-variant-numeric: tabular-nums; min-width: 40px;
  text-align: center; background: hsl(195 80% 56% / .12); border: 1px solid hsl(195 80% 56% / .3);
  border-radius: 7px; padding: 2px 0; font-size: 12px;
}
.login-brand-foot { margin-top: auto; color: hsl(215 14% 44%); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }
.seat-motif {
  position: absolute; right: -30px; bottom: -26px; width: 280px; height: 210px;
  opacity: .55; pointer-events: none;
  background-image: radial-gradient(hsl(195 80% 60%) 1.4px, transparent 1.7px);
  background-size: 16px 22px;
  -webkit-mask-image: linear-gradient(135deg, transparent 28%, #000 92%);
  mask-image: linear-gradient(135deg, transparent 28%, #000 92%);
}

/* Form side */
.login-form { padding: 42px 40px; display: flex; flex-direction: column; gap: 16px; background: var(--panel); }
.login-form-head h2 { margin: 0 0 5px; font-size: 24px; letter-spacing: -.01em; }
.login-form-head p { margin: 0; color: var(--muted); }
.field { display: flex; flex-direction: column; gap: 7px; }
.field-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.field-wrap { position: relative; display: flex; align-items: center; }
.field-ic { position: absolute; left: 13px; width: 18px; height: 18px; color: hsl(215 14% 50%); pointer-events: none; transition: color .15s; }
.field-wrap:focus-within .field-ic { color: var(--brand); }
.field-wrap input {
  width: 100%; padding: 12px 42px 12px 42px; border-radius: 11px; background: var(--panel-2);
  border: 1px solid var(--line-2); color: var(--ink); font-size: 14px;
}
.field-wrap input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px hsl(195 80% 56% / .18); }
.field-btn { position: absolute; right: 7px; background: transparent; border: none; color: var(--muted); padding: 7px; display: flex; }
.field-btn:hover { color: var(--ink); background: transparent; border: none; }
.field-btn svg { width: 18px; height: 18px; }
.login-submit {
  margin-top: 6px; padding: 13px; border-radius: 11px; border: none; cursor: pointer;
  background: linear-gradient(180deg, hsl(195 85% 60%), hsl(199 86% 47%)); color: hsl(222 47% 10%);
  font-weight: 700; font-size: 15px; box-shadow: 0 10px 26px -8px hsl(195 80% 50% / .6);
  transition: transform .06s, filter .15s, box-shadow .15s;
}
.login-submit:hover { filter: brightness(1.06); box-shadow: 0 16px 32px -8px hsl(195 80% 50% / .72); }
.login-submit:active { transform: translateY(1px); }
.login-foot {
  display: flex; align-items: center; justify-content: center; gap: 8px; margin: 4px 0 0;
  color: hsl(215 14% 46%); font-size: 12px;
}
.login-foot svg { width: 14px; height: 14px; flex-shrink: 0; }

/* ---- Shell ---- */
.app { height: 100vh; height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 20px; padding: 11px 18px;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.nav-toggle { display: none; background: var(--panel-2); border: 1px solid var(--line-2); color: var(--ink); font-size: 17px; line-height: 1; padding: 7px 11px; border-radius: 9px; flex-shrink: 0; }
.nav-toggle:hover { border-color: var(--brand); }
.nav-backdrop { display: none; }
.brand { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.brand-logo { height: 42px; width: auto; display: block; flex-shrink: 0; object-fit: contain; }
.brand-divider { width: 1px; height: 28px; background: var(--line-2); }
.brand-text { font-weight: 700; font-size: 16px; letter-spacing: -.01em; }
.brand-text small { color: var(--muted); font-weight: 500; font-size: 13px; }
.site-picker {
  flex-shrink: 0; padding: 8px 12px; border-radius: 9px; background: var(--panel-2);
  border: 1px solid var(--line-2); color: var(--ink); font: inherit; font-weight: 600;
  max-width: 220px; cursor: pointer;
}
.site-picker:hover { border-color: var(--brand); }
/* Single-site: shown as a readable label (not greyed) until a 2nd site exists. */
.site-picker:disabled { opacity: 1; cursor: default; color: var(--ink); -webkit-text-fill-color: var(--ink); }
.stat-cards { display: flex; gap: 9px; flex: 1; flex-wrap: nowrap; overflow-x: auto; }
.stat-card {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 11px;
  padding: 6px 13px; min-width: 78px; flex-shrink: 0;
}
.stat-card b { display: block; font-size: 19px; font-variant-numeric: tabular-nums; }
.stat-card small { color: var(--muted); white-space: nowrap; }
.topbar-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.search input { border-radius: 20px; width: 220px; }
.who { color: var(--muted); font-size: 13px; }

.main { flex: 1; display: flex; min-height: 0; }

/* ---- Sidebar ---- */
.sidebar { width: 264px; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.sidebar-scroll { flex: 1; overflow-y: auto; padding: 16px; min-height: 0; }

/* Account footer pinned to the bottom of the sidebar */
.sidebar-account { border-top: 1px solid var(--line); padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.account-chip { display: flex; align-items: center; gap: 10px; padding: 2px 2px 4px; }
.account-avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  background: var(--brand); color: var(--brand-ink); display: grid; place-items: center;
  font-weight: 700; text-transform: uppercase; font-size: 15px;
}
.account-meta { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.account-meta b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-meta small { color: var(--muted); text-transform: capitalize; font-size: 12px; }
.account-admin, .account-actions { display: flex; gap: 8px; }
.account-admin button, .account-actions button { padding: 7px 8px; white-space: nowrap; }
.account-admin button { flex: 1; }            /* Manage sites / users: equal halves */
.account-actions #change-pass { flex: 1; }    /* takes remaining width, stays one line */
.account-actions #logout { flex: 0 0 auto; }  /* sized to "Sign out" */
.gauge-wrap { position: relative; width: 152px; height: 152px; margin: 4px auto 18px; }
.gauge { width: 100%; height: 100%; border-radius: 50%; background: conic-gradient(var(--brand) 0deg, var(--avail) 0deg); }
.gauge::after { content: ""; position: absolute; inset: 17px; background: var(--panel); border-radius: 50%; box-shadow: inset 0 0 0 1px var(--line); }
.gauge-label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.gauge-label span { font-size: 30px; font-weight: 700; }
.gauge-label small { color: var(--muted); display: block; }
.floor-list { display: flex; flex-direction: column; gap: 3px; margin: 0 0 18px; }
.floor-list:empty { display: none; }
.floor-list-title { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 3px; }
.floor-row { display: flex; justify-content: space-between; align-items: center; gap: 10px;
  font-size: 12.5px; color: var(--muted); padding: 5px 9px; border-radius: 8px; border: 1px solid var(--line); }
.floor-row b { color: var(--ink); font-variant-numeric: tabular-nums; }
.floor-row.active { background: hsl(195 80% 56% / .12); border-color: hsl(195 80% 56% / .35); color: var(--ink); }
.legend { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; font-size: 12px; color: var(--muted); margin-bottom: 18px; }
.legend i.sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; border: 1px solid var(--line-2); }
.sw.avail { background: var(--avail); }
.sw.occ { background: var(--brand); }
.sw.res { background: var(--res); }
.sw.maint { background: repeating-linear-gradient(45deg, var(--maint) 0 2px, transparent 2px 5px), var(--panel-2); }
.clients-head { display: flex; justify-content: space-between; align-items: center; }
.clients-head h2 { font-size: 14px; margin: 8px 0; }
.client-list { list-style: none; margin: 0; padding: 0; }
.client-list li { display: flex; align-items: center; gap: 9px; padding: 8px; border-radius: 9px; cursor: pointer; border: 1px solid transparent; }
.client-list li:hover { background: var(--panel-2); }
.client-edit {
  padding: 2px 7px; font-size: 12px; line-height: 1.4; opacity: 0; flex-shrink: 0;
  background: transparent; border-color: transparent; color: var(--muted);
}
.client-list li:hover .client-edit { opacity: 1; }
.client-edit:hover { color: var(--brand); border-color: var(--line-2); }
.client-list li.active { background: hsl(195 80% 56% / .14); border-color: hsl(195 80% 56% / .4); }
.client-list .dot { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; box-shadow: 0 0 0 1px rgb(0 0 0 / .3); }
.client-list .cname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.client-list .ccount { color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---- Map ---- */
.map-wrap { flex: 1; display: flex; flex-direction: column; min-width: 0; position: relative; }
.map-toolbar { display: flex; align-items: center; gap: 8px; padding: 9px 14px; border-bottom: 1px solid var(--line); background: var(--panel); }
.map-count { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }
#floor { flex: 1; width: 100%; background:
  radial-gradient(900px 700px at 70% 20%, hsl(222 30% 11%), var(--map-bg)); touch-action: none; }
/* Floor-plan layer: walls + room labels, drawn behind the desks. Inert so it
   never intercepts desk clicks, panning, or rubber-band selection. */
.fp, .fp * { pointer-events: none; }
.fp-outline { fill: hsl(217 26% 10% / .5); stroke: var(--line-2); stroke-width: 2.4; stroke-linejoin: round; }
.fp-wall { stroke: #ffffff; stroke-width: 1.4; stroke-linecap: round; opacity: .92; }
.fp-post { fill: hsl(220 20% 17%); stroke: #ffffff; stroke-width: 1; opacity: .95; }
.fp-furn { fill: hsl(220 16% 24% / .55); stroke: hsl(220 14% 52%); stroke-width: 1; opacity: .9; }
.fp-post-label { fill: #cdd6e6; font-size: 4.6px; font-weight: 700; letter-spacing: .3px;
  text-anchor: middle; dominant-baseline: middle; }
.fp-room { fill: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .6px;
  text-anchor: middle; dominant-baseline: middle; text-transform: uppercase; opacity: .7;
  /* dark halo so labels stay readable where they sit over desks */
  paint-order: stroke; stroke: hsl(217 28% 7%); stroke-width: 2px; stroke-linejoin: round; }

.desk { stroke: var(--avail-stroke); stroke-width: 0.6; cursor: pointer; transition: opacity .12s; }
.desk:hover { stroke: var(--ink); stroke-width: 1.6; }
.desk.dim { opacity: 0.1; }
.desk.reserved { stroke: var(--res); stroke-dasharray: 3 2; stroke-width: 1.2; }
.desk.sel { stroke: var(--brand); stroke-width: 2.4; }
.desk.picked { stroke: #ffffff; stroke-width: 2.6; }
#floor.selecting, #floor.adding { cursor: crosshair; }
#floor.selecting .desk:hover { stroke: #fff; }
#floor.panning { cursor: grabbing; }
#band-rect {
  fill: hsl(195 80% 56% / .15); stroke: var(--brand); stroke-width: 1.5;
  stroke-dasharray: 5 3; vector-effect: non-scaling-stroke; pointer-events: none;
}
#select-mode.active, #add-desk.active { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }

.select-bar {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; z-index: 20; flex-wrap: nowrap;
  max-width: calc(100% - 24px);
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 12px;
  padding: 10px 14px; box-shadow: 0 18px 50px rgb(0 0 0 / .55);
}
/* Buttons/input never shrink (so labels stay on one line); the hint ellipsizes. */
.select-bar button, .select-bar input { flex-shrink: 0; white-space: nowrap; }
.select-bar #select-count { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; flex-shrink: 0; }
.select-bar .select-hint {
  color: var(--muted); font-size: 12px; white-space: nowrap; border-right: 1px solid var(--line-2);
  padding-right: 10px; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex-shrink: 1;
}
.select-bar input { width: 170px; padding: 7px 10px; }
.wks-label { font-size: 4px; fill: hsl(210 25% 82%); pointer-events: none; text-anchor: middle; }

/* ---- Drawer ---- */
.drawer {
  position: fixed; top: 0; right: 0; height: 100vh; width: 366px; background: var(--panel);
  border-left: 1px solid var(--line); box-shadow: -20px 0 60px rgb(0 0 0 / .5);
  display: flex; flex-direction: column; z-index: 50;
}
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 16px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { margin: 0; }
.drawer-body { padding: 16px; overflow-y: auto; flex: 1; }
.drawer-body label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); margin-bottom: 13px; }
.drawer-body input:disabled { opacity: .6; }
.drawer-actions { display: flex; gap: 10px; padding: 14px 16px; border-top: 1px solid var(--line); }
.drawer-actions .primary { flex: 1; }
.drawer-history { padding: 12px 16px; border-top: 1px solid var(--line); max-height: 180px; overflow-y: auto; }
.drawer-history h3 { font-size: 12px; color: var(--muted); margin: 0 0 8px; text-transform: uppercase; letter-spacing: .05em; }
.drawer-history ul { list-style: none; margin: 0; padding: 0; font-size: 12px; }
.drawer-history li { padding: 6px 0; border-bottom: 1px solid var(--line); color: var(--muted); }
.drawer-history b { color: var(--ink); }

/* Role-based visibility:
   .can-edit  -> admin + editor (seat-map / client controls); hidden for viewers
   .admin-only -> admin only (user management) */
body.role-viewer .can-edit { display: none !important; }
body:not(.role-admin) .admin-only { display: none !important; }

/* ---- Manage users modal ---- */
.users-card { width: 480px; max-width: 92vw; gap: 0; }
.users-head { display: flex; justify-content: space-between; align-items: center; }
.users-head h2 { margin: 0; }
.users-note { color: var(--muted); font-size: 12px; margin: 6px 0 10px; line-height: 1.5; }
.users-note b { color: var(--ink); font-weight: 600; }
.users-list { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 8px; max-height: 320px; overflow-y: auto; }
.users-list li { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; }
.users-list .u-name { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.users-list .u-name small { color: var(--muted); font-weight: 500; margin-left: 6px; }
.users-list .u-you { color: var(--muted); font-weight: 400; font-size: 12px; margin-left: 6px; }
.users-list select.u-role-sel { padding: 5px 8px; font-size: 13px; }
.u-reset, .u-del { padding: 4px 9px; font-size: 12px; }
.u-del { color: var(--danger); border-color: hsl(0 50% 32%); }
.u-del:hover { background: hsl(0 60% 16%); border-color: var(--danger); }
.u-del:disabled { opacity: .35; cursor: not-allowed; }
.user-add { border-top: 1px solid var(--line); padding-top: 14px; }
.user-add h3 { margin: 0 0 10px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.user-add-row { display: flex; gap: 8px; flex-wrap: wrap; }
.user-add-row input { flex: 1; min-width: 120px; }

/* ---- Manage sites modal ---- */
.sites-card { width: 540px; max-width: 94vw; }
.sites-list { list-style: none; margin: 12px 0 16px; padding: 0; display: flex; flex-direction: column; gap: 8px; max-height: 320px; overflow-y: auto; }
.sites-list li { display: flex; align-items: center; gap: 8px; padding: 9px 11px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; }
.sites-list .s-name { flex: 1; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sites-list .s-name small { color: var(--muted); font-weight: 500; margin-left: 6px; }
.sites-list .s-name .s-inactive { color: var(--res); font-weight: 500; margin-left: 6px; font-size: 12px; }
.sites-list .s-count { color: var(--muted); font-size: 12px; min-width: 64px; text-align: right; font-variant-numeric: tabular-nums; }
.sites-list .s-import { cursor: pointer; }
.s-edit, .s-del, .s-import-btn { padding: 4px 9px; font-size: 12px; }
.s-del { color: var(--danger); border-color: hsl(0 50% 32%); }
.s-del:hover { background: hsl(0 60% 16%); border-color: var(--danger); }
.site-add-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.site-add-grid input { width: 100%; }

/* ---- Manage zones modal ---- */
.zones-card { width: 470px; max-width: 92vw; }
.zones-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; max-height: 360px; overflow-y: auto; }
.zones-list li { display: flex; align-items: center; gap: 8px; }
.zones-list .z-name { flex: 1; }
.zones-list .z-count { color: var(--muted); font-size: 12px; min-width: 70px; text-align: right; }
.z-save { padding: 7px 13px; }
.z-save:disabled { opacity: .4; cursor: not-allowed; border-color: transparent; }

/* ---- Modal (add client) ---- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center;
  background: rgb(3 6 12 / .66); backdrop-filter: blur(2px);
}
.modal-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  padding: 22px; width: 360px; max-width: 92vw; max-height: 90vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 12px;
  box-shadow: 0 30px 80px rgb(0 0 0 / .55);
}
.modal-card h2 { margin: 0 0 4px; font-size: 18px; }
.modal-card label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); }
.modal-card label .opt { color: hsl(215 14% 42%); }
.swatches { display: grid; grid-template-columns: repeat(9, 1fr); gap: 7px; }
.swatches .sw {
  width: 100%; aspect-ratio: 1; border-radius: 7px; cursor: pointer;
  border: 2px solid transparent; box-shadow: inset 0 0 0 1px rgb(0 0 0 / .35);
}
.swatches .sw.sel { border-color: var(--ink); transform: scale(1.08); }
.color-custom { display: flex; align-items: center; gap: 10px; }
.color-custom input[type="color"] {
  width: 40px; height: 32px; padding: 2px; border-radius: 8px; background: var(--panel-2);
  border: 1px solid var(--line-2); cursor: pointer;
}
.color-custom .hex { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; }
.preview-chip { margin-left: auto; display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); }
.preview-chip i { width: 14px; height: 14px; border-radius: 4px; display: inline-block; box-shadow: inset 0 0 0 1px rgb(0 0 0 / .35); }
.modal-actions { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.modal-actions .left-actions { margin-right: auto; display: flex; gap: 8px; }
.modal-actions #c-delete:disabled { opacity: .4; cursor: not-allowed; border-color: transparent; background: transparent; }
.modal-actions #c-delete:disabled:hover { background: transparent; }
.warn-btn { background: transparent; color: var(--res); border-color: hsl(38 60% 32%); }
.warn-btn:hover { background: hsl(38 60% 14%); border-color: var(--res); }
.hint-note { color: var(--muted); font-size: 12px; margin: 2px 0 0; min-height: 0; }
.hint-note.warn { color: var(--res); }

/* ---- Mobile (≤760px) ----
   Kept at the end of the file so these overrides win over the base component
   rules above. Media queries don't add specificity, so an equal-specificity
   base rule placed later in the source would otherwise defeat them (which is
   exactly what hid .nav-toggle and broke the drawer on phones). */
@media (max-width: 760px) {
  /* ---- Login ---- */
  .login-shell { grid-template-columns: 1fr; width: min(420px, 100%); }
  .login-brand { display: none; }
  .login-form-logo { display: block; height: 36px; width: auto; max-width: 70%; object-fit: contain; align-self: center; margin-bottom: 10px; }

  /* ---- Inner app ---- */
  .nav-toggle { display: inline-flex; align-items: center; }
  .topbar { gap: 8px; padding: 8px 10px; flex-wrap: wrap; }
  .brand-divider, .brand-text { display: none; }
  .brand-logo { height: 28px; }
  .site-picker { max-width: 40vw; padding: 7px 9px; }
  .topbar-right { order: 2; flex: 1; }
  .search { flex: 1; }
  .search input { width: 100%; }
  .stat-cards { order: 3; flex-basis: 100%; }   /* counts drop to their own scroll row */

  /* Sidebar becomes a slide-in drawer over the map */
  .sidebar {
    position: fixed; top: 0; left: 0; height: 100vh; height: 100dvh;
    width: 84vw; max-width: 300px;
    z-index: 60; transform: translateX(-100%); transition: transform .25s ease;
    box-shadow: 12px 0 44px rgb(0 0 0 / .6);
  }
  .sidebar.open { transform: translateX(0); }
  .nav-backdrop { display: block; position: fixed; inset: 0; background: rgb(0 0 0 / .55); z-index: 55; }
  .nav-backdrop.hidden { display: none; }

  /* Desk drawer + map fill the screen */
  .drawer { width: 100%; }
  .map-toolbar { flex-wrap: wrap; row-gap: 6px; }
  .site-add-grid { grid-template-columns: 1fr; }
  .select-bar { left: 8px; right: 8px; transform: none; flex-wrap: wrap; row-gap: 8px; }
}
