/* web/styles.css
 *
 * Design tokens and component styles. Extracted from index.html so the markup
 * stays readable; nothing here changed in the split.
 */
/* ============================================================
     Design tokens. Ported directly from the reference design so
     the two products look like the same family.
     ============================================================ */
  :root {
    --brand: #0B76AE;
    --brand-deep: #08587F;
    --brand-soft: #E2F0F8;
    --ink: #101828;
    --ink2: #344054;
    --mist: #667085;
    --paper: #F7F6F2;
    --card: #FFFFFF;
    --line: #E7E5DF;
    --muted: #EFEDE8;
    --success: #12B76A;
    --warning: #F79009;
    --danger: #F04438;
    --info: #2E90FA;
    --gold: #B98A2F;
    --radius: 0.65rem;
    --shadow: 0 1px 2px rgba(16,24,40,.04);
    --shadow-lg: 0 12px 32px -12px rgba(16,24,40,.18);
  }
  [data-theme="dark"] {
    --brand: #38A8D8;
    --brand-deep: #7CCDEC;
    --brand-soft: #102A38;
    --ink: #F2F4F7;
    --ink2: #D0D5DD;
    --mist: #98A2B3;
    --paper: #0E1417;
    --card: #151F24;
    --line: #24333A;
    --muted: #1B272D;
    --shadow: 0 1px 2px rgba(0,0,0,.3);
    --shadow-lg: 0 12px 32px -12px rgba(0,0,0,.5);
  }

  * { box-sizing: border-box; }
  html, body { height: 100%; }
  body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: 'Inter', system-ui, sans-serif;
    font-feature-settings: 'cv02','cv03','cv04','tnum';
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
  }
  h1, h2, h3, .display { font-family: 'Fraunces', Georgia, serif; letter-spacing: -.01em; margin: 0; }
  .mono { font-family: 'IBM Plex Mono', monospace; }
  .num { font-variant-numeric: tabular-nums; text-align: right; }
  button { font-family: inherit; cursor: pointer; border: 0; background: none; }
  input, select, textarea { font-family: inherit; }
  a { color: inherit; }
  .hide { display: none !important; }
  ::selection { background: var(--brand-soft); color: var(--brand-deep); }
  :focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }

  /* ---------- buttons ---------- */
  .btn {
    display: inline-flex; align-items: center; gap: 6px;
    border-radius: var(--radius); font-weight: 600;
    padding: 8px 16px; font-size: 13.5px;
    transition: background .15s, border-color .15s, color .15s, transform .05s;
  }
  .btn:active { transform: translateY(1px); }
  .btn:disabled { opacity: .5; cursor: not-allowed; }
  .btn i { width: 15px; height: 15px; }
  .btn-sm { padding: 6px 10px; font-size: 12.5px; }
  .btn-primary { background: var(--brand); color: #fff; }
  .btn-primary:hover:not(:disabled) { background: var(--brand-deep); }
  /* In dark mode the brand fill is light, so it carries dark text instead. */
  [data-theme="dark"] .btn-primary { color: #0E1417; }
  [data-theme="dark"] .glyph { color: #0E1417 !important; }
  .btn-outline { border: 1px solid var(--line); background: var(--card); color: var(--ink2); }
  .btn-outline:hover:not(:disabled) { border-color: var(--brand); color: var(--brand-deep); }
  .btn-ghost { color: var(--brand-deep); }
  .btn-ghost:hover:not(:disabled) { background: var(--brand-soft); }
  .btn-danger { background: var(--danger); color: #fff; }
  .icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 8px; border-radius: 6px; color: var(--mist);
  }
  .icon-btn:hover { background: var(--muted); color: var(--ink); }
  .icon-btn i { width: 16px; height: 16px; }

  /* ---------- cards ---------- */
  .card {
    border: 1px solid var(--line); background: var(--card);
    border-radius: 12px; padding: 20px; box-shadow: var(--shadow);
  }
  .card-title {
    font-family: 'Fraunces', Georgia, serif; font-size: 15.5px;
    font-weight: 600; color: var(--ink); margin: 0 0 12px;
    display: flex; align-items: center; justify-content: space-between;
  }
  .grid { display: grid; gap: 16px; }
  .g2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .g3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .g4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
  @media (max-width: 900px) { .g3, .g4 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
  @media (max-width: 560px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } }

  /* ---------- stat ---------- */
  .stat { padding: 16px; }
  .stat-label { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--mist); }
  .stat-value { font-family: 'Fraunces', Georgia, serif; font-size: 24px; font-weight: 600; line-height: 1; margin-top: 6px; color: var(--ink); }
  .stat-sub { font-size: 12px; color: var(--mist); margin-top: 6px; }
  .stat-head { display: flex; align-items: center; justify-content: space-between; }
  .stat-head i { width: 16px; height: 16px; color: var(--brand); }

  /* ---------- pills ---------- */
  .pill {
    display: inline-flex; align-items: center; gap: 4px;
    border-radius: 999px; padding: 2px 8px; font-size: 11px; font-weight: 600;
  }
  .pill-green { background: rgba(18,183,106,.12); color: #0A7A4C; }
  .pill-amber { background: rgba(247,144,9,.14); color: #B45309; }
  .pill-red   { background: rgba(240,68,56,.12); color: #B42318; }
  .pill-blue  { background: rgba(46,144,250,.12); color: #175CD3; }
  .pill-grey  { background: var(--muted); color: var(--mist); }
  [data-theme="dark"] .pill-green { color: #4ADE9C; }
  [data-theme="dark"] .pill-amber { color: #FCB44A; }
  [data-theme="dark"] .pill-red   { color: #F97066; }
  [data-theme="dark"] .pill-blue  { color: #84ADFF; }

  /* ---------- avatar ---------- */
  .avatar {
    display: flex; align-items: center; justify-content: center;
    border-radius: 999px; color: #fff; font-weight: 600; flex-shrink: 0;
    width: 36px; height: 36px; font-size: 13px;
  }
  .avatar-sm { width: 28px; height: 28px; font-size: 10.5px; }

  /* ---------- tables ---------- */
  .table-wrap { border: 1px solid var(--line); background: var(--card); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); }
  table { width: 100%; border-collapse: collapse; }
  thead tr { border-bottom: 1px solid var(--line); }
  th {
    padding: 8px 12px; text-align: left; font-size: 11px; font-weight: 600;
    text-transform: uppercase; letter-spacing: .06em; color: var(--mist);
  }
  th.r, td.r { text-align: right; }
  td { padding: 10px 12px; font-size: 13px; color: var(--ink2); border-top: 1px solid var(--line); }
  tbody tr:first-child td { border-top: 0; }
  tbody tr:hover td { background: rgba(127,127,127,.035); }
  td.r { font-variant-numeric: tabular-nums; color: var(--ink); }
  .row-click { cursor: pointer; }

  /* ---------- forms ---------- */
  .field { margin-bottom: 14px; }
  .field label { display: block; font-size: 12px; font-weight: 600; color: var(--ink2); margin-bottom: 5px; }
  .field .hint { font-weight: 400; color: var(--mist); }
  input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], select, textarea {
    width: 100%; padding: 8px 11px; font-size: 13.5px;
    border: 1px solid var(--line); border-radius: var(--radius);
    background: var(--card); color: var(--ink);
  }
  input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
  input:disabled, select:disabled { background: var(--muted); color: var(--mist); }
  .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink2); margin-bottom: 9px; }
  .check input { width: auto; }

  /* ---------- page header ---------- */
  .page-head {
    display: flex; flex-wrap: wrap; align-items: flex-end;
    justify-content: space-between; gap: 12px; margin-bottom: 20px;
  }
  .page-head h1 { font-size: 26px; font-weight: 600; line-height: 1.15; color: var(--ink); }
  .page-head .sub { font-size: 13.5px; color: var(--mist); margin-top: 2px; }
  .page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
  .eyebrow { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--mist); }

  /* ============================================================
     Login
     ============================================================ */
  /* The three signed-out screens share the same centred layout. .hide carries
     !important so hiding still wins over this display:grid. */
  #login, #mfaChallenge, #mfaEnrol, #setPassword, #onboarding, #redeem {
    min-height: 100vh; display: grid; place-items: center; padding: 24px;
    background: var(--paper);
  }
  .login-card { width: 100%; max-width: 380px; }
  .brandmark { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
  .brandmark .glyph {
    width: 38px; height: 38px; border-radius: 9px; background: var(--brand);
    color: #fff; display: grid; place-items: center;
  }
  .brandmark .glyph i { width: 20px; height: 20px; }
  .brandmark .name { font-family: 'Fraunces', Georgia, serif; font-size: 19px; font-weight: 600; line-height: 1; color: var(--ink); }
  .brandmark .tag { font-size: 11px; font-weight: 500; letter-spacing: .08em; color: var(--mist); margin-top: 3px; }
  .msg { font-size: 12.5px; color: var(--mist); min-height: 18px; margin-top: 10px; display: flex; align-items: center; gap: 6px; }
  .msg.error { color: var(--danger); }
  .msg i { width: 14px; height: 14px; }

  /* ============================================================
     App shell
     ============================================================ */
  #app { display: none; }
  #app.show { display: block; }

  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 30; width: 240px;
    display: flex; flex-direction: column;
    border-right: 1px solid var(--line); background: var(--card);
  }
  .side-brand { display: flex; align-items: center; gap: 10px; padding: 24px 20px 20px; }
  .side-nav { flex: 1; overflow-y: auto; padding: 0 12px; display: flex; flex-direction: column; gap: 2px; }
  .nav-item {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 8px 12px; border-radius: 6px; font-size: 13.5px; font-weight: 500;
    color: var(--ink2); text-align: left; transition: background .15s, color .15s;
  }
  .nav-item i { width: 16px; height: 16px; flex-shrink: 0; }
  .nav-item:hover { background: var(--muted); color: var(--ink); }
  .nav-item.active { background: var(--brand-soft); color: var(--brand-deep); }
  .side-foot { border-top: 1px solid var(--line); padding: 16px; }
  .side-foot .label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--mist); }
  .who-box {
    margin-top: 6px; width: 100%; border: 1px solid var(--line); border-radius: 6px;
    background: var(--card); padding: 8px 11px; text-align: left;
    font-size: 12.5px; font-weight: 500; color: var(--ink);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .who-role { font-size: 11px; color: var(--mist); font-weight: 400; margin-top: 2px; }

  .main { padding-left: 240px; }
  .topbar {
    position: sticky; top: 0; z-index: 20;
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--paper) 90%, transparent);
    backdrop-filter: blur(8px);
  }
  .topbar-in { display: flex; align-items: center; gap: 8px; padding: 10px 24px; }
  .entity-chip { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--mist); margin-right: 8px; }
  .entity-chip i { width: 14px; height: 14px; }
  .entity-chip .nm { font-weight: 500; color: var(--ink2); }
  .badge-stp { border-radius: 4px; background: var(--brand-soft); color: var(--brand-deep); padding: 2px 6px; font-size: 10.5px; font-weight: 600; }
  .quick { display: flex; align-items: center; gap: 6px; }
  .qa {
    display: inline-flex; align-items: center; gap: 6px;
    border: 1px solid var(--line); background: var(--card); color: var(--ink2);
    border-radius: 6px; padding: 6px 12px; font-size: 12.5px; font-weight: 500;
    box-shadow: var(--shadow); transition: border-color .15s, color .15s, transform .05s;
  }
  .qa:hover { border-color: var(--brand); color: var(--brand-deep); }
  .qa:active { transform: translateY(1px); }
  .qa i { width: 14px; height: 14px; color: var(--brand); }
  .top-right { margin-left: auto; display: flex; align-items: center; gap: 4px; }
  .content { max-width: 1152px; margin: 0 auto; padding: 24px; }
  .hamburger { display: none; }

  @media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); transition: transform .22s ease; }
    .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
    .main { padding-left: 0; }
    .hamburger { display: inline-flex; }
    .quick { display: none; }
    .entity-chip { display: none; }
  }

  /* ---------- empty / skeleton ---------- */
  .empty { text-align: center; padding: 48px 24px; }
  .empty .ico {
    width: 44px; height: 44px; border-radius: 11px; background: var(--brand-soft);
    color: var(--brand-deep); display: grid; place-items: center; margin: 0 auto 14px;
  }
  .empty .ico i { width: 21px; height: 21px; }
  .empty h3 { font-size: 16px; margin-bottom: 5px; color: var(--ink); }
  .empty p { font-size: 13px; color: var(--mist); margin: 0 0 16px; }
  .skel { background: var(--muted); border-radius: 8px; animation: pulse 1.4s ease-in-out infinite; }
  @keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .55 } }
  @media (prefers-reduced-motion: reduce) { .skel { animation: none } * { transition: none !important } }
  .errbox {
    border: 1px solid rgba(240,68,56,.3); background: rgba(240,68,56,.08);
    color: #B42318; border-radius: var(--radius); padding: 12px 14px; font-size: 13px;
    display: flex; gap: 8px; align-items: flex-start;
  }
  .errbox i { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }

  /* ---------- entity cards ---------- */
  .ent-card {
    border: 1px solid var(--line); background: var(--card); border-radius: 12px;
    padding: 18px; cursor: pointer; box-shadow: var(--shadow);
    transition: border-color .15s, transform .08s;
  }
  .ent-card:hover { border-color: var(--brand); transform: translateY(-1px); }
  .ent-card .nm { font-family: 'Fraunces', Georgia, serif; font-size: 16px; font-weight: 600; color: var(--ink); }
  .ent-card .meta { font-size: 12px; color: var(--mist); margin-top: 4px; }
  .ent-card .foot { display: flex; align-items: center; gap: 8px; margin-top: 14px; }

  /* ---------- drawer + sheet ---------- */
  .scrim {
    position: fixed; inset: 0; z-index: 40; background: rgba(16,24,40,.42);
    opacity: 0; pointer-events: none; transition: opacity .2s;
  }
  .scrim.show { opacity: 1; pointer-events: auto; }
  .drawer, .sheet {
    position: fixed; top: 0; right: 0; bottom: 0; z-index: 50;
    width: 420px; max-width: 92vw; background: var(--card);
    border-left: 1px solid var(--line); box-shadow: var(--shadow-lg);
    transform: translateX(100%); transition: transform .24s ease;
    display: flex; flex-direction: column;
  }
  .drawer.open, .sheet.open { transform: none; }
  .drawer-head, .sheet-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 20px; border-bottom: 1px solid var(--line);
  }
  .drawer-head h3, .sheet-head h3 { font-size: 16px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
  .sheet-head h3 i { width: 18px; height: 18px; color: var(--brand); }
  .drawer-body, .sheet-body { flex: 1; overflow-y: auto; padding: 20px; }
  .drawer-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 20px; border-top: 1px solid var(--line); }

  .help-purpose { font-size: 13.5px; line-height: 1.65; color: var(--ink2); }
  .help-steps { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
  .help-steps li { display: flex; gap: 10px; font-size: 13px; line-height: 1.6; color: var(--ink2); }
  .help-steps .n {
    flex-shrink: 0; width: 20px; height: 20px; border-radius: 999px; margin-top: 1px;
    background: var(--brand-soft); color: var(--brand-deep);
    display: grid; place-items: center; font-size: 11px; font-weight: 700;
  }
  .help-tip {
    border: 1px solid rgba(185,138,47,.3); background: rgba(185,138,47,.1);
    border-radius: var(--radius); padding: 12px; font-size: 12.5px; line-height: 1.6; color: var(--ink2);
  }
  .help-tip b { color: var(--gold); }

  /* ---------- toasts ---------- */
  .toasts { position: fixed; right: 20px; bottom: 20px; z-index: 60; display: flex; flex-direction: column; gap: 8px; }
  .toast {
    display: flex; align-items: center; gap: 8px;
    border: 1px solid var(--line); background: var(--card); color: var(--ink);
    border-radius: var(--radius); padding: 11px 14px; font-size: 13px;
    box-shadow: var(--shadow-lg); animation: slidein .22s ease;
  }
  .toast i { width: 16px; height: 16px; color: var(--success); }
  .toast.err i { color: var(--danger); }
  .toast.leaving { opacity: 0; transform: translateX(10px); transition: all .25s; }
  @keyframes slidein { from { opacity: 0; transform: translateX(16px) } }

  /* ---------- day grid ---------- */
  .day-block { margin-bottom: 18px; }
  .day-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 7px; gap: 12px; }
  .emp-name { font-weight: 600; color: var(--ink); font-size: 13.5px; }
  .emp-sub { font-size: 11.5px; color: var(--mist); }
  tr.weekend td { background: rgba(127,127,127,.045); }
  .hrs { width: 84px; }
  .pen { width: 148px; }
