/* ===========================================================================
   FACE/OS — editorial-industrial / biometric terminal skin
   Loaded AFTER styles.css so it re-skins the whole app. Square corners,
   1.5px ink hairlines, no soft shadows, Space Grotesk numerals + IBM Plex Mono
   labels over IBM Plex Sans Thai body. Multi-colour data accents.
   =========================================================================== */

:root {
  /* FACE/OS palette */
  --fos-paper:  #F5F5F4;
  --fos-inset:  #E7E7E5;
  --fos-ink:    #1C1C1F;
  --fos-gray:   #6E6E73;
  --fos-faint:  #A0A0A6;
  --fos-red:    #E5261C;
  --fos-green:  #178A4C;
  --fos-cobalt: #2457D6;
  --fos-amber:  #D4870C;
  --fos-violet: #6D3BD6;
  --fos-line:   rgba(26,26,28,.12);
  --fos-line-2: rgba(26,26,28,.20);

  --fos-display: 'Space Grotesk', 'IBM Plex Sans Thai', system-ui, sans-serif;
  --fos-mono:    'IBM Plex Mono', ui-monospace, monospace;
  --fos-sans:    'IBM Plex Sans Thai', system-ui, sans-serif;

  /* Re-map the legacy app tokens onto FACE/OS so ported pages inherit the look */
  --ink:       #1C1C1F;
  --ink-2:     #2A2A2E;
  --ink-3:     #6E6E73;
  --ink-4:     #6E6E73;
  --ink-5:     #A0A0A6;
  --line:      rgba(26,26,28,.14);
  --line-2:    #1C1C1F;
  --bg:        #F5F5F4;
  --bg-warm:   #F5F5F4;
  --surface:   #F5F5F4;
  --surface-2: #E7E7E5;
  --primary:      #E5261C;
  --primary-soft: #F7D4D1;
  --primary-ink:  #8A130C;
  --coral:        #E5261C;
  --coral-soft:   #F7D4D1;
  --mint:   #178A4C;
  --yellow: #D4870C;
  --magenta:#6D3BD6;
}

/* ── global reset to match the prototype ───────────────────────────────────── */
html, body {
  background: var(--fos-paper);
  color: var(--fos-ink);
  font-family: var(--fos-sans);
  -webkit-font-smoothing: antialiased;
}
body { position: relative; }

/* paper texture: faint grid + grain, behind everything */
body::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(90deg, rgba(26,26,28,.04) 1px, transparent 1px),
    linear-gradient(rgba(26,26,28,.04) 1px, transparent 1px);
  background-size: 96px 96px;
}
body::after {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  opacity: .05; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
#root { position: relative; z-index: 1; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #1C1C1F; }
::-webkit-scrollbar-track { background: #E7E7E5; }
::selection { background: var(--fos-red); color: var(--fos-paper); }

/* Kill rounded corners + soft shadows everywhere (the FACE/OS signature) */
.card, .btn, .chip, .input, select, .topbar-search, .sb-item, .sb-avatar,
.sb-brand-mark, .modal, .dialog, .drawer, .tbl, .badge, .kpi, .stat,
.tag, .pill, .tab, .seg, input, textarea {
  border-radius: 0 !important;
  box-shadow: none !important;
}

/* ── animations ────────────────────────────────────────────────────────────── */
@keyframes osblink { 0%,100%{opacity:1} 50%{opacity:.15} }
@keyframes osscan  { 0%{top:4%} 50%{top:92%} 100%{top:4%} }
@keyframes osrise  { from{transform:scaleY(.15);opacity:0} to{transform:scaleY(1);opacity:1} }
@keyframes osup    { from{opacity:0;transform:translateY(14px)} to{opacity:1;transform:none} }
@keyframes osslide { from{opacity:0;transform:translateX(-10px)} to{opacity:1;transform:none} }
@keyframes ospulse { 0%,100%{transform:scaleY(1)} 50%{transform:scaleY(1.5)} }
@keyframes osspin  { to{transform:rotate(360deg)} }

/* ── shell ─────────────────────────────────────────────────────────────────── */
.fos-shell { height: 100vh; display: flex; flex-direction: column; background: var(--fos-paper); }

/* masthead */
.fos-mast { flex-shrink: 0; border-bottom: 1.5px solid var(--fos-ink); background: var(--fos-paper); }
.fos-mast-top { display: flex; align-items: stretch; justify-content: space-between; }
.fos-brand { display: flex; align-items: center; gap: 16px; padding: 14px 26px; border-right: 1.5px solid var(--fos-ink); }
.fos-brand-mark {
  width: 42px; height: 42px; background: var(--fos-ink); color: var(--fos-paper);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--fos-display); font-weight: 700; font-size: 20px;
}
.fos-wordmark { font-family: var(--fos-display); font-weight: 700; font-size: 24px; letter-spacing: -.5px; line-height: .95; text-transform: uppercase; }
.fos-tag { font-family: var(--fos-mono); font-size: 10.5px; letter-spacing: 2px; color: var(--fos-gray); margin-top: 3px; }
.fos-ticker { flex: 1; display: flex; align-items: center; padding: 0 24px; overflow: hidden; }
.fos-ticker span.line { display: flex; align-items: center; gap: 9px; font-family: var(--fos-mono); font-size: 11px; letter-spacing: 1px; color: var(--fos-gray); white-space: nowrap; }
.fos-dot { width: 8px; height: 8px; background: var(--fos-red); border-radius: 50%; animation: osblink 1.3s infinite; flex-shrink: 0; }
.fos-clockbox { display: flex; align-items: center; gap: 18px; padding: 10px 26px; border-left: 1.5px solid var(--fos-ink); }
.fos-date { font-family: var(--fos-mono); font-size: 11px; letter-spacing: 1px; color: var(--fos-gray); text-align: right; }
.fos-clock { font-family: var(--fos-display); font-weight: 700; font-size: 30px; letter-spacing: 1px; line-height: 1; margin-top: 1px; font-variant-numeric: tabular-nums; text-align: right; }

/* nav index */
.fos-nav { display: flex; align-items: stretch; border-top: 1.5px solid var(--fos-ink); overflow-x: auto; }
.fos-nav::-webkit-scrollbar { height: 0; }
.fos-navbtn {
  display: flex; align-items: center; gap: 8px; padding: 11px 18px;
  border: none; border-right: 1.5px solid var(--fos-ink); background: transparent;
  color: var(--fos-gray); cursor: pointer; font-family: var(--fos-sans);
  font-size: 13.5px; font-weight: 400; white-space: nowrap;
}
.fos-navbtn .num { font-family: var(--fos-mono); font-size: 11px; color: var(--fos-faint); }
.fos-navbtn:hover { background: var(--fos-inset); }
.fos-navbtn.on { background: var(--fos-ink); color: var(--fos-paper); font-weight: 600; }
.fos-navbtn.on .num { color: var(--fos-red); }
.fos-navbtn .badge { font-family: var(--fos-mono); font-size: 10px; background: var(--fos-red); color: var(--fos-paper); padding: 1px 5px; border-radius: 0; }

/* body scroll area */
.fos-body { flex: 1; overflow: auto; }

/* ── section header (numbered index label) ─────────────────────────────────── */
.fos-sec { padding: 18px 24px 24px; }
.fos-sec-bb { border-bottom: 1.5px solid var(--fos-ink); }
.fos-sec-br { border-right: 1.5px solid var(--fos-ink); }
.fos-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.fos-idx { font-family: var(--fos-mono); font-size: 11px; }
.fos-lbl { font-family: var(--fos-mono); font-size: 11px; letter-spacing: 2px; color: var(--fos-gray); }
.fos-rule { flex: 1; height: 1px; background: var(--fos-line-2); }
.fos-head .meta { font-family: var(--fos-mono); font-size: 11px; color: var(--fos-gray); }

.fos-grid-2 { display: grid; grid-template-columns: 1.45fr 1fr; }

/* ── numbers / type helpers ────────────────────────────────────────────────── */
.fos-disp { font-family: var(--fos-display); font-weight: 700; letter-spacing: -.5px; }
.fos-mono { font-family: var(--fos-mono); }
.fos-num  { font-family: var(--fos-display); font-weight: 700; font-variant-numeric: tabular-nums; }
.fos-tnum { font-variant-numeric: tabular-nums; }

/* boxed key/value cell strips */
.fos-cellrow { display: flex; border: 1.5px solid var(--fos-ink); }
.fos-cell { flex: 1; padding: 11px 13px; border-right: 1.5px solid var(--fos-ink); }
.fos-cell:last-child { border-right: none; }
.fos-cell .k { font-family: var(--fos-mono); font-size: 10px; letter-spacing: 1px; color: var(--fos-gray); }
.fos-cell .v { font-family: var(--fos-display); font-weight: 700; font-size: 18px; margin-top: 3px; }

/* generic stat strip across the top of a page */
.fos-stats { display: grid; border-bottom: 1.5px solid var(--fos-ink); }
.fos-stat { padding: 16px 22px; border-right: 1.5px solid var(--fos-ink); }
.fos-stat:last-child { border-right: none; }
.fos-stat .k { font-family: var(--fos-mono); font-size: 10.5px; letter-spacing: 1.5px; color: var(--fos-gray); }
.fos-stat .v { font-family: var(--fos-display); font-weight: 700; font-size: 32px; margin-top: 6px; letter-spacing: -1px; }
.fos-stat .v small { font-size: 13px; color: var(--fos-faint); font-weight: 400; }

/* recognition / scan frame */
.fos-frame { position: relative; border: 1.5px solid var(--fos-ink); background: var(--fos-inset); overflow: hidden; }
.fos-frame .glyph { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-family: var(--fos-display); font-weight: 700; color: var(--fos-ink); opacity: .9; }
.fos-frame img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.fos-hud { position: absolute; width: 26px; height: 26px; }
.fos-hud.tl { top: 8px; left: 8px;  border-top: 2px solid var(--fos-red); border-left: 2px solid var(--fos-red); }
.fos-hud.tr { top: 8px; right: 8px; border-top: 2px solid var(--fos-red); border-right: 2px solid var(--fos-red); }
.fos-hud.bl { bottom: 8px; left: 8px;  border-bottom: 2px solid var(--fos-red); border-left: 2px solid var(--fos-red); }
.fos-hud.br { bottom: 8px; right: 8px; border-bottom: 2px solid var(--fos-red); border-right: 2px solid var(--fos-red); }
.fos-scanline { position: absolute; left: 0; right: 0; height: 2px; background: var(--fos-red); opacity: .85; animation: osscan 3s ease-in-out infinite; }

/* avatar (initials in an ink box) */
.fos-av { border: 1.5px solid var(--fos-ink); flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-family: var(--fos-display); font-weight: 700; background: var(--fos-paper); }

/* ── tables (FACE/OS grid rows) ────────────────────────────────────────────── */
.fos-table { width: 100%; }
.fos-thead { font-family: var(--fos-mono); font-size: 10.5px; letter-spacing: 1px; color: var(--fos-faint); border-bottom: 1.5px solid var(--fos-ink); }
.fos-row { border-bottom: 1px solid var(--fos-line); align-items: center; }
.fos-row:hover { background: rgba(26,26,28,.025); }

/* Re-skin the legacy .tbl tables that ported pages still use */
.tbl { border-collapse: collapse; }
.tbl th { font-family: var(--fos-mono); font-size: 10.5px; letter-spacing: 1px; color: var(--fos-faint); text-transform: uppercase; border-bottom: 1.5px solid var(--fos-ink); background: transparent; }
.tbl td { border-bottom: 1px solid var(--fos-line); }
.tbl tr:hover td { background: rgba(26,26,28,.025); }
.mono { font-family: var(--fos-mono); }

/* ── buttons ───────────────────────────────────────────────────────────────── */
.btn { font-family: var(--fos-sans); border: 1.5px solid var(--fos-ink); font-weight: 500; }
.btn-primary, .btn-coral { background: var(--fos-red); color: var(--fos-paper); border-color: var(--fos-red); }
.btn-primary:hover, .btn-coral:hover { background: #c81f16; border-color: #c81f16; }
.btn-soft, .btn-ghost { background: transparent; color: var(--fos-ink); border-color: var(--fos-ink); }
.btn-soft:hover, .btn-ghost:hover { background: var(--fos-ink); color: var(--fos-paper); }

.fos-btn { font-family: var(--fos-mono); font-size: 12px; letter-spacing: 1px; padding: 11px 18px; border: 1.5px solid var(--fos-ink); background: transparent; color: var(--fos-ink); cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.fos-btn:hover { background: var(--fos-ink); color: var(--fos-paper); }
.fos-btn.red { background: var(--fos-red); color: var(--fos-paper); border-color: var(--fos-red); }
.fos-btn.red:hover { background: #c81f16; }
.fos-btn.ink { background: var(--fos-ink); color: var(--fos-paper); }

/* chips (dept filter) — connected outline */
.fos-chip { padding: 8px 15px; border: 1.5px solid var(--fos-ink); background: transparent; color: var(--fos-ink); cursor: pointer; font-family: var(--fos-mono); font-size: 12px; letter-spacing: .5px; margin-left: -1.5px; }
.fos-chip.on { background: var(--fos-ink); color: var(--fos-paper); }

/* status text colours */
.c-green { color: var(--fos-green); } .c-red { color: var(--fos-red); }
.c-cobalt { color: var(--fos-cobalt); } .c-amber { color: var(--fos-amber); }
.c-violet { color: var(--fos-violet); } .c-gray { color: var(--fos-faint); }
.c-ink { color: var(--fos-ink); }

/* tag pill (alerts) */
.fos-tag { font-family: var(--fos-mono); font-size: 10.5px; letter-spacing: 1px; font-weight: 600; color: var(--fos-paper); padding: 5px 9px; min-width: 70px; text-align: center; }

/* inputs */
.input, input.fos-input, select.fos-select {
  background: transparent; border: 1.5px solid var(--fos-ink); padding: 11px 13px;
  color: var(--fos-ink); font-size: 14px; font-family: var(--fos-sans);
}
.input:focus, .fos-input:focus, .fos-select:focus { outline: none; border-color: var(--fos-red); }
.fos-label { font-family: var(--fos-mono); font-size: 11px; letter-spacing: 1px; color: var(--fos-gray); display: block; margin-bottom: 7px; }

/* ── drawer (right slide-in) ───────────────────────────────────────────────── */
.fos-scrim { position: fixed; inset: 0; background: rgba(26,26,28,.55); z-index: 80; }
.fos-drawer { position: fixed; top: 0; right: 0; width: 440px; max-width: 92vw; height: 100vh; background: var(--fos-paper); border-left: 1.5px solid var(--fos-ink); z-index: 81; display: flex; flex-direction: column; animation: osslide .25s ease; }
.fos-drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1.5px solid var(--fos-ink); background: var(--fos-ink); color: var(--fos-paper); }
.fos-drawer-body { flex: 1; overflow: auto; padding: 24px; display: flex; flex-direction: column; gap: 20px; }
.fos-drawer-foot { display: flex; border-top: 1.5px solid var(--fos-ink); }
.fos-x { width: 34px; height: 34px; border: 1.5px solid var(--fos-paper); background: transparent; color: var(--fos-paper); cursor: pointer; font-size: 16px; }

/* ── PASS (mobile employee card) ───────────────────────────────────────────── */
.fos-passwrap { height: 100vh; display: flex; align-items: center; justify-content: center; }
.fos-pass { width: 372px; height: 760px; max-height: 94vh; background: var(--fos-paper); border: 2px solid var(--fos-ink); display: flex; flex-direction: column; overflow: hidden; box-shadow: 14px 14px 0 rgba(26,26,28,.12) !important; }
.fos-pass-head { background: var(--fos-ink); color: var(--fos-paper); padding: 18px 20px; }
.fos-barcode { display: flex; gap: 2px; height: 34px; margin-top: 16px; align-items: stretch; }
.fos-barcode i { display: block; height: 100%; }

/* ── TERMINAL (kiosk) ──────────────────────────────────────────────────────── */
.fos-kiosk { height: 100vh; background: var(--fos-ink); color: var(--fos-paper); display: flex; flex-direction: column; position: relative; overflow: hidden; }
.fos-kiosk::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .06; background-image: linear-gradient(#F5F5F4 1px, transparent 1px); background-size: 100% 4px; }
.fos-kiosk-head { display: flex; align-items: center; justify-content: space-between; padding: 22px 34px; border-bottom: 1.5px solid rgba(245,245,244,.3); position: relative; z-index: 1; }
.fos-kiosk-main { flex: 1; display: flex; align-items: center; justify-content: center; position: relative; z-index: 1; }
.fos-kiosk-foot { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 18px; border-top: 1.5px solid rgba(245,245,244,.3); font-family: var(--fos-mono); font-size: 11px; letter-spacing: 1px; color: #9A9A9F; position: relative; z-index: 1; }
.fos-ring { position: absolute; width: 150px; height: 150px; border: 1.5px dashed rgba(229,38,28,.7); border-radius: 50%; animation: osspin 3s linear infinite; }

/* ── mode switcher (fixed bottom-right) ────────────────────────────────────── */
.fos-modes { position: fixed; bottom: 0; right: 0; z-index: 90; display: flex; border-top: 1.5px solid var(--fos-ink); border-left: 1.5px solid var(--fos-ink); background: var(--fos-paper); }
.fos-modebtn { padding: 9px 16px; border: none; border-left: 1.5px solid var(--fos-ink); background: transparent; color: var(--fos-gray); cursor: pointer; font-family: var(--fos-mono); font-size: 11px; letter-spacing: 1px; }
.fos-modebtn:first-child { border-left: none; }
.fos-modebtn.on { background: var(--fos-ink); color: var(--fos-paper); }

/* misc legacy overrides so ported pages feel native */
.page-head h1, h1, h2, .h1, .h2 { font-family: var(--fos-display); letter-spacing: -.5px; }
.sub, .muted, .label-sm { font-family: var(--fos-sans); }
.card { border: 1.5px solid var(--fos-ink); background: var(--fos-paper); }
.card.bare { border: 1.5px solid var(--fos-ink); }

/* responsive: collapse the dashboard 2-col grids on narrow screens */
@media (max-width: 880px) {
  .fos-grid-2 { grid-template-columns: 1fr; }
  .fos-sec-br { border-right: none; border-bottom: 1.5px solid var(--fos-ink); }
}

/* On a REAL phone the PASS card fills the screen (not the desktop "phone mockup"). */
@media (max-width: 768px) {
  .fos-passwrap { display: block; height: 100vh; height: 100dvh; }
  .fos-pass {
    width: 100vw; height: 100vh; height: 100dvh;
    max-height: none; border: none;
    box-shadow: none !important;
  }
  /* masthead nav stays scrollable; keep tap targets comfortable on touch */
  .fos-navbtn { padding: 12px 16px; }
}
