:root {
  --bg: #121712;
  --surface: #1c241c;
  --surface-2: #273127;
  --line: #3d4a3c;
  --text: #f4f0e8;
  --muted: #b7ad9f;
  --faint: #8a8174;
  --brass: #e0bc84;
  --brass-dim: #a78455;
  --ok: #9dbe94;
  --warn: #e0a57d;
  --bad: #d48476;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
  --serif: "Iowan Old Style", Palatino, "Songti SC", serif;
  --sans: "Avenir Next", "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --nav: 248px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background:
    radial-gradient(720px 360px at 0 0, rgba(224, 188, 132, 0.08), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--brass); outline-offset: 2px;
}

.app { display: grid; grid-template-columns: var(--nav) minmax(0, 1fr); min-height: 100vh; }
.nav {
  position: sticky; top: 0; height: 100vh; overflow: auto;
  border-right: 1px solid var(--line);
  padding: 22px 14px 18px;
  display: flex; flex-direction: column;
  background: #161c16;
}
.brand { display: flex; gap: 12px; align-items: center; padding: 4px 8px 18px; }
.mark {
  width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center;
  background: var(--brass); color: #1b160e;
  font-family: var(--serif); font-weight: 700; font-size: 18px;
}
.brand strong { display: block; font-size: 16px; }
.brand em { display: block; font-style: normal; color: var(--muted); font-size: 12px; margin-top: 2px; }
#nav { display: flex; flex-direction: column; gap: 2px; }
.nav-btn {
  text-align: left; border: 0; background: transparent;
  color: var(--muted); border-radius: 12px; padding: 10px 12px;
  border-left: 3px solid transparent;
}
.nav-btn.active { background: var(--surface-2); color: var(--text); border-left-color: var(--brass); }
.nav-btn small { display: block; color: var(--faint); font-size: 11px; margin-top: 2px; }
.nav-foot {
  margin-top: auto; color: var(--muted); font-size: 12px;
  display: flex; gap: 8px; align-items: center; padding: 14px 8px 4px;
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }

main { padding: 28px 32px 56px; min-width: 0; }
.view { max-width: 1180px; }
.top { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 22px; }
.titles { min-width: 0; flex: 1; }
.kicker { margin: 0 0 6px; color: var(--brass); font-size: 12px; letter-spacing: 0.14em; }
h1 { margin: 0; font-family: var(--serif); font-weight: 560; font-size: 34px; line-height: 1.15; }
.top-actions { display: flex; gap: 8px; flex-shrink: 0; }
.menu-btn { display: none; }
.primary, .ghost, .chip, .mini, .menu-btn {
  border-radius: 999px; border: 1px solid var(--line); background: #1a211a; padding: 9px 14px;
  min-height: 40px;
}
.primary { background: var(--brass); color: #1b160e; border-color: transparent; font-weight: 650; }
.ghost:hover, .chip:hover, .mini:hover, .menu-btn:hover { border-color: var(--brass-dim); }
.chip.active { background: #2c261c; border-color: var(--brass-dim); color: var(--brass); }

.grid { display: grid; gap: 14px; }
.stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card {
  background: var(--surface);
  border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px;
  box-shadow: 0 1px 0 rgba(255,255,255,0.03) inset;
}
.stat b { display: block; font-family: var(--serif); font-size: 32px; font-weight: 560; margin-top: 6px; color: var(--text); }
.stat span, .muted { color: var(--muted); font-size: 13px; }
.split { grid-template-columns: 1.4fr 0.8fr; }
.list { display: flex; flex-direction: column; gap: 8px; }
.row {
  display: grid; gap: 10px; align-items: center;
  padding: 12px 14px; border-radius: 12px; background: var(--surface-2);
  border: 1px solid transparent;
}
.row button.link, button.link { background: none; border: 0; padding: 0; text-align: left; color: var(--text); }
.row button.link:hover, button.link:hover { color: var(--brass); }
.tag {
  display: inline-flex; align-items: center; border-radius: 999px;
  padding: 2px 8px; font-size: 12px; border: 1px solid var(--line); color: var(--muted);
}
.tag.ok { color: var(--ok); border-color: #4d6550; }
.tag.warn { color: var(--warn); border-color: #7a5842; }
.tag.bad { color: var(--bad); border-color: #7a4640; }
.tag.brass { color: var(--brass); border-color: #6d5734; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--faint); font-weight: 560; font-size: 12px; padding: 8px; }
td { padding: 12px 8px; border-top: 1px solid var(--line); vertical-align: middle; }
.toolbar { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 14px; align-items: center; }
.search {
  background: #141a14; border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px; min-width: 240px; min-height: 42px;
}
.kanban { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.col h3 { margin: 0 0 10px; font-size: 13px; color: var(--muted); font-weight: 560; }
.ticket, .clip {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px; margin-bottom: 10px;
}
.ticket h4, .clip h4 { margin: 6px 0; font-size: 15px; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.mini { padding: 6px 10px; font-size: 12px; min-height: 32px; }
.script {
  display: grid; grid-template-columns: 180px 1fr auto; gap: 12px; align-items: start;
  padding: 14px 0; border-top: 1px solid var(--line);
}
.drawer {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  display: grid; justify-content: end; z-index: 30;
}
.drawer[hidden], .toast[hidden], .scrim[hidden] { display: none !important; }
.panel {
  width: min(440px, 100vw); height: 100%; background: #171d17;
  border-left: 1px solid var(--line); padding: 22px; overflow: auto;
  padding-bottom: calc(22px + env(safe-area-inset-bottom));
}
.panel h2 { font-family: var(--serif); font-weight: 560; margin: 8px 0 4px; }
label { display: block; font-size: 12px; color: var(--muted); margin: 12px 0 6px; }
input, select, textarea {
  width: 100%; background: #121812; border: 1px solid var(--line);
  border-radius: 10px; padding: 11px; min-height: 42px;
}
textarea { min-height: 96px; resize: vertical; }
.form-actions { display: flex; gap: 8px; margin-top: 16px; }
.toast {
  position: fixed; bottom: calc(18px + env(safe-area-inset-bottom)); right: 18px;
  background: var(--text); color: #1b160e;
  padding: 10px 14px; border-radius: 999px; font-size: 13px; z-index: 40;
}
.bar { height: 8px; background: #2c362c; border-radius: 99px; overflow: hidden; margin-top: 6px; }
.bar i { display: block; height: 100%; background: var(--brass); }
.empty { color: var(--faint); padding: 12px 0; }
.quote {
  white-space: pre-wrap; background: var(--surface-2); border-radius: 12px;
  padding: 12px; font-size: 14px; line-height: 1.6;
}
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,0.46); z-index: 15; }

@media (max-width: 960px) {
  .menu-btn { display: inline-flex; align-items: center; }
  .app { grid-template-columns: 1fr; }
  .nav {
    position: fixed; z-index: 20; width: min(300px, 86vw); height: 100%;
    transform: translateX(-105%); transition: transform .18s ease;
    box-shadow: var(--shadow);
  }
  .app.nav-open .nav { transform: none; }
  main { padding: 16px 16px calc(28px + env(safe-area-inset-bottom)); }
  h1 { font-size: 28px; }
  .top { align-items: center; flex-wrap: wrap; }
  .top-actions { width: 100%; }
  .top-actions .ghost, .top-actions .primary { flex: 1; }
  .stats { grid-template-columns: 1fr 1fr; }
  .split, .two, .script { grid-template-columns: 1fr; }
  .kanban { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x mandatory; }
  .col { min-width: 78vw; scroll-snap-align: start; }
  .search { min-width: 0; width: 100%; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .row { grid-template-columns: 1fr !important; }
  .card { overflow: auto; }
  table { min-width: 640px; }
}
