/* ============================================================
   Metzlabs Team Status — theme tokens
   ============================================================ */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f2f4f7;
  --surface-3: #eaedf1;
  --border: #e4e7ec;
  --border-strong: #d3d8e0;
  --ink: #101828;
  --ink-2: #344054;
  --muted: #667085;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-ink: #ffffff;
  --accent-soft: #eef2ff;
  --accent-soft-border: #dfe3ff;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --danger-border: #fecaca;
  --ok: #15803d;
  --ok-soft: #f0fdf4;
  --ok-border: #bbf7d0;
  --ring: rgba(79,70,229,.18);
  --shadow-sm: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.05);
  --shadow-md: 0 4px 12px rgba(16,24,40,.08), 0 2px 4px rgba(16,24,40,.04);
  --shadow-lg: 0 20px 45px rgba(16,24,40,.14);
  --sidebar-w: 248px;
}
[data-theme="dark"] {
  --bg: #0b0e14;
  --surface: #141821;
  --surface-2: #1b2029;
  --surface-3: #232a35;
  --border: #262d38;
  --border-strong: #333b48;
  --ink: #e7ebf2;
  --ink-2: #c3cbd8;
  --muted: #8b97a8;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-ink: #ffffff;
  --accent-soft: rgba(99,102,241,.16);
  --accent-soft-border: rgba(99,102,241,.32);
  --danger: #f87171;
  --danger-soft: rgba(248,113,113,.12);
  --danger-border: rgba(248,113,113,.3);
  --ok: #4ade80;
  --ok-soft: rgba(74,222,128,.12);
  --ok-border: rgba(74,222,128,.3);
  --ring: rgba(99,102,241,.32);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow-md: 0 6px 18px rgba(0,0,0,.45);
  --shadow-lg: 0 24px 50px rgba(0,0,0,.6);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
::selection { background: var(--accent-soft); }

.pulse { width: 10px; height: 10px; border-radius: 50%; background: #22c55e; display: inline-block;
  box-shadow: 0 0 0 0 rgba(34,197,94,.5); animation: pulse 2.4s infinite; }
@keyframes pulse { 0%{box-shadow:0 0 0 0 rgba(34,197,94,.5);} 70%{box-shadow:0 0 0 7px rgba(34,197,94,0);} 100%{box-shadow:0 0 0 0 rgba(34,197,94,0);} }

/* ============================================================
   App shell
   ============================================================ */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w); flex: none; position: sticky; top: 0; height: 100vh;
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 18px 14px; z-index: 40;
}
.side-brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 18px; }
.side-brand .brand-mark { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-sm); }
.side-brand .brand-mark .pulse { background:#fff; box-shadow: 0 0 0 0 rgba(255,255,255,.5); animation:pulse-w 2.4s infinite; }
@keyframes pulse-w { 0%{box-shadow:0 0 0 0 rgba(255,255,255,.5);} 70%{box-shadow:0 0 0 6px rgba(255,255,255,0);} 100%{box-shadow:0 0 0 0 rgba(255,255,255,0);} }
.side-brand .brand-text { font-weight: 800; font-size: 16px; letter-spacing: -.01em; }

.side-nav { display: flex; flex-direction: column; gap: 3px; margin-top: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px;
  color: var(--ink-2); font-weight: 600; font-size: 14.5px; transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }
.nav-item svg { width: 19px; height: 19px; opacity: .85; }
.nav-item.active { background: var(--accent-soft); color: var(--accent); position: relative; }
.nav-item.active svg { opacity: 1; }
[data-theme="dark"] .nav-item.active { color: var(--accent-hover); }
.nav-item.active::before { content:""; position:absolute; left:-14px; top:8px; bottom:8px; width:3px; border-radius:0 3px 3px 0; background: var(--accent); }

.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding-top: 14px; }
.theme-toggle {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--ink-2); font: inherit; font-weight: 600; font-size: 14px; cursor: pointer;
}
.theme-toggle:hover { background: var(--surface-3); color: var(--ink); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .ic-moon { display: none; }
[data-theme="dark"] .theme-toggle .ic-sun { display: none; }
[data-theme="dark"] .theme-toggle .ic-moon { display: block; }

.user-card { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.avatar { width: 36px; height: 36px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover)); color: #fff; font-weight: 700; font-size: 13px; letter-spacing: .02em; }
.u-meta { min-width: 0; }
.u-name { font-weight: 700; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.u-role { font-size: 11.5px; color: var(--muted); }
.signout { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; color: var(--muted); font-weight: 600; font-size: 14px; }
.signout:hover { background: var(--danger-soft); color: var(--danger); text-decoration: none; }
.signout svg { width: 18px; height: 18px; }

.scrim { display: none; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mobile-top { display: none; }

.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 30px 32px 72px; }

/* ============================================================
   Headers & shared
   ============================================================ */
.page-title { font-size: 25px; font-weight: 800; letter-spacing: -.02em; margin: 0 0 4px; }
.page-sub { color: var(--muted); font-size: 14px; margin: 0 0 24px; }

.panel, .picker {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 22px; box-shadow: var(--shadow-sm); margin-bottom: 22px;
}
.panel h2, .picker h2 { margin: 0 0 4px; font-size: 15.5px; font-weight: 700; }
.panel .muted, .picker .hint, .hint { color: var(--muted); font-size: 13.5px; margin: 0 0 16px; }
.muted { color: var(--muted); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; margin-top: 18px;
  padding: 12px 16px; border: 0; border-radius: 11px; background: var(--accent); color: var(--accent-ink);
  font: inherit; font-weight: 700; font-size: 14.5px; cursor: pointer; transition: background .15s, transform .05s, box-shadow .15s; box-shadow: var(--shadow-sm); }
.btn:hover { background: var(--accent-hover); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(1px); }
.btn.secondary { background: var(--surface); color: var(--ink-2); border: 1px solid var(--border-strong); box-shadow: none; }
.btn.secondary:hover { background: var(--surface-2); color: var(--ink); }
.btn.small { width: auto; margin: 0; padding: 7px 12px; font-size: 13px; border-radius: 9px; }

/* Inputs */
label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin: 12px 0 6px; }
input[type=text], input[type=password], input[type=time] {
  width: 100%; padding: 11px 13px; border: 1px solid var(--border-strong); border-radius: 11px; font: inherit;
  background: var(--surface); color: var(--ink); transition: border-color .15s, box-shadow .15s;
}
input::placeholder { color: var(--muted); opacity: .8; }
input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--ring); }
[data-theme="dark"] input[type=time]::-webkit-calendar-picker-indicator { filter: invert(1) opacity(.7); }

.flash { background: var(--ok-soft); color: var(--ok); border: 1px solid var(--ok-border); padding: 11px 15px; border-radius: 12px; margin-bottom: 20px; font-size: 14px; font-weight: 500; }
.error { background: var(--danger-soft); color: var(--danger); border: 1px solid var(--danger-border); padding: 11px 14px; border-radius: 12px; font-size: 14px; }

/* ============================================================
   Status picker
   ============================================================ */
.status-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 11px; }
.status-btn {
  width: 100%; border: 1.5px solid var(--border); background: var(--surface); border-radius: 13px; padding: 13px 15px;
  cursor: pointer; font: inherit; text-align: left; display: flex; align-items: center; gap: 11px; color: var(--ink);
  transition: transform .06s ease, box-shadow .15s ease, border-color .15s ease, background .15s;
}
.status-btn:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: var(--border-strong); }
.status-btn .swatch { width: 13px; height: 13px; border-radius: 50%; flex: none; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 0%, transparent); }
.status-btn .lbl { font-weight: 650; font-weight: 600; font-size: 14px; }
.status-btn.current { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 3px var(--ring); }
.status-btn.current::after { content: "current"; margin-left: auto; font-size: 10.5px; color: var(--accent); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
[data-theme="dark"] .status-btn.current::after { color: var(--accent-hover); }
.status-btn.signoff { border-style: dashed; color: var(--muted); }
.status-btn.signoff:hover { color: var(--ink); }

/* ============================================================
   Board
   ============================================================ */
.board-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }
.board-head .clock { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; background: var(--surface); border: 1px solid var(--border); padding: 6px 12px; border-radius: 999px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(252px, 1fr)); gap: 15px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 15px; padding: 17px 18px;
  box-shadow: var(--shadow-sm); border-left: 5px solid var(--muted); position: relative; transition: box-shadow .15s, transform .08s;
}
.card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.card.me { border-color: var(--accent-soft-border); box-shadow: 0 0 0 2px var(--ring); }
.card .name { font-weight: 700; font-size: 15.5px; display: flex; align-items: center; gap: 8px; }
.badge-admin { font-size: 9.5px; background: var(--accent-soft); color: var(--accent); padding: 2px 7px; border-radius: 6px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
[data-theme="dark"] .badge-admin { color: var(--accent-hover); }
.card .status-line { display: flex; align-items: center; gap: 9px; margin-top: 12px; }
.card .status-line .swatch { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.card .status-name { font-weight: 650; font-weight: 600; font-size: 14.5px; }
.card .since { color: var(--muted); font-size: 12.5px; margin-top: 7px; }
.card .dur { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--ink-2); }
.you-tag { position: absolute; top: 14px; right: 14px; font-size: 9.5px; font-weight: 800; color: var(--accent); background: var(--accent-soft); padding: 2px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: .04em; }
[data-theme="dark"] .you-tag { color: var(--accent-hover); }

/* ============================================================
   My Time
   ============================================================ */
.current-big { display: flex; align-items: center; gap: 14px; margin: 10px 0 4px; }
.current-big .swatch { width: 24px; height: 24px; border-radius: 50%; box-shadow: var(--shadow-sm); }
.current-big .txt { font-size: 24px; font-weight: 800; letter-spacing: -.01em; }
.totals-table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.totals-table td { padding: 11px 8px; border-bottom: 1px solid var(--border); }
.totals-table tr:last-child td { border-bottom: 0; }
.totals-table .st { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 14px; }
.totals-table .st .swatch { width: 12px; height: 12px; border-radius: 50%; }
.totals-table .val { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); white-space: nowrap; }
.totals-table .bar { height: 9px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.totals-table .bar > span { display: block; height: 100%; border-radius: 6px; transition: width .4s ease; }
.grand { font-weight: 800; color: var(--ink); }
.private-note { font-size: 12px; color: var(--muted); margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--border); }

/* ============================================================
   Working-day chips & time row
   ============================================================ */
.days-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 4px; }
.day-chip { position: relative; margin: 0 !important; }
.day-chip input { position: absolute; opacity: 0; width: 0; height: 0; }
.day-chip span { display: inline-block; padding: 8px 13px; border: 1.5px solid var(--border-strong); border-radius: 999px;
  font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; user-select: none; background: var(--surface); transition: all .12s; }
.day-chip span:hover { border-color: var(--accent); color: var(--ink); }
.day-chip input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; }
.day-chip input:focus-visible + span { box-shadow: 0 0 0 4px var(--ring); }
.day-chip.sm span { padding: 5px 9px; font-size: 12px; }

/* ============================================================
   Admin
   ============================================================ */
.admin-grid { display: grid; grid-template-columns: 1fr; gap: 22px; }
@media (min-width: 980px) { .admin-grid { grid-template-columns: 340px 1fr; align-items: start; } }
table.users { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; box-shadow: var(--shadow-sm); }
table.users th, table.users td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 13.5px; vertical-align: top; }
table.users th { background: var(--surface-2); font-size: 11px; text-transform: uppercase; color: var(--muted); letter-spacing: .05em; font-weight: 700; }
table.users tr:last-child td { border-bottom: 0; }
table.users tbody tr:hover { background: var(--surface-2); }
table.users .inactive { opacity: .55; }
.tag { font-size: 10.5px; padding: 2px 8px; border-radius: 999px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.tag.admin { background: var(--accent-soft); color: var(--accent); }
[data-theme="dark"] .tag.admin { color: var(--accent-hover); }
.tag.active { background: var(--ok-soft); color: var(--ok); }
.tag.off { background: var(--danger-soft); color: var(--danger); }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: flex-start; }
.row-actions button, .row-actions .btn.small { font-size: 12px; padding: 6px 10px; }
details.reset summary { cursor: pointer; font-size: 12px; color: var(--accent); font-weight: 600; list-style: none; padding: 6px 0; }
[data-theme="dark"] details.reset summary { color: var(--accent-hover); }
details.reset summary::-webkit-details-marker { display: none; }
details.reset[open] summary { margin-bottom: 4px; }
details.reset input { margin: 0; font-size: 13px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; margin-top: 16px; }
.checkbox-row input { width: auto; }
.checkbox-row label { margin: 0; font-weight: 500; color: var(--ink-2); }

/* ============================================================
   Login
   ============================================================ */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; position: relative; }
.login-card { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 38px 34px; width: 100%; max-width: 400px; box-shadow: var(--shadow-lg); }
.login-card .logo { display: flex; justify-content: center; margin-bottom: 16px; }
.login-card .logo .mark { width: 52px; height: 52px; border-radius: 15px; background: linear-gradient(135deg, var(--accent), var(--accent-hover)); display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-md); }
.login-card .logo .mark .pulse { background:#fff; }
.login-card h1 { font-size: 22px; font-weight: 800; text-align: center; margin: 0 0 4px; letter-spacing: -.02em; }
.login-card p.sub { text-align: center; color: var(--muted); font-size: 13.5px; margin: 0 0 24px; }
.login-theme { position: absolute; top: 18px; right: 18px; }
.login-theme button { background: var(--surface); border: 1px solid var(--border); color: var(--ink-2); width: 40px; height: 40px; border-radius: 11px; cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-sm); }
.login-theme button:hover { background: var(--surface-2); }
.login-theme svg { width: 19px; height: 19px; }
.login-theme .ic-moon { display: none; }
[data-theme="dark"] .login-theme .ic-sun { display: none; }
[data-theme="dark"] .login-theme .ic-moon { display: block; }

/* ============================================================
   Responsive: sidebar -> off-canvas
   ============================================================ */
@media (max-width: 880px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .25s ease; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: translateX(0); }
  .scrim.show { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 35; }
  .mobile-top { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 30; }
  .hamburger { background: transparent; border: 0; color: var(--ink); cursor: pointer; padding: 6px; display: flex; }
  .hamburger svg { width: 24px; height: 24px; }
  .mt-brand { font-weight: 800; font-size: 15px; display: flex; align-items: center; gap: 9px; }
  .wrap { padding: 22px 18px 64px; }
}
