:root {
  --ink: #171716;
  --ink-2: #2a2926;
  --muted: #706f69;
  --muted-2: #999790;
  --line: #e6e4de;
  --line-dark: #d7d4cb;
  --canvas: #f7f7f4;
  --paper: #fff;
  --soft: #f1f0eb;
  --gold: #b18b3c;
  --gold-bright: #c9a646;
  --gold-soft: #f6f0df;
  --gold-pale: #fbf8ed;
  --success: #477456;
  --success-soft: #edf5ef;
  --danger: #ad493f;
  --danger-soft: #fbefed;
  --warning: #a16922;
  --warning-soft: #fff4dc;
  --info: #467084;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(20, 20, 18, .04), 0 14px 35px rgba(20, 20, 18, .035);
  --sidebar: 224px;
  --ease: cubic-bezier(.22, .75, .3, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { overflow-x: hidden; color-scheme: light; scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; overflow-x: hidden; color: var(--ink); background: var(--canvas); font-family: "Segoe UI", Inter, Arial, sans-serif; font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; color: inherit; }
button, select { cursor: pointer; }
button { border: 0; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; }
img { max-width: 100%; }
p, h1, h2, h3, h4 { margin-top: 0; }
::selection { color: #fff; background: var(--gold); }
:focus-visible { outline: 3px solid rgba(177, 139, 60, .28); outline-offset: 2px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 19px; height: 19px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.skip-link { position: fixed; z-index: 1000; left: 16px; top: -70px; padding: 10px 14px; border-radius: 8px; background: var(--ink); color: #fff; transition: top .2s; }
.skip-link:focus { top: 16px; }

/* Shell */
.app-shell { min-height: 100vh; overflow-x: hidden; }
.sidebar { position: fixed; z-index: 40; inset: 0 auto 0 0; width: var(--sidebar); display: flex; flex-direction: column; padding: 25px 18px 18px; color: #d9d8d2; background: #181817; border-right: 1px solid #242422; }
.brand { display: inline-flex; align-items: center; gap: 11px; width: fit-content; }
.brand-mark { position: relative; display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid rgba(201, 166, 70, .68); border-radius: 10px 3px 10px 3px; color: #eee8da; font: 600 20px/1 Georgia, serif; transform: rotate(-2deg); }
.brand-mark span { position: absolute; right: 4px; bottom: 4px; width: 4px; height: 4px; border-radius: 50%; background: var(--gold-bright); }
.brand-name { display: flex; flex-direction: column; color: #fff; font-family: Georgia, "Times New Roman", serif; font-size: 20px; line-height: 1.05; letter-spacing: .01em; }
.brand-caption { margin-top: 5px; color: #918f87; font-family: "Segoe UI", Arial, sans-serif; font-size: 8px; font-weight: 600; letter-spacing: .17em; }
.sidebar-divider { height: 1px; margin: 24px 1px 20px; background: #2d2d2a; }
.nav-caption { padding: 0 10px 9px; color: #77756f; font-size: 9px; font-weight: 700; letter-spacing: .16em; }
.primary-nav { display: grid; gap: 5px; }
.nav-link { position: relative; display: flex; align-items: center; gap: 12px; height: 44px; padding: 0 11px; color: #9e9d96; border: 1px solid transparent; border-radius: 9px; font-size: 13px; font-weight: 550; transition: color .18s, background .18s, border-color .18s; }
.nav-link .icon { width: 18px; height: 18px; stroke-width: 1.65; }
.nav-link:hover { color: #f2f0eb; background: #20201f; }
.nav-link[aria-current="page"] { color: #fff; background: linear-gradient(105deg, #2b2a27, #232321); border-color: #34332f; box-shadow: inset 3px 0 0 var(--gold); }
.nav-link[aria-current="page"] .icon { color: #cfad5c; }
.nav-active-dot { margin-left: auto; width: 4px; height: 4px; border-radius: 50%; background: transparent; }
.nav-link[aria-current="page"] .nav-active-dot { background: var(--gold-bright); box-shadow: 0 0 0 3px rgba(201, 166, 70, .08); }
.sidebar-bottom { display: grid; gap: 14px; margin-top: auto; }
.sidebar-note { display: flex; gap: 9px; align-items: flex-start; padding: 12px 11px; color: #77766f; border: 1px solid #2a2a28; border-radius: 9px; font-size: 10px; line-height: 1.55; }
.sidebar-note strong { color: #aaa8a1; font-weight: 500; }
.status-dot { display: inline-block; width: 6px; height: 6px; margin-top: 5px; border-radius: 50%; background: var(--gold-bright); box-shadow: 0 0 0 3px rgba(201, 166, 70, .10); flex: 0 0 auto; }
.powered-brand { display: grid; justify-items: center; gap: 2px; padding: 8px 8px 9px; border-bottom: 1px solid #2a2927; color: #5f5e59; font-size: 8px; letter-spacing: .06em; }
.powered-brand img { width: 82px; height: 22px; object-fit: contain; filter: grayscale(1) invert(1); opacity: .52; }
.sidebar-user { display: flex; align-items: center; min-width: 0; gap: 10px; padding: 2px 3px; }
.sidebar-user .avatar { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; color: #1a1917; background: #c6a65b; font-size: 12px; font-weight: 700; }
.user-copy { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.user-copy strong, .user-copy span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-copy strong { color: #d8d6d0; font-size: 11px; font-weight: 600; }
.user-copy span { color: #686762; font-size: 9px; }
.icon-button { display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0; color: var(--muted); background: transparent; border: 1px solid transparent; border-radius: 8px; transition: color .18s, background .18s, border-color .18s; }
.icon-button:hover { color: var(--ink); background: var(--soft); border-color: var(--line); }
.sidebar .icon-button { width: 31px; height: 31px; color: #6e6d67; }
.sidebar .icon-button:hover { color: #fff; background: #282725; border-color: #363531; }
.sidebar .icon-button .icon { width: 16px; height: 16px; }
.workspace { min-height: 100vh; margin-left: var(--sidebar); display: flex; flex-direction: column; }
.topbar { position: sticky; z-index: 30; top: 0; display: flex; align-items: center; justify-content: space-between; height: 62px; padding: 0 clamp(25px, 4vw, 58px); border-bottom: 1px solid var(--line); background: rgba(247, 247, 244, .92); backdrop-filter: blur(12px); }
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 10px; }
.topbar-left { color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .04em; }
.topbar-left a:hover { color: var(--ink); }
.topbar-workspace { color: var(--ink); }
.topbar-divider, .breadcrumb-slash { color: #bbb8b0; }
.topbar-right { color: var(--muted-2); font-size: 10px; }
.topbar-status { display: flex; align-items: center; gap: 8px; margin-right: 5px; }
.topbar-status .status-dot { width: 5px; height: 5px; margin: 0; }
.topbar-date { padding-left: 15px; border-left: 1px solid var(--line-dark); }
.mobile-menu { display: none; }
.main-content { flex: 1; width: 100%; padding: 44px clamp(25px, 4vw, 58px) 66px; }
.workspace-footer { display: flex; justify-content: space-between; gap: 20px; padding: 18px clamp(25px, 4vw, 58px) 22px; color: var(--muted-2); border-top: 1px solid var(--line); font-size: 10px; }
.page-root { width: 100%; max-width: 1260px; margin: 0 auto; }
.page-loading { display: flex; align-items: center; justify-content: center; min-height: 320px; gap: 10px; color: var(--muted); }
.spinner { width: 18px; height: 18px; border: 2px solid var(--line-dark); border-top-color: var(--gold); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Type and primitives */
.eyebrow { display: block; margin-bottom: 10px; color: #806226; font-size: 9px; font-weight: 750; letter-spacing: .17em; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 32px; }
.page-heading { margin: 0 0 7px; font: 500 clamp(29px, 3vw, 39px)/1.12 Georgia, "Times New Roman", serif; letter-spacing: -.025em; }
.page-subtitle { margin: 0; color: var(--muted); font-size: 13px; }
.page-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.title-row { display: flex; align-items: center; gap: 12px; }
.count-pill { display: inline-grid; min-width: 25px; height: 25px; padding: 0 7px; place-items: center; border-radius: 20px; color: #786024; background: var(--gold-soft); font-size: 10px; font-weight: 700; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; color: var(--ink); background: var(--paper); border: 1px solid var(--line-dark); border-radius: 8px; font-size: 12px; font-weight: 650; letter-spacing: .01em; white-space: nowrap; box-shadow: 0 1px 0 rgba(0,0,0,.015); transition: transform .15s var(--ease), color .18s, background .18s, border-color .18s, box-shadow .18s; }
.button:hover { border-color: #c6c2b9; background: #fcfcfa; box-shadow: 0 5px 12px rgba(20,20,18,.05); transform: translateY(-1px); }
.button:active { transform: translateY(0); }
.button:disabled { cursor: not-allowed; opacity: .54; transform: none; box-shadow: none; }
.button .icon { width: 16px; height: 16px; }
.button-primary { color: #fff; background: var(--ink); border-color: var(--ink); box-shadow: 0 5px 13px rgba(25,25,22,.12); }
.button-primary:hover { color: #fff; background: #262522; border-color: #262522; box-shadow: 0 8px 18px rgba(25,25,22,.16); }
.button-gold { color: #171716; background: #c9a646; border-color: #c9a646; }
.button-gold:hover { color: #171716; background: #d4b55e; border-color: #d4b55e; }
.button-quiet { background: transparent; border-color: transparent; box-shadow: none; }
.button-quiet:hover { background: var(--soft); border-color: var(--line); box-shadow: none; }
.button-small { min-height: 34px; padding: 0 12px; font-size: 11px; }
.button-danger { color: var(--danger); }
.button-full { width: 100%; }
.text-button { display: inline-flex; align-items: center; gap: 5px; padding: 0; color: var(--ink); background: none; border-bottom: 1px solid var(--line-dark); font-size: 11px; font-weight: 650; }
.text-button:hover { color: var(--gold); border-color: var(--gold); }
.text-button .icon { width: 13px; height: 13px; }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important; }
.space-top-13 { margin-top: 13px; }
.space-top-14 { margin-top: 14px; }
.space-bottom-16 { margin-bottom: 16px; }
.space-bottom-18 { margin-bottom: 18px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.section-card { padding: 24px; }
.section-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.section-title-row h2, .section-title-row h3 { margin: 0; font-size: 14px; font-weight: 700; }
.section-title-row p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.divider { height: 1px; background: var(--line); }
.chip, .status-badge, .kind-badge { display: inline-flex; align-items: center; gap: 6px; min-height: 23px; padding: 0 8px; border-radius: 20px; font-size: 9px; font-weight: 700; letter-spacing: .035em; white-space: nowrap; }
.status-badge::before, .kind-badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .72; }
.status-draft { color: #706d66; background: #efeee9; }
.status-offered { color: #8c6925; background: #f7f0dc; }
.status-won { color: #3f7550; background: #e9f4ec; }
.status-archived { color: #77736c; background: #ecebe7; }
.kind-offer { color: #7c6226; background: var(--gold-soft); }
.kind-contract { color: #426876; background: #eaf2f5; }
.notice { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; color: var(--muted); background: var(--soft); border: 1px solid var(--line); border-radius: 9px; font-size: 11px; }
.notice .icon { width: 16px; height: 16px; margin-top: 1px; }
.notice-error { color: #883a33; background: var(--danger-soft); border-color: #efd3cf; }
.notice-warning { color: #7b571e; background: var(--warning-soft); border-color: #f0dfb8; }
.notice-info { color: #5e552f; background: var(--gold-pale); border-color: #e9dec0; }
.readiness-notice { justify-content: space-between; align-items: center; }
.readiness-notice a { font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }

/* Fields */
.field { display: grid; align-content: start; gap: 6px; min-width: 0; }
.field > label, .field-label { display: flex; align-items: center; gap: 5px; color: #4f4e49; font-size: 10px; font-weight: 700; letter-spacing: .025em; }
.optional { margin-left: auto; color: var(--muted-2); font-size: 9px; font-weight: 500; }
input, textarea, select { width: 100%; min-height: 40px; padding: 9px 11px; color: var(--ink); background: #fff; border: 1px solid var(--line-dark); border-radius: 8px; outline: 0; font-size: 12px; transition: border-color .18s, box-shadow .18s, background .18s; }
input::placeholder, textarea::placeholder { color: #aaa8a0; }
input:hover, textarea:hover, select:hover { border-color: #c7c3b9; }
input:focus, textarea:focus, select:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(177,139,60,.10); }
textarea { min-height: 100px; resize: vertical; line-height: 1.5; }
select { appearance: none; padding-right: 34px; background-image: linear-gradient(45deg, transparent 50%, #777 50%), linear-gradient(135deg, #777 50%, transparent 50%); background-position: calc(100% - 16px) 17px, calc(100% - 12px) 17px; background-size: 4px 4px, 4px 4px; background-repeat: no-repeat; }
.field.has-error input, .field.has-error textarea, .field.has-error select, input[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(173,73,63,.08); }
.field-error { margin: 0; color: var(--danger); font-size: 10px; }
.field-hint { margin: 0; color: var(--muted-2); font-size: 9px; }
.input-prefix { position: relative; }
.input-prefix > span { position: absolute; z-index: 1; left: 11px; top: 50%; color: var(--muted); transform: translateY(-50%); }
.input-prefix input { padding-left: 27px; }
.input-suffix { position: relative; }
.input-suffix input { padding-right: 42px; }
.input-suffix > span { position: absolute; right: 11px; top: 50%; color: var(--muted); font-size: 10px; transform: translateY(-50%); }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.field-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field-grid .span-2 { grid-column: span 2; }
.field-grid .span-3 { grid-column: span 3; }
.search-field { position: relative; width: min(290px, 100%); }
.search-field .icon { position: absolute; z-index: 1; left: 12px; top: 50%; width: 16px; height: 16px; color: var(--muted-2); transform: translateY(-50%); pointer-events: none; }
.search-field input { padding-left: 37px; background: #fafaf8; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.switch input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.switch-track { position: relative; width: 34px; height: 19px; border-radius: 12px; background: #d6d4cd; transition: background .18s; }
.switch-track::after { content: ""; position: absolute; left: 3px; top: 3px; width: 13px; height: 13px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .18s; }
.switch input:checked + .switch-track { background: var(--gold); }
.switch input:checked + .switch-track::after { transform: translateX(15px); }
.switch input:focus-visible + .switch-track { outline: 3px solid rgba(177,139,60,.25); outline-offset: 2px; }

/* Dashboard list */
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 22px; }
.stat-card { position: relative; min-height: 112px; padding: 18px 19px; overflow: hidden; background: var(--paper); border: 1px solid var(--line); border-radius: 11px; }
.stat-card::after { content: ""; position: absolute; right: -14px; bottom: -24px; width: 75px; height: 75px; border-radius: 50%; background: var(--gold-pale); opacity: .8; }
.stat-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 13px; color: var(--muted); font-size: 10px; font-weight: 600; }
.stat-icon { display: grid; place-items: center; width: 27px; height: 27px; color: var(--gold); background: var(--gold-pale); border: 1px solid #eee3c6; border-radius: 7px; }
.stat-icon .icon { width: 14px; height: 14px; }
.stat-value { display: block; position: relative; z-index: 1; font: 500 21px/1.1 Georgia, serif; letter-spacing: -.01em; }
.stat-foot { display: block; position: relative; z-index: 1; margin-top: 5px; color: var(--muted-2); font-size: 9px; }
.deal-panel { min-height: 340px; overflow: hidden; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.deal-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.filter-tabs { display: flex; align-items: center; gap: 2px; padding: 3px; background: var(--soft); border: 1px solid #eceae5; border-radius: 8px; }
.filter-tab { min-height: 31px; padding: 0 11px; color: var(--muted); background: transparent; border-radius: 6px; font-size: 10px; font-weight: 650; }
.filter-tab:hover { color: var(--ink); }
.filter-tab.is-active { color: var(--ink); background: #fff; box-shadow: 0 1px 3px rgba(20,20,18,.08); }
.filter-tab-count { margin-left: 4px; color: var(--muted-2); font-size: 9px; }
.mobile-filter { display: none; width: 150px; }
.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.data-table th { padding: 10px 15px; color: var(--muted-2); background: #fbfbfa; border-bottom: 1px solid var(--line); font-size: 8.5px; font-weight: 700; letter-spacing: .08em; text-align: left; text-transform: uppercase; }
.data-table td { height: 67px; padding: 10px 15px; border-bottom: 1px solid #efeee9; color: #45443f; font-size: 11px; vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr { position: relative; transition: background .15s; }
.data-table tbody tr:hover { background: #fbfaf7; }
.data-table .col-main { width: 29%; }
.data-table .col-customer { width: 20%; }
.data-table .col-status { width: 12%; }
.data-table .col-money { width: 14%; text-align: right; }
.data-table .col-date { width: 13%; }
.data-table .col-action { width: 5%; text-align: right; }
.deal-title-link { display: block; overflow: hidden; color: var(--ink); font-size: 12px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.deal-title-link:hover { color: #8a6929; }
.deal-number { display: block; margin-top: 3px; color: var(--muted-2); font-size: 9px; letter-spacing: .045em; }
.customer-cell { display: flex; align-items: center; gap: 8px; min-width: 0; }
.customer-avatar { display: grid; width: 28px; height: 28px; place-items: center; flex: 0 0 auto; color: #6f5b2d; background: var(--gold-soft); border-radius: 7px; font-size: 9px; font-weight: 750; }
.customer-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.money-cell { color: var(--ink); font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.date-cell { color: var(--muted); white-space: nowrap; }
.row-arrow { display: inline-grid; width: 28px; height: 28px; place-items: center; color: var(--muted-2); border-radius: 50%; }
.row-arrow:hover { color: var(--ink); background: var(--soft); }
.row-arrow .icon { width: 14px; height: 14px; }
.table-empty { display: grid; min-height: 280px; place-items: center; padding: 40px; text-align: center; }
.empty-visual { position: relative; width: 88px; height: 74px; margin: 0 auto 21px; }
.empty-paper { position: absolute; width: 52px; height: 66px; left: 18px; top: 0; background: #fff; border: 1px solid #d9d5cb; border-radius: 5px; box-shadow: 0 10px 22px rgba(20,20,18,.08); }
.empty-paper::before { content: ""; position: absolute; left: 11px; right: 11px; top: 17px; height: 2px; background: var(--gold); box-shadow: 0 10px 0 #e2dfd7, 0 18px 0 #e2dfd7, 0 26px 0 #e2dfd7; }
.empty-paper:nth-child(1) { left: 5px; top: 7px; transform: rotate(-8deg); background: #f4f2eb; }
.empty-paper:nth-child(2) { left: 31px; top: 8px; transform: rotate(7deg); background: #faf9f5; }
.empty-paper:nth-child(3) { z-index: 2; }
.empty-content h3 { margin: 0 0 7px; font: 500 19px/1.25 Georgia, serif; }
.empty-content p { max-width: 360px; margin: 0 auto 18px; color: var(--muted); font-size: 11px; }
.setup-banner { display: flex; align-items: center; gap: 13px; margin-top: 16px; padding: 14px 16px; background: var(--gold-pale); border: 1px solid #e9dfc3; border-radius: 10px; }
.setup-banner-icon { display: grid; width: 34px; height: 34px; flex: 0 0 auto; place-items: center; color: var(--gold); background: #fff; border: 1px solid #ebdfbf; border-radius: 9px; }
.setup-banner-icon .icon { width: 17px; height: 17px; }
.setup-banner-copy { flex: 1; }
.setup-banner-copy strong { display: block; font-size: 11px; }
.setup-banner-copy span { color: var(--muted); font-size: 9px; }

/* Detail */
.detail-header { align-items: flex-start; margin-bottom: 24px; }
.deal-meta-row { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; color: var(--muted); font-size: 9px; letter-spacing: .04em; }
.deal-meta-separator { width: 2px; height: 2px; border-radius: 50%; background: var(--muted-2); }
.detail-layout { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(305px, .72fr); align-items: start; gap: 18px; }
.detail-main, .detail-side { display: grid; gap: 16px; }
.detail-side { position: static; min-width: 0; }
.detail-summary-strip { display: grid; grid-template-columns: repeat(3, 1fr); overflow: hidden; }
.detail-summary-item { padding: 18px 20px; border-right: 1px solid var(--line); }
.detail-summary-item:last-child { border: 0; }
.detail-summary-label { display: block; margin-bottom: 6px; color: var(--muted-2); font-size: 9px; font-weight: 650; text-transform: uppercase; letter-spacing: .07em; }
.detail-summary-value { display: block; font: 500 18px/1.2 Georgia, serif; font-variant-numeric: tabular-nums; }
.detail-summary-value small { color: var(--muted); font: 500 10px/1.2 "Segoe UI", sans-serif; }
.detail-card { padding: 21px; }
.identity-block { display: flex; align-items: flex-start; gap: 13px; }
.identity-icon { display: grid; width: 38px; height: 38px; flex: 0 0 auto; place-items: center; color: #796028; background: var(--gold-soft); border-radius: 9px; }
.identity-icon .icon { width: 18px; height: 18px; }
.identity-main strong { display: block; margin-bottom: 3px; font-size: 12px; }
.identity-main p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.6; }
.identity-links { display: flex; gap: 12px; margin-top: 10px; }
.identity-links a { color: #82672c; font-size: 10px; }
.items-list { display: grid; gap: 0; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.item-line { display: grid; grid-template-columns: 1fr auto; gap: 14px; padding: 14px; background: #fff; border-bottom: 1px solid var(--line); }
.item-line:last-child { border-bottom: 0; }
.item-line strong { display: block; margin-bottom: 2px; font-size: 11px; }
.item-line p { margin: 0; color: var(--muted); font-size: 9px; }
.item-line-total { color: var(--ink); font-size: 11px; font-weight: 650; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.item-line-total small { display: block; margin-top: 2px; color: var(--muted-2); font-size: 8px; font-weight: 500; }
.terms-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; overflow: hidden; background: var(--line); border: 1px solid var(--line); border-radius: 8px; }
.term-box { padding: 13px; background: #fff; }
.term-box span { display: block; margin-bottom: 4px; color: var(--muted-2); font-size: 8px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.term-box strong { display: block; font-size: 10px; font-weight: 600; line-height: 1.45; }
.document-action-card { position: relative; overflow: hidden; padding: 22px; color: #eee; background: #1b1b19; border-color: #1b1b19; }
.document-action-card::after { content: ""; position: absolute; right: -65px; top: -80px; width: 180px; height: 180px; border: 1px solid rgba(201,166,70,.13); border-radius: 50%; box-shadow: 0 0 0 28px rgba(201,166,70,.03), 0 0 0 56px rgba(201,166,70,.02); }
.document-action-card h2 { position: relative; z-index: 1; margin-bottom: 6px; font: 500 19px/1.25 Georgia, serif; }
.document-action-card > p { position: relative; z-index: 1; margin-bottom: 18px; color: #96958e; font-size: 10px; }
.document-actions { position: relative; z-index: 2; display: grid; gap: 8px; }
.document-actions .button { width: 100%; color: #fff; background: #282825; border-color: #393834; }
.document-actions .button:hover { background: #32322e; border-color: #504d44; }
.document-actions .button-gold { color: #181714; background: #c5a557; border-color: #c5a557; }
.document-actions .button-gold:hover { background: #d0b267; border-color: #d0b267; }
.document-action-foot { position: relative; z-index: 1; display: flex; gap: 7px; align-items: flex-start; margin: 14px 0 0; color: #77766f; font-size: 8.5px; }
.document-action-foot .icon { width: 12px; height: 12px; }
.history-card { padding: 20px; }
.customer-number { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; font-weight: 500; }
.customer-number-badge { display: inline-block; flex-shrink: 0; padding: 7px 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--gold-pale); color: var(--ink); font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kind-confirmation { color: #37684c; background: #eef6f0; }
.detail-header .page-actions { justify-content: flex-end; max-width: 470px; }
.detail-main { min-width: 0; }
.lifecycle-card { min-width: 0; padding: 20px; }
.lifecycle-card .section-title-row { align-items: flex-start; flex-wrap: wrap; gap: 10px; }
.lifecycle-facts { display: grid; gap: 10px; margin: 0 0 16px; }
.lifecycle-facts > div { display: grid; grid-template-columns: minmax(85px, .75fr) minmax(0, 1.25fr); gap: 10px; }
.lifecycle-facts dt { color: var(--muted); font-size: 10px; }
.lifecycle-facts dd { margin: 0; font-size: 11px; font-weight: 600; overflow-wrap: anywhere; }
.lifecycle-actions { display: grid; gap: 7px; }
.lifecycle-actions .button { justify-content: flex-start; white-space: normal; text-align: left; }
.lifecycle-note { display: flex; gap: 7px; margin: 14px 0 0; color: var(--muted); font-size: 10px; line-height: 1.6; }
.lifecycle-note .icon { width: 13px; height: 13px; margin-top: 2px; flex-shrink: 0; }
.retention-note { margin-top: 14px; padding: 11px; background: var(--soft); border: 1px solid var(--line); border-radius: 8px; font-size: 10px; line-height: 1.6; }
.retention-note p { color: var(--muted); margin: 5px 0 0; }
.retention-note summary { cursor: pointer; font-weight: 650; }
.lifecycle-history { margin-top: 15px; border-top: 1px solid var(--line); padding-top: 12px; }
.lifecycle-history summary { cursor: pointer; font-size: 11px; font-weight: 650; }
.lifecycle-history summary span { margin-left: 5px; color: var(--muted); font-weight: 400; }
.lifecycle-history ol { list-style: none; margin: 12px 0 0; padding: 0 0 0 9px; border-left: 2px solid var(--line); }
.lifecycle-history li { margin: 0 0 12px; padding-left: 7px; }
.lifecycle-history li:last-child { margin-bottom: 0; }
.lifecycle-history li strong, .lifecycle-history li span { display: block; font-size: 10px; line-height: 1.6; overflow-wrap: anywhere; }
.lifecycle-history li span { color: var(--muted); }
.lifecycle-form { display: grid; gap: 16px; }
.lifecycle-form > p { margin: 0; font-size: 12px; line-height: 1.7; }
.lifecycle-form .lifecycle-error { color: var(--danger); background: var(--danger-soft); padding: 10px; border-radius: 7px; }
.field input:disabled { opacity: 1; color: var(--muted); background: var(--soft); cursor: not-allowed; }
.history-list { display: grid; gap: 7px; }
.history-row { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 10px 11px; background: #fafaf8; border: 1px solid var(--line); border-radius: 8px; }
.history-icon { display: grid; width: 29px; height: 29px; flex: 0 0 auto; place-items: center; color: var(--gold); background: var(--gold-pale); border-radius: 6px; }
.history-icon .icon { width: 14px; height: 14px; }
.history-copy { display: flex; flex: 1; min-width: 0; flex-direction: column; }
.history-copy strong { overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.history-copy span { color: var(--muted-2); font-size: 8px; }
.history-actions { display: flex; }
.history-actions .icon-button { width: 28px; height: 28px; }
.history-actions .icon { width: 14px; height: 14px; }
.preview-card { overflow: hidden; }
.preview-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 12px 14px; background: #efeee9; border-bottom: 1px solid var(--line-dark); }
.preview-toolbar strong { font-size: 10px; }
.preview-toolbar span { color: var(--muted); font-size: 9px; }
.pdf-frame { width: 100%; height: 570px; border: 0; background: #d6d4cf; }
.no-doc-preview { display: grid; min-height: 300px; place-items: center; padding: 30px; color: var(--muted); background: #efeee9; text-align: center; }
.no-doc-preview .empty-visual { transform: scale(.8); margin-bottom: 10px; }

/* Document index */
.document-summary { display: flex; gap: 7px; align-items: center; }
.documents-panel { margin-top: 15px; }
.summary-chip { display: flex; align-items: center; gap: 7px; min-height: 33px; padding: 0 11px; color: var(--muted); background: #fff; border: 1px solid var(--line); border-radius: 8px; font-size: 9px; }
.summary-chip strong { color: var(--ink); font-size: 11px; }
.doc-table .col-doc { width: 24%; }
.doc-table .col-kind { width: 13%; }
.doc-table .col-deal { width: 25%; }
.doc-table .col-version { width: 10%; }
.doc-table .col-actions { width: 15%; text-align: right; }
.doc-number { display: flex; align-items: center; gap: 10px; }
.doc-number-icon { display: grid; width: 30px; height: 35px; flex: 0 0 auto; place-items: center; color: var(--gold); background: var(--gold-pale); border: 1px solid #eadfbe; border-radius: 4px; }
.doc-number-icon .icon { width: 15px; height: 15px; }
.doc-number strong { display: block; color: var(--ink); font-size: 10px; }
.doc-number span { display: block; margin-top: 2px; color: var(--muted-2); font-size: 8px; }
.doc-actions { display: flex; justify-content: flex-end; gap: 4px; }
.doc-actions .button { min-height: 31px; padding: 0 10px; font-size: 9px; }
.doc-actions .icon-button { width: 31px; height: 31px; }
.doc-actions .icon { width: 14px; height: 14px; }

/* Deal editor */
.editor-page { max-width: 1320px; }
.editor-topline { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.editor-title-wrap { flex: 1; min-width: 0; }
.editor-title-input { width: min(620px,100%); min-height: 43px; margin: -2px 0 4px; padding: 0 3px 2px 0; background: transparent; border: 0; border-bottom: 1px solid transparent; border-radius: 0; font: 500 clamp(27px,3vw,36px)/1.2 Georgia, serif; letter-spacing: -.025em; }
.editor-title-input:hover { border-color: var(--line-dark); }
.editor-title-input:focus { border-color: var(--gold); box-shadow: none; }
.editor-title-hint { display: flex; align-items: center; gap: 5px; color: var(--muted-2); font-size: 9px; }
.editor-title-hint .icon { width: 11px; height: 11px; }
.editor-top-actions { display: flex; gap: 8px; }
.stepper { position: relative; display: grid; grid-template-columns: repeat(4,1fr); max-width: 820px; margin-bottom: 29px; }
.stepper::before { content: ""; position: absolute; z-index: 0; left: 12.5%; right: 12.5%; top: 17px; height: 1px; background: var(--line-dark); }
.stepper-progress { position: absolute; z-index: 1; left: 12.5%; top: 17px; height: 1px; background: var(--gold); transition: width .25s var(--ease); }
.stepper-progress-1 { width: 0; }
.stepper-progress-2 { width: 25%; }
.stepper-progress-3 { width: 50%; }
.stepper-progress-4 { width: 75%; }
.step-button { position: relative; z-index: 2; display: grid; justify-items: center; gap: 7px; padding: 0; color: var(--muted-2); background: transparent; font-size: 9px; font-weight: 650; }
.step-circle { display: grid; width: 35px; height: 35px; place-items: center; color: var(--muted); background: var(--canvas); border: 1px solid var(--line-dark); border-radius: 50%; font-size: 10px; transition: color .18s, background .18s, border-color .18s; }
.step-button.is-active { color: var(--ink); }
.step-button.is-active .step-circle { color: #fff; background: var(--ink); border-color: var(--ink); box-shadow: 0 0 0 4px var(--canvas); }
.step-button.is-complete .step-circle { color: #6f5721; background: var(--gold-soft); border-color: #dbc78f; }
.step-button.is-complete { color: #75612f; }
.step-circle .icon { width: 14px; height: 14px; stroke-width: 2.1; }
.editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) 304px; align-items: start; gap: 19px; }
.editor-layout > * { min-width: 0; }
.editor-stage { min-width: 0; min-height: 510px; padding: 28px; }
.stage-heading { margin-bottom: 25px; }
.stage-heading h2 { margin: 0 0 7px; font: 500 23px/1.2 Georgia, serif; letter-spacing: -.01em; }
.stage-heading p { max-width: 640px; margin: 0; color: var(--muted); font-size: 11px; }
.stage-section + .stage-section { margin-top: 30px; padding-top: 25px; border-top: 1px solid var(--line); }
.stage-section-title { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 13px; }
.stage-section-title h3 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 12px; }
.stage-number { display: grid; width: 20px; height: 20px; place-items: center; color: #7d6328; background: var(--gold-soft); border-radius: 6px; font-size: 8px; }
.stage-section-title p, .stage-section-subtitle { margin: 3px 0 0; color: var(--muted-2); font-size: 9px; }
.product-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; }
.product-choice { position: relative; display: block; min-height: 146px; cursor: pointer; }
.product-choice > input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.product-card-inner { display: block; height: 100%; padding: 15px; background: #fff; border: 1px solid var(--line); border-radius: 10px; transition: border-color .18s, background .18s, box-shadow .18s, transform .18s var(--ease); }
.product-choice:hover .product-card-inner { border-color: #d0c8b4; transform: translateY(-1px); box-shadow: 0 7px 15px rgba(20,20,18,.04); }
.product-choice > input:focus-visible + .product-card-inner { outline: 3px solid rgba(177,139,60,.2); outline-offset: 2px; }
.product-choice > input:checked + .product-card-inner { background: var(--gold-pale); border-color: #cdb572; box-shadow: inset 0 0 0 1px rgba(177,139,60,.18); }
.choice-check { position: absolute; right: 11px; top: 11px; display: grid; width: 20px; height: 20px; place-items: center; color: transparent; background: #fff; border: 1px solid var(--line-dark); border-radius: 50%; transition: color .18s, background .18s, border-color .18s; }
.choice-check .icon { width: 11px; height: 11px; stroke-width: 2.5; }
.product-choice > input:checked ~ .choice-check { color: #fff; background: var(--gold); border-color: var(--gold); }
.product-tier { display: inline-block; margin-bottom: 17px; color: var(--muted-2); font-size: 7.5px; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; }
.product-card-inner h4 { margin: 0 30px 5px 0; font-size: 11px; }
.product-card-inner p { display: -webkit-box; min-height: 32px; margin: 0 0 11px; overflow: hidden; color: var(--muted); font-size: 8.5px; line-height: 1.5; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.product-price { display: flex; align-items: baseline; gap: 3px; color: var(--ink); font: 500 16px Georgia, serif; }
.product-price small { color: var(--muted); font: 500 8px "Segoe UI",sans-serif; }
.care-block { padding: 16px; background: #faf9f5; border: 1px solid #e8e3d5; border-radius: 10px; }
.care-block + .care-block { margin-top: 8px; }
.care-block-head { display: flex; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.care-block-head strong { font-size: 10px; }
.care-block-head span { display: flex; align-items: center; gap: 5px; color: #81692f; font-size: 8.5px; }
.care-block-head .icon { width: 12px; height: 12px; }
.care-options { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
.care-choice { position: relative; display: flex; align-items: flex-start; gap: 9px; padding: 11px; cursor: pointer; background: #fff; border: 1px solid var(--line); border-radius: 8px; transition: border-color .18s, background .18s; }
.care-choice:has(input:checked) { background: var(--gold-pale); border-color: #cdb674; }
.care-choice input { width: 15px; height: 15px; min-height: 0; margin: 1px 0 0; accent-color: var(--gold); }
.care-choice-copy { flex: 1; min-width: 0; }
.care-choice strong { display: block; overflow: hidden; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.care-choice span { display: block; margin-top: 2px; color: var(--muted); font-size: 8px; }
.extras-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 8px; }
.extra-choice { display: flex; align-items: center; gap: 10px; padding: 11px 12px; cursor: pointer; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.extra-choice:has(input:checked) { background: var(--gold-pale); border-color: #cfba7f; }
.extra-choice input { width: 15px; height: 15px; min-height: 0; accent-color: var(--gold); }
.extra-choice-copy { flex: 1; min-width: 0; }
.extra-choice strong { display: block; overflow: hidden; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.extra-choice span { color: var(--muted); font-size: 8px; }
.selected-items { display: grid; gap: 7px; margin-top: 13px; }
.selected-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: #fafaf8; border: 1px solid var(--line); border-radius: 8px; }
.selected-item-badge { padding: 3px 6px; color: #80672f; background: var(--gold-soft); border-radius: 4px; font-size: 7px; font-weight: 700; text-transform: uppercase; }
.selected-item-copy { flex: 1; min-width: 0; }
.selected-item-copy strong { display: block; overflow: hidden; font-size: 9.5px; text-overflow: ellipsis; white-space: nowrap; }
.selected-item-copy span { color: var(--muted); font-size: 8px; }
.selected-item-actions { display: flex; }
.selected-item-actions .icon-button { width: 27px; height: 27px; }
.selected-item-actions .icon { width: 13px; height: 13px; }
.add-custom { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 44px; margin-top: 10px; color: #725b29; background: var(--gold-pale); border: 1px dashed #ccb77b; border-radius: 8px; font-size: 10px; font-weight: 650; }
.add-custom:hover { background: var(--gold-soft); border-style: solid; }
.add-custom .icon { width: 14px; height: 14px; }
.customer-intro { display: flex; align-items: center; gap: 13px; margin-bottom: 22px; padding: 14px; background: var(--gold-pale); border: 1px solid #ece1c2; border-radius: 9px; }
.customer-intro .identity-icon { width: 34px; height: 34px; }
.customer-intro strong { display: block; font-size: 10px; }
.customer-intro span { color: var(--muted); font-size: 9px; }
.conditions-sections { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; min-width: 0; }
.condition-card { min-width: 0; padding: 18px; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.condition-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 15px; }
.condition-card-head > div { min-width: 0; }
.condition-card-head > .button, .condition-card-head > .text-button { flex: 0 0 auto; }
.condition-card-head h3 { margin: 0 0 3px; font-size: 11px; }
.condition-card-head p { margin: 0; color: var(--muted); font-size: 9px; }
.discount-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.discount-box { min-width: 0; padding: 13px; background: #fafaf8; border: 1px solid var(--line); border-radius: 8px; }
.discount-box-head { display: flex; justify-content: space-between; margin-bottom: 10px; font-size: 9px; font-weight: 650; }
.discount-box-head span { color: var(--muted); font-weight: 500; }
.segment-control { display: grid; grid-template-columns: repeat(4,1fr); gap: 2px; padding: 3px; background: var(--soft); border-radius: 7px; }
.segment-control label { position: relative; }
.segment-control input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.segment-control span { display: grid; min-height: 28px; place-items: center; color: var(--muted); border-radius: 5px; font-size: 8px; font-weight: 700; }
.segment-control input:checked + span { color: var(--ink); background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.discount-value { margin-top: 9px; }
.discount-impact { display: block; margin-top: 7px; color: var(--muted); font-size: 8px; }
.editable-defaults { display: grid; grid-template-columns: minmax(0,1fr); gap: 1px; min-width: 0; overflow: hidden; background: var(--line); border: 1px solid var(--line); border-radius: 8px; }
.editable-default-row { display: grid; grid-template-columns: 27px minmax(0,1fr) auto; align-items: center; gap: 13px; min-width: 0; padding: 11px 12px; background: #fff; }
.editable-default-icon { display: grid; width: 27px; height: 27px; place-items: center; color: var(--gold); background: var(--gold-pale); border-radius: 6px; }
.editable-default-icon .icon { width: 13px; height: 13px; }
.editable-default-copy { flex: 1; min-width: 0; }
.editable-default-copy strong { display: block; font-size: 9px; }
.editable-default-copy span { display: -webkit-box; overflow: hidden; overflow-wrap: anywhere; color: var(--muted); font-size: 9px; line-height: 1.5; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.editable-default-row .button { flex: 0 0 auto; min-height: 32px; }
.review-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 12px; }
.review-card { padding: 17px; background: #fff; border: 1px solid var(--line); border-radius: 9px; }
.review-card-head { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.review-card-head h3 { display: flex; gap: 7px; align-items: center; margin: 0; font-size: 10px; }
.review-card-head .icon { width: 14px; height: 14px; color: var(--gold); }
.review-card-body { color: var(--muted); font-size: 9px; line-height: 1.65; }
.review-card-body strong { color: var(--ink); font-weight: 650; }
.review-item { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.review-item:last-child { border: 0; }
.review-ready { display: flex; gap: 12px; align-items: flex-start; margin-top: 16px; padding: 15px; background: var(--success-soft); border: 1px solid #d0e4d5; border-radius: 9px; color: #396747; }
.review-ready.has-missing { color: #77571d; background: var(--warning-soft); border-color: #ecdbae; }
.review-ready-icon { display: grid; width: 28px; height: 28px; flex: 0 0 auto; place-items: center; background: rgba(255,255,255,.55); border-radius: 50%; }
.review-ready-icon .icon { width: 15px; height: 15px; }
.review-ready strong { display: block; font-size: 10px; }
.review-ready p { margin: 3px 0 0; font-size: 9px; }
.review-ready ul { margin: 6px 0 0; padding-left: 15px; font-size: 9px; }
.editor-total-card { position: sticky; top: 79px; overflow: hidden; }
.total-card-head { padding: 17px 18px; border-bottom: 1px solid var(--line); }
.total-card-head-row { display: flex; align-items: center; justify-content: space-between; }
.total-card-head h2 { margin: 0; font-size: 11px; }
.quote-status { display: flex; align-items: center; gap: 5px; color: var(--muted-2); font-size: 8px; }
.quote-status .status-dot { width: 4px; height: 4px; margin: 0; }
.total-card-body { padding: 17px 18px; }
.total-section { display: grid; gap: 8px; }
.total-row { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 9px; }
.total-row span:last-child { color: var(--ink); font-variant-numeric: tabular-nums; }
.total-row.is-discount span:last-child { color: var(--success); }
.total-row.is-surcharge span:last-child { color: var(--danger); }
.total-divider { height: 1px; margin: 11px 0; background: var(--line); }
.total-grand { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.total-grand span { color: var(--muted); font-size: 9px; }
.total-grand strong { font: 500 19px Georgia,serif; font-variant-numeric: tabular-nums; }
.total-monthly { margin-top: 13px; padding: 12px; background: var(--gold-pale); border: 1px solid #eee3c6; border-radius: 8px; }
.total-monthly .total-grand strong { color: #755d28; font-size: 17px; }
.term-value { display: flex; justify-content: space-between; margin: 11px 0 0; padding-top: 10px; color: var(--muted); border-top: 1px solid #eae0c5; font-size: 8px; }
.term-value strong { color: #69572c; }
.quote-error { margin-top: 12px; color: var(--danger); font-size: 8.5px; }
.total-card-foot { padding: 13px 18px; color: var(--muted-2); background: #fafaf8; border-top: 1px solid var(--line); font-size: 8px; line-height: 1.55; }
.editor-navigation { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; }
.editor-navigation-right { display: flex; gap: 8px; }
.editor-navigation .button { min-width: 110px; }
.stage-error { margin-bottom: 17px; }

/* Settings */
.settings-layout { display: grid; grid-template-columns: 188px minmax(0,1fr); align-items: start; gap: 20px; }
.settings-nav { position: sticky; top: 80px; display: grid; gap: 5px; padding: 7px; background: #fff; border: 1px solid var(--line); border-radius: 11px; }
.settings-nav-button { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 0 11px; color: var(--muted); background: transparent; border-radius: 7px; font-size: 10px; font-weight: 650; text-align: left; }
.settings-nav-button .icon { width: 15px; height: 15px; }
.settings-nav-button:hover { color: var(--ink); background: #fafaf8; }
.settings-nav-button.is-active { color: var(--ink); background: var(--gold-pale); }
.settings-nav-button.is-active .icon { color: var(--gold); }
.settings-content { min-width: 0; }
.settings-panel { display: grid; grid-template-columns: minmax(0,1fr); gap: 15px; min-width: 0; }
.settings-section { min-width: 0; padding: 23px; }
.settings-section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 21px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.settings-section-head h2 { margin: 0 0 4px; font: 500 18px Georgia,serif; }
.settings-section-head p { margin: 0; color: var(--muted); font-size: 9px; }
.readiness-badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px; color: #78581f; background: var(--warning-soft); border-radius: 20px; font-size: 8px; font-weight: 700; }
.readiness-badge.is-ready { color: var(--success); background: var(--success-soft); }
.readiness-badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.logo-upload-row { display: flex; align-items: center; gap: 15px; margin-bottom: 21px; padding: 14px; background: #fafaf8; border: 1px solid var(--line); border-radius: 9px; }
.logo-preview { display: grid; width: 105px; height: 59px; place-items: center; overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: 7px; }
.logo-preview img { max-width: 83px; max-height: 39px; object-fit: contain; }
.logo-placeholder { color: var(--muted-2); font-size: 8px; }
.logo-upload-copy { flex: 1; }
.logo-upload-copy strong { display: block; font-size: 10px; }
.logo-upload-copy span { display: block; margin: 3px 0 8px; color: var(--muted); font-size: 8px; }
.file-input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.bank-details { margin-top: 17px; border: 1px solid var(--line); border-radius: 8px; }
.bank-details summary { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; cursor: pointer; color: var(--muted); font-size: 9px; font-weight: 650; list-style: none; }
.bank-details summary::-webkit-details-marker { display: none; }
.bank-details summary::after { content: "+"; font-size: 15px; font-weight: 400; }
.bank-details[open] summary::after { content: "−"; }
.bank-details .field-grid { padding: 2px 14px 14px; }
.catalog-groups { display: grid; gap: 20px; }
.catalog-group-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.catalog-group-head h3 { margin: 0; font-size: 10px; }
.catalog-group-head span { color: var(--muted-2); font-size: 8px; }
.catalog-list { display: grid; gap: 6px; }
.catalog-row { display: grid; grid-template-columns: 38px minmax(130px,1fr) minmax(180px,1.4fr) 135px 40px; align-items: center; gap: 10px; padding: 10px 11px; background: #fafaf8; border: 1px solid var(--line); border-radius: 8px; }
.catalog-drag { color: var(--muted-2); font-size: 10px; text-align: center; }
.catalog-row strong { display: block; overflow: hidden; font-size: 9.5px; text-overflow: ellipsis; white-space: nowrap; }
.catalog-name-button { min-width: 0; padding: 0; background: transparent; text-align: left; }
.catalog-name-button:hover strong { color: #806226; }
.catalog-code { display: block; color: var(--muted-2); font-size: 7.5px; }
.catalog-description { overflow: hidden; color: var(--muted); font-size: 8.5px; text-overflow: ellipsis; white-space: nowrap; }
.catalog-price input { min-height: 34px; padding-right: 29px; background: #fff; }
.catalog-price .input-suffix > span { right: 9px; }
.template-list { display: grid; grid-template-columns: minmax(0,1fr); gap: 7px; min-width: 0; }
.template-row { display: grid; grid-template-columns: 30px minmax(0,1fr) auto; align-items: center; gap: 12px; min-width: 0; padding: 12px; background: #fafaf8; border: 1px solid var(--line); border-radius: 8px; }
.template-icon { display: grid; width: 30px; height: 30px; flex: 0 0 auto; place-items: center; color: var(--gold); background: var(--gold-pale); border-radius: 7px; }
.template-icon .icon { width: 14px; height: 14px; }
.template-copy { flex: 1; min-width: 0; }
.template-copy strong { display: block; font-size: 9.5px; }
.template-copy span { display: -webkit-box; overflow: hidden; overflow-wrap: anywhere; color: var(--muted); font-size: 9px; line-height: 1.5; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.template-row .button { min-height: 32px; }
.settings-panel-actions { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 15px 0 3px; }
.settings-panel-actions p { margin: 0; color: var(--muted); font-size: 11px; }
.settings-save-status { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 9px; }
.settings-save-status .status-dot { width: 5px; height: 5px; margin: 0; background: #aaa8a1; box-shadow: none; }
.settings-save-status.is-dirty .status-dot { background: var(--gold); }

@media (max-width: 1100px) {
  .editor-layout { grid-template-columns: minmax(0,1fr) 280px; }
  .product-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .care-options { grid-template-columns: 1fr; }
  .catalog-row { grid-template-columns: 30px minmax(130px,1fr) 125px 40px; }
  .catalog-description { display: none; }
}
@media (max-width: 900px) {
  .editor-layout { grid-template-columns: 1fr; }
  .editor-total-card { position: static; order: -1; }
  .total-card-body { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
  .total-monthly { margin: 0; }
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { position: static; display: flex; overflow-x: auto; }
  .settings-nav-button { flex: 1 0 auto; justify-content: center; }
}
@media (max-width: 680px) {
  .editor-topline { flex-direction: column; }
  .editor-total-card { order: 0; }
  .editor-top-actions { width: 100%; }
  .editor-top-actions .button { flex: 1; }
  .editor-title-input { font-size: 27px; }
  .stepper { margin-inline: -8px; }
  .step-button { font-size: 8px; }
  .editor-stage { min-height: 0; padding: 19px 15px; }
  .stage-heading h2 { font-size: 20px; }
  .product-grid, .extras-grid, .discount-grid, .review-grid { grid-template-columns: 1fr; }
  .product-choice { min-height: 128px; }
  .total-card-body { grid-template-columns: 1fr; }
  .editor-navigation { align-items: stretch; flex-direction: column-reverse; }
  .editor-navigation-right { width: 100%; }
  .editor-navigation .button { flex: 1; min-width: 0; }
  .editor-navigation > .button { width: 100%; }
  .settings-section { padding: 17px 14px; }
  .settings-nav { margin-inline: -2px; }
  .settings-nav-button { min-height: 38px; padding: 0 9px; }
  .settings-nav-button .icon { display: none; }
  .logo-upload-row { align-items: flex-start; flex-wrap: wrap; }
  .logo-preview { width: 85px; }
  .catalog-row { grid-template-columns: minmax(100px,1fr) 100px 35px; gap: 7px; }
  .catalog-drag { display: none; }
  .catalog-code { display: none; }
  .catalog-row .switch-label { display: none; }
  .template-row, .editable-default-row { grid-template-columns: 27px minmax(0,1fr); gap: 8px 10px; }
  .template-row .button, .editable-default-row .button { grid-column: 2; justify-self: start; padding-inline: 10px; }
  .condition-card-head, .settings-section-head { flex-wrap: wrap; }
  .settings-panel-actions { align-items: stretch; flex-direction: column; }
  .settings-panel-actions .button { width: 100%; }
}

/* Toast and dialog */
.toast-stack { position: fixed; z-index: 100; right: 22px; bottom: 22px; display: grid; gap: 8px; width: min(360px, calc(100vw - 32px)); pointer-events: none; }
.toast { display: flex; align-items: flex-start; gap: 10px; padding: 13px 14px; color: #ecebe5; background: #222220; border: 1px solid #363632; border-radius: 9px; box-shadow: 0 16px 35px rgba(0,0,0,.18); animation: toast-in .25s var(--ease); pointer-events: auto; }
.toast.is-error { color: #fff; background: #753832; border-color: #8f4e47; }
.toast.is-success .toast-icon { color: #d2b567; }
.toast.is-leaving { opacity: 0; transform: translateY(5px); transition: opacity .18s, transform .18s; }
.toast-icon { display: grid; place-items: center; width: 22px; height: 22px; color: #c6a85e; }
.toast-icon .icon { width: 16px; height: 16px; }
.toast-content { flex: 1; }
.toast-content strong { display: block; margin-bottom: 1px; font-size: 10px; }
.toast-content span { color: inherit; opacity: .7; font-size: 9px; }
.toast-close { display: grid; width: 24px; height: 24px; place-items: center; color: inherit; background: transparent; border-radius: 5px; opacity: .65; }
.toast-close:hover { background: rgba(255,255,255,.08); opacity: 1; }
.toast-close .icon { width: 12px; height: 12px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(9px) scale(.98); } }
.app-dialog { width: min(660px, calc(100vw - 30px)); max-height: min(86vh, 850px); margin: auto; padding: 0; overflow: hidden; background: #fff; border: 1px solid var(--line-dark); border-radius: 14px; box-shadow: 0 35px 90px rgba(15,15,13,.25); }
.app-dialog::backdrop { background: rgba(18,18,16,.55); backdrop-filter: blur(3px); }
.error-list { display: grid; gap: 7px; margin: 16px 0 0; padding-left: 21px; color: var(--muted); font-size: 10px; }
.error-list strong { color: var(--ink); }
.status-select { width: auto; min-width: 124px; min-height: 40px; background-color: #fff; font-size: 11px; font-weight: 650; }
.dialog-inner { display: flex; max-height: min(86vh, 850px); flex-direction: column; }
.dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 21px 23px 17px; border-bottom: 1px solid var(--line); }
.dialog-header h2 { margin: 0; font: 500 21px/1.2 Georgia, serif; }
.dialog-header p { margin: 5px 0 0; color: var(--muted); font-size: 10px; }
.dialog-header .icon-button { margin: -4px -5px 0 0; }
.dialog-body { flex: 1; padding: 21px 23px; overflow-y: auto; }
.dialog-footer { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; padding: 13px 23px; background: #fafaf8; border-top: 1px solid var(--line); }
.dialog-wide { width: min(970px, calc(100vw - 30px)); }
.preview-dialog .dialog-body { padding: 0; overflow: hidden; }
.preview-dialog iframe { width: 100%; height: min(70vh, 750px); border: 0; background: #deddd9; }

/* Authentication */
.auth-body { background: #f7f7f3; }
.auth-layout { display: grid; min-height: 100vh; grid-template-columns: minmax(430px, 46%) 1fr; }
.auth-story { position: relative; display: flex; min-height: 100vh; padding: 34px clamp(34px,5vw,76px); flex-direction: column; overflow: hidden; color: #f7f4ec; background: #191918; }
.auth-story::before { content: ""; position: absolute; width: 540px; height: 540px; left: -250px; bottom: -285px; border: 1px solid rgba(201,166,70,.10); border-radius: 50%; box-shadow: 0 0 0 70px rgba(201,166,70,.025), 0 0 0 140px rgba(201,166,70,.018); }
.auth-story::after { content: ""; position: absolute; width: 1px; height: 48%; right: 13%; top: 16%; background: linear-gradient(transparent, rgba(201,166,70,.15), transparent); transform: rotate(27deg); }
.brand-light { position: relative; z-index: 2; }
.auth-story-body { position: relative; z-index: 2; margin: auto 0; padding: 35px 0 15px; }
.auth-eyebrow { display: flex; align-items: center; gap: 9px; margin-bottom: 21px; color: #8f8d85; font-size: 8px; font-weight: 700; letter-spacing: .17em; }
.auth-eyebrow .status-dot { margin: 0; }
.auth-story h1 { margin: 0 0 20px; font: 400 clamp(45px,5vw,71px)/.97 Georgia, serif; letter-spacing: -.045em; }
.auth-story h1 span { color: #c5a75e; }
.auth-story-body > p { margin: 0 0 40px; color: #8e8d86; font-size: 12px; line-height: 1.8; }
.auth-mini-document { width: min(350px, 86%); padding: 19px 21px; color: #35342f; background: #f3f0e7; border-radius: 4px; box-shadow: 0 25px 60px rgba(0,0,0,.28); transform: rotate(-1.8deg); }
.auth-mini-head { display: flex; align-items: center; justify-content: space-between; padding-bottom: 10px; color: #8e805d; border-bottom: 1px solid #dcd6c5; font-size: 6px; font-weight: 800; letter-spacing: .17em; }
.auth-mini-head .icon { width: 13px; height: 13px; }
.auth-mini-title { padding: 14px 0; font: 500 17px/1.28 Georgia, serif; }
.auth-mini-lines i { display: block; height: 2px; margin-bottom: 7px; background: #d8d4c8; }
.auth-mini-lines i:nth-child(1) { width: 80%; }
.auth-mini-lines i:nth-child(2) { width: 67%; }
.auth-mini-lines i:nth-child(3) { width: 50%; }
.auth-mini-bottom { display: flex; align-items: center; justify-content: space-between; margin-top: 18px; padding-top: 11px; border-top: 1px solid #dcd6c5; color: #89867b; font-size: 6px; }
.auth-mini-check { display: grid; width: 17px; height: 17px; place-items: center; color: #fff; background: var(--gold); border-radius: 50%; }
.auth-mini-check .icon { width: 9px; height: 9px; stroke-width: 2.2; }
.auth-story-footer { position: relative; z-index: 2; color: #5e5d58; font-size: 8px; letter-spacing: .08em; }
.auth-form-side { display: flex; min-height: 100vh; padding: 40px clamp(28px,7vw,100px) 24px; flex-direction: column; align-items: center; justify-content: center; }
.auth-card { width: min(385px, 100%); }
.auth-welcome-icon { display: grid; width: 43px; height: 43px; margin-bottom: 26px; place-items: center; color: #8a6b29; background: var(--gold-soft); border: 1px solid #e8dcbb; border-radius: 11px; }
.auth-welcome-icon .icon { width: 20px; height: 20px; }
.auth-card h2 { margin: 0 0 10px; font: 500 32px/1.13 Georgia, serif; letter-spacing: -.02em; }
.auth-description { margin: 0 0 28px; color: var(--muted); font-size: 11px; line-height: 1.7; }
.auth-form { display: grid; gap: 16px; }
.auth-form .button { min-height: 45px; margin-top: 4px; }
.auth-security { display: flex; align-items: center; justify-content: center; gap: 7px; margin: 17px 0 0; color: var(--muted-2); font-size: 8.5px; }
.auth-security .icon { width: 12px; height: 12px; }
.auth-footer { display: flex; align-items: center; gap: 8px; margin-top: 42px; color: var(--muted-2); font-size: 8px; }
.auth-footer img { width: 77px; height: 22px; object-fit: contain; filter: grayscale(1); opacity: .62; }
.auth-mobile-brand { display: none; margin-bottom: 35px; font: 500 23px Georgia,serif; }
.auth-mobile-brand span { color: var(--gold); }
.auth-card .notice { margin-bottom: 17px; }
.auth-card ul.errorlist { margin: 0; padding-left: 15px; }

/* Responsive shell & common */
@media (max-width: 1050px) {
  :root { --sidebar: 204px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-layout { grid-template-columns: 1fr; }
  .detail-side { position: static; grid-template-columns: repeat(2, minmax(0,1fr)); }
  .document-action-card { min-height: 100%; }
}
@media (max-width: 820px) {
  :root { --sidebar: 234px; }
  .sidebar { transform: translateX(-100%); transition: transform .25s var(--ease); box-shadow: 20px 0 40px rgba(0,0,0,.15); }
  body.nav-open { overflow: hidden; }
  body.nav-open .sidebar { transform: translateX(0); }
  .sidebar-overlay { position: fixed; z-index: 35; inset: 0; width: 100%; height: 100%; background: rgba(20,20,18,.43); border: 0; backdrop-filter: blur(2px); }
  body.nav-open .sidebar-overlay { display: block; }
  .workspace { margin-left: 0; }
  .mobile-menu { display: inline-grid; margin-left: -8px; }
  .topbar { height: 57px; }
  .topbar-status { display: none; }
  .topbar-date { border: 0; padding: 0; }
  .main-content { padding-top: 32px; }
  .auth-layout { grid-template-columns: minmax(320px, 42%) 1fr; }
  .auth-story { padding-inline: 32px; }
  .auth-story h1 { font-size: 44px; }
  .auth-mini-document { width: 100%; }
}
@media (max-width: 680px) {
  .main-content { padding: 27px 15px 48px; }
  .topbar { padding: 0 17px; }
  .topbar-right { display: none; }
  .workspace-footer { padding-inline: 16px; }
  .workspace-footer > span:last-child { display: none; }
  .page-header { align-items: flex-start; margin-bottom: 24px; flex-direction: column; }
  .page-actions { width: 100%; }
  .page-actions .button-primary { flex: 1; }
  .page-heading { font-size: 30px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .stat-card { min-height: 98px; padding: 14px; }
  .stat-value { font-size: 17px; }
  .deal-toolbar { align-items: stretch; flex-direction: column; }
  .search-field { width: 100%; }
  .filter-tabs { display: none; }
  .mobile-filter { display: block; width: 100%; }
  .data-table { min-width: 700px; }
  .table-scroll { scrollbar-width: thin; }
  .setup-banner { align-items: flex-start; }
  .setup-banner .button { min-width: 36px; padding: 0; }
  .setup-banner .button span { display: none; }
  .detail-side { grid-template-columns: 1fr; }
  .detail-summary-strip { grid-template-columns: 1fr; }
  .detail-summary-item { display: flex; align-items: center; justify-content: space-between; padding: 13px 17px; border-right: 0; border-bottom: 1px solid var(--line); }
  .detail-summary-item:last-child { border-bottom: 0; }
  .detail-summary-label { margin: 0; }
  .detail-summary-value { font-size: 15px; }
  .terms-grid { grid-template-columns: 1fr; }
  .field-grid, .field-grid-3 { grid-template-columns: 1fr; }
  .field-grid .span-2, .field-grid .span-3 { grid-column: span 1; }
  .dialog-header, .dialog-body { padding-inline: 17px; }
  .dialog-footer { padding-inline: 17px; }
  .dialog-footer .button { flex: 1; }
  .auth-layout { display: block; }
  .auth-story { display: none; }
  .auth-form-side { padding: 42px 23px 25px; justify-content: flex-start; }
  .auth-mobile-brand { display: block; align-self: flex-start; }
  .auth-card { margin: auto 0; }
  .auth-footer { margin-top: 45px; }
}
@media (max-width: 400px) {
  .stats-grid { grid-template-columns: 1fr; }
  .stat-card { min-height: 90px; }
  .page-actions > * { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
