:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --nav: #0b1220;
  --nav-2: #111c31;
  --accent: #0f766e;
  --accent-2: #14b8a6;
  --good: #047857;
  --warn: #b45309;
  --bad: #b91c1c;
  --info: #1d4ed8;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 8px 24px rgba(15, 23, 42, .04);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", Inter, system-ui, -apple-system, Arial, sans-serif;
  background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.5;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 24px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
p { margin: 6px 0; }
code { background: #eef2f7; border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; font-size: 12px; }
.muted { color: var(--muted); }
.good { color: var(--good) !important; }
.warn { color: var(--warn) !important; }
.bad { color: var(--bad) !important; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 248px; flex: 0 0 248px; background: linear-gradient(180deg, var(--nav), var(--nav-2));
  color: #cbd5e1; display: flex; flex-direction: column; padding: 18px 14px; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; gap: 10px; align-items: center; padding: 6px 8px 18px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 10px; background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex; align-items: center; justify-content: center; font-weight: 800; color: #fff; font-size: 14px; letter-spacing: -.02em;
}
.brand-name { color: #fff; font-weight: 700; font-size: 16px; line-height: 1.1; }
.brand-sub { color: #94a3b8; font-size: 11px; }
.nav { flex: 1; display: flex; flex-direction: column; gap: 2px; overflow: auto; }
.nav-group { color: #64748b; font-size: 10px; text-transform: uppercase; letter-spacing: .12em; padding: 16px 10px 6px; }
.nav-link { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 8px; color: #cbd5e1; font-size: 13px; }
.nav-link:hover { background: rgba(255,255,255,.06); text-decoration: none; color: #fff; }
.nav-link.active { background: rgba(20, 184, 166, .16); color: #fff; box-shadow: inset 3px 0 0 var(--accent-2); }
.sidebar-footer { border-top: 1px solid rgba(255,255,255,.08); padding-top: 12px; }
.user-mini { display: flex; gap: 9px; align-items: center; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: #1e293b; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.user-name { color: #fff; font-size: 12px; font-weight: 600; }
.user-role { color: #94a3b8; font-size: 10px; text-transform: capitalize; }
.logout-form { margin-top: 8px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 54px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 26px; }
.topbar-title { font-weight: 600; font-size: 13px; color: #334155; }
.topbar-right { display: flex; align-items: center; gap: 9px; font-size: 12px; }
.dot { width: 4px; height: 4px; border-radius: 50%; background: #94a3b8; }
.content { padding: 24px 26px 60px; max-width: 1280px; width: 100%; }

.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; }
.page-head h1 { font-size: 24px; }
.page-head p { margin-top: 4px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.panel-head h2 { font-size: 15px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.metric { background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.metric-label { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.metric-value { font-size: 20px; font-weight: 700; margin-top: 4px; }
.metric-sub { color: var(--muted); font-size: 11px; margin-top: 2px; }
.result-metrics { flex: 1; }
.result-top { display: flex; gap: 18px; align-items: center; }
.bucket-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 14px; }

.ring { border-radius: 50%; background: conic-gradient(var(--accent-2) calc(var(--p) * 1%), #e2e8f0 0); display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.ring-md { width: 74px; height: 74px; }
.ring-lg { width: 92px; height: 92px; }
.ring-xl { width: 132px; height: 132px; }
.ring-inner { width: 78%; height: 78%; background: #fff; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-inner strong { font-size: 15px; }
.ring-lg .ring-inner strong { font-size: 17px; }
.ring-xl .ring-inner strong { font-size: 22px; }
.ring-inner span { font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.ring.bad { background: conic-gradient(var(--bad) calc(var(--p) * 1%), #e2e8f0 0); }
.ring.warn { background: conic-gradient(#f59e0b calc(var(--p) * 1%), #e2e8f0 0); }
.ring.good { background: conic-gradient(var(--good) calc(var(--p) * 1%), #e2e8f0 0); }

.trend { display: flex; flex-direction: column; gap: 8px; }
.trend-row { display: grid; grid-template-columns: 110px 1fr 52px; gap: 10px; align-items: center; font-size: 12px; }
.trend-label { color: var(--muted); }
.trend-bars { height: 16px; background: #eef2f7; border-radius: 4px; position: relative; overflow: hidden; }
.bar { height: 100%; position: absolute; left: 0; top: 0; border-radius: 4px; }
.bar.expected { background: #cbd5e1; }
.bar.worked { background: var(--accent-2); height: 8px; top: 4px; }
.trend-val { text-align: right; font-weight: 600; }
.legend { display: flex; gap: 14px; margin-top: 12px; font-size: 11px; color: var(--muted); flex-wrap: wrap; }
.dotbar, .swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: middle; }
.dotbar.expected { background: #cbd5e1; }
.dotbar.worked { background: var(--accent-2); }
.swatch.working { background: #ecfdf5; border: 1px solid #a7f3d0; }
.swatch.nonworking { background: #f1f5f9; border: 1px solid #cbd5e1; }
.swatch.vacation { background: #eff6ff; border: 1px solid #bfdbfe; }
.swatch.holiday { background: #fef3c7; border: 1px solid #fcd34d; }
.swatch.override { background: #fae8ff; border: 1px solid #e9d5ff; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 9px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 10px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); background: #f8fafc; }
tbody tr:hover { background: #fafcff; }
td .muted { font-size: 11px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: #fff; color: #334155; border-radius: 8px; padding: 7px 12px; font-size: 12px; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { background: #f8fafc; text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #0d5f59; }
.btn-danger { color: var(--bad); border-color: #fecaca; background: #fff; }
.btn-danger:hover { background: #fef2f2; }
.btn-ghost { background: transparent; color: #cbd5e1; border-color: rgba(255,255,255,.16); }
.btn-ghost:hover { background: rgba(255,255,255,.08); color: #fff; }
.btn-sm { padding: 4px 8px; font-size: 11px; border-radius: 6px; }
.inline { display: inline-block; margin: 0; }
.inline-row { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.inline-row select { padding: 4px 6px; font-size: 11px; }
.inline-row input { padding: 4px 6px; font-size: 11px; width: 110px; }

label { display: block; font-size: 11px; font-weight: 600; color: #475569; text-transform: uppercase; letter-spacing: .04em; }
label input, label select, label textarea { display: block; width: 100%; margin-top: 4px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; font-family: inherit; background: #fff; color: var(--ink); text-transform: none; letter-spacing: 0; font-weight: 400; }
label input:focus, label select:focus, label textarea:focus { outline: 2px solid rgba(20,184,166,.25); border-color: var(--accent-2); }
.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
legend { font-size: 11px; font-weight: 600; color: #475569; padding: 0 4px; text-transform: uppercase; letter-spacing: .04em; }
.checks { display: flex; gap: 14px; flex-wrap: wrap; }
.check { display: flex; align-items: center; gap: 6px; text-transform: none; letter-spacing: 0; font-weight: 400; font-size: 12px; color: var(--ink); }
.check input { width: auto; margin: 0; }
.filters { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 12px; }
.filters label { min-width: 130px; }
.filters .btn { margin-bottom: 1px; }

.flash { border-radius: 9px; padding: 10px 12px; margin-bottom: 14px; font-size: 13px; border: 1px solid; }
.flash.ok { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.flash.err { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.badge { display: inline-block; border-radius: 999px; padding: 2px 8px; font-size: 10px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; background: #eef2f7; color: #475569; white-space: nowrap; }
.badge.ok { background: #d1fae5; color: #065f46; }
.badge.warn { background: #fef3c7; color: #92400e; }
.badge.muted { background: #eef2f7; color: #64748b; }
.badge.info { background: #dbeafe; color: #1e40af; margin-left: 6px; }
.empty { color: var(--muted); font-size: 12px; padding: 10px 0; text-align: center; }
.notes { margin: 0; padding-left: 18px; color: #475569; font-size: 12px; }
.notes li { margin-bottom: 6px; }

.source-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.source-card { border: 1px solid var(--line); border-radius: 10px; padding: 13px; background: #fbfdff; }
.source-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.source-detail { font-size: 12px; color: #334155; margin: 8px 0; word-break: break-all; }
.source-meta { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--muted); margin-bottom: 10px; }
.source-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.source-mini { border-bottom: 1px solid var(--line); padding: 8px 0; }
.source-mini-top { display: flex; justify-content: space-between; gap: 8px; }

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-dow { text-align: center; font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; padding: 4px 0; }
.cal-cell { min-height: 76px; border: 1px solid var(--line); border-radius: 8px; padding: 6px; background: #fff; position: relative; }
.cal-cell.empty { background: transparent; border-color: transparent; }
.cal-cell.nonworking { background: #f1f5f9; }
.cal-cell.vacation { background: #eff6ff; border-color: #bfdbfe; }
.cal-cell.holiday { background: #fffbeb; border-color: #fcd34d; }
.cal-cell.override { background: #faf5ff; border-color: #e9d5ff; }
.cal-cell.event { background: #f0fdfa; border-color: #99f6e4; }
.cal-cell.today { box-shadow: inset 0 0 0 2px var(--accent-2); }
.cal-date { font-size: 12px; font-weight: 700; }
.cal-hours { font-size: 10px; color: var(--muted); margin-top: 2px; }
.cal-badge { font-size: 9px; color: #475569; margin-top: 4px; line-height: 1.25; word-break: break-word; }

.login-body { background: linear-gradient(135deg, #0b1220, #0f766e); min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-wrap { width: 100%; max-width: 420px; padding: 20px; }
.login-card { background: #fff; border-radius: 16px; padding: 28px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.login-brand { display: flex; gap: 10px; align-items: center; margin-bottom: 18px; }
.login-card h1 { font-size: 22px; margin-top: 8px; }
.login-card .stack { margin-top: 16px; }
.login-card .btn { margin-top: 6px; }
.login-foot { margin-top: 16px; color: var(--muted); font-size: 11px; }
.login-card .brand-name { color: var(--ink); }

@media (max-width: 980px) {
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .bucket-row { grid-template-columns: 1fr 1fr; }
  .result-top { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 760px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; flex: none; height: auto; position: static; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .nav-group { display: none; }
  .nav-link { padding: 6px 8px; }
  .content { padding: 16px; }
  .topbar { padding: 0 16px; }
  .page-head { flex-direction: column; }
  .cal-cell { min-height: 58px; }
}
