/* Anchor Admin. Light and dark follow the device. Chart colours are the ones already validated for Anchor's Insights. */
:root {
  --bg: #f6f5fb; --bg2: #ffffff; --card: #ffffff; --line: rgba(20, 18, 60, 0.09); --text: #15132b; --muted: #6a6884;
  --accent: #7c5cff; --accentSoft: rgba(124, 92, 255, 0.12); --base: #c9c6db; --good: #1fa971; --danger: #e5484d; --shadow: rgba(30, 20, 80, 0.08);
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #100e24; --bg2: #16132f; --card: #1b1838; --line: rgba(255, 255, 255, 0.08); --text: #f1effa; --muted: #a29fc0;
    --accent: #8f72ff; --accentSoft: rgba(143, 114, 255, 0.16); --base: #3a3660; --shadow: rgba(0, 0, 0, 0.35);
  }
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { font-family: var(--font); color: var(--text); background: var(--bg); min-height: 100vh; -webkit-font-smoothing: antialiased; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
[hidden] { display: none !important; }

.logo { flex: none; width: 34px; height: 34px; border-radius: 50%; background: conic-gradient(#ff8a3d, #7c5cff, #1e3a8a, #ff8a3d); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.5); }

/* ---------- Key screen ---------- */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.gate-card { width: min(400px, 100%); padding: 28px 24px; border-radius: 24px; background: var(--card); border: 1px solid var(--line); box-shadow: 0 30px 60px -30px var(--shadow); }
.gate-card .logo { width: 44px; height: 44px; margin-bottom: 16px; }
.gate-card h1 { font-size: 24px; font-weight: 800; letter-spacing: -0.5px; }
.gate-card > p { margin: 6px 0 18px; font-size: 14px; line-height: 1.5; color: var(--muted); }
.field { display: block; }
.field span { display: block; margin: 0 2px 6px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; color: var(--muted); }
.field input { width: 100%; height: 48px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg2); outline: 0; font-size: 15px; }
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accentSoft); }
.check { display: flex; align-items: center; gap: 8px; margin-top: 14px; font-size: 14px; color: var(--muted); cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.err { margin-top: 12px; padding: 10px 12px; border-radius: 12px; font-size: 13.5px; font-weight: 600; color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); }
.gate-card .btn.primary { width: 100%; height: 50px; margin-top: 18px; }

/* ---------- Buttons ---------- */
.btn { height: 40px; padding: 0 16px; border-radius: 12px; font-size: 14px; font-weight: 700; background: var(--card); border: 1px solid var(--line); }
.btn:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.btn.primary { color: #fff; border: 0; background: linear-gradient(135deg, #ff8a3d, #7c5cff 65%, #1e3a8a); }
.btn.ghost { background: transparent; }
.btn.danger { color: #fff; border: 0; background: var(--danger); }
.btn.small { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn:disabled { opacity: 0.6; cursor: default; }

/* ---------- Dashboard ---------- */
.dash { max-width: 1200px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 22px) 16px calc(env(safe-area-inset-bottom) + 32px); }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand h1 { font-size: 22px; font-weight: 800; letter-spacing: -0.5px; }
.brand p { font-size: 13px; color: var(--muted); }
.top-actions { display: flex; gap: 8px; }

.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 20px; }
.tile { padding: 16px; border-radius: 20px; background: var(--card); border: 1px solid var(--line); }
.tile-label { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 700; color: var(--muted); }
.tile b { display: block; margin-top: 6px; font-size: 34px; font-weight: 800; letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.tile small { font-size: 12px; color: var(--muted); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 0 color-mix(in srgb, var(--good) 60%, transparent); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

.panel { margin-top: 22px; }
.panel-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.panel-head h2 { font-size: 18px; font-weight: 800; letter-spacing: -0.3px; }
.panel-head .sub { width: 100%; font-size: 13px; color: var(--muted); }
.search { width: min(320px, 100%); height: 40px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); outline: 0; font-size: 14px; }
.search:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accentSoft); }

.users { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); gap: 12px; }
.user { padding: 16px; border-radius: 20px; background: var(--card); border: 1px solid var(--line); }
.user-head { display: flex; align-items: flex-start; gap: 10px; }
.user-id { flex: 1; min-width: 0; }
.user-name { font-size: 16px; font-weight: 800; overflow-wrap: anywhere; }
.tag { display: inline-block; margin-left: 6px; padding: 2px 7px; border-radius: 99px; font-size: 11.5px; font-weight: 800; letter-spacing: 0.4px; color: #fff; background: linear-gradient(135deg, #7c5cff, #1e3a8a); vertical-align: 1px; font-variant-numeric: tabular-nums; }
.user-email { margin-top: 2px; font-size: 13.5px; color: var(--muted); overflow-wrap: anywhere; }
.status { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; color: var(--muted); background: color-mix(in srgb, var(--muted) 12%, transparent); }
.status.on { color: var(--good); background: color-mix(in srgb, var(--good) 13%, transparent); }
.status.on::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--good); }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin-top: 14px; }
.facts div { min-width: 0; }
.facts small { display: block; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px; color: var(--muted); }
.facts span { display: block; margin-top: 2px; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.hours { margin-top: 14px; }
.hours-head { display: flex; justify-content: space-between; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px; color: var(--muted); }
.hours svg { display: block; width: 100%; height: 54px; margin-top: 6px; overflow: visible; }
.hours .bar { fill: var(--accent); }
.hours .bar.zero { fill: var(--base); }
.hours .hit { fill: transparent; cursor: default; }
.hours .base { stroke: var(--line); stroke-width: 1; }
.hours-axis { display: flex; justify-content: space-between; margin-top: 4px; font-size: 11px; color: var(--muted); }
.user-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
.btn.remove { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); background: transparent; }
.empty { padding: 28px; border-radius: 20px; text-align: center; color: var(--muted); background: var(--card); border: 1px dashed var(--line); }

.blocked { display: grid; gap: 8px; }
.blocked-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); }
.blocked-row b { display: block; font-size: 14.5px; overflow-wrap: anywhere; }
.blocked-row small { font-size: 12.5px; color: var(--muted); }
.foot { margin-top: 26px; font-size: 12.5px; line-height: 1.5; color: var(--muted); text-align: center; }

/* ---------- Pop-ups ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgba(10, 8, 30, 0.5); }
.modal-card { width: min(420px, 100%); padding: 22px; border-radius: 22px; background: var(--card); border: 1px solid var(--line); box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.5); }
.modal-card h3 { font-size: 19px; font-weight: 800; }
.modal-card p { margin-top: 8px; font-size: 14px; line-height: 1.5; color: var(--muted); }
.modal-row { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.tip { position: fixed; z-index: 60; pointer-events: none; padding: 7px 10px; border-radius: 10px; font-size: 12.5px; font-weight: 600; color: var(--text); background: var(--card); border: 1px solid var(--line); box-shadow: 0 10px 24px -8px var(--shadow); white-space: nowrap; }
.toast { position: fixed; z-index: 70; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); padding: 12px 16px; border-radius: 14px; font-size: 14px; font-weight: 600; color: #f4eff4; background: #2b2840; box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5); }

@media (max-width: 800px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 380px) { .users { grid-template-columns: 1fr; } .tile b { font-size: 28px; } }
