:root {
    color-scheme: dark;
    --bg: #090b0f;
    --panel: #11151d;
    --field: #151b26;
    --border: #2a3341;
    --text: #f3f4f6;
    --muted: #aeb7c5;
    --accent: #f59e0b;
    --green: #6ee7b7;
    --rose: #fda4af;
}

*, *::before, *::after { box-sizing: border-box; }
body {
    margin: 0;
    padding-bottom: 42px;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.55 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
a { color: inherit; text-underline-offset: 3px; }
h1, h2, p, dl, dd { margin: 0; }
h1 { font-size: clamp(1.7rem, 4vw, 2.5rem); letter-spacing: -.035em; line-height: 1.17; }
h2 { font-size: 1.12rem; line-height: 1.35; }
h1, h2, p, dd, .row { overflow-wrap: anywhere; }
.shell { width: min(1440px, calc(100% - 44px)); margin-inline: auto; }
main.shell > * + * { margin-top: 18px; }
.header { border-bottom: 1px solid var(--border); background: var(--panel); }
.header-inner, .brand, .header-account, .toolbar, .row, .section-top, .detail-title {
    display: flex;
    align-items: center;
    gap: 14px;
}
.header-inner { justify-content: space-between; min-height: 74px; }
.brand { text-decoration: none; line-height: 1.35; }
.brand-mark {
    display: grid;
    place-items: center;
    font-weight: 800;
    background: var(--accent);
    color: #171006;
    width: 40px;
    height: 40px;
    border-radius: 7px;
}
.brand small { display: block; color: var(--muted); }
.header-account { color: var(--muted); }
main.shell { padding-top: clamp(24px, 5vw, 54px); }
.search-panel { padding-bottom: 12px; }
.new-supplier { margin-top: 12px; }
.tab-count { color: var(--muted); font-size: .85em; font-variant-numeric: tabular-nums; }
.active-filters { padding: 0 19px 13px; }
.active-filters a { color: #fbd389; }
.result-group .section-top { padding: 13px 19px; margin: 0; border-top: 1px solid var(--border); }
.search { display: flex; gap: 9px; margin-top: 17px; }
.search input { min-height: 58px; font-size: 1.15rem; }
.search .primary { min-width: 115px; font-size: 1rem; }
.search-field { position: relative; flex: 1 1 auto; min-width: 0; }
.suggestions {
    position: absolute;
    z-index: 2;
    inset: calc(100% + 7px) 0 auto;
    max-height: min(56vh, 520px);
    overflow: auto;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 9px;
    box-shadow: 0 13px 40px rgb(0 0 0 / .38);
}
.suggestions[hidden] { display: none; }
.suggestion-group + .suggestion-group { border-top: 1px solid var(--border); }
.suggestion-label { color: var(--muted); padding: 9px 12px 3px; font-size: .85rem; font-weight: 650; }
.suggestion-option { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px; text-decoration: none; }
.suggestion-option strong { display: block; overflow-wrap: anywhere; }
.suggestion-option small { display: block; color: var(--muted); }
.suggestion-option:hover, .suggestion-option[aria-selected="true"] { background: var(--field); }
.suggestion-more { border-top: 1px solid var(--border); color: #fbd389; }
.suggestion-message { padding: 12px; color: var(--muted); }
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}
.lookup { position: relative; min-width: 0; display: grid; align-content: start; gap: 5px; }
.lookup label { font-weight: 550; }
.lookup-popup { position: absolute; z-index: 3; inset: 70px 0 auto; max-height: 285px; overflow: auto; background: var(--panel); border: 1px solid var(--border); border-radius: 6px; box-shadow: 0 10px 24px #0007; }
.lookup-option, .lookup-message { padding: 8px 11px; overflow-wrap: anywhere; }
.lookup-option { cursor: pointer; }
.lookup-option:hover, .lookup-option[aria-selected="true"] { background: var(--field); }
.lookup-more { width: 100%; }
.lookup-create { justify-self: start; }
.inline-form .lookup { flex: 1 1 210px; }
.supply-dialog { width: min(620px, calc(100% - 24px)); max-height: calc(100% - 24px); color: var(--text); overflow: auto; }
.supply-dialog::backdrop { background: #080b10ba; }
.supply-dialog h2 { margin-bottom: 16px; }
.contact-action { display: flex; align-items: baseline; flex-wrap: wrap; column-gap: 8px; }
.contact-action button { min-height: 28px; padding: 2px 6px; }
.offer-sort { margin-bottom: 12px; }
.offer-sort a[aria-current] { border-color: var(--accent); color: #fbd389; }
.offer-comparison { width: 100%; border-collapse: collapse; }
.offer-comparison td, .offer-comparison th { padding: 12px 9px; vertical-align: top; text-align: left; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
.offer-comparison td > span { display: block; }
.offer-comparison td .state { margin-top: 5px; }
.offer-comparison td a { display: block; }
.offer-amount { display: inline-block; max-width: 100%; overflow-wrap: anywhere; }
.offer-price-group { background: var(--field); }
.offer-menu summary { list-style: none; }
.offer-menu summary::-webkit-details-marker { display: none; }
.offer-menu-content { margin: 5px 0 0; display: grid; gap: 5px; }
.check-label { display: flex; gap: 8px; align-items: center; }
.check-label input { min-height: 0; width: auto; }
@media (max-width: 760px) {
    .offer-comparison, .offer-comparison tbody { display: block; }
    .offer-comparison thead { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; }
    .offer-comparison tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; padding: 10px 0; border-top: 1px solid var(--border); }
    .offer-comparison td, .offer-comparison th { display: block; border: 0; padding: 3px 4px; }
    .offer-comparison td:first-child, .offer-comparison th { grid-column: 1 / -1; }
    .offer-comparison td:not(:first-child)::before { content: attr(data-field); display: block; color: var(--muted); font-size: .85rem; }
}
.panel {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 19px;
    background: var(--panel);
    min-width: 0;
}
.catalog { display: grid; grid-template-columns: minmax(200px, 270px) minmax(0, 1fr); align-items: start; gap: 17px; }
.category-navigation { display: grid; gap: 4px; }
.category-navigation h2 { margin-bottom: 8px; }
.category-navigation > a { text-decoration: none; padding: 6px 9px; border-radius: 5px; }
.category-navigation > a:hover, .category-navigation .current { background: var(--field); }
.category-navigation .current { border-inline-start: 2px solid var(--accent); }
.catalog-results { padding: 0; }
.tabs, .filters, .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tabs { gap: 20px; border-bottom: 1px solid var(--border); padding-inline: 19px; }
.tabs a { padding: 13px 0 10px; text-decoration: none; border-bottom: 3px solid transparent; color: var(--muted); }
.tabs a[aria-current="page"] { color: var(--text); border-color: var(--accent); }
.filters a { border: 1px solid var(--border); color: var(--muted); padding: 4px 8px; border-radius: 5px; text-decoration: none; }
.filters a:hover, .filters a[aria-current] { background: var(--field); color: var(--text); }
.filters a[aria-current] { border-color: var(--accent); }
.toolbar, .section-top { justify-content: space-between; flex-wrap: wrap; }
.toolbar { padding: 14px 19px; }
.section-top { margin-bottom: 12px; }
.row { border-top: 1px solid var(--border); padding: 13px 0; text-decoration: none; flex-wrap: wrap; }
.catalog-results .row { padding-inline: 19px; }
.result:hover { background-color: var(--field); }
.result .muted { display: block; }
.offer-row { gap: 8px 14px; }
.offer-record { display: flex; align-items: center; flex-wrap: wrap; gap: 7px 12px; text-decoration: none; }
.offer-record:hover strong { text-decoration: underline; }
.offer-record .muted { display: block; }
.offer-external { padding-block: 4px; color: #fbd389; font-size: .9rem; }
.grow { flex: 1 1 185px; min-width: 0; }
.muted, dt { color: var(--muted); }
.empty { padding: 24px 19px; }
.state { display: inline-flex; padding: 4px 9px; border: 1px solid currentColor; border-radius: 5px; font-size: .85rem; white-space: nowrap; }
.state-pending { color: #fbd389; }
.state-confirmed { color: var(--green); }
.state-rejected { color: var(--rose); }
.login { width: min(100%, 440px); margin: 2vh auto; }
.stack { display: grid; gap: 12px; }
.login .stack { margin-block: 14px 9px; }
.fields, .facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.fields .wide { grid-column: 1 / -1; }
.inline-form { display: flex; align-items: end; flex-wrap: wrap; gap: 10px; }
label { display: grid; gap: 5px; font-weight: 550; min-width: 0; }
input, select, textarea, button, .button {
    color: var(--text);
    background: var(--field);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 9px 12px;
    font: inherit;
    min-height: 40px;
}
input, select, textarea { width: 100%; min-width: 0; }
input::placeholder { color: var(--muted); }
textarea { resize: vertical; }
button, .button { display: inline-flex; align-items: center; justify-content: center; cursor: pointer; text-decoration: none; }
button:hover, .button:hover { border-color: var(--muted); }
.primary { background: var(--accent); border-color: var(--accent); color: #171006; font-weight: 720; }
.primary:hover { background: #fbbf24; border-color: #fbbf24; }
.text-button { background: none; border: 0; color: #fbd389; text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.notice { background: #10231e; border: 1px solid #34765c; color: var(--green); padding: 12px 16px; border-radius: 7px; }
.notice.error { background: #2a1420; border-color: #754359; color: var(--rose); }
.notice ul { margin: 0; padding-inline-start: 17px; }
.crumbs { color: var(--muted); }
.detail-title { margin-bottom: 20px; align-items: start; flex-wrap: wrap; }
.detail-title p { margin-top: 8px; }
.facts dd, .text-lines { white-space: pre-line; }
.entry { padding-top: 11px; border-top: 1px solid var(--border); overflow-wrap: anywhere; }
summary { cursor: pointer; }
.edit-title { font-size: 1.1rem; font-weight: 700; }
details .fields, .source-data { margin-top: 13px; }
.paging { display: flex; justify-content: flex-end; gap: 7px; padding: 10px 0 0; }
.activity-filters { display: flex; gap: 14px; flex-wrap: wrap; align-items: end; }
.activity-filters label:first-child { flex: 1 1 210px; }
.activity-changes { display: grid; gap: 8px; }
.activity-changes > div { display: grid; grid-template-columns: minmax(125px, 155px) 1fr; gap: 10px; }
.activity-changes dd { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; }
.office-frame { height: max(450px, 75vh); border: 1px solid var(--border); background: var(--panel); }
.sheet-changes { min-width: 0; max-height: 55vh; overflow-y: auto; }
.sheet-changes .entry { padding: 10px 0; }
.sheet-changes .section-top { margin-bottom: 0; }
input[type="file"]::file-selector-button { margin-inline-end: 10px; }
.catalog-results .paging { padding: 12px 19px; }

@media (max-width: 720px) {
    .shell { width: calc(100% - 26px); }
    .catalog { grid-template-columns: minmax(0, 1fr); }
    .category-navigation { grid-template-columns: repeat(auto-fit, minmax(138px, 1fr)); }
    .category-navigation h2 { grid-column: 1 / -1; }
    .search .primary { min-width: auto; }
    .suggestions { width: calc(100vw - 26px); }
    .suggestion-option .state { display: none; }
    .header-account > span { display: none; }
    .fields, .facts { grid-template-columns: minmax(0, 1fr); }
    .activity-changes > div { grid-template-columns: 1fr; gap: 3px; }
}
