:root {
  --bar: 64px;
  --ink: #14232c; --ink-soft: #1c303b; --ink-text: #b9c8d1; --ink-muted: #7f929e;
  --canvas: #f2f4f6; --paper: #ffffff; --line: #dde2e8; --line-soft: #eaeef2;
  --text: #17232c; --muted: #5b6a76; --faint: #8896a2;
  --brand: #0b6477; --brand-dark: #084e5d; --brand-tint: #e3f1f4;
  --sandbox: #a24508; --sandbox-tint: #fff2df;
  --live: #a11d1d; --live-tint: #fde9e9;
  --ok: #14633a; --ok-tint: #e2f4ea; --bad: #a11d1d; --bad-tint: #fde9e9;
  --info: #1d5fa8; --info-tint: #e6f0fb;
  --radius: 8px; --radius-sm: 6px;
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --mono: Consolas, "Cascadia Mono", "Courier New", monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--canvas); color: var(--text); font: 15px/1.5 var(--font); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, p { margin: 0; }
.icon { flex: none; vertical-align: -3px; }
.num, td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mono { font-family: var(--mono); font-size: .92em; }
.muted { color: var(--muted); }
.version-note { margin-top: 22px; text-align: center; font-size: .85rem; }
.sr-only { position: absolute; left: -9999px; }
:focus-visible { outline: 3px solid #7cc4d8; outline-offset: 2px; }

.appbar { position: sticky; top: 0; z-index: 20; height: var(--bar); display: flex; align-items: center; gap: 14px; padding: 0 20px 0 10px;
          background: var(--paper); border-top: 4px solid var(--sandbox); border-bottom: 1px solid var(--line); }
.mode-live .appbar { border-top-color: var(--live); }
.menu-toggle { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border: 0; border-radius: var(--radius-sm);
               background: transparent; color: var(--text); cursor: pointer; }
.menu-toggle:hover { background: var(--canvas); }
.brand { display: flex; gap: 10px; align-items: center; flex: 0 1 auto; min-width: 0; }
.brand-mark { width: 34px; height: 34px; flex: none; border-radius: 9px; background: var(--brand); color: #fff; display: grid; place-items: center; }
.brand-logo { display: block; flex: none; max-width: 170px; max-height: 38px; object-fit: contain; }
.brand-name { color: var(--ink); font-weight: 700; font-size: 1.06rem; line-height: 1.2; letter-spacing: .1px; white-space: normal; overflow-wrap: anywhere; max-width: 300px; }
.company-switch { flex: 0 1 auto; min-width: 120px; max-width: 680px; margin-left: 16px; }
.company-switch form { margin: 0; }
.company-switch .company-name { padding: 7px 12px; border: 1px solid #c4ccd5; border-radius: var(--radius-sm); background: var(--paper); color: var(--text);
                                font-weight: 600; font-size: .92rem; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appbar-end { margin-left: auto; display: flex; align-items: center; gap: 14px; flex: none; }
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: calc(100vh - var(--bar)); transition: grid-template-columns .18s ease; }
.sidebar { background: var(--ink); color: var(--ink-text); padding: 14px 12px; display: flex; flex-direction: column;
           position: sticky; top: var(--bar); height: calc(100vh - var(--bar)); overflow-y: auto; overflow-x: hidden; }
.step-hint { font-size: .86rem; color: var(--muted); }
.nav-group { margin: 14px 8px 6px; font-size: .78rem; color: var(--ink-muted); }
.nav a { display: flex; gap: 11px; align-items: center; padding: 9px 10px; margin: 1px 0; border-radius: var(--radius-sm);
         color: var(--ink-text); font-weight: 500; position: relative; white-space: nowrap; }
.nav a .icon { flex: none; }
.nav a:hover { background: var(--ink-soft); color: #fff; text-decoration: none; }
.nav a.active { background: var(--ink-soft); color: #fff; }
.nav a.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px;
                        border-radius: 0 3px 3px 0; background: #4fc3d9; }

.side-foot { margin-top: auto; padding: 12px 10px 4px; border-top: 1px solid var(--ink-soft); font-size: .82rem; color: var(--ink-muted); }
.side-foot b { color: var(--ink-text); font-weight: 600; }

.main { min-width: 0; display: flex; flex-direction: column; }
.mode-pill { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px 4px 10px; border-radius: 99px; font-weight: 600; font-size: .86rem; }
.mode-pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.mode-sandbox .mode-pill { background: var(--sandbox-tint); color: var(--sandbox); }
.mode-live .mode-pill { background: var(--live-tint); color: var(--live); }
.content { padding: 26px 28px 80px; width: 100%; max-width: 1240px; }

.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 1.55rem; line-height: 1.25; font-weight: 650; letter-spacing: -.2px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin-top: 4px; display: flex; gap: 18px; flex-wrap: wrap; }
.crumb { display: inline-flex; gap: 6px; align-items: center; font-size: .88rem; margin-bottom: 6px; color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.change-number { position: relative; }
.change-number summary { list-style: none; cursor: pointer; }
.change-number summary::-webkit-details-marker { display: none; }
.change-number form { position: absolute; right: 0; top: calc(100% + 6px); z-index: 5; display: flex; gap: 8px; padding: 12px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 6px 20px rgba(15, 30, 45, .14); }
.change-number form { width: 300px; }
.change-number input { flex: 1; min-width: 0; width: auto; }

.btn { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: var(--radius-sm);
       border: 1px solid var(--brand); background: var(--brand); color: #fff; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--brand-dark); border-color: var(--brand-dark); text-decoration: none; }
.btn.secondary { background: var(--paper); color: var(--text); border-color: #c4ccd5; }
.btn.secondary:hover { background: var(--canvas); }
.btn.danger { background: var(--live); border-color: var(--live); }
.btn.danger:hover { background: #831515; }
.btn.ghost-danger { background: transparent; color: var(--bad); border-color: transparent; }
.btn.ghost-danger:hover { background: var(--bad-tint); }
.btn.small { height: 30px; padding: 0 10px; font-size: .9rem; }
.btn[disabled], .btn.disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.icon-btn { width: 32px; height: 32px; display: inline-grid; place-items: center; border-radius: var(--radius-sm); border: 0; background: transparent; color: var(--faint); cursor: pointer; }
.icon-btn:hover { background: var(--bad-tint); color: var(--bad); }

.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 20px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line-soft); }
.panel-head h2 { font-size: 1rem; font-weight: 650; white-space: nowrap; }
.panel-body { padding: 18px; }
.panel-note { padding: 12px 18px; border-top: 1px solid var(--line-soft); color: var(--muted); font-size: .9rem; }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.two-col > aside .panel:last-child { margin-bottom: 0; }

.msg { display: flex; gap: 10px; padding: 11px 14px; border-radius: var(--radius-sm); margin-bottom: 14px; border: 1px solid; align-items: flex-start; }
.msg.success { background: var(--ok-tint); border-color: #a5d6b8; color: var(--ok); }
.msg.error { background: var(--bad-tint); border-color: #e6aaaa; color: var(--bad); }
.msg.warning, .msg.info { background: var(--sandbox-tint); border-color: #f0c98c; color: #7a3a05; }

.kpis { display: flex; flex-wrap: wrap; gap: 1px; overflow: hidden; background: var(--line-soft); }
.kpi { flex: 1 1 190px; min-width: 0; padding: 18px 20px; background: var(--paper); container-type: inline-size; }
.kpi.total { background: var(--ink); }
.kpi.total .label, .kpi.total .note, .kpi.total .value small { color: #c5d2da; }
.kpi.total .value { color: #fff; }
.kpi .label { color: var(--muted); font-size: .88rem; }
.kpi-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.kpi-head .label { min-width: 0; }
.kpi-icon { width: 34px; height: 34px; flex: none; display: grid; place-items: center; border-radius: 10px; }
.kpi-icon .icon { vertical-align: 0; }
.kpi-icon.sales { background: var(--brand-tint); color: var(--brand-dark); }
.kpi-icon.tax { background: var(--ok-tint); color: var(--ok); }
.kpi-icon.extra { background: var(--sandbox-tint); color: #8a3c06; }
.kpi-icon.further { background: #efe9fd; color: #5b3cc4; }
.kpi.total .kpi-icon { background: rgba(255, 255, 255, .14); color: #fff; }
.kpi .value { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 4px; font-size: 1.25rem; font-size: clamp(1rem, 12.5cqi, 1.6rem); font-weight: 650; letter-spacing: -.4px; font-variant-numeric: tabular-nums; margin: 4px 0 2px; }
.kpi .amount { white-space: nowrap; }
.kpi .value small { font-size: .95rem; font-weight: 600; color: var(--muted); }
.fbr-status { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 30px; padding: 14px 20px; }
.fbr-status h2 { font-size: 1rem; font-weight: 650; margin-right: 6px; }
.status-count { display: inline-flex; align-items: center; gap: 10px; color: var(--text); }
.status-count:hover { text-decoration: none; }
.status-count:hover .chip { text-decoration: underline; }
.status-count b { font-size: 1.3rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.status-count .chip { padding: 4px 12px 4px 10px; font-size: .86rem; }
.chip.waiting { background: var(--sandbox-tint); color: #7a3a05; }
.kpi .note { color: var(--faint); font-size: .85rem; }
.status-count b.bad { color: var(--bad); }

.bars { display: grid; grid-template-columns: repeat(12, 1fr); gap: 8px; align-items: end; height: 170px; padding: 18px 18px 0; }
.bar { display: flex; flex-direction: column; justify-content: flex-end; height: 100%; text-align: center; }
.bar .fill { background: var(--brand); border-radius: 4px 4px 0 0; min-height: 3px; opacity: .88; }
.bar.zero .fill { background: var(--line); opacity: 1; }
.bar .v { font-size: .78rem; color: var(--muted); margin-bottom: 4px; font-variant-numeric: tabular-nums; }
.bar-labels { display: grid; grid-template-columns: repeat(12, 1fr); gap: 8px; padding: 6px 18px 14px; border-top: 1px solid var(--line); margin: 0 18px; padding-left: 0; padding-right: 0; text-align: center; color: var(--muted); font-size: .85rem; }

.chart-head { align-items: center; flex-wrap: wrap; }
.chart-head h2 { font-size: 1.05rem; }
.chart-note { margin-top: 2px; font-size: .88rem; }
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--radius-sm); background: var(--canvas); border: 1px solid var(--line-soft); }
.seg-btn { min-height: 34px; padding: 0 14px; border: 0; border-radius: calc(var(--radius-sm) - 2px); background: transparent; color: var(--muted); font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer; white-space: nowrap; }
.seg-btn:hover { color: var(--text); }
.seg-btn[aria-pressed="true"] { background: var(--paper); color: var(--text); box-shadow: 0 1px 3px rgba(20, 35, 44, .14); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-weight: 600; font-size: .85rem; color: var(--muted); padding: 10px 16px; border-bottom: 1px solid var(--line); background: #fafbfc; white-space: nowrap; }
td { padding: 12px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.row-link { cursor: pointer; }
tbody tr.row-link:hover { background: #f7fafb; }
td .sub { display: block; color: var(--muted); font-size: .85rem; }
td strong a { color: var(--text); }
.empty { padding: 40px 18px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--text); font-size: 1.02rem; margin-bottom: 4px; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 8px; border-radius: 99px; font-size: .82rem; font-weight: 600; white-space: nowrap; line-height: 1.6; }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip.draft { background: #e9edf1; color: #46535e; }
.chip.validated { background: var(--info-tint); color: var(--info); }
.chip.submitted { background: var(--ok-tint); color: var(--ok); }
.chip.failed { background: var(--bad-tint); color: var(--bad); }
.chip.sandbox { background: var(--sandbox-tint); color: var(--sandbox); }
.chip.production { background: var(--live-tint); color: var(--live); }
.chip.plain::before { display: none; }
.chip.registered { background: var(--ok-tint); color: var(--ok); }
.chip.unregistered { background: var(--sandbox-tint); color: #7a3a05; }

.toolbar { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tabs a { padding: 6px 12px; border-radius: 99px; color: var(--muted); font-weight: 600; font-size: .9rem; }
.tabs a:hover { background: var(--canvas); text-decoration: none; }
.tabs a.active { background: var(--brand-tint); color: var(--brand-dark); }
.tabs a small { font-weight: 500; margin-left: 3px; color: var(--faint); }
.tabs a.active small { color: var(--brand); }
.list-bar { justify-content: flex-start; gap: 12px 14px; padding: 14px 16px; }
.list-bar .search input[type=search] { width: 330px; max-width: 100%; height: 40px; }
.list-bar .search .icon { top: 12px; }
.list-count { margin-left: auto; white-space: nowrap; }
.pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border: 1px solid #c4ccd5; border-radius: 99px; background: var(--paper); color: var(--text); font-weight: 600; font-size: .92rem; white-space: nowrap; }
.pill small { font-weight: 500; color: var(--muted); }
.pill:hover { background: var(--canvas); text-decoration: none; }
.pill.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.pill.active small { color: #c5d2da; }
.code { display: inline-block; padding: 2px 8px; border-radius: var(--radius-sm); background: #eef1f4; color: var(--text); font-family: var(--mono); font-size: .88rem; white-space: nowrap; }
.chip.rate { background: var(--brand-tint); color: var(--brand-dark); padding: 2px 12px; }
.tabs a[class^="tab-"]:not(.tab-all)::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; vertical-align: 2px; background: currentColor; }
.tabs .tab-draft::before { color: #7b8794; }
.tabs .tab-validated::before { color: var(--info); }
.tabs .tab-submitted::before { color: var(--ok); }
.tabs .tab-failed::before { color: var(--bad); }
.tabs a small { color: var(--muted); }
.search { position: relative; }
.search .icon { position: absolute; left: 10px; top: 9px; color: var(--faint); }
.search input[type=search] { padding-left: 34px; width: 310px; }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line-soft); color: var(--muted); font-size: .9rem; }
.pager .pages { display: flex; gap: 6px; }

label { display: block; font-weight: 600; font-size: .9rem; margin: 0 0 5px; }
input[type=text], input[type=number], input[type=date], input[type=password], input[type=search], select, textarea {
  width: 100%; height: 36px; padding: 0 10px; border: 1px solid #b9c3cd; border-radius: var(--radius-sm); font: inherit; color: var(--text); background: #fff; }
input[type=number] { text-align: right; font-variant-numeric: tabular-nums; }
input:hover, select:hover { border-color: #8d9ba7; }
input:focus, select:focus { border-color: var(--brand); outline: 3px solid #bfe0e8; outline-offset: 0; }
.field { margin-bottom: 14px; }
.field .help { color: var(--muted); font-size: .85rem; margin-top: 4px; max-width: 520px; }
.field .help ul { margin: 4px 0 0; padding-left: 18px; }
.field .err, .row-errors { color: var(--bad); font-weight: 600; font-size: .88rem; margin-top: 4px; }
.has-err input, .has-err select { border-color: var(--bad); }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 20px; }
.form-grid .wide { grid-column: span 2; }
.form-grid .full { grid-column: 1 / -1; }
.form-narrow { max-width: 680px; }
.form-actions { display: flex; gap: 10px; padding-top: 6px; }

.items-head, .item { display: grid; grid-template-columns: 172px minmax(160px, 1fr) 96px 136px 32px; gap: 10px; align-items: end; }
.items-head { padding: 10px 18px; background: #fafbfc; border-bottom: 1px solid var(--line); font-size: .85rem; font-weight: 600; color: var(--muted); }
.items-head .r { text-align: right; }
.item { padding: 12px 18px 8px; border-bottom: 1px solid var(--line-soft); }
.item[hidden] { display: none; }
.item .c-total { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.item .c-more { grid-column: 1 / -1; }
.item label { display: block; font-size: .74rem; font-weight: 600; color: var(--muted); margin-bottom: 2px; }
.item .price-head { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; white-space: nowrap; }
.item .price-head label { margin-bottom: 2px; }
.item .mode-switch { all: unset; box-sizing: border-box; font-size: .7rem; font-weight: 500; color: var(--brand); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; padding: 0 0 2px; }
.item .mode-switch:hover, .item .mode-switch:focus-visible { color: var(--ink); }
.item input[hidden] { display: none; }
.tax-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.tax-strip .pair { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 6px; border: 1px solid var(--line-soft); border-radius: 8px; background: #fafbfc; }
.item input.ro { background: #f1f3f5; color: var(--muted); }
.item input[data-f="qty"], .item input[data-f="price"], .item input[data-f="linevalue"], .item input[data-f="discpct"], .item input[data-f="discount"], .item input[data-f="taxamt"],
.item input[data-f$="pct"], .item input[data-f$="view"] { text-align: right; font-variant-numeric: tabular-nums; }
.labels-hidden label { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.labels-hidden .field .help { display: none; }
.fbr-details { font-size: .88rem; }
.fbr-details summary { cursor: pointer; color: var(--muted); padding: 2px 0; list-style: none; display: inline-flex; gap: 6px; align-items: center; }
.fbr-details summary::-webkit-details-marker { display: none; }
.fbr-details summary::before { content: "\25B8"; font-size: .8rem; transition: transform .12s; }
.fbr-details[open] summary::before { transform: rotate(90deg); }
.fbr-details summary:hover { color: var(--brand); }
.summary-hidden .fbr-details summary span { display: none; }
.summary-hidden .fbr-details summary { padding: 2px 8px 2px 0; }
.more-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; padding: 10px 0 6px; }
.more-grid label { font-size: .8rem; font-weight: 600; color: var(--muted); }
.item input[type=checkbox] { display: none; }
.items-foot { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; padding: 16px 18px; }
.totals { min-width: 300px; margin-left: auto; }
.totals div { display: flex; justify-content: space-between; padding: 4px 0; color: var(--muted); font-variant-numeric: tabular-nums; }
.totals .grand { border-top: 2px solid var(--text); margin-top: 6px; padding-top: 9px; color: var(--text); font-weight: 700; font-size: 1.2rem; }
.actionbar { position: sticky; bottom: 0; background: var(--paper); border-top: 1px solid var(--line); margin: 0 -28px -80px; padding: 12px 28px; display: flex; gap: 10px; justify-content: flex-end; align-items: center; }
.actionbar .hint { margin-right: auto; color: var(--muted); font-size: .88rem; }

.stepper { display: flex; align-items: center; padding: 18px 24px; }
.step { display: flex; align-items: center; gap: 10px; font-weight: 600; color: var(--faint); white-space: nowrap; }
.step .dot { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; background: #fff; }
.step.done { color: var(--ok); } .step.done .dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.step.current { color: var(--text); } .step.current .dot { border-color: var(--brand); }
.step.current .dot::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.step-line { flex: 1; height: 2px; background: var(--line); margin: 0 14px; min-width: 24px; }
.step-line.done { background: var(--ok); }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; padding: 16px 18px; }
.facts dt { color: var(--muted); font-size: .85rem; }
.facts dd { margin: 2px 0 0; font-weight: 600; }
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: flex; gap: 9px; padding: 6px 0; align-items: flex-start; }
.checklist .ok { color: var(--ok); } .checklist .no { color: var(--bad); }
.irn { display: flex; gap: 8px; align-items: center; background: var(--ok-tint); border-radius: var(--radius-sm); padding: 10px 12px; color: var(--ok); }
.irn .mono { font-size: .95rem; font-weight: 700; word-break: break-all; flex: 1; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 0 0 14px 20px; position: relative; border-left: 2px solid var(--line); margin-left: 5px; font-size: .9rem; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--ok); border: 2px solid #fff; }
.timeline li.bad::before { background: var(--bad); }
.timeline .when { color: var(--faint); font-size: .8rem; display: block; }
.confirm-box { display: flex; gap: 8px; align-items: flex-start; font-weight: 500; font-size: .9rem; background: var(--live-tint); padding: 10px 12px; border-radius: var(--radius-sm); margin-bottom: 10px; }
.confirm-box input { margin-top: 4px; }
.qr-box { text-align: center; padding-top: 6px; } .qr-box img { width: 1in; height: 1in; padding: .12in; box-sizing: content-box; background: #fff; }

.progress { height: 8px; background: var(--line-soft); border-radius: 99px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.steps { list-style: none; margin: 0; padding: 0; }
.steps li { display: flex; gap: 12px; align-items: center; padding: 9px 18px; border-top: 1px solid var(--line-soft); }
.steps .tick { width: 24px; height: 24px; border-radius: 50%; border: 2px solid #b9c3cd; flex: none; display: grid; place-items: center; color: #fff; }
.steps .done .tick { background: var(--ok); border-color: var(--ok); }
.steps .done .what { color: var(--muted); }
.steps .what { flex: 1; }

@media (max-width: 1000px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; gap: 8px; padding: 10px 14px; }
  .nav-group { display: none; }
  .appbar { gap: 10px; padding: 0 12px 0 8px; }
  .brand-name { display: none; }
  .company-switch { margin-left: 4px; }
  .nav { display: flex; flex-wrap: wrap; } .nav a.active::before { display: none; }
  .two-col { grid-template-columns: 1fr; }
  .list-bar .search { flex: 1 1 100%; } .list-bar .search input[type=search] { width: 100%; }
  .items-head { display: none; }
  .item { grid-template-columns: 1fr 1fr; }
  .tax-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: 1fr; } .form-grid .wide { grid-column: auto; }
  .more-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media print { .sidebar, .appbar, .actionbar { display: none; } .shell { display: block; } }

.nw { white-space: nowrap; }
.compact th, .compact td { padding-left: 12px; padding-right: 12px; }
.compact td { font-size: .94rem; }
.compact td .sub { font-size: .82rem; line-height: 1.4; margin-top: 2px; }
.settings-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.settings-grid .panel { margin-bottom: 20px; }
.dash-top { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: stretch; }
.dash-top .panel { margin-bottom: 20px; }
.dash-top.single { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 1000px) { .settings-grid, .dash-top { grid-template-columns: 1fr; } }
.top-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.top-row .panel { margin-bottom: 20px; }
.top-head { flex-wrap: wrap; }
.top-rows { list-style: none; margin: 0; padding: 4px 18px 10px; }
.top-item { display: flex; gap: 12px; align-items: flex-start; padding: 11px 0; border-bottom: 1px solid var(--line-soft); }
.top-item:last-child { border-bottom: 0; }
.top-rank { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--brand-tint); color: var(--brand-dark); display: grid; place-items: center; font-weight: 700; font-size: .82rem; }
.top-main { flex: 1; min-width: 0; }
.top-line { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.top-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.top-value { flex: none; font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.top-bar { height: 6px; border-radius: 999px; background: var(--line-soft); margin-top: 7px; overflow: hidden; }
.top-bar i { display: block; height: 100%; background: var(--brand); border-radius: inherit; }
.top-note { display: block; margin-top: 5px; color: var(--muted); font-size: .84rem; }
.top-empty { padding: 28px 18px; color: var(--muted); text-align: center; }
@media (max-width: 1000px) { .top-row { grid-template-columns: 1fr; } }

input:disabled { background: #f2f4f6; color: var(--muted); cursor: not-allowed; border-color: var(--line); }
.lock-note, .locked-value { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: .9rem; }
.lock-note { margin: -6px 0 14px; }
.locked-value { background: #f2f4f6; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 10px; color: var(--text); max-width: 420px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; background: var(--sandbox-tint); border: 1px solid #f0c98c; border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 14px; max-width: 520px; }
.check input { width: 18px; height: 18px; margin-top: 2px; flex: none; }

.ss { position: relative; }
.ss .ss-input { width: 100%; height: 36px; padding: 0 34px 0 10px; border: 1px solid #b9c3cd; border-radius: var(--radius-sm); font: inherit; color: var(--text); background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%235b6a76' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center; }
.ss .ss-input:hover { border-color: #8d9ba7; }
.ss .ss-input:focus { border-color: var(--brand); outline: 3px solid #bfe0e8; outline-offset: 0; }
.ss-list { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px; list-style: none;
           max-height: 300px; overflow-y: auto; background: #fff; border: 1px solid #b9c3cd; border-radius: var(--radius); box-shadow: 0 8px 24px rgba(20, 35, 44, .16); }
.ss-item { display: flex; gap: 12px; align-items: baseline; padding: 8px 10px; border-radius: var(--radius-sm); cursor: pointer; line-height: 1.35; }
.ss-item.active { background: var(--brand-tint); }
.ss-code { flex: none; min-width: 84px; font-family: var(--mono); font-weight: 700; color: var(--brand-dark); font-size: .93rem; }
.ss-desc { color: var(--text); font-size: .92rem; }
.ss-custom { font-style: italic; color: var(--muted); }
.ss-empty { padding: 10px; color: var(--muted); font-size: .9rem; }
#rate-note:empty { display: none; }
.lists { width: 100%; margin-bottom: 14px; font-size: .94rem; }
.lists div { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line-soft); }
.lists div:last-child { border-bottom: 0; }
.lists .when { color: var(--muted); font-size: .86rem; }
.lists .path-text { font-family: var(--mono); font-size: .84rem; text-align: right; overflow-wrap: anywhere; }
.lists .company-row { align-items: center; }
.lists .company-actions { display: flex; align-items: center; gap: 10px; }
.lists form { margin: 0; }

.rate-note { color: var(--muted); font-size: .85rem; max-width: 560px; margin: -8px 0 14px; }
.rate-note:empty { display: none; }
.rate-note.bad { color: #7a3a05; }
#registration-retry { margin: -6px 0 14px; }
#registration-retry[hidden] { display: none; }
.rate-note.warn { color: #7a3a05; background: var(--sandbox-tint); border: 1px solid #f0c98c; border-radius: var(--radius-sm); padding: 6px 10px; }
.ss-badge { margin-left: auto; flex: none; align-self: center; font-size: .72rem; font-weight: 600; color: var(--ok); background: var(--ok-tint); border-radius: 99px; padding: 1px 8px; white-space: nowrap; }
.ss-link { color: var(--brand); font-weight: 600; margin-left: 6px; cursor: pointer; text-decoration: underline; }
.ss-note { padding: 9px 10px; color: var(--muted); font-size: .86rem; border-top: 1px solid var(--line-soft); margin-top: 4px; }

.req { color: var(--bad); font-weight: 700; }
.opt { color: var(--muted); font-weight: 400; font-size: .85rem; }
.js-err { margin-top: 4px; }

.has-err .ss .ss-input, .has-err select { border-color: var(--bad); }

.hint { display: block; font-size: .74rem; color: var(--muted); margin-top: 2px; }

[hidden] { display: none !important; }
.plain-fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.plain-fieldset[disabled] { pointer-events: none; }
.plain-fieldset[disabled] .btn { opacity: .55; }
.user-box { margin: auto 4px 0; padding: 12px; border-top: 1px solid rgba(255,255,255,.12); font-size: .88rem; }
.user-box b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-box .user-role { display: block; opacity: .75; margin-bottom: 8px; }
.user-box .user-links { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.user-box a, .user-box button { color: inherit; background: none; border: 0; padding: 0; font: inherit; text-decoration: underline; cursor: pointer; }
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; background: var(--canvas); }
.login-card { width: 100%; max-width: 400px; }
.login-card .brand-line { display: flex; gap: 10px; align-items: center; margin-bottom: 4px; }
.login-card label { display: block; font-weight: 600; margin: 12px 0 6px; }
.login-card input[type=text], .login-card input[type=password] { width: 100%; }
.login-card .btn { width: 100%; justify-content: center; margin-top: 18px; }
.date-filter { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 10px 16px; border-bottom: 1px solid var(--line-soft); font-size: .9rem; }
.date-filter label { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.date-filter input[type=date], .date-filter select { width: auto; }
.pp .ss-list { min-width: 420px; }
.pp .ss-code { min-width: 92px; }
.logo-preview { border: 1px solid var(--line-soft); border-radius: var(--radius-sm); padding: 10px; margin-bottom: 10px; background: #fff; text-align: center; }
.logo-preview img { max-width: 100%; max-height: 90px; object-fit: contain; }
.logo-upload { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.logo-upload input[type=file] { flex: 1 1 200px; min-width: 0; }
.company-picker { position: relative; }
.company-picker::after { content: ""; position: absolute; right: 14px; top: 50%; width: 7px; height: 7px; margin-top: -6px; pointer-events: none;
                         border-right: 2px solid var(--text); border-bottom: 2px solid var(--text); transform: rotate(45deg); }
.company-picker .company-name { padding-right: 38px; }
.company-picker:hover .company-name { border-color: #8d9ba7; }
.company-picker select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.company-picker:focus-within .company-name { border-color: var(--brand); outline: 3px solid #bfe0e8; outline-offset: 0; }
.company-picker select option { color: #111; background: #fff; }
.cs-ready select { display: none; }
.cs-button { display: block; width: 100%; text-align: left; font-family: inherit; cursor: pointer; }
.cs-button:hover { border-color: #8d9ba7; }
.cs-button:focus-visible { border-color: var(--brand); outline: 3px solid #bfe0e8; outline-offset: 0; }
.cs-button[aria-expanded="true"] { border-color: var(--brand); }
.cs-pop { position: absolute; z-index: 40; left: 0; top: calc(100% + 6px); width: max(100%, 340px); max-width: calc(100vw - 24px); padding: 8px;
          background: var(--paper); color: var(--text); border: 1px solid #b9c3cd; border-radius: var(--radius); box-shadow: 0 10px 30px rgba(20, 35, 44, .18); }
.cs-pop .cs-search { width: 100%; height: 38px; padding: 0 10px; border: 1px solid #b9c3cd; border-radius: var(--radius-sm); font: inherit; color: var(--text); background: #fff; }
.cs-pop .cs-search:focus { border-color: var(--brand); outline: 3px solid #bfe0e8; outline-offset: 0; }
.cs-list { list-style: none; margin: 6px 0 0; padding: 0; max-height: 320px; overflow-y: auto; }
.cs-item { padding: 9px 10px; border-radius: var(--radius-sm); cursor: pointer; font-weight: 500; font-size: .93rem; line-height: 1.35; overflow-wrap: anywhere; }
.cs-item.active { background: var(--brand-tint); }
.cs-item.current { font-weight: 700; }
.cs-item.current::after { content: " (open now)"; font-weight: 500; color: var(--muted); font-size: .85rem; }
.cs-empty { padding: 10px; color: var(--muted); font-size: .9rem; }
@media (min-width: 1001px) {
  .menu-closed .shell { grid-template-columns: 68px minmax(0, 1fr); }
  .menu-closed .sidebar { padding: 14px 10px; }
  .menu-closed .nav a { justify-content: center; gap: 0; padding: 10px 0; font-size: 0; }
  .menu-closed .nav a.active::before { left: -10px; }
  .menu-closed .nav-group { height: 1px; margin: 10px 6px; padding: 0; font-size: 0; background: var(--ink-soft); }
  .menu-closed .user-box { display: none; }
}
@media (max-width: 1000px) { .menu-closed .sidebar { display: none; } }
@media (max-width: 760px) { .mode-pill { display: none; } }
.preview { position: fixed; inset: 0; z-index: 60; display: flex; align-items: stretch; justify-content: center; padding: 20px; background: rgba(15, 28, 36, .6); }
.preview-box { width: min(1000px, 100%); display: flex; flex-direction: column; overflow: hidden; background: var(--paper); border-radius: var(--radius); box-shadow: 0 18px 50px rgba(0, 0, 0, .35); }
.preview-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 18px; border-bottom: 1px solid var(--line); }
.preview-head h2 { flex: 1 1 auto; min-width: 0; margin: 0; font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preview-x { width: 38px; height: 38px; flex: none; display: grid; place-items: center; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text); cursor: pointer; }
.preview-x:hover { background: var(--bad-tint); color: var(--bad); }
.preview-frame { flex: 1 1 auto; width: 100%; border: 0; background: #e8ebee; }
body.preview-open { overflow: hidden; }
@media (max-width: 760px) { .preview { padding: 0; } .preview-box { border-radius: 0; } .preview-head { flex-wrap: wrap; } .preview-head h2 { flex-basis: 100%; } }
@media print { .preview { display: none; } }
.net-toasts { position: fixed; z-index: 120; top: 14px; left: 50%; transform: translateX(-50%); width: min(560px, calc(100vw - 24px)); display: flex; flex-direction: column; align-items: center; gap: 10px; pointer-events: none; }
.net-toast { pointer-events: auto; width: 100%; display: flex; align-items: flex-start; gap: 12px; padding: 14px 14px 14px 16px; border-radius: 14px; background: #fff; color: #1b2433; border: 1px solid #e3e8ef; border-left: 5px solid var(--bad); box-shadow: 0 14px 38px rgba(17, 24, 39, .2), 0 2px 6px rgba(17, 24, 39, .08); animation: net-in .32s cubic-bezier(.2, .9, .3, 1.2); }
.content > .net-toast { position: fixed; z-index: 121; top: 14px; left: 50%; width: min(560px, calc(100vw - 24px)); transform: translateX(-50%); }
.net-toast.online { border-left-color: var(--ok); }
.net-toast.warning { border-left-color: #c2620a; }
.net-toast.warning .net-icon { background: var(--sandbox-tint); color: #8a3c06; }
.net-text span { max-height: 42vh; overflow-y: auto; overflow-wrap: anywhere; }
.net-act { align-self: flex-start; margin-top: 8px; padding: 6px 14px; border: 0; border-radius: 99px; background: var(--bad-tint); color: var(--bad); font: inherit; font-weight: 650; font-size: .88rem; cursor: pointer; }
.net-act:hover { filter: brightness(.96); }
.net-toast.leaving { animation: net-out .26s ease forwards; }
.net-toast.nudge { animation: net-nudge .45s ease; }
.net-icon { width: 38px; height: 38px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--bad-tint); color: var(--bad); }
.net-toast.online .net-icon { background: var(--ok-tint); color: var(--ok); }
.net-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; padding-top: 1px; }
.net-text b { font-size: 1rem; font-weight: 700; }
.net-text span { font-size: .9rem; line-height: 1.45; color: #4a5566; }
.net-text a { align-self: flex-start; margin-top: 6px; font-weight: 650; font-size: .9rem; }
.net-x { flex: none; width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: #4a5566; cursor: pointer; }
.net-x:hover { background: #eef1f5; color: #1b2433; }
.net-chip { pointer-events: auto; display: inline-flex; align-items: center; gap: 7px; padding: 6px 14px 6px 10px; border: 1px solid #f3c2bd; border-radius: 99px; background: #fff4f2; color: #9b1c12; font: inherit; font-weight: 650; font-size: .86rem; cursor: pointer; box-shadow: 0 6px 18px rgba(17, 24, 39, .14); animation: net-in .3s ease; }
.net-chip svg { width: 16px; height: 16px; }
.is-offline form[data-needs-internet] button[type="submit"] { opacity: .55; }
@keyframes net-in { from { opacity: 0; transform: translateY(-18px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes net-out { to { opacity: 0; transform: translateY(-14px) scale(.97); } }
@keyframes net-nudge { 0%, 100% { transform: none; } 25% { transform: translateX(-6px); } 50% { transform: translateX(6px); } 75% { transform: translateX(-3px); } }
@media (prefers-reduced-motion: reduce) { .net-toast, .net-chip, .net-toast.leaving, .net-toast.nudge { animation: none; } }
.report-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 18px; align-items: start; }
.month-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.month-pick label { font-weight: 600; }
.month-pick select { width: auto; min-width: 200px; }
.report-figures .report-total { font-weight: 700; border-top: 2px solid var(--text); }
.report-rates { margin: 6px 0 14px; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); }
.small-note { font-size: .86rem; margin: 12px 0 0; }
.export-links { display: flex; flex-wrap: wrap; gap: 10px; }
.page-head .actions { display: flex; flex-wrap: wrap; gap: 10px; }
.report-grid.one { grid-template-columns: minmax(0, 1fr); max-width: 820px; }
@media (max-width: 1000px) { .report-grid { grid-template-columns: 1fr; } }
.list-tools { position: relative; display: inline-block; }
.list-tools > summary { list-style: none; cursor: pointer; }
.list-tools > summary::-webkit-details-marker { display: none; }
.list-tools[open] > summary { box-shadow: 0 0 0 3px var(--brand-tint); }
.list-tools-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; min-width: 290px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: 0 12px 32px rgba(15, 30, 45, .16); padding: 6px; }
.list-tools-menu a { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-radius: 8px; color: var(--text); }
.list-tools-menu a:hover, .list-tools-menu a:focus-visible { background: var(--soft, #f1f5f8); text-decoration: none; outline: none; }
.list-tools-menu a svg { flex: none; margin-top: 2px; color: var(--brand); }
.list-tools-menu b { display: block; font-weight: 600; }
.list-tools-menu small { display: block; color: var(--muted); font-size: .84rem; margin-top: 2px; }
.import-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.import-columns { margin-top: 16px; }
.import-columns td { vertical-align: top; }
.import-columns td:first-child { white-space: nowrap; width: 38%; }
.import-notes { margin: 18px 0 0; padding-left: 18px; color: var(--muted); font-size: .9rem; }
.import-notes li { margin-bottom: 6px; }
.import-counts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 8px; }
.import-count { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.import-count b { font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.import-count span { color: var(--muted); font-size: .88rem; }
.import-count.ready b { color: var(--ok); }
.import-count.skipped b { color: var(--muted); }
.import-count.problem b { color: var(--bad); }
.import-title { margin: 20px 0 8px; font-size: 1rem; }
.import-title.problem { color: var(--bad); }
.import-title.ready { color: var(--ok); }
.import-table td { vertical-align: top; }
.import-row { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--muted); }
.import-table tr.problem td:last-child { color: var(--bad); }
.import-go { margin-top: 18px; }
@media (max-width: 1000px) { .import-grid, .import-counts { grid-template-columns: 1fr; } }
@media (max-width: 700px) { .list-tools-menu { left: 0; right: auto; min-width: 0; width: min(290px, calc(100vw - 32px)); } }
