:root {
  --canvas: #f6f7fb;
  --surface: #ffffff;
  --surface-soft: #f4f5f7;
  --ink: #1f2937;
  --ink-strong: #111827;
  --muted: #6b7280;
  --faint: #9ca3af;
  --line: #e2e5eb;
  --line-strong: #d1d5db;
  --brand: #4f46e5;
  --brand-soft: #eef2ff;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --success: #15803d;
  --success-soft: #f0fdf4;
  --amber: #b45309;
  --radius: 12px;
  --shadow: 0 2px 8px rgba(16, 24, 40, .045);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
body { margin: 0; background: var(--canvas); color: var(--ink); font: 14px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea, summary { touch-action: manipulation; }
button { cursor: pointer; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 6px; color: var(--ink-strong); font-size: 24px; font-weight: 700; line-height: 1.3; letter-spacing: -.35px; }
h2 { margin: 0; color: var(--ink-strong); font-size: 17px; font-weight: 700; line-height: 1.4; }
h3 { color: var(--ink-strong); font-size: 14px; font-weight: 600; }
strong, b { font-weight: 600; }
small { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
code { padding: 2px 6px; border-radius: 5px; background: var(--surface-soft); color: #374151; font: 12px ui-monospace, SFMono-Regular, Consolas, monospace; }

button, .button { display: inline-flex; min-height: 40px; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--surface); color: #374151; font-size: 14px; font-weight: 600; line-height: 1.3; text-decoration: none; }
button:hover, .button:hover { border-color: #b8bdc7; background: #fafafa; text-decoration: none; }
.primary { border-color: var(--brand); background: var(--brand); color: white; }
.primary:hover { border-color: #4338ca; background: #4338ca; }
.button.small, button.small { min-height: 31px; padding: 5px 10px; font-size: 12px; }
.full { width: 100%; }
.text-button { min-height: auto; justify-content: flex-start; padding: 0; border: 0; background: transparent; color: var(--muted); font-weight: 400; }
.icon-button { width: 36px; height: 36px; min-height: 36px; padding: 0; border-color: transparent; background: transparent; font-size: 18px; }

input, select, textarea { min-height: 40px; max-width: 100%; padding: 8px 11px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--surface); color: var(--ink); }
.date-control { position: relative; display: block; width: 100%; }
.date-control > .date-input { width: 100%; padding-right: 43px; font-variant-numeric: tabular-nums; }
.date-picker-button { position: absolute; right: 1px; top: 1px; width: 38px; min-height: 38px; padding: 0; border: 0; border-left: 1px solid var(--line); border-radius: 0 6px 6px 0; background: transparent; color: var(--muted); }
.date-picker-button:hover { border-color: var(--line); background: var(--surface-soft); color: var(--brand); }
.date-picker-button svg { display: block; }
.date-control > .native-date-picker { position: absolute; width: 1px; height: 1px; min-height: 0; right: 20px; bottom: 0; padding: 0; opacity: 0; pointer-events: none; }
textarea { min-height: 88px; resize: vertical; }
input[type=checkbox] { width: 18px; height: 18px; min-height: auto; accent-color: var(--brand); }
select[multiple] { min-height: 104px; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 3px solid #c7d2fe; outline-offset: 1px; }

.sidebar { position: fixed; z-index: 40; inset: 0 auto 0 0; display: flex; width: 224px; flex-direction: column; border-right: 1px solid var(--line); background: var(--surface); }
.sidebar-head { display: flex; height: 64px; align-items: center; justify-content: space-between; padding: 0 18px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink-strong); font-size: 16px; font-weight: 700; letter-spacing: -.2px; }
.brand:hover { text-decoration: none; }
.brand-mark { display: grid; width: 30px; height: 30px; flex: 0 0 auto; place-items: center; overflow: hidden; border-radius: 8px; background: var(--brand); color: white; font-size: 14px; }
.brand-mark img { width: 100%; height: 100%; object-fit: cover; }
.sidebar-close { display: none; }
.primary-nav { flex: 1; overflow-y: auto; padding: 5px 12px; }
.nav-label { margin: 18px 10px 6px; color: var(--faint); font-size: 11px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; }
.primary-nav a { display: flex; min-height: 40px; align-items: center; gap: 11px; margin: 2px 0; padding: 8px 10px; border-radius: 7px; color: #4b5563; font-weight: 500; }
.primary-nav a:hover { background: var(--surface-soft); text-decoration: none; }
.primary-nav a[aria-current=page] { background: var(--brand-soft); color: #4338ca; font-weight: 600; }
.nav-icon { width: 18px; height: 18px; flex: 0 0 auto; color: inherit; }
.sidebar-bottom { padding: 12px; border-top: 1px solid var(--line); }
.quota { margin-bottom: 10px; padding: 8px 9px; color: var(--muted); font-size: 11px; }
.quota strong { float: right; color: var(--ink); }
.quota-track { height: 4px; margin-top: 9px; overflow: hidden; border-radius: 99px; background: var(--line); }
.quota-track i { display: block; height: 100%; max-width: 100%; border-radius: inherit; background: var(--brand); }
.user-menu summary { display: flex; align-items: center; gap: 9px; padding: 7px; border-radius: 8px; cursor: pointer; list-style: none; }
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary:hover { background: var(--surface-soft); }
.avatar { display: grid; width: 32px; height: 32px; flex: 0 0 auto; place-items: center; border-radius: 50%; background: #e0e7ff; color: #4338ca; font-weight: 700; }
.user-menu summary > span:nth-child(2) { min-width: 0; flex: 1; }
.user-menu strong { display: block; overflow: hidden; color: var(--ink); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.user-menu small { margin: 0; }
.chevron { color: var(--faint); }
.user-menu > div { display: grid; gap: 4px; padding: 6px 12px 4px 48px; }
.user-menu > div a, .user-menu > div button { color: var(--muted); font-size: 12px; }
.mobile-scrim { display: none; }

.main { min-height: 100vh; margin-left: 224px; }
.topbar { position: sticky; z-index: 30; top: 0; display: flex; height: 64px; align-items: center; gap: 16px; padding: 0 28px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.94); backdrop-filter: blur(10px); }
.global-search { position: relative; width: min(440px, 46vw); }
.global-search span, .search-control span { position: absolute; left: 12px; top: 50%; color: var(--faint); font-size: 18px; transform: translateY(-50%); }
.global-search input { width: 100%; padding-left: 36px; border-color: transparent; background: var(--surface-soft); }
.global-search input:focus { border-color: #c7d2fe; background: white; }
.quick-create { padding: 7px 12px; border-radius: 7px; background: var(--brand); color: white; font-weight: 600; }
.topbar-scope { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.topbar-scope-label { color: var(--muted); font-size: 12px; white-space: nowrap; }
.topbar-scope .segmented { padding: 2px; }
.topbar-scope .segmented a { padding: 5px 10px; }
.mobile-scope { position: relative; display: none; }
.mobile-scope summary { display: flex; min-width: 66px; min-height: 32px; align-items: center; justify-content: center; gap: 6px; padding: 5px 9px; border-radius: 7px; background: var(--surface-soft); color: var(--ink); font-size: 12px; font-weight: 600; cursor: pointer; list-style: none; }
.mobile-scope summary::-webkit-details-marker { display: none; }
.mobile-scope > div { position: absolute; top: calc(100% + 7px); right: 0; display: grid; min-width: 96px; padding: 4px; border: 1px solid var(--line); border-radius: 8px; background: white; box-shadow: 0 12px 30px rgba(15,23,42,.14); }
.mobile-scope a { padding: 8px 10px; border-radius: 6px; color: var(--muted); font-size: 12px; }
.mobile-scope a:hover, .mobile-scope a[aria-current=page] { background: var(--surface-soft); color: var(--ink); text-decoration: none; }
.quick-create:hover { background: #4338ca; text-decoration: none; }
.mobile-menu-button { display: none; }
.content { max-width: 1500px; margin: 0 auto; padding: 32px 36px 72px; }
.mobile-nav { display: none; }

.page-heading, .record-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.compact-heading { align-items: center; }
.eyebrow { margin-bottom: 6px; color: var(--muted); font-size: 12px; }
.muted { color: var(--muted); }
.actions, .record-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.inline-form { display: inline-flex; margin: 0; }
.numeric { font-variant-numeric: tabular-nums; white-space: nowrap; }
.back { display: inline-block; margin-bottom: 12px; color: var(--muted); font-size: 12px; }
.panel, .side-card { min-width: 0; margin-bottom: 20px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.section-heading { display: flex; min-height: 68px; align-items: center; justify-content: space-between; gap: 18px; padding: 17px 20px; border-bottom: 1px solid var(--line); }
.section-heading p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.section-heading > a { font-size: 12px; }
.section-heading > .button { flex: 0 0 auto; white-space: nowrap; }
.padded { padding: 24px; }
.panel-footer { padding: 13px 18px; border-top: 1px solid var(--line); background: #fafbfc; color: var(--muted); font-size: 12px; line-height: 1.65; }

.focus-stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); margin-bottom: 22px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.focus-stat { display: flex; min-width: 0; align-items: baseline; gap: 9px; padding: 17px 16px; border-right: 1px solid var(--line); color: var(--ink); }
.focus-stat:last-child { border-right: 0; }
.focus-stat:hover { background: #fafafa; text-decoration: none; }
.focus-stat strong { flex: 0 0 auto; color: var(--ink-strong); font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.focus-stat span { color: var(--muted); font-size: 12px; line-height: 1.35; }
.focus-stat.danger strong { color: var(--danger); }
.focus-stat.attention strong { color: #b45309; }
.dashboard-owner-filter { margin: 0; }
.dashboard-owner-filter select { min-width: 170px; }
.applied-filters { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: -5px 0 14px; color: var(--muted); font-size: 12px; }
.applied-filters span { padding: 5px 9px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); }
.applied-filters a { margin-left: 2px; }
.action-notice { display: flex; align-items: center; justify-content: space-between; }
.action-notice div { display: grid; }
.action-notice span { color: var(--muted); font-size: 12px; }
.home-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(300px, .85fr); align-items: start; gap: 20px; }
.home-side { min-width: 0; }
.recent-inquiry { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 10px; padding: 13px 18px; border-bottom: 1px solid var(--line); color: var(--ink); }
.recent-inquiry:hover { background: #fafafa; text-decoration: none; }
.recent-inquiry strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-inquiry time { color: var(--muted); font-size: 12px; }
.stage-dot { display: inline-block; width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: #818cf8; }
.count-pill { min-width: 25px; padding: 2px 8px; border-radius: 99px; background: var(--surface-soft); color: var(--muted); text-align: center; font-size: 12px; }
.mini-action { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 18px; border-bottom: 1px solid var(--line); }
.mini-action > a:first-child { min-width: 0; }
.mini-action strong { display: block; overflow: hidden; color: var(--ink); text-overflow: ellipsis; white-space: nowrap; }
.mini-action small { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; }
.home-task-empty { display: flex; min-height: 72px; align-items: center; justify-content: center; gap: 9px; padding: 18px 20px; color: var(--muted); font-size: 13px; }
.home-task-empty span { display: grid; width: 25px; height: 25px; place-items: center; border-radius: 50%; background: var(--success-soft); color: var(--success); font-size: 14px; }
.home-task-empty strong { color: var(--ink); font-weight: 500; }

.task-row { display: grid; grid-template-columns: auto minmax(0,1fr) auto auto; align-items: center; gap: 13px; min-height: 66px; padding: 13px 18px; border-bottom: 1px solid var(--line); }
.task-row:last-child { border-bottom: 0; }
.task-row:hover { background: #fcfcfd; }
.task-check { width: 19px; height: 19px; min-height: 19px; padding: 0; border: 1.5px solid #b7bec8; border-radius: 50%; }
.task-check:hover { border-color: var(--success); background: var(--success-soft); }
.task-title { display: block; overflow: hidden; color: var(--ink); font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.task-context { margin-top: 2px; color: var(--muted); font-size: 12px; }
.task-context span { margin: 0 6px; color: var(--line-strong); }
.task-date { min-width: 44px; color: var(--muted); font-size: 12px; text-align: right; }
.task-date.late, .overdue-text { color: var(--danger) !important; }
.task-actions { display: flex; align-items: center; gap: 7px; }
.task-actions form { margin: 0; }
.task-kind { display: inline-flex; min-width: 38px; justify-content: center; padding: 4px 7px; border-radius: 999px; background: #e0e7ff; color: #4338ca; font-size: 11px; font-weight: 600; }
.task-kind.internal { background: #fef3c7; color: #92400e; }
.task-row.completed { grid-template-columns: auto minmax(0,1fr) minmax(250px,auto) auto; background: #fbfdfb; }
.task-row.completed .task-title { color: var(--ink); font-weight: 500; }
.task-row.completed .task-kind { background: var(--surface-soft); color: var(--muted); }
.task-completed { display: inline-flex; align-items: center; gap: 7px; color: var(--success); font-size: 12px; font-weight: 600; white-space: nowrap; }
.task-completion { display: grid; grid-template-columns: repeat(2,minmax(110px,auto)); gap: 8px 18px; }
.task-completion span { display: grid; gap: 2px; }
.task-completion small { color: var(--muted); font-size: 10px; font-weight: 500; }
.task-completion b { color: var(--ink); font-size: 12px; font-weight: 500; white-space: nowrap; }
.task-history-note { margin: -4px 0 14px; color: var(--muted); font-size: 12px; }
.button.quiet { border-color: transparent; background: transparent; color: var(--muted); }
.icon-link { color: var(--muted); letter-spacing: 2px; }

.task-view-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.scope-owner-filter { margin: 0 0 0 auto; }
.scope-owner-filter select { min-width: 170px; }
.view-toolbar { margin-bottom: 16px; }
.segmented { display: flex; width: fit-content; gap: 3px; padding: 3px; border-radius: 8px; background: #eceef2; }
.segmented a { padding: 6px 12px; border-radius: 6px; color: var(--muted); font-size: 12px; font-weight: 600; }
.segmented a:hover { color: var(--ink); text-decoration: none; }
.segmented a[aria-current=page] { background: white; color: var(--ink-strong); box-shadow: var(--shadow); }
.page-segments { margin-bottom: 15px; }
.toolbar-controls { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.search-control { position: relative; flex: 1; min-width: 230px; }
.search-control input { width: 100%; padding-left: 35px; }
.toolbar-controls select { max-width: 180px; }
.toolbar-controls.is-filtering, form.is-filtering { opacity: .7; pointer-events: none; }
.filter-actions { display: flex; align-items: center; gap: 8px; }
.view-switch { display: flex; padding: 3px; border: 1px solid var(--line); border-radius: 7px; background: white; }
.view-switch a { display: grid; width: 30px; height: 28px; place-items: center; border-radius: 5px; color: var(--muted); }
.view-switch a:hover { text-decoration: none; }
.view-switch a[aria-current=page] { background: var(--surface-soft); color: var(--ink); }
.inquiry-list-panel { overflow: visible; }
.heading-count { margin-left: 6px; color: var(--muted); font-size: 15px; font-weight: 500; }
.customer-toolbar { border-bottom: 1px solid var(--line); }
.customer-toolbar .search-control { min-width: 260px; }
.customer-toolbar .search-control input { width: 100%; }
.customer-list-head, .customer-list-row { display: grid; grid-template-columns: minmax(240px,1.5fr) minmax(210px,1.2fr) 70px minmax(100px,.7fr) minmax(100px,.7fr); align-items: center; gap: 16px; }
.customer-list-head { padding: 10px 18px; border-bottom: 1px solid var(--line); background: #fafafa; color: var(--muted); font-size: 11px; }
.customer-list-row { min-height: 68px; padding: 11px 18px; border-bottom: 1px solid var(--line); color: var(--ink); }
.customer-list-row:hover { background: #fafafa; text-decoration: none; }
.customer-list-row .customer-contact-name { color: var(--ink); font-weight: 500; }
.customer-list-row .customer-inquiry-count { color: var(--ink); font-weight: 500; }
.list-header, .inquiry-row { display: grid; grid-template-columns: minmax(240px,1.55fr) minmax(105px,.65fr) minmax(150px,1fr) minmax(180px,1.15fr) minmax(100px,.65fr); align-items: center; gap: 16px; }
.list-header { padding: 10px 18px; border-bottom: 1px solid var(--line); background: #fafafa; color: var(--muted); font-size: 11px; }
.inquiry-row { min-height: 68px; padding: 11px 18px; border-bottom: 1px solid var(--line); color: var(--ink); }
.inquiry-row > div { min-width: 0; }
.inquiry-row:last-of-type { border-bottom: 0; }
.inquiry-row:hover { background: #fafafa; text-decoration: none; }
.inquiry-name { display: flex; min-width: 0; align-items: center; gap: 11px; }
.inquiry-name > span:last-child { min-width: 0; }
.inquiry-name strong, .next-cell strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inquiry-name strong { color: var(--ink-strong); font-weight: 600; }
.inquiry-row .product-preview { color: #475569; font-weight: 400; }
.next-cell strong { color: var(--ink); font-weight: 600; }
.company-avatar { display: grid; width: 34px; height: 34px; flex: 0 0 auto; place-items: center; border-radius: 8px; background: #eef2ff; color: #4f46e5; font-weight: 700; }
.company-avatar.large { width: 44px; height: 44px; border-radius: 10px; font-size: 17px; }
.status-chip { display: inline-flex; align-items: center; padding: 3px 8px; border: 1px solid #e0e7ff; border-radius: 99px; background: #f5f7ff; color: #4f46e5; font-size: 11px; font-weight: 600; white-space: nowrap; }
.missing-action { color: var(--muted); font-size: 12px; }
.pipeline { display: flex; align-items: flex-start; gap: 12px; overflow-x: auto; padding-bottom: 16px; }
.pipeline-column { width: 292px; min-width: 292px; border-radius: 9px; background: #eceef2; }
.inquiry-board .pipeline-column { width: auto; min-width: 180px; flex: 1 0 180px; }
.board-column-head { display: flex; align-items: center; gap: 8px; height: 46px; padding: 0 12px; cursor: pointer; list-style: none; }
.board-column-head::-webkit-details-marker { display: none; }
.board-scroll-actions { display: flex; justify-content: flex-end; align-items: center; gap: 7px; margin: -4px 0 10px; color: var(--muted); font-size: 11px; }
.board-scroll-actions[hidden] { display: none; }
.board-scroll-actions button { width: 31px; height: 29px; padding: 0; border: 1px solid var(--line); background: white; color: var(--ink); }
.board-column-head h2 { flex: 1; font-size: 13px; }
.board-column-head > span:last-child { color: var(--muted); font-size: 12px; }
.board-column-body { padding: 0 8px 8px; }
.deal-card { display: block; margin-bottom: 8px; padding: 13px; border: 1px solid var(--line); border-radius: 8px; background: white; color: var(--ink); box-shadow: var(--shadow); }
.deal-card:hover { border-color: #c7d2fe; text-decoration: none; }
.deal-card > strong, .deal-company { display: block; }
.deal-company { margin-top: 3px; color: var(--muted); font-size: 12px; }
.deal-meta { display: flex; gap: 10px; margin-top: 12px; color: var(--muted); font-size: 11px; }
.deal-next { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 7px; margin-top: 11px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 12px; }
.deal-next > span { color: var(--muted); }
.deal-next b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.deal-next time { color: var(--muted); }
.deal-next.late time { color: var(--danger); }
.deal-next.missing { display: block; color: var(--muted); }
.board-empty { padding: 30px 8px; color: var(--faint); text-align: center; font-size: 12px; }

.record-title { display: flex; align-items: center; gap: 12px; }
.record-title h1 { margin: 0; }
.record-title p { margin: 3px 0 0; color: var(--muted); }
.stage-path { display: flex; max-width: 100%; margin-bottom: 18px; overflow-x: auto; padding: 0 2px 5px; }
.mobile-stage-form { display: none; }
.stage-step { position: relative; display: flex; min-width: 118px; flex: 1; align-items: center; color: var(--faint); font-size: 11px; }
.stage-step button { display: flex; align-items: center; min-height: 32px; padding: 0; border: 0; background: transparent; color: inherit; cursor: pointer; }
.stage-step:after { content: ''; height: 2px; flex: 1; margin: 0 8px; background: var(--line-strong); }
.stage-step:last-child:after { display: none; }
.stage-step i { width: 9px; height: 9px; margin-right: 7px; border: 2px solid #c5cad3; border-radius: 50%; background: white; }
.stage-step.done { color: #4f46e5; }
.stage-step.done i, .stage-step.done:after { border-color: #818cf8; background: #818cf8; }
.stage-step.current { color: var(--ink-strong); font-weight: 600; }
.stage-step.current i { outline: 3px solid #e0e7ff; }
.stage-step.won i { border-color: var(--success); background: var(--success); outline-color: #dcfce7; }
.stage-step.lost i { border-color: var(--danger); background: var(--danger); outline-color: #fee2e2; }
.next-action-bar { display: flex; align-items: center; gap: 13px; margin-bottom: 20px; padding: 13px 16px; border: 1px solid #c7d2fe; border-radius: var(--radius); background: #f5f7ff; }
.next-action-bar.missing { border-color: var(--line-strong); background: var(--surface); }
.next-action-bar.missing .next-icon { background: var(--surface-soft); color: var(--muted); }
.next-action-bar.closed { border-color: #bbf7d0; background: var(--success-soft); }
.next-action-bar.closed .next-icon { background: #dcfce7; color: var(--success); }
.next-icon { display: grid; width: 30px; height: 30px; flex: 0 0 auto; place-items: center; border-radius: 50%; background: #e0e7ff; color: var(--brand); font-size: 17px; }
.next-content { min-width: 0; flex: 1; }
.next-content > span { color: var(--muted); font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.next-content p { margin: 2px 0; }
.next-content time, .next-content p > span { margin-left: 10px; color: var(--muted); font-size: 12px; }
.next-content a { margin-left: 8px; font-size: 11px; }
.record-layout { display: grid; grid-template-columns: minmax(0,1fr) 310px; align-items: start; gap: 20px; }
.record-main, .record-side { min-width: 0; }
.record-side { position: sticky; top: 80px; }
.record-tabs { display: flex; gap: 22px; margin-bottom: 10px; border-bottom: 1px solid var(--line); }
.record-tabs button { position: relative; min-height: 40px; padding: 6px 1px 10px; border: 0; border-radius: 0; background: transparent; color: var(--muted); font-weight: 500; }
.record-tabs button:hover { background: transparent; color: var(--ink); }
.record-tabs button[aria-current=page] { color: var(--ink-strong); }
.record-tabs button[aria-current=page]:after { content: ''; position: absolute; right: 0; bottom: -1px; left: 0; height: 2px; background: var(--brand); }
.record-tabs button span { margin-left: 3px; color: var(--faint); font-size: 11px; }
.side-card { overflow: visible; box-shadow: none; }
.side-card-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.side-card-head a { font-size: 12px; }
.data-list { margin: 0; padding: 15px 16px; }
.data-list dt { margin-top: 13px; color: var(--muted); font-size: 11px; }
.data-list dt:first-child { margin-top: 0; }
.data-list dd { margin: 3px 0 0; overflow-wrap: anywhere; }
.data-list.compact { padding-top: 4px; }
.contact-card { display: flex; align-items: center; gap: 10px; padding: 15px 16px 5px; }
.contact-card strong { display: block; }
.side-actions { display: flex; justify-content: space-between; padding: 12px 16px; border-top: 1px solid var(--line); font-size: 12px; }
.danger-link { color: var(--danger); }
.person-row { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.person-row > div { min-width: 0; flex: 1; }
.person-row > a { flex: 0 0 auto; font-size: 12px; }
.primary-contact-badge { display: inline-flex; margin-left: 7px; padding: 1px 6px; border-radius: 999px; background: var(--brand-soft); color: #4338ca; font-size: 10px; font-weight: 600; vertical-align: 1px; }
.person-actions { display: flex; flex: 0 0 auto !important; align-items: center; gap: 9px; font-size: 12px; }
.contact-action-row { min-width: 0; }
.contact-action-row > a { display: block; overflow: hidden; text-overflow: ellipsis; }
.contact-action-row > span { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; font-size: 12px; }
.contact-action-row .text-button, .person-actions .text-button { color: var(--brand); font-size: 12px; }
.small-avatar { width: 30px; height: 30px; }
.side-task { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); color: var(--ink); }
.side-task time { color: var(--muted); font-size: 11px; }
.customer-inquiry { display: grid; grid-template-columns: auto minmax(0,1fr) auto auto auto; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); color: var(--ink); }
.customer-inquiry:hover { background: #fafafa; text-decoration: none; }
.product-preview { display: block; min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inquiry-row .product-preview { display: -webkit-box; overflow: hidden; line-height: 1.45; white-space: normal; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.item-spec { margin-top: 4px; color: var(--ink) !important; line-height: 1.55; white-space: normal; }
.activity-feed { padding: 6px 18px 12px; }
.activity-feed article { display: grid; grid-template-columns: auto minmax(0,1fr); gap: 11px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.activity-feed article:last-child { border-bottom: 0; }
.activity-avatar { display: grid; width: 30px; height: 30px; place-items: center; border-radius: 50%; background: var(--surface-soft); color: var(--muted); font-weight: 700; }
.activity-meta { display: flex; align-items: baseline; flex-wrap: wrap; gap: 7px; }
.activity-meta span, .activity-meta time { color: var(--muted); font-size: 11px; }
.activity-meta time { margin-left: auto; }
.activity-feed article p { margin: 6px 0 0; }
.document-row { display: grid; grid-template-columns: auto minmax(0,1fr) auto auto; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); color: var(--ink); }
.document-row:hover { background: #fafafa; text-decoration: none; }
.document-kind { display: grid; width: 30px; height: 30px; place-items: center; border-radius: 7px; background: var(--brand-soft); color: var(--brand); font-size: 12px; font-weight: 700; }
.document-kind.order { background: var(--success-soft); color: var(--success); }
.document-type-badge { display: inline-flex; align-items: center; padding: 2px 7px; border-radius: 999px; background: var(--brand-soft); color: #4338ca; font-size: 11px; font-weight: 600; line-height: 1.5; white-space: nowrap; }
.document-type-badge.sample { background: #fff7ed; color: #b45309; }
.document-type-badge.order { background: var(--success-soft); color: var(--success); }
.document-customer, .document-amount { color: var(--ink-strong); font-weight: 600; }
.commercial-list { overflow: hidden; }
.commercial-card + .commercial-card { border-top: 1px solid var(--line); }
.commercial-card[data-new-document] { background: #f8faff; box-shadow: inset 3px 0 var(--brand); }
.commercial-head { display: grid; grid-template-columns: auto minmax(0,1fr) auto auto; align-items: center; gap: 12px; padding: 15px 18px 11px; }
.commercial-head strong, .commercial-head small { display: block; }
.commercial-head small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.commercial-head > a { font-size: 12px; }
.commercial-lines { margin: 0 18px 15px 60px; border: 1px solid var(--line); border-radius: 8px; background: #fafafa; }
.commercial-lines > div { display: grid; grid-template-columns: minmax(0,1fr) minmax(170px,.8fr) minmax(110px,.45fr); align-items: center; gap: 12px; padding: 10px 12px; border-top: 1px solid var(--line); }
.commercial-lines > div:first-child { border-top: 0; }
.commercial-lines strong, .commercial-lines small { display: block; }
.commercial-lines small { color: var(--muted); font-size: 11px; }
.deal-products { margin: 9px 0 3px; overflow: hidden; color: var(--ink); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }

.customer-summary { display: grid; grid-template-columns: .8fr 1.5fr .8fr 1fr; margin-bottom: 18px; }
.customer-summary > div { min-width: 0; padding: 17px 19px; }
.customer-summary > div + div { border-left: 1px solid var(--line); }
.customer-summary span, .customer-summary small { display: block; color: var(--muted); font-size: 11px; }
.customer-summary strong { display: block; margin: 5px 0 2px; overflow-wrap: anywhere; font-size: 21px; font-weight: 700; }
.summary-amounts strong { display: inline-block; margin-right: 18px; font-size: 17px; }
.customer-tabs { display: flex; gap: 24px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.customer-tabs a { position: relative; padding: 10px 2px 12px; color: var(--muted); font-weight: 600; }
.customer-tabs a:hover { color: var(--ink); text-decoration: none; }
.customer-tabs a[aria-current=page] { color: var(--ink-strong); }
.customer-tabs a[aria-current=page]:after { content: ''; position: absolute; right: 0; bottom: -1px; left: 0; height: 2px; background: var(--brand); }
.customer-tabs span { margin-left: 4px; color: var(--faint); font-size: 11px; }
.customer-workspace-grid { display: grid; grid-template-columns: minmax(0,1fr) 310px; align-items: start; gap: 18px; }
.customer-workspace-grid > aside { position: sticky; top: 78px; }
.customer-inquiry-list .customer-inquiry:last-child { border-bottom: 0; }
.stage-dot.closed { background: var(--faint); }
.customer-tab-filter { padding: 13px 18px; border-bottom: 1px solid var(--line); background: #fafafa; }
.customer-tab-filter label { display: flex; max-width: 430px; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; }
.customer-tab-filter select { flex: 1; }
.contact-record-list { padding: 0 18px; }
.contact-timeline { padding: 8px 20px 20px; }
.contact-day-heading { display: flex; align-items: center; gap: 12px; margin: 18px 0 2px; color: #475569; font-size: 12px; font-weight: 700; }
.contact-day-heading:first-child { margin-top: 8px; }
.contact-day-heading span { height: 1px; flex: 1; background: var(--line); }
.contact-record { display: grid; grid-template-columns: 92px minmax(0,1fr); padding: 17px 0; border-bottom: 1px solid var(--line); }
.contact-day-records .contact-record:last-child { border-bottom: 0; }
.contact-rail { display: flex; align-items: flex-end; flex-direction: column; gap: 7px; padding-right: 17px; color: var(--muted); font-size: 11px; }
.method-chip { display: inline-flex; padding: 3px 8px; border-radius: 999px; background: var(--brand-soft); color: #4338ca; font-size: 11px; font-weight: 600; white-space: nowrap; }
.contact-record-main { position: relative; min-width: 0; padding-left: 22px; border-left: 1px solid var(--line); }
.contact-record-main::before { content: ''; position: absolute; top: 3px; left: -4px; width: 7px; height: 7px; border: 2px solid white; border-radius: 50%; background: #cbd5e1; box-shadow: 0 0 0 1px #cbd5e1; }
.contact-day-records .contact-record:first-child .contact-record-main::before { background: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.contact-record-content { overflow-wrap: anywhere; color: var(--ink-strong); font-size: 14px; line-height: 1.8; }
.contact-record.is-collapsed .contact-record-content { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 4; }
.contact-expand { margin-top: 6px; color: var(--brand); font-size: 12px; }
.contact-record-meta { display: flex; align-items: flex-end; gap: 12px; margin-top: 13px; padding-top: 10px; border-top: 1px dashed var(--line); color: var(--muted); font-size: 11px; }
.contact-record-meta > div { display: flex; min-width: 0; flex-wrap: wrap; gap: 5px 15px; }
.contact-record-meta b { margin-right: 3px; color: var(--faint); font-weight: 500; }
.contact-recorder { flex: 0 0 auto; margin-left: auto; color: var(--faint); white-space: nowrap; }
.drawer-body section > .contact-timeline { margin: 0 -4px; padding: 0; }
.tab-heading-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.customer-document-head, .customer-document-row { display: grid; grid-template-columns: minmax(170px,1.2fr) minmax(170px,1fr) 105px 135px minmax(110px,.7fr); align-items: center; gap: 14px; }
.customer-document-head { padding: 10px 18px; border-bottom: 1px solid var(--line); background: #fafafa; color: var(--muted); font-size: 11px; }
.customer-document-row { min-height: 66px; padding: 11px 18px; border-bottom: 1px solid var(--line); color: var(--ink); }
.customer-document-row:hover { background: #fafafa; text-decoration: none; }
.customer-document-row strong, .customer-document-row small { display: block; }
.customer-document-row small, .customer-document-row time { color: var(--muted); font-size: 11px; }
.customer-document-row.voided, .voided-row { opacity: .62; }
body:has(.record-drawer) { overflow: hidden; }
.drawer-scrim { position: fixed; z-index: 44; inset: 0; background: rgba(15,23,42,.34); }
.record-drawer { position: fixed; z-index: 45; top: 0; right: 0; bottom: 0; width: min(860px,88vw); overflow-y: auto; border-left: 1px solid var(--line); background: var(--canvas); box-shadow: -20px 0 60px rgba(15,23,42,.16); }
.drawer-head { position: sticky; z-index: 2; top: 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 22px 24px 17px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.97); }
.drawer-head h2 { margin: 3px 0 4px; }
.drawer-head p { margin: 0; color: var(--muted); }
.drawer-close { display: grid; width: 38px; height: 38px; flex: 0 0 auto; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: white; color: var(--muted); font-size: 24px; }
.drawer-close:hover { text-decoration: none; }
.drawer-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 24px; border-bottom: 1px solid var(--line); background: white; }
.drawer-body { padding: 18px 24px 42px; }
.drawer-body section { margin-bottom: 16px; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: white; }
.drawer-body section h3 { margin: 0 0 12px; }
.drawer-row, .drawer-line { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 0; border-top: 1px solid var(--line); color: var(--ink); }
.drawer-row:first-of-type, .drawer-line:first-of-type { border-top: 0; }
.drawer-row:hover { text-decoration: none; }
.drawer-row > span:first-child, .drawer-line > span:first-child { min-width: 0; flex: 1; }
.drawer-row strong, .drawer-row small, .drawer-line strong, .drawer-line small { display: block; }
.drawer-row small, .drawer-line small, .drawer-entry time { color: var(--muted); font-size: 11px; }
.drawer-entry { padding: 12px 0; border-top: 1px solid var(--line); }
.drawer-entry:first-of-type { border-top: 0; }
.drawer-entry time { float: right; }
.drawer-entry p { margin: 5px 0 0; }
.drawer-total { display: flex; justify-content: flex-end; gap: 18px; padding-top: 15px; border-top: 1px solid var(--line); font-size: 17px; }
.void-banner { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; padding: 13px 16px; border: 1px solid #fecaca; border-radius: 9px; background: var(--danger-soft); color: #991b1b; }
.void-banner span { color: #b91c1c; }
.record-drawer .void-banner { margin: 14px 24px 0; }
.document-filter-grid { display: grid; grid-template-columns: minmax(220px,1.5fr) repeat(5,minmax(125px,1fr)); align-items: end; gap: 12px; }
.document-filter-grid label { display: block; margin-bottom: 5px; color: var(--muted); font-size: 11px; }
.document-filter-grid input, .document-filter-grid select { width: 100%; }
.document-filter-grid .filter-actions { flex-wrap: nowrap; }

.filters { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 16px; }
.filters > input { min-width: 220px; flex: 1; }
.filters > select { width: 140px; }
.advanced { width: 100%; color: var(--muted); font-size: 12px; }
summary { cursor: pointer; }
.filter-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(170px,1fr)); align-items: end; gap: 12px; padding-top: 12px; }
.filter-grid label, .filter-grid > div > label { display: block; color: var(--muted); font-size: 12px; }
.filter-grid input, .filter-grid select { display: block; width: 100%; margin-top: 5px; }
.responsive-table { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; text-align: left; }
th { padding: 10px 16px; background: #fafafa; color: var(--muted); font-size: 11px; font-weight: 500; white-space: nowrap; }
td { padding: 13px 16px; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
tbody tr:hover { background: #fcfcfd; }
.pagination { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 12px; padding: 16px; color: var(--muted); font-size: 12px; }
.empty { padding: 42px 20px; color: var(--muted); text-align: center; }
.empty h3 { margin-bottom: 4px; }
.empty p { margin-bottom: 12px; font-size: 12px; }
.empty-icon { display: block; margin-bottom: 5px; color: #a5b4fc; font-size: 28px; }
.compact-empty { padding: 24px 15px; font-size: 12px; }
.notice { margin-bottom: 18px; padding: 12px 15px; border: 1px solid #c7d2fe; border-radius: 8px; background: var(--brand-soft); color: #3730a3; }
.notice.success { border-color: #bbf7d0; background: var(--success-soft); color: var(--success); }
.notice.error, .errorlist { color: #b91c1c; }
.notice.error { border-color: #fecaca; background: var(--danger-soft); }
.form-panel { max-width: 780px; }
.inquiry-create-form { max-width: 1080px; }
.form-section { padding: 24px; }
.form-section-title { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 20px; }
.form-section-title > span { display: grid; width: 26px; height: 26px; flex: 0 0 auto; place-items: center; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-size: 12px; font-weight: 700; }
.form-section-title p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.choice-block { padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: #fafafa; }
.choice-block label, .form-grid label { display: block; margin-bottom: 6px; font-weight: 600; }
.choice-block select { width: 100%; }
.or-divider { display: flex; align-items: center; gap: 12px; margin: 17px 0; color: var(--faint); font-size: 11px; }
.or-divider:before, .or-divider:after { content: ''; height: 1px; flex: 1; background: var(--line); }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 15px; }
.form-grid.one-column { grid-template-columns: 1fr; }
.form-grid input, .form-grid select, .form-grid textarea { width: 100%; }
.customer-mode-switch { display: grid; grid-template-columns: 1fr 1fr; max-width: 520px; margin-bottom: 16px; padding: 3px; border-radius: 9px; background: var(--surface-soft); }
.customer-mode-switch button { min-height: 38px; border-color: transparent; background: transparent; color: var(--muted); }
.customer-mode-switch button[aria-pressed=true] { border-color: var(--line); background: white; color: var(--ink-strong); box-shadow: var(--shadow); }
.choice-block input[type=search] { width: 100%; margin-bottom: 9px; }
.customer-search-empty { margin: 9px 0 0; color: var(--muted); font-size: 12px; }
.customer-extra { margin-top: 15px; border-top: 1px solid var(--line); padding-top: 12px; }
.customer-extra summary { color: var(--brand); cursor: pointer; font-weight: 600; }
.customer-extra .form-grid { margin-top: 12px; }
.checkbox-field { display: flex; align-items: center; gap: 8px; align-self: end; min-height: 40px; }
.checkbox-field input { width: auto; min-height: auto; }
.checkbox-field label { margin: 0; }
.formset-heading { margin: 0; }
.formset-heading .form-section-title { margin: 0; }
.product-formset #product-lines { padding: 0 20px 4px; }
.product-form-row { display: grid; grid-template-columns: minmax(150px,1.2fr) minmax(130px,1fr) minmax(135px,1fr) minmax(90px,.55fr) minmax(70px,.4fr); gap: 10px; padding: 16px 0; border-top: 1px solid var(--line); }
.product-form-row:first-child { border-top: 0; }
.product-field label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 11px; }
.product-field input, .product-field select, .product-field textarea { width: 100%; }
.product-form-row .field-spec { grid-column: 1 / -1; }
.inquiry-submit { max-width: 1080px; justify-content: flex-end; }
.edit-form { padding: 24px; }
.padded .edit-form { padding: 0; }
.edit-form > div, .login-card form > div { margin-bottom: 17px; }
.edit-form label, .login-card label { display: block; margin-bottom: 6px; font-weight: 600; }
.edit-form > div:has(#id_transfer_target), .edit-form > div:has(#id_release_to_pool), .edit-form > div:has(#id_transfer_reason) { margin-bottom: 0; padding: 14px 16px; border: 1px solid #fed7aa; background: #fffaf5; }
.edit-form > div:has(#id_transfer_target) { border-radius: 9px 9px 0 0; }
.edit-form > div:has(#id_release_to_pool), .edit-form > div:has(#id_transfer_reason) { border-top: 0; }
.edit-form > div:has(#id_transfer_reason) { margin-bottom: 17px; border-radius: 0 0 9px 9px; }
.edit-form input:not([type=checkbox]), .edit-form select, .edit-form textarea, .login-card input { width: 100%; }
.helptext { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; }
.form-actions { display: flex; gap: 9px; padding-top: 12px; }
.errorlist { padding-left: 18px; font-size: 12px; }
.compact-form { max-width: 700px; }
.line-form { display: grid; grid-template-columns: 62px 120px minmax(180px,1.5fr) minmax(100px,1fr) minmax(100px,1fr); align-items: start; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.line-form:hover { background: #fcfcfd; }
.line-field label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 11px; }
.line-field input:not([type=checkbox]), .line-field select { width: 100%; }
.line-field textarea { width: 100%; resize: vertical; }
.line-field[hidden] { display: none; }
.document-form .field-line_type { display: none; }
.editable-document-line { grid-template-columns: 52px repeat(11,minmax(0,1fr)); }
.editable-document-line .field-selected { grid-column: 1; grid-row: 1; }
.editable-document-line .field-item { grid-column: 2 / span 3; grid-row: 1; }
.editable-document-line .field-name { grid-column: 5 / span 3; grid-row: 1; }
.editable-document-line .field-quantity { grid-column: 8 / span 2; grid-row: 1; }
.editable-document-line .field-unit { grid-column: 10; grid-row: 1; }
.editable-document-line .field-price { grid-column: 11 / span 2; grid-row: 1; }
.editable-document-line .field-category { grid-column: 2 / span 3; grid-row: 2; }
.editable-document-line .field-drawing { grid-column: 5 / span 3; grid-row: 2; }
.editable-document-line .field-spec { grid-column: 8 / span 5; grid-row: 2; }
.editable-document-line.is-fee .field-fee { grid-column: 2 / span 6; grid-row: 1; }
.line-field small { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; }
.quick-line { grid-template-columns: repeat(12,minmax(0,1fr)); }
.quick-line .field-selected { grid-column: 1; grid-row: 1; }
.quick-line .field-line_type { grid-column: 2 / span 2; grid-row: 1; }
.quick-line .field-name { grid-column: 4 / span 3; grid-row: 1; }
.quick-line .field-category { grid-column: 7 / span 2; grid-row: 1; }
.quick-line .field-quantity { grid-column: 9 / span 2; grid-row: 1; }
.quick-line .field-price { grid-column: 11 / span 2; grid-row: 1; }
.quick-line .field-drawing { grid-column: 4 / span 3; grid-row: 2; }
.quick-line .field-spec { grid-column: 7 / span 4; grid-row: 2; }
.quick-line .field-unit { grid-column: 11 / span 2; grid-row: 2; }
.quick-line.is-fee .field-fee { grid-column: 4 / span 5; grid-row: 1; }
.total { display: flex; align-items: center; justify-content: flex-end; gap: 20px; padding: 18px; border-top: 1px solid var(--line); background: #fafafa; }
.total strong { font-size: 22px; }
.warning-text { color: var(--amber); }
.login-card { width: min(420px,100%); padding: 32px; border: 1px solid var(--line); border-radius: 14px; background: white; box-shadow: 0 18px 50px rgba(15,23,42,.08); }
.login-card .brand { font-size: 20px; }
.auth-brand { margin-bottom: 24px; }
.login-card h1 { margin-top: 28px; font-size: 22px; }
.login-card form { margin: 24px 0; }
.auth-main { display: grid; min-height: 100vh; place-items: center; background: radial-gradient(circle at top left,#eef2ff,transparent 50%),var(--canvas); }
.auth-main > .content { width: 100%; padding: 20px; }
.qr { display: block; width: 230px; max-width: 100%; }
.settings-group-title { margin: 28px 2px 10px; color: var(--muted); font-size: 13px; font-weight: 700; letter-spacing: .04em; }
.settings-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; }
.compact-row { display: flex; min-height: 54px; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 18px; border-bottom: 1px solid var(--line); }
.compact-row:last-child { border-bottom: 0; }
.compact-row > div, .compact-row > span { min-width: 0; }
.compact-row strong { display: block; }
.compact-row small { margin-top: 2px; }
.compact-row > a { flex: 0 0 auto; font-size: 12px; }
.compact-row.sortable-row > span { flex: 1; }
.brand-preview { display: flex; align-items: center; gap: 10px; margin: 14px 0 18px; padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-soft); }
.brand-preview .brand-mark { width: 38px; height: 38px; }
.tag-picker { overflow: hidden; border: 1px solid var(--line-strong); border-radius: 8px; background: white; }
.tag-picker:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.tag-search { width: 100%; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: #fafafa; }
.tag-search:focus { box-shadow: none; }
.tag-choice-list { display: flex; max-height: 220px; flex-wrap: wrap; align-content: flex-start; gap: 8px; overflow-y: auto; padding: 11px; }
.tag-choice-list > div { margin: 0; }
.tag-choice-list label { display: inline-flex; align-items: center; gap: 6px; margin: 0; padding: 7px 10px; border: 1px solid var(--line); border-radius: 999px; background: white; cursor: pointer; font-size: 12px; font-weight: 500; }
.tag-choice-list label:has(input:checked) { border-color: #a5b4fc; background: var(--brand-soft); color: #3730a3; }
.tag-choice-list input { width: 15px; height: 15px; margin: 0; }
.sortable-row { transition: opacity .15s ease, background .15s ease; }
.sortable-row.is-dragging { opacity: .42; background: var(--brand-soft); }
.drag-handle { display: grid; width: 30px; height: 30px; flex: 0 0 auto; place-items: center; padding: 0; border: 0; background: transparent; color: var(--faint); font-size: 19px; cursor: grab; touch-action: none; }
.drag-handle:active { cursor: grabbing; }
.sort-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 7px; }
.sort-actions button { display: none; width: 30px; height: 30px; padding: 0; border: 1px solid var(--line); background: white; color: var(--muted); }
.sort-actions a { font-size: 12px; }
.customer-metrics { display: grid; grid-template-columns: 1fr 1.2fr; }
.customer-metrics > div { min-width: 0; padding: 15px 16px; }
.customer-metrics > div + div { border-left: 1px solid var(--line); }
.customer-metrics span, .customer-metrics small { display: block; color: var(--muted); font-size: 11px; }
.customer-metrics strong { display: block; margin: 5px 0 3px; overflow-wrap: anywhere; font-size: 19px; }
.settings-card { margin-bottom: 0; }
.settings-link-card { display: flex; min-height: 120px; align-items: center; justify-content: space-between; gap: 20px; padding: 20px; color: var(--ink); }
.settings-link-card:hover { border-color: #c7d2fe; box-shadow: 0 8px 25px rgba(79,70,229,.08); }
.settings-link-card h2 { margin: 0 0 5px; }
.settings-link-card p { margin: 0 0 12px; color: var(--muted); font-size: 12px; }
.settings-link-card small { color: var(--faint); }
.settings-link-card > span { color: var(--brand); font-weight: 600; }
.data-actions { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
.data-actions > div { padding: 20px; }
.data-actions > div + div { border-left: 1px solid var(--line); }
.data-actions p { min-height: 42px; margin: 5px 0 14px; color: var(--muted); font-size: 12px; }
.data-actions.three { grid-template-columns: repeat(3,minmax(0,1fr)); }
.data-actions .danger-zone { background: var(--danger-soft); }
.danger-button { border-color: #fecaca; color: var(--danger); }
.danger-button:hover { border-color: #fca5a5; background: #fee2e2; }
.empty-actions { justify-content: center; margin-top: 12px; }
.option-list-head, .option-list-row { display: grid; grid-template-columns: 34px minmax(180px,1fr) 80px 110px minmax(150px,auto); align-items: center; gap: 12px; }
.option-list-row { min-height: 56px; padding: 10px 18px; border-bottom: 1px solid var(--line); }
.option-list-row > .actions { justify-content: flex-end; }
.option-list-row .text-button { font-size: 12px; }
.customer-share small { margin-left: 6px; color: var(--muted); font-weight: 400; }
.edit-form > div:has(#id_is_sample) { display: flex; align-items: center; gap: 10px; padding: 13px 15px; border: 1px solid #fed7aa; border-radius: 8px; background: #fffaf5; }
.edit-form > div:has(#id_is_sample) label { margin: 0; }
#id_is_sample { order: -1; width: 18px; height: 18px; }

.stats-period { margin: 10px 2px 4px; }
.stats-scope-note { margin: 0 2px 18px; font-size: 12px; }
.statistics-block-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 22px 2px 11px; }
.statistics-block-heading h2 { margin: 0; font-size: 17px; }
.statistics-block-heading p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.stat-card-link { color: inherit; text-decoration: none; transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease; }
.stat-card-link:hover { transform: translateY(-1px); border-color: color-mix(in srgb,var(--card-color) 34%,var(--line)); box-shadow: 0 8px 22px rgba(15,23,42,.08); }
.stat-card-link:focus-visible { outline: 3px solid color-mix(in srgb,var(--card-color) 28%,transparent); outline-offset: 2px; }
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit,minmax(180px,1fr)); gap: 12px; margin-bottom: 16px; }
.stat-card { position: relative; overflow: hidden; min-height: 132px; padding: 20px; border: 1px solid var(--line); border-radius: 12px; background: white; box-shadow: var(--shadow); }
.stat-card::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 5px; background: var(--card-color); }
.stat-card::after { content: ''; position: absolute; width: 90px; height: 90px; right: -36px; top: -36px; border-radius: 50%; background: color-mix(in srgb,var(--card-color) 12%,white); }
.stat-card span, .stat-card small { display: block; color: var(--muted); }
.stat-card strong { display: block; margin: 9px 0 4px; color: #172033; font-size: 27px; font-weight: 700; line-height: 1.1; }
.stat-card.blue { --card-color: #2563eb; } .stat-card.teal { --card-color: #0d9488; } .stat-card.violet { --card-color: #7c3aed; } .stat-card.amber { --card-color: #d97706; } .stat-card.red { --card-color: #dc2626; }
.stats-grid { display: grid; grid-template-columns: minmax(0,1.35fr) minmax(320px,.85fr); gap: 16px; margin-bottom: 16px; }
.chart-panel { min-width: 0; }
.chart-group { padding: 18px 20px 20px; }
.chart-group + .chart-group { padding-top: 18px; border-top: 1px solid var(--line); }
.chart-group h3 { margin: 0 0 14px; font-size: 13px; color: var(--muted); }
.bar-row { margin-bottom: 15px; }
.bar-row > div:first-child { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 6px; font-size: 13px; }
.bar-row > div:first-child > span { min-width: 0; overflow-wrap: anywhere; }
.bar-row strong { flex: 0 0 auto; font-variant-numeric: tabular-nums; }
.bar-track { overflow: hidden; height: 10px; border-radius: 999px; background: #edf2f7; }
.bar-track i { display: block; min-width: 3px; height: 100%; border-radius: inherit; background: linear-gradient(90deg,#2563eb,#38bdf8); }
.donut-layout { display: grid; grid-template-columns: 150px 1fr; align-items: center; gap: 22px; padding: 8px 22px 24px; }
.donut { display: grid; place-items: center; width: 146px; aspect-ratio: 1; border-radius: 50%; }
.donut::before { content: ''; grid-area: 1/1; width: 88px; aspect-ratio: 1; border-radius: 50%; background: white; }
.donut span { z-index: 1; grid-area: 1/1; text-align: center; }
.donut strong, .donut small { display: block; }
.donut strong { font-size: 25px; font-weight: 700; }
.donut small { color: var(--muted); }
.chart-legend { min-width: 0; }
.chart-legend > div { display: grid; grid-template-columns: 10px minmax(0,1fr) auto; align-items: center; gap: 8px; padding: 7px 0; font-size: 12px; }
.chart-legend i { width: 9px; height: 9px; border-radius: 3px; }
.chart-legend span { min-width: 0; overflow-wrap: anywhere; line-height: 1.35; }
.statistics-details { margin-top: 12px; border-top: 1px solid var(--line); }
.statistics-details > summary { padding: 13px 2px 2px; color: var(--brand); font-size: 12px; font-weight: 600; list-style-position: inside; }
.chart-more > summary { padding-bottom: 7px; }
.details-bars { padding-top: 8px; }
.details-bars .bar-row:last-child { margin-bottom: 2px; }
.loss-bar i { background: linear-gradient(90deg,#dc2626,#fb923c); }
.source-bar i { background: linear-gradient(90deg,#0f766e,#2dd4bf); }
.customer-share-panel, .sales-share-panel { margin-bottom: 16px; }
.category-detail-panel { margin-bottom: 18px; }
.category-detail-disclosure { margin-top: 0; }
.category-detail-disclosure > summary { padding: 15px 20px; }
.category-detail-disclosure[open] > summary { border-bottom: 1px solid var(--line); }
.category-detail-disclosure .responsive-table { padding: 0; }
.ranking-list { margin-top: 10px; border: 1px solid var(--line); border-radius: 8px; background: #fafafa; }
.ranking-list > div { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 12px; border-top: 1px solid var(--line); font-size: 12px; }
.ranking-list > div:first-child { border-top: 0; }
.ranking-list span { min-width: 0; }
.ranking-list a, .ranking-list small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ranking-list small { margin-top: 2px; color: var(--muted); }
.mobile-category-details { display: none; }

.quick-status-form { display: flex; flex-direction: column; gap: 5px; }
.quick-status-form label { display: flex; align-items: center; justify-content: space-between; gap: 7px; color: var(--muted); font-size: 11px; }
.quick-status-form select { width: 112px; min-height: 30px; padding: 4px 24px 4px 7px; border-radius: 999px; background-color: var(--surface-soft); font-size: 12px; }
.quick-status-form.is-saving { opacity: .55; pointer-events: none; }

.followup-open { overflow: hidden; }
.quick-followup-layer { position: fixed; z-index: 60; inset: 0; }
.quick-followup-layer[hidden] { display: none; }
.quick-followup-scrim { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; border-radius: 0; background: rgba(15,23,42,.34); }
.quick-followup-drawer { position: absolute; top: 0; right: 0; bottom: 0; width: min(560px,92vw); overflow-y: auto; border-left: 1px solid var(--line); background: var(--canvas); box-shadow: -20px 0 60px rgba(15,23,42,.16); }
.quick-followup-form { padding: 18px 24px 34px; }
.quick-form-fields { padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: white; }
.quick-form-fields > div { margin-bottom: 15px; }
.quick-form-fields > div:last-child { margin-bottom: 0; }
.quick-form-fields label { display: block; margin-bottom: 6px; font-weight: 600; }
.quick-form-fields input:not([type=checkbox]), .quick-form-fields select, .quick-form-fields textarea { width: 100%; }
.quick-form-actions { display: flex; justify-content: flex-end; gap: 9px; padding-top: 14px; }

@media (max-width: 1080px) {
  .sidebar { width: 205px; }
  .main { margin-left: 205px; }
  .topbar { gap: 10px; padding: 0 18px; }
  .global-search { width: auto; min-width: 0; flex: 1; }
  .topbar-scope-label { display: none; }
  .topbar-scope .segmented a { padding: 5px 8px; white-space: nowrap; }
  .quick-create { flex: 0 0 auto; white-space: nowrap; }
  .content { padding: 28px 24px 64px; }
  .record-layout { grid-template-columns: minmax(0,1fr) 275px; }
  .home-grid { grid-template-columns: 1fr; }
  .focus-stats { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .focus-stat { border-bottom: 1px solid var(--line); }
  .focus-stat:nth-child(3n) { border-right: 0; }
  .focus-stat:nth-child(n+4) { border-bottom: 0; }
  .list-header, .inquiry-row { grid-template-columns: minmax(210px,1.45fr) 100px minmax(130px,.9fr) minmax(150px,1fr); }
  .list-header > span:last-child, .inquiry-row > div:last-child { display: none; }
  .customer-list-head, .customer-list-row { grid-template-columns: minmax(220px,1.5fr) minmax(190px,1fr) 65px minmax(100px,.7fr); }
  .customer-list-head > span:last-child, .customer-list-row > div:last-child { display: none; }
  .line-form:not(.quick-line) { grid-template-columns: 60px 1fr 1fr; }
  .editable-document-line .line-field { grid-column: auto; grid-row: auto; }
  .editable-document-line .field-selected { grid-column: 1; }
  .editable-document-line .field-item, .editable-document-line .field-name, .editable-document-line .field-spec, .editable-document-line.is-fee .field-fee { grid-column: span 2; }
  .quick-line { grid-template-columns: repeat(6,minmax(0,1fr)); }
  .quick-line .line-field { grid-row: auto; }
  .quick-line .field-selected { grid-column: span 1; }
  .quick-line .field-line_type { grid-column: span 2; }
  .quick-line .field-name { grid-column: span 3; }
  .quick-line .field-category, .quick-line .field-drawing { grid-column: span 2; }
  .quick-line .field-quantity, .quick-line .field-unit, .quick-line .field-price { grid-column: span 1; }
  .quick-line .field-spec { grid-column: span 4; }
  .quick-line.is-fee .field-fee { grid-column: span 3; }
  .stats-grid { grid-template-columns: 1fr; }
  .customer-summary { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .customer-summary > div:nth-child(3) { border-top: 1px solid var(--line); border-left: 0; }
  .customer-summary > div:nth-child(4) { border-top: 1px solid var(--line); }
  .customer-workspace-grid { grid-template-columns: 1fr; }
  .customer-workspace-grid > aside { position: static; }
  .document-filter-grid { grid-template-columns: repeat(3,minmax(150px,1fr)); }
  .product-form-row { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .product-form-row .field-spec { grid-column: span 2; }
}

@media (max-width: 1100px) {
  .toolbar-controls { flex-wrap: wrap; }
  .toolbar-controls .search-control { min-width: 220px; flex: 1 1 280px; }
  .toolbar-controls select { max-width: none; flex: 1 1 145px; }
  .toolbar-controls .filter-actions { flex: 1 1 auto; }
  .list-header { display: none; }
  .inquiry-row { display: grid; grid-template-columns: minmax(0,.75fr) minmax(0,1.25fr); gap: 11px; padding: 15px; }
  .inquiry-name { grid-column: 1 / -1; }
  .inquiry-row > div { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 10px; }
  .inquiry-row > div[data-label]:before { content: attr(data-label); flex: 0 0 auto; color: var(--muted); font-size: 11px; }
  .inquiry-row .inquiry-name { justify-content: flex-start; }
  .inquiry-row > div:last-child { display: flex; }
  .inquiry-row .product-cell { align-items: flex-start; }
  .inquiry-row .product-preview { min-width: 0; white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
  .inquiry-row .product-cell small { flex: 0 0 auto; color: var(--muted); }
  .inquiry-row .next-cell { grid-column: 1 / -1; padding-top: 9px; border-top: 1px solid var(--line); }
  .inquiry-row .next-cell strong { white-space: normal; }
  .inquiry-row .owner-cell { grid-column: 1 / -1; }
  .inquiry-board { display: grid; grid-template-columns: minmax(0,1fr); overflow: visible; padding-bottom: 0; }
  .inquiry-board .pipeline-column { width: 100%; min-width: 0; }
  .board-scroll-actions { display: none !important; }
}

@media (max-width: 760px) {
  html { scroll-padding-bottom: calc(100px + env(safe-area-inset-bottom)); }
  body { font-size: 15px; }
  h1 { font-size: 22px; }
  .sidebar { display: flex; width: min(300px,86vw); transform: translateX(-105%); transition: transform .2s ease; box-shadow: 30px 0 70px rgba(15,23,42,.2); }
  .menu-open .sidebar { transform: translateX(0); }
  .sidebar-close { display: inline-flex; }
  .mobile-scrim { position: fixed; z-index: 35; inset: 0; background: rgba(15,23,42,.35); }
  .menu-open .mobile-scrim { display: block; }
  .main { margin-left: 0; }
  .topbar { height: 56px; padding: 0 12px; }
  .mobile-menu-button { display: inline-flex; }
  .global-search { width: auto; flex: 1; }
  .global-search input { min-height: 36px; }
  .quick-create { display: none; }
  .content { padding: 20px 16px calc(180px + env(safe-area-inset-bottom)); }
  .mobile-nav { position: fixed; z-index: 32; right: 0; bottom: 0; left: 0; display: grid; grid-template-columns: repeat(5,1fr); align-items: end; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(255,255,255,.98); }
  .mobile-nav a, .mobile-nav button { display: flex; min-height: 48px; flex-direction: column; align-items: center; justify-content: center; gap: 1px; padding: 2px; border: 0; background: transparent; color: var(--muted); font-size: 10px; font-weight: 600; }
  .mobile-nav .nav-icon { width: 20px; height: 20px; }
  .mobile-nav a[aria-current=page] { color: var(--brand); }
  .mobile-nav .mobile-create { align-self: center; width: 43px; height: 43px; min-height: 43px; justify-self: center; margin-top: -17px; border-radius: 50%; background: var(--brand); color: white; font-size: 24px; box-shadow: 0 7px 18px rgba(79,70,229,.28); }
  .page-heading, .record-header { flex-direction: column; gap: 14px; margin-bottom: 18px; }
  .topbar { gap: 8px; }
  .topbar-scope { gap: 0; }
  .topbar-scope-label, .topbar-scope .scope-switch { display: none; }
  .mobile-scope { display: block; }
  .task-view-toolbar { align-items: stretch; flex-direction: column; }
  .task-view-toolbar .segmented { width: 100%; }
  .task-view-toolbar .segmented a { flex: 1; text-align: center; }
  .scope-owner-filter { width: 100%; margin: 0; }
  .scope-owner-filter select { width: 100%; }
  .compact-heading { align-items: flex-start; }
  .page-heading .button.primary, .record-actions { width: 100%; }
  .record-actions .button { flex: 1; }
  .customer-summary { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .customer-summary > div { padding: 14px; }
  .customer-summary > div:nth-child(odd) { border-left: 0; }
  .customer-summary > div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .customer-summary strong { font-size: 18px; }
  .summary-amounts strong { display: block; margin-right: 0; font-size: 15px; }
  .customer-tabs { gap: 20px; overflow-x: auto; }
  .customer-tabs a { flex: 0 0 auto; white-space: nowrap; }
  .tab-heading-actions { align-items: stretch; flex-direction: column; }
  .tab-heading-actions > .button { width: 100%; }
  .customer-tab-filter { padding: 12px 14px; }
  .customer-tab-filter label { max-width: none; align-items: stretch; flex-direction: column; gap: 6px; }
  .customer-document-head { display: none; }
  .customer-document-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 7px 12px; padding: 14px; }
  .customer-document-row > span:nth-child(2) { grid-column: 1 / -1; color: var(--muted); }
  .customer-document-row > time { grid-column: 1; color: var(--muted); }
  .customer-document-row > b { grid-column: 2; grid-row: 1; }
  .customer-document-row > span:last-child { grid-column: 2; grid-row: 3; text-align: right; }
  .contact-record-list { padding: 0 14px; }
  .contact-timeline { padding: 8px 16px 17px; }
  .contact-day-heading { margin-top: 15px; }
  .contact-record { grid-template-columns: 1fr; gap: 10px; padding: 16px 0; }
  .contact-rail { align-items: center; flex-direction: row; justify-content: space-between; padding-right: 0; }
  .contact-record-main { padding-left: 0; border-left: 0; }
  .contact-record-main::before { display: none; }
  .contact-record-content { font-size: 15px; }
  .contact-record-meta { align-items: flex-start; flex-direction: column; gap: 7px; }
  .contact-recorder { margin-left: auto; }
  .record-drawer { width: 100vw; border-left: 0; }
  .drawer-head { padding: 17px 14px 14px; }
  .drawer-head h2 { font-size: 21px; }
  .drawer-actions { padding: 12px 14px; }
  .drawer-actions .button { flex: 1 1 calc(50% - 4px); }
  .drawer-body { padding: 14px 14px calc(32px + env(safe-area-inset-bottom)); }
  .drawer-body section { padding: 14px; }
  .drawer-row, .drawer-line { align-items: flex-start; flex-wrap: wrap; }
  .drawer-row > span:first-child, .drawer-line > span:first-child { flex-basis: 100%; }
  .drawer-entry time { float: none; display: block; margin-top: 3px; }
  .record-drawer .void-banner { margin: 12px 14px 0; }
  .void-banner { flex-direction: column; gap: 4px; }
  .document-filter-grid { grid-template-columns: 1fr; }
  .document-filter-grid .filter-actions { width: 100%; }
  .document-filter-grid .filter-actions > * { flex: 1; }
  .focus-stats { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .focus-stat { padding: 13px 14px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
  .focus-stat:nth-child(3n) { border-right: 1px solid var(--line); }
  .focus-stat:nth-child(even) { border-right: 0; }
  .focus-stat:nth-child(n+5) { border-bottom: 0; }
  .focus-stat strong { font-size: 22px; }
  .desktop-action { display: none; }
  .dashboard-heading { align-items: flex-start; }
  .dashboard-owner-filter { width: 48%; }
  .dashboard-owner-filter select { width: 100%; min-width: 0; }
  .action-notice { align-items: flex-start; gap: 10px; }
  .task-row { grid-template-columns: auto minmax(0,1fr) auto; gap: 10px; padding: 13px 14px; }
  .task-actions { grid-column: 2 / -1; }
  .task-actions .button { flex: 1; }
  .task-title { white-space: normal; }
  .task-row.completed { grid-template-columns: auto minmax(0,1fr) auto; }
  .task-row.completed .task-completion { grid-column: 2 / -1; grid-row: 2; grid-template-columns: repeat(2,minmax(0,1fr)); padding-top: 9px; border-top: 1px solid var(--line); }
  .task-row.completed .task-completed { grid-column: 3; grid-row: 1; }
  .toolbar-controls { flex-wrap: wrap; }
  .search-control { min-width: 100%; }
  .toolbar-controls select { max-width: none; min-width: 135px; flex: 1 1 calc(50% - 5px); }
  .toolbar-controls > .button { flex: 1 1 90px; }
  .filter-actions { flex: 1 1 100%; }
  .filter-actions .button { flex: 1; }
  .segmented { width: 100%; overflow-x: auto; }
  .segmented a { flex: 1; text-align: center; white-space: nowrap; }
  .list-header { display: none; }
  .inquiry-row { display: grid; grid-template-columns: minmax(0,.75fr) minmax(0,1.25fr); gap: 11px; padding: 15px; }
  .inquiry-name { grid-column: 1 / -1; }
  .inquiry-row > div { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 10px; }
  .inquiry-row .product-preview { min-width: 0; }
  .inquiry-row > div[data-label]:before { content: attr(data-label); color: var(--muted); font-size: 11px; }
  .inquiry-row > div:last-child { display: flex; }
  .inquiry-row .next-cell { grid-column: 1 / -1; padding-top: 9px; border-top: 1px solid var(--line); }
  .inquiry-row .next-cell strong { white-space: normal; }
  .customer-list-head { display: none; }
  .customer-list-row { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; padding: 15px; }
  .customer-list-row .inquiry-name { grid-column: 1 / -1; }
  .customer-list-row > div { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
  .customer-list-row > div:before { content: attr(data-label); margin-right: auto; color: var(--muted); font-size: 11px; }
  .customer-list-row > div:last-child { display: flex; }
  .customer-list-row > div:nth-child(2) { grid-column: 1 / -1; padding-top: 8px; border-top: 1px solid var(--line); }
  .pipeline:not(.inquiry-board) .pipeline-column { width: 82vw; min-width: 82vw; }
  .record-title { align-items: flex-start; }
  .record-title .company-avatar { margin-top: 2px; }
  .stage-path { margin-right: -14px; }
  .stage-step { min-width: 105px; }
  .stage-step span { white-space: nowrap; }
  .mobile-stage-form { display: flex; align-items: end; gap: 9px; margin-bottom: 14px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: white; }
  .mobile-stage-form label { flex: 1; color: var(--muted); font-size: 12px; }
  .mobile-stage-form select { display: block; width: 100%; margin-top: 5px; color: var(--ink); }
  .stage-path { display: none; }
  .next-action-bar { align-items: flex-start; flex-wrap: wrap; }
  .next-content { width: calc(100% - 44px); flex: none; }
  .next-content p > span, .next-content time { display: block; margin: 3px 0; }
  .next-action-bar > .button { width: 100%; }
  .record-layout { display: flex; flex-direction: column; }
  .record-main, .record-side { width: 100%; }
  .record-side { position: static; }
  .record-tabs { position: sticky; z-index: 20; top: 55px; overflow-x: auto; background: var(--canvas); }
  .record-tabs button { flex: 1; white-space: nowrap; }
  .customer-layout .record-side { order: -1; }
  .customer-inquiry { grid-template-columns: auto minmax(0,1fr) auto; }
  .customer-inquiry .muted, .customer-inquiry > span:last-child { display: none; }
  .activity-meta time { width: 100%; margin-left: 0; }
  .document-row { grid-template-columns: auto minmax(0,1fr) auto; }
  .document-row > span:last-child { display: none; }
  .section-heading { min-height: 64px; align-items: flex-start; padding: 16px; }
  .section-heading .actions { justify-content: flex-end; }
  .responsive-table { overflow: visible; }
  table, tbody, tr, td { display: block; width: 100%; }
  thead { display: none; }
  tr { padding: 12px 14px; border-top: 1px solid var(--line); }
  td { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 6px 0; border: 0; text-align: right; }
  td[data-label]:before { content: attr(data-label); margin-right: auto; color: var(--muted); font-size: 11px; text-align: left; }
  td small { width: 100%; text-align: right; }
  td .empty { width: 100%; text-align: center; }
  .filter-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .filters { padding: 14px; }
  .filters > input { min-width: 100%; }
  .line-form:not(.quick-line) { grid-template-columns: repeat(2,minmax(0,1fr)); padding: 16px; }
  .editable-document-line .line-field { grid-column: auto; grid-row: auto; }
  .editable-document-line .field-item, .editable-document-line .field-name, .editable-document-line .field-spec, .editable-document-line.is-fee .field-fee { grid-column: 1 / -1; }
  .product-formset #product-lines { padding: 0 14px 4px; }
  .product-form-row { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .product-form-row .field-spec { grid-column: 1 / -1; }
  .commercial-head { grid-template-columns: auto minmax(0,1fr) auto; padding: 14px; }
  .commercial-head > a { grid-column: 2; }
  .commercial-lines { margin: 0 14px 14px; }
  .commercial-lines > div { grid-template-columns: 1fr auto; }
  .commercial-lines > div > span:first-child { grid-column: 1 / -1; }
  .quick-line { grid-template-columns: repeat(2,minmax(0,1fr)); padding: 16px; }
  .quick-line .line-field { grid-column: auto; grid-row: auto; }
  .quick-line .field-spec, .quick-line.is-fee .field-fee { grid-column: 1 / -1; }
  .quick-followup-drawer { width: 100vw; border-left: 0; }
  .quick-followup-form { padding: 14px 14px calc(120px + env(safe-area-inset-bottom)); }
  .quick-form-fields { padding: 15px; }
  .quick-form-actions { flex-direction: column; }
  .quick-form-actions .primary { order: -1; }
  .quick-form-actions > * { width: 100%; min-height: 46px; }
  .person-actions { flex-wrap: wrap; justify-content: flex-end; }
  .stat-cards { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .settings-grid { grid-template-columns: 1fr; }
  .data-actions { grid-template-columns: 1fr; }
  .data-actions.three { grid-template-columns: 1fr; }
  .data-actions > div + div { border-top: 1px solid var(--line); border-left: 0; }
  .option-list-head { display: none; }
  .option-list-row { grid-template-columns: minmax(0,1fr) auto; gap: 8px 14px; }
  .option-list-row > span:nth-child(3), .option-list-row > span:nth-child(4) { grid-column: 1; }
  .option-list-row > .actions { grid-column: 2; grid-row: 1 / span 3; flex-direction: column; align-items: flex-end; }
  .drag-handle { display: none; }
  .sort-actions button { display: grid; place-items: center; }
  .customer-metrics { grid-template-columns: 1fr; }
  .customer-metrics > div + div { border-top: 1px solid var(--line); border-left: 0; }
  .tag-choice-list { max-height: 260px; }
  .stat-card { min-height: 116px; padding: 16px; }
  .donut-layout { grid-template-columns: 1fr; justify-items: center; }
  .chart-legend { width: 100%; }
  .desktop-category-details { display: none; }
  .mobile-category-details { display: block; }
  .ranking-list > div { align-items: flex-start; flex-direction: column; gap: 5px; }
  .ranking-list strong { width: 100%; text-align: left; }
  .form-panel { max-width: 100%; }
  .edit-form, .padded, .form-section { padding: 18px; }
  .padded .edit-form { padding: 0; }
  .panel-footer { padding: 13px 16px; }
  .form-actions { position: static; padding: 12px 0 0; border: 0; background: transparent; box-shadow: none; }
  .form-actions .primary { flex: 1; }
  input, select, textarea { font-size: 16px; }
  .login-card { padding: 25px; }
}




/* Statistics terminology help and inquiry date filter */
.inquiry-date-filter { display: grid; grid-template-columns: 150px repeat(2,minmax(160px,1fr)); flex: 1 1 520px; align-items: end; gap: 8px; }
.inquiry-date-filter > div { min-width: 0; }
.inquiry-date-filter label { display: block; margin: 0 0 4px; color: var(--muted); font-size: 10px; line-height: 1.2; }
.inquiry-date-filter select, .inquiry-date-filter .date-control { width: 100%; max-width: none; }
.inquiry-date-filter .date-input { width: 100%; }
.view-toolbar .toolbar-controls { flex-wrap: wrap; }

.metric-label { display: inline-flex !important; min-width: 0; align-items: center; gap: 4px; }
.metric-help { display: inline-grid; width: 14px; min-width: 14px; height: 14px; min-height: 14px; place-items: center; padding: 0; border: 1px solid #aab8c5; border-radius: 50%; background: transparent; color: #64748b; font-size: 9px; font-weight: 700; line-height: 1; vertical-align: middle; cursor: help; }
.metric-help:hover, .metric-help:focus-visible, .metric-help[aria-expanded="true"] { border-color: #64748b; background: #f1f5f9; color: #334155; outline: none; }
.metric-help-popover { position: fixed; z-index: 120; width: max-content; max-width: min(290px,calc(100vw - 24px)); padding: 9px 11px; border-radius: 7px; background: #172033; color: white; box-shadow: 0 10px 28px rgba(15,23,42,.24); font-size: 12px; font-weight: 400; line-height: 1.55; text-align: left; pointer-events: none; }
.metric-help-popover[hidden] { display: none; }
.performance-table table { min-width: 900px; table-layout: auto; }
.performance-table th { white-space: nowrap; }
.performance-table td { vertical-align: middle; }
.performance-table td > span { display: block; white-space: nowrap; }
.performance-table td small { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; white-space: nowrap; }
.sample-note { display: inline-flex; margin-top: 4px; padding: 2px 6px; border-radius: 999px; background: #fff7ed; color: #b45309; font-size: 9px; font-style: normal; font-weight: 600; white-space: nowrap; }
.source-performance-panel { margin-bottom: 16px; }
.folded-performance { margin: 0 20px 14px; }
.folded-performance .responsive-table { margin-top: 10px; border: 1px solid var(--line); border-radius: 8px; }
.category-performance-table td:first-child, .source-performance-panel td:first-child { min-width: 125px; }

@media (max-width: 760px) {
  .inquiry-date-filter { grid-template-columns: repeat(2,minmax(0,1fr)); flex: 1 1 100%; }
  .inquiry-date-filter > div:first-child { grid-column: 1 / -1; }
  .inquiry-date-filter select, .inquiry-date-filter input { min-height: 42px; }
  .performance-table table { min-width: 0; }
  .performance-table td small { width: auto; }
  .folded-performance { margin: 0 14px 14px; }
  .metric-help-popover { font-size: 12px; }
}

.stat-card-detail { position: relative; z-index: 1; display: inline-block; margin-top: 6px; color: var(--brand); font-size: 10px; font-weight: 600; }
.stat-card-detail:hover { text-decoration: underline; }

