:root {
  --ink: #1b1712;
  --ink-soft: #4a4338;
  --paper: #f3ece1;
  --panel: #fffaf2;
  --line: #d9cbb8;
  --line-strong: #c4b195;
  --steel: #24364d;
  --steel-2: #1a2a3d;
  --amber: #e08a00;
  --amber-deep: #b86d00;
  --safety: #f0c14b;
  --ok: #3d6b2f;
  --warn: #9a4a12;
  --rain: #355f7a;
  --muted: #7a7164;
  --shadow: 0 18px 40px rgba(36, 28, 16, 0.08);
  --radius: 18px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
.gate {
  position: fixed; inset: 0; z-index: 40;
  display: grid; place-items: center;
  background:
    radial-gradient(circle at 0 0, rgba(240, 193, 75, 0.22), transparent 32%),
    linear-gradient(180deg, #1a2a3d, #24364d);
}
.gate-card {
  width: min(420px, 92vw);
  background: var(--panel);
  border-radius: 22px;
  padding: 28px 24px 24px;
  box-shadow: var(--shadow);
}
.gate-card h2 { margin: 8px 0 6px; }
.gate[hidden] { display: none !important; }

body {
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 0 0, rgba(240, 193, 75, 0.18), transparent 28%),
    linear-gradient(180deg, #efe4d4 0%, var(--paper) 40%);
}

button, input, textarea, select {
  font-family: inherit;
  color: inherit;
}

.app {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
}

.sider {
  background: linear-gradient(180deg, var(--steel-2), var(--steel));
  color: #f6efe4;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 6px solid var(--safety);
}

.brand { display: flex; gap: 12px; align-items: center; padding: 6px 8px 22px; }
.brand-mark {
  width: 38px; height: 38px;
  display: grid; grid-template-rows: 8px 8px 8px; gap: 4px;
}
.brand-mark span { display: block; background: var(--safety); }
.brand-mark span:nth-child(2) { width: 70%; }
.brand-mark span:nth-child(3) { width: 42%; }
.brand-kicker {
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--safety);
}
.brand-name { font-weight: 700; font-size: 18px; }

.nav { display: grid; gap: 6px; }
.nav button {
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  color: #d9d0c3;
  padding: 11px 12px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 15px;
}
.nav button:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav button.active {
  background: rgba(240, 193, 75, 0.14);
  border-color: rgba(240, 193, 75, 0.45);
  color: var(--safety);
  font-weight: 700;
}

.sider-foot {
  margin-top: auto;
  padding: 14px 10px 4px;
  border-top: 1px dashed rgba(255,255,255,0.18);
  font-size: 13px;
}
.sider-foot .muted { color: #b3a896; margin-top: 4px; }

.main { padding: 28px 36px 48px; min-width: 0; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 22px;
}
.topbar h1 { margin: 0; font-size: 30px; letter-spacing: 0.02em; }
.lede { margin: 6px 0 0; color: var(--ink-soft); }
.top-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.top-search {
  min-width: 240px;
  border: 1px solid var(--line-strong);
  background: var(--panel);
  padding: 10px 14px;
  border-radius: 999px;
}

.btn {
  border: 1px solid var(--line-strong);
  background: var(--panel);
  padding: 10px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
}
.btn:hover { border-color: var(--ink); }
.btn.primary {
  background: var(--ink);
  color: #fffaf2;
  border-color: var(--ink);
}
.btn.primary:hover { background: #000; }
.btn.ghost { background: transparent; }
.btn.danger { color: #9f1239; border-color: #e8b4c0; }
.btn.small { padding: 6px 10px; font-size: 13px; }

.view { display: none; }
.view.active { display: block; }

.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.kpi .label {
  font-size: 12px;
  letter-spacing: 0.12em;
  color: var(--muted);
  text-transform: uppercase;
}
.kpi .value {
  font-size: 32px;
  margin-top: 8px;
  line-height: 1.1;
}
.kpi .hint { color: var(--muted); margin-top: 6px; font-size: 13px; }

.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; }
.section-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 0 0 12px;
  font-size: 16px;
}
.chart { height: auto; min-height: 160px; }

.progress-wrap { display: flex; gap: 18px; align-items: center; }
.ring { width: 132px; height: 132px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.progress-meta b { font-size: 28px; }
.bar {
  height: 10px; background: #efe4d3; border-radius: 99px; overflow: hidden; margin-top: 8px;
}
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--amber), var(--safety)); }

.month-bars { display: grid; gap: 8px; margin-top: 16px; }
.month-row { display: grid; grid-template-columns: 64px 1fr 28px; gap: 8px; align-items: center; font-size: 13px; }
.month-row .bar { margin: 0; }
.pie-list { display: grid; gap: 8px; }
.pie-row { display: flex; justify-content: space-between; font-size: 13px; }

.timeline { display: grid; gap: 10px; }
.t-item {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
  cursor: pointer;
}
.t-item:last-child { border-bottom: 0; }
.t-date { color: var(--steel); }
.t-item p { margin: 4px 0 0; color: var(--ink-soft); font-size: 13px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 8px; border-radius: 999px;
  background: #f3e6cc; font-size: 12px; font-weight: 600;
}
.chip.rain { background: #d7e6ef; color: var(--rain); }
.chip.ok { background: #e3efd8; color: var(--ok); }

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.filters input, .filters select, .field input, .field textarea, .field select {
  border: 1px solid var(--line-strong);
  background: #fff;
  border-radius: 12px;
  padding: 10px 12px;
  min-width: 0;
}
.field { display: grid; gap: 6px; }
.field label { font-size: 13px; color: var(--muted); }
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.form-grid .span-2 { grid-column: span 2; }

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; font-size: 12px; color: var(--muted); font-weight: 600;
  padding: 8px 10px; border-bottom: 1px solid var(--line);
}
.table td { padding: 12px 10px; border-bottom: 1px solid #eee3d3; vertical-align: top; }
.table tr { cursor: pointer; }
.table tr:hover td { background: #fbf3e6; }

.cal-head, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.cal-head span { text-align: center; color: var(--muted); font-size: 12px; padding: 4px; }
.cal-cell {
  min-height: 92px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 8px; cursor: pointer;
}
.cal-cell.empty { background: transparent; border-color: transparent; cursor: default; }
.cal-cell.has { border-color: var(--amber); background: #fff7e8; }
.cal-cell.today { outline: 2px solid var(--steel); }
.cal-num { font-size: 13px; }
.cal-cell small { display: block; margin-top: 10px; color: var(--ink-soft); font-size: 12px; }

.drop {
  border: 2px dashed var(--line-strong);
  border-radius: 22px;
  padding: 36px 20px;
  text-align: center;
  background: repeating-linear-gradient(-45deg, #fffaf2, #fffaf2 12px, #f7efe2 12px, #f7efe2 24px);
}
.drop.over { border-color: var(--amber); background: #fff3d6; }
.drop h3 { margin: 0 0 6px; }
.file-list { margin-top: 14px; display: grid; gap: 8px; }
.file-item {
  display: flex; justify-content: space-between; gap: 10px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px;
}

.detail-hero {
  display: flex; justify-content: space-between; gap: 12px; align-items: flex-start;
  margin-bottom: 16px;
}
.blocks { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; }
.block h3 { margin: 0 0 8px; font-size: 13px; letter-spacing: 0.08em; color: var(--muted); }
.block p { margin: 0; white-space: pre-wrap; line-height: 1.7; }
.atts { display: grid; gap: 8px; }
.att {
  display: flex; justify-content: space-between; align-items: center;
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: #fff;
}
.preview img { max-width: 100%; border-radius: 12px; border: 1px solid var(--line); }

.milestone {
  display: grid;
  grid-template-columns: 16px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
}
.dot { width: 12px; height: 12px; border-radius: 50%; background: #d7cbb8; }
.dot.done { background: var(--ok); }
.dot.doing { background: var(--amber); }

.empty { text-align: center; padding: 48px 16px; color: var(--ink-soft); }
.empty h3 { margin-bottom: 8px; color: var(--ink); }

.toast {
  position: fixed; right: 24px; bottom: 24px;
  background: var(--ink); color: #fff; padding: 12px 16px;
  border-radius: 12px; max-width: 360px; z-index: 20;
}

.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }
.ai-search-box { display: flex; gap: 10px; margin-bottom: 10px; }
.ai-search-box input {
  flex: 1; border: 1px solid var(--line-strong); border-radius: 14px; padding: 12px 14px; background: #fff;
}
.ai-answer {
  background: #24364d; color: #f6efe4; border-radius: 14px;
  padding: 14px 16px; line-height: 1.7; margin: 12px 0; white-space: pre-wrap;
}
.ai-chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 4px; }

@media (max-width: 1100px) {
  .app { grid-template-columns: 1fr; }
  .sider { height: auto; position: relative; border-right: 0; border-bottom: 6px solid var(--safety); }
  .nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpis, .grid-2, .blocks, .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
}
