:root {
  color-scheme: light;
  --bg: #efe7dc;
  --ink: #1d1915;
  --muted: #6f675e;
  --line: #e3d8ca;
  --card: #fffdf9;
  --green: #0f6b52;
  --green-dark: #0b5340;
  --gold: #8a6428;
  --danger: #8d2e2e;
  --danger-bg: #f8ecec;
  --warn-bg: #fff4df;
  --warn: #8a5a12;
  --sidebar: #171512;
  --sidebar-muted: #b7ab9c;
  --shadow: 0 16px 40px rgba(70, 48, 22, 0.08);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
}

button, input, textarea { font: inherit; color: inherit; }

button { cursor: pointer; }

a { color: inherit; }

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
  background:
    radial-gradient(900px 420px at 50% -10%, rgba(15, 107, 82, 0.18), transparent 60%),
    var(--bg);
}

.login-card {
  width: min(420px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 36px 32px 28px;
}

.eyebrow {
  margin: 0;
  color: var(--gold);
  letter-spacing: 0.18em;
  font-size: 12px;
}

h1, h2, h3 { font-family: "Palatino Linotype", "Songti SC", "STSong", serif; font-weight: 600; }

.login-card h1 { margin: 10px 0 6px; font-size: 34px; }
.sub { margin: 0 0 22px; color: var(--muted); line-height: 1.6; }

.field { display: grid; gap: 8px; margin-bottom: 14px; }
.field-label { font-size: 13px; color: var(--muted); }

.input, .textarea, .select {
  width: 100%;
  border: 1px solid #ddd2c4;
  background: #fff;
  border-radius: 12px;
  padding: 11px 12px;
  outline: none;
}

.textarea { min-height: 110px; resize: vertical; line-height: 1.6; }
.input:focus, .textarea:focus, .select:focus { border-color: #9d8b72; box-shadow: 0 0 0 3px rgba(15, 107, 82, 0.12); }

.btn {
  border: 0;
  border-radius: 12px;
  min-height: 40px;
  padding: 0 16px;
  background: var(--green);
  color: white;
}

.btn:hover { background: var(--green-dark); }
.btn.block { width: 100%; min-height: 46px; margin-top: 6px; }
.btn.ghost, .btn.danger, .btn.gold {
  background: transparent;
  color: var(--ink);
  border: 1px solid #ddd2c4;
}
.btn.ghost:hover { background: #f6f1ea; }
.btn.danger { color: var(--danger); border-color: #efd0d0; background: var(--danger-bg); }
.btn.gold { color: var(--gold); }
.btn[disabled], .btn[data-busy="1"] { opacity: 0.65; cursor: wait; }
.btn.small { min-height: 32px; padding: 0 10px; border-radius: 9px; font-size: 13px; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 232px 1fr; }

.sidebar {
  background: var(--sidebar);
  color: #f6f0e6;
  padding: 26px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.side-brand { padding: 0 10px; }
.side-brand strong {
  display: block;
  font-family: "Palatino Linotype", "Songti SC", serif;
  font-size: 22px;
  font-weight: 600;
}
.side-brand span { color: var(--sidebar-muted); font-size: 12px; letter-spacing: 0.12em; }

.nav { display: grid; gap: 4px; }
.nav a {
  text-decoration: none;
  padding: 11px 12px;
  border-radius: 12px;
  color: #efe7dc;
}
.nav a.active, .nav a:hover { background: rgba(255, 255, 255, 0.08); }

.side-foot { margin-top: auto; padding: 8px 10px 0; display: grid; gap: 10px; }
.who { color: var(--sidebar-muted); font-size: 13px; word-break: break-all; }

.main { padding: 28px 32px 48px; min-width: 0; }
.page-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-end; margin-bottom: 18px; }
.page-head h1 { margin: 0; font-size: 32px; }
.page-head p { margin: 6px 0 0; color: var(--muted); }

.banner {
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 16px;
  background: var(--warn-bg);
  color: var(--warn);
  line-height: 1.6;
}
.banner.bad { background: var(--danger-bg); color: var(--danger); }
.banner a { color: inherit; }

.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat, .panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.stat { padding: 16px 16px 14px; }
.stat span { color: var(--muted); font-size: 13px; }
.stat strong {
  display: block;
  margin-top: 8px;
  font-family: "Palatino Linotype", "Songti SC", serif;
  font-size: 32px;
  font-weight: 600;
}
.panel { padding: 16px 18px 8px; margin-top: 14px; }
.panel h2 { margin: 0 0 8px; font-size: 22px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 14px; }
th { color: var(--muted); font-weight: 600; font-size: 12px; letter-spacing: 0.06em; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.muted { color: var(--muted); }
.mono { font-variant-numeric: tabular-nums; }

.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
.toolbar .input { max-width: 280px; }

.pending { display: grid; gap: 8px; margin-bottom: 16px; }
.pending-item, .split {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.grow { min-width: 0; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 12px; }
.chip {
  border: 1px solid #ddd2c4;
  background: #fff;
  border-radius: 999px;
  min-height: 32px;
  padding: 0 12px;
}

.stack { display: grid; gap: 14px; }
.two { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 14px; align-items: start; }
.back { color: var(--green); text-decoration: none; font-size: 14px; }
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: #e7f3ee;
  color: var(--green-dark);
  font-size: 12px;
}
.badge.done { background: #f8f1e4; color: var(--gold); }
.badge.pause { background: #f0eeea; color: #5c564e; }
.badge.off { background: #f8ecec; color: var(--danger); }

.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 12px; }
.file-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.hidden-file { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(28, 22, 16, 0.46);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 30;
}
.modal {
  width: min(520px, 100%);
  background: #fffdf9;
  border-radius: 18px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.2);
  padding: 22px 22px 18px;
}
.modal h3 { margin: 0 0 8px; font-size: 26px; }
.modal-text { margin: 0 0 8px; line-height: 1.7; white-space: pre-wrap; }
.modal-error { min-height: 22px; color: var(--danger); font-size: 13px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

#toast-root {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  display: grid;
  gap: 8px;
  z-index: 40;
}
.toast {
  background: #1d1915;
  color: white;
  border-radius: 999px;
  padding: 10px 16px;
  box-shadow: var(--shadow);
  max-width: min(520px, calc(100vw - 32px));
}

@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { padding: 16px; }
  .nav { grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); }
  .side-foot { margin-top: 0; grid-template-columns: 1fr auto; align-items: center; }
  .grid, .two { grid-template-columns: 1fr; }
  .main { padding: 18px 14px 40px; }
}
