/* ============================================================
   Infinity Attendance - design tokens
   ============================================================ */
:root {
  /* Warm-tinted charcoal, not pure black. One gray family throughout. */
  --ink:        #16130F;
  --ink-2:      #241E18;
  --ink-3:      #3A322A;

  /* Single accent. The brand orange, used sparingly. */
  --accent:     #FF700D;
  --accent-dk:  #D95A00;
  --accent-sfz: rgba(255, 112, 13, .12);

  --white:      #FFFFFF;
  --paper:      #FAF8F5;
  --paper-2:    #F2EEE8;
  --line:       #E6E0D8;
  --muted:      #8B8177;
  --body:       #554C43;
  --text:       #1F1A15;

  --green:      #2F7D5B;
  --green-soft: #E6F1EB;
  --red:        #C0453D;
  --red-soft:   #F9E9E7;
  --blue:       #35618E;
  --blue-soft:  #E8EFF6;
  --amber-soft: #FBF0DC;
  --amber-ink:  #8A6212;

  --r-sm:       8px;
  --r:          12px;
  --r-lg:       20px;
  --r-xl:       28px;

  /* Shadows carry the background hue rather than generic black. */
  --shadow:     0 1px 2px rgba(34, 26, 18, .05), 0 8px 24px rgba(34, 26, 18, .06);
  --shadow-lg:  0 24px 60px rgba(14, 10, 6, .38);

  --font:       'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono:       'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --ease:       cubic-bezier(.22, .61, .36, 1);

  --z-overlay:  40;
  --z-modal:    60;
}

/* Legacy aliases so existing screens keep working during the redesign. */
:root {
  --primary:    var(--ink);
  --primary-2:  var(--ink-2);
  --off-white:  var(--paper);
  --light-gray: var(--line);
  --mid-gray:   var(--muted);
  --dark-gray:  var(--body);
  --highlight:  #E8A33D;
  --radius:     var(--r);
  --radius-lg:  var(--r-lg);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  font-variant-numeric: tabular-nums;
  color: var(--text);
  background: var(--off-white);
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.55;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Accessibility: a visible focus ring is a requirement, not a nicety. */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: absolute; left: -9999px;
  background: var(--ink); color: var(--white);
  padding: 10px 16px; border-radius: var(--r-sm); z-index: 100;
}
.skip-link:focus { left: 16px; top: 16px; }

/* ============================================================
   Top bar
   ============================================================ */
.topbar {
  background: var(--primary);
  color: var(--white);
  padding: 0 24px;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 40;
}
.topbar-brand { display: flex; align-items: center; gap: 12px; font-weight: 700; letter-spacing: -.2px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--accent); color: var(--white);
  display: grid; place-items: center; font-size: 13px; font-weight: 800;
}
.topbar-nav { display: flex; align-items: center; gap: 6px; }
.topbar-nav a, .topbar-nav button {
  color: rgba(255,255,255,.72);
  background: none; border: 0; cursor: pointer;
  font: inherit; font-size: 14px; padding: 8px 14px;
  border-radius: 8px; text-decoration: none;
}
.topbar-nav a:hover, .topbar-nav button:hover { background: rgba(255,255,255,.08); color: var(--white); text-decoration: none; }
.topbar-nav a.active { background: var(--accent); color: var(--white); font-weight: 600; }
.topbar-user { font-size: 13px; color: rgba(255,255,255,.6); margin-right: 4px; }

/* ============================================================
   Layout
   ============================================================ */
.wrap { max-width: 1180px; margin: 0 auto; padding: 26px 24px 64px; }
.wrap-narrow { max-width: 760px; margin: 0 auto; padding: 26px 24px 64px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; letter-spacing: -.4px; }
.page-head p { color: var(--dark-gray); font-size: 14px; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.card {
  background: var(--white);
  border: 1px solid var(--light-gray);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2 { font-size: 16px; letter-spacing: -.2px; }
.card-sub { font-size: 13px; color: var(--mid-gray); }

.stat-label { font-size: 12px; text-transform: uppercase; letter-spacing: .7px; color: var(--mid-gray); font-weight: 600; }
.stat-value { font-size: 28px; font-weight: 700; letter-spacing: -.8px; margin-top: 4px; }
.stat-note  { font-size: 12px; color: var(--mid-gray); margin-top: 2px; }

/* ============================================================
   Buttons, forms
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: var(--white);
  border: 0; border-radius: var(--radius);
  padding: 11px 20px; font: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: background .15s ease, transform .05s ease;
}
.btn:hover { background: var(--accent-dk); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-ghost { background: var(--white); color: var(--text); border: 1px solid var(--light-gray); }
.btn-ghost:hover { background: var(--off-white); }
.btn-dark { background: var(--primary); }
.btn-dark:hover { background: var(--primary-2); }
.btn-green { background: var(--green); }
.btn-green:hover { background: #17835a; }
.btn-red { background: var(--red); }
.btn-red:hover { background: #bc3838; }
.btn-sm { padding: 7px 13px; font-size: 13px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

label { display: block; font-size: 13px; font-weight: 600; color: var(--dark-gray); margin-bottom: 6px; }
input, select, textarea {
  width: 100%; font: inherit; font-size: 14px; color: var(--text);
  background: var(--white);
  border: 1px solid var(--light-gray); border-radius: var(--radius);
  padding: 10px 12px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255,112,13,.14); }
textarea { min-height: 84px; resize: vertical; }
.field { margin-bottom: 14px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; color: var(--text); }
.check input { width: auto; }

/* ============================================================
   Tables
   ============================================================ */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--light-gray); }
table { width: 100%; border-collapse: collapse; font-size: 14px; background: var(--white); }
th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .7px;
  color: var(--dark-gray); background: var(--off-white);
  padding: 11px 14px; border-bottom: 1px solid var(--light-gray); white-space: nowrap;
}
td { padding: 11px 14px; border-bottom: 1px solid var(--light-gray); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #FCFCFD; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.code-chip {
  display: inline-block; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--primary); color: var(--white);
  padding: 3px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; letter-spacing: .5px;
}

/* ============================================================
   Pills
   ============================================================ */
.pill {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.pill-present  { background: var(--green-soft); color: var(--green); }
.pill-absent   { background: var(--red-soft);   color: var(--red); }
.pill-leave    { background: var(--blue-soft);  color: var(--blue); }
.pill-half_day { background: var(--amber-soft); color: #A66A00; }
.pill-weekend, .pill-holiday { background: var(--light-gray); color: var(--dark-gray); }
.pill-late     { background: var(--amber-soft); color: #A66A00; }
.pill-pending  { background: var(--amber-soft); color: #A66A00; }
.pill-approved { background: var(--green-soft); color: var(--green); }
.pill-rejected, .pill-cancelled { background: var(--red-soft); color: var(--red); }
.pill-in       { background: var(--green-soft); color: var(--green); }
.pill-out      { background: var(--light-gray); color: var(--dark-gray); }
.pill-on_leave { background: var(--blue-soft);  color: var(--blue); }
.pill-not_started { background: var(--light-gray); color: var(--mid-gray); }

/* ============================================================
   Alerts, tabs, empty
   ============================================================ */
.alert { padding: 12px 15px; border-radius: var(--radius); font-size: 14px; margin-bottom: 16px; }
.alert-error   { background: var(--red-soft);   color: #93292A; }
.alert-success { background: var(--green-soft); color: #12684A; }
.alert-info    { background: var(--blue-soft);  color: #1B4BA8; }
.alert:empty { display: none; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--light-gray); margin-bottom: 20px; flex-wrap: wrap; }
.tab {
  background: none; border: 0; border-bottom: 2px solid transparent;
  padding: 11px 16px; font: inherit; font-size: 14px; font-weight: 600;
  color: var(--mid-gray); cursor: pointer;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.empty { text-align: center; padding: 40px 20px; color: var(--mid-gray); font-size: 14px; }

/* ============================================================
   Kiosk - the wall tablet / shared device home screen
   Entry pad is anchored to the bottom so it sits in thumb reach.
   ============================================================ */
.kiosk {
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background:
    radial-gradient(120% 80% at 18% 0%, var(--ink-2) 0%, var(--ink) 58%),
    var(--ink);
  color: var(--white);
  position: relative;
  overflow: hidden;
}

/* Grain overlay breaks the digital flatness of a large dark surface. */
.kiosk::after {
  content: '';
  position: fixed; inset: 0;
  pointer-events: none;
  opacity: .28;
  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='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.42'/%3E%3C/svg%3E");
}

/* ---------- header ---------- */
.k-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 22px 28px 0; position: relative; z-index: 2;
}
.k-brand { display: flex; align-items: center; gap: 11px; }
.k-mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--accent); color: var(--white);
  display: grid; place-items: center;
  font-size: 13px; font-weight: 700; letter-spacing: -.3px;
}
.k-brand-name { font-size: 16px; font-weight: 600; letter-spacing: -.2px; }
.k-brand-sub {
  font-size: 11px; letter-spacing: 1.4px; text-transform: uppercase;
  color: rgba(255,255,255,.42); font-weight: 500; margin-top: -2px;
}

/* The portal button is the only secondary destination offered here. */
.k-portal {
  display: inline-flex; align-items: center; gap: 9px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.14);
  color: var(--white); font: inherit; font-size: 14px; font-weight: 500;
  padding: 11px 18px; border-radius: 999px; cursor: pointer;
  transition: background .2s var(--ease), border-color .2s var(--ease), transform .08s var(--ease);
  text-decoration: none;
}
.k-portal:hover {
  background: rgba(255,255,255,.13);
  border-color: rgba(255,255,255,.26);
  text-decoration: none; color: var(--white);
}
.k-portal:active { transform: translateY(1px); }
.k-portal svg { width: 16px; height: 16px; flex: none; }

/* ---------- hero: clock and instruction ---------- */
.k-hero {
  display: flex; flex-direction: column; justify-content: center;
  padding: 28px; position: relative; z-index: 2; text-align: left;
  max-width: 620px; margin: 0 auto; width: 100%;
}
.k-clock {
  font-size: clamp(56px, 12vw, 92px);
  font-weight: 300; letter-spacing: -3.5px; line-height: .95;
  font-variant-numeric: tabular-nums;
}
.k-clock .k-ampm {
  font-size: .34em; font-weight: 500; letter-spacing: 0;
  color: rgba(255,255,255,.42); margin-left: 10px;
}
.k-date {
  font-size: 15px; color: rgba(255,255,255,.48);
  margin-top: 10px; font-weight: 400;
}
.k-instruct {
  margin-top: 26px; font-size: clamp(19px, 3.4vw, 25px);
  font-weight: 500; letter-spacing: -.5px; text-wrap: balance; line-height: 1.3;
}
.k-instruct em {
  font-style: normal; color: var(--accent);
}
.k-note { font-size: 14px; color: rgba(255,255,255,.4); margin-top: 8px; }

.k-alert {
  margin-top: 18px; padding: 12px 16px;
  border-radius: var(--r); font-size: 14.5px; font-weight: 500;
  background: rgba(192,69,61,.16);
  border: 1px solid rgba(192,69,61,.4);
  color: #FFC9C4;
}
.k-alert:empty { display: none; }

/* ---------- entry pad, anchored bottom ---------- */
.k-pad {
  position: relative; z-index: 2;
  background: rgba(255,255,255,.045);
  border-top: 1px solid rgba(255,255,255,.1);
  backdrop-filter: blur(14px);
  padding: 20px 24px calc(22px + env(safe-area-inset-bottom, 0px));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
}
.k-pad-inner { max-width: 480px; margin: 0 auto; }

.k-step {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin-bottom: 9px;
}
.k-step-label {
  font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase;
  color: rgba(255,255,255,.46); font-weight: 600;
}
.k-step-hint { font-size: 12.5px; color: rgba(255,255,255,.34); }

.k-display {
  background: rgba(0,0,0,.28);
  border: 1px solid rgba(255,255,255,.13);
  border-radius: var(--r);
  padding: 14px 18px; margin-bottom: 13px;
  min-height: 62px; display: flex; align-items: center;
  transition: border-color .2s var(--ease), background .2s var(--ease);
}
.k-display.is-active {
  border-color: rgba(255,112,13,.55);
  background: rgba(255,112,13,.07);
}
.k-value {
  font-family: var(--mono);
  font-size: 30px; font-weight: 600; letter-spacing: 6px;
  color: var(--white); line-height: 1;
}
.k-value.is-empty { color: rgba(255,255,255,.2); letter-spacing: 4px; }

.k-caret {
  display: inline-block; width: 2px; height: 26px;
  background: var(--accent); margin-left: 2px; vertical-align: -4px;
  animation: kblink 1.1s steps(2, start) infinite;
}
@keyframes kblink { 0%, 50% { opacity: 1; } 51%, 100% { opacity: 0; } }

.k-field { margin-bottom: 13px; }
.k-field input {
  width: 100%; font-family: var(--mono);
  font-size: 17px; letter-spacing: 3px; text-transform: uppercase;
  background: rgba(0,0,0,.22); color: var(--white);
  border: 1px solid rgba(255,255,255,.13);
  border-radius: var(--r); padding: 13px 16px;
}
.k-field input::placeholder {
  letter-spacing: .4px; text-transform: none;
  color: rgba(255,255,255,.28); font-family: var(--font);
}
.k-field input:focus {
  border-color: rgba(255,112,13,.6);
  box-shadow: 0 0 0 3px var(--accent-sfz);
}

.k-keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.k-key {
  font-family: var(--mono);
  font-size: 22px; font-weight: 500; color: var(--white);
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.09);
  border-radius: var(--r); padding: 17px 0; cursor: pointer;
  transition: background .15s var(--ease), transform .07s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.k-key:hover { background: rgba(255,255,255,.13); }
.k-key:active { transform: scale(.965); background: rgba(255,255,255,.19); }

.k-key-alt {
  font-family: var(--font); font-size: 13px;
  font-weight: 600; letter-spacing: .6px; text-transform: uppercase;
  color: rgba(255,255,255,.62);
}
.k-key-go {
  background: var(--accent); border-color: var(--accent); color: var(--white);
  font-family: var(--font); font-size: 14px; font-weight: 600;
  letter-spacing: .6px; text-transform: uppercase;
}
.k-key-go:hover { background: var(--accent-dk); border-color: var(--accent-dk); }
.k-key-go:disabled { opacity: .4; cursor: not-allowed; }

.k-foot {
  margin-top: 15px; text-align: center;
  font-size: 12.5px; color: rgba(255,255,255,.3);
}

/* ---------- result overlay ---------- */
.k-result {
  position: fixed; inset: 0; z-index: var(--z-modal);
  background: rgba(12, 9, 6, .965);
  display: none; place-items: center; padding: 28px;
}
.k-result.is-open { display: grid; animation: kfade .22s var(--ease); }
@keyframes kfade { from { opacity: 0; } to { opacity: 1; } }

.k-result-inner {
  text-align: center; color: var(--white); max-width: 460px;
  animation: krise .34s var(--ease);
}
@keyframes krise {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: none; }
}

.k-badge {
  width: 76px; height: 76px; border-radius: 24px;
  display: grid; place-items: center; margin: 0 auto 22px;
}
.k-badge svg { width: 36px; height: 36px; }
.k-badge.in  { background: var(--green); box-shadow: 0 12px 40px rgba(47,125,91,.4); }
.k-badge.out { background: var(--accent); box-shadow: 0 12px 40px rgba(255,112,13,.34); }
.k-badge.err { background: var(--red); box-shadow: 0 12px 40px rgba(192,69,61,.4); }

.k-result-action {
  font-size: 12px; letter-spacing: 2.2px; text-transform: uppercase;
  color: rgba(255,255,255,.46); font-weight: 600;
}
.k-result-name {
  font-size: clamp(24px, 5vw, 33px); font-weight: 600;
  letter-spacing: -.8px; margin: 7px 0 3px; text-wrap: balance;
}
.k-result-time {
  font-family: var(--mono); font-size: clamp(38px, 9vw, 52px);
  font-weight: 600; letter-spacing: -1.5px;
}
.k-result-meta {
  font-size: 13.5px; color: rgba(255,255,255,.44); margin-top: 10px;
}
.k-result-msg {
  font-size: 14px; color: #F0B96A; margin-top: 14px; line-height: 1.55;
}
.k-result-dismiss {
  margin-top: 26px; font-size: 12.5px; color: rgba(255,255,255,.3);
}

@media (max-width: 560px) {
  .k-head { padding: 16px 18px 0; }
  .k-hero { padding: 20px 18px; }
  .k-pad { padding: 16px 18px calc(18px + env(safe-area-inset-bottom, 0px)); }
  .k-key { padding: 15px 0; font-size: 20px; }
  .k-portal span { display: none; }
  .k-portal { padding: 11px 13px; }
}

@media (min-height: 860px) {
  .k-hero { padding-bottom: 60px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ============================================================
   Login
   ============================================================ */
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--off-white); }
.login-card { width: 100%; max-width: 380px; background: var(--white); border-radius: var(--radius-lg); padding: 30px 28px; box-shadow: var(--shadow); }
.login-card h1 { font-size: 20px; margin-bottom: 4px; letter-spacing: -.3px; }
.login-card p.sub { font-size: 13px; color: var(--mid-gray); margin-bottom: 20px; }

/* ============================================================
   Misc
   ============================================================ */
.hidden { display: none !important; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.filters { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 16px; }
.filters .field { margin-bottom: 0; min-width: 150px; }
.muted { color: var(--mid-gray); font-size: 13px; }
.strong { font-weight: 600; }
.spacer { height: 18px; }
.bal-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--light-gray); }
.bal-row:last-child { border-bottom: 0; }
.bal-name { font-weight: 600; font-size: 14px; }
.bal-num { font-size: 20px; font-weight: 700; letter-spacing: -.4px; }

@media (max-width: 900px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 620px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .topbar { padding: 0 14px; height: auto; flex-wrap: wrap; gap: 8px; padding-top: 10px; padding-bottom: 10px; }
  .wrap, .wrap-narrow { padding: 18px 14px 48px; }
  .result-name { font-size: 24px; }
  .result-time { font-size: 34px; }
}

/* Screen-reader-only label text. */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
