/* ==========================================================================
   Sitewatch Employee Hub – brand: night navy with signal blue, amber accent (sitewatchgroup.co.uk)
   ========================================================================== */
:root {
  --navy: #0b1b33;
  --navy-deep: #07111f;
  --navy-raised: #13294a;
  --blue: #469ddf;
  --blue-hover: #2f86c9;
  --ice: #7ebef0;
  --sky: #6fc3ff;
  --mist: #c3d3e6;
  --amber: #e29a1d;

  --bg: var(--navy-deep);
  --panel: #0a1930;
  --surface: rgba(255, 255, 255, 0.035);
  --surface-2: rgba(255, 255, 255, 0.06);
  --surface-3: rgba(255, 255, 255, 0.09);
  --text: #ffffff;
  --text-2: #dde6f1;
  --muted: #96a6bc;
  --border: rgba(195, 211, 230, 0.14);
  --border-strong: rgba(195, 211, 230, 0.28);
  --gradient: linear-gradient(90deg, var(--blue), var(--sky));
  --ok: #4ade9b;
  --ok-bg: rgba(74, 222, 155, 0.1);
  --warn: var(--amber);
  --warn-bg: rgba(226, 154, 29, 0.1);
  --err: #ff6b8a;
  --err-bg: rgba(255, 107, 138, 0.1);
  --radius-lg: 16px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 12px 32px -12px rgba(0, 0, 0, 0.55);
  --shadow-pop: 0 18px 48px -12px rgba(0, 0, 0, 0.7), 0 0 0 1px var(--border-strong);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --sidebar-w: 284px;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.55 Outfit, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
/* Background glow on its own fixed layer: painted once and composited, rather than
   repainted on every scroll frame as `background-attachment: fixed` is (slow on tablets) */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(70, 157, 223, 0.18), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(111, 195, 255, 0.08), transparent 60%);
  transform: translateZ(0);
}
h1, h2, h3 { font-family: Outfit, sans-serif; margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }
[hidden] { display: none !important; }

.icon {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

/* ------------------------------------------------------------ App shell */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 24px;
  padding: 22px 16px;
  background: linear-gradient(180deg, rgba(11, 27, 51, 0.95), rgba(7, 17, 31, 0.95));
  border-right: 1px solid var(--border);
}
.sidebar-brand { padding: 4px 8px 8px; }
.sidebar-brand img { height: 38px; display: block; }

.nav-label {
  margin: 8px 10px -12px; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.12em;
  text-transform: uppercase; color: rgba(150, 166, 188, 0.7);
}
.nav { display: flex; flex-direction: column; gap: 10px; }
.tab {
  display: flex; align-items: center; gap: 14px;
  width: 100%; padding: 14px 16px; border: 1px solid transparent; border-radius: var(--radius);
  background: transparent; color: var(--muted); cursor: pointer; text-align: left;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.15s var(--ease);
  position: relative;
}
.tab-icon {
  width: 44px; height: 44px; flex: none; display: grid; place-items: center; border-radius: 12px;
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--border); color: var(--mist);
  transition: background 0.2s var(--ease), color 0.2s var(--ease), box-shadow 0.2s var(--ease), border-color 0.2s;
}
.tab-icon .icon { width: 20px; height: 20px; }
.tab-text { display: grid; gap: 2px; min-width: 0; }
.tab-title { font-weight: 600; font-size: 0.98rem; color: var(--text-2); }
.tab-desc { font-size: 0.78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tab:hover { background: var(--surface-2); border-color: var(--border); }
.tab:hover .tab-icon { color: var(--ice); border-color: rgba(126, 190, 240, 0.4); }
.tab:active { transform: scale(0.99); }
.tab.active {
  background: linear-gradient(135deg, rgba(70, 157, 223, 0.22), rgba(111, 195, 255, 0.08));
  border-color: rgba(126, 190, 240, 0.35);
  box-shadow: 0 10px 28px -14px rgba(70, 157, 223, 0.8);
}
.tab.active .tab-icon {
  background: var(--gradient); border-color: transparent; color: #fff;
  box-shadow: 0 6px 18px -6px rgba(111, 195, 255, 0.7);
}
.tab.active .tab-title { color: #fff; }
.tab.active .tab-desc { color: var(--text-2); }
.tab.active::before {
  content: ""; position: absolute; left: -17px; top: 14px; bottom: 14px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--gradient);
}

.sidebar-status {
  margin-top: auto; display: grid; gap: 12px; width: 100%;
  padding: 14px; border-radius: var(--radius); border: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(19, 41, 74, 0.9), rgba(11, 27, 51, 0.9)); color: var(--text);
  transition: border-color 0.2s;
}
.sidebar-status.in { border-color: rgba(74, 222, 155, 0.35); }
.side-info {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; cursor: pointer;
  padding: 2px; border: 0; background: none; color: inherit; border-radius: 6px;
}
.side-info:hover .side-label { text-decoration: underline; text-underline-offset: 3px; }
.sidebar-status .punch-btn { width: 100%; }
/* "Check out" is a different action from "Check in", so it gets its own look */
.punch-btn.out { background: rgba(255, 255, 255, 0.05); color: var(--text); border-color: var(--border-strong); box-shadow: none; }
.punch-btn.out:hover:not(:disabled) { background: rgba(255, 107, 138, 0.12); border-color: rgba(255, 107, 138, 0.5); color: #fff; }
.mobile-actions { display: flex; align-items: center; gap: 8px; }
.side-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--mist); opacity: 0.6; }
.sidebar-status.in .side-dot { background: var(--ok); opacity: 1; }
.side-text { display: grid; gap: 2px; }
.side-label { font-weight: 600; font-size: 0.88rem; }
.sidebar-status.in .side-label { color: var(--ok); }
.side-time { color: var(--muted); font-size: 0.8rem; font-variant-numeric: tabular-nums; }
.sidebar-status + .sidebar-user { margin-top: 0; }
.sidebar-user {
  margin-top: auto; display: flex; align-items: center; gap: 10px;
  padding: 10px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border);
}
.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font: 600 0.85rem Outfit, sans-serif;
  background: var(--gradient); color: #fff;
}
.user-meta { min-width: 0; flex: 1; }
.user-name { font-weight: 600; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-sub { color: var(--muted); font-size: 0.78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.icon-btn {
  display: grid; place-items: center; width: 34px; height: 34px; flex: none;
  border: 1px solid transparent; border-radius: var(--radius-sm); background: transparent;
  color: var(--muted); cursor: pointer; transition: all 0.2s var(--ease);
}
.icon-btn:hover { color: var(--text); background: var(--surface-2); border-color: var(--border); }

.content { min-width: 0; padding: 28px clamp(16px, 4vw, 44px) 56px; }
.mobile-header { display: none; }

.page-header {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 16px;
  max-width: 1180px; margin: 0 auto 22px;
}
.eyebrow {
  margin: 0 0 4px; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--ice);
}
.page-header h1 { font-size: clamp(1.4rem, 2.6vw, 1.9rem); font-weight: 600; letter-spacing: -0.01em; }
.header-clock {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px;
  border-radius: 999px; background: var(--surface); border: 1px solid var(--border);
  color: var(--text-2); font-variant-numeric: tabular-nums; font-weight: 500;
}
.header-clock .icon { color: var(--ice); width: 16px; height: 16px; }

main { max-width: 1180px; margin: 0 auto; }
.panel { display: grid; gap: 20px; animation: fade-up 0.35s var(--ease); }
@keyframes fade-up { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.grid { display: grid; gap: 20px; }
.grid.two { grid-template-columns: 1fr 1fr; }
.hero-grid { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.form-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); align-items: start; }

/* ------------------------------------------------------------ Banner */
.banner {
  max-width: 1180px; margin: 0 auto 20px;
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  border-radius: var(--radius); background: var(--warn-bg); border: 1px solid rgba(226, 154, 29, 0.35);
  color: var(--warn); font-weight: 500;
}
.banner .icon { flex: none; }
.banner .btn { margin-left: auto; }

/* ------------------------------------------------------------ Cards */
.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 22px; box-shadow: var(--shadow); min-width: 0;
}
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.card h2 { font-size: 1rem; font-weight: 600; letter-spacing: 0; }
.card-note { color: var(--muted); font-size: 0.8rem; }
.card-intro { margin: -6px 0 18px; color: var(--muted); font-size: 0.92rem; }

/* ------------------------------------------------------------ Hero / timer */
.hero {
  position: relative; overflow: hidden;
  background:
    radial-gradient(500px 220px at 100% 0%, rgba(111, 195, 255, 0.12), transparent 70%),
    linear-gradient(135deg, #0e2247 0%, var(--navy-raised) 100%);
  border-color: rgba(126, 190, 240, 0.25);
}
.hero::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--gradient);
}
.hero-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.hero-sub { color: var(--muted); font-size: 0.9rem; }
.hero-label {
  margin-top: 22px; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--muted);
}
.timer {
  font: 600 clamp(2.6rem, 6vw, 4rem)/1.1 Outfit, sans-serif;
  font-variant-numeric: tabular-nums; letter-spacing: 0.01em; margin: 4px 0 18px;
}
.timer.running { background: linear-gradient(90deg, #fff 0%, var(--ice) 60%, var(--sky) 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }

.status-badge {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px 6px 12px; border-radius: 999px;
  font-weight: 600; font-size: 0.82rem; border: 1px solid var(--border-strong); color: var(--mist);
  background: rgba(255, 255, 255, 0.04);
}
.status-badge .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status-badge.in { color: var(--ok); border-color: rgba(74, 222, 155, 0.45); background: var(--ok-bg); }
@keyframes pulse {
  0% { transform: scale(1); opacity: 0.6; }
  80%, 100% { transform: scale(2.4); opacity: 0; }
}
/* The ring is a pseudo-element, so only opacity/transform animate (no repaints) */
.status-badge .dot, .side-dot { position: relative; }
.status-badge.in .dot::after, .sidebar-status.in .side-dot::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--ok);
  animation: pulse 1.6s ease-out infinite; will-change: transform, opacity;
}

.timeline { margin-bottom: 22px; }
.timeline-track {
  position: relative; height: 12px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.06); overflow: hidden;
}
.timeline-seg {
  position: absolute; top: 0; bottom: 0; border-radius: 999px;
  background: var(--gradient); min-width: 4px;
}
.timeline-seg.open { background: linear-gradient(90deg, var(--blue), var(--sky)); box-shadow: 0 0 12px rgba(111, 195, 255, 0.6); }
.timeline-now { position: absolute; top: -3px; bottom: -3px; width: 2px; background: #fff; border-radius: 2px; opacity: 0.8; }
.timeline-scale { display: flex; justify-content: space-between; margin-top: 6px; color: var(--muted); font-size: 0.72rem; font-variant-numeric: tabular-nums; }

.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* ------------------------------------------------------------ Stats */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.stat {
  display: flex; align-items: center; gap: 14px; padding: 16px;
  border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border);
}
.stat-icon {
  width: 40px; height: 40px; border-radius: 10px; flex: none; display: grid; place-items: center;
  background: rgba(70, 157, 223, 0.16); color: var(--ice);
}
.stat-label { color: var(--muted); font-size: 0.78rem; line-height: 1.3; }
.stat-value { font: 600 1.25rem/1.3 Outfit, sans-serif; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------ Sessions list */
.sessions { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.session {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px;
  padding: 12px 4px; border-bottom: 1px solid var(--border);
}
.session:last-child { border-bottom: 0; }
.session-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--mist); opacity: 0.5; }
.session.open .session-dot { background: var(--ok); opacity: 1; box-shadow: 0 0 0 4px var(--ok-bg); }
.session-times { font-weight: 500; font-variant-numeric: tabular-nums; }
.session-times .arrow { color: var(--muted); margin: 0 8px; }
.session-dur { color: var(--muted); font-size: 0.88rem; font-variant-numeric: tabular-nums; }
.session.open .session-dur { color: var(--ok); }
.session.incomplete .session-dot { background: var(--warn); opacity: 1; }
.session .missing { color: var(--warn); font-weight: 500; }
.timeline-seg.incomplete { background: var(--warn); }

/* ------------------------------------------------------------ Bar chart */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 180px; padding-top: 18px; }
.bar-col { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; min-width: 0; }
/* Lift the hovered column above its neighbours so its tooltip isn't drawn behind taller bars */
.bar-col:hover { z-index: 10; }
.bar-wrap { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.bar {
  width: min(100%, 22px); border-radius: 6px 6px 3px 3px; background: var(--gradient);
  background: linear-gradient(180deg, var(--ice), var(--blue));
  min-height: 3px; position: relative; transition: height 0.5s var(--ease);
}
.bar.today { background: linear-gradient(180deg, var(--sky), var(--blue)); }
/* A day with no hours: a thin grey stub (named "no-hours" so the general .empty style can't resize it) */
.bar.no-hours { background: rgba(255, 255, 255, 0.12); height: 3px !important; }
.bar:hover::after {
  content: attr(data-tip); position: absolute; z-index: 10; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  white-space: nowrap; padding: 5px 9px; border-radius: 6px; font-size: 0.75rem; font-weight: 500;
  background: var(--navy); border: 1px solid var(--border-strong); color: var(--text);
  box-shadow: 0 8px 20px -6px rgba(0, 0, 0, 0.7); pointer-events: none;
}.bar-label { font-size: 0.68rem; color: var(--muted); }

/* ------------------------------------------------------------ Tables */
.table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.table th {
  text-align: left; padding: 0 12px 10px; color: var(--muted); font-weight: 500;
  font-size: 0.74rem; letter-spacing: 0.06em; text-transform: uppercase; border-bottom: 1px solid var(--border);
}
.table-scroll { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
.table td { padding: 13px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table td.wrap { white-space: normal; min-width: 140px; color: var(--text-2); }
.table tbody tr { transition: background 0.15s; }
.table tbody tr:hover { background: rgba(255, 255, 255, 0.025); }
.table tbody tr:last-child td { border-bottom: 0; }
.table td.empty-cell { padding: 0; }

/* Request lists */
.requests { list-style: none; margin: 0; padding: 0; }
.request {
  display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center;
  padding: 14px 4px; border-bottom: 1px solid var(--border);
}
.request:last-child { border-bottom: 0; }
.request-icon {
  width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
  background: rgba(70, 157, 223, 0.14); color: var(--ice);
}
.request-body { min-width: 0; }
.request-title { font-weight: 600; }
.request-sub { color: var(--text-2); font-size: 0.86rem; font-variant-numeric: tabular-nums; }
.request-sub .arrow { color: var(--muted); margin: 0 6px; }
.request-note { color: var(--muted); font-size: 0.82rem; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.request-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.request-actions { display: flex; gap: 4px; }
.request-actions .icon-btn { width: 30px; height: 30px; }
.request-actions .icon-btn .icon { width: 16px; height: 16px; }
.request-actions .icon-btn.danger:hover { color: var(--err); background: var(--err-bg); border-color: rgba(255, 107, 138, 0.35); }
.request.editing { background: rgba(70, 157, 223, 0.08); border-radius: var(--radius-sm); }
@media (max-width: 480px) {
  .request { grid-template-columns: 1fr auto; }
  .request-icon { display: none; }
}

/* Collapsible "Cancelled & rejected" section under a request list */
.closed-section { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 12px; }
.closed-section + .closed-section { margin-top: 6px; padding-top: 6px; }
.closed-section summary {
  display: flex; align-items: center; gap: 10px; cursor: pointer; list-style: none; user-select: none;
  padding: 8px 6px; border-radius: var(--radius-sm); color: var(--muted); font-weight: 600; font-size: 0.88rem;
  transition: background 0.15s, color 0.15s;
}
.closed-section summary::-webkit-details-marker { display: none; }
.closed-section summary:hover { background: var(--surface-2); color: var(--text-2); }
.closed-section summary .icon { width: 16px; height: 16px; transform: rotate(-90deg); transition: transform 0.2s var(--ease); }
.closed-section[open] summary .icon { transform: none; color: var(--ice); }
.count-badge {
  margin-left: auto; min-width: 24px; padding: 1px 8px; border-radius: 999px; text-align: center;
  background: var(--surface-2); color: var(--text-2); font-size: 0.75rem;
}
.closed-section.is-empty summary { opacity: 0.55; }
.closed-section.is-empty .count-badge { background: transparent; border: 1px solid var(--border); }
.closed-section .empty { padding: 14px 12px; font-size: 0.84rem; }
.closed-section .empty .icon { width: 20px; height: 20px; }
.requests.closed { margin-top: 4px; }
.requests.closed .request { opacity: 0.72; }
.requests.closed .request:hover { opacity: 1; }
.requests.closed .request-icon { background: var(--surface-2); color: var(--muted); }

/* Edit mode banner on the leave form */
.edit-banner {
  display: flex; align-items: center; gap: 10px; margin: -4px 0 16px; padding: 10px 12px;
  border-radius: var(--radius-sm); background: rgba(70, 157, 223, 0.12); border: 1px solid rgba(70, 157, 223, 0.35);
  color: var(--text-2); font-size: 0.88rem;
}
.edit-banner .icon { color: var(--ice); }
.edit-banner span { flex: 1; }

/* Confirmation dialog */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(3, 8, 16, 0.82); animation: fade 0.2s var(--ease); }
.modal-card {
  position: relative; width: min(420px, 100%); padding: 24px; border-radius: var(--radius-lg);
  background: linear-gradient(180deg, #152c4f, #0f213c); box-shadow: var(--shadow-pop);
  display: grid; gap: 12px; animation: pop 0.22s var(--ease);
}
.modal-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--err-bg); color: var(--err); }
.modal-icon .icon { width: 22px; height: 22px; }
.modal-card.info .modal-icon { background: rgba(70, 157, 223, 0.18); color: var(--ice); }
.modal-card h3 { font-size: 1.15rem; font-weight: 600; }
.modal-card p { margin: 0; color: var(--text-2); font-size: 0.92rem; }
.modal-card textarea {
  width: 100%; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: rgba(4, 10, 20, 0.55); color: var(--text); resize: vertical;
}
.modal-card textarea:focus { outline: none; border-color: var(--ice); box-shadow: 0 0 0 4px rgba(70, 157, 223, 0.22); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.btn-danger { background: #e0365e; color: #fff; box-shadow: 0 8px 24px -8px rgba(224, 54, 94, 0.8); }
.btn-danger:hover:not(:disabled) { background: #c92a50; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(0.97); } }

.empty {
  display: grid; justify-items: center; gap: 8px; padding: 28px 12px; color: var(--muted); text-align: center; font-size: 0.9rem;
}
.empty .icon { width: 28px; height: 28px; color: var(--ice); opacity: 0.7; }

.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: 999px;
  font-size: 0.76rem; font-weight: 600; white-space: nowrap;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ok { color: var(--ok); background: var(--ok-bg); }
.pill.warn { color: var(--warn); background: var(--warn-bg); }
.pill.err { color: var(--err); background: var(--err-bg); }
.pill.neutral { color: var(--mist); background: var(--surface-2); }

/* ------------------------------------------------------------ Leave balances */
.balances { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.balance {
  display: flex; align-items: center; gap: 16px; padding: 16px;
  border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border);
  transition: border-color 0.2s, transform 0.2s var(--ease);
}
.balance:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.ring { position: relative; width: 72px; height: 72px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 7; }
.ring .ring-bg { stroke: rgba(255, 255, 255, 0.08); }
.ring .ring-fg { stroke: url(#ring-grad); stroke-linecap: round; transition: stroke-dashoffset 0.8s var(--ease); }
.ring-value { position: absolute; inset: 0; display: grid; place-items: center; font: 600 1.15rem Outfit, sans-serif; }
.balance-name { font-weight: 600; margin-bottom: 2px; }
.balance-meta { color: var(--muted); font-size: 0.82rem; line-height: 1.5; }
.balance-meta strong { color: var(--text-2); font-weight: 600; }
.balances .notice { grid-column: 1 / -1; }

/* ------------------------------------------------------------ Entitlement (grouped) */
.entitlement { display: grid; gap: 22px; }
.leave-hero {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 24px;
  padding: 22px 24px; border-radius: var(--radius);
  background:
    radial-gradient(420px 180px at 100% 0%, rgba(111, 195, 255, 0.12), transparent 70%),
    linear-gradient(135deg, #102650 0%, var(--navy-raised) 100%);
  border: 1px solid rgba(126, 190, 240, 0.28);
}
.leave-hero .ring { width: 104px; height: 104px; }
.leave-hero .ring circle { stroke-width: 6; }
.leave-hero .ring-value { font-size: 1.6rem; }
.ring.plain { display: grid; place-items: center; border-radius: 50%; border: 6px solid rgba(255, 255, 255, 0.08); }
.leave-hero-name { font: 600 1.15rem Outfit, sans-serif; }
.leave-hero-left { color: var(--text-2); margin-top: 2px; }
.leave-hero-left strong { color: var(--ice); font-size: 1.05rem; }
.hero-figs { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.hero-fig {
  display: grid; gap: 1px; padding: 8px 14px; border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--border); min-width: 96px;
}
.hero-fig-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.hero-fig-value { font-weight: 600; font-variant-numeric: tabular-nums; }

.leave-group-title {
  font: 600 0.75rem Outfit, sans-serif; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--muted); margin: 0 0 10px 2px;
}
.leave-group.closed-section { margin-top: -6px; }
.leave-group.closed-section .leave-rows { margin-top: 10px; }
.leave-rows { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.leave-row {
  display: flex; align-items: center; gap: 16px; width: 100%; text-align: left; cursor: pointer;
  padding: 14px 16px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface); color: var(--text); transition: border-color 0.2s, background 0.2s, transform 0.15s var(--ease);
}
.leave-row:hover { border-color: rgba(126, 190, 240, 0.45); background: var(--surface-2); transform: translateY(-1px); }
.leave-row-main { flex: 1; min-width: 0; display: grid; gap: 4px; }
.leave-row-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.leave-row-meta { font-size: 0.8rem; color: var(--muted); }
.leave-row-left { display: grid; justify-items: end; flex: none; }
.leave-row-left strong { font: 600 1.35rem/1.1 Outfit, sans-serif; color: var(--ice); font-variant-numeric: tabular-nums; }
.leave-row-left span { font-size: 0.72rem; color: var(--muted); }
.leave-row.overdrawn .leave-row-left strong, .leave-row.overdrawn .leave-row-left span { color: var(--err); }
.leave-row.overdrawn { border-color: rgba(255, 107, 138, 0.3); }
.leave-hero-left.over strong { color: var(--err); }
.meter { height: 5px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); overflow: hidden; margin-top: 2px; }
.meter span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--gradient); transition: width 0.8s var(--ease); }
@media (max-width: 640px) {
  .leave-hero { grid-template-columns: auto 1fr; padding: 18px; gap: 16px; }
  .leave-hero .btn { grid-column: 1 / -1; }
  .leave-hero .ring { width: 84px; height: 84px; }
  .leave-rows { grid-template-columns: 1fr; }
}

/* ------------------------------------------------------------ Profile */
.user-link {
  display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; padding: 0; border: 0;
  background: none; color: inherit; text-align: left; cursor: pointer; border-radius: 8px;
}
/* The name card is the way into the profile: make it read as a button */
.sidebar-user { transition: border-color 0.2s, background 0.2s; }
.sidebar-user:has(.user-link:hover) { border-color: rgba(126, 190, 240, 0.45); background: var(--surface-2); }
.sidebar-user:has(.user-link.active) {
  border-color: rgba(126, 190, 240, 0.5);
  background: linear-gradient(135deg, rgba(70, 157, 223, 0.22), rgba(111, 195, 255, 0.08));
}
.user-link:hover .user-name, .user-link.active .user-name { color: #fff; }
.user-link:focus-visible { outline: 2px solid var(--ice); outline-offset: 4px; }
/* Initials in the top bar (tablets and phones; the bar itself is hidden on desktop) */
.avatar-sm { width: 34px; height: 34px; font-size: 0.78rem; border: 0; cursor: pointer; }
.mobile-header .avatar-sm { display: grid; }
.avatar-sm.active { box-shadow: 0 0 0 2px var(--navy), 0 0 0 4px var(--ice); }
.profile-hero { display: grid; grid-template-columns: auto 1fr; gap: 22px; align-items: center; padding: 26px; }
.profile-avatar {
  width: 96px; height: 96px; border-radius: 50%; display: grid; place-items: center;
  font: 600 2rem Outfit, sans-serif; color: #fff; background: var(--gradient);
  box-shadow: 0 12px 30px -10px rgba(111, 195, 255, 0.7), 0 0 0 4px rgba(255, 255, 255, 0.06);
}
.profile-name { font: 600 1.6rem/1.2 Outfit, sans-serif; }
.profile-role { color: var(--text-2); margin-top: 2px; }
.profile-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.profile-chips .chip-static {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  font-size: 0.8rem; color: var(--text-2); background: rgba(255, 255, 255, 0.06); border: 1px solid var(--border);
}
.profile-chips .chip-static .icon { width: 14px; height: 14px; color: var(--ice); }
.profile-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.profile-facts .stat { min-width: 0; }
.profile-facts .stat-value { font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-grid { align-items: start; }
.dl { display: grid; gap: 0; margin: 0; }
.dl-row { display: grid; grid-template-columns: minmax(120px, 38%) 1fr; gap: 12px; padding: 10px 2px; border-bottom: 1px solid var(--border); }
.dl-row:last-child { border-bottom: 0; }
.dl dt { color: var(--muted); font-size: 0.86rem; }
.dl dd { margin: 0; color: var(--text); overflow-wrap: anywhere; white-space: pre-line; }
.dl dd .sub { display: block; color: var(--muted); font-size: 0.8rem; }
.masked { letter-spacing: 0.2em; color: var(--muted); }
.reveal-btn { margin-left: auto; }
.about-text { color: var(--text-2); white-space: pre-line; margin: 0 0 10px; }
.mini-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.mini-table th { text-align: left; color: var(--muted); font-weight: 500; font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.05em; padding: 0 8px 8px; border-bottom: 1px solid var(--border); }
.mini-table td { padding: 9px 8px; border-bottom: 1px solid var(--border); }
.mini-table tr:last-child td { border-bottom: 0; }
.dd-with-pill { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.82rem; line-height: 1.4;
  background: rgba(70, 157, 223, 0.14); border: 1px solid rgba(70, 157, 223, 0.3); color: var(--text);
}
.training-summary { display: flex; gap: 18px; flex-wrap: wrap; margin: -4px 0 12px; color: var(--muted); font-size: 0.86rem; }
.training-summary strong { color: var(--text); font-family: Outfit, sans-serif; }
.training-table td:first-child { color: var(--text); font-weight: 500; }
.training-table td:last-child, .training-table th:last-child { text-align: right; }
.muted-cell { color: var(--muted); }
/* The training table spans the full width of the profile grid */
#profile-sections > .card:has(.training-table) { grid-column: 1 / -1; }
.profile-note {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0; padding: 12px 16px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); color: var(--muted); font-size: 0.86rem;
}
.profile-note .icon { color: var(--ice); }
.profile-note .btn { margin-left: auto; }
@container (max-width: 460px) {
  .profile-hero { grid-template-columns: 1fr; justify-items: start; }
}
@container (max-width: 340px) {
  .dl-row { grid-template-columns: 1fr; gap: 2px; }
}
@media (max-width: 760px) {
  .profile-avatar { width: 72px; height: 72px; font-size: 1.5rem; }
}

/* ------------------------------------------------------------ Documents */
.private-note {
  display: inline-flex; align-items: center; gap: 6px; font-size: 0.78rem; color: var(--muted);
  padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border);
}
.private-note .icon { width: 14px; height: 14px; color: var(--ice); }
.doc-tools { display: grid; gap: 12px; margin-bottom: 14px; }
.search-field {
  display: flex; align-items: center; gap: 10px; padding: 0 13px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: rgba(4, 10, 20, 0.55); transition: border-color 0.2s, box-shadow 0.2s;
}
.search-field:focus-within { border-color: var(--ice); box-shadow: 0 0 0 4px rgba(70, 157, 223, 0.22); }
.search-field .icon { color: var(--muted); }
.search-field input { flex: 1; min-width: 0; border: 0; background: none; color: var(--text); padding: 11px 0; outline: none; font: inherit; }
.search-field input::placeholder { color: rgba(150, 166, 188, 0.7); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border-strong); background: transparent; color: var(--muted); font-size: 0.84rem; font-weight: 500;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.chip:hover { color: var(--text); border-color: rgba(126, 190, 240, 0.45); }
.chip[aria-pressed=true] { background: var(--blue); border-color: var(--blue); color: #fff; }
.chip .n { font-size: 0.72rem; opacity: 0.75; }
.doc-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.doc {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px;
  padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface);
  transition: border-color 0.2s, background 0.2s;
}
.doc:hover { border-color: rgba(126, 190, 240, 0.35); background: var(--surface-2); }
.doc-badge {
  width: 44px; height: 52px; border-radius: 8px; display: grid; place-items: end center; padding-bottom: 7px;
  position: relative; background: rgba(70, 157, 223, 0.14); border: 1px solid rgba(70, 157, 223, 0.3);
  font: 700 0.62rem Outfit, sans-serif; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ice);
}
.doc-badge .icon { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); width: 18px; height: 18px; }
.doc-badge.pdf { color: #ff7a93; background: rgba(255, 107, 138, 0.1); border-color: rgba(255, 107, 138, 0.3); }
.doc-badge.img { color: #6fd3ff; background: rgba(111, 211, 255, 0.1); border-color: rgba(111, 211, 255, 0.3); }
.doc-badge.sheet { color: var(--ok); background: var(--ok-bg); border-color: rgba(74, 222, 155, 0.3); }
.doc-body { min-width: 0; }
.doc-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-meta { font-size: 0.8rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 10px; }
.doc-meta .expiring { color: var(--warn); }
.doc-desc { font-size: 0.82rem; color: var(--text-2); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-locked { display: grid; justify-items: center; gap: 8px; padding: 32px 16px; text-align: center; }
.doc-locked-icon {
  width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center;
  background: rgba(70, 157, 223, 0.16); color: var(--ice); margin-bottom: 4px;
}
.doc-locked-icon .icon { width: 24px; height: 24px; }
.doc-locked-title { font-weight: 600; }
.doc-locked-text { color: var(--muted); font-size: 0.86rem; margin-bottom: 8px; }
@container (max-width: 480px) {
  .doc { grid-template-columns: auto 1fr; }
  .doc .btn { grid-column: 1 / -1; }
}

/* ------------------------------------------------------------ Forms */
.form { display: grid; gap: 18px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: grid; gap: 7px; min-width: 0; }
.field > label { font-size: 0.84rem; font-weight: 500; color: var(--text-2); }
.optional { color: var(--muted); font-weight: 400; font-size: 0.78rem; margin-left: 4px; }

.form input[type=date], .form input[type=time], .form input[type=text], .form textarea {
  width: 100%; padding: 11px 13px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: rgba(4, 10, 20, 0.55);
  color: var(--text); transition: border-color 0.2s, box-shadow 0.2s;
}
.form textarea { resize: vertical; min-height: 84px; }
.form input:hover, .form textarea:hover { border-color: rgba(126, 190, 240, 0.45); }
.form input:focus, .form textarea:focus {
  outline: none; border-color: var(--ice); box-shadow: 0 0 0 4px rgba(70, 157, 223, 0.22);
}
.form ::placeholder { color: rgba(150, 166, 188, 0.7); }
.form input::-webkit-calendar-picker-indicator {
  cursor: pointer; opacity: 0.85; padding: 4px; border-radius: 6px;
  filter: invert(62%) sepia(66%) saturate(2400%) hue-rotate(240deg) brightness(105%);
}
.form input::-webkit-calendar-picker-indicator:hover { background-color: rgba(70, 157, 223, 0.25); }
.field.invalid input, .field.invalid textarea, .field.invalid .select-btn { border-color: var(--err); }

.form-actions { display: flex; gap: 12px; justify-content: flex-end; padding-top: 4px; }

.day-count {
  display: inline-flex; align-items: center; gap: 8px; justify-self: start;
  padding: 7px 12px; border-radius: 999px; font-size: 0.85rem; font-weight: 500;
  background: rgba(70, 157, 223, 0.14); color: var(--ice); margin-top: -4px;
}
.recorded {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm);
  background: rgba(70, 157, 223, 0.1); border: 1px solid rgba(70, 157, 223, 0.3); color: var(--text-2); font-size: 0.88rem;
}
.recorded .icon { color: var(--ice); margin-top: 2px; }
/* Structured breakdown of what Zoho recorded for the chosen day */
.recorded:has(.rec-list) { display: grid; gap: 8px; padding: 12px 14px 10px; }
.rec-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rec-head .icon { margin-top: 0; }
.rec-title { font-weight: 600; color: var(--text); }
.rec-total { margin-left: auto; font-size: 0.8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.rec-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.rec-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 7px 10px; border-radius: 6px; background: rgba(4, 10, 20, 0.35); font-variant-numeric: tabular-nums;
}
.rec-times { font-weight: 500; color: var(--text); }
.rec-times .arrow { color: var(--muted); margin: 0 8px; }
.rec-dur { font-size: 0.8rem; color: var(--muted); }
.rec-row.missing { box-shadow: inset 3px 0 0 var(--warn); }
.rec-missing { color: var(--warn); font-weight: 500; }
.rec-foot { display: flex; justify-content: flex-end; padding-top: 2px; }

/* Custom select */
.select { position: relative; }
.select select { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; }
.select-btn {
  width: 100%; display: flex; align-items: center; gap: 10px; text-align: left; cursor: pointer;
  padding: 11px 13px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: rgba(4, 10, 20, 0.55); color: var(--text); transition: border-color 0.2s, box-shadow 0.2s;
}
.select-btn:hover { border-color: rgba(126, 190, 240, 0.45); }
.select-btn:focus-visible, .select.open .select-btn {
  outline: none; border-color: var(--ice); box-shadow: 0 0 0 4px rgba(70, 157, 223, 0.22);
}
.select-btn .value { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.select-btn .value.placeholder { color: var(--muted); }
.select-btn .icon { color: var(--muted); transition: transform 0.2s var(--ease); }
.select.open .select-btn .icon { transform: rotate(180deg); color: var(--ice); }
.select-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.meta-tag {
  flex: none; font-size: 0.75rem; font-weight: 600; padding: 2px 8px; border-radius: 999px;
  background: rgba(70, 157, 223, 0.18); color: var(--ice);
}
.select-list {
  position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 6px);
  margin: 0; padding: 6px; list-style: none; max-height: 280px; overflow: auto;
  background: #10233f; border-radius: var(--radius); box-shadow: var(--shadow-pop);
  opacity: 0; transform: translateY(-4px) scale(0.98); transform-origin: top; pointer-events: none;
  transition: opacity 0.15s var(--ease), transform 0.15s var(--ease);
}
.select.open .select-list { opacity: 1; transform: none; pointer-events: auto; }
.select.up .select-list { top: auto; bottom: calc(100% + 6px); transform-origin: bottom; }
/* Scrollbars – slim violet thumb, transparent track (dropdowns, tables, text boxes, page) */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(126, 190, 240, 0.55), rgba(70, 157, 223, 0.55));
  border-radius: 999px; border: 3px solid transparent; background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--ice), var(--blue));
  border: 2px solid transparent; background-clip: padding-box;
}
::-webkit-scrollbar-corner, ::-webkit-scrollbar-button { display: none; background: transparent; }
.select-list::-webkit-scrollbar { width: 12px; }
.select-list::-webkit-scrollbar-track { margin: 6px 0; }
/* Firefox (and browsers without the ::-webkit-scrollbar styling) */
@supports not selector(::-webkit-scrollbar) {
  html, .select-list, .table-scroll, textarea { scrollbar-width: thin; scrollbar-color: rgba(70, 157, 223, 0.6) transparent; }
}

.select-option {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm);
  cursor: pointer; color: var(--text-2);
}
.select-option .label { flex: 1; min-width: 0; }
.select-option .tick { width: 16px; height: 16px; color: var(--ice); visibility: hidden; }
.select-option[aria-selected=true] { color: var(--text); font-weight: 500; }
.select-option[aria-selected=true] .tick { visibility: visible; }
.select-option.active { background: rgba(70, 157, 223, 0.2); color: var(--text); }
.select-empty { padding: 10px 12px; color: var(--muted); }

/* Date picker */
.native-hidden { position: absolute !important; opacity: 0; pointer-events: none; width: 1px !important; height: 1px; padding: 0 !important; border: 0 !important; }
.datepicker { position: relative; }
.date-btn {
  width: 100%; display: flex; align-items: center; gap: 10px; text-align: left; cursor: pointer;
  padding: 11px 13px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: rgba(4, 10, 20, 0.55); color: var(--text); transition: border-color 0.2s, box-shadow 0.2s;
}
.date-btn > .icon:first-child { color: var(--ice); }
.date-btn .value { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.date-btn .value.placeholder { color: var(--muted); }
.date-btn > .icon:last-child { color: var(--muted); transition: transform 0.2s var(--ease); }
.date-btn:hover { border-color: rgba(126, 190, 240, 0.45); }
.date-btn:focus-visible, .datepicker.open .date-btn {
  outline: none; border-color: var(--ice); box-shadow: 0 0 0 4px rgba(70, 157, 223, 0.22);
}
.datepicker.open .date-btn > .icon:last-child { transform: rotate(180deg); color: var(--ice); }
.field.invalid .date-btn { border-color: var(--err); }

.date-pop {
  position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; width: 300px; max-width: calc(100vw - 32px);
  padding: 14px; border-radius: var(--radius); background: #10233f; box-shadow: var(--shadow-pop);
  opacity: 0; transform: translateY(-4px) scale(0.98); transform-origin: top left; pointer-events: none;
  transition: opacity 0.15s var(--ease), transform 0.15s var(--ease);
}
.datepicker.open .date-pop { opacity: 1; transform: none; pointer-events: auto; }
.datepicker.up .date-pop { top: auto; bottom: calc(100% + 6px); transform-origin: bottom left; }
/* The "To" picker sits on the right of its row: open towards the left so it stays on screen */
.row > .field:last-child .date-pop { left: auto; right: 0; transform-origin: top right; }

.date-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.date-title { font: 600 0.98rem Outfit, sans-serif; }
.date-head .icon-btn { width: 32px; height: 32px; color: var(--text-2); }
.date-head .icon-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.date-head .prev .icon { transform: rotate(90deg); }
.date-head .next .icon { transform: rotate(-90deg); }

.date-dow, .date-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.date-dow span { text-align: center; font-size: 0.72rem; font-weight: 600; color: var(--muted); padding: 4px 0 8px; letter-spacing: 0.04em; }
.date-dow span.weekend { color: rgba(150, 166, 188, 0.6); }
.date-grid { row-gap: 2px; }
.day {
  position: relative; height: 38px; border: 0; padding: 0; background: transparent; cursor: pointer;
  color: var(--text-2); font-size: 0.88rem; font-variant-numeric: tabular-nums;
}
.day span {
  display: grid; place-items: center; width: 34px; height: 34px; margin: 0 auto; border-radius: 50%;
  position: relative; z-index: 1; transition: background 0.15s, color 0.15s;
}
.day:hover:not(:disabled) span { background: rgba(70, 157, 223, 0.25); color: #fff; }
.day.weekend { color: var(--muted); }
.day.outside { color: rgba(150, 166, 188, 0.35); }
.day.today span { box-shadow: inset 0 0 0 1.5px var(--ice); color: #fff; }
.day.in-range::before { content: ""; position: absolute; inset: 2px 0; background: rgba(70, 157, 223, 0.18); }
.day.range-start::before { left: 50%; }
.day.range-end::before { right: 50%; }
.day.selected span, .day.range-start span, .day.range-end span {
  background: var(--blue); color: #fff; font-weight: 600; box-shadow: 0 4px 14px -4px rgba(70, 157, 223, 0.9);
}
.day:focus-visible { outline: none; }
.day:focus-visible span { outline: 2px solid var(--ice); outline-offset: 2px; }
.day:disabled { cursor: not-allowed; color: rgba(150, 166, 188, 0.22); }

.date-foot { display: flex; justify-content: space-between; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.link-btn { border: 0; background: none; padding: 6px 8px; border-radius: 6px; cursor: pointer; font-weight: 600; font-size: 0.85rem; color: var(--ice); }
.link-btn:hover:not(:disabled) { background: rgba(70, 157, 223, 0.15); }
.link-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.link-btn.muted-link { color: var(--muted); }

/* Time picker */
.time-pop { width: 220px; }
.time-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.time-col-label { text-align: center; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); padding-bottom: 8px; }
.time-col {
  position: relative; height: 228px; overflow-y: auto; display: grid; gap: 2px; align-content: start;
  padding: 4px; border-radius: var(--radius-sm); background: rgba(4, 10, 20, 0.45);
  scroll-snap-type: y proximity; overscroll-behavior: contain;
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 16px, #000 calc(100% - 16px), transparent 100%);
  mask-image: linear-gradient(180deg, transparent 0, #000 16px, #000 calc(100% - 16px), transparent 100%);
}
.time-col::-webkit-scrollbar { width: 6px; }
.time-item {
  height: 36px; border: 0; border-radius: 8px; background: transparent; cursor: pointer; scroll-snap-align: center;
  color: var(--text-2); font: 500 0.95rem Outfit, sans-serif; font-variant-numeric: tabular-nums;
  transition: background 0.15s, color 0.15s;
}
.time-item:hover { background: rgba(70, 157, 223, 0.25); color: #fff; }
.time-item.selected { background: var(--blue); color: #fff; font-weight: 600; box-shadow: 0 4px 14px -4px rgba(70, 157, 223, 0.9); }
.time-item:focus-visible { outline: 2px solid var(--ice); outline-offset: -2px; }
.row > .field:last-child .time-pop { left: auto; right: 0; }

/* Toggle switch */
.inline-field { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.switch { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; user-select: none; font-weight: 500; color: var(--text-2); font-size: 0.9rem; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track {
  width: 44px; height: 26px; border-radius: 999px; padding: 3px; flex: none;
  background: rgba(255, 255, 255, 0.12); border: 1px solid var(--border-strong); transition: background 0.2s var(--ease);
}
.switch-thumb {
  display: block; width: 18px; height: 18px; border-radius: 50%; background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4); transition: transform 0.2s var(--ease);
}
.switch input:checked + .switch-track { background: var(--gradient); border-color: transparent; }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { box-shadow: 0 0 0 4px rgba(70, 157, 223, 0.3); }
.switch input:disabled + .switch-track { opacity: 0.4; }
.switch input:disabled ~ .switch-label { opacity: 0.5; }

/* Segmented control */
.segmented {
  display: inline-flex; padding: 4px; border-radius: 10px; gap: 4px;
  background: rgba(4, 10, 20, 0.55); border: 1px solid var(--border-strong);
  transition: opacity 0.2s;
}
.segmented label { position: relative; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segmented span {
  display: block; padding: 6px 14px; border-radius: 7px; font-size: 0.85rem; font-weight: 500; color: var(--muted);
  transition: background 0.2s var(--ease), color 0.2s;
}
.segmented input:checked + span { background: var(--blue); color: #fff; box-shadow: 0 2px 10px rgba(70, 157, 223, 0.45); }
.segmented input:focus-visible + span { outline: 2px solid var(--ice); outline-offset: 2px; }
.segmented.disabled { opacity: 0.4; pointer-events: none; }

/* ------------------------------------------------------------ Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 11px 20px; border-radius: 10px; border: 1px solid transparent;
  font-weight: 600; font-size: 0.92rem; cursor: pointer; white-space: nowrap;
  transition: background 0.2s var(--ease), border-color 0.2s, transform 0.1s, box-shadow 0.2s, opacity 0.2s;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn-lg { padding: 14px 26px; font-size: 1rem; border-radius: 12px; }
.btn-primary { background: var(--blue); color: #fff; box-shadow: 0 8px 24px -8px rgba(70, 157, 223, 0.8); }
.btn-primary:hover:not(:disabled) { background: var(--blue-hover); box-shadow: 0 10px 28px -8px rgba(70, 157, 223, 0.95); }
.btn-ghost { background: rgba(255, 255, 255, 0.04); color: var(--text); border-color: var(--border-strong); }
.btn-ghost:hover:not(:disabled) { border-color: var(--ice); background: rgba(70, 157, 223, 0.12); }
.btn-sm { padding: 7px 12px; font-size: 0.82rem; border-radius: 8px; }
.btn:disabled { opacity: 0.38; cursor: not-allowed; box-shadow: none; }
.btn.loading { pointer-events: none; }
.btn.loading .icon { display: none; }
.btn.loading::before {
  content: ""; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35); border-top-color: #fff; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

:focus-visible { outline: 2px solid var(--ice); outline-offset: 2px; }

/* ------------------------------------------------------------ Skeletons */
.skeleton-row, .skeleton-block {
  border-radius: 8px; background: linear-gradient(90deg, rgba(255,255,255,0.04), rgba(255,255,255,0.09), rgba(255,255,255,0.04));
  background-size: 200% 100%; animation: shimmer 1.4s linear infinite;
}
.skeleton-row { height: 18px; margin: 10px 0; list-style: none; }
.skeleton-block { height: 104px; flex: 1; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ------------------------------------------------------------ Toasts */
.toasts {
  position: fixed; z-index: 50; right: 20px; bottom: 20px; display: grid; gap: 10px;
  width: min(380px, calc(100vw - 32px));
}
.toast {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 14px 14px 16px;
  border-radius: var(--radius); background: #11264a; box-shadow: var(--shadow-pop);
  border-left: 3px solid var(--ok); animation: toast-in 0.3s var(--ease);
}
.toast.err { border-left-color: var(--err); }
.toast .icon { margin-top: 1px; color: var(--ok); }
.toast.err .icon { color: var(--err); }
.toast-msg { flex: 1; font-size: 0.9rem; color: var(--text-2); }
.toast .icon-btn { width: 24px; height: 24px; margin: -2px -4px 0 0; }
.toast .icon-btn .icon { color: var(--muted); width: 14px; height: 14px; }
.toast.leaving { animation: toast-out 0.25s var(--ease) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(16px); } }

/* ------------------------------------------------------------ Responsive */
/* ------------------------------------------------------------ Menu drawer (tablets) */
.menu-toggle, .nav-backdrop { display: none; }
.mobile-brand { display: flex; align-items: center; gap: 10px; }

/* Cards lay out by their own width (not the screen's), so nothing spills out of them
   when the sidebar takes space or the screen is mid-sized */
.card { container-type: inline-size; }
/* Container cards are separate layers, so lift the one with an open dropdown/calendar above its neighbours */
.card:has(.select.open, .datepicker.open) { position: relative; z-index: 30; }
.grid > * { min-width: 0; }
.leave-rows { grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); }
@container (max-width: 640px) {
  .leave-hero { grid-template-columns: auto 1fr; gap: 16px; padding: 18px; }
  .leave-hero .btn { grid-column: 1 / -1; justify-self: stretch; }
  .leave-hero .ring { width: 84px; height: 84px; }
}
@container (max-width: 520px) {
  .row { grid-template-columns: 1fr; }
  .request { grid-template-columns: 1fr auto; }
  .request-icon { display: none; }
}
@container (max-width: 380px) {
  .leave-hero { grid-template-columns: 1fr; justify-items: start; }
  .hero-fig { min-width: 0; flex: 1; }
}

@media (min-width: 761px) and (max-width: 1180px) {
  .app { grid-template-columns: 1fr; }
  .content { padding: 0 24px 48px; }
  .mobile-header {
    display: flex; justify-content: space-between; align-items: center;
    margin: 0 -24px 22px; padding: 12px 24px; border-bottom: 1px solid var(--border);
    background: rgba(11, 27, 51, 0.98); position: sticky; top: 0; z-index: 20;
  }
  .mobile-header img { height: 32px; }
  .menu-toggle { display: grid; width: 40px; height: 40px; color: var(--text-2); border-color: var(--border); }
  .menu-toggle .icon { width: 22px; height: 22px; }
  .page-header { margin-bottom: 18px; }

  /* The sidebar becomes a drawer, opened with the menu button */
  .sidebar {
    position: fixed; z-index: 40; top: 0; bottom: 0; left: 0; height: 100%; width: min(300px, 85vw);
    overflow-y: auto; transform: translateX(-102%); visibility: hidden;
    transition: transform 0.25s var(--ease), visibility 0s linear 0.25s;
    background: linear-gradient(180deg, #0d2040, #07111f);
  }
  .app.nav-open .sidebar {
    transform: none; visibility: visible; box-shadow: 24px 0 60px rgba(0, 0, 0, 0.6);
    transition: transform 0.25s var(--ease), visibility 0s;
  }
  .tab.active::before { display: none; }
  .nav-backdrop {
    display: block; position: fixed; inset: 0; z-index: 35; background: rgba(3, 8, 16, 0.65);
    opacity: 0; pointer-events: none; transition: opacity 0.25s var(--ease);
  }
  .app.nav-open .nav-backdrop { opacity: 1; pointer-events: auto; }
}

@media (max-width: 1100px) {
  .hero-grid, .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .grid.two { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .content { padding: 0 16px calc(96px + env(safe-area-inset-bottom)); }
  .mobile-header {
    display: flex; justify-content: space-between; align-items: center;
    margin: 0 -16px 18px; padding: 12px 16px; border-bottom: 1px solid var(--border);
    background: rgba(11, 27, 51, 0.98); position: sticky; top: 0; z-index: 20;
  }
  .mobile-header img { height: 30px; }
  .sidebar {
    position: fixed; z-index: 25; top: auto; bottom: 0; left: 0; right: 0; height: auto;
    flex-direction: row; padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    border-right: 0; border-top: 1px solid var(--border);
    background: rgba(9, 22, 42, 0.98);
  }
  .sidebar-brand, .sidebar-user, .sidebar-status, .nav-label, .tab-desc { display: none; }
  .nav { flex-direction: row; flex: 1; }
  .nav { gap: 2px; }
  .tab { flex-direction: column; gap: 4px; padding: 6px 2px; justify-content: center; border: 0; text-align: center; }
  .tab:hover, .tab.active { background: transparent; border-color: transparent; box-shadow: none; }
  .tab-text { justify-items: center; }
  .tab-title { font-size: 0.7rem; font-weight: 500; color: var(--muted); }
  .tab.active .tab-title { color: var(--ice); }
  .tab-icon { width: 36px; height: 30px; border-radius: 10px; background: transparent; border: 0; }
  .tab.active .tab-icon { background: rgba(70, 157, 223, 0.2); color: var(--ice); box-shadow: none; }
  .tab-icon .icon { width: 21px; height: 21px; }
  .tab.active::before { left: 30%; right: 30%; top: -9px; bottom: auto; width: auto; height: 3px; border-radius: 0 0 3px 3px; }
  .page-header { align-items: flex-start; flex-direction: column; gap: 10px; }
  .header-clock { display: none; }
  .toasts { right: 16px; bottom: calc(84px + env(safe-area-inset-bottom)); }
  .card { padding: 18px; }
  .hero-actions .btn { flex: 1; }

  /* Tables become stacked cards */
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tbody tr { padding: 12px 0; border-bottom: 1px solid var(--border); }
  .table tbody tr:last-child { border-bottom: 0; }
  .table td { display: flex; justify-content: space-between; gap: 16px; padding: 4px 0; border: 0; text-align: right; }
  .table td::before { content: attr(data-label); color: var(--muted); font-size: 0.8rem; text-align: left; }
  .table td.empty-cell::before { display: none; }
  .table td.empty-cell { display: block; }
}
@media (max-width: 480px) {
  .row { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px; }
  .bars { gap: 3px; }
  .bar-label { font-size: 0.6rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
