:root {
  --ink: #18231f;
  --muted: #53635d;
  --aux: #687770;
  --line: #d5dfda;
  --table-grid: #dde6e2;
  --paper: #ffffff;
  --canvas: #f4f7f5;
  --green: #0f6b53;
  --green-dark: #0b5743;
  --green-soft: #e6f3ee;
  --amber: #7a5200;
  --amber-soft: #fff1cc;
  --blue: #175a86;
  --blue-soft: #e8f3fb;
  --red: #b42318;
  --red-soft: #fdecec;
  --navy: #14372f;
  --shadow: 0 6px 20px rgba(28, 53, 44, 0.055);
}

* { box-sizing: border-box; }
.is-hidden { display: none !important; }
html { min-width: 320px; background: var(--canvas); }
body { margin: 0; color: var(--ink); background: var(--canvas); font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", "Segoe UI", sans-serif; font-size: 16px; line-height: 1.6; font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid #2c8a6d; outline-offset: 2px; }
button:disabled, input:disabled, select:disabled { color: #7b8983; border-color: #d5ddda; background: #e8ecea; cursor: not-allowed; box-shadow: none; }
.permission-hidden { display: none !important; }
.auth-pending .app-shell { visibility: hidden; }
.sidebar-backdrop, .mobile-bottom-nav, .mobile-register-tabs { display: none; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); transition: grid-template-columns .22s ease; }
.app-shell.sidebar-collapsed { grid-template-columns: 0 minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; width: 248px; height: 100vh; padding: 28px 20px 20px; background: var(--navy); color: white; display: flex; flex-direction: column; z-index: 30; overflow: hidden; transition: transform .22s ease, opacity .18s ease; }
.app-shell.sidebar-collapsed .sidebar { transform: translateX(-100%); opacity: 0; pointer-events: none; }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 30px; }
.brand-mark { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; background: #f3d79c; color: #19362e; font: 700 23px/1 Georgia, serif; }
.brand strong, .brand span { display: block; }
.brand strong { font-size: 17px; letter-spacing: .02em; }
.brand span { margin-top: 3px; color: #b7c9c2; font-size: 13px; }
.nav { display: grid; gap: 7px; }
.nav-item { width: 100%; min-height: 48px; border: 0; border-radius: 10px; padding: 11px 14px; color: #d4e0db; background: transparent; text-align: left; display: flex; align-items: center; gap: 12px; font-size: 16px; font-weight: 600; transition: .18s ease; }
.nav-item span { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 7px; font-size: 20px; font-weight: 700; }
.nav-item b { margin-left: auto; min-width: 24px; padding: 2px 7px; border-radius: 99px; text-align: center; color: white; background: var(--red); font-size: 13px; line-height: 20px; }
.nav-item:hover { background: rgba(255,255,255,.07); color: white; }
.nav-item.active { background: #f3d79c; color: #19362e; font-weight: 700; }
.sidebar-note { margin-top: auto; padding: 14px; border: 1px solid rgba(255,255,255,.12); border-radius: 12px; background: rgba(255,255,255,.05); display: flex; align-items: center; gap: 11px; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: #65d49e; box-shadow: 0 0 0 5px rgba(101,212,158,.12); }
.sidebar-note strong, .sidebar-note small { display: block; }
.sidebar-note strong { font-size: 14px; }
.sidebar-note small { margin-top: 2px; color: #b7c9c2; font-size: 13px; }
.reset-demo { margin-top: 9px; padding: 8px; border: 0; color: #b7c9c2; background: transparent; font-size: 13px; }
.reset-demo:hover { color: white; }

.main { min-width: 0; padding: 0 32px 48px; }
.topbar { min-height: 92px; display: flex; align-items: center; gap: 18px; }
.topbar h1 { margin: 2px 0 0; font-size: 28px; line-height: 38px; letter-spacing: -.02em; }
.eyebrow { margin: 0; color: var(--green); font-size: 13px; line-height: 20px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.eyebrow.red { color: var(--red); }
.top-actions { position: relative; margin-left: auto; display: flex; align-items: center; gap: 12px; }
.today { padding-right: 15px; border-right: 1px solid var(--line); }
.today span, .today strong { display: block; text-align: right; }
.today span { color: var(--aux); font-size: 13px; }
.today strong { margin-top: 1px; font-size: 15px; line-height: 22px; }
.avatar { width: 44px; height: 44px; border: 0; border-radius: 50%; display: grid; place-items: center; color: white; background: var(--navy); font-size: 14px; font-weight: 700; }
.account-menu { position: absolute; right: 0; top: 54px; z-index: 45; width: 210px; padding: 15px; border: 1px solid var(--line); border-radius: 11px; background: white; box-shadow: 0 15px 35px rgba(18,42,34,.16); display: none; }
.account-menu.open { display: grid; }
.account-menu strong, .account-menu span { display: block; }
.account-menu span { margin: 2px 0 12px; color: var(--aux); font-size: 13px; }
.account-menu .ghost { width: 100%; }
.mobile-menu { width: 44px; height: 44px; flex: 0 0 auto; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: white; font-size: 21px; box-shadow: 0 3px 10px rgba(28,53,44,.04); }
.mobile-menu:hover { border-color: #2c8a6d; color: var(--green); background: var(--green-soft); }

.workspace-tabs-bar { min-height: 48px; margin: 0 0 18px; padding: 6px 7px 0; border: 1px solid var(--line); border-bottom-color: #c9d7d1; border-radius: 11px 11px 0 0; display: flex; align-items: flex-end; gap: 8px; background: #edf3f0; }
.workspace-tabs { min-width: 0; min-height: 40px; flex: 1 1 auto; display: flex; align-items: flex-end; gap: 5px; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.workspace-tab { min-width: 118px; max-width: 210px; height: 40px; flex: 0 0 auto; border: 1px solid transparent; border-bottom: 0; border-radius: 9px 9px 0 0; display: flex; align-items: stretch; color: var(--muted); background: transparent; }
.workspace-tab:hover { background: rgba(255,255,255,.66); }
.workspace-tab.active { border-color: #c9d7d1; color: var(--ink); background: var(--canvas); box-shadow: 0 -2px 8px rgba(28,53,44,.04); }
.workspace-tab-button { min-width: 0; min-height: 38px; flex: 1 1 auto; padding: 8px 5px 8px 11px; border: 0; display: flex; align-items: center; gap: 7px; color: inherit; background: transparent; font-size: 13px; font-weight: 600; text-align: left; }
.workspace-tab.active .workspace-tab-button { font-weight: 700; }
.workspace-tab-icon { width: 17px; flex: 0 0 17px; color: var(--green); text-align: center; font-size: 14px; line-height: 18px; }
.workspace-tab-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.workspace-tab-close { width: 29px; min-height: 38px; flex: 0 0 29px; padding: 0; border: 0; border-radius: 7px 7px 0 0; color: var(--aux); background: transparent; font-size: 18px; line-height: 38px; }
.workspace-tab-close:hover { color: var(--ink); background: #e1eae6; }
.new-contract-query-tab { min-height: 34px; margin-bottom: 4px; padding: 6px 10px; flex: 0 0 auto; border: 1px solid #a8c5ba; border-radius: 8px; color: var(--green); background: white; font-size: 12px; font-weight: 700; white-space: nowrap; }
.new-contract-query-tab:hover { border-color: var(--green); background: var(--green-soft); }

.page { display: none; animation: pageIn .22s ease both; }
.page.active { display: block; }
@keyframes pageIn { from { opacity: 0; transform: translateY(4px); } }

.hero-panel { min-height: 160px; padding: 32px 34px; border-radius: 16px; color: white; background: var(--green); box-shadow: var(--shadow); display: flex; align-items: center; justify-content: space-between; gap: 24px; overflow: hidden; position: relative; }
.hero-panel::after { content: ""; position: absolute; right: -70px; top: -90px; width: 290px; height: 290px; border: 45px solid rgba(255,255,255,.05); border-radius: 50%; }
.hero-panel p { margin: 0 0 8px; color: #d1e8df; font-size: 15px; line-height: 24px; }
.hero-panel h2 { max-width: 680px; margin: 0; font-size: clamp(22px, 2.2vw, 31px); line-height: 1.35; }
.hero-panel h2 span { color: #f3d79c; }
.light-button { position: relative; z-index: 1; min-height: 46px; flex: 0 0 auto; padding: 10px 18px; border: 1px solid rgba(255,255,255,.45); border-radius: 9px; color: white; background: rgba(255,255,255,.1); font-size: 15px; font-weight: 600; }

.kpi-grid { margin-top: 18px; display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; }
.kpi-card { padding: 22px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); box-shadow: var(--shadow); }
.kpi-card span, .kpi-card small { display: block; color: var(--muted); }
.kpi-card span { font-size: 14px; line-height: 22px; }
.kpi-card strong { display: inline-block; margin: 10px 5px 2px 0; font-size: 30px; line-height: 38px; font-variant-numeric: tabular-nums; }
.kpi-card small { display: inline-block; font-size: 13px; }
.kpi-card.warning { background: #fff8e8; border-color: #ead39a; }
.kpi-card.warning strong { color: var(--amber); }

.dashboard-grid { margin-top: 18px; display: grid; grid-template-columns: minmax(0,2fr) minmax(285px, .75fr); gap: 16px; }
.panel { border: 1px solid var(--line); border-radius: 14px; background: var(--paper); box-shadow: var(--shadow); overflow: hidden; }
.panel-head { min-height: 80px; padding: 20px 22px; display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.panel-head h3 { margin: 3px 0 0; font-size: 18px; line-height: 28px; }
.modal-head-actions { display: flex; align-items: center; gap: 8px; }
.modal-head-actions .compact-action { white-space: nowrap; }
.text-button, .icon-button { border: 0; color: var(--green); background: transparent; font-weight: 700; }
.text-button { min-height: 40px; padding: 7px 10px; font-size: 14px; }
.icon-button { width: 44px; height: 44px; display: grid; place-items: center; color: var(--ink); font-size: 26px; }
.table-wrap { overflow-x: auto; scrollbar-color: #9fb4ac #edf3f0; }
table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 22px; font-variant-numeric: tabular-nums; }
th { position: sticky; top: 0; z-index: 2; height: 46px; padding: 12px 16px; border-right: 1px solid var(--table-grid); border-bottom: 1px solid #cfdbd6; color: var(--muted); background: #edf3f0; text-align: left; white-space: nowrap; font-weight: 600; }
td { height: 52px; padding: 13px 16px; border-right: 1px solid var(--table-grid); border-bottom: 1px solid var(--table-grid); white-space: nowrap; }
tr > :last-child { border-right: 0; }
tbody tr:last-child > td { border-bottom: 0; }
tbody tr:nth-child(even) { background: #fbfcfb; }
tbody tr:hover { background: #f2f8f5; }
.dashboard-grid .span-2 .table-wrap { max-height: 420px; overflow: auto; }
.dashboard-grid .table-wrap th:nth-child(n+4):nth-child(-n+7), .dashboard-grid .table-wrap td:nth-child(n+4):nth-child(-n+7) { text-align: right; }
.dashboard-grid .table-wrap th:nth-child(8), .dashboard-grid .table-wrap td:nth-child(8) { text-align: center; }
.customer-name { font-weight: 600; }
.fee-alert { color: var(--red); font-weight: 700; background: var(--red-soft); border-radius: 6px; padding: 4px 7px; }
.badge { display: inline-flex; min-height: 28px; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 99px; font-size: 13px; line-height: 20px; font-weight: 600; }
.badge.open { color: var(--amber); background: var(--amber-soft); }
.badge.partial { color: var(--blue); background: var(--blue-soft); }
.badge.done { color: #146c43; background: #e6f4ec; }
.badge.alert { color: var(--red); background: var(--red-soft); }
.badge.end { color: #7b3731; background: #f8dedb; }
.badge.invalid { color: #775813; background: #fff0c7; }

.alert-panel { padding-bottom: 18px; }
.mini-alert { margin: 0 18px 12px; padding: 15px; border: 1px solid #efc4bf; border-radius: 11px; background: var(--red-soft); }
.mini-alert strong { display: flex; justify-content: space-between; gap: 8px; font-size: 15px; line-height: 24px; }
.mini-alert strong span { color: var(--red); }
.mini-alert p { margin: 6px 0 0; color: #765956; font-size: 13px; line-height: 20px; }

.primary, .secondary, .ghost { min-height: 46px; border-radius: 9px; padding: 10px 18px; font-size: 15px; line-height: 22px; font-weight: 600; border: 1px solid transparent; }
.button-link { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.primary { color: white; background: var(--green); box-shadow: 0 5px 12px rgba(8,119,91,.15); }
.primary:hover { background: var(--green-dark); }
.primary.small { padding: 9px 15px; font-size: 15px; }
.secondary { color: var(--green); border-color: #a9c9bd; background: white; }
.secondary:hover { border-color: var(--green); background: var(--green-soft); }
.ghost { color: var(--muted); border-color: var(--line); background: transparent; }
.full { width: calc(100% - 36px); margin: 0 18px; }

.step-row { max-width: 560px; margin: 4px auto 24px; display: flex; align-items: center; justify-content: center; }
.step { color: var(--aux); display: flex; align-items: center; gap: 8px; font-size: 14px; line-height: 22px; }
.step b { width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: white; }
.step.active { color: var(--green); font-weight: 700; }
.step.active b { color: white; background: var(--green); border-color: var(--green); }
.step-row i { width: 60px; height: 1px; margin: 0 12px; background: #cbd6d1; }
.form-panel { margin-bottom: 16px; overflow: visible; }
.form-grid { padding: 0 21px 21px; display: grid; gap: 14px; }
.form-grid.four { grid-template-columns: repeat(4, minmax(0,1fr)); }
.form-grid.contract-basics { grid-template-columns: repeat(4, minmax(0,1fr)); }
.contract-note-field { grid-column: span 3; }
.contract-note-field textarea { min-height: 46px; resize: vertical; }
.powder-price-field input { border-color: #8fbbaa; background: #f4faf7; font-weight: 600; }
.yn-field { min-width: 0; margin: 0; padding: 0; border: 0; }
.yn-field legend { margin: 0 0 7px; padding: 0; color: var(--muted); font-size: 14px; line-height: 20px; font-weight: 600; }
.yn-options { min-height: 46px; display: grid; grid-template-columns: 1fr 1fr; border: 1px solid #c7d4ce; border-radius: 8px; overflow: hidden; background: white; }
.yn-options label { position: relative; display: grid; place-items: center; cursor: pointer; }
.yn-options label + label { border-left: 1px solid #c7d4ce; }
.yn-options input { position: absolute; width: 1px; height: 1px; min-height: 0; margin: 0; padding: 0; opacity: 0; }
.yn-options span { width: 100%; height: 100%; display: grid; place-items: center; color: var(--muted); font-size: 15px; }
.yn-options input:checked + span { color: white; background: var(--green); font-weight: 700; }
.yn-options input:focus-visible + span { outline: 2px solid #2c8a6d; outline-offset: -3px; }
label { color: var(--muted); font-size: 14px; line-height: 20px; font-weight: 600; }
input, select, textarea { width: 100%; min-height: 46px; margin-top: 7px; border: 1px solid #c7d4ce; border-radius: 8px; padding: 10px 13px; color: var(--ink); background: white; outline: none; font-size: 15px; line-height: 24px; }
input:focus, select:focus, textarea:focus { border-color: #2c8a6d; box-shadow: 0 0 0 3px rgba(44,138,109,.18); }
input[readonly] { color: var(--aux); background: #f1f4f3; }
.auto-date { padding: 7px 11px; border-radius: 99px; color: var(--green); background: var(--green-soft); font-size: 13px; line-height: 20px; font-weight: 600; }
.upload-box { margin: 0 21px 21px; min-height: 128px; padding: 20px; border: 1px dashed #8fbbaa; border-radius: 11px; background: #f4faf7; display: flex; align-items: center; justify-content: center; flex-direction: column; text-align: center; cursor: pointer; }
.upload-box strong, .upload-box small { display: block; }
.upload-box small { margin-top: 5px; color: var(--aux); font-size: 13px; line-height: 20px; font-weight: 400; }
.upload-box input { display: none; }
.upload-icon { width: 38px; height: 38px; margin-bottom: 8px; border-radius: 50%; display: grid; place-items: center; color: white; background: var(--green); font-size: 21px; }
.file-list { padding: 0 21px 14px; display: flex; flex-wrap: wrap; gap: 8px; }
.file-chip { padding: 7px 10px; border-radius: 7px; color: var(--muted); background: #edf3f0; font-size: 13px; line-height: 20px; }

.spec-table-wrap { max-height: 58vh; margin: 0 21px 10px; border: 1px solid var(--line); border-radius: 11px; overflow: auto; background: white; }
.spec-entry-table { min-width: 1492px; table-layout: fixed; }
.spec-entry-table th { position: sticky; top: 0; z-index: 2; padding: 11px 8px; color: var(--muted); background: #edf3f0; text-align: center; }
.spec-entry-table td { padding: 7px; border-top: 1px solid #e3eae7; }
.spec-entry-table tbody tr:focus-within { background: #edf7f3; }
.spec-entry-table input { min-width: 0; min-height: 44px; margin: 0; padding: 8px; border-radius: 7px; text-align: center; }
.spec-entry-table th:nth-child(1), .spec-entry-table td:nth-child(1) { width: 108px; }
.spec-entry-table th:nth-child(2), .spec-entry-table td:nth-child(2),
.spec-entry-table th:nth-child(3), .spec-entry-table td:nth-child(3) { width: 94px; }
.spec-entry-table th:nth-child(4), .spec-entry-table td:nth-child(4),
.spec-entry-table th:nth-child(5), .spec-entry-table td:nth-child(5) { width: 126px; }
.spec-entry-table th:nth-child(6), .spec-entry-table td:nth-child(6),
.spec-entry-table th:nth-child(7), .spec-entry-table td:nth-child(7),
.spec-entry-table th:nth-child(9), .spec-entry-table td:nth-child(9) { width: 112px; }
.spec-entry-table th:nth-child(8), .spec-entry-table td:nth-child(8) { width: 220px; }
.spec-entry-table th:nth-child(10), .spec-entry-table td:nth-child(10),
.spec-entry-table th:nth-child(11), .spec-entry-table td:nth-child(11) { width: 116px; }
.spec-entry-table th:nth-child(12), .spec-entry-table td:nth-child(12),
.spec-entry-table th:nth-child(13), .spec-entry-table td:nth-child(13) { width: 112px; }
.spec-entry-table th:nth-child(14), .spec-entry-table td:nth-child(14) { width: 76px; text-align: center; }
.service-price-column { background: #fff9e9; }
.spec-entry-table td.service-price-column input { border-color: #d8b86e; background: #fffdf6; }
.spec-entry-table td.service-price-column input:disabled { border-color: var(--line); color: var(--aux); background: #f2f5f4; }
.row-service-options { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; }
.row-service-options label { cursor: pointer; }
.row-service-options input { position: absolute; opacity: 0; pointer-events: none; }
.row-service-options span { min-height: 32px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; display: inline-flex; align-items: center; color: var(--muted); background: white; font-size: 12px; white-space: nowrap; }
.row-service-options input:checked + span { color: white; border-color: var(--green); background: var(--green); }
.remove-line { min-height: 40px; padding: 7px 5px; border: 0; color: #9c3d36; background: transparent; font-size: 13px; font-weight: 600; }
.remove-line:hover { color: var(--red); }
.computed { color: var(--green); font-weight: 700; background: #edf7f3; }
.formula-note { margin: 5px 21px 20px; padding: 11px 13px; border-radius: 8px; color: var(--aux); background: #f1f4f3; font-size: 13px; line-height: 20px; }
.formula-note span { margin-right: 6px; color: var(--green); font-weight: 700; }
.form-actions { padding: 5px 0 16px; display: flex; justify-content: flex-end; gap: 10px; }
.contract-draft-status { margin-right: auto; align-self: center; color: var(--aux); font-size: 13px; line-height: 20px; }
.contract-draft-status[data-state="saved"], .contract-draft-status[data-state="restored"] { color: var(--green); }
.contract-draft-status[data-state="warning"] { color: #8a6420; }
.contract-draft-status[data-state="error"] { color: var(--red); font-weight: 600; }

.filter-panel { margin-bottom: 18px; padding: 20px; overflow: visible; }
.filter-grid { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr 1.2fr auto; gap: 11px; align-items: end; }
.contract-filter-grid { grid-template-columns: repeat(5, minmax(145px, 1fr)); }
.filter-grid input, .filter-grid select { padding: 10px 13px; }
.filter-hint { margin: 13px 2px 0; color: var(--aux); font-size: 13px; line-height: 20px; }
.wide { max-height: calc(100vh - 280px); overflow: auto; }
.wide table { min-width: 1650px; }
.wide th:nth-child(n+6):nth-child(-n+13), .wide td:nth-child(n+6):nth-child(-n+13) { text-align: right; }
.wide th:nth-child(14), .wide th:nth-child(15), .wide td:nth-child(14), .wide td:nth-child(15) { text-align: center; }
.contract-data-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.detail-icon-button { width: 40px; height: 40px; margin: auto; border: 1px solid #a9c9bd; border-radius: 8px; display: grid; place-items: center; background: white; }
.detail-icon-button:hover { border-color: var(--green); background: var(--green-soft); }
.eye-glyph { width: 18px; height: 11px; position: relative; display: block; border: 2px solid var(--green); border-radius: 70% 35%; transform: rotate(45deg); }
.eye-glyph::after { content: ""; position: absolute; left: 50%; top: 50%; width: 5px; height: 5px; border-radius: 50%; background: var(--green); transform: translate(-50%,-50%); }

.explain-banner { margin-bottom: 18px; padding: 20px 22px; border: 1px solid #efc4bf; border-radius: 14px; background: var(--red-soft); display: flex; align-items: center; gap: 15px; }
.explain-icon { width: 44px; height: 44px; flex: 0 0 auto; border-radius: 10px; display: grid; place-items: center; color: white; background: var(--red); font-weight: 700; font-size: 21px; }
.explain-banner strong { font-size: 15px; line-height: 24px; }
.explain-banner p { margin: 4px 0 0; color: #765956; font-size: 13px; line-height: 20px; }
.explain-banner button { margin-left: auto; flex: 0 0 auto; }
.compact-rule-banner { padding: 13px 17px; }
.compact-rule-banner .explain-icon { width: 38px; height: 38px; }
.alert-ledger-panel { overflow: visible; }
.alert-toolbar { padding: 16px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: end; justify-content: space-between; gap: 18px; }
.alert-status-tabs { display: flex; gap: 7px; flex-wrap: wrap; }
.alert-status-button { min-height: 42px; padding: 8px 13px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: white; font-weight: 600; }
.alert-status-button b { min-width: 24px; margin-left: 5px; padding: 1px 6px; border-radius: 99px; color: var(--muted); background: #edf3f0; font-size: 13px; }
.alert-status-button.active { color: white; border-color: var(--green); background: var(--green); }
.alert-status-button.active b { color: var(--green); background: white; }
.alert-filter-grid { display: grid; grid-template-columns: 140px 160px 120px 110px 125px auto auto; gap: 9px; align-items: end; }
.alert-filter-grid input, .alert-filter-grid select { min-height: 42px; margin-top: 4px; padding: 7px 10px; }
.alert-filter-grid .secondary { min-height: 42px; padding: 8px 12px; }
.alert-table-wrap { max-height: calc(100vh - 330px); overflow: auto; }
.alert-ledger-table { min-width: 1320px; }
.alert-ledger-table th, .alert-ledger-table td { padding-left: 13px; padding-right: 13px; }
.alert-ledger-table th:nth-child(n+4):nth-child(-n+8), .alert-ledger-table td:nth-child(n+4):nth-child(-n+8) { text-align: right; }
.alert-ledger-table th:nth-child(9), .alert-ledger-table td:nth-child(9), .alert-ledger-table th:nth-child(10), .alert-ledger-table td:nth-child(10) { text-align: center; }
.alert-ledger-row.pending { box-shadow: inset 3px 0 var(--red); }
.alert-ledger-row.confirmed { color: var(--muted); }
.alert-spec-cell { font-weight: 600; }
.drop-value { color: var(--red); font-weight: 700; }
.alert-row-actions { display: flex; align-items: center; justify-content: center; gap: 7px; }
.compact-action { min-height: 38px; padding: 7px 11px; font-size: 13px; white-space: nowrap; }
.alert-comparison-grid { margin: 3px 0 18px; display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center; }
.comparison-record { padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: #f7f9f8; }
.comparison-record.current { border-color: #efc4bf; background: var(--red-soft); }
.comparison-record span, .comparison-record strong { display: block; }
.comparison-record span { color: var(--muted); font-size: 13px; }
.comparison-record strong { margin-top: 3px; font-size: 20px; }
.comparison-record.current strong { color: var(--red); }
.comparison-record p { margin: 4px 0 0; color: var(--aux); font-size: 13px; }
.comparison-arrow { color: var(--aux); font-size: 22px; }
.alert-parameter-comparison { border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: white; }
.alert-parameter-header, .alert-parameter-row { display: grid; grid-template-columns: minmax(118px, .7fr) minmax(0, 1fr) minmax(0, 1fr); }
.alert-parameter-header { color: var(--muted); background: #edf3f0; }
.alert-parameter-header > *, .alert-parameter-row > * { min-width: 0; padding: 9px 12px; border-right: 1px solid var(--line); }
.alert-parameter-header > *:last-child, .alert-parameter-row > *:last-child { border-right: 0; }
.alert-parameter-header span, .alert-parameter-header strong { font-size: 13px; line-height: 20px; font-weight: 700; }
.alert-parameter-row { border-top: 1px solid var(--line); }
.alert-parameter-label { color: var(--aux); font-size: 13px; line-height: 21px; font-weight: 600; background: #fafcfb; }
.alert-parameter-row strong { font-size: 14px; line-height: 21px; font-weight: 600; overflow-wrap: anywhere; }
.alert-parameter-row.is-different .alert-current-value { background: #f5faf8; }
.alert-parameter-row.fee-comparison .alert-current-value { color: var(--red); background: var(--red-soft); }
.compact-detail-grid { grid-template-columns: repeat(2, 1fr); }
.compact-detail-grid .detail-info:nth-child(2n) { border-right: 0; }
.detail-action-row { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; }
.audit-note { margin: 9px 0 0; color: var(--aux); font-size: 13px; }

.settlement-mode-switch { width: fit-content; margin: 0 0 12px; padding: 4px; display: flex; gap: 4px; border: 1px solid var(--line); border-radius: 11px; background: #edf3f0; }
.settlement-mode-button { min-height: 40px; padding: 8px 18px; border: 0; border-radius: 8px; color: var(--muted); background: transparent; font-weight: 700; }
.settlement-mode-button:hover { color: var(--green); background: rgba(255,255,255,.72); }
.settlement-mode-button.active { color: white; background: var(--green); box-shadow: 0 3px 8px rgba(15,107,83,.18); }
.settlement-filter { grid-template-columns: 1.15fr 1fr .9fr 1.15fr 1fr auto; }
.settlement-customer-field { color: var(--green); font-weight: 700; }
.settlement-customer-field select { color: var(--aux); font-weight: 500; }
.settlement-customer-field select.has-selection { border-color: #79aa98; color: var(--green); background: #f2faf6; font-weight: 800; box-shadow: inset 3px 0 0 var(--green); }
.settlement-archive-filter { grid-template-columns: 1.1fr 1.2fr auto auto; }
.settlement-entry-table { min-width: 1364px; }
.settlement-table-wrap { max-height: calc(100vh - 300px); overflow: auto; }
.settlement-entry-table th, .settlement-entry-table td { text-align: left; }
.settlement-entry-table th:first-child, .settlement-entry-table td:first-child { text-align: center; }
.settlement-entry-table th:nth-child(n+5):nth-child(-n+12), .settlement-entry-table td:nth-child(n+5):nth-child(-n+12) { text-align: right; }
.settlement-entry-table th:nth-child(n+13), .settlement-entry-table td:nth-child(n+13) { text-align: center; }
.settlement-entry-table .settlement-qty { width: 106px; min-height: 42px; margin: 0 0 0 auto; padding: 8px 10px; text-align: right; }
.settlement-entry-table .preview-remaining { color: var(--green); font-weight: 700; }
.settlement-entry-table tr.invalid-row { background: var(--red-soft); }
.settlement-drag-cell { padding-left: 7px !important; padding-right: 7px !important; }
.settlement-drag-handle { width: 38px; height: 38px; margin: auto; padding: 0; border: 1px solid #b8cec5; border-radius: 8px; color: var(--green); background: white; cursor: grab; touch-action: none; font-size: 22px; line-height: 1; }
.settlement-drag-handle:hover, .settlement-drag-handle:focus-visible { border-color: var(--green); background: var(--green-soft); outline: none; }
.settlement-drag-handle:active { cursor: grabbing; }
.settlement-entry-table tr.settlement-row-dragging { position: relative; z-index: 6; opacity: .72; background: #edf7f3; box-shadow: inset 4px 0 var(--green), 0 7px 18px rgba(15,107,83,.16); }
.settlement-entry-table tr.settlement-drop-target { box-shadow: inset 0 3px var(--green); }
body.settlement-drag-active { cursor: grabbing; user-select: none; }
.end-spec-button { min-height: 38px; padding: 7px 11px; border: 1px solid #dfaaa5; border-radius: 8px; color: var(--red); background: white; font-size: 13px; font-weight: 600; white-space: nowrap; }
.end-spec-button:hover { border-color: var(--red); background: var(--red-soft); }
.settlement-price { display: block; font-weight: 600; }
.package-price-tag { display: inline-flex; margin-top: 3px; padding: 1px 6px; border-radius: 99px; color: var(--amber); background: var(--amber-soft); font-size: 13px; line-height: 20px; font-weight: 700; }
.settlement-actions { padding: 17px 22px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: flex-end; gap: 18px; }
.settlement-actions span { margin-right: auto; color: var(--aux); font-size: 13px; line-height: 20px; }
.settlement-candidate-modal { width: min(1320px, 96vw); }
.candidate-help { margin: -4px 0 14px; color: var(--aux); font-size: 14px; line-height: 22px; }
.settlement-candidate-table-wrap { max-height: min(58vh, 560px); border: 1px solid var(--line); border-radius: 9px; overflow: auto; }
.settlement-candidate-table { min-width: 1320px; }
.settlement-candidate-table th:first-child, .settlement-candidate-table td:first-child { width: 72px; text-align: center; }
.settlement-candidate-table th:nth-child(n+8), .settlement-candidate-table td:nth-child(n+8) { text-align: right; }
.settlement-candidate-row:not(.candidate-selected) { cursor: pointer; }
.settlement-candidate-table .settlement-candidate-radio { appearance: none; -webkit-appearance: none; width: 20px; height: 20px; min-height: 20px; margin: 0; padding: 0; border: 2px solid #7fae9e; border-radius: 50%; display: inline-block; vertical-align: middle; background: white; box-shadow: none; cursor: pointer; }
.settlement-candidate-table .settlement-candidate-radio:checked { border-color: var(--green); background: var(--green); box-shadow: inset 0 0 0 4px white; }
.settlement-candidate-table .settlement-candidate-radio:focus, .settlement-candidate-table .settlement-candidate-radio:focus-visible { border-color: var(--green); border-radius: 50%; outline: 2px solid rgba(44,138,109,.45); outline-offset: 3px; box-shadow: none; }
.settlement-candidate-table .settlement-candidate-radio:checked:focus, .settlement-candidate-table .settlement-candidate-radio:checked:focus-visible { box-shadow: inset 0 0 0 4px white; }
.settlement-candidate-table .settlement-candidate-radio:disabled { border-color: #bcc9c4; background: #eef2f0; box-shadow: none; opacity: .7; cursor: not-allowed; }
.settlement-candidate-table.data-grid td:first-child.grid-cell-active { box-shadow: none; background: transparent !important; }
.candidate-selected { color: var(--aux); background: #f1f5f3 !important; }
.candidate-added-tag { display: inline-flex; margin-left: 7px; padding: 1px 6px; border-radius: 99px; color: var(--green); background: var(--green-soft); font-size: 13px; line-height: 20px; font-weight: 700; }
.remove-settlement-candidate { min-height: 38px; padding: 7px 11px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: white; font-size: 13px; font-weight: 600; white-space: nowrap; }
.remove-settlement-candidate:hover { border-color: var(--green); color: var(--green); background: var(--green-soft); }
.settlement-archive-heading > strong { color: var(--green); font-size: 18px; font-variant-numeric: tabular-nums; }
.settlement-archive-table { min-width: 1340px; }
.settlement-archive-table th:nth-child(n+5):nth-child(-n+8), .settlement-archive-table td:nth-child(n+5):nth-child(-n+8) { text-align: right; }
.settlement-archive-table th:nth-child(n+9), .settlement-archive-table td:nth-child(n+9) { text-align: center; }
.settlement-processing-fee { color: var(--green); font-weight: 700; }
.settlement-archive-table .archive-total { color: var(--green); font-weight: 700; }
.settlement-archive-table-wrap { max-height: calc(100vh - 300px); overflow: auto; }
.management-grid { display: grid; gap: 18px; }
.management-table-wrap, .log-table-wrap { max-height: 430px; overflow: auto; }
.management-table-wrap table { min-width: 980px; }
.log-table-wrap table { min-width: 850px; }
.management-actions { display: flex; gap: 7px; }
.settlement-correction-button { display: inline-flex; margin-left: 8px; }
.settlement-correction-history-wrap table { min-width: 1140px; }
.correction-modal-actions .ghost { margin-right: auto; }

.import-modal { width: min(1180px, 96vw); }
.import-step-bar { margin: 2px 0 17px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.import-step-bar span { min-height: 38px; padding: 7px 10px; border-radius: 7px; color: var(--muted); background: #edf3f0; text-align: center; font-size: 13px; font-weight: 600; }
.import-step-bar span.active { color: white; background: var(--green); }
.compact-upload { min-height: 105px; margin: 0 0 16px; padding: 14px; }
.compact-upload .upload-icon { width: 34px; height: 34px; margin-bottom: 5px; }
.import-summary { margin-bottom: 14px; display: grid; grid-template-columns: repeat(5, 1fr); gap: 9px; }
.import-summary > div { padding: 12px 14px; border: 1px solid var(--line); border-radius: 9px; background: #f7f9f8; }
.import-summary span, .import-summary strong { display: block; }
.import-summary span { color: var(--aux); font-size: 13px; }
.import-summary strong { margin-top: 2px; font-size: 22px; }
.import-summary .success strong { color: var(--green); }
.import-summary .danger strong { color: var(--red); }
.import-summary .skipped strong { color: #526b7a; }
.import-summary .warning strong { color: var(--amber); }
.import-preview-wrap { max-height: 360px; border: 1px solid var(--line); border-radius: 9px; overflow: auto; }
.import-preview-table { min-width: 1050px; }
.import-preview-table th:nth-child(6), .import-preview-table td:nth-child(6), .import-preview-table th:nth-child(7), .import-preview-table td:nth-child(7) { text-align: right; }
.import-preview-table th:nth-child(8), .import-preview-table td:nth-child(8) { min-width: 300px; white-space: normal; }
.import-error-row { background: var(--red-soft) !important; }
.import-skipped-row { background: #f1f5f7 !important; }
.import-warning-row { background: #fff9e9 !important; }
.import-result { font-weight: 600; }
.import-result.error { color: var(--red); }
.import-result.skipped { color: #526b7a; }
.import-result.warning { color: var(--amber); }
.import-result.success { color: var(--green); }
.import-footer { padding-top: 14px; display: flex; align-items: center; justify-content: flex-end; gap: 20px; }
.import-footer p { margin: 0 auto 0 0; color: var(--aux); font-size: 13px; }

.login-screen { position: fixed; inset: 0; z-index: 200; padding: 20px; background: linear-gradient(145deg, #102f28, #0f6b53); display: none; place-items: center; }
.login-screen.open { display: grid; }
.login-card { width: min(450px, 100%); padding: 30px; border-radius: 16px; background: white; box-shadow: 0 28px 80px rgba(0,0,0,.3); }
.login-brand { display: flex; align-items: center; gap: 12px; }
.login-brand strong, .login-brand span { display: block; }
.login-brand strong { font-size: 18px; }
.login-brand span { color: var(--aux); font-size: 13px; }
.login-card h1 { margin: 25px 0 3px; font-size: 28px; }
.login-card > p { margin: 0 0 20px; color: var(--muted); }
.login-card .full { width: 100%; margin: 8px 0 0; }
.login-error { min-height: 22px; margin: 5px 0; color: var(--red); font-size: 13px; }

.toast { position: fixed; left: 50%; bottom: 25px; z-index: 100; transform: translate(-50%, 20px); padding: 12px 18px; border-radius: 9px; color: white; background: var(--navy); box-shadow: 0 10px 30px rgba(0,0,0,.18); opacity: 0; pointer-events: none; transition: .2s ease; font-size: 14px; line-height: 22px; }
.toast.show { transform: translate(-50%,0); opacity: 1; }
.business-date-field { min-width: 0; }
.business-date-trigger { width: 100%; min-height: 46px; margin-top: 7px; padding: 10px 13px; border: 1px solid #bdcbc5; border-radius: 9px; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--ink); background: white; text-align: left; font-weight: 500; }
.business-date-trigger:hover { border-color: #7caa9a; background: #fbfdfc; }
.business-date-trigger.is-placeholder { color: #7d8a85; }
.business-date-icon { width: 17px; height: 17px; flex: 0 0 auto; border: 1.7px solid currentColor; border-radius: 3px; position: relative; }
.business-date-icon::before { content: ""; position: absolute; left: 2px; right: 2px; top: 4px; border-top: 1.7px solid currentColor; }
.business-date-icon::after { content: ""; position: absolute; left: 3px; right: 3px; top: -3px; height: 5px; border-left: 1.7px solid currentColor; border-right: 1.7px solid currentColor; }
.business-calendar-popover { position: fixed; z-index: 180; width: 330px; max-width: calc(100vw - 24px); padding: 14px; border: 1px solid #cbd8d2; border-radius: 13px; color: var(--ink); background: white; box-shadow: 0 18px 46px rgba(18,42,34,.22); }
.business-calendar-popover[hidden] { display: none; }
.business-calendar-head { height: 42px; display: grid; grid-template-columns: 42px 1fr 42px; align-items: center; text-align: center; }
.business-calendar-head strong { font-size: 16px; }
.business-calendar-nav { width: 38px; height: 38px; padding: 0; border: 0; border-radius: 8px; color: var(--green); background: transparent; font-size: 28px; line-height: 1; }
.business-calendar-nav:hover { background: var(--green-soft); }
.business-calendar-weekdays, .business-calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.business-calendar-weekdays { margin: 4px 0; color: var(--aux); text-align: center; font-size: 13px; font-weight: 600; }
.business-calendar-weekdays span { height: 28px; display: grid; place-items: center; }
.business-calendar-grid { gap: 2px; }
.business-calendar-day { width: 100%; min-width: 0; aspect-ratio: 1; padding: 0; border: 0; border-radius: 8px; display: grid; place-items: center; background: transparent; font-size: 14px; line-height: 1; }
.business-calendar-day.has-activity { color: #111915; font-weight: 800; }
.business-calendar-day.no-activity { color: #9aa39f; font-weight: 500; }
.business-calendar-day:disabled { color: #b6bdb9; background: transparent; cursor: not-allowed; opacity: .45; }
.business-calendar-day:disabled:hover { color: #b6bdb9; background: transparent; opacity: .45; }
.business-calendar-day.outside-month { opacity: .48; }
.business-calendar-day:hover { color: var(--green); background: var(--green-soft); opacity: 1; }
.business-calendar-day.today-date:not(.selected) { box-shadow: inset 0 0 0 2px #2c8a6d; }
.business-calendar-day.selected { color: white !important; background: var(--green); font-weight: 800; opacity: 1; }
.business-calendar-actions { min-height: 43px; margin-top: 8px; padding-top: 8px; border-top: 1px solid #e1e8e5; display: flex; align-items: center; justify-content: space-between; }
.business-calendar-actions button { min-height: 34px; padding: 5px 9px; border: 0; border-radius: 7px; color: var(--green); background: transparent; font-weight: 700; }
.business-calendar-actions button:hover { background: var(--green-soft); }
.modal-backdrop { position: fixed; inset: 0; z-index: 80; padding: 20px; background: rgba(13,27,23,.45); display: none; place-items: center; }
.modal-backdrop.open { display: grid; }
#settlementCorrectionModal, #contractEditModal { z-index: 90; }
.modal { width: min(480px,100%); padding: 8px 24px 24px; border-radius: 14px; background: white; box-shadow: 0 25px 70px rgba(0,0,0,.2); }
.detail-modal { width: min(1080px, 94vw); max-height: 88vh; padding-top: 0; overflow-y: auto; }
.compact-modal { width: min(700px, 94vw); }
.modal .panel-head { padding-left: 0; padding-right: 0; }
.detail-modal > .panel-head { position: sticky; top: 0; z-index: 5; border-bottom: 1px solid var(--line); background: white; }
.detail-modal > .panel-head h3 { font-size: 20px; line-height: 30px; }
.modal label { display: block; margin-bottom: 13px; }
.modal .full { width: 100%; margin: 8px 0 0; }
.required-mark { margin-left: 6px; color: var(--red); font-size: 13px; }
.end-summary { margin: 2px 0 16px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); background: #f7f9f8; font-size: 14px; line-height: 23px; }
.end-summary strong { color: var(--ink); }
.end-warning { margin: -2px 0 16px; padding: 10px 12px; border-left: 3px solid var(--red); color: #765956; background: var(--red-soft); font-size: 13px; line-height: 21px; }
.detail-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.detail-section-heading h4 { margin: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; }
.danger-button { min-height: 46px; padding: 10px 18px; border: 1px solid var(--red); border-radius: 9px; color: white; background: var(--red); font-size: 15px; font-weight: 600; }
.danger-button:hover { background: #951b12; }
.warning-button { min-height: 46px; padding: 10px 18px; border: 1px solid #bd8615; border-radius: 9px; color: #694a0b; background: #fff0c7; font-size: 15px; font-weight: 700; }
.warning-button:hover { border-color: #96680d; background: #ffe5a1; }
.warning-text { color: #9b6b0d; }
.contract-operation-section { padding: 15px 16px; border: 1px solid #e0e7e4; border-radius: 11px; display: flex; align-items: center; justify-content: space-between; gap: 16px; background: #f8faf9; }
.contract-operation-section h4 { margin-bottom: 2px; }
.contract-operation-section p { margin: 0; color: var(--aux); font-size: 13px; line-height: 20px; }
.contract-operation-actions { display: flex; flex: 0 0 auto; flex-wrap: wrap; justify-content: flex-end; gap: 9px; }
.price-edit-grid { padding: 0; }
.correction-edit-grid { padding: 0; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.contract-edit-modal { width: min(920px, 96vw); }
.contract-edit-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px 14px; }
.contract-edit-grid label { min-width: 0; margin: 0; }
.contract-edit-grid label small { min-height: 18px; margin-top: 4px; display: block; color: var(--green); font-size: 12px; line-height: 18px; }
.contract-edit-services { margin: 15px 0; padding: 11px 14px; border: 1px solid var(--line); border-radius: 9px; display: flex; align-items: center; gap: 22px; }
.contract-edit-services legend { padding: 0 6px; color: var(--muted); font-size: 13px; font-weight: 700; }
.contract-edit-services label { margin: 0; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.contract-edit-services input { width: 18px; height: 18px; min-height: 0; margin: 0; padding: 0; }
.price-edit-note { margin: -2px 0 16px; padding: 10px 12px; border-left: 3px solid var(--green); color: var(--muted); background: var(--green-soft); font-size: 13px; line-height: 21px; }
.price-history-wrap { max-height: 300px; }
.price-history-table { min-width: 1080px; }
.price-history-table th:nth-child(n+4), .price-history-table td:nth-child(n+4) { text-align: right; }
.price-history-table th:nth-child(3), .price-history-table td:nth-child(3) { min-width: 220px; white-space: normal; }
.contract-scope-options { margin: 0 0 16px; padding: 0; border: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.contract-scope-options legend { width: 100%; margin-bottom: 7px; color: var(--muted); font-size: 13px; font-weight: 700; }
.contract-scope-options label { min-height: 72px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; display: flex; align-items: flex-start; gap: 9px; background: white; cursor: pointer; }
.contract-scope-options label:has(input:checked) { border-color: var(--green); background: var(--green-soft); box-shadow: inset 0 0 0 1px var(--green); }
.contract-scope-options label.disabled-option { opacity: .55; cursor: not-allowed; }
.contract-scope-options input { width: 18px; height: 18px; min-height: 0; margin: 2px 0 0; padding: 0; flex: 0 0 auto; }
.contract-scope-options span, .contract-scope-options strong, .contract-scope-options small { display: block; }
.contract-scope-options strong { color: var(--ink); font-size: 14px; line-height: 21px; }
.contract-scope-options small { margin-top: 2px; color: var(--aux); font-size: 12px; line-height: 18px; }
.modal-table-wrap { max-height: 340px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.modal-table-wrap th:nth-child(2), .modal-table-wrap td:nth-child(2) { text-align: right; }
.detail-section { margin: 20px 0; }
.detail-section h4 { margin: 0 0 11px; font-size: 17px; line-height: 26px; }
.detail-info-grid { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.detail-info { min-height: 86px; padding: 15px 16px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: white; }
.detail-info:nth-child(4n) { border-right: 0; }
.detail-info span, .detail-info strong { display: block; }
.detail-info span { color: var(--aux); font-size: 13px; line-height: 20px; }
.detail-info strong { margin-top: 5px; font-size: 15px; line-height: 24px; font-weight: 600; }
.attachment-list { display: flex; flex-wrap: wrap; gap: 8px; }
.attachment-chip { min-height: 40px; padding: 8px 12px; border: 1px solid #a9c9bd; border-radius: 8px; color: var(--green); background: #f4faf7; font-size: 14px; line-height: 22px; text-decoration: none; }
.attachment-chip.disabled { color: var(--muted); cursor: default; }
.empty { padding: 38px 22px; color: var(--aux); text-align: center; font-size: 14px; line-height: 22px; }

/* 表格优先：统一密度、固定列宽、冻结列、可调整列宽与键盘选中状态 */
.topbar { min-height: 76px; }
.table-settings-button { width: 42px; height: 42px; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 9px; color: var(--green); background: white; font-size: 20px; font-weight: 700; }
.table-settings-button:hover { border-color: var(--green); background: var(--green-soft); }
.hero-panel { min-height: 96px; padding: 20px 24px; border-radius: 13px; }
.hero-panel p { margin-bottom: 3px; }
.hero-panel h2 { font-size: clamp(19px, 1.65vw, 25px); }
.kpi-grid { margin-top: 12px; gap: 10px; }
.kpi-card { min-height: 76px; padding: 13px 16px; border-radius: 11px; }
.kpi-card strong { margin: 4px 4px 0 0; font-size: 24px; line-height: 31px; }
.dashboard-grid { margin-top: 12px; gap: 12px; }
.panel { border-radius: 12px; }
.panel-head { min-height: 62px; padding: 13px 18px; }
.panel-head h3 { margin-top: 1px; font-size: 17px; line-height: 25px; }
.step-row { margin: 0 auto 12px; }
.form-panel { margin-bottom: 12px; }
.form-grid { padding: 0 18px 15px; gap: 11px; }
.filter-panel { margin-bottom: 12px; padding: 14px 16px; }
.filter-hint { margin-top: 8px; }
.contract-filter-grid:not(.show-advanced) { grid-template-columns: 1.15fr 1fr 1fr 1fr 1fr auto auto auto; }
.contract-filter-grid:not(.show-advanced) .advanced-filter { display: none; }
.more-filter-button { white-space: nowrap; }
.explain-banner { margin-bottom: 12px; }
.compact-rule-banner { padding: 10px 14px; }
.alert-toolbar { padding: 11px 14px; }
.settlement-actions { position: sticky; bottom: 0; z-index: 7; padding: 11px 16px; background: rgba(255,255,255,.97); box-shadow: 0 -5px 14px rgba(28,53,44,.06); }
.wide { max-height: calc(100vh - 244px); }
.alert-table-wrap { max-height: calc(100vh - 270px); }
.settlement-table-wrap { max-height: calc(100vh - 255px); }

.table-wrap { position: relative; overflow-x: auto; overscroll-behavior: contain; scrollbar-gutter: stable; scrollbar-width: auto; }
.table-wrap::-webkit-scrollbar { width: 11px; height: 11px; }
.table-wrap::-webkit-scrollbar-track { background: #edf3f0; }
.table-wrap::-webkit-scrollbar-thumb { border: 2px solid #edf3f0; border-radius: 9px; background: #95aaa2; }
.table-wrap::-webkit-scrollbar-thumb:hover { background: #6f8d82; }
table.data-grid { width: max-content; min-width: 100%; table-layout: fixed; outline: none; }
table.data-grid th, table.data-grid td { overflow: hidden; text-overflow: ellipsis; }
table.data-grid th { height: 44px; padding: 10px 13px; user-select: none; }
table.data-grid td { height: 48px; padding: 10px 13px; }
table.data-grid:focus-visible { box-shadow: inset 0 0 0 2px rgba(44,138,109,.45); }
.data-grid .column-resizer { position: absolute; top: 0; right: -5px; z-index: 9; width: 10px; height: 100%; cursor: col-resize; touch-action: none; }
.data-grid .column-resizer::after { content: ""; position: absolute; top: 8px; bottom: 8px; left: 4px; width: 1px; background: #b7c9c2; opacity: .65; }
.data-grid th:hover .column-resizer::after, .data-grid .column-resizer.dragging::after { width: 2px; background: var(--green); opacity: 1; }
.data-grid .grid-cell-active { position: relative; box-shadow: inset 0 0 0 2px var(--green); background: #e9f6f1 !important; }
.data-grid .sticky-column { position: sticky; background: white; }
.data-grid tbody tr:nth-child(even) .sticky-column { background: #fbfcfb; }
.data-grid tbody tr:hover .sticky-column { background: #f2f8f5; }
.data-grid thead .sticky-column { z-index: 7; background: #e5efea; }
.data-grid tbody .sticky-column { z-index: 4; }
.data-grid .sticky-start-edge { box-shadow: 7px 0 10px -10px rgba(20,55,47,.7); }
.data-grid .sticky-end-edge { box-shadow: -7px 0 10px -10px rgba(20,55,47,.7); }
body.resizing-table-column, body.resizing-table-column * { cursor: col-resize !important; user-select: none !important; }

/* 合同附件与对照录入 */
#register.active { height: auto; min-height: 0; overflow: hidden; display: flex; flex: 1 1 auto; flex-direction: column; }
body.register-mode { overflow: hidden; }
body.register-mode .main { height: 100dvh; padding-bottom: 0; overflow: hidden; display: flex; flex-direction: column; }
body.register-mode .topbar, body.register-mode .workspace-tabs-bar { flex: 0 0 auto; }
#register .step-row { flex: 0 0 auto; }
.registration-form { min-height: 0; flex: 1; }
.contract-entry-workspace { --preview-height: 45%; height: 100%; min-height: 0; display: grid; grid-template-rows: minmax(210px, var(--preview-height)) 12px minmax(0, 1fr); }
.contract-preview-zone { min-height: 0; border: 1px solid var(--line); border-radius: 12px; background: white; box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; }
.preview-surface { min-height: 0; flex: 1; position: relative; }
.contract-upload-box { width: 100%; height: 100%; min-height: 0; margin: 0; padding: 18px; border: 0; border-radius: 0; flex-direction: row; justify-content: center; gap: 13px; text-align: left; }
.contract-upload-box .upload-icon { margin: 0; flex: 0 0 auto; }
.upload-copy { min-width: 0; }
.contract-preview-panel { width: 100%; height: 100%; min-width: 0; min-height: 0; background: white; overflow: hidden; display: flex; flex-direction: column; }
.preview-toolbar { min-height: 54px; padding: 7px 10px 7px 14px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.preview-file-summary { min-width: 0; display: grid; grid-template-columns: minmax(0, auto) auto; align-items: center; column-gap: 9px; }
.preview-file-summary .eyebrow { grid-column: 1 / -1; }
.preview-toolbar strong { max-width: min(420px, 30vw); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
#previewCounter { padding: 1px 7px; border-radius: 99px; color: var(--green); background: var(--green-soft); font-size: 13px; white-space: nowrap; }
.preview-toolbar-actions { display: flex; align-items: center; gap: 4px; }
.preview-toolbar-actions > span { min-width: 45px; color: var(--muted); text-align: center; font-size: 13px; }
.preview-add-button { min-height: 34px; margin: 0 5px 0 0; padding: 5px 10px; border: 1px solid #a9c9bd; border-radius: 7px; display: inline-flex; align-items: center; color: var(--green); background: white; cursor: pointer; font-size: 13px; line-height: 22px; }
.preview-add-button:hover { border-color: var(--green); background: var(--green-soft); }
.icon-control { width: 34px; height: 34px; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 7px; display: grid; place-items: center; color: var(--green); background: white; font-size: 18px; line-height: 1; }
.icon-control:hover { border-color: var(--green); background: var(--green-soft); }
.icon-control:disabled { color: #9aa6a1; background: #f1f4f3; }
.preview-mode-button { min-height: 34px; padding: 5px 9px; border: 1px solid var(--line); border-radius: 7px; color: var(--green); background: white; font-size: 13px; font-weight: 600; white-space: nowrap; }
.preview-mode-button:hover, .preview-mode-button.active { border-color: var(--green); background: var(--green-soft); }
.preview-delete-current { min-height: 34px; margin-left: 5px; padding: 5px 10px; border: 1px solid #dfaaa5; border-radius: 7px; color: var(--red); background: white; font-size: 13px; font-weight: 600; }
.preview-delete-current:hover { border-color: var(--red); background: var(--red-soft); }
.preview-stage { min-height: 0; flex: 1; padding: 16px; overflow: auto; overscroll-behavior: contain; background: #e9eeeb; cursor: grab; user-select: none; touch-action: none; }
.preview-stage:focus-visible { outline: 2px solid #2c8a6d; outline-offset: -2px; }
.preview-stage.dragging { cursor: grabbing; }
.preview-stage.center-preview { display: grid; place-items: center; }
.preview-canvas { position: relative; flex: 0 0 auto; margin: 0 auto; background: white; box-shadow: 0 5px 22px rgba(17,43,35,.18); transition: width .15s ease, height .15s ease; }
.preview-stage.center-preview .preview-canvas { margin: auto; }
.preview-stage img { position: absolute; left: 50%; top: 50%; max-width: none; display: block; transform-origin: center center; pointer-events: none; transition: width .15s ease, height .15s ease, transform .15s ease; }
.preview-file-list { min-height: 38px; flex: 0 0 auto; padding: 5px 8px; border-top: 1px solid var(--line); flex-wrap: nowrap; overflow-x: auto; }
.file-item { flex: 0 0 auto; border: 1px solid transparent; border-radius: 7px; display: inline-flex; align-items: center; background: #edf3f0; overflow: hidden; }
.file-item.active { border-color: #8fbbaa; background: var(--green-soft); }
button.file-chip, span.file-chip { min-height: 32px; padding: 5px 8px 5px 10px; border: 0; border-radius: 0; color: var(--muted); background: transparent; font: inherit; font-size: 13px; cursor: pointer; }
span.file-chip { cursor: default; }
button.file-chip:hover { color: var(--green); }
.file-chip .file-type { margin-left: 5px; color: var(--aux); font-size: 13px; }
.delete-file-button { width: 30px; height: 30px; border: 0; border-left: 1px solid #cbd8d2; color: var(--red); background: transparent; font-size: 18px; line-height: 1; }
.delete-file-button:hover { background: var(--red-soft); }
.preview-resizer { position: relative; cursor: row-resize; touch-action: none; }
.preview-resizer::before { content: ""; position: absolute; left: 35%; right: 35%; top: 5px; height: 3px; border-radius: 3px; background: #a7bbb3; }
.preview-resizer span { position: absolute; left: 50%; top: 0; padding: 0 8px; color: var(--aux); background: var(--canvas); transform: translateX(-50%); font-size: 13px; line-height: 12px; opacity: 0; }
.preview-resizer:hover::before, .preview-resizer:focus-visible::before { background: var(--green); }
.preview-resizer:hover span, .preview-resizer:focus-visible span { opacity: 1; }
.preview-size-presets { position: absolute; right: 8px; top: -12px; z-index: 3; padding: 2px; border: 1px solid var(--line); border-radius: 7px; display: flex; gap: 2px; background: var(--canvas); cursor: default; }
.preview-size-presets button { min-height: 26px; padding: 2px 8px; border: 0; border-radius: 5px; color: var(--aux); background: transparent; font-size: 13px; line-height: 20px; }
.preview-size-presets button:hover, .preview-size-presets button.active { color: white; background: var(--green); }
.contract-form-zone { min-height: 0; padding: 0 2px 0 0; overflow-y: auto; overscroll-behavior: contain; }
.contract-form-zone .form-panel { margin-bottom: 10px; }
.contract-form-zone .form-actions { position: sticky; bottom: 0; z-index: 12; margin-top: 0; padding: 9px 4px 10px; border-top: 1px solid var(--line); background: rgba(244,247,245,.97); box-shadow: 0 -6px 16px rgba(28,53,44,.07); }
.contract-form-zone .spec-table-wrap { max-height: 54vh; }
body.resizing-preview, body.resizing-preview * { cursor: row-resize !important; user-select: none !important; }
body.preview-fullscreen-open { overflow: hidden !important; }
.contract-preview-panel.preview-fullscreen { position: fixed; inset: 16px; z-index: 120; width: auto; height: auto; border: 1px solid var(--line); border-radius: 13px; box-shadow: 0 24px 80px rgba(12,35,29,.28); }
.contract-preview-panel.preview-fullscreen::before { content: ""; position: fixed; inset: 0; z-index: -1; background: rgba(18,37,32,.56); }
.contract-preview-panel.preview-fullscreen .preview-toolbar strong { max-width: min(620px, 42vw); }

/* 详情与批量导入改为更紧凑的档案式信息布局 */
.detail-section { margin: 14px 0; }
.detail-section h4 { margin-bottom: 7px; font-size: 16px; line-height: 24px; }
.detail-info-grid { border-radius: 8px; }
.detail-info { min-height: 60px; padding: 9px 12px; }
.detail-info span { line-height: 18px; }
.detail-info strong { margin-top: 2px; font-size: 14px; line-height: 21px; }
.compact-upload { min-height: 66px; }
.import-step-bar { margin-bottom: 10px; }
.import-summary { margin-bottom: 10px; }
.import-summary > div { padding: 8px 11px; }
.import-summary strong { font-size: 19px; }

@media (max-width: 1439px) {
  .main { padding: 0 24px 40px; }
  .form-grid.contract-basics { grid-template-columns: repeat(3,1fr); }
  .filter-grid, .contract-filter-grid, .settlement-filter, .settlement-archive-filter { grid-template-columns: repeat(3,1fr); }
  .alert-toolbar { align-items: stretch; flex-direction: column; }
  .alert-filter-grid { grid-template-columns: repeat(4, minmax(130px, 1fr)); }
  .filter-grid button { min-height: 46px; }
  .detail-info-grid { grid-template-columns: repeat(2, 1fr); }
  .detail-info:nth-child(4n) { border-right: 1px solid var(--line); }
  .detail-info:nth-child(2n) { border-right: 0; }
  .contract-filter-grid:not(.show-advanced), .contract-filter-grid.show-advanced { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 1080px) {
  .kpi-grid { grid-template-columns: repeat(2,1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .form-grid.four, .form-grid.contract-basics { grid-template-columns: repeat(2,1fr); }
  .contract-note-field { grid-column: 1 / -1; }
  .alert-filter-grid { grid-template-columns: repeat(2, 1fr); }
  .preview-toolbar { align-items: flex-start; flex-direction: column; }
  .preview-toolbar strong { max-width: calc(100vw - 70px); }
  .preview-toolbar-actions { width: 100%; padding-bottom: 2px; justify-content: flex-start; overflow-x: auto; }
}

@media (max-width: 1023px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; left: -270px; width: 248px; padding-left: 20px; padding-right: 20px; transition: .2s ease; box-shadow: 20px 0 50px rgba(0,0,0,.18); }
  .sidebar.open { left: 0; }
  .main { padding: 0 24px 36px; }
  .topbar { min-height: 88px; }
  .mobile-menu { display: grid; }
  .form-grid.four, .form-grid.contract-basics, .filter-grid, .contract-filter-grid, .settlement-filter, .settlement-archive-filter { grid-template-columns: 1fr 1fr; }
  #register.active { height: auto; }
  .contract-entry-workspace.preview-open { display: grid; }
  .contract-preview-panel { min-height: 0; margin-bottom: 0; }
  .preview-resizer { display: block; }
  .contract-filter-grid:not(.show-advanced), .contract-filter-grid.show-advanced { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 767px) {
  .main { padding: 0 16px 30px; }
  .topbar { min-height: 82px; }
  .topbar h1 { font-size: 24px; line-height: 32px; }
  .today { display: none; }
  .primary.small { padding: 9px 12px; }
  .hero-panel { min-height: 185px; padding: 24px; align-items: flex-start; flex-direction: column; }
  .hero-panel h2 { font-size: 24px; line-height: 34px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .kpi-card { padding: 18px; }
  .kpi-card strong { font-size: 27px; line-height: 36px; }
  .form-grid.four, .form-grid.contract-basics, .filter-grid, .contract-filter-grid, .settlement-filter, .settlement-archive-filter { grid-template-columns: 1fr; }
  .settlement-mode-switch { width: 100%; }
  .settlement-mode-button { flex: 1; padding-left: 10px; padding-right: 10px; }
  .settlement-archive-heading { align-items: flex-start; flex-direction: column; }
  .alert-filter-grid { grid-template-columns: 1fr; }
  .explain-banner { align-items: flex-start; flex-wrap: wrap; }
  .explain-banner button { margin-left: 52px; }
  .modal-backdrop { padding: 12px; }
  .detail-modal { width: 100%; max-height: 94vh; }
  .detail-info-grid { grid-template-columns: 1fr; }
  .alert-comparison-grid { grid-template-columns: 1fr; }
  .comparison-arrow { transform: rotate(90deg); text-align: center; }
  .detail-info, .detail-info:nth-child(2n), .detail-info:nth-child(4n) { border-right: 0; }
  .contract-data-actions { width: 100%; justify-content: flex-start; }
  .import-summary { grid-template-columns: repeat(2, 1fr); }
  .import-footer { align-items: stretch; flex-direction: column; }
  .import-footer p { margin-right: 0; }
  .table-settings-button { display: none; }
  .contract-upload-box { align-items: flex-start; }
  #register.active { height: auto; min-height: 0; }
  .contract-entry-workspace { --preview-height: 42%; grid-template-rows: minmax(190px, var(--preview-height)) 12px minmax(0, 1fr); }
  .contract-preview-panel { min-height: 0; }
  .preview-toolbar { align-items: flex-start; flex-direction: column; }
  .preview-toolbar strong { max-width: calc(100vw - 70px); }
  .preview-toolbar-actions { width: 100%; justify-content: flex-start; flex-wrap: wrap; }
  .preview-add-button, .preview-delete-current { margin-left: 0; }
  .contract-filter-grid:not(.show-advanced), .contract-filter-grid.show-advanced { grid-template-columns: 1fr; }
  .business-calendar-popover { width: calc(100vw - 24px); }
}

@media (max-width: 480px) {
  .top-actions .primary { font-size: 0; }
  .top-actions .primary::after { content: "＋登记"; font-size: 14px; }
  .kpi-grid { grid-template-columns: 1fr; }
  .step-row i { width: 22px; margin: 0 5px; }
  .step span { display: none; }
  .panel-head { padding: 16px; }
  .spec-table-wrap { margin: 0 14px 10px; }
  .settlement-actions { align-items: stretch; flex-direction: column; }
  .settlement-actions span { margin-right: 0; }
  .modal { padding-left: 16px; padding-right: 16px; }
}
/* 手机端：缩小字体层级、减少纵向浪费，并将宽表格转换为可扫描卡片 */
@media (max-width: 767px) {
  html { min-width: 320px; }
  body { font-size: 14px; line-height: 1.5; }
  body.mobile-nav-open { overflow: hidden; }

  .main { padding: 0 12px calc(86px + env(safe-area-inset-bottom)); }
  .topbar { position: sticky; top: 0; z-index: 24; min-height: 60px; gap: 10px; background: rgba(244,247,245,.96); backdrop-filter: blur(12px); }
  .topbar > div:nth-child(2) { min-width: 0; }
  .topbar .eyebrow, .today, .table-settings-button, .top-actions .primary.small { display: none; }
  .topbar h1 { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 20px; line-height: 28px; }
  .mobile-menu, .avatar { width: 40px; height: 40px; }
  .mobile-menu { border-radius: 10px; font-size: 19px; }
  .avatar { font-size: 13px; }
  .top-actions { gap: 7px; }
  .account-menu { top: 47px; }

  .workspace-tabs-bar { position: sticky; top: 60px; z-index: 23; min-height: 44px; margin: 0 0 12px; padding: 5px 5px 0; border-radius: 0; background: rgba(237,243,240,.97); backdrop-filter: blur(12px); }
  .workspace-tabs { min-height: 38px; }
  .workspace-tab { min-width: 108px; max-width: 172px; height: 38px; }
  .workspace-tab-button { min-height: 36px; padding: 7px 4px 7px 9px; font-size: 12px; }
  .workspace-tab-close { width: 27px; min-height: 36px; flex-basis: 27px; line-height: 36px; }
  .new-contract-query-tab { width: 34px; min-height: 32px; padding: 0; font-size: 0; }
  .new-contract-query-tab::before { content: "＋"; font-size: 18px; line-height: 30px; }

  .sidebar { left: -286px; width: min(278px, 84vw); padding: 22px 18px calc(20px + env(safe-area-inset-bottom)); }
  .sidebar.open { left: 0; }
  .brand { padding-bottom: 22px; }
  .nav { gap: 5px; }
  .nav-item { min-height: 46px; font-size: 15px; }
  .sidebar-backdrop { position: fixed; inset: 0; z-index: 25; border: 0; background: rgba(13,27,23,.42); opacity: 0; pointer-events: none; transition: opacity .2s ease; }
  body.mobile-nav-open .sidebar-backdrop { display: block; opacity: 1; pointer-events: auto; }

  .mobile-bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 38; min-height: calc(64px + env(safe-area-inset-bottom)); padding: 5px 8px env(safe-area-inset-bottom); border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(5, 1fr); background: rgba(255,255,255,.97); box-shadow: 0 -6px 20px rgba(20,55,47,.08); backdrop-filter: blur(14px); }
  .mobile-nav-item { position: relative; min-width: 0; min-height: 54px; padding: 4px 2px; border: 0; border-radius: 10px; display: grid; place-items: center; align-content: center; gap: 1px; color: var(--aux); background: transparent; }
  .mobile-nav-item span { height: 25px; font-size: 22px; line-height: 25px; font-weight: 700; }
  .mobile-nav-item small { font-size: 11px; line-height: 16px; font-weight: 600; }
  .mobile-nav-item.active { color: var(--green); background: var(--green-soft); }
  .mobile-nav-primary span { width: 34px; height: 30px; border-radius: 10px; display: grid; place-items: center; color: white; background: var(--green); font-size: 24px; }
  .mobile-nav-item b { position: absolute; top: 3px; left: calc(50% + 7px); min-width: 17px; height: 17px; padding: 0 4px; border: 2px solid white; border-radius: 99px; color: white; background: var(--red); font-size: 10px; line-height: 13px; }

  .hero-panel { min-height: 124px; padding: 16px; border-radius: 13px; align-items: flex-end; flex-direction: row; gap: 12px; }
  .hero-panel > div { min-width: 0; }
  .hero-panel::after { right: -95px; top: -120px; }
  .hero-panel p { margin-bottom: 4px; font-size: 13px; line-height: 20px; }
  .hero-panel h2 { font-size: 18px; line-height: 26px; }
  .light-button { min-height: 40px; padding: 8px 12px; font-size: 13px; white-space: nowrap; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 9px; }
  .kpi-card { min-height: 82px; padding: 11px 12px; border-radius: 11px; box-shadow: none; }
  .kpi-card span { font-size: 12px; line-height: 18px; }
  .kpi-card strong { margin: 3px 3px 0 0; font-size: 22px; line-height: 29px; }
  .kpi-card small { font-size: 11px; }
  .dashboard-grid { gap: 10px; }

  .panel { border-radius: 11px; box-shadow: 0 3px 12px rgba(28,53,44,.045); }
  .panel-head { min-height: 54px; padding: 11px 13px; flex-wrap: wrap; }
  .panel-head h3 { font-size: 16px; line-height: 23px; }
  .eyebrow { font-size: 11px; line-height: 17px; }
  .primary, .secondary, .ghost { min-height: 44px; padding: 9px 13px; font-size: 14px; }

  .filter-panel { margin-bottom: 10px; padding: 11px; }
  .filter-grid, .contract-filter-grid, .settlement-filter, .settlement-archive-filter,
  .contract-filter-grid:not(.show-advanced), .contract-filter-grid.show-advanced { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 9px; }
  .alert-filter-grid { grid-template-columns: 1fr; gap: 9px; }
  .filter-grid label, .alert-filter-grid label { font-size: 12px; }
  .filter-grid input, .filter-grid select, .business-date-trigger,
  .alert-filter-grid input, .alert-filter-grid select { min-height: 44px; margin-top: 4px; padding: 8px 10px; font-size: 16px; }
  .filter-grid button, .alert-filter-grid button { min-height: 44px; }
  .filter-hint { display: none; }
  .more-filter-button, #applyFilters, #clearContractFilters, #applySettlementFilter { align-self: end; }
  .alert-toolbar { padding: 10px; gap: 10px; }
  .alert-status-tabs { flex-wrap: nowrap; overflow-x: auto; }
  .alert-status-button { min-height: 40px; flex: 0 0 auto; padding: 7px 10px; font-size: 13px; }
  .compact-rule-banner { padding: 11px 12px; gap: 10px; }
  .compact-rule-banner .explain-icon { width: 32px; height: 32px; font-size: 17px; }
  .explain-banner p { margin-top: 2px; font-size: 12px; line-height: 18px; }
  .explain-banner button { margin-left: 42px; }
  .contract-data-actions { width: 100%; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
  .contract-data-actions > * { min-width: 0; padding-left: 9px; padding-right: 9px; font-size: 12px; }

  .wide, .alert-table-wrap, .settlement-table-wrap, .settlement-archive-table-wrap, .management-table-wrap, .log-table-wrap { max-height: none; overflow: visible; }
  :is(#dashboard table, #contracts .wide table, #alerts .alert-ledger-table, #settlement .settlement-entry-table, #settlement .settlement-archive-table, #management table) { width: 100% !important; min-width: 0 !important; display: block; table-layout: auto !important; }
  :is(#dashboard table, #contracts .wide table, #alerts .alert-ledger-table, #settlement .settlement-entry-table, #settlement .settlement-archive-table, #management table) thead { display: none; }
  :is(#dashboard table, #contracts .wide table, #alerts .alert-ledger-table, #settlement .settlement-entry-table, #settlement .settlement-archive-table, #management table) tbody { display: grid; gap: 9px; padding: 9px; }
  :is(#dashboard table, #contracts .wide table, #alerts .alert-ledger-table, #settlement .settlement-entry-table, #settlement .settlement-archive-table, #management table) tr { border: 1px solid var(--line); border-radius: 10px; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); overflow: hidden; background: white !important; }
  :is(#dashboard table, #contracts .wide table, #alerts .alert-ledger-table, #settlement .settlement-entry-table, #settlement .settlement-archive-table, #management table) td { position: static !important; left: auto !important; right: auto !important; width: auto !important; min-width: 0 !important; height: auto; padding: 7px 10px; border: 0; display: flex; flex-direction: column; justify-content: center; white-space: normal; overflow: visible; text-overflow: clip; box-shadow: none !important; font-size: 13px; line-height: 20px; }
  :is(#dashboard table, #contracts .wide table, #alerts .alert-ledger-table, #settlement .settlement-entry-table, #settlement .settlement-archive-table, #management table) td::before { margin-bottom: 1px; color: var(--aux); font-size: 10px; line-height: 15px; font-weight: 600; }
  :is(#dashboard table, #contracts .wide table, #alerts .alert-ledger-table, #settlement .settlement-entry-table, #settlement .settlement-archive-table, #management table) td.empty { grid-column: 1 / -1; padding: 26px 14px; display: block; text-align: center; }
  .data-grid .column-resizer { display: none; }

  #dashboard .span-2 .table-wrap { max-height: none; }
  #dashboard table td:nth-child(1)::before { content: "客户"; }
  #dashboard table td:nth-child(2)::before { content: "排产日期"; }
  #dashboard table td:nth-child(3)::before { content: "网孔"; }
  #dashboard table td:nth-child(6)::before { content: "数量"; }
  #dashboard table td:nth-child(8)::before { content: "状态"; }
  #dashboard table td:nth-child(4), #dashboard table td:nth-child(5), #dashboard table td:nth-child(7) { display: none; }

  #contracts .wide table td:nth-child(1)::before { content: "排产日期"; }
  #contracts .wide table td:nth-child(2)::before { content: "客户"; }
  #contracts .wide table td:nth-child(3)::before { content: "合同编号"; }
  #contracts .wide table td:nth-child(4)::before { content: "网孔"; }
  #contracts .wide table td:nth-child(9)::before { content: "加工费"; }
  #contracts .wide table td:nth-child(10)::before { content: "当前结账单价"; }
  #contracts .wide table td:nth-child(12)::before { content: "预估数量"; }
  #contracts .wide table td:nth-child(14)::before { content: "状态"; }
  #contracts .wide table td:nth-child(5), #contracts .wide table td:nth-child(6), #contracts .wide table td:nth-child(7), #contracts .wide table td:nth-child(8), #contracts .wide table td:nth-child(11), #contracts .wide table td:nth-child(13) { display: none; }
  #contracts .wide table td:nth-child(15) { grid-column: 1 / -1; padding: 0; border-top: 1px solid var(--line); }
  #contracts .detail-icon-button { width: 100%; height: 42px; border: 0; border-radius: 0; }
  #contracts .detail-icon-button::after { content: "查看详情"; margin-left: 9px; color: var(--green); font-weight: 700; }

  #alerts .alert-ledger-table td:nth-child(1)::before { content: "排产日期"; }
  #alerts .alert-ledger-table td:nth-child(2)::before { content: "客户"; }
  #alerts .alert-ledger-table td:nth-child(3)::before { content: "规格"; }
  #alerts .alert-ledger-table td:nth-child(6)::before { content: "参考加工费"; }
  #alerts .alert-ledger-table td:nth-child(7)::before { content: "本次加工费"; }
  #alerts .alert-ledger-table td:nth-child(8)::before { content: "下降金额"; }
  #alerts .alert-ledger-table td:nth-child(9)::before { content: "状态"; }
  #alerts .alert-ledger-table td:nth-child(4), #alerts .alert-ledger-table td:nth-child(5) { display: none; }
  #alerts .alert-ledger-table td:nth-child(10) { grid-column: 1 / -1; border-top: 1px solid var(--line); }
  .alert-row-actions { justify-content: flex-start; }

  #settlement .settlement-entry-table td:nth-child(1) { min-height: 38px; grid-column: 1 / -1; padding: 3px 7px; align-items: center; background: var(--green-soft); }
  #settlement .settlement-entry-table td:nth-child(2)::before { content: "排产日期"; }
  #settlement .settlement-entry-table td:nth-child(3)::before { content: "合同编号"; }
  #settlement .settlement-entry-table td:nth-child(4)::before { content: "网孔"; }
  #settlement .settlement-entry-table td:nth-child(8)::before { content: "结账单价"; }
  #settlement .settlement-entry-table td:nth-child(10)::before { content: "累计已结"; }
  #settlement .settlement-entry-table td:nth-child(11)::before { content: "实际结账数量"; }
  #settlement .settlement-entry-table td:nth-child(12)::before { content: "亏损数"; }
  #settlement .settlement-entry-table td:nth-child(5), #settlement .settlement-entry-table td:nth-child(6), #settlement .settlement-entry-table td:nth-child(7), #settlement .settlement-entry-table td:nth-child(9) { display: none; }
  #settlement .settlement-entry-table td:nth-child(n+13) { padding: 5px; }
  #settlement .settlement-drag-handle { width: 100%; height: 32px; }
  #settlement .settlement-entry-table .settlement-qty { width: 100%; min-height: 42px; margin: 0; font-size: 16px; text-align: left; }
  .settlement-actions { bottom: calc(64px + env(safe-area-inset-bottom)); padding: 9px 10px; gap: 8px; }
  .settlement-actions span { display: none; }
  .settlement-actions .primary { width: 100%; }

  .mobile-register-tabs { margin: 0 -12px 10px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr 1fr; background: white; }
  .mobile-register-tabs button { min-height: 48px; padding: 8px; border: 0; border-bottom: 3px solid transparent; color: var(--aux); background: transparent; font-size: 14px; font-weight: 700; }
  .mobile-register-tabs button.active { color: var(--green); border-bottom-color: var(--green); }
  #register.active { height: auto; min-height: 0; overflow: visible; display: block; }
  body.register-mode { overflow: auto; }
  body.register-mode .main { height: auto; padding-bottom: calc(86px + env(safe-area-inset-bottom)); overflow: visible; }
  .step-row { margin: 4px auto 12px; }
  .step b { width: 26px; height: 26px; font-size: 12px; }
  .step span { display: inline; font-size: 11px; }
  .step-row i { width: 18px; margin: 0 4px; }
  .registration-form, .contract-entry-workspace { height: auto; min-height: 0; }
  .contract-entry-workspace { display: block; }
  .contract-entry-workspace[data-mobile-view="form"] .contract-preview-zone,
  .contract-entry-workspace[data-mobile-view="form"] .preview-resizer { display: none; }
  .contract-entry-workspace[data-mobile-view="preview"] .contract-form-zone { display: none; }
  .contract-entry-workspace[data-mobile-view="preview"] .contract-preview-zone { min-height: calc(100dvh - 176px); display: flex; }
  .contract-upload-box { min-height: calc(100dvh - 190px); padding: 24px 18px; align-items: center; flex-direction: column; text-align: center; }
  .preview-toolbar { padding: 8px; }
  .preview-toolbar-actions { flex-wrap: nowrap; overflow-x: auto; }
  #previewRead, #previewOriginal, #previewFullscreen { display: none; }
  .preview-stage { min-height: 50dvh; }
  .contract-form-zone { overflow: visible; }
  .form-grid.contract-basics { grid-template-columns: repeat(2,minmax(0,1fr)); padding: 0 12px 12px; gap: 10px; }
  .form-grid.contract-basics > label:first-child { grid-column: 1 / -1; }
  label, .yn-field legend { font-size: 12px; }
  input, select, textarea, .business-date-trigger { min-height: 44px; margin-top: 4px; padding: 8px 10px; font-size: 16px; line-height: 24px; }
  .auto-date { display: none; }
  .spec-table-wrap { max-height: none !important; margin: 0 10px 10px; border: 0; overflow: visible; }
  .spec-entry-table { width: 100% !important; min-width: 0 !important; display: block; table-layout: auto !important; }
  .spec-entry-table thead { display: none; }
  .spec-entry-table tbody { display: grid; gap: 10px; }
  .spec-entry-table .spec-row { padding: 10px; border: 1px solid var(--line); border-radius: 10px; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; background: white; }
  .spec-entry-table td { position: static !important; left: auto !important; right: auto !important; width: auto !important; min-width: 0 !important; height: auto; padding: 0; border: 0; display: block; background: transparent; box-shadow: none !important; }
  .spec-entry-table td::before { display: block; margin-bottom: 3px; color: var(--muted); font-size: 11px; line-height: 16px; font-weight: 600; }
  .spec-entry-table td:nth-child(1)::before { content: "网孔"; }
  .spec-entry-table td:nth-child(2)::before { content: "高度/m"; }
  .spec-entry-table td:nth-child(3)::before { content: "长度/m"; }
  .spec-entry-table td:nth-child(4)::before { content: "塑前重量/kg"; }
  .spec-entry-table td:nth-child(5)::before { content: "塑后重量/kg"; }
  .spec-entry-table td:nth-child(6)::before { content: "数量/卷"; }
  .spec-entry-table td:nth-child(7)::before { content: "基础价格/元"; }
  .spec-entry-table td:nth-child(8)::before { content: "附加服务"; }
  .spec-entry-table td:nth-child(9)::before { content: "含服务单价/元"; }
  .spec-entry-table td:nth-child(10)::before { content: "丝径/mm"; }
  .spec-entry-table td:nth-child(11)::before { content: "上塑量"; }
  .spec-entry-table td:nth-child(12)::before { content: "加工费/元/米"; }
  .spec-entry-table td:nth-child(13)::before { content: "加工户"; }
  .spec-entry-table td:nth-child(14) { grid-column: 1 / -1; }
  .row-service-options { justify-content: flex-start; }
  .spec-entry-table input { width: 100%; min-height: 44px; padding: 8px 9px; font-size: 16px; text-align: left; }
  .remove-line { width: 100%; min-height: 42px; border: 1px solid #dfaaa5; border-radius: 8px; background: var(--red-soft); }
  .formula-note { display: none; }
  .contract-form-zone .form-actions { bottom: calc(64px + env(safe-area-inset-bottom)); padding: 8px 0; }
  .contract-form-zone .form-actions { flex-wrap: wrap; }
  .contract-form-zone .contract-draft-status { width: 100%; }
  .contract-form-zone .form-actions .primary { flex: 1; }

  .modal-backdrop { padding: 0; place-items: end center; }
  .modal, .detail-modal, .compact-modal, .import-modal, .settlement-candidate-modal { width: 100%; max-height: 92dvh; padding: 0 14px calc(16px + env(safe-area-inset-bottom)); border-radius: 18px 18px 0 0; overflow-y: auto; }
  .modal > .panel-head { position: sticky; top: 0; z-index: 3; margin: 0 -14px 12px; padding: 12px 14px; background: white; }
  .toast { bottom: calc(76px + env(safe-area-inset-bottom)); max-width: calc(100vw - 24px); font-size: 13px; }
  .alert-parameter-header, .alert-parameter-row { grid-template-columns: 78px minmax(0,1fr) minmax(0,1fr); }
  .alert-parameter-header > *, .alert-parameter-row > * { padding: 8px 7px; }
  .alert-parameter-header span, .alert-parameter-header strong, .alert-parameter-label { font-size: 11px; line-height: 17px; }
  .alert-parameter-row strong { font-size: 12px; line-height: 18px; }
  #alertDetailBody .detail-action-row { display: grid; grid-template-columns: 1fr 1fr; }
  #alertDetailBody .detail-action-row .secondary { min-width: 0; padding-left: 8px; padding-right: 8px; font-size: 12px; }
  .contract-operation-section { align-items: stretch; flex-direction: column; }
  .contract-operation-actions { display: grid; grid-template-columns: repeat(auto-fit,minmax(120px,1fr)); }
  .contract-scope-options { grid-template-columns: 1fr; }
}

@media (max-width: 390px) {
  .main { padding-left: 10px; padding-right: 10px; }
  .hero-panel { padding: 14px; }
  .hero-panel h2 { font-size: 17px; line-height: 24px; }
  .light-button { padding-left: 10px; padding-right: 10px; }
  .kpi-card strong { font-size: 20px; }
  .step span { display: none; }
  .form-grid.contract-basics { gap: 8px; }
}
@media (max-width: 767px) {
  .correction-edit-grid, .contract-edit-grid { grid-template-columns: 1fr; }
  .contract-edit-services { align-items: flex-start; flex-direction: column; gap: 10px; }
  .settlement-mode-switch { width: 100%; }
  .settlement-mode-button { min-width: 0; flex: 1; padding-left: 8px; padding-right: 8px; font-size: 12px; }
  .settlement-archive-heading { align-items: flex-start; }
  #settlement .settlement-archive-table td:nth-child(1)::before { content: "结账日期"; }
  #settlement .settlement-archive-table td:nth-child(2)::before { content: "客户"; }
  #settlement .settlement-archive-table td:nth-child(3)::before { content: "规格"; }
  #settlement .settlement-archive-table td:nth-child(4)::before { content: "重量"; }
  #settlement .settlement-archive-table td:nth-child(5)::before { content: "结账数量"; }
  #settlement .settlement-archive-table td:nth-child(6)::before { content: "结账单价"; }
  #settlement .settlement-archive-table td:nth-child(7)::before { content: "结账后涂塑加工费"; }
  #settlement .settlement-archive-table td:nth-child(8)::before { content: "合计"; }
  #settlement .settlement-archive-table td:nth-child(9)::before { content: "操作员"; }
  #settlement .settlement-archive-table td:nth-child(10)::before { content: "操作"; }
}
