:root {
  color-scheme: light;
  --bg: #f7f7fb;
  --ink: #202137;
  --muted: #62667c;
  --line: #e8e8f0;
  --surface: #fff;
  --brand: #5346c7;
  --brand-deep: #3b309e;
  --brand-soft: #efedff;
  --green: #236945;
  --green-soft: #e6f6ed;
  --blue: #315aad;
  --blue-soft: #edf2ff;
  --amber: #885217;
  --amber-soft: #fff4df;
  --red: #9a3937;
  --red-soft: #fcecec;
  --shadow: 0 10px 32px #2523500a;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); min-width: 300px; }
button, input, select, textarea { font: inherit; color: inherit; }
button, select { cursor: pointer; }
a { color: var(--brand-deep); }
button:disabled { opacity: .55; cursor: not-allowed; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible, tr:focus-visible { outline: 3px solid #9a91f2; outline-offset: 2px; }
[hidden] { display: none !important; }
h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: clamp(28px, 3vw, 40px); line-height: 1.11; letter-spacing: -.045em; }
h2 { font-size: 19px; letter-spacing: -.025em; line-height: 1.25; }
h3 { font-size: 16px; line-height: 1.3; }
small, .subtle { color: var(--muted); }
.icon { width: 19px; height: 19px; flex: none; vertical-align: middle; }
.skip-link { position: fixed; left: 1rem; top: 1rem; z-index: 5; padding: .6rem 1rem; background: white; border-radius: 8px; transform: translateY(-200%); }
.skip-link:focus { transform: translateY(0); }
.initial { display: grid; min-height: 100vh; place-items: center; color: var(--muted); }
.layout { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 24px; padding: 23px 16px 16px; background: var(--surface); border-right: 1px solid var(--line); }
.brandmark { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; margin: 0 8px; }
.brandmark strong { display: block; font-size: 17px; line-height: 1.2; letter-spacing: -.055em; }
.brandmark small { display: block; font-size: 11px; }
.logo { display: grid; place-items: center; width: 38px; height: 38px; background: var(--brand); color: #fff; border-radius: 11px; box-shadow: 0 5px 13px #5346c740; }
.logo .icon { width: 23px; height: 23px; }
.workspace-switch { display: grid; grid-template-columns: 1fr 1fr; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 2px; }
.workspace-switch.single { grid-template-columns: 1fr; }
.workspace-switch button { border: 0; background: transparent; border-radius: 8px; padding: 7px 4px; font-size: 11px; font-weight: 750; letter-spacing: .025em; color: var(--muted); }
.workspace-switch .current { color: var(--brand-deep); background: white; box-shadow: 0 2px 8px #29235d16; }
.nav { display: grid; gap: 4px; }
.nav-caption { padding: 0 10px 7px; color: var(--muted); text-transform: uppercase; font-size: 10px; font-weight: 740; letter-spacing: .12em; }
.nav-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 42px; padding: 7px 10px; border: 0; border-radius: 9px; background: transparent; text-align: left; color: var(--muted); }
.nav-item:hover { background: var(--bg); color: var(--ink); }
.nav-item[aria-current=page] { background: var(--brand-soft); color: var(--brand-deep); font-weight: 700; }
.nav-item .nav-count { margin-left: auto; font-size: 11px; background: white; border: 1px solid var(--line); padding: 0 6px; border-radius: 6px; }
.sidebar-bottom { margin-top: auto; display: grid; gap: 9px; }
.mode-card { border: 1px solid var(--line); border-radius: 12px; padding: 11px; background: var(--bg); }
.mode-card strong { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.mode-card p { color: var(--muted); font-size: 11px; margin-top: 4px; }
.dot { display: inline-block; width: 7px; height: 7px; background: #b77a2d; border-radius: 50%; flex: none; }
.dot.live { background: #32865b; }
.main { width: 100%; max-width: 1630px; margin: 0 auto; padding: 19px clamp(16px, 3vw, 43px) 40px; min-width: 0; }
.topline { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 19px; color: var(--muted); font-size: 12px; }
.topline > span { display: flex; align-items: center; gap: 6px; }
.topline .icon { width: 15px; height: 15px; }
.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px 22px; padding: 22px 0 23px; }
.hero p:not(.eyebrow) { color: var(--muted); margin-top: 9px; max-width: 680px; }
.eyebrow { margin-bottom: 8px; color: var(--brand-deep); font-size: 10px; font-weight: 760; letter-spacing: .17em; text-transform: uppercase; }
.actions { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.hero .actions { flex: none; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 37px; padding: 7px 11px; border-radius: 9px; border: 1px solid var(--line); color: var(--ink); background: var(--surface); font-weight: 650; text-decoration: none; white-space: nowrap; }
.button:hover { background: #f1f0fa; border-color: #dbd8f4; }
.button .icon { width: 16px; height: 16px; }
.button.primary { color: #fff; background: var(--brand); border-color: var(--brand); }
.button.primary:hover { background: var(--brand-deep); border-color: var(--brand-deep); }
.button.quiet { background: transparent; border-color: transparent; color: var(--muted); }
.button.quiet:hover { background: var(--bg); color: var(--ink); }
.button.danger { color: var(--red); }
.button.sm { font-size: 12px; min-height: 31px; padding: 4px 9px; }
.button.icon-only { width: 37px; padding: 5px; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 17px; }
.stat { display: grid; gap: 3px; min-width: 0; padding: 14px; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 13px; box-shadow: var(--shadow); }
.stat:hover { border-color: #c8c1fa; }
.stat-head { display: flex; justify-content: space-between; align-items: center; gap: 3px; }
.stat-head span:first-child { color: var(--muted); font-size: 12px; font-weight: 630; }
.stat-icon { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 9px; background: var(--brand-soft); color: var(--brand-deep); }
.stat-icon .icon { width: 17px; height: 17px; }
.stat-icon.green { color: var(--green); background: var(--green-soft); }
.stat-icon.blue { color: var(--blue); background: var(--blue-soft); }
.stat-icon.amber { color: var(--amber); background: var(--amber-soft); }
.stat strong { display: block; font-size: 27px; letter-spacing: -.055em; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat small { font-size: 11px; }
.columns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 270px); gap: 14px; align-items: start; }
.panel { min-width: 0; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); box-shadow: var(--shadow); }
.panel + .panel { margin-top: 13px; }
.panel-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 9px; padding: 16px; }
.panel-header p { color: var(--muted); margin-top: 3px; font-size: 12px; }
.panel-body { padding: 0 16px 16px; }
.badge { display: inline-flex; max-width: 100%; align-items: center; gap: 4px; padding: 3px 7px; border-radius: 7px; background: var(--bg); color: var(--muted); font-size: 11px; font-weight: 690; line-height: 1.25; overflow-wrap: anywhere; }
.badge.purple { color: var(--brand-deep); background: var(--brand-soft); }
.badge.green { color: var(--green); background: var(--green-soft); }
.badge.blue { color: var(--blue); background: var(--blue-soft); }
.badge.amber { color: var(--amber); background: var(--amber-soft); }
.badge.red { color: var(--red); background: var(--red-soft); }
.toolbar { display: flex; flex-wrap: wrap; gap: 7px; padding: 0 16px 12px; }
.search-field { position: relative; flex: 1 0 180px; }
.search-field .icon { position: absolute; top: 10px; left: 10px; width: 16px; height: 16px; color: var(--muted); }
.search-field input:not([type=checkbox]) { padding-left: 34px; width: 100%; }
input:not([type=checkbox]), select, textarea { background: var(--surface); border: 1px solid #dcdde8; border-radius: 8px; min-width: 0; padding: 7px 9px; min-height: 35px; }
input::placeholder, textarea::placeholder { color: #777b90; }
input[type=file] { max-width: 100%; }
textarea { resize: vertical; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; }
.table-scroll { overflow: auto; border-top: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; text-align: left; }
th { padding: 8px 10px; background: #fafafd; color: var(--muted); text-transform: uppercase; letter-spacing: .045em; font-size: 10px; white-space: nowrap; font-weight: 740; }
td { border-top: 1px solid var(--line); padding: 11px 10px; vertical-align: middle; }
th:first-child, td:first-child { padding-left: 16px; }
th:last-child, td:last-child { padding-right: 16px; }
.lot-row:hover { background: #faf9ff; }
.lot-title { padding: 0; margin: 0; border: 0; background: transparent; color: var(--ink); text-align: left; font-weight: 690; text-decoration: none; line-height: 1.35; overflow-wrap: anywhere; }
.lot-title:hover { color: var(--brand-deep); text-decoration: underline; }
.lot-meta { margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.3; overflow-wrap: anywhere; }
.lot-badges { margin-top: 5px; }
.automation-caption { margin-top: 8px; }
.lot-price { white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 690; }
.lot-deadline { white-space: nowrap; font-size: 12px; }
.footer-line { display: flex; justify-content: space-between; align-items: center; gap: 10px; border-top: 1px solid var(--line); padding: 9px 16px; color: var(--muted); font-size: 12px; }
.stack { display: grid; gap: 13px; }
.stack .panel + .panel { margin-top: 0; }
.timeline { display: grid; gap: 0; list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 14px minmax(0, 1fr); gap: 7px; min-height: 48px; }
.timeline li > span:first-child { position: relative; }
.timeline li > span:first-child:before { position: absolute; top: 5px; left: 2px; content: ""; width: 7px; height: 7px; border-radius: 50%; background: #7164d9; }
.timeline li:not(:last-child) > span:first-child:after { position: absolute; content: ""; background: var(--line); width: 1px; top: 13px; bottom: 0; left: 5px; }
.timeline li > div { padding-bottom: 8px; min-width: 0; overflow-wrap: anywhere; }
.timeline li strong, .timeline li button { font-size: 12px; }
.timeline time { display: block; color: var(--muted); font-size: 10px; }
.hint { padding: 12px; border-radius: 9px; border: 1px solid #dfdbff; color: var(--brand-deep); background: #f6f4ff; font-size: 12px; overflow-wrap: anywhere; }
.hint.amber { border-color: #f0dbb4; background: var(--amber-soft); color: var(--amber); }
.hint.error { border-color: #f1cecd; background: var(--red-soft); color: var(--red); }
.empty { text-align: center; padding: 36px 14px; color: var(--muted); }
.empty > span { display: inline-grid; place-items: center; width: 39px; height: 39px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); margin-bottom: 9px; }
.empty h3 { color: var(--ink); margin-bottom: 3px; }
.kv-grid, .fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; }
.kv-grid > div { padding: 8px 9px; background: var(--bg); border-radius: 8px; overflow-wrap: anywhere; }
.kv-grid small { display: block; font-size: 11px; }
.kv-grid strong { font-weight: 670; }
.field { display: grid; gap: 4px; min-width: 0; align-content: start; }
.field > span { font-size: 12px; font-weight: 660; }
.field.wide, .wide { grid-column: 1 / -1; }
.field > small { font-size: 11px; }
.check { display: flex; align-items: flex-start; gap: 7px; }
.check input { accent-color: var(--brand); margin-top: 5px; flex: none; }
.clean-fieldset { min-width: 0; margin: 0; border: 0; padding: 0; }
.rule-types { display: flex; flex-wrap: wrap; gap: 6px 16px; min-width: 0; padding: 6px 9px; margin: 0; border: 1px solid var(--line); border-radius: 8px; }
.rule-types legend { padding-inline: 4px; font-weight: 650; font-size: 12px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; align-items: center; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(245px, 1fr)); gap: 12px; }
.cards .panel + .panel { margin-top: 0; }
.cards .panel { display: flex; flex-direction: column; }
.cards .panel-body { flex: 1; }
.cards .form-actions { padding: 0 16px 15px; margin-top: auto; }
.pills { display: flex; flex-wrap: wrap; gap: 5px; }
.description { white-space: pre-wrap; overflow-wrap: anywhere; }
.small-list { padding-left: 18px; margin: 5px 0; overflow-wrap: anywhere; }
.small-list li + li { margin-top: 4px; }
dialog { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 15px; padding: 0; max-width: min(calc(100vw - 22px), 630px); max-height: calc(100dvh - 26px); width: 100%; box-shadow: 0 25px 70px #1f19463b; }
dialog::backdrop { background: #201c3d62; }
dialog.drawer { width: min(730px, 100%); height: 100dvh; max-height: 100dvh; max-width: 100%; margin: 0 0 0 auto; border-radius: 15px 0 0 15px; }
.dialog-head { position: sticky; top: 0; z-index: 2; background: var(--surface); display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 14px 17px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { margin-top: 2px; overflow-wrap: anywhere; }
.dialog-body { padding: 15px 17px 19px; }
.drawer .dialog-body { background: var(--bg); }
.drawer-tabs { display: flex; flex-wrap: wrap; padding: 0 17px; gap: 8px; border-bottom: 1px solid var(--line); }
.drawer-tabs button { min-height: 39px; color: var(--muted); border: 0; border-bottom: 2px solid transparent; background: white; padding: 5px 4px; }
.drawer-tabs button[aria-pressed=true] { color: var(--brand-deep); font-weight: 700; border-bottom-color: var(--brand); }
.drawer-badges { margin-bottom: 9px; }
.section { display: grid; gap: 9px; padding: 13px; border: 1px solid var(--line); border-radius: 11px; background: white; }
.section .form-actions { margin-top: 0; }
.quote-items { display: grid; gap: 7px; }
.section .quote-actions { margin: 9px 0; }
.section .quote-fields { margin-top: 10px; }
.quote-line { display: grid; grid-template-columns: minmax(115px, 2.5fr) minmax(65px, .7fr) minmax(60px, .7fr) minmax(75px, 1fr) minmax(75px, 1fr) auto; align-items: end; gap: 6px; }
.quote-line input { width: 100%; }
.quote-total { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 7px; padding: 9px 11px; background: var(--brand-soft); border-radius: 8px; }
.quote-total strong { color: var(--brand-deep); font-size: 17px; }
.mail-entry { border: 1px solid var(--line); padding: 8px 11px; border-radius: 9px; overflow-wrap: anywhere; }
.mail-entry summary { cursor: pointer; }
.mail-entry p { margin-top: 6px; }
.login { min-height: 100dvh; display: grid; align-items: center; justify-items: center; padding: 18px; }
.login .panel { width: min(100%, 400px); padding: 24px; display: grid; gap: 17px; }
.login .brandmark { margin: 0; }
.login .button { width: 100%; }
.toasts { position: fixed; right: 13px; bottom: 13px; z-index: 8; max-width: min(415px, calc(100vw - 26px)); pointer-events: none; }
.toast { padding: 10px 13px; border-radius: 9px; border: 1px solid #ccedda; background: var(--green-soft); color: var(--green); box-shadow: var(--shadow); }
.toast.error { border-color: #f1cecd; background: var(--red-soft); color: var(--red); }
@media (max-width: 1130px) {
  .layout { grid-template-columns: 200px minmax(0, 1fr); }
  .sidebar { padding-inline: 12px; }
  .columns { grid-template-columns: minmax(0, 1fr); }
  .columns aside.stack { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 790px) {
  .layout { display: block; }
  .sidebar { position: static; height: auto; padding: 12px 15px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(130px, 190px); gap: 10px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brandmark { margin: 0; }
  .sidebar .nav { grid-column: 1 / -1; display: flex; overflow-x: auto; gap: 4px; padding-bottom: 2px; }
  .nav-item { width: auto; white-space: nowrap; min-height: 36px; flex: none; padding: 5px 8px; font-size: 12px; }
  .nav-item .icon { width: 15px; height: 15px; }
  .nav-caption, .sidebar-bottom { display: none; }
  .topline { margin-bottom: 3px; }
  .hero { flex-wrap: wrap; padding-top: 14px; }
}
@media (max-width: 530px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .stat { padding: 9px; }
  .columns aside.stack { grid-template-columns: 1fr; }
  .tender-table th.optional, .tender-table td.optional { display: none; }
  .hero .actions { flex: 1 1 auto; }
  .kv-grid, .fields { grid-template-columns: 1fr; }
  .quote-line { grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 8px; border: 1px solid var(--line); border-radius: 8px; }
  .quote-line .field:first-child { grid-column: span 2; }
  .quote-line button { justify-self: start; }
}
