:root {
  --bg: #f3f5f2;
  --surface: #ffffff;
  --surface-soft: #f2f4f0;
  --ink: #1f2420;
  --muted: #6a7169;
  --line: #e2e6df;
  --line-strong: #cdd3ca;
  --green: #166b47;
  --green-dark: #0d5136;
  --green-soft: #e6f3ec;
  --amber: #9b6510;
  --amber-soft: #fff3d8;
  --red: #b03a32;
  --red-soft: #fdecea;
  --blue: #245f88;
  --blue-soft: #e8f1f7;
  --violet: #5b4a8a;
  --violet-soft: #efecf7;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(24, 31, 25, 0.05), 0 2px 8px rgba(24, 31, 25, 0.04);
  --shadow-md: 0 4px 16px rgba(24, 31, 25, 0.08);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  letter-spacing: 0;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html { scroll-behavior: smooth; }
body { background: var(--bg); }
a { color: var(--green); text-decoration: none; }
a:hover { color: var(--green-dark); }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button, .button { min-height: 40px; }
button { transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 236px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 24px 16px; background: linear-gradient(180deg, #1b2620 0%, #16201a 100%); color: #f4f7f3; }
.brand, .login-brand { display: flex; align-items: center; gap: 12px; }
.brand { padding: 0 8px 26px; border-bottom: 1px solid rgba(255,255,255,.12); }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 9px; background: linear-gradient(135deg, #dce8df, #b9d6c6); color: #163b2c; font-size: 13px; font-weight: 800; box-shadow: 0 2px 6px rgba(0,0,0,.25); }
.brand strong, .login-brand strong { display: block; font-size: 16px; }
.brand small, .login-brand small { display: block; max-width: 142px; margin-top: 3px; color: #9faea4; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.business-switcher { display: grid; gap: 6px; padding: 16px 8px 0; }
.business-switcher label { color: #9faea4; font-size: 11px; }
.business-switcher select { min-height: 38px; border-color: rgba(255,255,255,.18); color: #f4f7f3; background: #263329; font-size: 12px; border-radius: var(--radius-sm); }
.sidebar nav { display: grid; gap: 5px; margin-top: 22px; }
.sidebar nav a { display: flex; align-items: center; gap: 11px; min-height: 44px; padding: 0 12px; border-radius: 8px; color: #c4cfc7; font-size: 14px; transition: background .15s ease, color .15s ease; }
.sidebar nav a:hover, .sidebar nav a.active { color: #fff; background: rgba(255,255,255,.10); }
.sidebar nav a.active { box-shadow: inset 3px 0 0 #6fc89d; font-weight: 650; }
.sidebar nav svg { width: 18px; height: 18px; }
.sidebar-user { margin-top: auto; padding: 16px 8px 0; display: flex; align-items: center; justify-content: space-between; border-top: 1px solid rgba(255,255,255,.12); color: #dce3de; font-size: 13px; }
.link-button { padding: 0; border: 0; background: none; color: #9faea4; cursor: pointer; min-height: auto; }
.link-button:hover { color: #fff; }

.main-content { min-width: 0; padding: 32px clamp(22px, 4vw, 54px) 64px; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.page-header h1 { margin: 2px 0 8px; font-size: 28px; line-height: 1.2; font-weight: 720; letter-spacing: .01em; }
.page-header p { margin: 0; color: var(--muted); font-size: 13.5px; }
.eyebrow { color: var(--green) !important; font-size: 12px !important; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.page-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }

.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 18px; border: 1px solid transparent; border-radius: 8px; cursor: pointer; font-weight: 650; font-size: 14px; white-space: nowrap; transition: background .15s ease, border-color .15s ease, box-shadow .15s ease, transform .1s ease; }
.button:active { transform: translateY(1px); }
.button.primary { background: var(--green); color: white; box-shadow: 0 2px 6px rgba(22, 107, 71, .28); }
.button.primary:hover { background: var(--green-dark); color: white; box-shadow: 0 3px 10px rgba(22, 107, 71, .34); }
.button.secondary { background: var(--surface); border-color: var(--line-strong); color: var(--ink); }
.button.secondary:hover { border-color: #9fae9d; color: var(--ink); background: var(--surface-soft); }
.button.danger { background: var(--red); color: white; }
.button.danger:hover { background: #932f29; }
.button:disabled { opacity: .45; cursor: not-allowed; }
.button.full { width: 100%; }

.messages { display: grid; gap: 8px; margin-bottom: 18px; }
.message { padding: 12px 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font-size: 14px; box-shadow: var(--shadow); }
.message.success { border-color: #b8dfc9; color: var(--green-dark); background: var(--green-soft); }
.message.error { border-color: #efc2be; color: var(--red); background: var(--red-soft); }

.metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-bottom: 28px; }
.metrics article { min-width: 0; padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); transition: box-shadow .15s ease, transform .15s ease; }
.metrics article:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.metrics span, .metrics small { display: block; color: var(--muted); }
.metrics span { font-size: 13px; font-weight: 650; }
.metrics strong { display: block; margin: 8px 0 6px; font-size: 26px; font-variant-numeric: tabular-nums; }
.metrics small { font-size: 12px; white-space: normal; }
.metrics .metric-warning { border-top: 3px solid #d69c2e; padding-top: 15px; }
.metrics .metric-highlight { border-top: 3px solid var(--green); padding-top: 15px; }
.metrics .metric-highlight strong { color: var(--green-dark); }
.account-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 0; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr); gap: 22px; }
.section-block, .form-section { margin-bottom: 24px; padding: 22px 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.section-heading { min-height: 48px; display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 15px; }
.section-heading h2 { margin: 0 0 5px; font-size: 17px; }
.section-heading p { margin: 0; color: var(--muted); font-size: 13px; }
.table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); box-shadow: var(--shadow); }
.section-block > .table-wrap, .month-section > .table-wrap { box-shadow: none; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { padding: 11px 14px; background: var(--surface-soft); color: #596159; text-align: left; font-weight: 700; white-space: nowrap; font-size: 12.5px; letter-spacing: .02em; }
.table-wrap thead th { position: sticky; top: 0; z-index: 1; }
td { padding: 12px 14px; border-top: 1px solid var(--line); vertical-align: middle; }
tbody tr:nth-child(even) { background: #fafbf8; }
tbody tr:hover { background: #f2f7f3; }
tbody tr:target { background: var(--green-soft); animation: row-flash 1.6s ease; }
@keyframes row-flash { 0% { background: #cfe8da; } 100% { background: var(--green-soft); } }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
td input, td select { min-width: 112px; }
.cell-sub { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.unit-alert { display: block; margin-top: 5px; color: var(--amber); font-size: 11px; font-weight: 750; }
.over-quota { border-color: var(--amber) !important; background: var(--amber-soft); }
.over-quota-hint { display: block; margin-top: 4px; color: var(--amber); font-size: 11px; font-weight: 700; }
.over-quota-hint[hidden] { display: none; }
.mono { font-family: Consolas, "Microsoft YaHei", monospace; }
.muted { color: var(--muted); }
.amount { font-variant-numeric: tabular-nums; font-weight: 700; }
.empty { padding: 30px; color: var(--muted); text-align: center; }
.negative { color: var(--red); }

.status { display: inline-flex; align-items: center; min-height: 24px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.status + .status { margin-left: 4px; }
.status.ready, .status.parsed, .status.generated { color: var(--green-dark); background: var(--green-soft); }
.status.incomplete, .status.review { color: var(--amber); background: var(--amber-soft); }
.status.error, .status.void { color: var(--red); background: var(--red-soft); }
.status.missing { color: var(--red); background: var(--red-soft); border: 1px solid #f0c5c1; }
.status.archived { color: var(--muted); background: var(--surface-soft); border: 1px solid var(--line-strong); }
.status.sealed { color: var(--blue); background: var(--blue-soft); }
.status.dual_signed { color: var(--violet); background: var(--violet-soft); }
.status.other { color: var(--muted); background: var(--surface-soft); }
.status.mini { min-height: 18px; padding: 1px 6px; font-size: 10.5px; }

.activity-list { display: grid; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); overflow: hidden; }
.activity-list a { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 64px; padding: 11px 14px; color: var(--ink); border-bottom: 1px solid var(--line); transition: background .15s ease; }
.activity-list a:hover { background: #f4f8f5; }
.activity-list a:last-child { border-bottom: 0; }
.activity-list strong, .activity-list small { display: block; }
.activity-list strong { font-size: 13px; }
.activity-list small { margin-top: 4px; color: var(--muted); font-size: 11px; }

.upload-band { margin-bottom: 28px; padding: 22px; border-left: 4px solid var(--green); border-radius: 0 var(--radius) var(--radius) 0; background: var(--surface); box-shadow: var(--shadow); }
.upload-form { display: flex; align-items: flex-end; justify-content: space-between; gap: 22px; }
.upload-form > div { flex: 1; }
.upload-form label { display: block; margin-bottom: 7px; font-weight: 700; }
.upload-form small { display: block; margin-top: 6px; color: var(--muted); }

.search-form { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
input, select, textarea { width: 100%; min-height: 40px; padding: 8px 11px; border: 1px solid var(--line-strong); border-radius: 8px; color: var(--ink); background: white; outline: none; transition: border-color .15s ease, box-shadow .15s ease; }
input:focus, select:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(22,107,71,.12); }
input[type=file] { padding: 7px; background: var(--surface-soft); }
.search-form input { min-width: 200px; }
.search-form select { width: auto; min-width: 0; }
.check-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 650; cursor: pointer; white-space: nowrap; }
.check-inline input { width: 16px; min-height: 16px; margin: 0; accent-color: var(--green); }
.data-form { max-width: 920px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid label, .stack-form label { display: grid; gap: 7px; color: #4f574f; font-size: 13px; font-weight: 700; }
.form-grid .span-2 { grid-column: span 2; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.field-error { display: block; margin-top: 5px; color: var(--red); font-size: 12px; }
.match-success { color: var(--green-dark) !important; }
.match-warning { color: var(--amber) !important; }
.allocation-summary { padding: 7px 10px; background: var(--blue-soft); color: var(--blue); border-radius: 5px; font-size: 13px; }
.allocation-summary strong { margin-left: 5px; }
.allocation-heading { align-items: center; }
.allocation-tools { display: flex; align-items: center; gap: 8px; }
.allocation-tools .button { gap: 7px; }
.allocation-tools .button svg { width: 16px; height: 16px; }
.allocation-lines { display: grid; gap: 10px; }
.allocation-line { display: grid; grid-template-columns: minmax(205px, 1.15fr) minmax(250px, 1.4fr) 105px 120px 130px 36px; align-items: end; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); box-shadow: var(--shadow); }
.allocation-line label { display: grid; gap: 6px; color: #4f574f; font-size: 12px; font-weight: 700; }
.allocation-line-info { align-self: center; min-width: 0; }
.allocation-line-title, .allocation-line-detail { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.allocation-line-title { font-size: 13px; }
.allocation-line-detail { margin-top: 5px; color: var(--muted); font-size: 11px; }
.allocation-line-detail.unit-kilogram { color: var(--amber); font-weight: 700; }
.allocation-line .remove-allocation { margin-bottom: 3px; }

.filter-tabs { display: flex; align-items: center; gap: 4px; margin: -6px 0 24px; border-bottom: 1px solid var(--line); }
.filter-tabs a { display: inline-flex; align-items: center; gap: 6px; padding: 10px 14px; color: var(--muted); font-size: 13px; font-weight: 700; border-bottom: 2px solid transparent; }
.filter-tabs a.active { color: var(--green); border-bottom-color: var(--green); }
.tab-badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--red); color: #fff; font-size: 11px; font-weight: 750; }
.filter-tabs a.active .tab-badge { background: var(--green); }

.month-section { margin-bottom: 30px; }
details.month-section > summary { list-style: none; cursor: pointer; user-select: none; }
details.month-section > summary::-webkit-details-marker { display: none; }
details.month-section > summary::after { content: "收起"; font-size: 12px; color: var(--muted); padding: 3px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
details.month-section:not([open]) > summary::after { content: "展开"; }
details.month-section:not([open]) { margin-bottom: 14px; }
details.month-section:not([open]) > summary { margin-bottom: 0; }
.month-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 10px; }
.month-heading h2 { margin: 0; font-size: 17px; }
.month-heading h2::before { content: ""; display: inline-block; width: 4px; height: 16px; margin-right: 8px; border-radius: 2px; background: var(--green); vertical-align: -2px; }
.month-heading > span { color: var(--muted); font-size: 12px; padding: 3px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.nowrap { white-space: nowrap; }

.ledger-toolbar { display: grid; gap: 10px; margin: -4px 0 22px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.toolbar-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.search-box { position: relative; flex: 1 1 240px; max-width: 420px; display: flex; align-items: center; }
.search-box svg { position: absolute; left: 11px; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.search-box input { padding-left: 34px; border-radius: 999px; background: var(--surface-soft); border-color: transparent; }
.search-box input:focus { background: #fff; border-color: var(--green); }
.segmented { display: inline-flex; align-items: center; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-soft); }
.seg-label { padding: 0 8px 0 10px; color: var(--muted); font-size: 12px; font-weight: 700; white-space: nowrap; }
.seg { min-height: 30px; padding: 4px 13px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font-size: 12.5px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.seg:hover { color: var(--ink); }
.seg.active { background: var(--surface); color: var(--green-dark); box-shadow: 0 1px 3px rgba(24,31,25,.14); }
.month-row { align-items: flex-start; }
.month-row > .seg-label { padding-top: 6px; }
.month-chips { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 4px 13px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 12.5px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.chip svg { width: 14px; height: 14px; }
.chip:hover { border-color: var(--green); color: var(--green); }
.chip.active { border-color: var(--green); background: var(--green); color: #fff; box-shadow: 0 1px 4px rgba(22,107,71,.3); }
.chip.reset { border-style: dashed; color: var(--red); }
.chip.reset:hover { border-color: var(--red); }
.chip-badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--red); color: #fff; font-size: 10.5px; }
.chip.active .chip-badge { background: rgba(255,255,255,.28); }

.stat-bar { display: flex; align-items: stretch; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(180deg, #fbfdfb, #f4f8f4); box-shadow: var(--shadow); }
.stat { min-width: 150px; flex: 1 1 150px; padding: 4px 14px; border-left: 1px solid var(--line); }
.stat:first-child { border-left: 0; padding-left: 0; }
.stat span, .stat small { display: block; color: var(--muted); font-size: 12px; }
.stat strong { display: block; margin: 4px 0 2px; font-size: 18px; font-variant-numeric: tabular-nums; }
.stat.primary strong { font-size: 20px; color: var(--green-dark); }
.stat.primary strong.negative { color: var(--red); }
.stat.fx strong { color: var(--blue); }

.row-actions { display: flex; align-items: center; gap: 5px; min-width: 112px; }
.row-actions form { margin: 0; }
.icon-button { width: 34px; height: 34px; min-height: 34px; display: inline-grid; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--muted); cursor: pointer; transition: all .15s ease; }
.icon-button:hover { border-color: #9fae9d; color: var(--ink); background: var(--surface-soft); }
.icon-button svg { width: 16px; height: 16px; }
.icon-button.marked, .mark-symbol { color: #b47712; }
.icon-button.danger-icon:hover { color: var(--red); border-color: #e7b4af; background: var(--red-soft); }
.marked-row { background: #fffaee !important; }
.archived-row { opacity: .62; }
.mark-symbol { margin-right: 5px; font-family: Arial, sans-serif; }
.check-col { width: 34px; text-align: center; }
.check-col input { width: 15px; min-height: 15px; margin: 0; accent-color: var(--green); cursor: pointer; }

.bulk-bar { position: sticky; bottom: 16px; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 14px; padding: 12px 18px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-md); }
.bulk-bar[hidden] { display: none; }
.bulk-bar span { font-size: 13px; color: var(--muted); }
.bulk-bar strong { color: var(--ink); }

.flag-toggle { display: inline-flex; align-items: center; gap: 7px; min-height: 32px; padding: 4px 12px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 12.5px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.flag-toggle svg { width: 15px; height: 15px; }
.flag-toggle:hover { border-color: var(--green); color: var(--green); }
.flag-toggle.on { border-color: #b8dfc9; background: var(--green-soft); color: var(--green-dark); }
.flag-panel { display: flex; align-items: stretch; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.flag-panel form { margin: 0; }
.flag-card { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 12px 20px; border: 1.5px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); cursor: pointer; color: var(--muted); }
.flag-card svg { width: 26px; height: 26px; }
.flag-card span { text-align: left; }
.flag-card strong, .flag-card small { display: block; }
.flag-card strong { font-size: 14px; color: var(--ink); }
.flag-card small { margin-top: 3px; font-size: 11.5px; }
.flag-card:hover { border-color: var(--green); }
.flag-card.on { border-color: #b8dfc9; background: var(--green-soft); color: var(--green-dark); }
.flag-card.on strong { color: var(--green-dark); }
.attach-upload { flex: 1 1 420px; display: flex; align-items: center; gap: 10px; padding: 12px 16px; border: 1.5px dashed var(--line-strong); border-radius: var(--radius); background: var(--surface-soft); }
.attach-upload select { max-width: 130px; }
.attach-upload input[type=file] { flex: 1; min-width: 0; }
.attach-count { display: inline-flex; align-items: center; gap: 5px; color: var(--blue); font-size: 12.5px; font-weight: 700; }
.attach-count svg { width: 14px; height: 14px; }

.missing-banner { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; padding: 12px 16px; border: 1px solid #f0c5c1; border-radius: var(--radius-sm); background: var(--red-soft); color: var(--red); font-size: 13px; }
.missing-banner svg { width: 18px; height: 18px; flex: 0 0 auto; }
.missing-banner strong { margin: 0 2px; }

.document-links { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.document-links a { padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); transition: border-color .15s ease, box-shadow .15s ease; }
.document-links a:hover { border-color: var(--green); box-shadow: var(--shadow); }
.document-links span, .document-links strong, .document-links small { display: block; }
.document-links span { color: var(--green); font-size: 11px; font-weight: 750; }
.document-links strong { margin: 6px 0; font-size: 13px; overflow-wrap: anywhere; }
.document-links small { color: var(--muted); }

.detail-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1px; margin-bottom: 28px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--line); overflow: hidden; box-shadow: var(--shadow); }
.detail-summary > div { padding: 18px; background: var(--surface); }
.detail-summary span, .detail-summary strong { display: block; }
.detail-summary > div > span { margin-bottom: 8px; color: var(--muted); font-size: 12px; }
.detail-summary > div > strong { font-size: 16px; font-variant-numeric: tabular-nums; }
.declaration-totals { margin-top: 20px; }
.check-field { display: inline-flex; align-items: center; gap: 8px; margin-top: 16px; color: #4f574f; font-size: 13px; font-weight: 700; }
.check-field input { width: 18px; min-height: 18px; margin: 0; accent-color: var(--green); }
.two-column-detail { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, .6fr); gap: 24px; }
dl { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 11px 16px; margin: 0; font-size: 13px; }
dt { color: var(--muted); }
dd { margin: 0; overflow-wrap: anywhere; }
.danger-zone { align-self: start; border-color: #ecc5c2; }
.danger-zone p { color: var(--muted); font-size: 13px; line-height: 1.7; }
.empty-module { min-height: 360px; display: grid; place-items: center; align-content: center; gap: 10px; border: 1px dashed var(--line-strong); border-radius: var(--radius); color: var(--muted); text-align: center; }
.empty-module svg { width: 38px; height: 38px; color: var(--green); }
.empty-module h2, .empty-module p { margin: 0; }
.empty-module p { max-width: 560px; font-size: 14px; line-height: 1.7; }

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(160deg, #e9efe9, #dfe8e0); }
.login-panel { width: min(400px, 100%); padding: 34px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: 0 16px 44px rgba(29,40,33,.10); }
.login-brand { padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.login-brand small { color: var(--muted); }
.login-panel h1 { margin: 26px 0 20px; font-size: 24px; }
.stack-form { display: grid; gap: 16px; }

@media (max-width: 1100px) {
  .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .account-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid, .two-column-detail { grid-template-columns: 1fr; }
  .allocation-line { grid-template-columns: minmax(210px, 1fr) minmax(240px, 1.2fr) repeat(3, 110px) 36px; }
}

@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { position: static; width: 100%; height: auto; padding: 13px 14px; }
  .brand { padding: 0 0 12px; border-bottom: 0; }
  .business-switcher { padding: 0 0 10px; }
  .sidebar nav { grid-template-columns: repeat(5, minmax(70px, 1fr)); gap: 4px; margin: 0; overflow-x: auto; }
  .sidebar nav a { min-height: 52px; padding: 5px 8px; flex-direction: column; justify-content: center; gap: 3px; font-size: 11px; }
  .sidebar nav a.active { box-shadow: inset 0 -3px 0 #6fc89d; }
  .sidebar-user { display: none; }
  .main-content { padding: 22px 14px 44px; }
  .page-header { align-items: flex-start; flex-direction: column; }
  .page-header h1 { font-size: 25px; }
  .metrics, .account-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid, .form-grid.three { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: span 1; }
  .document-links, .detail-summary { grid-template-columns: 1fr; }
  .section-block, .form-section { padding: 16px; }
  .stat-bar { flex-direction: column; }
  .stat { border-left: 0; border-top: 1px solid var(--line); padding: 10px 0 4px; }
  .stat:first-child { border-top: 0; padding-top: 0; }
  .flag-panel { flex-direction: column; }
  .attach-upload { flex-wrap: wrap; }
  .upload-form { align-items: stretch; flex-direction: column; }
  .search-form { width: 100%; }
  .search-form input { min-width: 0; flex: 1; }
  .page-actions { width: 100%; }
  .page-actions .search-form { flex: 1 1 100%; }
  .filter-tabs { overflow-x: auto; }
  .allocation-heading, .allocation-tools { align-items: stretch; flex-direction: column; width: 100%; }
  .allocation-line { grid-template-columns: 1fr; align-items: stretch; }
  .allocation-line .remove-allocation { margin: 0; justify-self: end; }
  .allocation-line-title, .allocation-line-detail { white-space: normal; }
}
