:root {
  --bg: #f4f3ee;
  --surface: #ffffff;
  --surface-soft: #f8faf8;
  --ink: #17221f;
  --muted: #66736f;
  --line: #dce3df;
  --brand: #176b5b;
  --brand-dark: #0f5145;
  --brand-soft: #dff1eb;
  --brand-soft-hover: #c8e7dc;
  --accent: #d88b33;
  --danger: #b84040;
  --danger-soft: #fbe8e8;
  --danger-soft-hover: #f7d7d7;
  --warning: #976214;
  --warning-soft: #fff2d8;
  --good: #1f7a4d;
  --shadow: 0 18px 48px rgba(30, 47, 42, .12);
  --radius: 16px;
  --radius-sm: 12px;
  --focus: rgba(23,107,91,.58);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); }
body { min-height: 100vh; min-height: 100dvh; font-size: 15px; line-height: 1.5; }
body.modal-open { overflow: hidden; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.hidden { display: none !important; }
[hidden] { display: none !important; }
.mobile-only { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); clip-path: inset(50%); white-space: nowrap; }

.login-view {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(360px, 520px);
  gap: clamp(48px, 9vw, 140px);
  align-items: center;
  padding: clamp(32px, 8vw, 110px);
  background:
    radial-gradient(circle at 18% 20%, rgba(23,107,91,.14), transparent 32%),
    linear-gradient(145deg, #f5f3eb, #e9f0ec);
}
.login-brand { display: flex; align-items: flex-start; gap: 24px; max-width: 670px; }
.login-brand h1 { margin: 4px 0 12px; font-size: clamp(44px, 7vw, 82px); letter-spacing: -.06em; }
.login-brand p:last-child { color: var(--muted); font-size: 18px; line-height: 1.7; }
.brand-mark { display: inline-grid; place-items: center; flex: 0 0 auto; width: 82px; height: 82px; border-radius: 24px; color: #fff; background: var(--brand); font-size: 28px; font-weight: 900; box-shadow: var(--shadow); }
.brand-mark.small { width: 42px; height: 42px; border-radius: 13px; font-size: 16px; box-shadow: none; }
.eyebrow { margin: 0; color: var(--brand); font-size: 11px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.login-card { padding: 40px; border: 1px solid rgba(255,255,255,.7); border-radius: 28px; background: rgba(255,255,255,.88); box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.login-card-head { margin-bottom: 28px; }
.login-card h2 { margin: 0 0 8px; font-size: 28px; }
.login-card p { margin: 0; color: var(--muted); }

label { display: grid; gap: 8px; margin-bottom: 18px; color: #34423e; font-size: 13px; font-weight: 700; }
.field-label { display: grid; gap: 8px; margin-bottom: 18px; color: #34423e; font-size: 13px; font-weight: 700; }
.field-label label { margin: 0; }
input, select, textarea {
  width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  color: var(--ink); background: #fff; outline: none; transition: .16s border-color, .16s box-shadow;
}
textarea { min-height: 92px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(23,107,91,.12); }
input[type="checkbox"] { width: 18px; min-height: 18px; padding: 0; }
input[type="date"]:not(:disabled):not([readonly]) { cursor: pointer; }
.password-field { display: flex; align-items: stretch; width: 100%; }
.password-field input { border-radius: 10px 0 0 10px; }
.password-field button { min-width: 52px; border: 1px solid var(--line); border-left: 0; border-radius: 0 10px 10px 0; color: var(--brand-dark); background: var(--surface-soft); font-size: 12px; font-weight: 750; }
.password-field button:hover { background: var(--brand-soft); }
.form-error { min-height: 20px; margin-top: 12px !important; color: var(--danger) !important; font-size: 13px; }

.button { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; border: 0; border-radius: 10px; padding: 9px 15px; font-weight: 750; color: var(--ink); background: #edf1ef; transition: .15s transform, .15s color, .15s border-color, .15s background, .15s box-shadow; }
.button:hover { color: var(--ink); background: #e1e8e4; transform: translateY(-1px); }
.button:active { transform: translateY(0); }
.button:disabled { cursor: not-allowed; opacity: .55; transform: none; }
.button.primary { color: #fff; background: var(--brand); }
.button.primary:hover { color: #fff; background: var(--brand-dark); }
.button.subtle { color: var(--brand-dark); background: var(--brand-soft); }
.button.subtle:hover { color: var(--brand-dark); background: var(--brand-soft-hover); }
.button.danger { color: var(--danger); background: var(--danger-soft); }
.button.danger:hover { color: #8e3131; background: var(--danger-soft-hover); }
.button.danger-solid { color: #fff; background: var(--danger); }
.button.danger-solid:hover { background: #913232; }
.button.ghost { border: 1px solid var(--line); background: #fff; }
.button.ghost:hover { border-color: #b8d7cc; color: var(--brand-dark); background: #f1f8f5; }
.button.small { min-height: 34px; padding: 6px 10px; font-size: 13px; }
.button.wide { width: 100%; }
.quick-create-button { display: inline-flex; align-items: center; gap: 5px; }
.icon-button { display: inline-grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 10px; color: var(--muted); background: transparent; font-size: 24px; }
.icon-button:hover { color: var(--ink); background: #eef2f0; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 272px minmax(0, 1fr); transition: grid-template-columns .2s ease; }
.app-shell.sidebar-collapsed { grid-template-columns: 82px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; padding: 20px 14px 14px; color: #dfe9e5; background: #142c27; z-index: 30; }
.sidebar-nav-head { display: flex; align-items: center; min-height: 40px; padding: 0 7px 8px; color: #8eaaa2; font-size: 11px; font-weight: 800; letter-spacing: .12em; }
.desktop-nav-collapse { margin-left: auto; color: #bdd0ca; }
.desktop-nav-collapse:hover { color: #fff; background: rgba(255,255,255,.1); }
.sidebar-collapsed .sidebar { padding-right: 10px; padding-left: 10px; }
.sidebar-collapsed .sidebar-brand { justify-content: center; padding-right: 0; padding-left: 0; }
.sidebar-collapsed .sidebar-nav-head { justify-content: center; padding-right: 0; padding-left: 0; }
.sidebar-collapsed .sidebar-nav-head > span { display: none; }
.sidebar-collapsed .desktop-nav-collapse { margin-left: 0; }
.sidebar-collapsed .sidebar-brand > div, .sidebar-collapsed .sidebar-foot > span:last-child, .sidebar-collapsed .nav-item > span:last-child, .sidebar-collapsed .nav-group-toggle > span:first-child, .sidebar-collapsed .nav-group-chevron { display: none; }
.sidebar-collapsed .nav-group { display: none; }
.sidebar-collapsed .nav-group-toggle { display: none; }
.sidebar-collapsed .nav-group-items { display: none !important; }
.sidebar-collapsed .nav-item, .sidebar-collapsed .nav-group-items .nav-item { justify-content: center; padding: 11px; }
.sidebar-collapsed .nav-icon { width: auto; font-size: 16px; }
.sidebar-collapsed .sidebar-foot { justify-content: center; padding-right: 0; padding-left: 0; }
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 2px 7px 22px; }
.sidebar-brand strong, .sidebar-brand small { display: block; }
.sidebar-brand strong { color: #fff; font-size: 16px; }
.sidebar-brand small { margin-top: 3px; color: #8eaaa2; font-size: 11px; }
.main-nav { display: grid; flex: 1 1 auto; align-content: start; min-height: 0; gap: 10px; overflow-x: hidden; overflow-y: auto; padding-right: 2px; }
.nav-group { display: grid; gap: 5px; }
.nav-group-toggle { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 48px; border: 1px solid transparent; border-radius: 12px; padding: 11px 14px; color: #bdd0ca; background: rgba(255,255,255,.035); font-size: 14px; font-weight: 750; letter-spacing: .02em; text-align: left; transition: .15s color, .15s background, .15s border-color; }
.nav-group-toggle:hover, .nav-group.expanded .nav-group-toggle { color: #fff; border-color: rgba(178,222,210,.15); background: rgba(255,255,255,.10); }
.nav-group-chevron { width: 9px; height: 9px; flex: 0 0 auto; margin-right: 0; margin-left: 8px; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg); transition: transform .16s ease; }
.nav-group.expanded .nav-group-chevron { transform: rotate(225deg); }
.nav-group-items { display: grid; gap: 6px; }
.nav-item { display: flex; align-items: center; gap: 12px; min-height: 48px; border: 0; border-radius: 11px; padding: 11px 14px; color: #c5d5d0; background: transparent; font-size: 15px; text-align: left; transition: .15s color, .15s background; }
.nav-group-items .nav-item { padding-left: 18px; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,.09); }
.nav-item.active { color: #fff; background: #1f5c50; box-shadow: inset 3px 0 #7dc7b4; }
.nav-item:hover .nav-icon, .nav-item.active .nav-icon { color: #c7eee4; }
.nav-icon { display: inline-grid; flex: 0 0 22px; place-items: center; width: 22px; color: #9ab7af; text-align: center; }
.nav-icon-svg { display: block; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.6; }
.sidebar-foot { margin-top: auto; display: flex; align-items: center; gap: 8px; padding: 14px 10px 4px; color: #89a69e; font-size: 12px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #999; }
.status-dot.good { background: #5ec68e; box-shadow: 0 0 0 4px rgba(94,198,142,.12); }

.workspace { min-width: 0; }
.sidebar-utilities { display: flex; align-items: center; gap: 10px; }
.global-search { position: relative; flex: 0 1 440px; min-width: 220px; }
.global-search > input { height: 44px; padding: 9px 62px 9px 38px; border-color: #d6ded9; border-radius: 12px; background: rgba(255,255,255,.86); }
.global-search-icon { position: absolute; left: 13px; top: 50%; z-index: 1; color: var(--muted); font-size: 20px; transform: translateY(-53%); pointer-events: none; }
.global-search kbd { position: absolute; right: 10px; top: 50%; border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px; color: var(--muted); background: var(--surface-soft); font: 10px/1.2 inherit; transform: translateY(-50%); pointer-events: none; }
.global-search-results { position: absolute; top: calc(100% + 9px); right: 0; z-index: 80; width: min(610px, calc(100vw - 300px)); max-height: min(570px, calc(100vh - 105px)); overflow-y: auto; padding: 8px; border: 1px solid var(--line); border-radius: 15px; background: #fff; box-shadow: var(--shadow); }
.global-search-result { display: flex; width: 100%; min-height: 60px; align-items: center; gap: 10px; border: 0; border-radius: 10px; padding: 9px 10px; color: var(--ink); background: transparent; text-align: left; }
.global-search-result:hover, .global-search-result:focus-visible { background: var(--surface-soft); }
.search-result-type { flex: 0 0 66px; color: var(--brand-dark); font-size: 11px; font-weight: 800; }
.search-result-copy { min-width: 0; flex: 1; }
.search-result-copy strong, .search-result-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-result-copy strong { font-size: 13px; }
.search-result-copy small { margin-top: 4px; color: #53645e; font-size: 11px; }
.global-search-result .badge { flex: 0 0 auto; }
.global-search-hint { margin: 0; padding: 16px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.global-search-hint.error { color: var(--danger); }
.sidebar-user-actions { position: relative; flex: 0 0 auto; }
.guide-button { display: inline-flex; align-items: center; gap: 6px; }
.guide-button > span:first-child { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; color: #fff; background: var(--brand); font-size: 12px; }
.user-chip { display: flex; align-items: center; gap: 10px; min-height: 46px; border: 0; border-radius: 14px; padding: 6px 10px; color: var(--ink); background: #fff; box-shadow: 0 4px 16px rgba(20,44,39,.07); text-align: left; }
.user-chip > span:first-child { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: #fff; background: var(--brand); font-weight: 800; }
.user-chip strong, .user-chip small { display: block; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip small { color: #53645e; font-size: 11px; margin-top: 2px; }
.user-menu { position: absolute; top: calc(100% + 9px); right: 0; z-index: 80; width: 170px; padding: 7px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: var(--shadow); }
.user-menu button { width: 100%; border: 0; border-radius: 8px; padding: 10px; background: transparent; text-align: left; }
.user-menu button:hover { background: var(--surface-soft); }

.main-content { min-height: 100vh; padding: 28px 30px 60px; outline: none; }
.page-loading { min-height: 160px; display: grid; place-content: center; justify-items: center; color: var(--muted); }
.spinner { width: 30px; height: 30px; border: 3px solid #d6e3df; border-top-color: var(--brand); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.page-skeleton { display: grid; gap: 14px; max-width: 960px; padding-top: 16px; }
.page-skeleton > *, .skeleton-grid > i { display: block; border-radius: 10px; background: linear-gradient(100deg,#edf1ef 12%,#f8faf8 38%,#edf1ef 62%); background-size: 200% 100%; animation: skeleton-shimmer 1.2s linear infinite; }
.skeleton-title { width: min(290px, 50%); height: 28px; }
.skeleton-copy { width: min(470px, 80%); height: 15px; }
.skeleton-toolbar { height: 44px; }
.skeleton-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; }
.skeleton-grid > i { min-height: 144px; }
@keyframes skeleton-shimmer { to { background-position-x: -200%; } }

.page-head { display: flex; align-items: flex-end; gap: 18px; margin-bottom: 22px; }
.page-head > div:first-child { margin-right: auto; }
.page-location { display: flex; align-items: center; gap: 9px; margin-bottom: 4px; }
.page-overline { margin: 0 0 4px !important; color: var(--brand) !important; font-size: 11px !important; font-weight: 800; letter-spacing: .08em; }
.page-location .page-overline { margin: 0 !important; }
.page-head h2 { margin: 0 0 5px; font-size: 25px; letter-spacing: -.02em; }
.page-head p { margin: 0; color: var(--muted); }
.page-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.dashboard-page-head { align-items: center; }
.dashboard-work-filter-head { display: flex; align-items: center; gap: 9px; margin-left: auto; }
.dashboard-work-filter-head strong { color: var(--ink); font-size: 14px; white-space: nowrap; }
.dashboard-work-scope { border-radius: 999px; padding: 4px 8px; color: var(--brand-dark); background: var(--brand-soft); font-size: 11px; font-weight: 800; white-space: nowrap; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.kpi-card { min-height: 128px; padding: 20px; border: 1px solid #e2e7e4; border-radius: var(--radius); background: var(--surface); box-shadow: 0 5px 18px rgba(24,44,39,.05); }
.kpi-card .label { color: var(--muted); font-size: 12px; font-weight: 700; }
.kpi-card .value { display: block; margin-top: 16px; font-size: clamp(24px, 3vw, 34px); font-weight: 850; letter-spacing: -.03em; }
.kpi-card .hint { margin-top: 7px; color: var(--muted); font-size: 11px; }
.kpi-card.emphasis { color: #fff; border-color: var(--brand); background: var(--brand); }
.kpi-card.emphasis .label, .kpi-card.emphasis .hint { color: #cce6df; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr); gap: 18px; }
.dashboard-workspace { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(280px, .85fr); gap: 18px; margin-bottom: 18px; }
.panel { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 5px 18px rgba(24,44,39,.04); }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 17px 19px; border-bottom: 1px solid var(--line); }
.panel-head h3 { margin: 0; font-size: 16px; }
.panel-head span { margin-left: auto; color: var(--muted); font-size: 11px; }
.panel-body { padding: 18px; }
.dashboard-task-list { display: grid; gap: 9px; }
.dashboard-task { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 70px; border: 1px solid var(--line); border-radius: 12px; padding: 12px 13px; color: var(--ink); background: var(--surface-soft); text-align: left; transition: .15s border-color, .15s background, .15s transform; }
.dashboard-task:hover { border-color: #b4d5ca; background: #f1f8f5; transform: translateY(-1px); }
.dashboard-task-copy { min-width: 0; margin-right: auto; }
.dashboard-task-copy strong, .dashboard-task-copy small { display: block; }
.dashboard-task-copy strong { font-size: 13px; }
.dashboard-task-copy small { margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.dashboard-task-action { flex: 0 0 auto; color: var(--brand-dark); font-size: 12px; font-weight: 800; white-space: nowrap; }
.dashboard-task-action b { margin-left: 3px; font-size: 16px; }
.dashboard-task-empty { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.dashboard-shortcuts { display: flex; flex-wrap: wrap; align-content: flex-start; gap: 9px; }
.workbench-hero { display: flex; align-items: center; gap: 24px; margin: -5px 0 18px; padding: 25px 27px; border-radius: 20px; color: #fff; background: linear-gradient(120deg, #123f36, #176b5b 65%, #31816f); box-shadow: 0 14px 32px rgba(20,68,58,.18); }
.workbench-hero > div:first-child { min-width: 0; margin-right: auto; }
.workbench-eyebrow { color: #c6e9df; font-size: 11px; font-weight: 850; letter-spacing: .13em; }
.workbench-hero h2 { margin: 6px 0 7px; font-size: clamp(23px, 3vw, 32px); letter-spacing: -.03em; }
.workbench-hero p { margin: 0; color: #d5e9e3; font-size: 13px; line-height: 1.55; }
.workbench-hero-actions { display: flex; flex: 0 0 auto; gap: 9px; }
.workbench-hero .button.primary { color: var(--brand-dark); background: #fff; }
.workbench-hero .button.ghost { color: #fff; border-color: rgba(255,255,255,.35); background: rgba(255,255,255,.08); }
.workbench-hero .button.primary:hover { color: var(--brand-dark); background: #e7f6f0; }
.workbench-hero .button.ghost:hover { color: #fff; border-color: rgba(255,255,255,.55); background: rgba(255,255,255,.18); }
.workflow-panel { margin-bottom: 18px; padding: 18px 20px 20px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255,255,255,.72); }
.workflow-heading { display: flex; align-items: flex-start; gap: 15px; margin-bottom: 14px; }
.workflow-heading > div { margin-right: auto; }
.workflow-heading h3 { margin: 0 0 4px; font-size: 15px; }
.workflow-heading p { margin: 0; color: #53645e; font-size: 12px; }
.workflow-heading > span { border-radius: 999px; padding: 5px 9px; color: var(--brand-dark); background: var(--brand-soft); font-size: 11px; font-weight: 800; }
.workflow-track { display: flex; align-items: stretch; overflow-x: auto; padding: 2px 1px 7px; scrollbar-width: thin; }
.workflow-stage { display: grid; flex: 1 0 132px; grid-template-columns: 30px minmax(78px, 1fr); grid-template-rows: auto auto; gap: 3px 8px; align-items: center; min-height: 75px; border: 1px solid var(--line); border-radius: 12px; padding: 10px; color: var(--ink); background: #fff; text-align: left; transition: .15s border-color, .15s transform; }
.workflow-stage:hover { border-color: #9bc7ba; transform: translateY(-1px); }
.workflow-number { display: grid; grid-row: 1 / 3; place-items: center; width: 30px; height: 30px; border-radius: 9px; color: var(--brand-dark); background: var(--brand-soft); font-size: 11px; font-weight: 900; }
.workflow-copy strong, .workflow-copy small { display: block; }
.workflow-copy strong { font-size: 12px; }
.workflow-copy small { margin-top: 2px; color: #53645e; font-size: 11px; }
.workflow-count { color: var(--warning); font-size: 11px; font-weight: 800; }
.workflow-done { color: var(--good); font-size: 11px; font-weight: 900; }
.workflow-connector { align-self: center; flex: 0 0 22px; color: #9aaba5; text-align: center; }
.workbench-primary { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(285px, .55fr); gap: 18px; margin-bottom: 18px; }
.workbench-focus { margin-bottom: 14px; }
.work-list-panel { min-height: 0; }
.work-list-head { align-items: flex-start; }
.work-list-head h3 { margin-bottom: 3px; }
.work-list-head small { color: #53645e; font-size: 12px; }
.work-list-scope { display: block; margin-bottom: 5px; color: var(--brand-dark); font-size: 11px; font-weight: 850; letter-spacing: .05em; }
.work-filters { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; margin-left: auto; }
.work-filters button { min-height: 34px; border: 0; border-radius: 8px; padding: 6px 10px; color: #53645e; background: var(--surface-soft); font-size: 12px; font-weight: 750; }
.work-filters button.active { color: #fff; background: var(--brand); }
.work-item-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 290px), 1fr)); gap: 12px; }
.work-item { display: grid; grid-template-columns: 6px minmax(0, 1fr) auto; grid-template-rows: auto 1fr auto; width: 100%; min-height: 154px; align-items: start; gap: 8px 11px; border: 1px solid var(--line); border-radius: 14px; padding: 14px; color: var(--ink); background: #fff; text-align: left; transition: .15s border-color, .15s background, .15s transform, .15s box-shadow; }
.work-item:hover { border-color: #a9cec2; background: #f8fcfa; transform: translateY(-1px); }
.work-item.overdue { border-color: #eccaca; background: #fffafa; }
.work-item-marker { grid-row: 1 / -1; align-self: stretch; width: 6px; border-radius: 999px; background: #95aaa3; }
.work-item-marker.approval { background: var(--accent); }
.work-item-marker.sales, .work-item-marker.fulfillment { background: var(--brand); }
.work-item-marker.purchase { background: #477aa3; }
.work-item-marker.invoice { background: #7a5aa8; }
.work-item-marker.cash { background: var(--good); }
.work-item-copy { grid-column: 2 / -1; min-width: 0; }
.work-item-heading { display: flex; align-items: center; gap: 7px; min-width: 0; }
.work-item-heading strong { min-width: 0; flex: 1; overflow: hidden; font-size: 14px; line-height: 1.45; text-overflow: ellipsis; }
.work-item-stage { flex: 0 0 auto; border-radius: 6px; padding: 4px 7px; color: var(--brand-dark); background: var(--brand-soft); font-size: 11px; font-weight: 850; }
.work-item-copy > small, .work-item-copy > em { display: block; margin-top: 4px; overflow: hidden; color: #53645e; font-size: 12px; font-style: normal; text-overflow: ellipsis; white-space: nowrap; }
.work-item-copy > small { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; white-space: normal; }
.work-item-copy > em { color: #5a6a64; }
.work-item-date { grid-column: 2; grid-row: 3; align-self: end; margin-top: 8px; color: #53645e; font-size: 11px; white-space: nowrap; }
.work-item-date.danger { color: var(--danger); font-weight: 800; }
.work-item .dashboard-task-action { grid-column: 3; grid-row: 3; align-self: end; }
.work-item[data-work-stage="approval"] { border-color: #efd7b3; background: #fffaf1; }
.work-item[data-work-stage="sales"], .work-item[data-work-stage="fulfillment"] { border-color: #c6e2d8; background: #f5fbf8; }
.work-item[data-work-stage="purchase"] { border-color: #cbdceb; background: #f4f8fc; }
.work-item[data-work-stage="invoice"] { border-color: #d9cdea; background: #faf7fd; }
.work-item[data-work-stage="cash"] { border-color: #c3e2d4; background: #f2fbf6; }
.work-item[data-work-stage="approval"] .work-item-stage { color: #8b5c1c; background: #ffedcf; }
.work-item[data-work-stage="purchase"] .work-item-stage { color: #315c80; background: #e1edf7; }
.work-item[data-work-stage="invoice"] .work-item-stage { color: #65478e; background: #eee5f8; }
.work-item[data-work-stage="cash"] .work-item-stage { color: #216b47; background: #dff2e8; }
.guide-intro { margin-bottom: 16px; padding: 15px 17px; border-radius: 13px; color: var(--brand-dark); background: var(--brand-soft); }
.guide-intro p { margin: 5px 0 0; color: #47645c; font-size: 12px; line-height: 1.6; }
.guide-flow-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.guide-flow { min-width: 0; border: 1px solid var(--line); border-radius: 14px; padding: 15px; background: #fff; }
.guide-flow-head { display: flex; gap: 10px; align-items: flex-start; }
.guide-flow-head > span { display: grid; flex: 0 0 auto; place-items: center; width: 31px; height: 31px; border-radius: 9px; color: #fff; background: var(--brand); font-weight: 900; }
.guide-flow h3 { margin: 0 0 4px; font-size: 14px; }
.guide-flow p { margin: 0; color: #53645e; font-size: 12px; line-height: 1.5; }
.guide-flow ol { margin: 15px 0 0; padding: 0; list-style: none; counter-reset: guide-step; }
.guide-flow li { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 7px; padding: 0 0 15px 26px; counter-increment: guide-step; }
.guide-flow li:not(:last-child)::after { content: ""; position: absolute; left: 8px; top: 18px; bottom: 2px; width: 1px; background: var(--line); }
.guide-flow li::before { content: counter(guide-step); position: absolute; left: 0; top: 0; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; color: var(--brand-dark); background: var(--brand-soft); font-size: 10px; font-weight: 900; }
.guide-flow li strong { font-size: 12px; }
.guide-flow li small { grid-column: 1; color: #53645e; font-size: 11px; line-height: 1.45; }
.guide-flow li button { grid-column: 2; grid-row: 1 / 3; align-self: center; min-height: 36px; border: 0; border-radius: 7px; padding: 6px 9px; color: var(--brand-dark); background: var(--surface-soft); font-size: 11px; font-weight: 800; }
.business-context-bar { display: flex; align-items: center; gap: 18px; margin-bottom: 16px; padding: 17px 20px; border-radius: var(--radius); color: #fff; background: linear-gradient(120deg, #153f36, #176b5b); }
.business-context-bar > div:first-child { min-width: 0; margin-right: auto; }
.business-context-bar span, .business-context-bar strong, .business-context-bar small { display: block; }
.business-context-bar > div:first-child > span { color: #d1eee5; font-size: 11px; font-weight: 850; letter-spacing: .1em; }
.business-context-bar > div:first-child > strong { margin-top: 5px; font-size: 16px; }
.business-context-bar > div:first-child > small { margin-top: 4px; color: #e2f2ed; font-size: 12px; }
.next-step-callout { display: grid; grid-template-columns: minmax(130px, 1fr) 22px; align-items: center; min-width: 230px; border: 1px solid rgba(255,255,255,.24); border-radius: 12px; padding: 10px 12px; color: #fff; background: rgba(255,255,255,.1); text-align: left; }
.next-step-callout span, .next-step-callout strong { grid-column: 1; }
.next-step-callout span { color: #d8eee7; font-size: 11px; }
.next-step-callout strong { margin-top: 3px; font-size: 14px; }
.next-step-callout b { grid-column: 2; grid-row: 1 / 3; font-size: 18px; }
.business-progress-panel { margin-bottom: 16px; }
.business-progress-panel .panel-head small { color: #53645e; font-size: 11px; }
.business-detail-progress { display: flex; align-items: center; overflow-x: auto; padding: 4px 2px 12px; }
.business-detail-progress > i { flex: 0 0 25px; color: #9aacA5; font-style: normal; text-align: center; }
.business-progress-step { display: flex; flex: 1 0 125px; align-items: center; gap: 8px; min-height: 55px; border: 1px solid var(--line); border-radius: 11px; padding: 9px; background: #fff; }
.business-progress-step > span { display: grid; flex: 0 0 auto; place-items: center; width: 25px; height: 25px; border-radius: 8px; color: #75837e; background: #edf1ef; font-size: 9px; font-weight: 900; }
.business-progress-step strong, .business-progress-step small { display: block; }
.business-progress-step strong { font-size: 12px; }
.business-progress-step small { margin-top: 3px; color: #53645e; font-size: 11px; }
.business-progress-step.done > span { color: #fff; background: var(--good); }
.business-progress-step.current { border-color: #9cc8bb; background: #f4fbf8; }
.business-progress-step.current > span { color: #fff; background: var(--brand); }
.business-progress-step.optional { border-style: dashed; opacity: .75; }
.business-relation-map { display: flex; align-items: stretch; overflow-x: auto; margin-top: 5px; padding: 14px 2px 2px; border-top: 1px solid var(--line); }
.business-relation-map > span { align-self: center; flex: 0 0 24px; color: #9ba8a4; text-align: center; }
.business-relation-node { display: grid; flex: 1 0 112px; align-content: center; min-height: 58px; border: 1px solid #dfe6e3; border-radius: 10px; padding: 9px; background: var(--surface-soft); }
.business-relation-node small, .business-relation-node strong { display: block; }
.business-relation-node small { color: #53645e; font-size: 11px; }
.business-relation-node strong { margin-top: 4px; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.business-relation-node.done { border-color: #add4c6; background: #f0f9f6; }
.business-summary-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.business-summary-grid article { min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.business-summary-grid span, .business-summary-grid strong { display: block; }
.business-summary-grid span { color: var(--muted); font-size: 9px; }
.business-summary-grid strong { margin-top: 7px; overflow: hidden; font-size: 17px; text-overflow: ellipsis; white-space: nowrap; }
.business-detail-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(310px, .7fr); gap: 16px; }
.business-detail-grid .panel-head { align-items: flex-start; }
.business-detail-grid .panel-head small { color: var(--muted); font-size: 9px; line-height: 1.4; }
.business-relations { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; align-content: start; }
.business-relation-group { min-width: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.business-relation-group > header { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface-soft); }
.business-relation-group h3 { margin: 0; font-size: 11px; }
.business-relation-group > header span { margin-left: auto; color: #53645e; font-size: 11px; }
.business-relation-group > div { display: grid; gap: 6px; padding: 8px; }
.relation-record { display: flex; width: 100%; min-height: 52px; align-items: center; gap: 8px; border: 0; border-radius: 9px; padding: 8px 9px; color: var(--ink); background: #fff; text-align: left; text-decoration: none; }
.relation-record:hover { background: #f3f9f6; }
.relation-record > span:first-child { min-width: 0; flex: 1; }
.relation-record strong, .relation-record small, .relation-record em { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.relation-record strong { font-size: 12px; }
.relation-record small { margin-top: 3px; color: #53645e; font-size: 11px; }
.relation-record em { margin-top: 3px; color: #53645e; font-size: 11px; font-style: normal; }
.relation-empty { margin: 0; padding: 12px; color: #53645e; font-size: 12px; line-height: 1.5; }
.business-timeline { position: relative; display: grid; gap: 4px; }
.business-timeline::before { content: ""; position: absolute; top: 20px; bottom: 20px; left: 9px; width: 1px; background: var(--line); }
.timeline-event { position: relative; display: flex; width: 100%; align-items: flex-start; gap: 10px; border: 0; border-radius: 10px; padding: 8px 4px; color: var(--ink); background: transparent; text-align: left; }
.timeline-event:hover { background: var(--surface-soft); }
.timeline-event > i { position: relative; z-index: 1; flex: 0 0 auto; width: 19px; height: 19px; border: 4px solid #fff; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 1px var(--line); }
.timeline-event > i.purchase { background: #477aa3; }
.timeline-event > i.invoice { background: #7a5aa8; }
.timeline-event > i.cash { background: var(--good); }
.timeline-event > i.inventory { background: var(--accent); }
.timeline-event > span { min-width: 0; flex: 1; }
.timeline-event small, .timeline-event strong, .timeline-event em { display: block; }
.timeline-event small { color: #53645e; font-size: 11px; }
.timeline-event strong { margin-top: 2px; font-size: 12px; }
.timeline-event em { margin-top: 2px; overflow: hidden; color: #53645e; font-size: 11px; font-style: normal; text-overflow: ellipsis; white-space: nowrap; }
.document-business-context { display: flex; align-items: center; gap: 12px; margin: 16px 0; padding: 12px 14px; border: 1px solid #b9d9cf; border-radius: 12px; background: #eff8f5; }
.document-business-context > div { min-width: 0; margin-right: auto; }
.document-business-context strong, .document-business-context small { display: block; }
.document-business-context strong { color: var(--brand-dark); font-size: 13px; }
.document-business-context small { margin-top: 3px; color: #53645e; font-size: 11px; }
.document-business-journey { margin: 18px 0; border: 1px solid #b9d9cf; border-radius: 13px; background: #f7fcfa; overflow: hidden; }
.document-business-journey > summary { display: flex; align-items: center; gap: 12px; padding: 13px 15px; cursor: pointer; list-style: none; }
.document-business-journey > summary::-webkit-details-marker { display: none; }
.document-business-journey > summary > span { min-width: 0; margin-right: auto; }
.document-business-journey > summary strong, .document-business-journey > summary small { display: block; }
.document-business-journey > summary strong { color: var(--brand-dark); font-size: 13px; }
.document-business-journey > summary small { margin-top: 3px; color: #53645e; font-size: 11px; }
.document-business-journey > summary b { color: var(--brand); font-size: 17px; transition: transform .16s ease; }
.document-business-journey:not([open]) > summary b { transform: rotate(-90deg); }
.document-business-journey-body { display: grid; gap: 14px; padding: 0 14px 14px; border-top: 1px solid #d6e9e3; }
.document-business-next { display: flex; align-items: center; gap: 13px; padding: 12px 0 0; }
.document-business-next > div { min-width: 0; margin-right: auto; }
.document-business-next span, .document-business-next strong, .document-business-next small { display: block; }
.document-business-next span { color: #53645e; font-size: 11px; }
.document-business-next strong { margin-top: 3px; color: var(--brand-dark); font-size: 14px; }
.document-business-next small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.document-business-quick-actions { display: flex; flex-wrap: wrap; gap: 7px; margin: 0 14px 14px; }
.document-business-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.document-business-journey .business-progress-panel { margin: 0; border: 0; background: transparent; box-shadow: none; }
.document-business-journey .business-progress-panel .panel-body { padding: 0; }
.document-business-detail-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(250px, .75fr); gap: 13px; }
.document-business-detail-grid > section { min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: #fff; }
.document-business-detail-grid h3 { margin: 0 0 10px; color: var(--brand-dark); font-size: 12px; }
.document-business-detail-grid .business-timeline { max-height: 290px; overflow: auto; }
.document-business-journey-head { padding: 13px 15px 0; }
.document-business-journey-head strong, .document-business-journey-head small { display: block; }
.document-business-journey-head strong { color: var(--brand-dark); font-size: 13px; }
.document-business-journey-head small { margin-top: 3px; color: #53645e; font-size: 11px; line-height: 1.45; }
.document-business-journey > .document-business-next { margin: 11px 14px 14px; padding: 0; }
.document-business-details { border-top: 1px solid #d6e9e3; background: rgba(255,255,255,.46); }
.document-business-details > summary { display: flex; min-height: 44px; align-items: center; cursor: pointer; padding: 0 14px; color: #47645c; font-size: 12px; font-weight: 800; list-style: none; }
.document-business-details > summary::-webkit-details-marker { display: none; }
.document-business-details > summary::after { content: "⌄"; margin-left: auto; color: var(--muted); font-size: 14px; transition: transform .16s ease; }
.document-business-details[open] > summary { color: var(--brand-dark); background: rgba(238,248,244,.7); }
.document-business-details[open] > summary::after { transform: rotate(180deg); }
.document-business-details-body { display: grid; gap: 14px; padding: 0 14px 14px; }
.document-business-details.document-business-actions { display: block; }
.document-business-actions > div { display: flex; flex-wrap: wrap; gap: 7px; padding: 0 14px 14px; }
.metric-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.metric-strip > div { padding: 16px; border-radius: 12px; background: var(--surface-soft); }
.metric-strip strong, .metric-strip span { display: block; }
.metric-strip strong { margin-top: 8px; font-size: 20px; }
.metric-strip span { color: var(--muted); font-size: 11px; }

.period-overview { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; margin: -3px 0 18px; }
.period-overview article { min-width: 0; padding: 17px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: 0 5px 18px rgba(24,44,39,.04); }
.period-overview span, .period-overview strong, .period-overview small { display: block; }
.period-overview span, .period-overview small { color: var(--muted); font-size: 11px; }
.period-overview strong { overflow: hidden; margin: 7px 0 5px; font-size: 20px; text-overflow: ellipsis; white-space: nowrap; }
.period-table-body { overflow-x: auto; }

.analytics-filter { margin: -4px 0 20px; padding: 15px 17px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255,255,255,.72); }
.analytics-filter-top { display: flex; align-items: center; gap: 12px; }
.analytics-presets { display: flex; flex: 1; flex-wrap: wrap; gap: 7px; }
.analytics-scope { display: inline-flex; align-items: center; min-height: 30px; border-radius: 999px; padding: 5px 10px; color: var(--brand-dark); background: var(--brand-soft); font-size: 11px; font-weight: 800; white-space: nowrap; }
.analytics-range-form { display: flex; align-items: end; flex-wrap: wrap; gap: 10px; margin-top: 13px; padding-top: 13px; border-top: 1px solid var(--line); }
.analytics-range-form label { width: 154px; margin: 0; }
.analytics-range-form input { min-height: 39px; padding: 7px 10px; }
.analytics-range-form small { align-self: center; color: var(--muted); font-size: 11px; }
.analytics-kpi-grid, .analytics-status-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; }
.analytics-kpi { display: flex; min-height: 138px; flex-direction: column; padding: 19px; border: 1px solid #e2e7e4; border-radius: var(--radius); background: var(--surface); box-shadow: 0 5px 18px rgba(24,44,39,.05); }
.analytics-kpi .label { color: var(--muted); font-size: 12px; font-weight: 750; }
.analytics-kpi .value { display: block; margin-top: 13px; font-size: clamp(22px, 2.7vw, 31px); font-variant-numeric: tabular-nums; letter-spacing: -.035em; }
.analytics-kpi .hint { min-height: 17px; margin-top: auto; color: var(--muted); font-size: 11px; line-height: 1.45; }
.analytics-change { margin-top: 4px; font-size: 11px; font-weight: 750; }
.analytics-change.positive { color: var(--good); }
.analytics-change.negative { color: var(--danger); }
.analytics-change.neutral { color: var(--muted); }
.analytics-kpi.emphasis { color: #fff; border-color: var(--brand); background: var(--brand); }
.analytics-kpi.emphasis .label, .analytics-kpi.emphasis .hint { color: #cce6df; }
.analytics-kpi.emphasis .analytics-change { color: #e0f3ed; }
.analytics-kpi.is-unavailable .value { color: var(--muted); }
.analytics-status-section { margin-top: 22px; }
.analytics-status-section .section-title { margin-bottom: 12px; }
.analytics-status-grid .analytics-kpi { min-height: 118px; padding: 16px; box-shadow: none; background: var(--surface-soft); }
.analytics-status-grid .analytics-kpi .value { margin-top: 10px; font-size: 24px; }
.analytics-chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 22px; }
.analytics-chart-panel .panel-head, .analytics-ranking .panel-head, .analytics-projects .panel-head { align-items: flex-start; }
.analytics-chart-panel .panel-head h3, .analytics-ranking .panel-head h3, .analytics-projects .panel-head h3 { margin-bottom: 4px; }
.analytics-chart-panel .panel-head small, .analytics-ranking .panel-head small, .analytics-projects .panel-head small { color: var(--muted); font-size: 11px; line-height: 1.45; }
.analytics-chart-panel .panel-body { padding: 8px 10px 10px; }
.analytics-chart { display: block; width: 100%; height: auto; overflow: visible; }
.analytics-grid-line { stroke: #e5ebe8; stroke-width: 1; }
.analytics-axis-label { fill: #7a8883; font-size: 10px; }
.analytics-legend { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; margin-left: auto; color: var(--muted); font-size: 11px; }
.analytics-legend span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.analytics-legend i { width: 8px; height: 8px; border-radius: 50%; }
.analytics-insight-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-top: 18px; }
.analytics-ranking-list { display: grid; gap: 14px; }
.analytics-ranking-row { display: flex; align-items: flex-start; gap: 10px; }
.analytics-rank-no { display: inline-grid; place-items: center; flex: 0 0 auto; width: 22px; height: 22px; border-radius: 7px; color: var(--brand-dark); background: var(--brand-soft); font-size: 11px; font-weight: 850; }
.analytics-ranking-main { min-width: 0; flex: 1; }
.analytics-ranking-main > div:first-child { display: flex; align-items: baseline; gap: 7px; justify-content: space-between; }
.analytics-ranking-main strong { display: block; min-width: 0; flex: 1 1 auto; overflow: hidden; color: #293631; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.analytics-ranking-main small { min-width: 0; flex: 0 1 58%; color: var(--muted); font-size: 10px; overflow-wrap: anywhere; text-align: right; }
.analytics-bar { height: 8px; margin-top: 7px; overflow: hidden; border-radius: 999px; background: #e2eae6; }
.analytics-bar i { display: block; height: 100%; border-radius: inherit; background: var(--brand); }
.analytics-bar.is-negative { background: #f1d7d7; }
.analytics-bar.is-empty i { width: 0 !important; }
.analytics-no-data { margin: 4px 0; color: var(--muted); font-size: 13px; }
.analytics-projects { margin-top: 18px; }
.analytics-projects .panel-body { padding: 0; }
.analytics-projects .table-shell { border: 0; border-radius: 0; }
.analytics-risk-grid { margin-top: 18px; }
.analytics-custom-range { margin-top: 12px; border-top: 1px solid var(--line); }
.analytics-custom-range > summary { display: flex; min-height: 38px; align-items: center; cursor: pointer; color: #53645e; font-size: 12px; font-weight: 750; list-style: none; }
.analytics-custom-range > summary::-webkit-details-marker { display: none; }
.analytics-custom-range > summary::after { content: "⌄"; margin-left: 6px; color: var(--muted); font-size: 14px; }
.analytics-custom-range[open] > summary { color: var(--brand-dark); }
.analytics-custom-range[open] > summary::after { content: "⌃"; }
.analytics-deep-dive { margin-top: 18px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 5px 18px rgba(24,44,39,.04); }
.analytics-deep-dive > summary { display: flex; min-height: 64px; align-items: center; gap: 12px; cursor: pointer; padding: 13px 17px; list-style: none; }
.analytics-deep-dive > summary::-webkit-details-marker { display: none; }
.analytics-deep-dive > summary > span { min-width: 0; margin-right: auto; }
.analytics-deep-dive summary strong, .analytics-deep-dive summary small { display: block; }
.analytics-deep-dive summary strong { color: var(--ink); font-size: 13px; }
.analytics-deep-dive summary small { margin-top: 3px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.analytics-deep-dive > summary::after { content: "⌄"; color: var(--muted); font-size: 16px; transition: transform .16s ease; }
.analytics-deep-dive[open] > summary { border-bottom: 1px solid var(--line); background: #fbfdfc; }
.analytics-deep-dive[open] > summary::after { transform: rotate(180deg); }
.analytics-deep-dive-body { padding: 0 17px 17px; }
.analytics-deep-dive-body .analytics-status-section { margin-top: 18px; }
.analytics-alert-list { display: grid; gap: 9px; }
.analytics-alert { display: flex; align-items: center; gap: 15px; padding: 12px 13px; border: 1px solid var(--line); border-left: 4px solid var(--warning); border-radius: 11px; background: var(--surface-soft); }
.analytics-alert.danger { border-left-color: var(--danger); background: #fff9f8; }
.analytics-alert > div:first-child { min-width: 0; margin-right: auto; }
.analytics-alert strong, .analytics-alert small { display: block; }
.analytics-alert > div:first-child strong { font-size: 13px; }
.analytics-alert small { margin-top: 3px; color: var(--muted); font-size: 10px; line-height: 1.4; }
.analytics-alert-value { flex: 0 0 auto; text-align: right; font-variant-numeric: tabular-nums; }
.analytics-alert-value strong { font-size: 14px; }
.analytics-alert-empty { padding: 24px 10px; color: var(--good); text-align: center; font-size: 13px; }
.analytics-definitions ul { display: grid; gap: 10px; margin: 0; padding-left: 19px; color: var(--muted); font-size: 12px; line-height: 1.6; }

.section-kicker { margin: 0 0 5px; color: var(--brand); font-size: 10px; font-weight: 850; letter-spacing: .13em; }
.project-overview-hero { display: grid; grid-template-columns: 1fr; gap: 18px; margin: 0 0 18px; }
.project-overview-hero.has-quick-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; }
.project-hero-column { display: flex; min-width: 0; }
.project-hero-column.has-workflow { display: grid; align-content: start; gap: 18px; }
.project-hero-column .project-workflow-panel { margin: 0; }
.project-hero-main { position: relative; flex: 1 1 auto; overflow: hidden; min-height: 286px; padding: 24px; border: 1px solid #cfe1da; border-radius: 20px; background: linear-gradient(135deg, #fbfdfc 0%, #f0f8f5 62%, #e2f0eb 100%); box-shadow: 0 10px 28px rgba(18, 64, 53, .08); }
.project-hero-main::after { content: ""; position: absolute; right: -74px; bottom: -118px; width: 280px; height: 280px; border: 36px solid rgba(23,107,91,.06); border-radius: 50%; pointer-events: none; }
.project-hero-topline { position: relative; z-index: 1; display: flex; align-items: center; gap: 9px; }
.project-code { color: var(--brand-dark); font-size: 12px; font-weight: 850; letter-spacing: .08em; }
.project-hero-summary { position: relative; z-index: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 23px; }
.project-hero-summary > div { display: grid; align-content: start; gap: 4px; min-width: 0; }
.project-hero-label, .project-hero-summary small { color: var(--muted); font-size: 10px; font-weight: 700; }
.project-hero-summary strong { overflow: hidden; color: #1d332d; font-size: 15px; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.project-hero-summary small { font-weight: 500; }
.project-hero-metrics { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; margin-top: 24px; border: 1px solid rgba(146, 191, 176, .55); border-radius: 13px; background: rgba(255,255,255,.76); backdrop-filter: blur(7px); }
.project-hero-metric { min-width: 0; padding: 13px 15px; border-right: 1px solid rgba(146, 191, 176, .45); }
.project-hero-metric:last-child { border-right: 0; }
.project-hero-metric span, .project-hero-metric small { display: block; color: var(--muted); font-size: 10px; }
.project-hero-metric strong { display: block; overflow: hidden; margin: 6px 0 4px; color: #183a31; font-size: clamp(18px, 2vw, 23px); font-variant-numeric: tabular-nums; letter-spacing: -.035em; text-overflow: ellipsis; white-space: nowrap; }
.project-hero-metric strong.negative { color: var(--danger); }
.project-hero-metric .rate-value { color: inherit; }
.project-hero-access-note { position: relative; z-index: 1; display: grid; gap: 4px; margin-top: 25px; border-left: 3px solid #8cbcab; padding: 7px 0 7px 12px; }
.project-hero-access-note strong { font-size: 13px; }
.project-hero-access-note span { color: var(--muted); font-size: 11px; line-height: 1.5; }
.project-focus-panel { display: flex; flex-direction: column; min-width: 0; border: 1px solid #d7e3de; border-radius: 20px; padding: 20px; background: #fff; box-shadow: 0 8px 25px rgba(24,44,39,.06); }
.project-focus-head { display: flex; align-items: flex-start; gap: 12px; }
.project-focus-head > div { min-width: 0; margin-right: auto; }
.project-focus-head h3 { margin: 0 0 4px; color: #22342e; font-size: 18px; }
.project-focus-head small { display: block; color: var(--muted); font-size: 11px; line-height: 1.5; }
.project-focus-count { display: grid; flex: 0 0 auto; place-items: center; min-width: 31px; height: 31px; border-radius: 10px; padding: 0 8px; color: #85500f; background: var(--warning-soft); font-size: 13px; font-weight: 850; font-variant-numeric: tabular-nums; }
.project-attention-list { display: grid; gap: 7px; margin: 16px 0; }
.project-attention-item { display: grid; grid-template-columns: minmax(0, 1fr) auto 14px; align-items: center; gap: 9px; width: 100%; border: 1px solid transparent; border-radius: 10px; padding: 9px 10px; color: #44544e; background: var(--surface-soft); font-size: 11px; text-align: left; transition: .16s border-color, .16s background, .16s transform; }
.project-attention-item:hover { border-color: #b8d7cc; background: #f2f9f6; transform: translateX(2px); }
.project-attention-item strong { color: var(--brand-dark); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.project-attention-item i { color: #71958a; font-size: 15px; font-style: normal; text-align: right; }
.project-all-clear { margin: auto 0 16px; border-radius: 11px; padding: 13px; color: var(--good); background: #edf8f1; font-size: 12px; font-weight: 750; line-height: 1.5; }
.project-action-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); }
.project-action-buttons .button { flex: 1 1 135px; }
.project-workflow-panel { margin: 0 0 18px; border: 1px solid var(--line); border-radius: 18px; padding: 19px; background: #fff; box-shadow: 0 5px 18px rgba(24,44,39,.04); }
.project-section-heading { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 14px; }
.project-section-heading > div { min-width: 0; margin-right: auto; }
.project-section-heading h3 { margin: 0; color: #22342e; font-size: 18px; }
.project-section-heading p:not(.section-kicker) { margin: 4px 0 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.project-workflow-total { flex: 0 0 auto; border-radius: 999px; padding: 6px 10px; color: var(--brand-dark); background: var(--brand-soft); font-size: 11px; font-weight: 800; white-space: nowrap; }
.project-stage-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.project-stage { position: relative; display: grid; grid-template-columns: 18px minmax(0, 1fr) 14px; align-items: start; gap: 7px; min-width: 0; min-height: 103px; border: 1px solid #d9e4df; border-radius: 12px; padding: 11px; color: #2c3f38; background: #fff; text-align: left; transition: .16s border-color, .16s box-shadow, .16s transform; }
.project-stage:hover { border-color: #9fc9ba; box-shadow: 0 6px 17px rgba(31,91,75,.1); transform: translateY(-2px); }
.project-stage-number { color: #7d938b; font-size: 10px; font-weight: 850; line-height: 1.8; }
.project-stage-copy { display: grid; gap: 3px; min-width: 0; }
.project-stage-copy > span { color: #53645e; font-size: 11px; font-weight: 750; }
.project-stage-copy strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.project-stage-copy small { color: var(--muted); font-size: 10px; line-height: 1.35; }
.project-stage-arrow { align-self: center; color: #7c938a; font-size: 15px; }
.project-stage.attention { border-color: #e8cf9f; background: #fffcf5; }
.project-stage.attention .project-stage-copy strong { color: #8d5910; }
.project-stage.ready { border-color: #bed9cd; background: #f8fcfa; }
.project-stage.ready .project-stage-copy strong { color: var(--good); }
.project-stage.empty { border-style: dashed; background: #fbfcfb; }
.project-overview-panel, .project-contract-grid, .project-finance-section { scroll-margin-top: 98px; }
.project-overview-tabs, .inventory-tabs { display: inline-flex; align-items: center; gap: 3px; max-width: 100%; margin: 0 0 14px; overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; padding: 4px; background: #fff; }
.project-overview-tabs button, .inventory-tabs button { display: inline-flex; min-height: 34px; align-items: center; gap: 7px; border: 0; border-radius: 7px; padding: 7px 12px; color: var(--muted); background: transparent; font-size: 12px; font-weight: 800; white-space: nowrap; }
.project-overview-tabs button:hover, .inventory-tabs button:hover { color: var(--brand); background: #f1f8f5; }
.project-overview-tabs button.active, .inventory-tabs button.active { color: #fff; background: var(--brand); box-shadow: 0 2px 5px rgba(20, 89, 73, .18); }
.inventory-tabs { margin-bottom: 16px; }
.inventory-tabs button span { display: inline-grid; min-width: 18px; place-items: center; border-radius: 999px; padding: 1px 5px; color: inherit; background: rgba(23,107,91,.1); font-size: 10px; }
.inventory-tabs button.active span { background: rgba(255,255,255,.18); }
.project-overview-panel { margin-top: 18px; }
.project-overview-tabs + .project-overview-panel { margin-top: 0; }
.project-overview-panel .panel-head, .project-contract-grid .panel-head, .project-finance-grid .panel-head { align-items: flex-start; }
.project-overview-panel .panel-head h3, .project-contract-grid .panel-head h3, .project-finance-grid .panel-head h3 { margin-bottom: 4px; }
.project-overview-panel .panel-head small, .project-contract-grid .panel-head small, .project-finance-grid .panel-head small { color: var(--muted); font-size: 11px; line-height: 1.45; }
.project-overview-panel .section-kicker, .project-contract-grid .section-kicker { margin-bottom: 4px; }
.panel-head-actions { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-left: 12px; }
.panel-head-actions > span { color: var(--muted); font-size: 11px; white-space: nowrap; }
.project-table-body { padding: 0; }
.project-table-body .table-shell { border: 0; border-radius: 0; }
.project-contract-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 18px; }
.project-finance-section { margin-top: 24px; }
.project-finance-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 18px; }
.project-cost-panel { grid-column: span 5; }
.project-expense-panel { grid-column: span 3; }
.project-cash-panel { grid-column: span 4; }
.project-cost-strip, .project-cash-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.project-cost-strip > div:last-child { grid-column: span 2; border: 1px solid #cce2d9; background: #eef8f4; }
.project-cash-strip > div { padding: 12px; }
.project-cash-strip strong { font-size: 17px; }
.project-page-action-cluster { display: contents; }
.project-lifecycle-menu { position: relative; }
.project-lifecycle-menu > summary { display: inline-flex; min-height: 42px; align-items: center; cursor: pointer; border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; color: #51615b; background: #fff; font-size: 13px; font-weight: 750; list-style: none; }
.project-lifecycle-menu > summary::-webkit-details-marker { display: none; }
.project-lifecycle-menu > summary::after { content: "⌄"; margin-left: 7px; color: var(--muted); font-size: 14px; }
.project-lifecycle-menu[open] > summary { border-color: #9fcdbd; color: var(--brand-dark); background: #f2f9f6; }
.project-lifecycle-menu > div { position: absolute; top: calc(100% + 7px); right: 0; z-index: 12; display: grid; min-width: 126px; gap: 6px; padding: 7px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: var(--shadow); }
.project-lifecycle-menu .button { width: 100%; justify-content: flex-start; white-space: nowrap; }
.project-link-stack { display: grid; gap: 5px; min-width: 180px; }
.project-link-stack > div { display: flex; flex-wrap: wrap; gap: 4px; }
.project-link-chip { display: inline-flex; max-width: 100%; overflow: hidden; border-radius: 999px; padding: 3px 7px; color: var(--brand-dark); background: var(--brand-soft); font-size: 10px; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }
a.project-link-chip:hover { background: #d7eee6; text-decoration: underline; }
.execution-status { display: grid; gap: 4px; color: var(--muted); font-size: 11px; }
.execution-quantity { color: var(--muted); line-height: 1.35; }
.execution-quantity.over-linked { color: var(--warning); font-weight: 750; }
.rate-value { font-variant-numeric: tabular-nums; }
.rate-value.negative { color: var(--danger); }
.rate-value.warning { color: var(--warning); }
.project-bom-table td { vertical-align: top; }
.project-purchase-bom-list { display: grid; max-height: 300px; gap: 8px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; padding: 10px; background: var(--surface-soft); }
.project-purchase-bom-option { display: flex; align-items: flex-start; gap: 9px; margin: 0; border: 1px solid transparent; border-radius: 9px; padding: 8px; cursor: pointer; }
.project-purchase-bom-option:hover { border-color: #bddace; background: #fff; }
.project-purchase-bom-option input { width: 17px; height: 17px; min-height: 0; margin: 1px 0 0; accent-color: var(--brand); }
.project-purchase-bom-option span { display: grid; gap: 3px; min-width: 0; }
.project-purchase-bom-option strong { overflow: hidden; color: #31413b; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.project-purchase-bom-option small { color: var(--muted); font-size: 10px; line-height: 1.35; }
button.project-link-chip { border: 0; font-family: inherit; text-align: left; cursor: pointer; }
button.project-link-chip:hover { background: #d7eee6; text-decoration: underline; }
.text-link { color: var(--brand-dark); font-weight: 750; text-decoration: none; }
.text-link:hover { text-decoration: underline; }
button.text-link { border: 0; padding: 0; color: var(--brand-dark); background: transparent; font: inherit; font-weight: 750; text-align: left; }

.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.list-meta { color: var(--muted); font-size: 11px; line-height: 1.4; }
.search-box { position: relative; flex: 1 1 260px; max-width: 460px; }
.search-box input { padding-left: 38px; margin: 0; }
.search-box::before { content: "⌕"; position: absolute; left: 13px; top: 10px; color: var(--muted); font-size: 20px; }
.toolbar select { width: auto; min-width: 130px; }
.batch-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: -2px 0 14px; padding: 10px 12px; border: 1px solid #b9d8ce; border-radius: 12px; background: #eff9f5; }
.batch-toolbar-count { color: var(--brand-dark); font-size: 12px; font-weight: 800; }
.batch-toolbar-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.selection-head, .batch-selection-cell { width: 42px; min-width: 42px; padding-right: 6px; padding-left: 12px; text-align: center; }
.selection-head input, .batch-selection-cell input, .batch-card-select input { width: 17px; height: 17px; min-height: 0; margin: 0; accent-color: var(--brand); cursor: pointer; }
.batch-selection-cell .muted { color: var(--muted); font-size: 10px; white-space: nowrap; }
.approval-separation-note { display: inline-flex; align-items: center; min-height: 28px; margin: 0; color: #7a5d16; font-size: 11px; font-weight: 750; white-space: nowrap; }
.batch-card-select { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 10px; font-weight: 750; cursor: pointer; }
.page-action-menu { position: relative; }
.page-action-menu > summary { display: inline-flex; min-height: 39px; align-items: center; cursor: pointer; border: 1px solid var(--line); border-radius: 9px; padding: 0 12px; color: #51615b; background: #fff; font-size: 12px; font-weight: 750; list-style: none; }
.page-action-menu > summary::-webkit-details-marker { display: none; }
.page-action-menu > summary::after { content: "⌄"; margin-left: 7px; color: var(--muted); font-size: 14px; }
.page-action-menu[open] > summary { border-color: #9fcdbd; color: var(--brand-dark); background: #f2f9f6; }
.page-action-menu-panel { position: absolute; top: calc(100% + 7px); right: 0; z-index: 5; display: grid; min-width: 140px; gap: 6px; padding: 7px; border: 1px solid var(--line); border-radius: 11px; background: #fff; box-shadow: var(--shadow); white-space: nowrap; }
.page-action-menu-panel .button { justify-content: flex-start; }
.compact-filters { position: relative; flex: 0 0 auto; }
.compact-filters > summary { display: inline-flex; min-height: 39px; align-items: center; cursor: pointer; border: 1px solid var(--line); border-radius: 9px; padding: 0 12px; color: #51615b; background: #fff; font-size: 12px; font-weight: 750; list-style: none; }
.compact-filters > summary::-webkit-details-marker { display: none; }
.compact-filters > summary::after { content: "⌄"; margin-left: 7px; color: var(--muted); font-size: 14px; }
.compact-filters[open] > summary { border-color: #9fcdbd; color: var(--brand-dark); background: #f2f9f6; }
.compact-filters[open] > summary::after { content: "⌃"; }
.compact-filter-panel { position: absolute; top: calc(100% + 7px); right: 0; z-index: 4; display: grid; width: max-content; min-width: 176px; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: var(--shadow); }
.compact-filter-panel select { width: 100%; min-width: 190px; }
.purchase-filter-controls, .sales-filter-controls { display: flex; flex: 1 1 520px; flex-wrap: wrap; gap: 8px; }
.purchase-filter-controls select, .sales-filter-controls select { flex: 1 1 150px; min-width: 150px; }
.document-list-scope-controls { align-items: end; }
.document-list-scope-controls label { display: grid; flex: 0 1 180px; gap: 4px; color: var(--muted); font-size: 10px; font-weight: 750; }
.document-list-scope-controls label select { min-width: 150px; }

.document-list { margin-top: 2px; }
.document-list-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 12px; }
.document-list-head .list-pagination { margin: 0; }
.purchase-card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.purchase-card { position: relative; min-width: 0; border: 1px solid var(--line); border-radius: 15px; background: #fff; box-shadow: 0 4px 14px rgba(24,44,39,.035); overflow: visible; transition: .15s border-color, .15s box-shadow, .15s transform; }
.document-card { display: flex; flex-direction: column; height: 100%; }
.purchase-card:hover { border-color: #b7d6cc; box-shadow: 0 9px 24px rgba(24,44,39,.075); transform: translateY(-1px); }
.purchase-card-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 8px; padding: 11px 13px 8px; }
.purchase-card-reference { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; min-width: 0; gap: 8px; }
.purchase-card-head-meta { display: flex; align-items: flex-start; justify-content: flex-end; min-width: 0; gap: 8px; }
.purchase-card-head-badges { display: flex; flex: 0 0 auto; flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
.purchase-card-head-badges .badge { min-height: 22px; padding: 3px 7px; font-size: 10px; }
.purchase-card-number { min-width: 0; overflow: hidden; color: var(--brand-dark); font-size: 13px; font-weight: 850; text-align: left; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }
.purchase-card-number:hover { text-decoration: underline; }
.purchase-card-date { color: var(--muted); font-size: 10px; white-space: nowrap; }
.purchase-card-body { display: grid; flex: 1; grid-template-columns: minmax(0, 1fr) auto; align-content: start; gap: 9px 13px; padding: 0 13px 10px; }
.purchase-card-body.document-card-restricted { grid-template-columns: minmax(0, 1fr); }
.purchase-card-party { min-width: 0; }
.purchase-card-party strong, .purchase-card-party span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.purchase-card-party strong { color: #2b3934; font-size: 15px; }
.purchase-card-party span { margin-top: 3px; color: var(--muted); font-size: 10px; }
.purchase-card-amount { align-self: start; min-width: 108px; text-align: right; }
.purchase-card-amount span, .purchase-card-amount strong { display: block; }
.purchase-card-amount span, .purchase-card-next > span { color: var(--muted); font-size: 10px; }
.purchase-card-amount strong { margin-top: 2px; color: #273832; font-size: 16px; font-variant-numeric: tabular-nums; }
.document-card-finance { display: flex; grid-column: 1 / -1; flex-wrap: wrap; gap: 6px 12px; padding-top: 1px; color: #5d6c66; font-size: 10px; font-weight: 750; }
.document-card-finance span { white-space: nowrap; }
.purchase-card-next { display: grid; grid-column: 1 / -1; grid-template-columns: 42px minmax(0, 1fr); align-items: baseline; gap: 8px; padding: 7px 9px; border-radius: 9px; background: var(--surface-soft); }
.purchase-card-next strong { overflow: hidden; color: #3a4b45; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.purchase-card-footer { display: flex; align-items: center; gap: 10px; margin-top: auto; padding: 8px 13px; border-top: 1px solid var(--line); background: #fcfdfc; }
.purchase-card-footer .purchase-card-next { flex: 1; grid-column: auto; min-width: 0; }
.purchase-card-actions { display: flex; flex: 0 0 auto; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; }
.card-action-menu { position: relative; flex: 0 0 auto; }
.card-action-menu > summary { display: inline-flex; min-height: 32px; align-items: center; cursor: pointer; border: 1px solid var(--line); border-radius: 8px; padding: 0 9px; color: #51615b; background: #fff; font-size: 11px; font-weight: 750; list-style: none; }
.card-action-menu > summary::-webkit-details-marker { display: none; }
.card-action-menu > summary::after { content: "⌄"; margin-left: 5px; color: var(--muted); font-size: 12px; }
.card-action-menu[open] > summary { border-color: #9fcdbd; color: var(--brand-dark); background: #f2f9f6; }
.card-action-menu[open] > summary::after { content: "⌃"; }
.card-action-menu > div { position: absolute; right: 0; bottom: calc(100% + 7px); z-index: 5; display: grid; min-width: 132px; gap: 6px; padding: 7px; border: 1px solid var(--line); border-radius: 11px; background: #fff; box-shadow: var(--shadow); white-space: nowrap; }
.card-action-menu .button { justify-content: flex-start; }
.cell-actions .table-action-menu > div { top: calc(100% + 7px); bottom: auto; }
.document-card-alert { margin: 0; border-top: 1px solid #f1dfb5; padding: 7px 13px; color: #7a5d16; background: #fffaf0; font-size: 11px; line-height: 1.4; }
.restricted-document-detail { display: grid; gap: 14px; }
.restricted-document-detail > .form-note { margin: 0; }
.restricted-document-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.restricted-document-facts > div { display: grid; gap: 4px; min-width: 0; padding: 10px 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); }
.restricted-document-facts span { color: var(--muted); font-size: 10px; font-weight: 750; }
.restricted-document-facts strong { overflow: hidden; color: #31413b; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.restricted-document-items { border: 1px solid var(--line); border-radius: 11px; padding: 11px 12px; background: #fff; }
.restricted-document-items h3 { margin: 0 0 8px; color: #41524c; font-size: 13px; }
.restricted-document-items ul { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
.restricted-document-items li { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; min-width: 0; color: #34433e; font-size: 12px; }
.restricted-document-items li strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.restricted-document-items li span { flex: 0 0 auto; color: var(--muted); }
.express-tracking-panel { margin-top: 18px; border: 1px solid #cfe2dc; border-radius: 14px; overflow: hidden; background: #f8fcfa; }
.express-tracking-panel > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 14px 16px 10px; border-bottom: 1px solid #dbeae4; background: #fff; }
.express-tracking-panel h3 { margin: 0 0 3px; font-size: 15px; }
.express-tracking-panel header small { color: var(--muted); }
.express-latest { margin: 12px 16px 5px; color: var(--ink); font-weight: 700; }
.express-tracking-panel > .form-note, .express-tracking-panel > .form-error { margin: 7px 16px 12px; }
.express-traces { max-height: 260px; overflow: auto; padding: 0 16px 14px; }
.express-trace-list { list-style: none; margin: 0; padding: 0; }
.express-trace-list li { display: grid; grid-template-columns: 138px minmax(0, 1fr); gap: 10px; padding: 10px 0; border-top: 1px dashed #d6e4df; }
.express-trace-list time { color: var(--muted); font-size: 12px; white-space: nowrap; }
.express-trace-list span { min-width: 0; color: var(--ink); }
.express-trace-list small { display: block; margin-top: 3px; color: var(--muted); }
.table-shell { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 13px; border-bottom: 1px solid #edf0ee; text-align: left; vertical-align: middle; white-space: nowrap; }
th { position: sticky; top: 0; z-index: 1; color: #52615c; background: #f7f9f8; font-size: 11px; font-weight: 800; letter-spacing: .03em; }
td { max-width: 320px; overflow: hidden; color: #293631; font-size: 13px; text-overflow: ellipsis; }
tbody tr:hover { background: #fbfcfb; }
tbody tr:last-child td { border-bottom: 0; }
.table-filter-toolbar { position: relative; z-index: 2; border-bottom: 1px solid #e4eeea; background: #fbfdfc; }
.table-filter-toolbar > summary { display: flex; align-items: center; min-height: 38px; padding: 0 13px; cursor: pointer; color: #40514b; font-size: 12px; font-weight: 800; list-style: none; user-select: none; }
.table-filter-toolbar > summary::-webkit-details-marker { display: none; }
.table-filter-toolbar > summary::before { content: "⌕"; margin-right: 6px; color: var(--brand); font-size: 16px; line-height: 1; }
.table-filter-toolbar > summary::after { content: "▾"; margin-left: 6px; color: #81928b; font-size: 11px; transition: transform .14s ease; }
.table-filter-toolbar[open] > summary::after { transform: rotate(180deg); }
.table-filter-toolbar.has-filter > summary { color: var(--brand-dark); background: #eff8f4; }
.table-filter-toolbar.has-filter > summary::after { color: var(--brand); }
.table-filter-toolbar-panel { display: grid; grid-template-columns: minmax(190px, 340px) auto; align-items: end; gap: 9px; padding: 0 13px 11px; }
.table-filter-toolbar-panel label { display: grid; gap: 5px; color: #596962; font-size: 11px; font-weight: 750; }
.table-filter-toolbar-panel input { width: 100%; min-width: 0; }
.table-filter-toolbar-panel .button { min-height: 34px; white-space: nowrap; }
.table-filter-status { margin: 0; padding: 7px 13px; border-bottom: 1px solid #e4eeea; color: var(--brand-dark); background: #f5fbf8; font-size: 12px; font-weight: 700; }
.cell-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.cell-actions .button { white-space: nowrap; }
.table-shell.with-actions > table { min-width: max-content; }
.table-shell.with-actions .action-cell { max-width: none; overflow: visible; }
.table-shell.with-actions .action-cell .cell-actions { flex-wrap: wrap; min-width: 0; }
.table-shell th { overflow: visible; }
.table-shell th:has(.table-column-filter[open]) { z-index: 8; }
.table-column-filter { display: block; position: relative; min-width: 100%; }
.table-column-filter > summary { display: flex; align-items: center; justify-content: space-between; box-sizing: border-box; width: 100%; min-height: 34px; cursor: pointer; color: inherit; font: inherit; letter-spacing: inherit; list-style: none; user-select: none; }
.table-column-filter > summary::-webkit-details-marker { display: none; }
.table-column-filter > summary::after { content: "▾"; margin-left: auto; color: #81928b; font-size: 11px; line-height: 1; transition: transform .14s ease; }
.table-column-filter[open] > summary::after { transform: rotate(180deg); }
.table-column-filter.has-filter > summary { color: var(--brand-dark); }
.table-column-filter.has-filter > summary::before { content: ""; width: 6px; height: 6px; margin-right: 5px; border-radius: 999px; background: var(--brand); box-shadow: 0 0 0 2px #e3f2ec; }
.table-column-filter:not([open]) .table-column-filter-panel { display: none; }
.table-column-filter-panel { position: fixed; top: var(--column-filter-top, 0); left: var(--column-filter-left, 0); z-index: 60; display: grid; width: min(272px, calc(100vw - 16px)); gap: 10px; padding: 12px; border: 1px solid #b9d8cd; border-radius: 12px; color: var(--ink); background: #fff; box-shadow: 0 14px 34px rgba(25, 52, 43, .18); white-space: normal; }
.table-column-filter.direct-options .table-column-filter-panel { gap: 3px; padding: 6px; }
.table-column-filter-panel > strong { color: #40514b; font-size: 12px; }
.table-column-filter-fields { display: grid; gap: 9px; }
.table-column-filter-fields label { display: grid; gap: 5px; color: #596962; font-size: 11px; font-weight: 750; }
.table-column-filter-fields input, .table-column-filter-fields select { width: 100%; min-width: 0; }
.table-column-filter-options { display: grid; max-height: min(330px, calc(100vh - 130px)); gap: 3px; overflow: auto; padding-right: 2px; }
.table-column-filter-option { display: flex; align-items: center; min-height: 34px; width: 100%; border: 1px solid transparent; border-radius: 7px; padding: 6px 8px; color: #40514b; background: transparent; font: inherit; font-size: 12px; font-weight: 700; text-align: left; }
.table-column-filter-option::before { content: ""; box-sizing: border-box; width: 15px; height: 15px; margin-right: 8px; border: 1px solid #aebfb7; border-radius: 3px; background: #fff; }
.table-column-filter-option:hover { border-color: #c9e1d6; background: #eff8f4; }
.table-column-filter-option.active { color: var(--brand-dark); background: #e8f5ef; }
.table-column-filter-option.active::before { content: "✓"; display: grid; place-items: center; border-color: var(--brand); color: #fff; background: var(--brand); font-size: 11px; font-weight: 900; }
.table-column-filter-option:focus-visible { outline: 3px solid rgba(23,107,91,.25); outline-offset: 1px; }
.table-column-filter-actions { display: grid; grid-template-columns: minmax(0, 1fr); gap: 7px; }
.table-column-filter-actions .button { width: 100%; min-height: 34px; padding-right: 7px; padding-left: 7px; }
.document-order-list + .empty-state { margin-top: 12px; }
.sales-order-list > table { width: 100%; min-width: 1360px; table-layout: auto; }
.sales-order-list .column-__selection { width: 42px; }
.sales-order-list .column-contract_display_number { width: 165px; }
.sales-order-list .column-order_date { width: 124px; font-variant-numeric: tabular-nums; }
.sales-order-list .column-customer_name { width: 170px; }
.sales-order-list .column-project_name { width: 148px; }
.sales-order-list .column-total_amount, .sales-order-list .column-outstanding_amount { width: 112px; }
.sales-order-list .column-status, .sales-order-list .column-delivery_status { width: 104px; }
.sales-order-list .column-sales_invoice_status, .sales-order-list .column-sales_receipt_status { width: 112px; }
.sales-order-list .column-__actions { width: 194px; }
.sales-order-list td.column-contract_display_number,
.sales-order-list td.column-customer_name,
.sales-order-list td.column-project_name { max-width: none; overflow: visible; text-overflow: clip; white-space: nowrap; }
.table-shell.with-actions.sales-order-list > table { width: 100%; min-width: 1360px; table-layout: auto; }
.sales-order-list .cell-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; gap: 6px; }
.sales-order-list .cell-actions .sales-order-action { width: 100%; min-width: 0; border: 1px solid transparent; padding-right: 7px; padding-left: 7px; }
.sales-order-list .sales-order-action-edit { border-color: #bfd4e8; color: #245b87; background: #eaf3fb; }
.sales-order-list .sales-order-action-contract { border-color: #d7c5ea; color: #68458f; background: #f3edfa; }
.sales-order-list .sales-order-action-confirm { border-color: #b9ddce; color: #176247; background: #e5f4ed; }
.sales-order-list .sales-order-action-delivery { border-color: #b9dce4; color: #216474; background: #e5f3f6; }
.sales-order-list .sales-order-action-purchase { border-color: #edd09a; color: #80540b; background: #fff2da; }
.sales-order-list .sales-order-action-close { border-color: #cbd1df; color: #49566d; background: #edf0f6; }
.sales-order-list .sales-order-action-project { border-color: #c8d6ad; color: #526a28; background: #eff5e4; }
.sales-order-list .sales-order-action-danger { border-color: #e8bcbc; color: #9d3333; background: #fbe8e8; }
.sales-order-list .sales-order-action-default { border-color: #ccd8d3; color: #40554d; background: #f0f4f2; }
.sales-order-list .sales-order-action:hover { filter: brightness(.97); box-shadow: 0 2px 7px rgba(27, 48, 41, .10); }
.purchase-order-list { overflow-x: hidden; }
.purchase-order-list > table,
.table-shell.with-actions.purchase-order-list > table { width: 100%; min-width: 0; table-layout: fixed; }
.purchase-order-list th, .purchase-order-list td { padding: 10px 12px; font-size: 13px; }
.purchase-order-list th { white-space: normal; line-height: 1.2; }
.purchase-order-list .column-__selection { width: 28px; }
.purchase-order-list .column-number { width: 88px; }
.purchase-order-list .column-order_date { width: 72px; font-variant-numeric: tabular-nums; }
.purchase-order-list .column-supplier_name { width: 96px; }
.purchase-order-list .column-project_name { width: 76px; }
.purchase-order-list .column-procurement_source { width: 54px; }
.purchase-order-list .column-total_amount, .purchase-order-list .column-actual_paid_amount, .purchase-order-list .column-outstanding_amount { width: 68px; }
.purchase-order-list .column-main_status, .purchase-order-list .column-status { width: 64px; }
.purchase-order-list .column-arrival_status, .purchase-order-list .column-invoice_status, .purchase-order-list .column-payment_status { width: 68px; }
.purchase-order-list .column-__actions { width: 150px; }
.purchase-order-list td.column-number { max-width: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.purchase-order-list td.column-supplier_name,
.purchase-order-list td.column-project_name { max-width: none; overflow-wrap: anywhere; white-space: normal; }
.purchase-order-list td.column-number .text-link { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.purchase-order-list .column-procurement_source .mobile-card-value,
.purchase-order-list .column-main_status .mobile-card-value,
.purchase-order-list .column-status .mobile-card-value,
.purchase-order-list .column-arrival_status .mobile-card-value,
.purchase-order-list .column-invoice_status .mobile-card-value,
.purchase-order-list .column-payment_status .mobile-card-value { display: block; text-align: center; }
.purchase-order-list .badge { white-space: normal; justify-content: center; text-align: center; }
.purchase-order-list .cell-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; gap: 6px; }
.purchase-order-list .cell-actions .purchase-order-action { width: 100%; min-width: 0; border: 1px solid transparent; padding-right: 7px; padding-left: 7px; }
.table-shell.with-actions.purchase-order-list td:has(.document-inline-action) { max-width: 68px; overflow: hidden; white-space: normal; }
.purchase-order-list .document-inline-action { display: grid; gap: 3px; min-height: 0; }
.purchase-order-list .document-inline-action .document-finance-action { width: 100%; }
.purchase-order-list .purchase-order-action-edit { border-color: #bfd4e8; color: #245b87; background: #eaf3fb; }
.purchase-order-list .purchase-order-action-contract { border-color: #d7c5ea; color: #68458f; background: #f3edfa; }
.purchase-order-list .purchase-order-action-confirm { border-color: #b9ddce; color: #176247; background: #e5f4ed; }
.purchase-order-list .purchase-order-action-delivery { border-color: #b9dce4; color: #216474; background: #e5f3f6; }
.purchase-order-list .purchase-order-action-close { border-color: #cbd1df; color: #49566d; background: #edf0f6; }
.purchase-order-list .purchase-order-action-project { border-color: #c8d6ad; color: #526a28; background: #eff5e4; }
.purchase-order-list .purchase-order-action-danger { border-color: #e8bcbc; color: #9d3333; background: #fbe8e8; }
.purchase-order-list .purchase-order-action-default { border-color: #ccd8d3; color: #40554d; background: #f0f4f2; }
.purchase-order-list .purchase-order-action:hover { filter: brightness(.97); box-shadow: 0 2px 7px rgba(27, 48, 41, .10); }
.number { text-align: right; font-variant-numeric: tabular-nums; }
.empty-state { display: grid; min-height: 220px; place-content: center; justify-items: center; padding: 40px; color: var(--muted); text-align: center; }
.empty-state-icon { display: grid; place-items: center; width: 42px; height: 42px; margin-bottom: 11px; border-radius: 14px; color: var(--brand-dark); background: var(--brand-soft); font-size: 23px; font-weight: 800; }
.empty-state strong { color: var(--ink); font-size: 16px; }
.empty-state p { max-width: 440px; margin: 8px 0 0; line-height: 1.6; }
.empty-state-action { margin-top: 16px; }

.badge { display: inline-flex; align-items: center; min-height: 25px; border-radius: 999px; padding: 4px 9px; color: #3c514b; background: #edf2f0; font-size: 11px; font-weight: 750; }
.badge.good { color: var(--good); background: #e4f5eb; }
.badge.warn { color: var(--warning); background: var(--warning-soft); }
.badge.danger { color: var(--danger); background: var(--danger-soft); }
.badge.brand { color: var(--brand-dark); background: var(--brand-soft); }
.bank-exception-responsibility { display: grid; gap: 7px; margin-top: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); }
.bank-exception-responsibility > div { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 3px 8px; align-items: baseline; }
.bank-exception-responsibility strong { color: var(--brand-dark); font-size: 12px; }
.bank-exception-responsibility span { min-width: 0; color: var(--ink); font-size: 12px; overflow-wrap: anywhere; }
.bank-exception-responsibility small { grid-column: 2; color: var(--muted); font-size: 11px; }
.sales-finance-status { display: inline-flex; align-items: center; min-height: 25px; border-radius: 999px; padding: 4px 9px; font-size: 11px; font-weight: 750; transition: opacity .14s ease; }
.sales-finance-status.invoice.pending { color: #4d668f; background: #eaf0f8; }
.sales-finance-status.invoice.partial { color: #aa6b12; background: #fff2d9; }
.sales-finance-status.invoice.complete { color: #315da8; background: #e8efff; }
.sales-finance-status.receipt.pending { color: #b44343; background: #ffedeb; }
.sales-finance-status.receipt.partial { color: #a16b0c; background: #fff1cf; }
.sales-finance-status.receipt.complete { color: #167352; background: #e3f5eb; }
.sales-finance-status.payment.pending { color: #b44343; background: #ffedeb; }
.sales-finance-status.payment.partial { color: #a16b0c; background: #fff1cf; }
.sales-finance-status.payment.complete { color: #167352; background: #e3f5eb; }
.document-inline-action { display: inline-flex; flex-wrap: wrap; min-width: 0; min-height: 34px; align-items: center; justify-content: center; gap: 6px; }
.document-inline-action .sales-finance-status { flex: 0 0 auto; }
.document-inline-action .document-finance-action { position: static; display: inline-flex; flex: 0 0 auto; visibility: visible; white-space: nowrap; transform: none; opacity: 1; pointer-events: auto; }
.sales-finance-trigger:focus-visible, .purchase-finance-trigger:focus-visible { border-radius: 999px; outline: 2px solid #6da990; outline-offset: 2px; }
.table-shell.with-actions td:has(.document-inline-action) { max-width: none; overflow: visible; white-space: normal; }

.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 22px; background: rgba(12,25,22,.55); backdrop-filter: blur(4px); }
.modal { display: flex; flex-direction: column; width: min(720px, 100%); min-width: 0; min-height: 0; max-height: min(900px, calc(100vh - 44px)); border-radius: 22px; background: #fff; box-shadow: 0 28px 90px rgba(0,0,0,.28); overflow: hidden; }
.modal.large { width: min(1120px, 100%); }
.modal-header { display: flex; align-items: center; gap: 14px; min-width: 0; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.modal-header > div { margin-right: auto; }
.modal-header h2 { margin: 4px 0 0; font-size: 21px; }
.modal-body { min-width: 0; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 22px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 9px; min-width: 0; padding: 15px 22px; border-top: 1px solid var(--line); background: #fbfcfb; }
.confirm-backdrop { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: 22px; background: rgba(12,25,22,.58); backdrop-filter: blur(5px); }
.confirm-dialog { display: grid; grid-template-columns: 44px minmax(0,1fr); gap: 14px; width: min(480px,100%); max-height: min(90dvh, 620px); border: 1px solid rgba(255,255,255,.72); border-radius: 20px; padding: 21px; background: #fff; box-shadow: 0 28px 90px rgba(0,0,0,.28); overflow: auto; }
.confirm-tone { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; color: var(--brand-dark); background: var(--brand-soft); font-size: 20px; font-weight: 900; }
.confirm-dialog.danger .confirm-tone { color: #8e3131; background: var(--danger-soft); }
.confirm-dialog.info .confirm-tone { color: #1d5c73; background: #dceff7; }
.confirm-copy { min-width: 0; }
.confirm-copy .eyebrow { margin-bottom: 4px; font-size: 10px; }
.confirm-copy h2 { margin: 0; color: var(--ink); font-size: 18px; }
.confirm-copy #confirm-detail { margin: 7px 0 0; color: #53645e; font-size: 13px; line-height: 1.55; }
.confirm-extra { margin-top: 14px; }
.confirm-extra > form { display: grid; gap: 12px; }
.confirm-extra label { margin: 0; }
.confirm-footer { display: flex; grid-column: 1 / -1; justify-content: flex-end; gap: 9px; margin-top: 2px; padding-top: 16px; border-top: 1px solid var(--line); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-grid > label { min-width: 0; }
.wide-form { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid .span-2 { grid-column: 1 / -1; }
.party-recognition-panel { margin: 0 0 4px; border: 1px solid #cfe3dc; border-radius: 14px; padding: 15px; background: linear-gradient(135deg, #fbfefd, #f0f8f5); }
.party-recognition-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.party-recognition-head strong { color: var(--brand-dark); font-size: 14px; }
.party-recognition-head small, .party-recognition-note { color: var(--muted); font-size: 11px; line-height: 1.5; }
.party-recognition-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.party-recognition-card { min-width: 0; border: 1px solid #dce9e3; border-radius: 11px; padding: 12px; background: rgba(255,255,255,.78); }
.party-recognition-card > strong { display: block; margin-bottom: 10px; color: #29483f; font-size: 13px; }
.party-recognition-card label { margin-bottom: 10px; }
.party-recognition-card small { color: var(--muted); font-size: 10px; line-height: 1.45; }
.party-recognition-card textarea { min-height: 112px; }
.party-recognition-note { margin: 11px 0 0; }
.party-recognition-result:empty { display: none; }
.party-recognition-result .form-note { margin: 10px 0 0; }
.party-recognition-warnings { border-left: 3px solid var(--warning); padding-left: 9px; }
.cash-settlement-rows { display: grid; gap: 10px; }
.cash-settlement-row { padding: 13px 14px 5px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); }
.cash-settlement-row .field-action { display: flex; align-items: end; padding-bottom: 10px; }
.cash-settlement-actions { display: flex; align-items: center; gap: 12px; }
.cash-settlement-actions .form-note { margin: 0; }
.purchase-form-details, .sales-form-details { margin-top: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); }
.purchase-form-details > summary, .sales-form-details > summary { cursor: pointer; padding: 12px 14px; color: #4d5d57; font-size: 12px; font-weight: 800; list-style: none; }
.purchase-form-details > summary::-webkit-details-marker, .sales-form-details > summary::-webkit-details-marker { display: none; }
.purchase-form-details > summary::after, .sales-form-details > summary::after { content: "⌄"; float: right; color: var(--muted); font-size: 14px; }
.purchase-form-details[open] > summary, .sales-form-details[open] > summary { border-bottom: 1px solid var(--line); color: var(--brand-dark); }
.purchase-form-details[open] > summary::after, .sales-form-details[open] > summary::after { content: "⌃"; }
.purchase-form-details > .form-grid, .sales-form-details > .form-grid { padding: 0 14px 4px; }
.purchase-core-form > label, .purchase-linkage-grid > label { align-self: start; align-content: start; }
.purchase-linkage-title { margin-top: 18px; }
.purchase-linkage-grid > label { margin-bottom: 12px; }
.purchase-source-order-picker { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; min-width: 0; }
.purchase-source-order-picker > label { margin-bottom: 8px; }
.purchase-source-order-picker > [data-procurement-source-more] { grid-column: 1 / -1; justify-self: start; margin: 2px 0 10px; }
.quick-create-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 16px; }
.quick-create-option { display: grid; min-height: 108px; align-content: center; gap: 7px; border: 1px solid var(--line); border-radius: 13px; padding: 16px; color: var(--ink); background: var(--surface-soft); text-align: left; transition: .15s border-color, .15s transform, .15s background; }
.quick-create-option:hover { border-color: #a8cfc2; background: #f1f8f5; transform: translateY(-1px); }
.quick-create-option.primary { color: #fff; border-color: var(--brand); background: var(--brand); }
.quick-create-option.primary:hover { background: var(--brand-dark); }
.quick-create-option span { font-weight: 850; }
.quick-create-option small { color: var(--muted); font-size: 11px; line-height: 1.5; }
.quick-create-option.primary small { color: #d6ebe5; }
.customer-address-row { margin: 10px 0; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); }
.customer-address-actions { display: flex; gap: 8px; }
.checkbox-label { display: flex; align-items: center; gap: 9px; min-height: 44px; }
.section-title { display: flex; align-items: center; gap: 10px; margin: 20px 0 12px; }
.section-title h3 { margin: 0; font-size: 15px; }
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.line-editor { overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
.line-editor table { min-width: 860px; }
.line-editor input, .line-editor select { min-height: 36px; margin: 0; padding: 6px 8px; border-radius: 7px; }
.document-line-editor { overflow: visible; border: 0; }
.document-line-editor table, .document-line-editor tbody { display: block; min-width: 0; }
.document-line-editor thead { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.document-line-editor tr[data-line] { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 14px; margin-bottom: 12px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-soft); }
.document-line-editor tr[data-line][data-receipt-locked] { border-color: #c9ddd5; background: #f1f7f4; }
.document-line-editor td { display: grid; min-width: 0; gap: 6px; max-width: none; overflow: visible; padding: 0; border: 0; text-overflow: clip; white-space: normal; }
.document-line-editor td::before { content: attr(data-label); color: var(--muted); font-size: 11px; font-weight: 750; }
.document-line-editor .line-extra-cell { grid-column: 1 / -1; }
.document-line-editor .line-extra-cell::before { display: none; }
.document-line-editor .purchase-pricing-cell { grid-column: 1 / -1; }
.purchase-pricing-inputs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 10px; align-items: end; }
.purchase-pricing-inputs label { margin: 0; font-size: 11px; }
.purchase-pricing-inputs .purchase-pricing-formula { grid-column: 1 / -1; color: var(--muted); }
.line-extra-details { border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.line-extra-details > summary { cursor: pointer; padding: 10px 11px; color: #52615c; font-size: 11px; font-weight: 750; list-style: none; }
.line-extra-details > summary::-webkit-details-marker { display: none; }
.line-extra-details > summary::after { content: "⌄"; float: right; color: var(--muted); font-size: 13px; }
.line-extra-details[open] > summary { border-bottom: 1px solid var(--line); color: var(--brand-dark); }
.line-extra-details[open] > summary::after { content: "⌃"; }
.line-extra-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 12px; padding: 11px; }
.line-extra-grid label { margin: 0; font-size: 11px; }
.document-line-editor td[data-label="操作"] { display: flex; grid-column: 1 / -1; justify-content: flex-end; padding-top: 4px; border-top: 1px solid var(--line); }
.document-line-editor td[data-label="操作"]::before { display: none; }
.document-line-editor .remove-line { width: auto; min-width: 96px; min-height: 36px; }
.line-total { font-weight: 800; text-align: right; }
.document-total { display: flex; justify-content: flex-end; gap: 18px; margin: 12px 4px 0; align-items: baseline; }
.document-total strong { font-size: 24px; }
.attachments { display: grid; gap: 8px; }
.attachment-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.attachment-item span { min-width: 0; margin-right: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-item.muted { opacity: .64; cursor: not-allowed; background: var(--surface-soft); }
.attachment-item.muted span { white-space: normal; }
.import-summary { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin: 14px 0; }
.import-summary > div { padding: 14px; border-radius: 10px; background: var(--surface-soft); }
.import-summary strong, .import-summary span { display: block; }
.import-summary strong { margin-top: 5px; font-size: 22px; }
.import-summary span { color: var(--muted); font-size: 11px; }

.toast-region { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: grid; gap: 10px; width: min(360px, calc(100vw - 40px)); }
.toast { display: flex; align-items: flex-start; gap: 10px; padding: 12px 12px 12px 14px; border-radius: 12px; color: #fff; background: #263b35; box-shadow: var(--shadow); animation: toast-in .2s ease-out; line-height: 1.45; }
.toast-icon { display: grid; flex: 0 0 auto; place-items: center; width: 22px; height: 22px; border-radius: 50%; color: #19352e; background: #c9f0de; font-size: 13px; font-weight: 900; }
.toast > span { min-width: 0; margin-right: auto; }
.toast-dismiss { display: grid; flex: 0 0 auto; place-items: center; width: 28px; height: 28px; border: 0; border-radius: 8px; color: inherit; background: transparent; font-size: 20px; line-height: 1; }
.toast-dismiss:hover { background: rgba(255,255,255,.15); }
.toast.error { background: var(--danger); }
.toast.error .toast-icon { color: #762e2e; background: #ffe0df; }
.toast.warning { color: #5b3e08; background: #fff0cc; }
.toast.warning .toast-icon { color: #fff; background: #9a6511; }
.toast.info { color: #17485b; background: #dceff7; }
.toast.info .toast-icon { color: #fff; background: #2d728a; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }
.list-pagination { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; }
.list-pagination > div { display: flex; gap: 8px; }

/* Desktop density: keep long data-entry and management pages comfortably compact
   without reducing the larger touch targets used by the mobile layout. */
@media (min-width: 761px) {
  label, .field-label { gap: 6px; margin-bottom: 14px; }
  input, select, textarea { min-height: 40px; padding: 8px 11px; }
  textarea { min-height: 78px; }
  .button { min-height: 38px; padding: 7px 13px; }
  .button.small { min-height: 32px; padding: 5px 9px; }
  .icon-button { width: 36px; height: 36px; }

  .global-search > input { height: 40px; padding-top: 7px; padding-bottom: 7px; }
  .user-chip { min-height: 42px; }
  .main-content { min-height: calc(100vh - 74px); padding: 22px 26px 48px; }

  .page-head { gap: 14px; margin-bottom: 16px; }
  .page-head h2 { margin-bottom: 3px; }
  .page-actions { gap: 8px; }
  .kpi-grid { gap: 12px; margin-bottom: 16px; }
  .kpi-card { min-height: 112px; padding: 16px; }
  .kpi-card .value { margin-top: 10px; }
  .dashboard-grid, .dashboard-workspace { gap: 14px; }
  .dashboard-workspace { margin-bottom: 14px; }
  .panel-head { padding: 14px 16px; }
  .panel-body { padding: 15px 16px; }

  .workbench-hero { gap: 18px; margin-bottom: 14px; padding: 20px 22px; }
  .workflow-panel { margin-bottom: 14px; padding: 14px 16px 16px; }
  .business-detail-grid, .business-relations { gap: 14px; }

  .analytics-filter { margin-bottom: 16px; padding: 13px 15px; }
  .analytics-range-form { gap: 8px; margin-top: 10px; padding-top: 10px; }
  .analytics-kpi-grid, .analytics-status-grid { gap: 12px; }
  .analytics-kpi { min-height: 122px; padding: 16px; }
  .analytics-status-section { margin-top: 18px; }
  .analytics-chart-grid { gap: 14px; margin-top: 18px; }

  .toolbar { gap: 8px; margin-bottom: 10px; }
  .batch-toolbar { gap: 8px; margin-bottom: 10px; padding: 8px 10px; }
  th, td { padding: 10px 12px; }

  .modal-backdrop { padding: 18px; }
  .modal { max-height: min(880px, calc(100vh - 36px)); }
  .modal-header { padding: 16px 18px; }
  .modal-body { padding: 18px; }
  .modal-footer { padding: 12px 18px; }
  .form-grid { column-gap: 14px; }
  .cash-settlement-rows { gap: 8px; }
  .cash-settlement-row { padding: 11px 12px 3px; }
  .purchase-form-details, .sales-form-details { margin-top: 12px; }
  .purchase-form-details > .form-grid, .sales-form-details > .form-grid { padding-right: 12px; padding-left: 12px; }
  .quick-create-grid { gap: 8px; margin-top: 12px; }
  .quick-create-option { min-height: 92px; gap: 5px; padding: 13px; }
  .customer-address-row { margin: 8px 0; padding: 11px 12px; }
  .checkbox-label { min-height: 40px; }
  .section-title { margin: 16px 0 10px; }
  .document-line-editor tr[data-line] { gap: 10px 12px; margin-bottom: 10px; padding: 12px; }
  .document-total { margin-top: 10px; }
  .attachments { gap: 6px; }
  .attachment-item { padding: 8px 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .dashboard-workspace { grid-template-columns: 1fr; }
  .workbench-primary { grid-template-columns: 1fr; }
  .guide-flow-grid { grid-template-columns: 1fr; }
  .business-detail-grid, .document-business-detail-grid { grid-template-columns: 1fr; }
  .business-summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .global-search { flex-basis: 270px; }
  .global-search kbd { display: none; }
  .global-search > input { padding-right: 12px; }
  .user-chip .desktop-only { display: none !important; }
  .project-overview-hero.has-quick-actions { grid-template-columns: 1fr; }
  .project-hero-main { min-height: auto; }
  .project-stage-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .project-contract-grid { grid-template-columns: 1fr; }
  .project-finance-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .project-cost-panel, .project-cash-panel { grid-column: span 1; }
  .project-expense-panel { grid-column: 1 / -1; }
  .analytics-kpi-grid, .analytics-status-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .analytics-insight-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .purchase-card-grid { grid-template-columns: 1fr; }
  .purchase-card-footer { align-items: flex-start; flex-direction: column; }
  .purchase-card-actions { width: 100%; }
  .purchase-card-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .purchase-card-actions .button, .purchase-card-actions .card-action-menu { flex: 1; }
  .purchase-card-actions .button, .purchase-card-actions .card-action-menu { min-width: 0; }
  .purchase-card-actions .card-action-menu > summary { width: 100%; justify-content: center; }
  .document-card .purchase-card-actions .button.danger { grid-column: 1 / -1; }
}

@media (min-width: 761px) and (max-width: 980px) {
  .wide-form, .document-line-editor tr[data-line], .line-extra-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  body { font-size: 16px; }
  .mobile-only { display: inline-grid !important; }
  .desktop-only { display: none !important; }
  body.nav-open { overflow: hidden; }
  .login-view { display: block; padding: 34px 20px; }
  .login-brand { align-items: center; margin-bottom: 34px; }
  .login-brand .brand-mark { width: 58px; height: 58px; border-radius: 17px; font-size: 20px; }
  .login-brand h1 { font-size: 36px; }
  .login-brand p:last-child { display: none; }
  .login-card { padding: 26px 20px; border-radius: 20px; }
  .app-shell { display: block; }
  .sidebar { position: fixed; left: 0; width: min(310px, 84vw); height: 100dvh; padding-top: max(20px, env(safe-area-inset-top)); padding-bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-105%); transition: transform .2s ease; box-shadow: 20px 0 55px rgba(0,0,0,.22); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-nav-head { display: none; }
  .nav-backdrop { position: fixed; inset: 0; z-index: 25; display: block; background: rgba(0,0,0,.38); }
  .mobile-nav-trigger { position: fixed; top: max(12px, env(safe-area-inset-top)); left: max(12px, env(safe-area-inset-left)); z-index: 20; border: 1px solid var(--line); background: rgba(255,255,255,.94); box-shadow: 0 4px 16px rgba(20,44,39,.1); }
  .sidebar-utilities { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 7px 4px; }
  .global-search { position: relative; min-width: 0; flex: 1 1 100%; }
  .global-search > input { min-height: 40px; height: 40px; padding-left: 34px; font-size: 13px; }
  .global-search-icon { left: 12px; }
  .global-search-results { position: fixed; top: 62px; right: 14px; left: 14px; width: auto; max-height: calc(100dvh - 76px); }
  .quick-create-button { display: inline-grid; place-items: center; min-width: 40px; padding: 7px 8px; font-size: 18px; }
  .quick-create-label { display: none; }
  .user-chip { padding: 5px; background: transparent; box-shadow: none; }
  .user-menu { top: auto; bottom: calc(100% + 9px); }
  .main-content { min-height: 100vh; padding: 64px 14px 86px; }
  .page-overline { display: none; }
  .page-head { align-items: stretch; flex-direction: column; margin-bottom: 16px; }
  .page-head h2 { font-size: 21px; }
  .page-actions { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); }
  .page-actions .button { width: 100%; }
  .dashboard-work-filter-head { align-items: flex-start; flex-wrap: wrap; margin-left: 0; }
  .project-page-action-cluster { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; width: 100%; }
  .page-actions .project-lifecycle-menu > summary { width: 100%; justify-content: center; }
  .project-page-action-cluster #add-project-bom { grid-column: 1 / -1; }
  .dashboard-shortcuts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-shortcuts .button { width: 100%; }
  .dashboard-task { align-items: flex-start; }
  .workbench-hero { align-items: stretch; flex-direction: column; padding: 21px; }
  .workbench-hero-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .document-business-next { align-items: stretch; flex-direction: column; }
  .document-business-next .button { width: 100%; }
  .document-business-quick-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .document-business-quick-actions .button { width: 100%; }
  .workflow-panel { padding: 16px 14px; }
  .workflow-heading > span { display: none; }
  .work-filters { justify-content: flex-start; margin: 9px 0 0; }
  .work-item { align-items: flex-start; flex-wrap: wrap; }
  .work-item-marker { min-height: 48px; }
  .work-item-date { margin-left: 15px; }
  .work-item .dashboard-task-action { margin-left: auto; }
  .business-context-bar { align-items: stretch; flex-direction: column; }
  .next-step-callout { min-width: 0; width: 100%; }
  .business-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .business-relations { grid-template-columns: 1fr; }
  .document-business-context { align-items: stretch; flex-direction: column; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 9px; }
  .kpi-card { min-height: 105px; padding: 15px; }
  .kpi-card .value { margin-top: 10px; font-size: 21px; }
  .analytics-filter { padding: 13px; }
  .analytics-filter-top { align-items: flex-start; flex-direction: column; }
  .analytics-scope { align-self: flex-start; }
  .analytics-range-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: end; }
  .analytics-range-form label { width: auto; }
  .analytics-range-form .button { width: 100%; }
  .analytics-range-form small { grid-column: 1 / -1; }
  .analytics-kpi-grid, .analytics-status-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .analytics-kpi { min-height: 120px; padding: 15px; }
  .analytics-kpi .value { margin-top: 10px; font-size: 21px; }
  .analytics-status-grid .analytics-kpi { min-height: 106px; }
  .analytics-chart-grid, .analytics-insight-grid { grid-template-columns: 1fr; gap: 12px; margin-top: 14px; }
  .analytics-chart-panel .panel-head { flex-direction: column; }
  .analytics-legend { justify-content: flex-start; margin: 8px 0 0; }
  .analytics-ranking-main > div:first-child { display: block; }
  .analytics-ranking-main small { display: block; margin-top: 3px; }
  .analytics-alert { align-items: flex-start; }
  .metric-strip { grid-template-columns: 1fr; }
  .period-overview { grid-template-columns: 1fr; gap: 9px; }
  .period-overview article { padding: 14px; }
  .project-overview-hero { gap: 12px; }
  .project-hero-main, .project-focus-panel { border-radius: 16px; padding: 17px; }
  .project-hero-summary { grid-template-columns: 1fr; gap: 11px; margin-top: 17px; }
  .project-hero-summary > div { grid-template-columns: 92px minmax(0, 1fr); align-items: center; gap: 0 10px; }
  .project-hero-summary small { grid-column: 2; }
  .project-hero-metrics { grid-template-columns: 1fr; margin-top: 17px; }
  .project-hero-metric { padding: 11px 13px; border-right: 0; border-bottom: 1px solid rgba(146, 191, 176, .45); }
  .project-hero-metric:last-child { border-bottom: 0; }
  .project-focus-head h3 { font-size: 17px; }
  .project-attention-list { margin: 13px 0; }
  .project-action-buttons { display: grid; grid-template-columns: 1fr; }
  .project-action-buttons .button { width: 100%; min-height: 42px; justify-content: center; }
  .project-workflow-panel { border-radius: 16px; padding: 16px 14px; }
  .project-section-heading { align-items: flex-start; flex-direction: column; gap: 5px; margin-bottom: 12px; }
  .project-workflow-total { align-self: flex-start; }
  .project-stage-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .project-stage { min-height: 96px; padding: 10px; }
  .project-stage-copy small { display: none; }
  .project-cost-strip { grid-template-columns: 1fr; }
  .project-cost-strip > div:last-child { grid-column: auto; }
  .project-cash-strip { grid-template-columns: 1fr; }
  .project-finance-section { margin-top: 20px; }
  .project-finance-grid { grid-template-columns: 1fr; gap: 12px; }
  .project-cost-panel, .project-cash-panel, .project-expense-panel { grid-column: auto; }
  .panel-head-actions { justify-content: flex-start; margin-left: 0; }
  .project-link-stack { min-width: 0; text-align: right; }
  .project-link-stack > div { justify-content: flex-end; }
  .toolbar { align-items: stretch; }
  .toolbar > label { flex: 1 1 calc(50% - 5px); min-width: 0; margin: 0; }
  .toolbar > label input { min-width: 0; }
  .toolbar .search-box { flex: 1 0 100%; max-width: none; }
  .toolbar > select { width: 100%; }
  .compact-filters { width: 100%; }
  .compact-filters > summary { width: 100%; justify-content: space-between; }
  .compact-filter-panel { position: static; width: auto; margin-top: 7px; box-shadow: none; }
  .compact-filter-panel select { min-width: 0; }
  .purchase-filter-controls, .sales-filter-controls { flex-basis: 100%; width: 100%; }
  .purchase-filter-controls select, .sales-filter-controls select { flex-basis: 100%; width: 100%; }
  .document-list-scope-controls label { flex: 1 1 100%; }
  .document-list-scope-controls label select { width: 100%; }
  .document-list-scope-controls > .button { flex: 1 1 100%; min-height: 40px; }
  .list-pagination { align-items: stretch; flex-direction: column; }
  .list-pagination > div { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .list-pagination .button { width: 100%; min-height: 44px; }
  .batch-toolbar { align-items: stretch; margin-bottom: 12px; }
  .batch-toolbar-count { width: 100%; }
  .batch-toolbar-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .batch-toolbar-actions .button { width: 100%; min-height: 44px; }
  .purchase-toolbar { align-items: flex-start; }
  .document-list-head { align-items: stretch; flex-direction: column; }
  .purchase-card-grid { grid-template-columns: 1fr; gap: 10px; }
  .purchase-card-head { padding: 13px 14px 10px; }
  .purchase-card-body { padding-right: 14px; padding-left: 14px; }
  .purchase-card-footer { align-items: flex-start; flex-direction: column; padding: 10px 14px; }
  .purchase-card-footer .purchase-card-next { width: 100%; }
  .purchase-card-actions { width: 100%; }
  .purchase-card-actions .button, .purchase-card-actions .card-action-menu { flex: 1; min-width: 0; }
  .purchase-card-actions .button, .purchase-card-actions .card-action-menu > summary { min-height: 42px; justify-content: center; }
  .card-action-menu > div { right: auto; bottom: calc(100% + 7px); left: 0; min-width: 100%; }
  .page-action-menu-panel { position: static; width: auto; margin-top: 7px; box-shadow: none; }
  .restricted-document-facts { grid-template-columns: 1fr; }
  .express-trace-list li { grid-template-columns: 1fr; gap: 3px; }
  .table-shell.mobile-cards { overflow: visible; border: 0; background: transparent; }
  .mobile-cards table, .mobile-cards tbody { display: block; }
  .table-shell.with-actions.mobile-cards > table { min-width: 0; }
  .mobile-cards thead, .line-editor thead { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
  .mobile-cards tr { display: grid; gap: 7px; margin-bottom: 10px; padding: 15px; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: 0 4px 14px rgba(24,44,39,.04); }
  .mobile-cards td { display: flex; min-width: 0; justify-content: space-between; gap: 12px; max-width: none; padding: 0; border: 0; overflow-wrap: anywhere; white-space: normal; }
  .mobile-cards td::before { content: attr(data-label); flex: 0 0 94px; color: var(--muted); font-size: 11px; font-weight: 700; }
  .mobile-cards td > :not(.cell-actions) { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
  .mobile-card-value { min-width: 0; overflow-wrap: anywhere; text-align: right; }
  .mobile-card-value .document-inline-action { justify-content: flex-end; }
  .mobile-cards .document-inline-action { min-width: 0; gap: 7px; }
  .mobile-cards .document-inline-action .button { position: static; min-height: 40px; visibility: visible; opacity: 1; pointer-events: auto; transform: none; box-shadow: none; }
  .mobile-cards .document-inline-action .sales-finance-status { opacity: 1; }
  .mobile-cards .cell-actions { display: grid; flex: 1 1 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding-top: 9px; border-top: 1px solid var(--line); }
  .table-shell.with-actions.mobile-cards .action-cell .cell-actions { min-width: 0; }
  .mobile-cards td[data-label="操作"]::before { display: none; }
  .mobile-cards .batch-selection-cell { justify-content: flex-start; padding-bottom: 9px; border-bottom: 1px solid var(--line); }
  .mobile-cards .batch-selection-cell::before { flex-basis: 94px; }
  .mobile-cards .cell-actions .button { display: inline-flex; min-width: 0; min-height: 44px; align-items: center; justify-content: center; text-align: center; }
  .mobile-cards .cell-actions .button:only-child, .mobile-cards .cell-actions .button.danger { grid-column: 1 / -1; }
  .mobile-cards .cell-actions .table-action-menu { grid-column: 1 / -1; }
  .mobile-cards .cell-actions .table-action-menu > summary { display: flex; min-height: 42px; align-items: center; justify-content: center; }
  .mobile-cards .cell-actions .table-action-menu > div { position: static; min-width: 0; margin-top: 7px; box-shadow: none; }
  .mobile-cards .cell-actions .table-action-menu .button { width: 100%; }
  .line-editor { overflow: visible; border: 0; }
  .line-editor table, .line-editor tbody { display: block; min-width: 0; }
  .line-editor tr { display: grid; gap: 9px; margin-bottom: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-soft); }
  .document-line-editor tr[data-line] { grid-template-columns: 1fr; }
  .purchase-source-order-picker { grid-template-columns: 1fr; }
  .line-extra-grid { grid-template-columns: 1fr; }
  .purchase-pricing-inputs { grid-template-columns: 1fr; }
  .line-editor .line-extra-cell { grid-template-columns: 1fr; }
  .line-editor td { display: grid; grid-template-columns: 96px minmax(0, 1fr); align-items: center; gap: 10px; max-width: none; padding: 0; border: 0; white-space: normal; }
  .line-editor td::before { content: attr(data-label); color: var(--muted); font-size: 11px; font-weight: 750; }
  .line-editor input, .line-editor select { min-width: 0; min-height: 44px; }
  .line-editor .line-total { text-align: right; }
  .line-editor td[data-label="操作"] { grid-template-columns: 1fr; padding-top: 6px; border-top: 1px solid var(--line); }
  .line-editor td[data-label="操作"]::before { display: none; }
  .line-editor .remove-line { width: 100%; min-height: 42px; font-size: 14px; }
  .modal-backdrop { align-items: end; padding: 0; }
  .modal { width: 100%; max-height: min(94dvh, calc(100dvh - env(safe-area-inset-top))); border-radius: 20px 20px 0 0; }
  .modal.large { width: 100%; }
  .modal-header, .modal-body, .modal-footer { padding-left: 16px; padding-right: 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .party-recognition-grid { grid-template-columns: 1fr; }
  .cash-settlement-row .field-action { padding-bottom: 12px; }
  .cash-settlement-actions { align-items: flex-start; flex-direction: column; gap: 6px; }
  .quick-create-grid { grid-template-columns: 1fr; }
  .modal-footer { position: sticky; bottom: 0; padding-bottom: max(15px, env(safe-area-inset-bottom)); }
  .modal-footer .button { flex: 1; }
  .import-summary { grid-template-columns: 1fr; }
  .toast-region { right: max(14px, env(safe-area-inset-right)); bottom: max(14px, env(safe-area-inset-bottom)); left: max(14px, env(safe-area-inset-left)); width: auto; }
  .confirm-backdrop { align-items: end; padding: 0; }
  .confirm-dialog { width: 100%; grid-template-columns: 40px minmax(0,1fr); border-radius: 20px 20px 0 0; padding: 19px 16px max(18px, env(safe-area-inset-bottom)); }
  .confirm-footer { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
  .confirm-footer .button { width: 100%; }
  .guide-flow li button { min-height: 42px; }
  .skeleton-grid { grid-template-columns: 1fr; }
}

@media (max-width: 440px) {
  .global-search { flex-basis: 100%; }
  .kpi-grid { grid-template-columns: 1fr; }
  .analytics-kpi-grid, .analytics-status-grid { grid-template-columns: 1fr; }
  .analytics-range-form { grid-template-columns: 1fr; }
  .page-actions { grid-template-columns: 1fr; }
  .dashboard-shortcuts { grid-template-columns: 1fr; }
  .workbench-hero-actions { grid-template-columns: 1fr; }
  .work-item-date { order: 4; }
  .business-summary-grid { grid-template-columns: 1fr; }
  .project-stage-list { grid-template-columns: 1fr; }
}

@media (max-width: 390px) {
  .toolbar > label { flex-basis: 100%; }
}

/* Desktop navigation lives in a compact bar above the workspace. The
   existing mobile rules below 760px continue to use the slide-in sidebar. */
@media (min-width: 761px) {
  .app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 40;
    width: 100%;
    height: 74px;
    min-height: 74px;
    flex: 0 0 74px;
    flex-direction: row;
    align-items: center;
    gap: 20px;
    padding: 12px 30px;
    border-bottom: 1px solid rgba(183, 222, 211, .16);
    box-shadow: 0 8px 24px rgba(20, 44, 39, .12);
  }

  .sidebar-brand {
    flex: 0 0 auto;
    min-width: 188px;
    padding: 0;
  }

  .sidebar-nav-head,
  .desktop-nav-collapse {
    display: none;
  }

  .main-nav {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    align-content: center;
    min-width: 0;
    gap: 4px;
    overflow: visible;
    padding: 0;
  }

  .sidebar-utilities {
    flex: 0 1 auto;
    margin-left: auto;
  }

  .sidebar-utilities .global-search {
    width: clamp(240px, 21vw, 320px);
  }

  .sidebar-utilities .user-chip small {
    display: none;
  }

  .main-nav > .nav-item,
  .main-nav > .nav-group {
    flex: 0 0 auto;
  }

  .nav-item {
    min-height: 42px;
    padding: 9px 10px;
    color: #c5d5d0;
    font-size: 14px;
    white-space: nowrap;
  }

  .nav-item.active {
    box-shadow: inset 0 -3px #7dc7b4;
  }

  .nav-group {
    position: relative;
    display: block;
  }

  .nav-group-toggle {
    min-height: 42px;
    padding: 9px 13px;
    white-space: nowrap;
  }

  .main-nav .guide-button {
    min-height: 42px;
    border: 0;
    padding: 9px 12px;
    color: #c5d5d0;
    background: transparent;
    box-shadow: none;
  }

  .main-nav .guide-button:hover {
    color: #fff;
    background: rgba(255, 255, 255, .09);
    transform: none;
  }

  .nav-group-items {
    position: absolute;
    top: calc(100% + 9px);
    left: 0;
    z-index: 60;
    display: none;
    min-width: 228px;
    gap: 4px;
    padding: 8px;
    border: 1px solid rgba(178, 222, 210, .2);
    border-radius: 13px;
    background: #17362f;
    box-shadow: 0 18px 38px rgba(8, 31, 26, .3);
    transform-origin: top left;
  }

  /* Bridge the visual gap above the dropdown so moving from a top-level
     item to its submenu never briefly leaves the hover target. */
  .nav-group-items::before {
    position: absolute;
    right: 0;
    bottom: 100%;
    left: 0;
    height: 9px;
    content: "";
  }

  /* .hidden is intentionally overridden here so the CSS hover interaction
     works before JavaScript has a chance to update the expanded state. */
  .nav-group:hover .nav-group-items,
  .nav-group:focus-within .nav-group-items,
  .nav-group.expanded .nav-group-items {
    display: grid !important;
    animation: nav-dropdown-in .16s ease both;
  }

  @keyframes nav-dropdown-in {
    from { opacity: 0; transform: translateY(-5px) scale(.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
  }

  .nav-group-items .nav-item {
    width: 100%;
    justify-content: flex-start;
    padding: 10px 12px;
    border-radius: 9px;
  }

  .nav-group-items .nav-item.active {
    box-shadow: inset 3px 0 #7dc7b4;
  }

  .nav-group:hover .nav-group-chevron,
  .nav-group:focus-within .nav-group-chevron {
    transform: rotate(225deg);
  }

  .sidebar-foot {
    flex: 0 0 auto;
    margin: 0;
    padding: 0 0 0 4px;
    white-space: nowrap;
  }

  .sidebar-foot > span:last-child {
    display: none;
  }

  .workspace {
    flex: 1 1 auto;
    min-width: 0;
  }

  .main-content {
    min-height: calc(100vh - 74px);
    min-height: calc(100dvh - 74px);
  }

  /* Keep the legacy collapse state harmless if restored from a previous
     session or triggered programmatically. */
  .app-shell.sidebar-collapsed {
    display: flex;
    grid-template-columns: none;
  }

  .app-shell.sidebar-collapsed .sidebar {
    padding: 12px 30px;
  }

  .app-shell.sidebar-collapsed .sidebar-brand > div,
  .app-shell.sidebar-collapsed .sidebar-foot > span:last-child,
  .app-shell.sidebar-collapsed .nav-item > span:last-child,
  .app-shell.sidebar-collapsed .nav-group-toggle > span:first-child,
  .app-shell.sidebar-collapsed .nav-group-chevron {
    display: initial;
  }

  .app-shell.sidebar-collapsed .nav-group {
    display: block;
  }

  .app-shell.sidebar-collapsed .nav-group-toggle {
    display: flex;
  }

  .app-shell.sidebar-collapsed .nav-group-items {
    display: none !important;
  }
}
.analytics-deep-dive > summary small { display: none; }
