:root {
  --ink: #18313d;
  --muted: #697b84;
  --navy: #123a4d;
  --navy-2: #1d5267;
  --mint: #dbeee7;
  --mint-strong: #2f866c;
  --cream: #f6f3ed;
  --paper: #fffdf9;
  --line: #dfe6e6;
  --amber: #c77923;
  --amber-bg: #fff0da;
  --red: #b84646;
  --red-bg: #fde8e6;
  --green: #26735e;
  --shadow: 0 12px 30px rgba(24, 49, 61, .08);
  --radius: 18px;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--cream); font-family: Inter, "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif; }
button, select, input, textarea { font: inherit; }
button { cursor: pointer; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 244px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 28px 18px; color: white; background: linear-gradient(165deg, #0e3447 0%, #1b4d60 72%, #245e68 100%); display: flex; flex-direction: column; z-index: 20; }
.brand { display: flex; gap: 12px; align-items: center; padding: 0 10px 30px; }
.brand-mark { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; color: var(--navy); background: #e7d9b7; font: 800 21px Georgia, serif; }
.brand strong, .brand span { display: block; }
.brand strong { letter-spacing: .08em; font-size: 13px; }
.brand span { color: #c8dce3; margin-top: 3px; font-size: 12px; }
nav { display: grid; gap: 7px; }
.nav-button { border: 0; width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 13px; border-radius: 12px; color: #d8e7ec; background: transparent; text-align: left; }
.nav-button:hover, .nav-button.active { color: white; background: rgba(255,255,255,.12); }
.nav-button.active { box-shadow: inset 3px 0 #efd89f; }
.nav-icon { width: 24px; text-align: center; }
.nav-lock { margin-left: auto; opacity: .65; font-size: 11px; }
.sidebar-note { margin-top: auto; border-top: 1px solid rgba(255,255,255,.13); padding: 20px 10px 2px; display: flex; gap: 10px; align-items: center; }
.sidebar-note .dot { width: 8px; height: 8px; border-radius: 50%; background: #7fdbb5; box-shadow: 0 0 0 5px rgba(127,219,181,.12); }
.sidebar-note strong, .sidebar-note small { display: block; }
.sidebar-note strong { font-size: 12px; }
.sidebar-note small { color: #bbd2db; margin-top: 3px; font-size: 11px; }
main { min-width: 0; }
.topbar { min-height: 94px; padding: 20px 34px; border-bottom: 1px solid var(--line); background: rgba(255,253,249,.84); backdrop-filter: blur(14px); display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 10; }
.eyebrow { margin: 0 0 4px; color: var(--mint-strong); font-weight: 800; font-size: 10px; letter-spacing: .16em; }
h1 { margin: 0; font-size: 24px; letter-spacing: -.02em; }
.top-actions { display: flex; align-items: center; gap: 12px; }
.role-switch { display: grid; gap: 4px; }
.role-switch span { color: var(--muted); font-size: 10px; font-weight: 700; }
select, input, textarea { color: var(--ink); border: 1px solid #cfdadb; background: white; border-radius: 10px; padding: 9px 11px; outline: none; }
select:focus, input:focus, textarea:focus { border-color: var(--mint-strong); box-shadow: 0 0 0 3px rgba(47,134,108,.11); }
.avatar { border: 0; width: 40px; height: 40px; border-radius: 50%; color: white; background: var(--navy); font-weight: 800; }
.content { padding: 28px 34px 60px; max-width: 1500px; margin: 0 auto; }
.page-head { display: flex; gap: 18px; justify-content: space-between; align-items: flex-end; margin-bottom: 22px; }
.page-head h2 { margin: 0 0 6px; font-size: 22px; }
.page-head p { margin: 0; color: var(--muted); font-size: 13px; }
.button-row { display: flex; gap: 9px; flex-wrap: wrap; }
.btn { border: 1px solid #cdd8d8; border-radius: 11px; padding: 10px 14px; color: var(--ink); background: white; font-weight: 750; font-size: 13px; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 5px 14px rgba(24,49,61,.08); }
.btn.primary { border-color: var(--navy); color: white; background: var(--navy); }
.btn.success { border-color: var(--green); color: white; background: var(--green); }
.btn.warn { border-color: #e2b779; color: #855219; background: var(--amber-bg); }
.btn.danger { border-color: #e5b1ad; color: var(--red); background: var(--red-bg); }
.btn.small { padding: 7px 10px; font-size: 11px; }
.btn[disabled] { cursor: not-allowed; opacity: .5; transform: none; box-shadow: none; }
.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; margin-bottom: 20px; }
.metric, .panel { border: 1px solid rgba(204,217,217,.85); background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); }
.metric { padding: 19px; position: relative; overflow: hidden; }
.metric::after { content: ""; width: 72px; height: 72px; border-radius: 50%; background: var(--mint); position: absolute; right: -28px; top: -28px; opacity: .7; }
.metric .label { color: var(--muted); font-size: 12px; font-weight: 700; }
.metric .value { display: block; margin: 9px 0 5px; font-size: 25px; line-height: 1; font-weight: 850; letter-spacing: -.03em; }
.metric .hint { color: var(--muted); font-size: 11px; }
.metric.alert .value { color: var(--red); }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(300px, .75fr); gap: 18px; }
.panel { padding: 20px; margin-bottom: 18px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.panel-head h3 { margin: 0; font-size: 16px; }
.panel-head p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.table-wrap { overflow-x: auto; margin: 0 -20px -20px; border-radius: 0 0 var(--radius) var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { padding: 11px 14px; color: #647881; background: #f4f6f4; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); white-space: nowrap; text-align: left; font-size: 10px; letter-spacing: .03em; }
td { padding: 13px 14px; border-bottom: 1px solid #edf0ef; white-space: nowrap; }
tbody tr:hover { background: #fcfbf7; }
.money { font-variant-numeric: tabular-nums; text-align: right; }
.sub { display: block; color: var(--muted); margin-top: 3px; font-size: 10px; }
.badge { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 5px 8px; color: #52636b; background: #edf1f1; font-weight: 800; font-size: 10px; }
.badge.green { color: var(--green); background: #e1f1ea; }
.badge.amber { color: #8d5a1e; background: var(--amber-bg); }
.badge.red { color: var(--red); background: var(--red-bg); }
.badge.blue { color: #1d617c; background: #e0eff5; }
.progress { height: 7px; border-radius: 999px; overflow: hidden; background: #e8eeed; }
.progress > i { display: block; height: 100%; border-radius: inherit; background: var(--mint-strong); }
.progress.amber > i { background: var(--amber); }
.progress.red > i { background: var(--red); }
.steps { display: grid; gap: 12px; }
.step { display: grid; grid-template-columns: 32px 1fr auto; gap: 10px; align-items: center; }
.step-index { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; color: var(--navy); background: var(--mint); font-weight: 850; font-size: 12px; }
.step strong, .step small { display: block; }
.step strong { font-size: 12px; }
.step small { color: var(--muted); margin-top: 2px; font-size: 10px; }
.drop-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.dropzone { border: 1px dashed #afc3c5; border-radius: 13px; padding: 15px; background: #fbfcfa; }
.dropzone strong, .dropzone small { display: block; }
.dropzone strong { font-size: 12px; }
.dropzone small { color: var(--muted); margin: 5px 0 10px; font-size: 10px; }
.dropzone input { max-width: 100%; padding: 7px; font-size: 10px; }
.filters { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; }
.filters input { min-width: 220px; }
.empty { text-align: center; padding: 45px 20px; color: var(--muted); }
.empty b { display: block; color: var(--ink); margin-bottom: 5px; }
.kpi-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; }
.kpi-card { border: 1px solid var(--line); border-radius: 14px; padding: 16px; background: #fff; }
.kpi-card header { display: flex; justify-content: space-between; gap: 10px; align-items: start; }
.kpi-card h4 { margin: 0; font-size: 13px; }
.kpi-card .big { font-size: 22px; font-weight: 850; margin: 13px 0 8px; }
.kpi-card p { color: var(--muted); margin: 8px 0 0; font-size: 10px; line-height: 1.5; }
.notice { display: flex; gap: 10px; padding: 13px 15px; border: 1px solid #edd6ac; border-radius: 12px; background: #fff8e9; color: #74511e; font-size: 11px; line-height: 1.5; margin-bottom: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 13px; }
.form-field { display: grid; gap: 6px; }
.form-field label { color: var(--muted); font-size: 11px; font-weight: 700; }
.form-field.full { grid-column: 1 / -1; }
.approval-flow { display: flex; gap: 8px; align-items: center; }
.approval-flow .line { width: 28px; height: 1px; background: #cdd9d9; }
.privacy-mask { filter: blur(6px); user-select: none; }
.locked-panel { min-height: 340px; display: grid; place-items: center; text-align: center; }
.locked-panel .lock-icon { margin: 0 auto 12px; width: 54px; height: 54px; display: grid; place-items: center; border-radius: 18px; background: var(--mint); font-size: 24px; }
.locked-panel h3 { margin: 0 0 6px; }
.locked-panel p { color: var(--muted); max-width: 440px; font-size: 12px; line-height: 1.6; }
.toast { position: fixed; right: 24px; bottom: 24px; max-width: 360px; padding: 12px 16px; color: white; background: var(--navy); border-radius: 12px; box-shadow: 0 14px 34px rgba(14,52,71,.25); opacity: 0; transform: translateY(10px); pointer-events: none; transition: .22s ease; z-index: 50; font-size: 12px; }
.toast.show { opacity: 1; transform: translateY(0); }
.icon-button { border: 0; background: transparent; color: var(--ink); font-size: 20px; }
.mobile-only { display: none; }

@media (max-width: 1050px) {
  .cards { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 760px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: -260px; width: 244px; transition: left .2s ease; }
  .sidebar.open { left: 0; box-shadow: 20px 0 50px rgba(0,0,0,.18); }
  .mobile-only { display: inline-grid; }
  .topbar { padding: 14px 17px; min-height: 78px; gap: 10px; }
  .topbar h1 { font-size: 19px; }
  .topbar .eyebrow, .role-switch span { display: none; }
  .role-switch select { max-width: 138px; font-size: 11px; }
  .avatar { display: none; }
  .content { padding: 20px 15px 50px; }
  .cards, .drop-grid, .kpi-grid, .form-grid { grid-template-columns: 1fr; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .panel { padding: 16px; }
  .table-wrap { margin: 0 -16px -16px; }
  td, th { padding: 11px 12px; }
}
