/* SMART — off-white canvas, white cards, monochrome neutrals + a dark-grey accent.
   Inter for UI, Space Grotesk for display.
   Pill buttons (20px), 8px cards, minimal shadows. Mobile-first → desktop. */
:root {
  /* neutrals */
  --bg: #efefef;            /* Mist canvas */
  --surface: #ffffff;       /* Paper */
  --fog: #f5f5f5;           /* inset */
  --chalk: #e8e8e8;         /* dividers / soft fills */
  --ink: #202020;           /* Carbon */
  --muted: #4d4d4d;         /* Graphite */
  --slate: #828282;         /* Slate */
  --line: #e3e3e3;
  --line-strong: #cfcfcf;

  --accent: #3f4147;        /* Dark grey — accents / active states */
  --accent-soft: #e7e8ea;   /* light grey tint */

  /* semantic (kept light/tinted for clarity) */
  --ok: #2f8f5b;  --ok-bg: #e7f3ec;
  --warn: #b5651f; --warn-bg: #fbeadb;
  --red: #c0392b;  --red-bg: #fae8e6;
  --blue: #3a6ea5; --blue-bg: #e8eff6;

  --radius: 8px;
  --radius-pill: 22px;
  --shadow: 0 1px 3px rgba(32,32,32,.05), 0 4px 12px rgba(32,32,32,.035);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);

  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --display: 'Space Grotesk', 'Inter', sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--sans); background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.45; }
h1, h2, h3, .display { font-family: var(--display); font-weight: 600; letter-spacing: -0.02em; }
h1 { font-size: 1.7rem; margin: 0; line-height: 1.1; }
h2 { font-size: 1.2rem; margin: 0; }
h3 { font-size: 1rem; margin: 0; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
svg { display: block; }

/* ── Login gate (split screen) ──────────────────────────────── */
.login-gate { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--bg); z-index: 100; padding: 20px; }
.login-split { display: flex; width: 100%; max-width: 940px; min-height: 560px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; box-shadow: var(--shadow); }
.login-hero { flex: 1; background: linear-gradient(155deg, #1b1b1b 45%, #34363b 90%, #52555b 130%); color: #fff; padding: 40px; display: flex; flex-direction: column; }
.login-hero-brand { font-family: var(--display); font-weight: 700; font-size: 1.4rem; letter-spacing: -.03em; }
.login-hero-brand span { color: #c9cdd4; }
/* Trimmed white-on-transparent brand logos, arranged in a triangle. */
.brand-logo-wrap { display: flex; align-items: center; justify-content: center; margin: auto 0; }
.brand-logo { display: block; height: auto; width: auto; max-height: 110px; max-width: 72%; object-fit: contain; }
.login-values { margin: auto 0 0; }
.login-values-kicker { font-family: var(--display); font-weight: 700; font-size: 2rem; line-height: 1; letter-spacing: -.02em; margin: 0 0 24px; }
.time-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 18px; }
.time-list li { display: flex; align-items: center; gap: 16px; }
.time-letter { font-family: var(--display); font-weight: 700; font-size: 2.1rem; line-height: 1; color: var(--accent); width: 32px; text-align: center; flex: none; }
.time-word { font-size: 1rem; font-weight: 500; letter-spacing: .01em; color: rgba(255,255,255,.92); }
.login-hero-sub { margin-top: 16px; color: rgba(255,255,255,.6); font-size: .82rem; }
.login-panel { flex: 1; padding: 44px 40px; display: flex; flex-direction: column; justify-content: center; }
.login-logo { font-family: var(--display); font-size: 1.5rem; font-weight: 700; letter-spacing: -.03em; color: var(--ink); margin-bottom: 18px; }
.login-logo span { color: var(--accent); }
.login-panel h2 { font-family: var(--display); font-size: 1.9rem; letter-spacing: -.02em; }
.login-panelsub { color: var(--slate); font-size: .9rem; margin: 6px 0 22px; }
#auth-form .field { margin-bottom: 14px; }
.login-hint { font-size: .75rem; color: var(--slate); margin: -6px 0 14px; }
.login-status { min-height: 18px; font-size: .84rem; margin-top: 12px; color: var(--slate); }
.login-toggle { margin-top: 16px; font-size: .88rem; color: var(--slate); text-align: center; }
.login-toggle a { color: var(--ink); font-weight: 600; text-decoration: underline; cursor: pointer; }
.btn.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.btn-accent:active { background: #2c2e33; }
.btn.btn-google { background: #fff; border: 1px solid var(--line-strong); color: var(--ink); font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 10px; }
.btn.btn-google:hover { background: #f7f7f7; }
.btn.btn-google svg { flex: none; }
@media (max-width: 720px) {
  .login-hero { display: none; }
  .login-split { min-height: auto; max-width: 420px; border-radius: 14px; }
  .login-panel { padding: 32px 24px; }
}

/* ── App shell ──────────────────────────────────────────────── */
.app { min-height: 100vh; }
.view { padding: 16px; padding-top: calc(16px + var(--safe-t)); padding-bottom: 96px; max-width: 760px; margin: 0 auto; }
.page { display: flex; flex-direction: column; gap: 14px; }

.page-head { display: flex; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.page-head .head-text { flex: 1; min-width: 0; }
.page-head p.muted { margin: 3px 0 0; }
.page-actions { display: flex; gap: 8px; flex-shrink: 0; align-items: center; }
@media (max-width: 620px) {
  .page-actions { width: 100%; }
  .page-actions > select, .page-actions > .inp { flex: 1; min-width: 0; }
}
.back-btn { background: var(--surface); border: 1px solid var(--line); border-radius: 50%; width: 38px; height: 38px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--ink); flex-shrink: 0; }
.section-title { margin: 8px 2px 0; color: var(--slate); font-size: .76rem; text-transform: uppercase; letter-spacing: .8px; font-weight: 600; }

/* ── Cards ──────────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card.warn { background: var(--warn-bg); border-color: #efd6bb; color: #7a4a16; }
.card.flush { padding: 8px; }

/* ── Profile header ─────────────────────────────────────────── */
.profile-head { display: flex; align-items: center; gap: 14px; padding: 4px 2px 6px; }
.avatar { width: 54px; height: 54px; border-radius: 50%; background: var(--chalk); color: var(--ink); display: flex; align-items: center; justify-content: center; font-family: var(--display); font-weight: 600; font-size: 1.2rem; overflow: hidden; flex-shrink: 0; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-head .pname { font-family: var(--display); font-size: 1.4rem; font-weight: 600; letter-spacing: -.02em; }
.profile-head .pmeta { color: var(--slate); font-size: .88rem; }

/* ── Clock card ─────────────────────────────────────────────── */
.clock-card { padding: 0; overflow: hidden; }
.clock-band { background: var(--fog); border-bottom: 1px solid var(--line); padding: 16px; text-align: center; }
.clock-band .shift { color: var(--slate); font-weight: 500; font-size: .9rem; }
.clock-band .now { font-family: var(--display); font-size: 2.1rem; font-weight: 600; color: var(--ink); line-height: 1.1; letter-spacing: -.02em; }
.clock-body { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.clock-times { display: flex; gap: 10px; }
.clock-times > div { flex: 1; background: var(--fog); border-radius: var(--radius); padding: 9px 12px; }
.clock-times .lbl { color: var(--slate); font-size: .74rem; }
.clock-times strong { font-size: 1.1rem; font-family: var(--display); }
.clock-split { display: flex; gap: 10px; }
.clock-split .btn { flex: 1; }
.done-note { text-align: center; color: var(--ok); font-weight: 600; padding: 6px; }

/* ── Tile grid (Home) ───────────────────────────────────────── */
.tile-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.tile { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 4px; border-radius: var(--radius); text-decoration: none; color: var(--ink); cursor: pointer; background: none; border: 0; font: inherit; }
.tile:active { background: var(--fog); }
.tile-ic { width: 46px; height: 46px; border-radius: 14px; display: flex; align-items: center; justify-content: center; background: var(--fog); color: var(--accent); }
.tile-ic svg { width: 23px; height: 23px; }
.tile-label { font-size: .74rem; text-align: center; line-height: 1.15; color: var(--ink); }
/* all tile chips share the fog + grey icon look */
.c-plum, .c-blue, .c-green, .c-amber, .c-red { background: var(--fog); color: var(--accent); }

/* ── Stat / KPI tiles ───────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat .stat-val { font-family: var(--display); font-size: 1.9rem; font-weight: 600; color: var(--ink); letter-spacing: -.02em; }
.stat .stat-label { font-size: .82rem; color: var(--muted); font-weight: 500; }
.stat .small { margin-top: 2px; color: var(--slate); }

/* ── Lists / rows ───────────────────────────────────────────── */
.list { display: flex; flex-direction: column; gap: 8px; }
.menu-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.menu-list .row { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; box-shadow: none; }
.menu-list .row:last-child { border-bottom: 0; }
.row { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 14px; display: flex; align-items: center; gap: 12px; box-shadow: var(--shadow); }
.row.tap { cursor: pointer; }
.row.tap:active { background: var(--fog); }
.row.col { flex-direction: column; align-items: stretch; gap: 10px; }
.row-ic { width: 26px; color: var(--slate); flex-shrink: 0; display: flex; }
.row-ic svg { width: 21px; height: 21px; }
.row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.row-main strong { font-size: .94rem; font-weight: 600; }
.row-trail { color: var(--slate); font-size: .85rem; display: flex; align-items: center; gap: 6px; }
.row-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.row-badges { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin: 12px 0; }
.cal-h { text-align: center; font-size: .66rem; font-weight: 700; color: var(--slate); text-transform: uppercase; padding: 2px 0; }
.cal-cell { height: 68px; box-sizing: border-box; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 5px 7px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; overflow: hidden; transition: transform .13s ease, background .13s ease, border-color .13s ease, color .13s ease, box-shadow .13s ease; }
.cal-cell.empty { background: transparent; border: 0; cursor: default; }
.cal-cell.has { border-color: var(--accent); }
.cal-cell.today { outline: 2px solid var(--accent); outline-offset: -2px; }
.cal-cell:not(.empty):hover { transform: scale(1.07); background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 8px 20px rgba(50,52,56,.35); position: relative; z-index: 3; }
.cal-cell:not(.empty):hover .cal-num { color: #fff; }
.cal-cell:not(.empty):hover .cal-dot { background: #fff !important; }
.cal-cell .cal-num { font-size: .78rem; font-weight: 600; }
.cal-dots { display: flex; gap: 3px; flex-wrap: wrap; }
.cal-dot { width: 7px; height: 7px; border-radius: 50%; }
.cal-dot.birthday { background: var(--accent); }
.cal-dot.anniversary { background: #8a3d8f; }
.cal-dot.leave { background: #3b82f6; }
.cal-dot.holiday { background: #e11d48; }
.cal-dot.event { background: #0ea5a5; }
.cal-cell.holiday .cal-num { color: #e11d48; }
.cal-ic-holiday { color: #e11d48; }
.cal-ic-event { color: #0ea5a5; }
.unread-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); flex: none; margin: 0 5px; }
.row.unread strong { font-weight: 700; }
.lang-toggle { display: flex; justify-content: flex-end; gap: 4px; margin-bottom: 10px; }
.lang-toggle button { font: inherit; font-size: .72rem; font-weight: 700; letter-spacing: .5px; padding: 5px 11px; border-radius: var(--radius-pill); border: 1px solid var(--line-strong); background: #fff; color: var(--slate); cursor: pointer; }
.lang-toggle button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.log-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 4px; }
.log-date { display: flex; align-items: baseline; gap: 8px; }
.log-day { font-size: .82rem; color: var(--slate); font-weight: 500; }

/* Post-login Core Values gate */
.values-gate { position: fixed; inset: 0; z-index: 120; display: flex; align-items: center; justify-content: center; background: var(--bg); padding: 20px; overflow: auto; }
.values-card { width: 100%; max-width: 560px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 30px 24px; }
.values-brand { font-family: var(--display); font-weight: 700; color: var(--accent); text-align: center; letter-spacing: .5px; margin-bottom: 4px; }
.values-title { font-family: var(--display); font-size: 1.7rem; line-height: 1.1; letter-spacing: -.02em; text-align: center; margin: 0 0 22px; }
.values-list { display: flex; flex-direction: column; gap: 16px; border-left: 4px solid var(--accent); padding-left: 18px; margin-bottom: 24px; }
.value-item h3 { font-family: var(--display); font-size: 1.12rem; margin: 0 0 2px; letter-spacing: -.01em; }
.value-item p { margin: 0; color: var(--slate); font-style: italic; font-size: .92rem; }
@media (min-width: 720px) { .values-card { padding: 40px; } .values-title { font-size: 1.9rem; } }

/* Employee "team card" */
.emp-card { display: flex; flex-direction: column; gap: 16px; }
.ec-top { display: flex; justify-content: space-between; align-items: center; font-size: .68rem; letter-spacing: 1.5px; font-weight: 700; color: var(--slate); text-transform: uppercase; }
.ec-head { display: flex; gap: 14px; align-items: center; }
.ec-head .avatar { width: 64px; height: 64px; font-size: 1.4rem; flex: none; }
.ec-name { font-family: var(--display); font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; }
.ec-role { font-size: .95rem; color: var(--ink); }
.ec-meta { font-size: .8rem; color: var(--slate); margin-top: 4px; }
.ec-quote { border-left: 3px solid var(--accent); padding: 2px 0 2px 14px; font-style: italic; font-size: 1.02rem; line-height: 1.4; }
.ec-section { border-top: 1px solid var(--line); padding-top: 14px; }
.ec-sectitle { font-size: .68rem; letter-spacing: 1.2px; text-transform: uppercase; font-weight: 700; color: var(--slate); margin-bottom: 10px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-pill); padding: 6px 14px; font-size: .85rem; }
.ec-disc { display: flex; gap: 12px; align-items: flex-start; }
.ec-disc-badge { flex: none; width: 40px; height: 40px; border-radius: 10px; background: var(--accent); color: #fff; font-family: var(--display); font-weight: 700; font-size: 1.2rem; display: flex; align-items: center; justify-content: center; }
.ec-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; border-top: 1px solid var(--line); padding-top: 14px; }
.ec-coltitle { font-weight: 700; margin-bottom: 6px; font-size: .9rem; }
.ec-ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 5px; font-size: .9rem; }
.ec-when { border-top: 1px solid var(--line); padding-top: 14px; display: flex; flex-direction: column; gap: 8px; font-size: .92rem; }
.ec-when p { margin: 0; }
.ec-when b { color: var(--accent); }
.ec-hr { background: var(--bg); border-radius: 10px; padding: 12px 14px; font-size: .78rem; color: var(--slate); line-height: 1.4; }
.ec-hr b { color: var(--ink); }
.day-row { display: flex; flex-wrap: wrap; gap: 6px; }
.day-toggle { font: inherit; font-size: .82rem; font-weight: 600; padding: 7px 12px; border-radius: var(--radius-pill); border: 1px solid var(--line-strong); background: #fff; color: var(--slate); cursor: pointer; }
.day-toggle.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chev { color: var(--slate); flex-shrink: 0; }
.avatar-sm { width: 38px; height: 38px; border-radius: 50%; background: var(--chalk); color: var(--ink); display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: .82rem; overflow: hidden; flex-shrink: 0; }
.avatar-sm img { width: 100%; height: 100%; object-fit: cover; }
.empty { text-align: center; color: var(--slate); padding: 36px 10px; }
.loading { text-align: center; color: var(--slate); padding: 26px; }
.blocker { text-align: center; padding: 70px 22px; display: flex; flex-direction: column; gap: 12px; align-items: center; }

/* ── Badges ─────────────────────────────────────────────────── */
.badge { font-size: .72rem; padding: 3px 10px; border-radius: 999px; font-weight: 600; white-space: nowrap; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--accent-soft); color: #3f4147; }
.badge-late { background: var(--red-bg); color: var(--red); }
.badge-info { background: var(--chalk); color: var(--muted); }
.badge-plum { background: var(--accent-soft); color: #3f4147; }   /* Outstanding → grey accent */

/* ── Buttons (pills; Carbon-filled / outlined) ──────────────── */
.btn { font: inherit; font-size: .9rem; padding: 9px 18px; border-radius: var(--radius-pill); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); cursor: pointer; min-height: 42px; font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.btn svg { width: 17px; height: 17px; }
.btn-primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-primary:active { background: #000; }
.btn-ghost { background: var(--surface); }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-outline-blue { background: var(--surface); border-color: var(--ink); color: var(--ink); }
.btn-outline-red { background: var(--surface); border-color: var(--line-strong); color: var(--red); }
.btn-sm { padding: 6px 13px; min-height: 34px; font-size: .84rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }

/* ── Forms ──────────────────────────────────────────────────── */
[hidden] { display: none !important; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field > span { font-size: .82rem; color: var(--muted); font-weight: 500; }
.inp { font: inherit; font-size: 16px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: #fff; color: var(--ink); width: 100%; }
.inp:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--chalk); }
.inp-sm { width: auto; padding: 8px 10px; }
textarea.inp { resize: vertical; }
.chk { display: inline-flex; align-items: center; gap: 8px; font-size: .9rem; cursor: pointer; padding: 6px 0; }
.chk input { width: 18px; height: 18px; accent-color: var(--accent); }
.chk-row { display: flex; flex-wrap: wrap; gap: 12px; }
.search-bar { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-pill); padding: 9px 15px; box-shadow: var(--shadow); }
.search-bar svg { width: 18px; height: 18px; color: var(--slate); flex-shrink: 0; }
.search-bar input { border: 0; outline: none; font: inherit; font-size: 16px; flex: 1; background: none; }

/* ── Tabs (pill segmented) ──────────────────────────────────── */
.tabs { display: flex; gap: 4px; background: var(--chalk); border-radius: var(--radius-pill); padding: 4px; }
.tab { flex: 1; background: none; border: 0; padding: 8px 10px; cursor: pointer; color: var(--muted); font-weight: 500; font-size: .86rem; border-radius: var(--radius-pill); font-family: var(--sans); }
.tab.active { color: var(--ink); background: var(--surface); box-shadow: var(--shadow); }

/* ── KPI bars / ranking ─────────────────────────────────────── */
.kpi-item { display: flex; flex-direction: column; gap: 6px; }
.kpi-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.kpi-top > div:first-child { min-width: 0; }
.kpi-pct { font-family: var(--display); font-weight: 600; color: var(--ink); flex-shrink: 0; }
.bar { background: var(--chalk); border-radius: 6px; height: 8px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 6px; transition: width .3s; background: var(--accent); }
.kpi-input-row { display: flex; flex-direction: column; gap: 10px; }
.kpi-inputs { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.kpi-inputs .field { margin: 0; }
.rank-row .rank-no { width: 30px; text-align: center; font-family: var(--display); font-weight: 600; color: var(--slate); font-size: 1.05rem; }
.rank-row.top .rank-no { color: var(--accent); font-size: 1.2rem; }
.rank-row.rank-1 { border-color: #e8b923; background: linear-gradient(120deg, rgba(255,215,64,.20), rgba(255,215,64,.04)); box-shadow: 0 4px 14px rgba(232,185,35,.18); }
.rank-row.rank-2 { border-color: #b8c0c8; background: linear-gradient(120deg, rgba(184,192,200,.22), rgba(184,192,200,.04)); }
.rank-row.rank-3 { border-color: #cd8b52; background: linear-gradient(120deg, rgba(205,139,82,.20), rgba(205,139,82,.04)); }
.rank-row.rank-1 .rank-score { color: #b8860b; }
.rank-row.me:not(.top) { border-color: var(--accent); background: var(--accent-soft); }
.rank-row.me.top { outline: 2px solid var(--accent); outline-offset: -2px; }
.rank-score { font-family: var(--display); font-weight: 600; font-size: 1.1rem; color: var(--ink); }

/* ── Detail / photos ────────────────────────────────────────── */
.detail-row { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.detail-row:last-child { border-bottom: 0; }
.detail-row .muted { flex-shrink: 0; color: var(--slate); }
.detail-row strong { text-align: right; font-weight: 600; }
.photo-pair { display: flex; gap: 12px; margin-top: 12px; }
.photo-slot { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.selfie { width: 100%; border-radius: var(--radius); border: 1px solid var(--line); aspect-ratio: 1; object-fit: cover; background: var(--fog); }

/* ── Org chart (graphical tree) ─────────────────────────────── */
.orgchart-scroll { overflow: auto; max-height: 72vh; padding: 18px 4px 10px; margin-top: 8px; cursor: grab; overscroll-behavior: contain; }
.orgchart-scroll.panning { cursor: grabbing; user-select: none; }
.orgchart-inner { display: inline-block; min-width: 100%; transition: transform .12s ease; }
.org-box.org-bridge { outline: 2px dashed var(--accent); outline-offset: 2px; opacity: .96; }
.org-branch-tag { display: inline-block; margin-top: 2px; font-size: .66rem; font-weight: 600; color: var(--accent); letter-spacing: .3px; }
/* Neutral level chip (employee card only — no colour on the org chart itself). */
.org-level { display: inline-block; font-size: .6rem; font-weight: 700; letter-spacing: .4px; padding: 2px 8px; border-radius: 999px; background: var(--fog); color: var(--slate); white-space: nowrap; }
/* Layered tier layout */
.org-layered { display: block; }
.org-svg { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
.org-link { fill: none; stroke: var(--line-strong); stroke-width: 2; }
.org-tier { position: absolute; left: 0; width: 52px; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 2px; }
.org-tier-n { font-family: var(--display); font-weight: 700; font-size: .92rem; color: var(--slate); }
.org-tier-name { font-size: .58rem; line-height: 1.05; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }
.zoom-bar { display: flex; align-items: center; gap: 6px; margin: 10px 0 0; }
.zoom-bar .btn { min-width: 34px; font-size: 1.05rem; line-height: 1; font-weight: 600; }
.zoom-pct { min-width: 46px; text-align: center; font-variant-numeric: tabular-nums; color: var(--slate); font-size: .85rem; }
.tree { display: inline-block; min-width: 100%; }
.tree ul { display: flex; justify-content: center; list-style: none; margin: 0; padding: 24px 0 0; position: relative; }
.tree > ul { padding-top: 0; }
.tree li { list-style: none; position: relative; padding: 24px 12px 0; display: flex; flex-direction: column; align-items: center; }
.tree li::before, .tree li::after { content: ''; position: absolute; top: 0; right: 50%; width: 50%; height: 24px; border-top: 2px solid var(--line-strong); }
.tree li::after { right: auto; left: 50%; border-left: 2px solid var(--line-strong); }
.tree li:only-child::before, .tree li:only-child::after { display: none; }
.tree li:only-child { padding-top: 0; }
.tree li:first-child::before, .tree li:last-child::after { border: 0 none; }
.tree li:last-child::before { border-right: 2px solid var(--line-strong); border-radius: 0 7px 0 0; }
.tree li:first-child::after { border-radius: 7px 0 0 0; }
.tree ul ul::before { content: ''; position: absolute; top: 0; left: 50%; width: 0; height: 24px; border-left: 2px solid var(--line-strong); }
.org-box { box-sizing: border-box; display: inline-flex; align-items: center; gap: 10px; min-width: 150px; max-width: 232px; padding: 10px 14px 10px 10px; border-radius: var(--radius-pill); cursor: pointer; box-shadow: var(--shadow); text-align: left; z-index: 1; }
.orgchart-inner.editing .org-box { cursor: grab; }
.orgchart-inner.editing .org-box:active { cursor: grabbing; }
.org-box.dragging { opacity: .45; }
.org-box.drop-hover { outline: 3px solid var(--accent); outline-offset: 2px; }
.org-box .org-ava { width: 40px; height: 40px; border-radius: 50%; overflow: hidden; flex-shrink: 0; background: rgba(255,255,255,.22); display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: .82rem; color: #fff; }
.org-box .org-ava img { width: 100%; height: 100%; object-fit: cover; }
.org-box .org-txt { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.org-box .org-txt strong { font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.org-box .org-role { font-size: .7rem; opacity: .85; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
/* Grayscale shading by seniority tier (darker = more senior). */
.org-box.tier-0 { background: #1d1d1f; color: #fff; }
.org-box.tier-1 { background: #3a3a3c; color: #fff; }
.org-box.tier-2 { background: #545456; color: #fff; }
.org-box.tier-3 { background: #6b6b6e; color: #fff; }
.org-box.tier-4 { background: #85858a; color: #fff; }
.org-box.tier-5 { background: #9a9aa0; color: #fff; }

/* ── Help FAB + guided tour (coach-marks) ───────────────────── */
.help-fab { position: fixed; right: 18px; bottom: 22px; z-index: 3000; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-family: var(--display); font-weight: 700; font-size: 1.25rem; line-height: 1; cursor: pointer; box-shadow: var(--shadow); display: flex; align-items: center; justify-content: center; transition: background .12s, color .12s, transform .12s; }
.help-fab:hover { background: var(--accent); color: #fff; border-color: var(--accent); transform: scale(1.06); }
@media (max-width: 900px) { .help-fab { bottom: calc(74px + var(--safe-b, 0px)); right: 14px; width: 42px; height: 42px; } }
.tour-card { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 4000; width: min(440px, 92vw); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 18px 50px rgba(0,0,0,.30); padding: 18px 18px 16px; animation: tourIn .18s ease; }
@keyframes tourIn { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
.tour-card h4 { margin: 0 0 6px; font-family: var(--display); font-size: 1.12rem; }
.tour-card p { margin: 0 0 14px; color: var(--slate); font-size: .9rem; line-height: 1.45; }
.tour-foot { display: flex; align-items: center; gap: 8px; }
.tour-prog { font-size: .8rem; color: var(--muted); margin-right: auto; font-variant-numeric: tabular-nums; }
.tour-focus { outline: 3px solid var(--accent) !important; outline-offset: 2px; border-radius: 12px; position: relative; z-index: 3500; animation: tourPulse 1.25s ease-in-out infinite; }
@keyframes tourPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(63,65,71,.45); } 50% { box-shadow: 0 0 0 7px rgba(63,65,71,0); } }
@media (max-width: 900px) { .tour-card { bottom: calc(72px + var(--safe-b, 0px)); } }

/* ── Modal & sheet ──────────────────────────────────────────── */
.modal-overlay, .sheet-overlay { position: fixed; inset: 0; background: rgba(32,32,32,.4); z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
.modal, .sheet { background: var(--surface); border-radius: 16px 16px 0 0; width: 100%; max-width: 520px; max-height: 92vh; display: flex; flex-direction: column; }
.modal-head, .sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; align-items: center; padding: 14px 18px; border-top: 1px solid var(--line); padding-bottom: calc(14px + var(--safe-b)); }
.modal-footer .mr-auto { margin-right: auto; }
.icon-btn { background: none; border: 0; cursor: pointer; color: var(--slate); padding: 4px; display: flex; }
.sheet-body { padding: 10px 12px calc(16px + var(--safe-b)); }
.sheet-item { display: flex; align-items: center; gap: 14px; padding: 15px 12px; border-radius: var(--radius); cursor: pointer; text-decoration: none; color: var(--ink); }
.sheet-item:active { background: var(--fog); }
.sheet-item .tile-ic { width: 40px; height: 40px; border-radius: 11px; }

/* ── Camera ─────────────────────────────────────────────────── */
.cam-overlay { position: fixed; inset: 0; background: #000; z-index: 80; display: flex; align-items: center; justify-content: center; }
.cam-box { width: 100%; max-width: 460px; display: flex; flex-direction: column; gap: 14px; padding: 18px; }
#cam-video { width: 100%; border-radius: var(--radius); background: #111; transform: scaleX(-1); }
.cam-actions { display: flex; gap: 10px; justify-content: center; }
.cam-msg { color: #fff; text-align: center; font-size: .85rem; min-height: 18px; }

/* ── Toast ──────────────────────────────────────────────────── */
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(86px + var(--safe-b)); z-index: 90; background: var(--ink); color: #fff; padding: 12px 18px; border-radius: var(--radius-pill); font-size: .9rem; max-width: 90%; box-shadow: 0 6px 20px rgba(0,0,0,.2); text-align: center; }
.toast-ok { background: var(--ok); }
.toast-warn { background: var(--accent); }
.toast-err { background: var(--red); }

/* ── Bottom nav (mobile) ────────────────────────────────────── */
.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: var(--safe-b); display: flex; height: calc(62px + var(--safe-b)); }
.bn-item { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-decoration: none; color: var(--slate); font-size: .68rem; cursor: pointer; background: none; border: 0; font-family: var(--sans); }
.bn-item svg { width: 23px; height: 23px; }
.bn-item.active { color: var(--accent); }
.bn-fab { position: relative; }
.bn-fab .fab { width: 46px; height: 46px; border-radius: 50%; background: var(--ink); color: #fff; display: flex; align-items: center; justify-content: center; margin-top: -16px; box-shadow: 0 4px 12px rgba(32,32,32,.28); }
.bn-fab .fab svg { width: 26px; height: 26px; }

/* ── Module switcher (desktop sidebar) ──────────────────────── */
.module-switch { display: none; }

/* ── Desktop sidebar ────────────────────────────────────────── */
.sidebar { display: none; }
@media (min-width: 860px) {
  .bottom-nav { display: none; }
  .app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
  /* Grey→dark-grey gradient sidebar; flex column so the footer pins to the bottom
     and the nav scrolls internally — always fills full height, never a gap. */
  .sidebar { display: flex; flex-direction: column; padding: 18px 12px; background: linear-gradient(180deg, #4a4d52 0%, #313338 72%, #1c1d20 118%); border-right: 0; position: sticky; top: 0; height: 100vh; align-self: start; overflow: hidden; }
  .sidebar .brand { font-family: var(--display); font-size: 1.4rem; font-weight: 700; letter-spacing: -.03em; color: #fff; padding: 6px 12px 2px; }
  .sidebar .brand span { font-weight: 400; color: rgba(255,255,255,.72); }
  .sidebar .brand-sub { font-size: .64rem; color: rgba(255,255,255,.82); padding: 0 12px 12px; line-height: 1.35; }
  .nav-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.35) transparent; }
  .nav-scroll::-webkit-scrollbar { width: 6px; }
  .nav-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,.3); border-radius: 3px; }
  /* Collapsible category header (accordion) */
  .nav-group-head { display: flex; align-items: center; justify-content: space-between; width: 100%; background: none; border: 0; cursor: pointer; font: inherit; font-size: .68rem; text-transform: uppercase; letter-spacing: .8px; font-weight: 600; color: rgba(255,255,255,.78); padding: 14px 12px 5px; }
  .nav-group-head:hover { color: #fff; }
  .nav-group-head svg { width: 15px; height: 15px; color: rgba(255,255,255,.7); transform: rotate(90deg); transition: transform .18s ease; }
  .nav-group-head.collapsed svg { transform: rotate(0deg); }
  .nav-group-items { display: flex; flex-direction: column; gap: 2px; }
  .nav-group-items.collapsed { display: none; }
  .nav-footer { flex: none; display: flex; flex-direction: column; gap: 2px; margin-top: 6px; padding-top: 6px; border-top: 1px solid rgba(255,255,255,.14); }
  .module-switch { display: block; margin: 0 8px 12px; font: inherit; font-size: .9rem; font-weight: 600; color: #fff; background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.32); border-radius: var(--radius-pill); padding: 9px 14px; cursor: pointer; -webkit-appearance: none; appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; }
  .module-switch option { color: var(--ink); }
  .nav-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius); text-decoration: none; color: rgba(255,255,255,.92); font-size: .92rem; font-weight: 500; cursor: pointer; }
  .nav-item svg { width: 20px; height: 20px; color: rgba(255,255,255,.85); }
  .nav-item:hover { background: rgba(255,255,255,.12); color: #fff; }
  .nav-item:hover svg { color: #fff; }
  .nav-item.active { background: #fff; color: var(--ink); font-weight: 600; }
  .nav-item.active svg { color: var(--accent); }
  .nav-sep { font-size: .68rem; text-transform: uppercase; letter-spacing: .8px; color: rgba(255,255,255,.75); padding: 14px 12px 4px; font-weight: 600; }
  .nav-spacer { flex: 1; }

  .view { width: 100%; max-width: 1640px; padding: 32px clamp(28px, 3.5vw, 64px) 56px; }
  .modal-overlay, .sheet-overlay { align-items: center; padding: 16px; }
  .modal, .sheet { border-radius: 16px; }
  .tile-grid { grid-template-columns: repeat(8, 1fr); }
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
  .list { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 12px; align-content: start; }
  .list--solo { display: flex; flex-direction: column; max-width: 720px; }
  .page-head h1 { font-size: 2rem; }
  .page.narrow { max-width: 880px; }
  .narrow .list { display: flex; flex-direction: column; }
}
