:root {
  --paper: #f7f6f1;
  --ink: #151515;
  --muted: #687076;
  --line: #d9ded9;
  --cell: #ffffff;
  --accent: #176b5b;
  --accent-2: #b73e2d;
  --focus: #f0b44c;
  --shadow: 0 18px 55px rgba(26, 38, 34, .12);
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(23, 107, 91, .06) 1px, transparent 1px),
    linear-gradient(180deg, rgba(23, 107, 91, .05) 1px, transparent 1px),
    var(--paper);
  background-size: 28px 28px;
}

button, input, textarea, select {
  font: inherit;
}

button {
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}

button:active { transform: translateY(1px); }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid rgba(240, 180, 76, .55);
  outline-offset: 2px;
}

.shell {
  width: min(1180px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 34px 0 48px;
}

.shell.wide { width: min(1480px, calc(100vw - 28px)); }

.login-card {
  width: min(430px, 100%);
  margin: 12vh auto 0;
  padding: 28px;
  background: var(--cell);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.brand-strip {
  height: 8px;
  margin: -28px -28px 24px;
  border-radius: 8px 8px 0 0;
  background: repeating-linear-gradient(90deg, var(--accent), var(--accent) 18px, #1f8a76 18px, #1f8a76 28px);
}

.brand-strip.admin {
  background: repeating-linear-gradient(90deg, var(--accent-2), var(--accent-2) 18px, #d1783d 18px, #d1783d 28px);
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(28px, 4vw, 44px); letter-spacing: 0; }
h2 { margin-bottom: 0; font-size: 18px; }
p { color: var(--muted); line-height: 1.7; }

.stack { display: grid; gap: 14px; }
label { display: grid; gap: 7px; color: #38413d; font-weight: 700; }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 11px 12px;
  background: #fff;
  color: var(--ink);
}

textarea {
  resize: vertical;
  min-height: 210px;
  line-height: 1.55;
  font-family: "Cascadia Mono", Consolas, monospace;
}

.primary {
  min-height: 42px;
  padding: 0 18px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 8px 20px rgba(23, 107, 91, .18);
}

.primary:hover { background: #115548; }

.ghost, .link-btn {
  min-height: 36px;
  padding: 0 12px;
  background: #eef2ef;
  color: #20312d;
  text-decoration: none;
  display: inline-grid;
  align-items: center;
  border-radius: 6px;
  font-weight: 700;
}

.danger { background: #f4dfdc; color: #9e2f22; }
.done { background: #e6eddc; color: #3b641f; }
.restore { background: #e2eef4; color: #235976; }

.workspace { display: grid; gap: 18px; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding-bottom: 18px;
  border-bottom: 2px solid #26352f;
}

.eyebrow {
  color: var(--accent);
  font-weight: 900;
  letter-spacing: 0;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  color: var(--muted);
  font-weight: 700;
}

.take-panel, .panel, .table-section {
  background: rgba(255, 255, 255, .86);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.take-panel { padding: 18px; }
.take-form {
  display: grid;
  grid-template-columns: minmax(140px, 210px) auto;
  gap: 12px;
  align-items: end;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(340px, .75fr);
  gap: 18px;
}

.panel { overflow: hidden; }
.panel textarea { border: 0; border-radius: 0; border-bottom: 1px solid var(--line); }
.panel-actions { padding: 12px 16px 16px; display: flex; justify-content: flex-end; }

.user-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.user-form button { grid-column: span 2; }

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

.stat {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 14px;
  box-shadow: 0 10px 30px rgba(26, 38, 34, .08);
}

.stat span { color: var(--muted); font-weight: 800; }
.stat strong { display: block; margin-top: 6px; font-size: 28px; }

.tabs {
  display: flex;
  gap: 6px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.tabs button {
  background: #eef2ef;
  color: #26352f;
  min-height: 36px;
  padding: 0 14px;
  white-space: nowrap;
  font-weight: 800;
}

.tabs button.active {
  background: var(--ink);
  color: #fff;
}

.table-wrap, .mini-table-wrap {
  width: 100%;
  overflow: auto;
}

.data-table, .mini-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

.data-table th, .data-table td, .mini-table th, .mini-table td {
  border: 1px solid var(--line);
  padding: 9px 10px;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
  font-size: 14px;
}

.data-table th, .mini-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #edf4f0;
  color: #243631;
  font-weight: 900;
}

.data-table td.copyable {
  cursor: copy;
  color: #075b8a;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.data-table td.copyable:hover {
  background: #eef8f6;
}

.data-table td.link-cell {
  max-width: 320px;
}

.data-table td.link-cell a {
  display: inline-block;
  max-width: 100%;
  color: #075b8a;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
}

.data-table td.link-cell a:hover {
  text-decoration: underline;
}

.actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.actions button {
  min-height: 32px;
  padding: 0 10px;
  font-weight: 800;
}

.note-input {
  min-width: 150px;
  padding: 8px 9px;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: #eef2ef;
  color: #26352f;
  font-weight: 800;
}

.danger-status {
  background: #f4dfdc;
  color: #9e2f22;
}

.aw-status {
  background: #e6eddc;
  color: #3b641f;
}

.using-status {
  background: #eef2ef;
  color: #26352f;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  min-width: 160px;
  max-width: min(420px, calc(100vw - 28px));
  padding: 12px 16px;
  border-radius: 8px;
  background: #151515;
  color: #fff;
  text-align: center;
  box-shadow: 0 14px 45px rgba(0,0,0,.22);
  z-index: 20;
}

.empty {
  padding: 24px;
  text-align: center;
  color: var(--muted);
}

@media (max-width: 820px) {
  .shell { padding-top: 18px; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .user-pill { justify-content: flex-start; }
  .take-form, .admin-grid, .stats, .user-form {
    grid-template-columns: 1fr;
  }
  .user-form button { grid-column: auto; }
}
