@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@600;700;800&family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  --ink: #171B24;
  --ink-line: #2E3548;
  --cloud: #EEF1F4;
  --cloud-panel: #FFFFFF;
  --cloud-line: #DDE2E8;
  --admin-bg: #F7F8FA;
  --sunrise: #E8963C;
  --sunrise-soft: #FBEAD3;
  --noon: #2A9D8F;
  --noon-soft: #DCF2EF;
  --dusk: #1B7F98;
  --dusk-soft: #DFF0F3;
  --alert: #E85D5D;
  --alert-soft: #FBE3E3;
  --slate-400: #94A0B4;
  --slate-500: #5C6478;
  --slate-600: #454C5E;
  --navy: #0E1B2E;
  --navy-soft: #16263D;
  --navy-line: #263952;
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', sans-serif;
  background: var(--cloud);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, .font-display { font-family: 'Playfair Display', serif; margin: 0; }
.font-display-sans { font-family: 'Space Grotesk', sans-serif; }
p { margin: 0; }
.font-mono, .tabular { font-family: 'IBM Plex Mono', monospace; font-variant-numeric: tabular-nums; }
a { color: inherit; }
button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; }

:focus-visible { outline: 2px solid var(--dusk); outline-offset: 2px; border-radius: 4px; }

/* ---------- Layout helpers ---------- */
.container-sm { max-width: 24rem; margin: 0 auto; }
.container-md { max-width: 42rem; margin: 0 auto; }
.container-lg { max-width: 72rem; margin: 0 auto; }
.stack { display: flex; flex-direction: column; }
.gap-2 { gap: 0.5rem; } .gap-3 { gap: 0.75rem; } .gap-4 { gap: 1rem; }
.row { display: flex; align-items: center; }
.row-between { display: flex; align-items: center; justify-content: space-between; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.75rem; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  border: none; border-radius: 0.75rem; font-weight: 500; font-size: 0.875rem;
  padding: 0.625rem 1rem; cursor: pointer; transition: transform 0.1s, background 0.15s;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; pointer-events: none; }
.btn-lg { padding: 0.875rem 1.25rem; font-size: 1rem; }
.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.8125rem; }
.btn-primary { background: var(--dusk); color: #fff; }
.btn-primary:hover { background: #4353bd; }
.btn-secondary { background: #fff; color: var(--ink); border: 1px solid var(--cloud-line); }
.btn-secondary:hover { background: #F7F8FA; }
.btn-ghost { background: transparent; color: var(--slate-600); }
.btn-ghost:hover { background: rgba(0,0,0,0.05); }
.btn-danger { background: var(--alert); color: #fff; }
.btn-block { width: 100%; }

/* ---------- Cards ---------- */
.card {
  background: #fff; border-radius: 1.25rem; border: 1px solid var(--cloud-line);
  box-shadow: 0 1px 2px rgba(15,19,26,0.04), 0 8px 24px rgba(15,19,26,0.06);
}
.card-admin { background: #fff; border: 1px solid #e2e6ea; border-radius: 1.25rem; box-shadow: 0 1px 2px rgba(0,0,0,0.03), 0 8px 20px rgba(15,19,26,0.05); }
.p-3 { padding: 0.75rem; } .p-4 { padding: 1rem; } .p-5 { padding: 1.25rem; } .p-6 { padding: 1.5rem; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 0.3rem 0.65rem; font-size: 0.75rem; font-weight: 500; }
.badge-slate { background: rgba(0,0,0,0.05); color: var(--slate-600); }
.badge-noon { background: var(--noon-soft); color: var(--noon); }
.badge-alert { background: var(--alert-soft); color: var(--alert); }
.badge-sunrise { background: var(--sunrise-soft); color: var(--sunrise); }
.badge-dusk { background: var(--dusk-soft); color: var(--dusk); }

/* ---------- Inputs ---------- */
.field { display: block; margin-bottom: 1rem; }
.field label { display: block; font-size: 0.75rem; font-weight: 500; color: var(--slate-600); margin-bottom: 0.375rem; }
.input, .settings-input {
  width: 100%; border-radius: 0.75rem; border: 1px solid var(--cloud-line); background: #fff;
  padding: 0.7rem 0.9rem; font-size: 0.875rem; color: var(--ink); transition: border-color .15s, box-shadow .15s;
}
.input:focus, .settings-input:focus { outline: none; border-color: var(--dusk); box-shadow: 0 0 0 3px rgba(76,95,213,0.12); }
.input::placeholder { color: #b7bfca; }

/* ---------- Spinner ---------- */
.spinner {
  width: 1.25rem; height: 1.25rem; border-radius: 999px; border: 2px solid rgba(0,0,0,0.15);
  border-top-color: currentColor; animation: spin 0.7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Top bar (staff app) ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: rgba(238,241,244,0.9); backdrop-filter: blur(6px); border-bottom: 1px solid var(--cloud-line); }
.topbar-inner { max-width: 28rem; margin: 0 auto; padding: 0.9rem 1.25rem; display: flex; align-items: center; justify-content: space-between; }

/* ---------- Bottom nav ---------- */
.bottomnav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: rgba(255,255,255,0.97); border-top: 1px solid var(--cloud-line); padding-bottom: env(safe-area-inset-bottom); }
.bottomnav-inner { max-width: 28rem; margin: 0 auto; display: flex; }
.bottomnav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 0.25rem; padding: 0.65rem 0; font-size: 0.7rem; font-weight: 500; color: var(--slate-500); text-decoration: none; }
.bottomnav a.active { color: var(--dusk); }
.bottomnav svg { width: 22px; height: 22px; }

.app-main { max-width: 28rem; margin: 0 auto; padding: 1.25rem; padding-bottom: 6rem; }

/* ---------- Admin shell ---------- */
.admin-shell { display: flex; min-height: 100vh; background: var(--admin-bg); color: var(--ink); }
.admin-sidebar { width: 15.5rem; flex-shrink: 0; display: flex; flex-direction: column; background: var(--navy); padding: 1.5rem 1rem; color: #fff; }
.admin-logo { display: flex; align-items: center; padding: 0 0.25rem; margin-bottom: 2rem; }
.admin-logo img { max-width: 100%; height: auto; }
.admin-nav { flex: 1; display: flex; flex-direction: column; gap: 0.25rem; }
.admin-nav a { display: flex; align-items: center; gap: 0.75rem; padding: 0.65rem 0.75rem; border-radius: 0.6rem; font-size: 0.875rem; font-weight: 500; color: rgba(255,255,255,0.55); text-decoration: none; transition: background .15s, color .15s; }
.admin-nav a:hover { background: rgba(255,255,255,0.06); color: #fff; }
.admin-nav a.active { background: var(--dusk); color: #fff; }
.admin-nav svg { width: 17px; height: 17px; }
.admin-main { flex: 1; overflow-y: auto; }
.admin-main-inner { max-width: 72rem; margin: 0 auto; padding: 2rem; }
.admin-userbox { margin-top: 1.5rem; display: flex; align-items: center; gap: 0.6rem; background: rgba(255,255,255,0.06); border-radius: 0.6rem; padding: 0.6rem; }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
thead tr { border-bottom: 1px solid var(--cloud-line); text-align: left; font-size: 0.75rem; color: var(--slate-400); }
th, td { padding: 0.75rem 1.1rem; }
tbody tr { border-bottom: 1px solid var(--cloud-line); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--admin-bg); }

/* ---------- Avatars ---------- */
.avatar { border-radius: 999px; object-fit: cover; }
.avatar-fallback { border-radius: 999px; background: var(--dusk-soft); color: var(--dusk); display: flex; align-items: center; justify-content: center; font-family: 'Space Grotesk', sans-serif; font-weight: 600; }

/* ---------- Toggle switch ---------- */
.toggle { position: relative; width: 2.75rem; height: 1.5rem; border-radius: 999px; border: none; background: #dfe3e8; transition: background 0.15s; }
.toggle.on { background: var(--dusk); }
.toggle .knob { position: absolute; top: 2px; left: 2px; width: 1.25rem; height: 1.25rem; border-radius: 999px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.25); transition: left 0.15s; }
.toggle.on .knob { left: 1.375rem; }

/* ---------- Misc ---------- */
.text-slate-500 { color: var(--slate-500); }
.text-slate-400 { color: var(--slate-400); }
.text-alert { color: var(--alert); }
.text-noon { color: var(--noon); }
.text-dusk { color: var(--dusk); }
.hidden { display: none !important; }
.error-banner { background: var(--alert-soft); color: var(--alert); border-radius: 0.6rem; padding: 0.6rem 0.9rem; font-size: 0.875rem; }
.center-loader { display: flex; align-items: center; justify-content: center; height: 16rem; color: var(--slate-400); }

/* ---------- Split-screen auth layout (login/register) ---------- */
.auth-shell { display: flex; min-height: 100vh; }
.auth-panel { flex: 1; background: var(--navy); color: #fff; position: relative; overflow: hidden; padding: 3rem; display: flex; flex-direction: column; justify-content: center; }
.auth-panel-content { position: relative; z-index: 2; max-width: 26rem; }
.auth-watermark { position: absolute; bottom: -3rem; left: -1rem; font-family: 'Playfair Display', serif; font-weight: 800; font-size: 9rem; color: rgba(255,255,255,0.04); line-height: 1; white-space: nowrap; z-index: 1; user-select: none; }
.auth-eyebrow { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.12em; color: var(--noon); text-transform: uppercase; margin-bottom: 1rem; }
.auth-headline { font-family: 'Playfair Display', serif; font-size: 2.75rem; font-weight: 700; line-height: 1.1; color: #fff; }
.auth-headline .accent { color: var(--sunrise); }
.auth-form-side { flex: 1; background: #fff; display: flex; align-items: center; justify-content: center; padding: 2rem; }
.auth-form-inner { width: 100%; max-width: 24rem; }
@media (max-width: 900px) {
  .auth-shell { flex-direction: column; }
  .auth-panel { padding: 2.5rem 1.75rem; min-height: 40vh; }
  .auth-headline { font-size: 2rem; }
  .auth-watermark { font-size: 5rem; }
}

/* ---------- Stepper (register flow, matches "01 — 02 — 03" reference style) ---------- */
.stepper { display: flex; align-items: flex-start; gap: 0; }
.stepper-item { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; }
.stepper-dot { width: 2.25rem; height: 2.25rem; border-radius: 999px; display: flex; align-items: center; justify-content: center; font-family: 'IBM Plex Mono', monospace; font-size: 0.8rem; font-weight: 600; background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.5); border: 1px solid rgba(255,255,255,0.15); transition: all .2s; }
.stepper-dot.active { background: var(--noon); color: #fff; border-color: var(--noon); }
.stepper-dot.done { background: rgba(42,157,143,0.15); color: var(--noon); border-color: var(--noon); }
.stepper-label { font-size: 0.7rem; color: rgba(255,255,255,0.5); white-space: nowrap; }
.stepper-label.active { color: #fff; font-weight: 500; }
.stepper-line { flex: 1; height: 1px; background: rgba(255,255,255,0.15); margin-top: 1.1rem; min-width: 1.5rem; }
.stepper-line.done { background: var(--noon); }

/* Light variant of the stepper, for use on white surfaces (e.g. register form side) */
.stepper-dot-light { background: rgba(0,0,0,0.05); color: var(--slate-400); border: 1px solid var(--cloud-line); }
.stepper-dot-light.active { background: var(--dusk); color: #fff; border-color: var(--dusk); }
.stepper-dot-light.done { background: var(--noon-soft); color: var(--noon); border-color: var(--noon); }
.stepper-label-light { color: var(--slate-400); }
.stepper-label-light.active { color: var(--ink); font-weight: 500; }
.stepper-line-light { background: var(--cloud-line); }
.stepper-line-light.done { background: var(--noon); }

/* ---------- Pills ---------- */
.pill { display: inline-flex; align-items: center; gap: 0.4rem; border-radius: 999px; padding: 0.3rem 0.75rem; font-size: 0.7rem; font-weight: 600; }
.pill-noon { background: var(--noon-soft); color: var(--noon); }
.pill-dot { width: 6px; height: 6px; border-radius: 999px; background: currentColor; }

/* ---------- Ring / donut chart (Today's staff attendance) ---------- */
.ring-chart-wrap { position: relative; width: 8rem; height: 8rem; flex-shrink: 0; }
.ring-chart-wrap svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-chart-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }

@media (max-width: 900px) {
  .admin-sidebar { display: none; }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
}