/* Restore Design Time Tracker */
:root {
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --baseline: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --accent: #2a78d6;
  --accent-dark: #1c5cab;
  --accent-wash: #e8f1fc;
  --good: #0ca30c;
  --good-text: #006300;
  --danger: #d03b3b;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(11,11,11,.05), 0 4px 16px rgba(11,11,11,.05);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--page); color: var(--ink); }
body { font-size: 14px; line-height: 1.45; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-dark); }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 20px;
  padding: 0 20px; height: 54px;
  background: var(--surface); border-bottom: 1px solid var(--grid);
  position: sticky; top: 0; z-index: 40;
}
.brand { font-weight: 700; font-size: 15px; letter-spacing: .01em; white-space: nowrap; }
.brand span { color: var(--accent); }
.nav { display: flex; gap: 2px; flex: 1; overflow-x: auto; }
.nav a {
  padding: 7px 12px; border-radius: 8px; text-decoration: none;
  color: var(--ink-2); font-weight: 500; white-space: nowrap;
}
.nav a:hover { background: rgba(11,11,11,.045); }
.nav a.active { background: var(--accent-wash); color: var(--accent-dark); }
.userbox { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.userbox .uname { color: var(--ink-2); font-weight: 500; }

.main { max-width: 1180px; margin: 0 auto; padding: 20px 20px 60px; }

/* ---------- generic ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; margin-bottom: 16px;
}
h1 { font-size: 20px; margin: 4px 0 14px; }
h2 { font-size: 15px; margin: 0 0 10px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.btn {
  border: 1px solid var(--border); background: var(--surface);
  padding: 7px 14px; border-radius: 8px; cursor: pointer; font-weight: 500;
}
.btn:hover { background: rgba(11,11,11,.035); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-dark); }
.btn.danger { color: var(--danger); }
.btn.small { padding: 4px 9px; font-size: 12.5px; border-radius: 7px; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: rgba(11,11,11,.05); }
.btn:disabled { opacity: .5; cursor: default; }
input[type=text], input[type=email], input[type=password], input[type=date],
input[type=time], input[type=number], select, textarea {
  border: 1px solid var(--baseline); border-radius: 8px;
  padding: 7px 10px; background: #fff; min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
label.fld { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--ink-2); font-weight: 500; }
.checkline { display: flex; gap: 7px; align-items: center; cursor: pointer; }

table.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  text-align: left; font-size: 12px; color: var(--muted); font-weight: 600;
  padding: 7px 10px; border-bottom: 1px solid var(--grid);
  text-transform: uppercase; letter-spacing: .04em; white-space: nowrap;
}
.tbl th.sortable { cursor: pointer; user-select: none; }
.tbl th.sortable:hover { color: var(--ink-2); }
.tbl td { padding: 8px 10px; border-bottom: 1px solid var(--grid); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .sub { color: var(--muted); font-size: 12px; }
.badge {
  display: inline-block; white-space: nowrap; padding: 2px 8px; border-radius: 20px;
  font-size: 11.5px; font-weight: 600; background: rgba(11,11,11,.06); color: var(--ink-2);
}
.badge.on { background: #e2f6e2; color: var(--good-text); }
.badge.admin { background: var(--accent-wash); color: var(--accent-dark); }
.muted { color: var(--muted); }
.right { margin-left: auto; }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card { width: 360px; padding: 28px; }
.login-card h1 { text-align: center; margin-bottom: 2px; }
.login-card .sub { text-align: center; color: var(--muted); margin-bottom: 18px; }
.login-card form { display: flex; flex-direction: column; gap: 12px; }

/* ---------- tracker ---------- */
.weekstrip { display: flex; gap: 6px; align-items: stretch; }
.daybtn {
  flex: 1; border: 1px solid var(--border); border-radius: 9px; background: var(--surface);
  padding: 7px 4px; cursor: pointer; text-align: center; min-width: 64px;
}
.daybtn .dw { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; }
.daybtn .dd { font-weight: 600; }
.daybtn .dh { font-size: 11.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.daybtn.sel { background: var(--accent); border-color: var(--accent); }
.daybtn.sel .dw, .daybtn.sel .dd, .daybtn.sel .dh { color: #fff; }
.daybtn.today:not(.sel) { border-color: var(--accent); }
.mode-tabs { display: flex; border: 1px solid var(--baseline); border-radius: 8px; overflow: hidden; }
.mode-tabs button { border: none; background: transparent; padding: 7px 12px; cursor: pointer; color: var(--ink-2); font-weight: 500; }
.mode-tabs button.sel { background: var(--accent); color: #fff; }
.timerbar {
  display: flex; gap: 12px; align-items: center;
  background: var(--accent-wash); border: 1px solid var(--accent);
  border-radius: var(--radius); padding: 10px 14px; margin-bottom: 16px;
}
.timerbar .elapsed { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--accent-dark); }
.entry-actions { display: flex; gap: 6px; justify-content: flex-end; }
.entry-actions .btn { white-space: nowrap; }
.daytotal { font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- combobox ---------- */
.combo { position: relative; }
.combo input { width: 100%; }
.combo .list {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 60;
  background: #fff; border: 1px solid var(--border); border-radius: 9px;
  box-shadow: var(--shadow); max-height: 260px; overflow-y: auto;
}
.combo .opt { padding: 7px 11px; cursor: pointer; }
.combo .opt .sub { display: block; font-size: 11.5px; color: var(--muted); }
.combo .opt:hover, .combo .opt.hi { background: var(--accent-wash); }
.combo .none { padding: 9px 11px; color: var(--muted); }

/* ---------- dashboard ---------- */
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.filters label.fld { min-width: 130px; flex: 1; max-width: 190px; }
.filters .fld.datef { max-width: 150px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { padding: 14px 16px; }
.kpi .lbl { font-size: 12.5px; color: var(--ink-2); font-weight: 500; }
.kpi .val { font-size: 30px; font-weight: 650; margin-top: 2px; }
.kpi .sub2 { font-size: 12px; color: var(--muted); margin-top: 2px; }
.chart-wrap { position: relative; }
.chart-tip {
  position: absolute; pointer-events: none; z-index: 30;
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
  box-shadow: var(--shadow); padding: 7px 10px; font-size: 12.5px; display: none;
}
.chart-tip .v { font-weight: 700; font-size: 14px; }
.chart-tip .l { color: var(--ink-2); }
.grouptabs { display: flex; gap: 2px; margin-bottom: 6px; flex-wrap: wrap; }
.grouptabs button {
  border: none; background: transparent; padding: 6px 12px; border-radius: 8px;
  cursor: pointer; color: var(--ink-2); font-weight: 500;
}
.grouptabs button.sel { background: var(--accent-wash); color: var(--accent-dark); font-weight: 600; }
.hbar { position: relative; height: 16px; background: transparent; min-width: 60px; }
.hbar i {
  position: absolute; left: 0; top: 2px; bottom: 2px; display: block;
  background: var(--accent); border-radius: 0 4px 4px 0; min-width: 2px;
}

/* ---------- modal ---------- */
.modal-back {
  position: fixed; inset: 0; background: rgba(11,11,11,.35); z-index: 90;
  display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px;
}
.modal {
  background: var(--surface); border-radius: 12px; box-shadow: var(--shadow);
  width: 520px; max-width: 100%; max-height: 86vh; overflow-y: auto; padding: 20px;
}
.modal.wide { width: 600px; }
.modal .tbl td { white-space: nowrap; }
.modal h2 { font-size: 17px; margin-bottom: 14px; }
.modal .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal .foot { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }
.checklist {
  border: 1px solid var(--grid); border-radius: 8px; max-height: 200px; overflow-y: auto; padding: 6px 10px;
}
.checklist .checkline { padding: 3px 0; }

/* ---------- toast ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 10px;
  z-index: 200; font-weight: 500; box-shadow: var(--shadow);
}
.toast.err { background: var(--danger); }

@media (max-width: 760px) {
  .modal .grid2 { grid-template-columns: 1fr; }
  .filters label.fld { max-width: none; }
}
