:root {
  color-scheme: light;
  --brand: #f36b21;
  --brand-dark: #d9500d;
  --ink: #20242b;
  --muted: #737a86;
  --line: #e7e9ed;
  --surface: #ffffff;
  --canvas: #f5f6f8;
  --success: #16845b;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--canvas); }
button, input, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.eyebrow { margin: 0 0 6px; color: var(--brand); font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: 28px; }
h2 { margin-bottom: 4px; font-size: 18px; }

.brand-mark { display: grid; width: 52px; height: 52px; margin-bottom: 24px; place-items: center; border-radius: 15px; color: white; background: linear-gradient(135deg, #ff8a3d, var(--brand)); font-size: 25px; font-weight: 800; box-shadow: 0 12px 28px rgba(243,107,33,.25); }
.brand-mark.small { width: 36px; height: 36px; margin: 0; border-radius: 11px; font-size: 17px; }
.login-shell { display: grid; min-height: 100vh; place-items: center; padding: 24px; background: radial-gradient(circle at top left, #fff4eb, transparent 40%), var(--canvas); }
.login-card { width: min(420px, 100%); padding: 42px; border: 1px solid rgba(255,255,255,.8); border-radius: 24px; background: rgba(255,255,255,.94); box-shadow: 0 24px 70px rgba(32,36,43,.10); }
.stack-form { display: grid; gap: 18px; margin-top: 28px; }
label { display: grid; gap: 8px; color: #4b515b; font-size: 14px; font-weight: 650; }
input, select { width: 100%; height: 44px; border: 1px solid var(--line); border-radius: 10px; padding: 0 13px; color: var(--ink); background: white; outline: none; }
input:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(243,107,33,.12); }
small { color: var(--muted); font-weight: 400; }
.primary, .secondary { min-height: 42px; border-radius: 10px; padding: 0 18px; font-weight: 700; }
.primary { border: 0; color: white; background: var(--brand); box-shadow: 0 8px 20px rgba(243,107,33,.18); }
.primary:hover { background: var(--brand-dark); }
.secondary { border: 1px solid var(--line); color: var(--ink); background: white; }

.app-shell { display: grid; min-height: 100vh; grid-template-columns: 220px 1fr; }
.sidebar { position: sticky; top: 0; display: flex; height: 100vh; flex-direction: column; padding: 24px 16px; border-right: 1px solid var(--line); background: var(--surface); }
.brand-row { display: flex; align-items: center; gap: 12px; padding: 0 8px 30px; }
.sidebar nav { display: grid; gap: 6px; }
.nav-item { width: 100%; border: 0; border-radius: 10px; padding: 12px 14px; color: #59606b; background: transparent; text-align: left; }
.nav-item.active { color: var(--brand-dark); background: #fff2e9; font-weight: 700; }
.nav-item.logout { margin-top: auto; }
.workspace { min-width: 0; padding: 34px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.metric-card, .panel { border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: 0 6px 22px rgba(32,36,43,.04); }
.metric-card { padding: 20px; }
.metric-card span { color: var(--muted); font-size: 13px; }
.metric-card strong { display: block; margin-top: 10px; font-size: 30px; }
.panel { padding: 22px; }
.panel + .panel { margin-top: 20px; }
.panel-head, .detail-head, .dialog-head, .dialog-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.search { max-width: 300px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 14px 12px; border-bottom: 1px solid var(--line); text-align: left; font-size: 14px; }
th { color: var(--muted); font-size: 12px; font-weight: 700; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: #fffaf6; }
.status { display: inline-flex; border-radius: 999px; padding: 4px 9px; color: var(--success); background: #eaf8f2; font-size: 12px; font-weight: 700; }
.empty { padding: 32px 0 12px; text-align: center; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 20px; }
.subpanel { border: 1px solid var(--line); border-radius: 13px; padding: 16px; }
.card-line, .ledger-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.card-line:first-of-type, .ledger-line:first-of-type { border-top: 0; }
.card-line p { margin: 4px 0 0; }
.text-button { border: 0; color: var(--brand-dark); background: transparent; font-weight: 700; }

dialog { width: min(500px, calc(100% - 32px)); border: 0; border-radius: 18px; padding: 26px; box-shadow: 0 28px 90px rgba(0,0,0,.22); }
dialog::backdrop { background: rgba(22,25,31,.46); backdrop-filter: blur(2px); }
.dialog-head h2 { margin: 0; }
.dialog-actions { justify-content: flex-end; }
.icon-button { border: 0; color: var(--muted); background: transparent; font-size: 27px; }
.toast { position: fixed; right: 24px; bottom: 24px; max-width: 360px; border-radius: 12px; padding: 13px 17px; color: white; background: #242830; box-shadow: 0 12px 30px rgba(0,0,0,.18); }

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; }
  .sidebar nav, .nav-item.logout { display: none; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .workspace { padding: 20px 14px; }
  .topbar, .panel-head { align-items: stretch; flex-direction: column; }
  .metrics { grid-template-columns: 1fr; }
  .search { max-width: none; }
  .login-card { padding: 28px; }
}
