/* ===================================================================
   Shine Security — Attendance console
   Direction: "Night Watch". The world this serves is a guard desk at
   3am: deep harbour navy, brass fittings, sodium light. Colour carries
   state rather than decorating it —
       teal  = live, an officer is signed in right now
       brass = settled, the shift is closed
       coral = this needs a person
   Boldness is spent in one place: the Bodoni numerals on the readout.
   Everything around them is deliberately quiet.
   =================================================================== */

:root {
  --ink:        #0A0F1C;
  --panel:      #121A2B;
  --panel-2:    #172136;
  --line:       #253150;
  --line-soft:  #1B2540;

  --porcelain:  #E8ECF5;
  --mist:       #8792AC;
  --mist-dim:   #5C6884;

  --brass:      #C9A44C;
  --brass-dim:  #8A7133;
  --live:       #3FBFAE;
  --alert:      #E2705F;

  --display: "Bodoni Moda", "Didot", "Times New Roman", serif;
  --body:    "Inter Tight", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono:    "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --rail-w: 208px;
  --drawer-w: 460px;

  --step: 4px;
  --r-sm: 3px;
  --r-md: 6px;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--ink);
  color: var(--porcelain);
  font-family: var(--body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body { min-height: 100vh; }

[hidden] { display: none !important; }

button, input, select { font-family: inherit; font-size: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* ── type primitives ─────────────────────────────────────────────── */

.eyebrow {
  margin: 0 0 calc(var(--step) * 1.5);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brass-dim);
}

.title {
  margin: 0;
  font-family: var(--display);
  font-size: 38px;
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.05;
}

.lede {
  max-width: 62ch;
  margin: 0 0 calc(var(--step) * 6);
  color: var(--mist);
}

.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ── sign in ─────────────────────────────────────────────────────── */

.gate {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: calc(var(--step) * 6);
  overflow: hidden;
}

/* A single slow sweep of sodium light across the harbour dark. The only
   ambient motion in the product; the console itself stays still. */
.gate__scrim {
  position: absolute;
  inset: -40%;
  z-index: 0;
  background:
    radial-gradient(52% 40% at 22% 18%, rgba(201, 164, 76, 0.16), transparent 62%),
    radial-gradient(46% 38% at 82% 78%, rgba(63, 191, 174, 0.10), transparent 60%);
  animation: drift 26s var(--ease) infinite alternate;
}

@keyframes drift {
  from { transform: translate3d(-2%, -1%, 0) scale(1); }
  to   { transform: translate3d(3%, 2%, 0) scale(1.08); }
}

.gate__frame {
  position: relative;
  z-index: 1;
  width: min(400px, 100%);
  padding: calc(var(--step) * 10) calc(var(--step) * 9) calc(var(--step) * 8);
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: 0 40px 100px -30px rgba(0, 0, 0, 0.9);
}

.gate__mark { display: flex; align-items: center; gap: calc(var(--step) * 3); }

.mark__glyph {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  font-family: var(--display);
  font-size: 22px;
  color: var(--brass);
  border: 1px solid var(--brass-dim);
  border-radius: 50%;
}

.mark__word {
  font-family: var(--display);
  font-size: 19px;
  letter-spacing: 0.01em;
}

.gate__lede {
  margin: calc(var(--step) * 3) 0 calc(var(--step) * 8);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mist-dim);
}

.gate__form { display: grid; gap: calc(var(--step) * 4); }

.gate__foot {
  margin: calc(var(--step) * 8) 0 0;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--mist-dim);
}

/* ── fields ──────────────────────────────────────────────────────── */

.field { display: grid; gap: calc(var(--step) * 1.5); }

.field__label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mist-dim);
}

.field input,
.field select {
  padding: calc(var(--step) * 2.5) calc(var(--step) * 3);
  background: rgba(10, 15, 28, 0.72);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  transition: border-color 140ms var(--ease);
}

.field input:hover,
.field select:hover { border-color: var(--mist-dim); }

.field input:focus,
.field select:focus { border-color: var(--brass); outline: none; }

.field--inline { min-width: 132px; }

.toggle {
  display: inline-flex;
  align-items: center;
  gap: calc(var(--step) * 2);
  padding-top: calc(var(--step) * 4);
  font-size: 12px;
  color: var(--mist);
  cursor: pointer;
}

.toggle input { accent-color: var(--brass); }

/* ── buttons ─────────────────────────────────────────────────────── */

.btn {
  padding: calc(var(--step) * 2.5) calc(var(--step) * 5);
  font-weight: 500;
  letter-spacing: 0.01em;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background 140ms var(--ease), border-color 140ms var(--ease),
              color 140ms var(--ease);
}

.btn:hover { border-color: var(--mist-dim); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn--brass {
  color: var(--ink);
  background: var(--brass);
  border-color: var(--brass);
  font-weight: 600;
}
.btn--brass:hover { background: #D8B45E; border-color: #D8B45E; }

.btn--ghost { color: var(--mist); }
.btn--ghost:hover { color: var(--porcelain); }

.btn--sm { padding: calc(var(--step) * 1.5) calc(var(--step) * 3); font-size: 12px; }

.btn--live { color: var(--live); border-color: rgba(63, 191, 174, 0.4); }
.btn--alert { color: var(--alert); border-color: rgba(226, 112, 95, 0.4); }

/* ── shell ───────────────────────────────────────────────────────── */

.shell {
  display: grid;
  grid-template-columns: var(--rail-w) 1fr;
  min-height: 100vh;
}

.rail {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: calc(var(--step) * 7) calc(var(--step) * 5);
  background: var(--panel);
  border-right: 1px solid var(--line-soft);
}

.rail__mark { margin-bottom: calc(var(--step) * 10); }

.rail__nav { flex: 1; margin: 0; padding: 0; list-style: none; }

.nav {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: calc(var(--step) * 2);
  width: 100%;
  padding: calc(var(--step) * 2.5) calc(var(--step) * 3);
  margin-bottom: calc(var(--step) * 1);
  text-align: left;
  color: var(--mist);
  background: transparent;
  border: 0;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: color 140ms var(--ease), background 140ms var(--ease);
}

.nav:hover { color: var(--porcelain); background: rgba(255, 255, 255, 0.03); }

.nav.is-on {
  color: var(--porcelain);
  background: rgba(201, 164, 76, 0.09);
}

/* The active marker is a brass spine, echoing the ledger's status spine
   so the same visual grammar means "this one" in both places. */
.nav.is-on::before {
  content: "";
  position: absolute;
  left: calc(var(--step) * -5);
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--brass);
}

.nav__count {
  padding: 1px calc(var(--step) * 1.5);
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink);
  background: var(--alert);
  border-radius: 999px;
}

.rail__foot { border-top: 1px solid var(--line-soft); padding-top: calc(var(--step) * 4); }

.who { display: grid; margin-bottom: calc(var(--step) * 3); }
.who__name { font-size: 13px; }
.who__role {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  color: var(--mist-dim);
}

/* ── stage ───────────────────────────────────────────────────────── */

.stage {
  min-width: 0;
  padding: calc(var(--step) * 10) calc(var(--step) * 12);
}

.stage__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: calc(var(--step) * 6);
  margin-bottom: calc(var(--step) * 8);
}

.stage__count, .clock {
  margin: 0;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--mist-dim);
}

.clock { font-size: 13px; color: var(--mist); }

/* ── readout: the signature ──────────────────────────────────────── */

.readout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1px;
  margin-bottom: calc(var(--step) * 10);
  background: var(--line-soft);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  overflow: hidden;
}

.readout__cell { padding: calc(var(--step) * 6); background: var(--panel); }

.readout__label {
  margin: 0 0 calc(var(--step) * 3);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--mist-dim);
}

/* The one loud gesture in the product. */
.readout__figure {
  margin: 0;
  font-family: var(--display);
  font-size: 58px;
  font-weight: 400;
  line-height: 0.9;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--porcelain);
}

.readout__cell--alert .readout__figure { color: var(--alert); }

.readout__note {
  margin: calc(var(--step) * 2) 0 0;
  font-size: 12px;
  color: var(--mist);
}

/* ── panels ──────────────────────────────────────────────────────── */

.panel {
  margin-bottom: calc(var(--step) * 8);
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
}

.panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(var(--step) * 4) calc(var(--step) * 6);
  border-bottom: 1px solid var(--line-soft);
}

.panel__title { margin: 0; font-size: 13px; font-weight: 600; letter-spacing: 0.01em; }

/* ── filters ─────────────────────────────────────────────────────── */

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: calc(var(--step) * 4);
  padding: calc(var(--step) * 5) calc(var(--step) * 6);
  margin-bottom: calc(var(--step) * 6);
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
}

/* ── ledger ──────────────────────────────────────────────────────── */

.ledger__head,
.row {
  display: grid;
  grid-template-columns:
    minmax(190px, 1.6fr) minmax(120px, 1fr) 96px 110px
    82px 82px 92px 72px 116px;
  gap: calc(var(--step) * 3);
  align-items: center;
}

.ledger__head {
  padding: 0 calc(var(--step) * 6) calc(var(--step) * 3);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mist-dim);
}

.ledger { display: grid; }

.row {
  position: relative;
  width: 100%;
  padding: calc(var(--step) * 3.5) calc(var(--step) * 6);
  text-align: left;
  background: var(--panel);
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  cursor: pointer;
  transition: background 120ms var(--ease);
}

.row:first-child { border-top-left-radius: var(--r-md); border-top-right-radius: var(--r-md); }
.row:last-child  { border-bottom: 0; border-bottom-left-radius: var(--r-md); border-bottom-right-radius: var(--r-md); }
.row:hover { background: var(--panel-2); }

/* The status spine: 2px of colour on the leading edge is the whole
   at-a-glance system. It reads down a column of forty rows without the
   eye having to parse any text. */
.row::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--brass-dim);
}
.row[data-spine="live"]::before  { background: var(--live); }
.row[data-spine="alert"]::before { background: var(--alert); }

.ledger--compact .row {
  grid-template-columns: minmax(180px, 1.4fr) minmax(110px, 1fr) 100px 1fr;
  padding-block: calc(var(--step) * 3);
}

.who-cell { display: grid; gap: 1px; min-width: 0; }
.who-cell__name { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-cell__code { font-family: var(--mono); font-size: 10px; color: var(--mist-dim); }

.cell { font-size: 12px; color: var(--mist); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell--mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.cell--strong { color: var(--porcelain); }

.state {
  display: inline-flex;
  align-items: center;
  gap: calc(var(--step) * 1.5);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--mist);
}

.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--brass-dim); flex: none; }
.dot--live { background: var(--live); animation: pulse 2.4s var(--ease) infinite; }
.dot--alert { background: var(--alert); }

@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(63, 191, 174, 0.5); }
  50%      { opacity: 0.7; box-shadow: 0 0 0 5px rgba(63, 191, 174, 0); }
}

.tags { display: flex; flex-wrap: wrap; gap: calc(var(--step)); }

.tag {
  padding: 1px calc(var(--step) * 1.5);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.06em;
  color: var(--alert);
  border: 1px solid rgba(226, 112, 95, 0.32);
  border-radius: var(--r-sm);
}

.tag--quiet { color: var(--mist-dim); border-color: var(--line); }

/* ── gallery (punch log) ─────────────────────────────────────────── */

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(212px, 1fr));
  gap: calc(var(--step) * 4);
}

.shot {
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  text-align: left;
  padding: 0;
  cursor: pointer;
  transition: border-color 140ms var(--ease), transform 140ms var(--ease);
}

.shot:hover { border-color: var(--brass-dim); transform: translateY(-2px); }

.shot__frame {
  position: relative;
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  background: linear-gradient(140deg, var(--panel-2), #0D1424);
  border-bottom: 1px solid var(--line-soft);
}

.shot__frame img { width: 100%; height: 100%; object-fit: cover; }

.shot__absent {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--mist-dim);
}

.shot__type {
  position: absolute;
  top: calc(var(--step) * 2);
  left: calc(var(--step) * 2);
  padding: 2px calc(var(--step) * 2);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--ink);
  background: var(--brass);
  border-radius: var(--r-sm);
}
.shot__type[data-type="OUT"] { background: var(--mist); }

.shot__meta { padding: calc(var(--step) * 3) calc(var(--step) * 4); display: grid; gap: 2px; }

/* ── drawer ──────────────────────────────────────────────────────── */

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  width: min(var(--drawer-w), 100%);
  height: 100vh;
  background: var(--panel);
  border-left: 1px solid var(--line);
  box-shadow: -30px 0 80px -40px rgba(0, 0, 0, 0.95);
  animation: slide-in 220ms var(--ease);
}

@keyframes slide-in { from { transform: translateX(18px); opacity: 0; } to { transform: none; opacity: 1; } }

.drawer__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: calc(var(--step) * 4);
  padding: calc(var(--step) * 6);
  border-bottom: 1px solid var(--line-soft);
}

.drawer__title { margin: 0; font-family: var(--display); font-size: 24px; font-weight: 400; }

.drawer__body { flex: 1; overflow-y: auto; padding: calc(var(--step) * 6); }

.veil {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(5, 8, 16, 0.6);
  backdrop-filter: blur(2px);
}

.dl { display: grid; grid-template-columns: 116px 1fr; gap: calc(var(--step) * 2) calc(var(--step) * 4); margin: 0 0 calc(var(--step) * 6); }
.dl dt { font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--mist-dim); }
.dl dd { margin: 0; font-size: 13px; }

.sub {
  margin: calc(var(--step) * 6) 0 calc(var(--step) * 3);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--brass-dim);
}

.evidence { display: grid; gap: calc(var(--step) * 3); }

.evidence__item {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: calc(var(--step) * 4);
  padding: calc(var(--step) * 3);
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
}

.evidence__thumb {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #0D1424;
  border-radius: var(--r-sm);
}
.evidence__thumb img { width: 100%; height: 100%; object-fit: cover; }

.stack { display: grid; gap: calc(var(--step) * 4); }

.card {
  padding: calc(var(--step) * 5) calc(var(--step) * 6);
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-left: 2px solid var(--brass-dim);
  border-radius: var(--r-md);
}

.card__actions { display: flex; gap: calc(var(--step) * 3); margin-top: calc(var(--step) * 4); }

/* ── notices, empties, toast ─────────────────────────────────────── */

.notice {
  margin: 0;
  padding: calc(var(--step) * 3) calc(var(--step) * 4);
  font-size: 12px;
  border-radius: var(--r-sm);
}
.notice--alert { color: var(--alert); background: rgba(226, 112, 95, 0.08); border: 1px solid rgba(226, 112, 95, 0.28); }

.empty {
  padding: calc(var(--step) * 12) calc(var(--step) * 6);
  text-align: center;
  color: var(--mist-dim);
}
.empty__line { margin: 0 0 calc(var(--step) * 2); font-family: var(--display); font-size: 19px; color: var(--mist); }
.empty__hint { margin: 0; font-size: 12px; }

.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: calc(var(--step) * 4);
  padding: calc(var(--step) * 5) 0;
}
.pager__label { font-family: var(--mono); font-size: 11px; color: var(--mist-dim); }

.toast {
  position: fixed;
  bottom: calc(var(--step) * 6);
  left: 50%;
  z-index: 60;
  transform: translateX(-50%);
  padding: calc(var(--step) * 3) calc(var(--step) * 6);
  font-size: 13px;
  background: var(--panel-2);
  border: 1px solid var(--brass-dim);
  border-radius: var(--r-sm);
  box-shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.9);
}

.skeleton {
  height: 46px;
  background: linear-gradient(90deg, var(--panel) 25%, var(--panel-2) 50%, var(--panel) 75%);
  background-size: 200% 100%;
  border-bottom: 1px solid var(--line-soft);
  animation: shimmer 1.3s linear infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ── responsive ──────────────────────────────────────────────────── */

@media (max-width: 1180px) {
  .ledger__head { display: none; }
  .row, .ledger--compact .row {
    grid-template-columns: 1fr auto;
    gap: calc(var(--step) * 2);
    row-gap: calc(var(--step) * 1);
  }
  .row .cell--hide { display: none; }
}

@media (max-width: 860px) {
  :root { --rail-w: 100%; }
  .shell { grid-template-columns: 1fr; }
  .rail {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: calc(var(--step) * 4);
    padding: calc(var(--step) * 3) calc(var(--step) * 4);
    overflow-x: auto;
  }
  .rail__mark { margin: 0; }
  .rail__nav { display: flex; gap: calc(var(--step) * 1); }
  .nav { white-space: nowrap; }
  .nav.is-on::before { left: 0; top: auto; bottom: -2px; right: 0; width: auto; height: 2px; }
  .rail__foot { border: 0; padding: 0; margin-left: auto; }
  .who { display: none; }
  .stage { padding: calc(var(--step) * 6) calc(var(--step) * 4); }
  .title { font-size: 28px; }
  .readout__figure { font-size: 42px; }
  .drawer { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
