:root {
  --bg: #eef1f4;
  --panel: #ffffff;
  --ink: #1a2332;
  --muted: #6b7785;
  --line: #dce3ea;
  --brand: #0f6e56;
  --brand-2: #14856a;
  --brand-soft: #e7f5f0;
  --accent: #c45c26;
  --accent-soft: #fdf2ea;
  --warn: #b45309;
  --danger: #b42318;
  --info: #175cd3;
  --ok: #027a48;
  --shadow: 0 10px 30px rgba(26, 35, 50, 0.08);
  --radius: 14px;
  --sidebar: 220px;
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: "Cascadia Mono", "Consolas", monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, #d9ebe4 0%, transparent 55%),
    radial-gradient(900px 420px at 100% 0%, #f3e6d8 0%, transparent 50%),
    var(--bg);
}

button, input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar) 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px 14px;
  background: linear-gradient(180deg, #12352c 0%, #0d2420 100%);
  color: #e8f2ee;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 8px 10px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand-mark {
  width: 40px; height: 40px; border-radius: 12px;
  background: linear-gradient(145deg, #2bb673, #0f6e56);
  display: grid; place-items: center;
  font-weight: 800; letter-spacing: .5px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.2);
}
.brand h1 { margin: 0; font-size: 15px; font-weight: 700; }
.brand p { margin: 2px 0 0; font-size: 11px; opacity: .65; }

.nav { display: flex; flex-direction: column; gap: 4px; overflow: auto; flex: 1; }
.nav-group {
  margin: 10px 10px 4px;
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  opacity: .45;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  border: 0; background: transparent; color: inherit;
  text-align: left; width: 100%;
  padding: 10px 12px; border-radius: 10px;
  opacity: .82; transition: .15s ease;
}
.nav-item:hover { background: rgba(255,255,255,.06); opacity: 1; }
.nav-item.active {
  background: rgba(43, 182, 115, .18);
  box-shadow: inset 0 0 0 1px rgba(43, 182, 115, .35);
  opacity: 1;
}
.nav-item .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: currentColor; opacity: .5;
}
.nav-item.active .dot { background: #5ee9b5; opacity: 1; }

.role-box {
  margin-top: auto;
  padding: 12px;
  border-radius: 12px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.08);
}
.role-box label { display: block; font-size: 11px; opacity: .6; margin-bottom: 6px; }
.role-box select {
  width: 100%;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.15);
  background: #0b1d19;
  color: #fff;
  padding: 8px 10px;
}
.role-box .hint { margin-top: 8px; font-size: 11px; line-height: 1.4; opacity: .7; }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 16px 22px;
  background: rgba(255,255,255,.72);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.topbar h2 { margin: 0; font-size: 18px; }
.topbar .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.top-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.content { padding: 14px 16px 40px; max-width: none; width: 100%; }
.content.wide { padding: 12px 12px 40px; }

.page-detail { display: grid; gap: 12px; }
.back-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.quote-sheet {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: auto;
  box-shadow: var(--shadow);
}
.quote-sheet .sheet-title {
  text-align: center;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: .08em;
  padding: 18px 12px 8px;
  border-bottom: 2px solid #12352c;
}
.quote-sheet .sheet-sub {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding-bottom: 12px;
}
.quote-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 24px;
  padding: 12px 16px;
  font-size: 13px;
  border-bottom: 1px solid var(--line);
  background: #fafbfc;
}
.quote-meta b { color: var(--muted); font-weight: 600; margin-right: 6px; }
.quote-sheet table.data th,
.quote-sheet table.data td {
  font-size: 12px;
  padding: 8px 8px;
  white-space: nowrap;
}
.quote-sheet .sum-row td { background: #f5f8fa; font-weight: 700; }

.filter-bar {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: end;
  padding: 12px 14px; background: #fff; border: 1px solid var(--line);
  border-radius: 12px; margin-bottom: 12px;
}
.filter-bar .field { min-width: 140px; flex: 1; }
.filter-bar label { font-size: 11px; }

.tabs {
  display: flex; gap: 4px; border-bottom: 1px solid var(--line);
  padding: 0 8px; background: #fff; border-radius: 12px 12px 0 0;
}
.tab-btn {
  border: 0; background: transparent; padding: 12px 14px;
  color: var(--muted); font-weight: 650; border-bottom: 2px solid transparent;
}
.tab-btn.on { color: var(--brand); border-bottom-color: var(--brand); }
.tab-panel { background: #fff; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 12px 12px; padding: 14px; }

.file-zone {
  border: 1px dashed #b8c2cc; border-radius: 12px; padding: 14px;
  background: #fafbfc; display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
}
.file-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 10px; background: #fff;
  border: 1px solid var(--line); font-size: 12px;
}
.file-chip a { color: var(--info); font-weight: 650; }

.log-split { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 1200px) { .log-split { grid-template-columns: 1fr; } }

.drawer { width: min(720px, 96vw); }

.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 8px 14px;
  background: var(--brand);
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  transition: .15s ease;
}
.btn:hover { filter: brightness(1.05); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost {
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
}
.btn.warn { background: var(--accent); }
.btn.danger { background: var(--danger); }
.btn.info { background: var(--info); }
.btn.sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }

.grid { display: grid; gap: 14px; }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1200px) {
  .grid.cols-3 { grid-template-columns: 1fr; }
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-hd {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.card-hd h3 { margin: 0; font-size: 15px; }
.card-bd { padding: 16px; }

.stat {
  padding: 16px;
  background:
    linear-gradient(180deg, #fff, #f8fafb);
}
.stat .label { color: var(--muted); font-size: 12px; }
.stat .value { font-size: 26px; font-weight: 750; margin-top: 6px; letter-spacing: -.02em; }
.stat .meta { margin-top: 8px; font-size: 12px; color: var(--muted); }

.table-wrap { overflow: auto; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.data th, table.data td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}
table.data th {
  background: #f5f8fa;
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
}
table.data tr:hover td { background: #fafcfb; }
table.data tr.clickable { cursor: pointer; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 650;
  border: 1px solid transparent;
}
.badge::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor;
}
.st-0 { color: #475467; background: #f2f4f7; border-color: #e4e7ec; }
.st-1 { color: #b54708; background: #fffaeb; border-color: #fedf89; }
.st-2 { color: #027a48; background: #ecfdf3; border-color: #abefc6; }
.st-3 { color: #175cd3; background: #eff8ff; border-color: #b2ddff; }
.st-wait { color: #b42318; background: #fef3f2; border-color: #fecdca; }
.st-ok { color: #027a48; background: #ecfdf3; border-color: #abefc6; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 6px 10px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand);
  font-size: 12px; font-weight: 600;
}
.chip.muted { background: #f2f4f7; color: #475467; }

.timeline { display: grid; gap: 12px; }
.tl-item {
  display: grid; grid-template-columns: 18px 1fr; gap: 10px;
}
.tl-dot {
  width: 12px; height: 12px; border-radius: 50%;
  margin-top: 4px; background: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-soft);
}
.tl-item.done .tl-dot { background: var(--ok); }
.tl-item.todo .tl-dot { background: #98a2b3; box-shadow: 0 0 0 4px #f2f4f7; }
.tl-title { font-weight: 650; font-size: 13px; }
.tl-meta { color: var(--muted); font-size: 12px; margin-top: 2px; }

.drawer-mask {
  position: fixed; inset: 0; background: rgba(16,24,40,.42);
  display: none; z-index: 50;
}
.drawer-mask.show { display: block; }
.drawer {
  position: fixed; top: 0; right: 0; height: 100%; width: min(560px, 96vw);
  background: #fff; box-shadow: -20px 0 50px rgba(0,0,0,.18);
  transform: translateX(100%); transition: transform .22s ease;
  z-index: 60; display: flex; flex-direction: column;
}
.drawer.show { transform: translateX(0); }
.drawer-hd {
  padding: 16px 18px; border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
}
.drawer-bd { padding: 16px 18px; overflow: auto; flex: 1; }
.drawer-ft {
  padding: 12px 18px; border-top: 1px solid var(--line);
  display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap;
}

.form-grid { display: grid; gap: 12px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 11px;
  background: #fff;
}
.field textarea { min-height: 90px; resize: vertical; }

.toast-wrap {
  position: fixed; right: 18px; bottom: 18px; z-index: 80;
  display: grid; gap: 8px;
}
.toast {
  min-width: 240px; max-width: 360px;
  background: #10231e; color: #fff;
  padding: 12px 14px; border-radius: 12px;
  box-shadow: var(--shadow);
  animation: slideIn .2s ease;
}
.toast.ok { background: #027a48; }
.toast.warn { background: #b54708; }
@keyframes slideIn {
  from { transform: translateY(10px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }
.flex { display: flex; }
.between { justify-content: space-between; }
.center { align-items: center; }
.gap-8 { gap: 8px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }

.progress-track {
  display: flex; gap: 0; margin: 8px 0 0;
}
.progress-step {
  flex: 1; text-align: center; position: relative; padding-top: 18px;
  font-size: 12px; color: var(--muted);
}
.progress-step::before {
  content: ""; position: absolute; top: 6px; left: 0; right: 0; height: 3px;
  background: #e4e7ec;
}
.progress-step:first-child::before { left: 50%; }
.progress-step:last-child::before { right: 50%; }
.progress-step .node {
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 14px; height: 14px; border-radius: 50%;
  background: #fff; border: 2px solid #d0d5dd; z-index: 1;
}
.progress-step.on { color: var(--brand); font-weight: 700; }
.progress-step.on .node,
.progress-step.done .node { border-color: var(--brand); background: var(--brand); }
.progress-step.done::before,
.progress-step.on::before { background: #9fe0c6; }

.progress-xl {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px 18px 18px;
  box-shadow: var(--shadow);
  width: 100%;
}
.progress-xl .progress-track { margin: 0; }
.progress-xl .progress-step {
  padding-top: 28px;
  font-size: 15px;
  font-weight: 700;
}
.progress-xl .progress-step::before {
  top: 10px;
  height: 5px;
}
.progress-xl .progress-step .node {
  width: 22px;
  height: 22px;
  border-width: 3px;
  top: 2px;
}
.progress-xl .progress-step .date {
  display: block;
  margin-top: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}
.progress-xl .progress-step.on .date,
.progress-xl .progress-step.done .date { color: var(--brand); font-weight: 650; }
.progress-xl .progress-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.alert {
  padding: 10px 12px; border-radius: 10px;
  background: #fffaeb; border: 1px solid #fedf89; color: #93370d;
  font-size: 13px;
}
.alert.danger {
  background: #fef3f2; border-color: #fecdca; color: #912018;
}
.alert.ok {
  background: #ecfdf3; border-color: #abefc6; color: #054f31;
}

.split {
  display: grid;
  grid-template-columns: 1.4fr .9fr;
  gap: 14px;
}

.mode-switch {
  display: inline-flex; background: #f2f4f7; border-radius: 999px; padding: 3px;
}
.mode-switch a, .mode-switch button {
  border: 0; background: transparent; padding: 6px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 650; color: var(--muted);
}
.mode-switch .on {
  background: #fff; color: var(--ink);
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}

/* Mini program phone frame */
.mp-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(160deg, #0f3d32, #1a2332 55%, #2a1f16);
}
.phone {
  width: 390px;
  height: 780px;
  border-radius: 36px;
  background: #0b1220;
  padding: 12px;
  box-shadow: 0 30px 80px rgba(0,0,0,.45);
  position: relative;
}
.phone-screen {
  height: 100%;
  border-radius: 28px;
  overflow: hidden;
  background: #f4f6f8;
  display: flex;
  flex-direction: column;
}
.mp-status {
  height: 44px; padding: 10px 18px 0;
  display: flex; justify-content: space-between;
  font-size: 12px; font-weight: 700; background: #fff;
}
.mp-nav {
  background: #fff; padding: 8px 16px 12px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
}
.mp-nav h3 { margin: 0; font-size: 16px; }
.mp-body { flex: 1; overflow: auto; padding: 12px; }
.mp-tabbar {
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: #fff; border-top: 1px solid var(--line);
  padding: 8px 4px calc(8px + env(safe-area-inset-bottom, 0));
}
.mp-tab {
  border: 0; background: transparent; color: var(--muted);
  font-size: 11px; display: grid; gap: 4px; place-items: center;
  padding: 4px;
}
.mp-tab.on { color: var(--brand); font-weight: 700; }
.mp-card {
  background: #fff; border-radius: 16px; padding: 14px;
  border: 1px solid var(--line); margin-bottom: 10px;
}
.mp-card h4 { margin: 0 0 6px; font-size: 15px; }
.clock-slots { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.clock-slot {
  border: 1px dashed #cdd5df; border-radius: 12px; padding: 12px 8px;
  text-align: center; background: #fafbfc;
}
.clock-slot.done {
  border-style: solid; border-color: #abefc6; background: #ecfdf3;
}
.photo-box {
  height: 140px; border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(15,110,86,.25), rgba(196,92,38,.25)),
    repeating-linear-gradient(45deg, #dce3ea 0 8px, #eef1f4 8px 16px);
  display: grid; place-items: center; color: #344054; font-weight: 650;
  margin: 10px 0;
}

@media (max-width: 1100px) {
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; }
}
