/* ==========================================================================
   Number Ten Group — Employee Portal
   Design tokens
   Color   ink #16303A · paper #EAF0EE · accent (ochre) #D9A62A ·
           accent-2 (coral) #C1553F · info (harbor blue) #4A7A95
           semantic: success #2F8F6B · warning #C97A2E · critical #B33F3F
   Type    Display: Sora · Body/UI: IBM Plex Sans · Data/mono: IBM Plex Mono
   Layout  App shell: topbar (role/location switcher) + left rail (desktop)
           / bottom tab bar (mobile) + card-grid content area
   ========================================================================== */

:root {
  --ink: #16303A;
  --ink-soft: #3E5661;
  --paper: #EAF0EE;
  --surface: #FFFFFF;
  --surface-raised: #F5F8F7;
  --border: #D7E1DD;
  --border-soft: #E4EBE8;

  --accent: #D9A62A;
  --accent-ink: #6B4E10;
  --accent-2: #C1553F;
  --info: #4A7A95;

  --success: #2F8F6B;
  --success-bg: #E1F1EA;
  --warning: #C97A2E;
  --warning-bg: #FBEBD9;
  --critical: #B33F3F;
  --critical-bg: #FAE3E1;
  --neutral-bg: #E7ECEA;

  --text: #16303A;
  --text-soft: #4C6067;
  --text-faint: #7C8D92;
  --text-on-accent: #2A1E04;
  --text-on-dark: #F4F7F6;

  --shadow-1: 0 1px 2px rgba(22, 48, 58, 0.06), 0 1px 1px rgba(22, 48, 58, 0.04);
  --shadow-2: 0 6px 20px rgba(22, 48, 58, 0.10), 0 2px 6px rgba(22, 48, 58, 0.06);

  --radius-s: 8px;
  --radius-m: 14px;
  --radius-l: 20px;

  --font-display: 'Sora', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'IBM Plex Sans', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', 'SFMono-Regular', Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #0F2027;
    --ink-soft: #A9BEC4;
    --paper: #0F2027;
    --surface: #16303A;
    --surface-raised: #1B3944;
    --border: #2A4750;
    --border-soft: #223E48;

    --accent: #E8BB4E;
    --accent-ink: #2A1E04;
    --accent-2: #D97561;
    --info: #7CA9C2;

    --success: #4DB68A;
    --success-bg: #17342A;
    --warning: #E0995A;
    --warning-bg: #3A2A16;
    --critical: #E07A7A;
    --critical-bg: #3A1E1E;
    --neutral-bg: #1E3841;

    --text: #EAF2F1;
    --text-soft: #B9CBCF;
    --text-faint: #86A0A6;
    --text-on-accent: #2A1E04;
    --text-on-dark: #F4F7F6;

    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.28), 0 1px 1px rgba(0, 0, 0, 0.2);
    --shadow-2: 0 10px 26px rgba(0, 0, 0, 0.38), 0 3px 8px rgba(0, 0, 0, 0.24);
  }
}

:root[data-theme="dark"] {
  --ink: #0F2027;
  --ink-soft: #A9BEC4;
  --paper: #0F2027;
  --surface: #16303A;
  --surface-raised: #1B3944;
  --border: #2A4750;
  --border-soft: #223E48;

  --accent: #E8BB4E;
  --accent-ink: #2A1E04;
  --accent-2: #D97561;
  --info: #7CA9C2;

  --success: #4DB68A;
  --success-bg: #17342A;
  --warning: #E0995A;
  --warning-bg: #3A2A16;
  --critical: #E07A7A;
  --critical-bg: #3A1E1E;
  --neutral-bg: #1E3841;

  --text: #EAF2F1;
  --text-soft: #B9CBCF;
  --text-faint: #86A0A6;
  --text-on-accent: #2A1E04;
  --text-on-dark: #F4F7F6;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.28), 0 1px 1px rgba(0, 0, 0, 0.2);
  --shadow-2: 0 10px 26px rgba(0, 0, 0, 0.38), 0 3px 8px rgba(0, 0, 0, 0.24);
}

/* ---- base --------------------------------------------------------------- */
* { box-sizing: border-box; }
body {
  background: var(--paper);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-display); text-wrap: balance; margin: 0; color: var(--text); }
p { margin: 0; }
button { font-family: inherit; }
a { color: inherit; }
::selection { background: var(--accent); color: var(--text-on-accent); }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.tabular { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; } }

/* ---- app shell ------------------------------------------------------------ */
#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
}
.topbar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.topbar__mark { height: 26px; width: auto; flex: none; }
/* Two flat-color PNG variants (the mark can't read CSS tokens like text can) —
   swap which one is visible per theme, the same three-state pattern the rest
   of the app's dark-mode overrides use. */
.topbar__mark--dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .topbar__mark--light { display: none; }
  :root:not([data-theme="light"]) .topbar__mark--dark { display: inline-block; }
}
:root[data-theme="dark"] .topbar__mark--light { display: none; }
:root[data-theme="dark"] .topbar__mark--dark { display: inline-block; }
.topbar__spacer { flex: 1; }
.topbar__controls { display: flex; align-items: center; gap: 8px; }
.icon-btn.topbar__more-btn { display: none; }

.switcher {
  display: flex; align-items: center; gap: 6px;
  border: 1px solid var(--border); border-radius: 999px;
  padding: 5px 10px 5px 6px;
  background: var(--surface-raised);
  cursor: pointer;
  font-size: 12.5px;
}
.switcher select {
  border: none; background: transparent; color: var(--text);
  font: inherit; font-family: var(--font-body); font-weight: 600;
  cursor: pointer;
}
.switcher__label { color: var(--text-faint); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; padding-left: 2px; }
.switcher select:focus-visible { outline: none; }

.shell {
  flex: 1;
  display: flex;
  width: 100%;
}

.rail {
  width: 224px;
  flex: none;
  border-right: 1px solid var(--border);
  background: var(--surface);
  padding: 14px 10px 90px;
  overflow-y: auto;
}
.rail__group { margin-bottom: 4px; }
.rail__group-title {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-faint); padding: 14px 10px 6px;
}
.rail__item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--radius-s);
  color: var(--text-soft); font-size: 13.5px; font-weight: 500;
  cursor: pointer; border: none; background: none; width: 100%; text-align: left;
}
.rail__item:hover { background: var(--surface-raised); color: var(--text); }
.rail__item.is-active { background: var(--neutral-bg); color: var(--text); font-weight: 600; }
.rail__item.is-active .rail__dot { background: var(--accent); }
.rail__icon { flex: none; width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; opacity: 0.85; }

.bottomnav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  background: var(--surface); border-top: 1px solid var(--border);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  gap: 2px;
}
.bottomnav__item {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 2px; border: none; background: none; color: var(--text-faint);
  font-size: 10.5px; font-weight: 600; border-radius: var(--radius-s);
}
.bottomnav__item.is-active { color: var(--accent-ink); }
:root[data-theme="dark"] .bottomnav__item.is-active,
@media (prefers-color-scheme: dark) { }
.bottomnav__item.is-active .bottomnav__icon { color: var(--accent); }
.bottomnav__icon { width: 20px; height: 20px; }

.main {
  flex: 1;
  min-width: 0;
  padding: 20px 22px 64px;
}
.main__header { margin-bottom: 18px; }
.main__title { font-size: 22px; font-weight: 700; }
.main__subtitle { color: var(--text-soft); font-size: 13.5px; margin-top: 3px; }

.more-sheet {
  position: fixed; inset: 0; z-index: 60; display: none;
}
.more-sheet.is-open { display: block; }
.more-sheet__scrim { position: absolute; inset: 0; background: rgba(15, 32, 39, 0.45); }
.more-sheet__panel {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: var(--surface); border-radius: 20px 20px 0 0;
  padding: 14px 14px calc(20px + env(safe-area-inset-bottom));
  max-height: 78vh; overflow-y: auto;
  box-shadow: var(--shadow-2);
}
.more-sheet__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
/* Account controls (language/persona/location switchers, logout, reset) sit
   inline in the desktop topbar but stack full-width here — a <select> that's
   fine at its natural inline width becomes unreadable/unusable squeezed into
   a phone-width row, so each control gets its own full-width line instead. */
.more-sheet__account {
  display: flex; flex-direction: column; gap: 8px;
  padding-bottom: 12px; margin-bottom: 8px; border-bottom: 1px solid var(--border-soft);
}
.more-sheet__account .switcher { width: 100%; box-sizing: border-box; }
.more-sheet__account .switcher select { flex: 1; min-width: 0; }

@media (max-width: 900px) {
  .rail { display: none; }
  .bottomnav { display: flex; }
  .main { padding: 16px 14px 92px; }
  .topbar__brand span.topbar__name { display: none; }
  .topbar__controls { display: none; }
  .icon-btn.topbar__more-btn { display: flex; }
}

/* ---- section / grid -------------------------------------------------------- */
.section { margin-bottom: 26px; }
.section__head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.section__title { font-size: 15px; font-weight: 700; font-family: var(--font-display); }
.section__meta { font-size: 12px; color: var(--text-faint); }
.grid { display: grid; gap: 14px; }
.grid--cards { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--tiles { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
@media (max-width: 640px) { .grid--2 { grid-template-columns: 1fr; } }

/* ---- card / tile ------------------------------------------------------------ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  padding: 16px;
  box-shadow: var(--shadow-1);
}
.card--pad-s { padding: 12px; }
.card__title { font-weight: 700; font-size: 13.5px; display: flex; align-items: center; gap: 8px; }
.card__body { margin-top: 8px; }
.card--action { cursor: pointer; transition: transform 0.12s ease, box-shadow 0.12s ease; }
.card--action:hover { box-shadow: var(--shadow-2); transform: translateY(-1px); }

.stat-tile {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-m);
  padding: 14px;
}
.stat-tile__label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); }
.stat-tile__value { font-family: var(--font-mono); font-size: 24px; font-weight: 600; margin-top: 4px; }
.stat-tile__sub { font-size: 12px; color: var(--text-soft); margin-top: 2px; }

.action-card {
  display: flex; flex-direction: column; gap: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-m);
  padding: 16px; cursor: pointer; text-align: left; width: 100%;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.action-card:hover { box-shadow: var(--shadow-2); transform: translateY(-1px); }
.action-card__icon {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: var(--neutral-bg); color: var(--ink);
}
.action-card__title { font-weight: 700; font-size: 14px; }
.action-card__sub { font-size: 12px; color: var(--text-soft); }
.action-card__badge { align-self: flex-start; }

/* ---- badges / status -------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 999px;
  background: var(--neutral-bg); color: var(--text-soft);
  white-space: nowrap;
}
.badge--success { background: var(--success-bg); color: var(--success); }
.badge--warning { background: var(--warning-bg); color: var(--warning); }
.badge--critical { background: var(--critical-bg); color: var(--critical); }
.badge--info { background: rgba(74,122,149,0.14); color: var(--info); }
.badge--accent { background: rgba(217,166,42,0.18); color: var(--accent-ink); }
:root[data-theme="dark"] .badge--accent, .badge--accent { color: var(--accent-ink); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .badge--accent { color: #2A1E04; background: rgba(232,187,78,0.28); } }
.badge__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.priority-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.priority-dot--high, .priority-dot--urgent, .priority-dot--critical { background: var(--critical); }
.priority-dot--medium, .priority-dot--important { background: var(--warning); }
.priority-dot--low, .priority-dot--normal { background: var(--success); }

/* ---- buttons ----------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: var(--radius-s); border: 1px solid transparent;
  padding: 9px 14px; font-size: 13px; font-weight: 600; cursor: pointer;
  font-family: var(--font-body);
}
.btn--primary { background: var(--accent); color: var(--text-on-accent); }
.btn--primary:hover { filter: brightness(1.04); }
.btn--secondary { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn--secondary:hover { background: var(--surface-raised); }
.btn--ghost { background: transparent; color: var(--text-soft); }
.btn--ghost:hover { background: var(--surface-raised); }
.btn--danger { background: var(--critical-bg); color: var(--critical); }
.btn--s { padding: 6px 10px; font-size: 12px; }
.btn--block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.icon-btn {
  width: 32px; height: 32px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); display: flex; align-items: center; justify-content: center; cursor: pointer;
  color: var(--text-soft); flex: none;
}
.icon-btn:hover { background: var(--surface-raised); }

/* ---- forms --------------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field__label { font-size: 12.5px; font-weight: 600; color: var(--text-soft); }
.field__hint { font-size: 11.5px; color: var(--text-faint); }
.input, .select, .textarea {
  border: 1px solid var(--border); border-radius: var(--radius-s);
  background: var(--surface); color: var(--text); padding: 9px 11px; font-size: 13.5px;
  font-family: var(--font-body); width: 100%;
}
.textarea { resize: vertical; min-height: 64px; }
.input--mono { font-family: var(--font-mono); }
.checklist-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 4px; border-bottom: 1px solid var(--border-soft);
}
.checklist-item:last-child { border-bottom: none; }
.checkbox {
  width: 22px; height: 22px; border-radius: 7px; border: 1.5px solid var(--border);
  display: flex; align-items: center; justify-content: center; flex: none; cursor: pointer;
  background: var(--surface); margin-top: 1px;
}
.checkbox.is-checked { background: var(--success); border-color: var(--success); color: white; }
.yesno { display: flex; gap: 6px; }
.yesno button {
  border: 1px solid var(--border); background: var(--surface); color: var(--text-soft);
  border-radius: 999px; padding: 5px 12px; font-size: 12px; font-weight: 600; cursor: pointer;
}
.yesno button.is-yes.is-active { background: var(--success-bg); color: var(--success); border-color: var(--success); }
.yesno button.is-no.is-active { background: var(--critical-bg); color: var(--critical); border-color: var(--critical); }

/* ---- progress ring ------------------------------------------------------------ */
.progress-ring { position: relative; width: 64px; height: 64px; flex: none; }
.progress-ring svg { transform: rotate(-90deg); }
.progress-ring__value {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 13px; font-weight: 600;
}
.progress-bar { height: 6px; border-radius: 999px; background: var(--neutral-bg); overflow: hidden; }
.progress-bar__fill { height: 100%; background: var(--accent); border-radius: 999px; }

/* ---- table --------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-m); background: var(--surface); }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 560px; }
/* Inside a modal there's no room to force the 560px min — let compact tables (e.g. an order's line items) size to
   the modal instead of clipping against its edge; wider tables still scroll within .table-wrap as needed. */
.modal table.data-table { min-width: 0; }
.data-table th {
  text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-faint); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--border);
  background: var(--surface-raised); white-space: nowrap;
}
.data-table td { padding: 10px 12px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }

/* ---- list rows ------------------------------------------------------------------ */
.list-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 4px;
  border-bottom: 1px solid var(--border-soft);
}
.list-row:last-child { border-bottom: none; }
.list-row__main { flex: 1; min-width: 0; }
.list-row__title { font-weight: 600; font-size: 13.5px; }
.list-row__sub { font-size: 12px; color: var(--text-soft); margin-top: 2px; }
.list-row__meta { text-align: right; flex: none; }

/* ---- avatar ------------------------------------------------------------------------ */
.avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 11.5px; font-family: var(--font-display);
}
.avatar--s { width: 24px; height: 24px; font-size: 10px; }
.avatar--l { width: 44px; height: 44px; font-size: 15px; }
.avatar-stack { display: flex; }
.avatar-stack .avatar { margin-left: -8px; border: 2px solid var(--surface); }
.avatar-stack .avatar:first-child { margin-left: 0; }

/* ---- tabs ----------------------------------------------------------------------------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 14px; overflow-x: auto; }
.tab {
  border: none; background: none; padding: 9px 4px; font-size: 13px; font-weight: 600;
  color: var(--text-faint); cursor: pointer; white-space: nowrap; position: relative; margin-right: 14px;
}
.tab.is-active { color: var(--text); }
.tab.is-active::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--accent); border-radius: 2px; }

/* ---- chips / filters ------------------------------------------------------------------- */
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--border); background: var(--surface); color: var(--text-soft);
  padding: 5px 11px; border-radius: 999px; font-size: 12px; font-weight: 600; cursor: pointer;
}
.chip.is-active { background: var(--ink); color: var(--text-on-dark); border-color: var(--ink); }
:root[data-theme="dark"] .chip.is-active { background: var(--accent); color: var(--text-on-accent); border-color: var(--accent); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .chip.is-active { background: var(--accent); color: var(--text-on-accent); border-color: var(--accent); } }

/* ---- modal / toast ----------------------------------------------------------------------- */
.modal-layer { position: fixed; inset: 0; z-index: 80; display: none; }
.modal-layer.is-open { display: flex; align-items: flex-end; justify-content: center; }
@media (min-width: 640px) { .modal-layer.is-open { align-items: center; } }
.modal-layer__scrim { position: absolute; inset: 0; background: rgba(15, 32, 39, 0.5); }
.modal {
  position: relative; background: var(--surface); border-radius: 18px 18px 0 0;
  width: 100%; max-width: 480px; max-height: 88vh; overflow-y: auto;
  padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
  box-shadow: var(--shadow-2);
}
@media (min-width: 640px) { .modal { border-radius: var(--radius-l); max-height: 82vh; } }
.modal__title { font-size: 16px; font-weight: 700; margin-bottom: 12px; }

.toast-layer { position: fixed; bottom: 76px; left: 0; right: 0; z-index: 90; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
@media (min-width: 900px) { .toast-layer { bottom: 24px; } }
.toast {
  background: var(--ink); color: var(--text-on-dark); padding: 10px 16px; border-radius: 999px;
  font-size: 13px; font-weight: 600; box-shadow: var(--shadow-2);
}

/* ---- empty state -------------------------------------------------------------------------- */
.empty-state { text-align: center; padding: 34px 14px; color: var(--text-faint); }
.empty-state__title { font-weight: 600; color: var(--text-soft); margin-bottom: 4px; }

/* ---- trend bars --------------------------------------------------------------------------- */
.trend-bars { display: flex; align-items: flex-end; gap: 4px; height: 44px; }
.trend-bars__bar { flex: 1; background: var(--neutral-bg); border-radius: 3px 3px 0 0; position: relative; }
.trend-bars__bar.is-last { background: var(--accent); }

/* ---- utility -------------------------------------------------------------------------------- */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-6 { gap: 6px; } .gap-8 { gap: 8px; } .gap-10 { gap: 10px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.text-faint { color: var(--text-faint); }
.text-soft { color: var(--text-soft); }
.text-s { font-size: 12px; }
.wrap { flex-wrap: wrap; }
.hr { height: 1px; background: var(--border-soft); border: none; margin: 12px 0; }
