:root {
  color-scheme: light;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: #182439;
  background: #f4f6fa;
  font-size: 15px;
  --line: #dce4ef;
  --muted: #586981;
  --blue: #244fbc;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
[hidden] { display: none !important; }
a { color: var(--blue); }
button, input, textarea, select { font: inherit; }
button, .upload-button { cursor: pointer; }
:is(button, a, input, textarea, select, .upload-button):focus-visible, .upload-button:focus-within { outline: 3px solid #8aaaff; outline-offset: 2px; }
button:disabled { opacity: .55; cursor: wait; }
button, .upload-button { border-radius: 9px; min-height: 42px; padding: 9px 15px; font-weight: 600; }
.primary { background: var(--blue); border: 1px solid var(--blue); color: #fff; }
.primary:hover:not(:disabled) { background: #1e429f; }
.secondary, .upload-button { background: #fff; border: 1px solid #cbd7e9; color: #284773; }
.secondary:hover, .upload-button:hover { background: #eef3fe; }
.wide { width: 100%; }
.text-button { border: 0; background: transparent; color: var(--blue); }
.text-button:hover { background: #edf2fc; }
.danger, .feedback[data-error="true"] { color: #a13228; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(28px, 4vw, 43px); letter-spacing: -.045em; line-height: 1.12; }
h2 { font-size: 19px; letter-spacing: -.015em; }
.brand { font-weight: 750; text-decoration: none; font-size: 29px; letter-spacing: -.07em; color: inherit; white-space: nowrap; }
.brand span { font-size: 12px; letter-spacing: 0; color: #2954b4; background: #e6edff; margin-left: 7px; padding: 4px 6px; border-radius: 6px; vertical-align: middle; }
.login { width: min(440px, calc(100% - 32px)); margin: clamp(36px, 12vh, 126px) auto; padding: 32px; background: #fff; border: 1px solid var(--line); border-radius: 19px; box-shadow: 0 12px 46px #263f6310; }
.login h1 { font-size: 29px; margin: 23px 0 10px; }
.login p, .heading p { color: var(--muted); line-height: 1.55; }
.login form { margin: 23px 0 10px; }
.login button { width: 100%; margin-top: 14px; }
.back { display: inline-block; margin-top: 15px; font-size: 14px; text-decoration: none; }
.workspace { display: grid; grid-template-columns: 230px minmax(0, 1fr); min-height: 100vh; }
.rail { padding: 28px 20px; background: #172740; color: #f6f8ff; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 34px; }
.rail nav { display: grid; gap: 6px; }
.rail button { color: #deebfa; background: none; border: 0; text-align: left; }
.rail button:hover, .rail button[aria-current] { background: #293f61; color: #fff; }
.rail-footer { margin-top: auto; display: flex; align-items: center; flex-wrap: wrap; }
.rail-footer a { padding: 12px; color: #deebfa; text-decoration: none; }
main { width: 100%; max-width: 1320px; margin: 0 auto; padding: 42px clamp(24px, 4vw, 64px); min-width: 0; }
.heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 26px; }
.heading p { margin-top: 8px; }
.surface { background: #fff; border: 1px solid var(--line); border-radius: 13px; }
.filters { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(160px, 220px); gap: 12px; padding: 14px; margin-bottom: 15px; }
label { display: block; color: #263951; font-size: 14px; font-weight: 600; }
label :is(input:not([type=checkbox]), textarea, select) { margin-top: 7px; }
input:not([type=checkbox]), textarea, select { display: block; width: 100%; padding: 10px 12px; min-height: 42px; border: 1px solid #cbd6e5; border-radius: 8px; color: #182439; background: #fcfdff; }
input::placeholder, textarea::placeholder { color: #65758c; }
textarea { resize: vertical; line-height: 1.5; }
.product-list { display: grid; gap: 8px; }
.product-row { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(100px, .75fr) auto; align-items: center; gap: 15px; text-align: left; color: inherit; width: 100%; padding: 14px 16px; }
.product-row:hover { border-color: #8aa9dc; }
.product-name { display: flex; align-items: center; gap: 12px; min-width: 0; }
.product-name img { width: 56px; height: 48px; object-fit: contain; background: #eaf0fa; border-radius: 8px; }
.product-name div { min-width: 0; }
.product-name strong { display: block; overflow-wrap: anywhere; }
.product-name small, .card-preview small { display: block; color: var(--muted); font-weight: 400; margin-top: 3px; }
.badge { display: inline-block; justify-self: start; border-radius: 20px; padding: 5px 9px; color: #4e5d73; background: #edf1f6; white-space: nowrap; font-size: 12px; font-weight: 650; }
.badge.published { background: #e5f4ea; color: #205d3e; }
.badge.changed { background: #fff1d9; color: #76520b; }
.row-action { color: var(--blue); font-size: 14px; }
.empty { padding: 28px; color: var(--muted); text-align: center; }
.editor-heading { margin-top: 11px; }
.editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(250px, .54fr); gap: 18px; align-items: start; }
.editor-fields { display: grid; gap: 18px; }
.panel { padding: 22px; margin-bottom: 16px; }
.editor-grid .panel { margin: 0; }
.panel > * + *, .panel form > * + * { margin-top: 14px; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.checkbox { display: flex; align-items: flex-start; gap: 7px; line-height: 1.5; }
.checkbox input { accent-color: var(--blue); width: 16px; height: 16px; flex: 0 0 auto; }
.hint, .optional { color: var(--muted); font-size: 13px; font-weight: 400; line-height: 1.55; }
.card-preview { display: flex; align-items: center; gap: 12px; padding: 12px; min-height: 78px; border: 1px solid var(--line); border-radius: 10px; overflow-wrap: anywhere; }
.card-preview img { display: block; width: 54px; height: 52px; object-fit: contain; background: #eaf0fa; border-radius: 8px; }
.upload-button { display: block; text-align: center; }
.upload-button input { width: 1px !important; height: 1px; padding: 0 !important; min-height: 0 !important; position: absolute; opacity: 0; }
.action-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 18px; padding: 12px; position: sticky; bottom: 10px; }
.editor-actions { display: flex; gap: 10px; margin-left: auto; flex-wrap: wrap; }
.feedback { color: #305e49; font-size: 14px; line-height: 1.5; }
.feedback:empty { display: none; }
.notice { position: sticky; top: 10px; z-index: 2; background: #eef7f0; border: 1px solid #cce2d3; padding: 10px 14px; border-radius: 9px; margin-bottom: 14px; }
.notice[data-error="true"] { border-color: #e8c3bc; background: #fff1ee; }
#workPage, #connectionsPage { max-width: 860px; }
#sheetStep > *, #columnsStep > * { margin-top: 12px; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
td, th { padding: 8px 10px; border: 1px solid var(--line); text-align: left; min-width: 110px; }
th { background: #edf2fa; }
.split, .connection-actions { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.connection-actions { justify-content: flex-start; }
@media (max-width: 900px) {
  .workspace { grid-template-columns: 174px minmax(0, 1fr); }
  .rail { padding-inline: 12px; }
  .editor-grid { grid-template-columns: 1fr; }
}
@media (max-width: 650px) {
  .workspace { display: block; }
  .rail { height: auto; padding: 14px 16px; position: static; gap: 10px; }
  .rail nav { display: flex; flex-wrap: wrap; }
  .rail nav button { padding-inline: 9px; font-size: 13px; }
  .rail-footer { margin: 0; gap: 5px; }
  .rail-footer a, .rail-footer button { font-size: 13px; padding: 4px 8px; min-height: 28px; }
  main { padding: 23px 15px; }
  .heading { align-items: flex-start; flex-wrap: wrap; }
  .filters, .field-grid { grid-template-columns: 1fr; }
  .product-row { grid-template-columns: minmax(0, 1fr) auto; gap: 7px; padding: 10px; }
  .row-action { display: none; }
  .panel { padding: 16px; }
  .editor-actions { margin-left: 0; }
  .editor-actions button { flex: 1 1 auto; }
}
.account-panel { width: min(94%, 600px); margin: clamp(24px, 8vh, 85px) auto; }
.account-panel h1 { font-size: clamp(1.7rem, 5vw, 2.4rem); }
.account-form { display: grid; gap: .85rem; }
.account-form p, .account-steps { line-height: 1.55; }
.account-form button { justify-self: start; }
.account-steps { margin: 0; padding-left: 1.5rem; }
.account-steps li + li { margin-top: .75rem; }
#factorQr { display: block; max-width: 100%; height: auto; border: 1px solid #dfe5ef; border-radius: 12px; }
.employee-row { display: grid; grid-template-columns: minmax(110px, 1fr) auto auto; align-items: center; gap: .75rem; border-top: 1px solid #dfe5ef; padding-top: .75rem; overflow-wrap: anywhere; }
.employee-actions { display: flex; flex-wrap: wrap; gap: .4rem; }
@media (max-width: 760px) { .employee-row { grid-template-columns: 1fr; } }
.history-layout { display: grid; grid-template-columns: minmax(210px, 1fr) minmax(0, 2fr); gap: 16px; align-items: start; }
.history-row { display: grid; gap: 5px; width: 100%; color: inherit; text-align: left; overflow-wrap: anywhere; }
.history-row small { color: var(--muted); }
.history-row:is(:hover, [aria-current]) { background: #edf2fc; }
.history-message { border: 1px solid var(--line); border-radius: 9px; padding: 14px; overflow-wrap: anywhere; }
.history-message h3 { margin-bottom: 8px; font-size: 14px; }
.history-message p { white-space: pre-wrap; }
.history-answer { background: #f4f6fa; }
.history-attachment { display: block; margin-top: 6px; }
@media (max-width: 760px) { .history-layout { grid-template-columns: minmax(0, 1fr); } }
