:root {
  --bg: #f4f5f2;
  --panel: #ffffff;
  --ink: #1d2321;
  --muted: #66706b;
  --line: #e1e4de;
  --brand: #0f5c4c;
  --brand-ink: #ffffff;
  --accent: #d97a17;
  --ok: #1f7a46;
  --warn: #a86500;
  --err: #b4322a;
  --info: #2a5d9f;
  --radius: 8px;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 14px/1.5 "Be Vietnam Pro", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink); background: var(--bg);
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: #12211d; color: #cfd8d3; padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow: auto; }
.side .brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; color: #fff; font-weight: 700; letter-spacing: .02em; }
.side .brand .mark { width: 28px; height: 28px; border-radius: 6px; background: var(--accent); display: grid; place-items: center; color: #12211d; font-weight: 800; }
.side nav a { display: block; padding: 8px 10px; border-radius: 6px; color: #cfd8d3; margin-bottom: 2px; }
.side nav a:hover { background: #1d322c; text-decoration: none; color: #fff; }
.side nav a.active { background: var(--brand); color: #fff; }
.side .me { margin-top: 24px; padding: 12px 10px; border-top: 1px solid #24382f; font-size: 13px; }
.side .me .role { color: #8fa39a; }
.side .me form { display: inline; }
.side .me button { background: none; border: 0; color: #f0b26a; padding: 0; cursor: pointer; font: inherit; }

main { padding: 24px 32px 48px; max-width: 1400px; }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 0 0 12px; }
.sub { color: var(--muted); margin: 0 0 20px; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1000px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } .shell { grid-template-columns: 1fr; } .side { position: static; height: auto; } }

.stat { padding: 14px 16px; }
.stat .k { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.stat .v { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 4px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; background: #fafbf8; }
tr:hover td { background: #fbfcfa; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tfoot td { font-weight: 700; background: #f7f8f5; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.empty { color: var(--muted); padding: 24px; text-align: center; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #eceee9; color: #3e4743; white-space: nowrap; }
.b-DRAFT { background: #eceee9; }
.b-SUBMITTED, .b-REVIEWING, .b-PENDING { background: #fff1dc; color: var(--warn); }
.b-RETURNED, .b-REJECTED, .b-LOCKED-user { background: #fbe4e2; color: var(--err); }
.b-APPROVED { background: #e0f2e7; color: var(--ok); }
.b-LOCKED, .b-CLOSED { background: #dde6f3; color: var(--info); }
.b-OPEN, .b-ACTIVE { background: #e0f2e7; color: var(--ok); }
.b-INACTIVE { background: #eceee9; color: var(--muted); }

form.inline { display: inline; }
.form { display: grid; gap: 10px 14px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); align-items: end; }
.form .wide { grid-column: 1 / -1; }
label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 600; }
input, select, textarea {
  font: inherit; color: var(--ink); padding: 7px 9px; border: 1px solid #cfd4cc; border-radius: 6px; background: #fff; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #9cc7bb; border-color: var(--brand); }
select[multiple] { min-height: 70px; }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 6px; border: 1px solid var(--brand);
  background: var(--brand); color: var(--brand-ink); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn.ghost { background: #fff; color: var(--brand); }
.btn.warn { background: var(--accent); border-color: var(--accent); }
.btn.danger { background: #fff; color: var(--err); border-color: #e3b0ab; }
.btn.sm { padding: 3px 9px; font-size: 12.5px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 12px; border: 1px solid; }
.flash.success { background: #e8f5ed; border-color: #b9dfc7; color: var(--ok); }
.flash.error { background: #fbeceb; border-color: #efc1bd; color: var(--err); }
.flash.info { background: #eaf1fa; border-color: #c3d4ec; color: var(--info); }

.pager { display: flex; gap: 6px; align-items: center; margin-top: 12px; }
.steps { display: flex; gap: 0; margin: 8px 0 16px; }
.steps span { flex: 1; text-align: center; padding: 8px 4px; background: #eceee9; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.steps span:first-child { border-radius: 6px 0 0 6px; }
.steps span:last-child { border-radius: 0 6px 6px 0; }
.steps span.done { background: #cfe5dc; color: var(--brand); }
.steps span.now { background: var(--brand); color: #fff; }

.bars { display: flex; align-items: flex-end; gap: 3px; height: 120px; padding-top: 8px; }
.bars div { flex: 1; background: var(--brand); border-radius: 3px 3px 0 0; min-height: 2px; position: relative; }
.bars div:hover { background: var(--accent); }
.bars-x { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; margin-top: 4px; }

.login { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, #12211d 0%, #0f5c4c 100%); }
.login .card { width: 360px; padding: 28px; }
.login h1 { margin-bottom: 2px; }
.warnbox { border-left: 4px solid var(--accent); background: #fff8ee; padding: 10px 14px; border-radius: 0 6px 6px 0; margin-bottom: 12px; }
details summary { cursor: pointer; font-weight: 600; }
