:root {
  --bg: #f6f7fb; --panel: #ffffff; --ink: #1c2333; --muted: #6b7280;
  --accent: #2563eb; --accent-ink: #ffffff; --ok: #16a34a; --warn: #d97706;
  --bad: #dc2626; --line: #e5e7eb; --nav: #101828; --nav-ink: #cbd5e1;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg); color: var(--ink); font-size: 15px; }
main.with-nav { margin-left: 220px; padding: 28px 36px; max-width: 1200px; }
main.centered { display: flex; min-height: 100vh; align-items: center; justify-content: center; }

.sidebar { position: fixed; inset: 0 auto 0 0; width: 220px; background: var(--nav);
  color: var(--nav-ink); display: flex; flex-direction: column; padding: 18px 12px; }
.sidebar .brand { font-size: 18px; font-weight: 700; color: #fff; padding: 6px 10px 18px; }
.sidebar .brand span { color: #60a5fa; }
.sidebar a { color: var(--nav-ink); text-decoration: none; padding: 9px 12px; border-radius: 8px;
  margin-bottom: 2px; font-size: 14px; }
.sidebar a:hover { background: #1e293b; color: #fff; }
.sidebar a.active { background: var(--accent); color: #fff; }
.nav-section { font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: #64748b; padding: 16px 12px 6px; }
.spacer { flex: 1; }
.me { border-top: 1px solid #1e293b; padding: 12px 10px 0; font-size: 13px; }
.me-name { color: #fff; font-weight: 600; }
.me-role { color: #64748b; margin-bottom: 8px; }
.small-link { font-size: 12px !important; padding: 2px 0 8px !important; display: block; }

h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 0 0 12px; }
.sub { color: var(--muted); margin: 0 0 22px; font-size: 14px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 20px; margin-bottom: 20px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px;
  text-transform: uppercase; letter-spacing: .04em; padding: 8px 10px;
  border-bottom: 1px solid var(--line); }
td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }

.btn { background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 8px;
  padding: 9px 16px; font-size: 14px; font-weight: 600; cursor: pointer; }
.btn:hover { filter: brightness(1.08); }
.btn-stop { background: var(--bad); }
.btn-ok { background: var(--ok); }
.btn-ghost { background: transparent; color: var(--nav-ink); border: 1px solid #334155;
  padding: 6px 12px; font-size: 13px; border-radius: 8px; cursor: pointer; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-warn { background: var(--warn); }

input, select, textarea { border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px;
  font-size: 14px; width: 100%; background: #fff; color: var(--ink); }
label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin: 10px 0 4px; }
form.inline { display: inline; }
.row { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.row > div { flex: 1; min-width: 130px; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.ok, .badge.present, .badge.approved, .badge.auto { background: #dcfce7; color: #166534; }
.badge.warn, .badge.late, .badge.pending { background: #fef3c7; color: #92400e; }
.badge.bad, .badge.absent, .badge.rejected { background: #fee2e2; color: #991b1b; }
.badge.off { background: #e5e7eb; color: #374151; }

.timer-display { font-size: 44px; font-weight: 700; font-variant-numeric: tabular-nums;
  letter-spacing: .02em; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 7px; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 4px #16a34a22; }
.dot.off { background: #9ca3af; }
.error { background: #fee2e2; color: #991b1b; padding: 10px 14px; border-radius: 8px;
  margin-bottom: 14px; font-size: 14px; }
.notice { background: #dbeafe; color: #1e40af; padding: 10px 14px; border-radius: 8px;
  margin-bottom: 14px; font-size: 14px; }
.stat { font-size: 26px; font-weight: 700; }
.stat-label { color: var(--muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em; }
.login-card { width: 380px; }
.login-card .brand { font-size: 26px; font-weight: 800; text-align: center; margin-bottom: 4px; }
.login-card .brand span { color: var(--accent); }
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.shot img { width: 100%; border-radius: 8px; border: 1px solid var(--line); }
.shot .cap { font-size: 12px; color: var(--muted); margin-top: 4px; }
.muted { color: var(--muted); }
code.temp { background: #fef3c7; padding: 2px 8px; border-radius: 6px; font-weight: 700; }

/* ---- Tier 1: wellness (weekly cap + burnout flags) ---- */
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.cap-track { background: #eef1f6; border-radius: 999px; height: 12px; overflow: hidden; }
.cap-fill { background: var(--ok); height: 100%; border-radius: 999px; transition: width .3s; }
.cap-fill.near { background: var(--warn); }
.cap-fill.over { background: var(--bad); }

/* ---- Tier 1: day timeline ---- */
.tl-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.tl-hours { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.tl-label { flex: 0 0 170px; font-size: 13px; text-align: right; }
.tl-scale { flex: 1; display: flex; justify-content: space-between; font-size: 11px;
  color: var(--muted); padding: 0 2px; }
.tl-track { flex: 1; position: relative; height: 22px; background: #f1f3f8;
  border-radius: 6px; overflow: hidden;
  background-image: repeating-linear-gradient(to right, transparent, transparent calc(12.5% - 1px),
    #e2e6ee calc(12.5% - 1px), #e2e6ee 12.5%); }
.tl-shift { position: absolute; top: 0; bottom: 0; background: #2563eb14; }
.tl-block { position: absolute; top: 3px; bottom: 3px; border-radius: 4px; min-width: 2px; }
.tl-normal { background: var(--accent); }
.tl-idle { background: var(--warn); }
.tl-pending { background: #9ca3af; }
.tl-running { background: var(--ok); animation: tl-pulse 1.6s ease-in-out infinite; }
@keyframes tl-pulse { 50% { opacity: .55; } }
.tl-key { display: inline-block; width: 12px; height: 12px; border-radius: 3px;
  vertical-align: -2px; margin: 0 4px 0 10px; }
.tl-key.tl-normal { background: var(--accent); }
.tl-key.tl-idle { background: var(--warn); }
.tl-key.tl-pending { background: #9ca3af; }
.tl-key.tl-running { background: var(--ok); }
