/* Brand reference: https://dyadya-yura.ru/ — local assets, no external requests. */
@font-face { font-family: "Open Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("assets/OpenSansRegular.woff2") format("woff2"); }
@font-face { font-family: "Open Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url("assets/OpenSansSemibold.woff2") format("woff2"); }
@font-face { font-family: "Open Sans"; font-style: normal; font-weight: 700; font-display: swap; src: url("assets/OpenSansBold.woff2") format("woff2"); }

:root {
  font-family: "Open Sans", Arial, sans-serif;
  color: #424b54;
  background: #f2f3f5;
  --page: #f2f3f5;
  --surface: #fff;
  --ink: #424b54;
  --muted: #69737d;
  --line: #dfe3e5;
  --accent: #477900;
  --accent-dark: #345d00;
  --accent-soft: #f0f6e7;
  --brand-green: #71be00;
  --rail: #353e48;
  --green: #477900;
  --shadow: 0 1px 3px rgb(36 43 50 / 4%);
}
::selection { background: #d9efba; color: #26351a; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline-color: var(--accent);
}
h1, h2, h3 { color: #525c68; font-weight: 700; }
.mono, .amount, .offer-price, .summary-card strong, .total strong, .finance-row strong { font-family: "Open Sans", Arial, sans-serif; }
.card, .summary-card, .offer-card, .picker-form { border-color: var(--line); border-radius: 4px; box-shadow: var(--shadow); }
.card-heading, .card-body > .client-meta, .note-form, .quote-variant-row { border-color: var(--line); }
.button, .input, .select, .badge, .icon-button, .stage-tabs button { border-radius: 2px; }
.button.primary { background: var(--brand-green); border-color: var(--brand-green); color: #203007; font-weight: 700; box-shadow: none; }
.button.primary:hover { background: #81ce10; border-color: #81ce10; color: #203007; }
.button.secondary { background: #fff; color: #525c68; border-color: #d6dce0; }
.button.secondary:hover { background: var(--accent-soft); border-color: #afc58d; color: var(--accent-dark); }
.button.ghost { color: var(--accent); }
.button.ghost:hover, .icon-button:hover { color: var(--accent-dark); background: var(--accent-soft); border-color: #d6e4c5; }
.text-button, .back-link { color: #69737d; }
.text-button:hover, .back-link:hover, .link-button:hover { color: var(--accent-dark); }
.link-button { color: var(--accent); }
.link-button.danger { color: var(--red); }

.app-rail { background: var(--rail); color: #cbd0d6; }
.brand { width: calc(100% - 12px); height: 58px; margin: 10px 0 18px; padding: 4px; background: #f2f3f5; border: 0; border-radius: 2px; letter-spacing: normal; }
.brand img { display: block; width: auto; height: 48px; max-width: 100%; object-fit: contain; }
.rail-button { color: #d2d7db; border-radius: 3px; }
.rail-symbol { color: #d2d7db; }
.rail-button:hover { background: #46515b; }
.rail-button.active { color: #263508; background: var(--brand-green); }
.rail-button.active .rail-symbol { color: #263508; }
.rail-button.active::before { background: #9edd40; }
.rail-bottom .avatar { color: #e3eddb; background: #515c64; }
.rail-bottom small { color: #b8c0c7; }
.app-header { background: #f2f3f5; border-color: #dfe3e5; }
.workspace-title { color: #353e48; font-weight: 700; }
.workspace-title strong { color: #69737d; font-weight: 600; }
.workspace-title span { color: #b9c1c6; }
.workspace-tabs { background: var(--rail); border-color: var(--rail); }
.workspace-tabs > button { color: #e5e5e5; }
.workspace-tabs > button:hover, .workspace-tabs > button.active { color: #a8e758; }
.workspace-tabs > button.active::after { background: var(--brand-green); height: 3px; }
.workspace-tabs > button > span { color: #d6dde2; background: #4b5660; border-radius: 2px; }
.workspace-tabs > button.active > span { color: #263508; background: var(--brand-green); }
.save-status { color: #d0d7dc; }
.demo-badge, .workspace-footer { color: #69737d; }
.demo-badge i { background: var(--brand-green); }

.input, .select, .field input, .field select, .field textarea, .note-form textarea { color: #424b54; border-color: #d6dce0; }
.input:hover, .select:hover, .field input:hover, .field select:hover { border-color: #b6c2a8; }
input:focus, select:focus, textarea:focus { border-color: var(--brand-green); }
.help, .muted, .field > label, label.field, .mini-label, .section-subtitle,
.card-heading p, .heading-left > p, .eyebrow, .view-caption, .screen-note { color: #69737d; }
.summary-card > label, .summary-card small, .summary-action .summary-label { color: #69737d; }
.summary-card strong, .item-table td.amount strong, .finance-row strong { color: #424b54; }
.cost-line, .finance-row, .client-main p, .client-main small, .quote-variant-row small { color: #69737d; }
.summary-action:hover { border-color: #accb88; background: #f8fbf3; }
.summary-action::after { color: var(--accent); }
.badge.blue { color: #476d1d; border-color: #d9e6c9; background: #f0f6e7; }
.badge.green { color: #416e14; border-color: #cbdcbb; background: #edf5e5; }
.badge.gray { color: #67717b; border-color: #e1e5e8; background: #f2f3f5; }
.avatar { color: #496b29; background: #eaf2df; }
.next-action { border-left-color: var(--brand-green); background: #f4f8ee; border-radius: 0 3px 3px 0; }
.next-action h3, .next-action strong, .client-main strong, .timeline-item strong { color: #424b54; }
.next-action-heading .icon-button { color: var(--accent); }
.next-action p, .next-action .due, .due, .timeline-date, .timeline-item p, .client-main small, .client-meta { color: #69737d; }
.timeline-item { border-left-color: #d8dfd1; }
.timeline-dot { background: #9eaf89; box-shadow: 0 0 0 1px #d5dfc9; }
.timeline-item:first-child .timeline-dot, .timeline-dot.blue { background: var(--brand-green); box-shadow: 0 0 0 1px #bed995; }
.notice.blue { color: #526a3e; border-color: #d9e5cb; background: #f3f7ed; }
.totals-strip, .stage-tabs { background: #f5f6f7; border-color: var(--line); }
.totals-strip > div > strong, .totals-strip > strong, .total strong, .cost-line strong, .cost-line b { color: #424b54; }

/* Preserve the position hierarchy and the responsive geometry in styles.css. */
.sales-table > thead > tr > th { color: #606b74; background: #f2f3f5; }
.sales-table > .sale-position > .item-row, .sales-table > .sale-position > .item-row > td { background-color: #f0f5e9; border-bottom-color: #dce5d0; }
.sales-table > .sale-position > .sale-lead-time-row > td { background-color: #f0f5e9; border-bottom-color: #dce5d0; }
.sales-table > .sale-position > .item-row > td:first-child,
.sales-table > .sale-position > .sale-lead-time-row > td,
.sales-table > .sale-position > .expanded-row > td { background-image: linear-gradient(to right, #71be00 3px, transparent 3px); }
.sales-table > .sale-position.is-open > .item-row > td { border-bottom-color: #e0e8d7; }
.sales-table > .sale-position > .expanded-row > td { background-color: #f0f5e9; border-bottom-color: #d8e1ce; }
.sales-table .sale-name-line input[data-field="name"] { color: #3e4c33; border-color: #cedcbe; border-radius: 2px; }
.sales-table .sale-name-line input[data-field="name"]:hover { border-color: #a9c18d; }
.sales-table .sale-name-line input[data-field="name"]:focus { border-color: var(--brand-green); }
.sales-table .item-row .item-source, .sales-table .item-row .sale-kind { color: #68765a; }
.sales-table .item-row > td.amount > strong { color: #3e4c33; }
.sales-table .item-row .sale-amount-values > strong { color: #3e4c33; }
.sales-table .item-row .row-toggle { color: #52792c; }
.sales-table .item-row .row-toggle:hover { color: #345d00; background: #dfebcf; }
.sales-table .button.purchase-toggle-button { background:#7fbd00; border-color:#6c9e08; color:#203d06; font-weight:700; box-shadow:0 1px 2px rgb(43 70 12 / 18%); }
.sales-table .button.purchase-toggle-button:hover { background:#72ad00; border-color:#527e00; color:#152d02; }
.sales-table .purchase-toggle-count { background:rgb(255 255 255 / 75%); color:#294a0b; }
.purchase-toggle-button .purchase-toggle-total { color:#203d06; font-weight:700; }
.purchase-toggle-button .purchase-toggle-total.is-loss { background:#fff1ee; color:#842323; padding:0 4px; border-radius:3px; }
.sales-table .item-detail.component-section { border-color: #d8e1ce; border-left-color: #bdd29e; background: #fcfdfa; border-radius: 0 0 3px 3px; }
.sales-table .component-table th { background: #f1f3ee; color: #646e5e; }
.sales-table .component-table td { border-color: #e4e9dd; }
.sales-table .component-heading > .compact-kicker, .sales-table .component-kind { color: #64725a; }
.sales-table .component-table .component-inline-name { color: #424b54; border-color: #dce2d5; }
.sales-table .component-purchase-name > .component-include { accent-color: var(--brand-green); }
.sales-table .component-purchase-row.is-excluded > td { background-color: #f3f5f0; }
.sales-table .component-purchase-row.is-excluded .component-inline-name { color: #687263; }
.sales-table .component-excluded-note { color: #6a7462; }
.sales-table .item-number, .sales-table .sale-unit, .sales-table .component-inline-value .input { color: #424b54; border-color: #d6dce0; }
.sales-table .component-supplier-line { border-color: #e1e6d9; }
.sales-table .component-supplier-label, .sales-table .component-table .component-inline-supplier,
.sales-table .component-basis, .sales-table .component-inline-value > span, .sales-table .sales-inline-value > span { color: #6a7462; }
.sales-table .component-supplier-line:hover { background: #f1f5ec; border-color: #bdcfaa; }
.sales-table .component-supplier-line:focus-within { background: #fff; border-color: var(--brand-green); }
.sales-table .component-inline-supplier:focus-visible { outline-color: var(--accent); }
.sales-table .component-totals { border-color: #dce4d2; color: #64725a; }
.sales-table .component-totals b, .sales-table .component-totals strong { color: #424b54; }
.sales-table .component-summary-text { color: #6a7462; }
.sales-table .sale-name-line .sale-include { accent-color: var(--brand-green); }
.sales-table > .sale-position.is-excluded > .item-row,
.sales-table > .sale-position.is-excluded > .item-row > td,
.sales-table > .sale-position.is-excluded > .sale-lead-time-row > td,
.sales-table > .sale-position.is-excluded > .expanded-row > td { background-color: #f0f2f3; }
.sales-table > .sale-position.is-excluded > .item-row > td:first-child,
.sales-table > .sale-position.is-excluded > .sale-lead-time-row > td,
.sales-table > .sale-position.is-excluded > .expanded-row > td { background-image: linear-gradient(to right, #aab3b9 3px, transparent 3px); }
.sales-table > .sale-position > .item-row.is-drag-source > td { background-color: #e3efcf; }
.row-drag-handle { color: #8b9c7c; }
.kanban-column { background: #e9ede5; border-color: #dce3d5; }
.kanban-heading, .kanban-column:nth-child(2) .kanban-heading { color: #526345; }
.deal-tile.featured { border-color: #9abd75; box-shadow: inset 0 3px 0 #71be00; }
button.deal-tile:hover { border-color: #71be00; }
.row-drag-handle:hover { color: var(--accent); background: #e5f0d7; }
[data-drop-row].drop-before > td { box-shadow: inset 0 3px 0 #71be00; }
[data-drop-row].drop-after > td { box-shadow: inset 0 -3px 0 #71be00; }

.stage-tabs button.active, .stage-tabs [aria-pressed="true"] { color: #3d6418; background: #edf5e3; border-color: #bdcfaa; }
.stage-tabs button:hover { color: var(--accent); border-color: #b6cd98; }
.picker-header, .picker-footer { border-color: var(--line); }
#picker, .picker-search .input, .picker-search .select { background: #f2f3f5; }
.picker-header h2, .picker-form h3, .offer-top strong, .offer-top h3, .offer-card > h3, .offer-price { color: #424b54; }
.picker-header p, .picker-search .search-field > span, .offer-spec, .offer-bottom > span, .offer-price small, .offer-radio { color: #69737d; }
.offer-card:hover { border-color: #afc68e; box-shadow: var(--shadow); }
.offer-card.selected { border-color: var(--brand-green); box-shadow: 0 0 0 1px #71be00; background: #f8fbf3; }
.offer-card.selected .offer-radio { color: var(--accent); }
.offer-bottom { border-color: var(--line); }
.prepayment-summary, .component-preview { border-color: #d8e3ca; background: #f3f7ed; }
.prepayment-summary strong, .component-preview strong, .prepayment-form h3, .deal-task-form h3 { color: #424b54; }
.prepayment-info, .prepayment-summary small, .prepayment-info p, .prepayment-form .field > span,
.deal-task-form .field > span, .deal-task-info > p, .deal-task-info > .due { color: #69737d; }
.prepayment-row, .prepayment-form, .deal-task-row, .deal-task-form { border-color: var(--line); }
.deal-task-info > strong, .quote-variant-row strong, .quote-variant-row > b { color: #424b54; }
.deal-task-check { accent-color: var(--brand-green); }
.prepayment-empty, .deal-task-empty, .component-empty { border-color: #d5dec9; color: #69737d; }
.kanban-column { background: #e8ebed; }
.kanban-column:nth-child(2) .kanban-heading { color: var(--accent); }
.kanban { grid-template-columns: repeat(auto-fit, minmax(min(225px, 100%), 1fr)); gap: 10px; }
.kanban-column { padding: 0 8px 10px; background: #f5f7f2; border: 0; border-right: 1px dashed #d5ddcb; border-radius: 0; }
.kanban-stage-header { margin: 0 -8px 12px; }
.kanban-heading, .kanban-column:nth-child(2) .kanban-heading { min-height: 34px; margin: 0; padding: 7px 19px 7px 12px; gap: 6px; color: var(--stage-ink, #293522); background: var(--stage-color, #c3e0a0); clip-path: polygon(0 0, calc(100% - 11px) 0, 100% 50%, calc(100% - 11px) 100%, 0 100%, 7px 50%); }
.kanban-heading h3 { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: inherit; font-size: 11px; line-height: 1.5; font-weight: 700; }
.kanban-heading > span { flex-shrink: 0; color: inherit; font-size: 10px; }
.kanban-stage-total { width: fit-content; max-width: calc(100% - 16px); margin: 9px auto 12px; padding: 3px 9px; border-radius: 3px; background: #e6ebdf; color: #424c39; font-size: 14px; line-height: 1.4; overflow-wrap: anywhere; }
.kanban-column.is-drop-target { background: #e8f2da; }
.deal-tile.featured .eyebrow { color: var(--accent); }
.deal-tile.featured { border-color: #accb84; box-shadow: 0 0 0 1px #d5e8ba; }
.deal-tile.featured:hover { border-color: var(--brand-green); }
.deal-tile h3, .deal-tile > strong { color: #424b54; }
.tile-next { color: #64705a; border-color: #e1e6d9; }
#quote-dialog, #component-dialog, #tasks-dialog, #prepayment-dialog, #confirm-dialog, #remove-component-dialog, #remove-item-dialog, #copy-item-dialog { border-color: #d7dce0; border-radius: 4px; }
dialog::backdrop { background: rgb(35 42 49 / 40%); }
#toast { background: #353e48; border-radius: 3px; }
input[aria-invalid="true"], .sales-table .component-table .input[aria-invalid="true"] { border-color: #bc6c6c; background: #fff7f7; }

/* Deal origin and automatic title remain compact beside the stage controls. */
.page-heading:has(.deal-source-field) { align-items: flex-start; }
.page-actions:has(.deal-source-field) { flex: 0 1 650px; min-width: 0; flex-wrap: wrap; justify-content: flex-end; align-items: flex-end; }
.deal-source-field { display: grid; gap: 4px; flex: 0 1 178px; min-width: 0; max-width: 100%; color: var(--muted); font-size: 10px; }
.deal-source-field .input { width: 100%; min-width: 0; max-width: 100%; }
.deal-title-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 5px; color: var(--muted); font-size: 11px; line-height: 1.5; overflow-wrap: anywhere; }
.deal-auto-name-control { display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: transparent; color: var(--accent); font: inherit; cursor: pointer; }
.deal-auto-name-control:hover { color: var(--accent-dark); text-decoration: underline; }
.deal-auto-name-control:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
@media (max-width: 850px) {
  .page-actions:has(.deal-source-field) { flex-basis: 100%; justify-content: flex-start; }
  .deal-source-field { flex: 1 1 170px; }
}
@media (max-width: 420px) {
  .page-actions:has(.deal-source-field) > .deal-stage-field { min-width: 0; flex: 1 1 150px; }
}

/* Five deal totals share a compact row; the payment block has room for both amounts. */
.summary-grid:has(> .financial-summary) { grid-template-columns: minmax(0, 1fr); gap: 0; margin-bottom: 14px; }
.financial-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)) minmax(0, 1.5fr) repeat(2, minmax(0, 1fr)); min-width: 0; background: #fff; border: 1px solid var(--line); border-radius: 4px; box-shadow: var(--shadow); }
.financial-summary .summary-metric { min-width: 0; min-height: 70px; margin: 0; padding: 8px 14px; }
.financial-summary .summary-metric + .summary-metric { border-left: 1px solid var(--line); }
.financial-summary .summary-metric-label { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; min-height: 15px; margin-bottom: 1px; color: var(--muted); font-size: 11px; line-height: 1.3; }
.financial-summary .summary-metric-label .badge { padding: 1px 4px; font-size: 10px; line-height: 1.2; }
.financial-summary .summary-metric > strong { display: block; color: var(--ink); font-family: "Open Sans", Arial, sans-serif; font-size: 20px; line-height: 1.2; font-weight: 600; letter-spacing: -.4px; font-variant-numeric: tabular-nums lining-nums; overflow-wrap: anywhere; }
.financial-summary .summary-metric > small { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; line-height: 1.2; overflow-wrap: anywhere; }
.financial-summary .summary-received { position: relative; appearance: none; border: 0; border-radius: 0; padding-right: 30px; background: transparent; text-align: left; transition: background .15s; }
.financial-summary .summary-received::after { content: "›"; position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--accent); font-size: 21px; line-height: 1; }
.financial-summary .summary-received:hover { background: #f3f8eb; }
.financial-summary .summary-received:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }

.financial-summary .payment-summary { container: payment-summary / inline-size; }
.payment-summary-open { position: relative; display: block; width: 100%; min-width: 0; margin: 0; padding: 0 17px 0 0; appearance: none; border: 0; border-radius: 2px; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.payment-summary-open::after { content: "›"; position: absolute; right: 0; top: 50%; transform: translateY(-50%); color: var(--accent); font-size: 21px; line-height: 1; }
.payment-summary-open:hover { background: var(--accent-soft); }
.payment-summary-open:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.payment-summary-amounts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; min-width: 0; }
.payment-summary-value { display: block; min-width: 0; }
.financial-summary .payment-summary-value > strong { display: block; margin-top: 2px; font-family: "Open Sans", Arial, sans-serif; font-size: 20px; line-height: 1.25; font-weight: 600; letter-spacing: -.4px; font-variant-numeric: tabular-nums lining-nums; white-space: normal; overflow-wrap: anywhere; }
.financial-summary .payment-amount-received { color: #477900; }
.financial-summary .payment-amount-remaining { color: #a65400; }
.payment-summary-prepayment { display: grid; gap: 5px; min-width: 0; }
.payment-summary-detail { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 2px 8px; min-width: 0; font-size: 11px; line-height: 1.4; }
.payment-summary-detail > span { flex: 1 1 120px; min-width: 0; color: var(--muted); overflow-wrap: anywhere; }
.payment-summary-detail > strong { min-width: 0; color: var(--ink); font-size: 11px; line-height: 1.4; font-weight: 600; font-variant-numeric: tabular-nums lining-nums; overflow-wrap: anywhere; }
.payment-summary-detail.is-covered > span { color: var(--accent-dark); }
.payment-summary-prepayment > small { display: block; min-width: 0; color: var(--muted); font-size: 10px; line-height: 1.4; overflow-wrap: anywhere; }
.payment-summary-prepayment > .link-button { justify-self: start; min-height: 24px; max-width: 100%; margin: 0; padding: 2px 0; font-size: 10px; line-height: 1.4; white-space: normal; }
.payment-summary-prepayment { grid-template-columns: auto minmax(0,1fr); align-items: baseline; }
.payment-summary-prepayment > .quote-prepayment-value { min-width: 0; justify-self: end; color: var(--ink); font-size: 12px; font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.quote-summary-actions { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; grid-column: 1 / -1; min-width: 0; }
.quote-summary-actions > .link-button { min-width: 0; min-height: 24px; margin: 0; padding: 2px 0; font-size: 11px; line-height: 1.4; white-space: normal; text-align: left; }
.quote-summary-actions > .link-button:last-child { text-align: right; }
.financial-summary .payment-summary > .payment-summary-debt { margin-top: 7px; color: var(--red, #b64545); font-size: 11px; line-height: 1.4; }
.payment-summary-status { display: flex; align-items: baseline; flex-wrap: wrap; gap: 3px 8px; min-width: 0; margin-top: 8px; padding-top: 7px; border-top: 1px solid #ead9c5; color: #8a4a08; font-size: 10px; line-height: 1.4; overflow-wrap: anywhere; }
.payment-summary-status > span { flex: 1 1 150px; min-width: 0; }
.payment-summary-status > .link-button { max-width: 100%; min-height: 24px; margin: 0; padding: 2px 0; font-size: 10px; line-height: 1.4; white-space: normal; }
.payment-summary .link-button:focus-visible, .quote-summary .link-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.payment-summary .link-button:disabled, .quote-summary .link-button:disabled { opacity: .5; cursor: default; }
.payment-summary [hidden] { display: none !important; }
@container payment-summary (max-width: 260px) {
  .payment-summary-amounts { grid-template-columns: minmax(0, 1fr); gap: 8px; }
}
@media (max-width: 1000px) {
  .financial-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .financial-summary .payment-summary { grid-column: 1 / -1; }
  .financial-summary .summary-metric:nth-child(3), .financial-summary .summary-metric:nth-child(4) { border-left: 0; }
  .financial-summary .summary-metric:nth-child(n + 3) { border-top: 1px solid var(--line); }
  .financial-summary .summary-received { border-radius: 0 3px 0 0; }
}
@media (max-width: 380px) {
  .financial-summary { grid-template-columns: minmax(0, 1fr); }
  .financial-summary .summary-metric + .summary-metric { border-left: 0; border-top: 1px solid var(--line); }
  .financial-summary .summary-received { border-radius: 0; }
}
