:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --panel-2: #fafbfc;
  --line: #e4e7ec;
  --text: #1f2328;
  --muted: #6b7280;
  --faint: #9aa1ab;
  --accent: #2563eb;
  --accent-soft: #e8effd;
  --accent-strong: #1d4ed8;
  --warn-bg: #fef3c7;
  --warn-fg: #92400e;
  --info-bg: #e0f2fe;
  --info-fg: #075985;
  --danger: #dc2626;
  --seg-morning: #cfe0fb;
  --seg-morning-line: #93b4ec;
  --seg-afternoon: #c9e9dd;
  --seg-afternoon-line: #7cc4a8;
  --seg-noon: #fbe1c4;
  --seg-noon-line: #e9b382;
  --seg-evening: #dcd9f6;
  --seg-evening-line: #a9a2e0;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171c;
    --panel: #1d2026;
    --panel-2: #22262d;
    --line: #2e333c;
    --text: #e6e8eb;
    --muted: #9aa3ae;
    --faint: #7b838f;
    --accent: #6f9cf5;
    --accent-soft: #23304a;
    --accent-strong: #a8c2fb;
    --warn-bg: #3d2f13;
    --warn-fg: #f0c877;
    --info-bg: #122f43;
    --info-fg: #8ecdf0;
    --danger: #f07171;
    --seg-morning: #2b4468;
    --seg-morning-line: #3f6798;
    --seg-afternoon: #1f4a3c;
    --seg-afternoon-line: #2f7359;
    --seg-noon: #4a3720;
    --seg-noon-line: #7a5a33;
    --seg-evening: #35305c;
    --seg-evening-line: #565095;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.shell { display: flex; min-height: 100vh; }

.side {
  width: 200px;
  flex: 0 0 200px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
}

.brand {
  font-size: 15px;
  font-weight: 500;
  padding: 0 8px 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: .2px;
}

.brand .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
}

.side nav { display: flex; flex-direction: column; gap: 2px; }

.side nav a {
  display: block;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
}

.side nav a:hover { background: var(--panel-2); text-decoration: none; color: var(--text); }
.side nav a.on { background: var(--accent-soft); color: var(--accent-strong); font-weight: 500; }

.side-foot {
  margin-top: auto;
  padding: 14px 8px 0;
  font-size: 12px;
  color: var(--faint);
  border-top: 1px solid var(--line);
  word-break: break-all;
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  padding: 16px 28px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.content { padding: 24px 28px 48px; max-width: 1180px; width: 100%; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 16px;
  overflow: hidden;
}

.card-head {
  padding: 16px 20px 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.card-head h3 { margin: 0; font-size: 14px; font-weight: 500; }
.card-head .sub { margin: 4px 0 0; }
.card-body { padding: 16px 20px 20px; }
.card-actions { flex: 0 0 auto; }

.sub { font-size: 12px; color: var(--muted); margin: 0; }
.hint { font-size: 12px; color: var(--faint); margin: 10px 0 0; }
.empty { color: var(--muted); padding: 12px 0; margin: 0; }
.err { color: var(--danger); font-size: 13px; margin: 0 0 12px; }

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metrics:has(.metric:only-child) { grid-template-columns: minmax(0, 1fr); }

.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
}

.m-label { font-size: 12px; color: var(--muted); }
.m-value { font-size: 24px; font-weight: 500; line-height: 1.35; font-variant-numeric: tabular-nums; }
.m-hint { font-size: 12px; color: var(--faint); }
.metric.warn .m-value { color: var(--warn-fg); }
.metric.info .m-value { color: var(--info-fg); }

.tbl-wrap { overflow-x: auto; margin: 0 -20px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left;
  font-weight: 500;
  color: var(--muted);
  font-size: 12px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
tbody tr:last-child td { border-bottom: none; }
table.compact td { padding: 7px 10px; }

.pill {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12px;
  white-space: nowrap;
}
.pill.warn { background: var(--warn-bg); color: var(--warn-fg); }
.pill.info { background: var(--info-bg); color: var(--info-fg); }

.timeline { padding: 4px 0 0; }
.tl-row { display: flex; align-items: center; gap: 10px; height: 30px; }
.tl-head { height: 22px; }
.tl-label {
  width: 46px;
  flex: 0 0 46px;
  font-size: 13px;
  color: var(--muted);
}
a.tl-label:hover { color: var(--accent); text-decoration: none; }
.tl-track { position: relative; flex: 1; height: 18px; }
.tl-axis { border-bottom: 1px solid var(--line); }
.tick-label { position: absolute; top: 0; font-size: 11px; color: var(--faint); transform: translateX(-50%); }

.bar {
  position: absolute;
  top: 4px;
  height: 10px;
  border-radius: 3px;
  display: block;
  transition: filter .12s ease;
}
.bar:hover { filter: brightness(1.12); }
.bar.morning { background: var(--seg-morning); border: 1px solid var(--seg-morning-line); }
.bar.afternoon { background: var(--seg-afternoon); border: 1px solid var(--seg-afternoon-line); }
.bar.noon { background: var(--seg-noon); border: 1px solid var(--seg-noon-line); }
.bar.evening { background: var(--seg-evening); border: 1px solid var(--seg-evening-line); }

.tl-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}
.lg { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 14px; height: 8px; border-radius: 2px; display: inline-block; }
.sw.morning { background: var(--seg-morning); border: 1px solid var(--seg-morning-line); }
.sw.afternoon { background: var(--seg-afternoon); border: 1px solid var(--seg-afternoon-line); }
.sw.noon { background: var(--seg-noon); border: 1px solid var(--seg-noon-line); }
.sw.evening { background: var(--seg-evening); border: 1px solid var(--seg-evening-line); }
.lg-hint { margin-left: auto; color: var(--faint); }

.tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.tab {
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--muted);
  border: 1px solid var(--line);
  background: var(--panel);
}
.tab:hover { text-decoration: none; color: var(--text); }
.tab.on { background: var(--accent-soft); color: var(--accent-strong); border-color: transparent; }

.task { padding: 14px 0; border-bottom: 1px solid var(--line); }
.task:last-child { border-bottom: none; padding-bottom: 0; }
.task:first-child { padding-top: 0; }
.task-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.task-head strong { font-size: 13px; font-weight: 500; }

.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.chip {
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  background: var(--panel-2);
  border: 1px solid var(--line);
}
.chip.main { background: var(--accent-soft); border-color: transparent; color: var(--accent-strong); font-weight: 500; }
.chip.prep { border-style: dashed; color: var(--muted); }
.gap { font-size: 11px; color: var(--faint); padding: 0 1px; }

form.inline { display: inline-flex; align-items: center; gap: 8px; margin: 0; }

select, input[type="text"], input[type="password"], input[type="file"] {
  font: inherit;
  font-size: 13px;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  max-width: 100%;
}

select:focus, input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }

button {
  font: inherit;
  font-size: 13px;
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}
button:hover { filter: brightness(1.06); }
button.link {
  background: none;
  border: none;
  color: var(--accent);
  padding: 0;
  font-size: 13px;
}
button.link.danger { color: var(--danger); }
button.wide { width: 100%; margin-top: 8px; }

.upload { display: flex; flex-direction: column; gap: 14px; max-width: 460px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; color: var(--muted); }

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.card.login { width: 340px; margin: 0; }
.card.login h2 { margin: 0 0 4px; font-size: 16px; font-weight: 500; }
.card.login .sub { margin-bottom: 18px; }
.card.login .field { margin-bottom: 14px; }

@media (max-width: 820px) {
  .shell { flex-direction: column; }
  .side {
    width: auto;
    flex: none;
    border-right: none;
    border-bottom: 1px solid var(--line);
    padding: 14px;
  }
  .side nav { flex-direction: row; flex-wrap: wrap; }
  .side-foot { display: none; }
  .content { padding: 16px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar { padding: 12px 16px; }
}

.tb-title { font-size: 14px; font-weight: 500; }
.tb-right { display: flex; align-items: center; gap: 14px; font-size: 13px; }
.who { color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.role {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--muted);
}
a.quiet { color: var(--muted); font-size: 13px; }
a.quiet:hover { color: var(--danger); text-decoration: none; }

.btn {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  line-height: 1.4;
}
.btn:hover { text-decoration: none; filter: brightness(1.06); }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.ghost:hover { background: var(--accent-soft); }

.flash {
  background: var(--accent-soft);
  color: var(--accent-strong);
  border-radius: 8px;
  padding: 9px 14px;
  font-size: 13px;
  margin-bottom: 14px;
}

.form { display: flex; flex-direction: column; gap: 14px; max-width: 520px; }
.form .field { display: flex; flex-direction: column; gap: 6px; }
.form .field.narrow { max-width: 180px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); }
.check input { width: auto; }
.row { display: flex; gap: 10px; }
.mt { margin-top: 14px; }
.inline-form { flex-direction: row; flex-wrap: wrap; max-width: none; gap: 8px; margin-top: 14px; }
.inline-form input, .inline-form select { width: auto; }
input.tiny { width: 120px; padding: 4px 8px; font-size: 12px; }

.group-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  padding-top: 4px;
  border-top: 1px solid var(--line);
}
.group-title:first-of-type { border-top: none; padding-top: 0; }

.site-foot {
  margin-top: 30px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--faint);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.site-foot a { color: var(--faint); }
.site-foot a:hover { color: var(--accent); }
.site-foot .sep { color: var(--line); }
.login-wrap { flex-direction: column; gap: 18px; }
.login-wrap .site-foot { border-top: none; margin-top: 0; }
