@font-face {
  font-family: "DM Sans";
  src: url("assets/dm-sans.woff2") format("woff2");
  font-weight: 100 1000;
  font-display: swap;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-width: 0;
  background: var(--canvas);
  color: var(--ink);
  font: 400 14px/1.5 "DM Sans", system-ui, sans-serif;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .58; }
a { color: var(--accent-ink); }
h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: clamp(26px, 3vw, 36px); line-height: 1.16; letter-spacing: -.04em; overflow-wrap: anywhere; }
h2 { font-size: 22px; line-height: 1.3; }
h3 { font-size: 17px; line-height: 1.35; letter-spacing: -.015em; }
h4 { font-size: 15px; }
small { font-size: 12px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.skip-link {
  position: fixed; inset: var(--s3) auto auto var(--s3); z-index: 10;
  padding: var(--s2) var(--s4); border-radius: var(--r1); background: var(--surface);
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; }

.brand-lockup { display: flex; align-items: center; gap: var(--s3); padding: 0 var(--s2) var(--s3); }
.brand-lockup img { flex: none; border-radius: 10px; }
.brand-lockup strong { display: block; font-size: 19px; line-height: 1.1; font-weight: 760; }
.brand-lockup span { color: var(--nav-muted); font-size: 12px; }
.nav-list { display: grid; gap: var(--s1); min-height: 0; align-content: start; overflow-y: auto; padding: 3px; }
.nav-btn {
  border: 1px solid transparent; border-radius: var(--r1); color: var(--nav-muted);
  background: transparent; text-align: left; font-weight: 650; min-height: 39px;
}
.nav-btn { display: flex; align-items: center; gap: var(--s3); width: 100%; padding: 7px var(--s2); font-size: 13px; }
.nav-btn i { width: 19px; flex: none; text-align: center; }
.nav-btn:hover { color: var(--nav-ink); background: var(--nav-hover); }
.nav-btn[aria-current="page"] { color: #fff; background: var(--nav-active); border-color: #b3d2fa32; }
.sidebar :focus-visible { outline-color: #a8ceff; outline-offset: 1px; }
.nav-badge { margin-left: auto; color: #fff; background: #ffffff22; padding: 1px 7px; border-radius: 99px; font-size: 11px; }
.topbar > div { min-width: 0; }
.eyebrow { font-size: 12px; color: var(--accent-ink); letter-spacing: .065em; font-weight: 750; margin-bottom: var(--s1); }
.top-actions, .toolbar-actions, .row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }
.sector-switch { display: flex; gap: var(--s1); padding: var(--s1); border: 1px solid var(--line); border-radius: 11px; background: var(--surface); }
.sector-switch button {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); padding: 5px var(--s3);
  min-height: 34px; border: 0; border-radius: 7px; background: transparent; color: var(--muted);
  font-size: 13px; font-weight: 740;
}
.sector-switch button:hover { background: var(--subtle); color: var(--ink); }
.sector-switch button[aria-pressed="true"] { background: var(--accent); color: #fff; }

.view:not(.active) { display: none; }
.view.active { display: grid; min-width: 0; gap: var(--s4); align-content: start; }
.section-toolbar, .welcome-row, .panel-head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s3);
}
.section-toolbar p, .welcome-row p, .valuation-note, .muted, .report-data-note { color: var(--muted); }
.section-toolbar > *, .panel-head > * { min-width: 0; }
.section-toolbar > div:first-child { flex: 1 1 240px; }
.inventory-actions { justify-content: flex-end; align-items: stretch; }
.notice, .sector-status, #frigobar-status {
  padding: var(--s2) var(--s3); border-radius: var(--r1);
  color: var(--accent-ink); background: var(--accent-soft);
}
.sector-status { margin-bottom: var(--s4); color: var(--positive); background: var(--positive-bg); }
:is(.notice, .sector-status).error { color: var(--danger); background: var(--danger-bg); }
.sector-status:empty, #frigobar-status:empty, #dialog-error:empty, #frigobar-edit-status:empty, #recipe-preview:empty { display: none; }
.btn, .icon-btn, .row-action, .text-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  border: 1px solid var(--control-line); border-radius: var(--r1);
  min-height: var(--control-size); padding: 7px var(--s3); text-align: center;
  font-size: 13px; font-weight: 700; line-height: 1.25; color: var(--ink); background: var(--surface);
}
.btn:hover, .icon-btn:hover, .row-action:hover { background: var(--subtle); }
.btn-primary, .btn-primary:hover { border-color: transparent; color: #fff; background: var(--accent); }
.btn-primary:not(:disabled):hover { background: var(--accent-hover); }
.btn-danger { color: var(--danger); border-color: currentColor; }
.btn-danger:not(:disabled):hover { background: var(--danger-bg); }
.btn-danger-solid, .btn-danger-solid:hover { background: #a82940; color: #fff; border-color: transparent; }
.btn-danger-solid:not(:disabled):hover { background: #8f2037; }
.icon-btn { width: var(--control-size); flex: none; padding: 0; font-size: 15px; }
.text-btn { padding: var(--s1) var(--s2); color: var(--accent-ink); background: transparent; border-color: transparent; }
.text-btn:hover { background: var(--accent-soft); }
.live-pill, .status {
  display: inline-block; width: fit-content; border-radius: 99px; padding: var(--s1) var(--s2);
  background: var(--accent-soft); color: var(--accent-ink); font-size: 11px; font-weight: 750; white-space: nowrap;
}
.status.ok { background: var(--positive-bg); color: var(--positive); }
.status.low, .status.pending { background: var(--warn-bg); color: var(--warn); }

.panel {
  min-width: 0; display: grid; align-content: start; gap: var(--s3);
  padding: var(--s4); background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r2); box-shadow: var(--shadow);
}
.panel-head { min-height: 28px; }
.panel-head h3 { flex: 1 1 145px; overflow-wrap: anywhere; }
.dashboard-grid { min-width: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4); }
.kpi-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--s3); }
#sector-view .kpi-grid, .monthly-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi-card {
  min-width: 0; min-height: 96px; padding: var(--s4);
  border: 1px solid var(--line); border-radius: var(--r2); background: var(--surface); box-shadow: var(--shadow);
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-content: start; align-items: start; gap: var(--s2);
}
.kpi-card > span { align-self: center; color: var(--muted); font-size: 12px; font-weight: 680; }
.kpi-card > b { grid-column: 1 / -1; font-size: 27px; line-height: 1.15; letter-spacing: -.04em; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.kpi-card > i { grid-column: 2; grid-row: 1; padding: 6px; border-radius: 6px; color: var(--accent-ink); background: var(--accent-soft); font-size: 12px; }
.kpi-card.warning > i { color: var(--warn); background: var(--warn-bg); }
.kpi-card small { grid-column: 1 / -1; color: var(--muted); }
.kpi-card b.kpi-money, #month-spend { font-size: clamp(18px, 2vw, 24px); line-height: 1.3; }
.compact-row { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s3); padding: var(--s3) 0; border-bottom: 1px solid var(--line); }
.compact-row:last-child { border-bottom: 0; }
.compact-main { min-width: 0; overflow-wrap: anywhere; }
.compact-main small { display: block; color: var(--muted); }
.compact-value { color: var(--accent-ink); font-variant-numeric: tabular-nums; font-size: 12px; font-weight: 700; text-align: right; }
.compact-value.warn { color: var(--warn); }

.filter-row { display: grid; grid-template-columns: minmax(180px, 2fr) minmax(150px, 1fr); align-items: stretch; gap: var(--s2); }
.inventory-filters { grid-template-columns: minmax(170px, 1.55fr) repeat(3, minmax(128px, 1fr)) auto; }
.filter-row > * { min-width: 0; }
.search-box {
  display: flex; align-items: center; gap: var(--s2); padding: 0 var(--s3);
  border: 1px solid var(--control-line); border-radius: var(--r1); background: var(--surface); color: var(--muted);
}
.search-box input { min-width: 0; width: 100%; border: 0; background: transparent; padding-inline: 0; }
.search-box:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.search-box input:focus-visible { outline: none; }
input, select, textarea {
  width: 100%; max-width: 100%; min-width: 0; min-height: var(--control-size);
  padding: 7px 10px; border: 1px solid var(--control-line); border-radius: var(--r1);
  background: var(--surface); color: var(--ink);
}
input::placeholder, textarea::placeholder { color: var(--muted); }
textarea { resize: vertical; }
input[type="checkbox"] { width: 17px; min-height: 17px; accent-color: var(--accent); vertical-align: middle; margin: 0 var(--s1) 0 0; }
input[type="file"] { padding: var(--s2); }
input[type="file"]::file-selector-button {
  border: 0; padding: var(--s1) var(--s2); margin-right: var(--s2); border-radius: 5px;
  background: var(--accent-soft); color: var(--accent-ink); font: inherit;
}
.field { display: grid; align-content: start; gap: 6px; min-width: 0; font-size: 13px; color: var(--ink); font-weight: 650; }
.field > :is(input, select, textarea) { font-weight: 400; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3) var(--s4); align-items: end; }
.span-all { grid-column: 1 / -1; }

.table-wrap {
  max-width: 100%; max-height: 65dvh; overflow: auto; overscroll-behavior-inline: contain;
  border: 1px solid var(--line); border-radius: var(--r1);
  scrollbar-color: var(--control-line) transparent;
}
table { width: 100%; border-spacing: 0; font-size: 13px; }
thead th {
  position: sticky; top: 0; z-index: 1; background: var(--subtle); text-align: left;
  color: var(--muted); font-size: 12px; font-weight: 750; line-height: 1.25;
}
th, td { padding: 8px var(--s3); vertical-align: middle; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
th { overflow-wrap: normal; }
td small { color: var(--muted); }
tbody tr:last-child > * { border: 0; }
tbody tr:nth-child(even) { background: var(--subtle); }
tbody tr:hover { background: var(--accent-soft); }
tbody th { text-align: left; font-weight: 690; }
table .numeric { text-align: right; font-variant-numeric: tabular-nums; }
td.numeric { white-space: nowrap; }
table .row-action, table .btn { min-height: 34px; padding: 5px var(--s2); white-space: nowrap; }
.row-actions { flex-wrap: nowrap; }
.table-wrap:has(table th:nth-child(4)) table { min-width: 420px; }
.table-wrap:has(table th:nth-child(5)) table { min-width: 560px; }
.table-wrap:has(table th:nth-child(7)) table { min-width: 660px; }
.dashboard-grid .table-wrap:has(table th:nth-child(5)) table { min-width: 480px; }
.table-wrap:has(tbody td.empty-state) table { min-width: 0; }
td.empty-state, .empty-state {
  text-align: center; color: var(--muted); font-size: 13px; background: var(--subtle);
  padding: var(--s6) var(--s4); border-radius: var(--r1);
}

.audit-detail { padding: var(--s4); background: var(--subtle); border-radius: var(--r1); display: grid; gap: var(--s2); }
.audit-detail .table-wrap { background: var(--surface); }
.detail-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s2); }
.detail-head span, .tiny { color: var(--muted); font-size: 12px; }
.row-void { color: var(--danger); }
.consumo-photo { max-inline-size: min(100%, 420px); max-block-size: 360px; object-fit: contain; border-radius: var(--r1); }
.report-data-note { display: block; margin-top: var(--s2); }
.bar-list, .monthly-supplier-list { display: grid; gap: var(--s3); }
.bar-row + .bar-row { margin-top: var(--s3); }
.bar-label { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s2); }
.bar-label b { min-width: 0; overflow-wrap: anywhere; }
.bar-label strong { color: var(--accent-ink); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar-track { height: 7px; margin-top: 5px; background: var(--subtle); border-radius: 99px; }
.bar-track span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.audit-mini-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2); }
.audit-mini-grid > div { display: grid; padding: var(--s2) var(--s3); border-radius: var(--r1); background: var(--subtle); }
.audit-mini-grid b { font-size: 18px; }
.audit-mini-grid span { color: var(--muted); font-size: 12px; }
.monthly-narrative { white-space: pre-line; overflow-wrap: anywhere; }

.sector-dialog {
  width: min(800px, calc(100% - 32px)); max-height: calc(100dvh - 32px);
  padding: 0; border: 1px solid var(--line); border-radius: var(--r2);
  background: var(--surface); color: var(--ink); box-shadow: var(--modal-shadow); overflow: auto;
}
.sector-dialog::backdrop { background: #081424a8; }
.sector-dialog > form { display: flex; flex-direction: column; max-height: calc(100dvh - 34px); }
.modal-head, .form-footer { flex: none; padding: var(--s3) var(--s5); background: var(--surface); }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: var(--s2); border-bottom: 1px solid var(--line); }
.modal-head h3 { overflow-wrap: anywhere; }
.modal-head .icon-btn { font-size: 19px; }
.dialog-content { min-height: 0; padding: var(--s4) var(--s5); overflow: auto; display: grid; gap: var(--s3); }
.dialog-content > .btn, .dialog-content > .toolbar-actions { justify-self: start; }
.dialog-content fieldset { margin: 0; padding: var(--s2) var(--s3); border: 1px solid var(--control-line); border-radius: var(--r1); }
.dialog-content fieldset label { display: inline-flex; align-items: center; margin-right: var(--s4); }
.dialog-content input, .dialog-content select { scroll-margin: 8px; }
.form-footer { display: flex; justify-content: flex-end; border-top: 1px solid var(--line); }
#dialog-error, #frigobar-edit-status {
  flex: none; padding: var(--s2) var(--s5); color: var(--danger); background: var(--danger-bg); overflow-wrap: anywhere;
}
#dialog-error { max-height: 20dvh; overflow: auto; }
.document-line {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1.45fr)) repeat(2, minmax(0, 1fr)) auto;
  align-items: end; gap: var(--s2); padding: var(--s3);
  border: 1px solid var(--line); border-radius: var(--r1); background: var(--subtle);
}
.document-line + .document-line { margin-top: var(--s2); }
.legacy-data { max-height: 46dvh; margin: 0; padding: var(--s3); overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--subtle); border-radius: var(--r1); }
#recipe-preview { padding: var(--s3); background: var(--accent-soft); border-radius: var(--r1); }
#frigobar-panel { margin-top: var(--s4); scroll-margin-top: var(--s4); }
#frigobar-panel .panel-head { align-items: center; }
#frigobar-login { grid-template-columns: repeat(2, minmax(0, 1fr)) auto; }
#frigobar-list { display: grid; gap: var(--s3); }
#frigobar-edit { width: min(455px, calc(100% - 32px)); }

@media (max-width: 1240px) {
  .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .inventory-filters { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .inventory-filters .search-box { grid-column: 1 / -1; }
}
@media (max-width: 1060px) {
  .inventory-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .inventory-actions:has(> :last-child:nth-child(3)) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; }
  #sector-view .kpi-grid, .monthly-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  :root { --page-padding: 16px; }
  .brand-lockup { padding: 0; }
  .nav-toggle { display: inline-flex !important; margin-left: auto; color: var(--nav-ink); background: var(--nav-hover); border-color: #d5e5fb55; }
  .nav-toggle:hover { background: var(--nav-active); }
  .nav-list { display: none; grid-template-columns: repeat(2, minmax(0, 1fr)); padding-bottom: var(--s2); }
  .nav-list.is-open { display: grid; }
  #frigobar-login { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #frigobar-login button { justify-self: start; }
}
@media (max-width: 560px) {
  :root { --s8: 24px; }
  .topbar { align-items: flex-start; }
  .top-actions { width: 100%; justify-content: space-between; }
  .panel { padding: var(--s3); }
  .section-toolbar > div:first-child { flex-basis: 100%; }
  .section-toolbar > .field, .monthly-actions { width: 100%; }
  .filter-row { grid-template-columns: minmax(0, 1fr); }
  .inventory-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inventory-actions:has(> :last-child:nth-child(3)) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inventory-actions:has(> :last-child:nth-child(3)) > :first-child { grid-column: 1 / -1; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #dashboard-kpis .kpi-card:first-child { grid-column: 1 / -1; }
  .kpi-card { padding: var(--s3); min-height: 88px; }
  .kpi-card b { font-size: 24px; }
  .kpi-card > i { display: none; }
  .table-wrap:has(tbody td.empty-state) thead { display: none; }
  .sector-dialog { width: calc(100% - 20px); max-height: calc(100dvh - 20px); }
  .sector-dialog > form { max-height: calc(100dvh - 22px); }
  .modal-head, .dialog-content, .form-footer { padding-inline: var(--s3); }
  .form-grid, #frigobar-login { grid-template-columns: minmax(0, 1fr); }
  .document-line { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .document-line > :first-child { grid-column: 1 / -1; }
  .document-line > button { justify-self: start; }
  table .btn, table .row-action { min-height: 39px; }
}

.org-brand-icon, .org-choice-icon {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  color: #fff;
  background: var(--accent);
}
.brand-lockup > div { min-width: 0; overflow-wrap: anywhere; }

.organization-portal {
  padding: clamp(24px, 4vw, 52px) var(--page-padding);
}
.portal-wrap {
  width: min(100%, 720px);
  margin-inline: auto;
  display: grid;
  align-content: start;
  gap: var(--s4);
}
.portal-wrap.is-compact { width: min(100%, 460px); }
.portal-header { display: flex; align-items: center; gap: var(--s3); }
.portal-header img { flex: none; }
.portal-header h1:focus { outline: 0; }
.portal-help { color: var(--muted); overflow-wrap: anywhere; }
.portal-wrap .portal-form { gap: var(--s4); }
.portal-form h2, .portal-wrap section h2 { font-size: 18px; }
.portal-actions { align-items: stretch; }
.portal-wrap code { overflow-wrap: anywhere; }
.org-choices { display: grid; gap: var(--s2); }
.org-choices:empty { display: none; }
.org-choice {
  width: 100%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--s3);
  padding: var(--s4);
  border: 1px solid var(--line);
  border-radius: var(--r2);
  color: var(--ink);
  background: var(--surface);
  text-align: left;
}
.org-choice:hover { border-color: var(--accent-ink); background: var(--accent-soft); }
.org-choice strong, .org-choice small, .portal-list small { display: block; overflow-wrap: anywhere; }
.org-choice small, .portal-list small, .portal-list time { color: var(--muted); }
.account-ident summary { font-weight: 700; cursor: pointer; }
.account-ident p:first-of-type { margin: var(--s2) 0; }
.portal-list { list-style: none; padding: 0; margin: 0; }
.portal-list:empty { display: none; }
.portal-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--s2);
  border-top: 1px solid var(--line);
  padding: var(--s2) 0;
}
.portal-list li > div { min-width: 0; }
.portal-list time { font-size: 12px; }
@media (max-width: 790px) {
}

/* Workspace navigation and review surfaces */
:root { scrollbar-width: thin; scrollbar-color: var(--control-line) transparent; }
.nav-list, .table-wrap, .dialog-content, .sector-dialog { scrollbar-width: thin; }
.sidebar { gap: var(--s3); border-right: 1px solid var(--line); }
.nav-list { gap: 8px; align-content: start; }
.nav-group { display: grid; gap: 2px; min-width: 0; }
.nav-group > p {
  padding: 4px 8px 2px;
  color: var(--nav-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
}
.nav-btn { gap: 9px; min-height: 35px; padding-block: 5px; }
.nav-btn > span { min-width: 0; overflow-wrap: anywhere; }
.nav-btn[aria-current="page"] { border-color: color-mix(in srgb, var(--org-color, #85baca) 55%, transparent); }
.btn, .icon-btn, .nav-btn, .settings-tabs button {
  transition: background-color var(--motion-control), border-color var(--motion-control), color var(--motion-control);
}
.portal-wrap:has(.settings-actions) { width: min(100%, 1020px); }
.portal-wizard { padding: clamp(16px, 3vw, 28px); }
.portal-wizard [data-org-step] { display: grid; gap: var(--s3); }
.wizard-progress {
  display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: var(--s2);
  margin: 0; padding: 0; list-style: none;
}
.wizard-progress li {
  min-width: 0; padding: 7px 2px; border-bottom: 2px solid var(--line);
  color: var(--muted); font-size: 13px; text-align: center;
}
.wizard-progress [aria-current="step"] { border-color: var(--accent-ink); color: var(--accent-ink); font-weight: 750; }
.module-list {
  display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: var(--s2);
  margin: var(--s2) 0 0; padding: 0; list-style: none;
}
.module-list li {
  display: grid; align-content: start; gap: 2px; padding: var(--s3);
  border: 1px solid var(--line); border-radius: var(--r1); background: var(--subtle);
}
.module-list span { color: var(--muted); font-size: 13px; }
.settings-actions {
  position: sticky; top: 0; z-index: 3;
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center;
  gap: var(--s2); background: var(--canvas); padding-block: var(--s2);
}
.settings-tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.settings-tabs button {
  min-height: 38px; border: 1px solid var(--line); border-radius: var(--r1);
  background: var(--surface); color: var(--muted); padding: 5px 12px; font-weight: 700;
}
.settings-tabs button:hover { color: var(--ink); background: var(--subtle); }
.settings-tabs [aria-selected="true"] { color: var(--accent-ink); background: var(--accent-soft); border-color: var(--control-line); }
.access-layout { display: grid; gap: var(--s3); grid-template-columns: repeat(2,minmax(0,1fr)); align-items: start; }
.access-layout code { overflow-wrap: anywhere; }
.access-layout section { min-width: 0; }
:where(#settings-access,#settings-audit) .portal-list { max-height: 58dvh; overflow: auto; scrollbar-width: thin; }
.form-footer { box-shadow: 0 -8px 22px #080a0c14; }
#dialog-error:empty { display: none; }
table :is(th,td) { padding-block: 8px; }
table .btn { min-height: 32px; }
table tbody tr:hover > td { background: color-mix(in srgb, var(--accent-soft) 32%, var(--surface)); }
.input-search, .inventory-actions { min-width: 0; }

.sector-dialog[data-layout="invoice"] { width: min(1120px, calc(100% - 32px)); }
.invoice-upload { padding: var(--s2); display: grid; gap: var(--s3); }
.invoice-upload > i, .invoice-note { color: var(--accent-ink); }
.invoice-upload > i { font-size: 22px; }
.invoice-upload p, .invoice-summary small { color: var(--muted); }
.invoice-summary, .invoice-lines-head, .invoice-line-head {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--s2);
}
.invoice-summary > div { min-width: 0; display: grid; overflow-wrap: anywhere; }
.invoice-summary .btn { text-decoration: none; }
.invoice-layout { display: grid; grid-template-columns: minmax(285px, .85fr) minmax(0,1.35fr); gap: var(--s3); align-items: start; }
.invoice-document, .invoice-fields, #invoice-new-supplier, #invoice-lines, .invoice-record {
  display: grid; gap: var(--s2); min-width: 0;
}
.invoice-card { background: var(--subtle); border: 1px solid var(--line); border-radius: var(--r1); padding: var(--s3); }
.invoice-card > summary { cursor: pointer; font-weight: 750; }
.invoice-card[open] > summary { margin-bottom: var(--s3); }
.invoice-lines { display: grid; gap: var(--s2); }
.invoice-line {
  min-width: 0; display: grid; gap: var(--s2); background: var(--surface);
  padding: var(--s3); border: 1px solid var(--line); border-radius: var(--r1);
}
.invoice-line-head strong { min-width: 0; overflow-wrap: anywhere; }
.invoice-pair, .invoice-amounts { display: grid; align-items: end; grid-template-columns: repeat(2,minmax(0,1fr)); gap: var(--s2); }
.invoice-amounts { grid-template-columns: repeat(3,minmax(0,1fr)); }
.invoice-note { font-size: 12px; overflow-wrap: anywhere; }
.invoice-note:empty { display: none; }
.invoice-original { display: block; max-width: 100%; max-height: 280px; object-fit: contain; }
.sector-dialog[data-layout="invoice"] .form-footer { flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2); }
.invoice-confirm { display: flex; gap: var(--s2); align-items: center; }
.invoice-confirm input { margin: 0; inline-size: 18px; block-size: 18px; flex: none; }
.invoice-record { grid-template-columns: repeat(auto-fit,minmax(150px,1fr)); border-top: 1px solid var(--line); padding-top: var(--s2); }
.invoice-record span { display: grid; }

@media (hover: hover) {
  :is(.nav-list,.table-wrap,.dialog-content):not(:hover,:focus-within) { scrollbar-color: transparent transparent; }
}
@media (max-width: 900px) {
  .nav-group { display: contents; }
  .nav-group > p { grid-column: 1 / -1; }
  .nav-btn { min-height: 38px; }
}
@media (max-width: 720px) {
  .invoice-layout, .access-layout { grid-template-columns: minmax(0,1fr); }
}
@media (max-width: 520px) {
  .settings-tabs { width: 100%; }
  .settings-tabs button { flex: 1 1 auto; min-width: 0; padding-inline: 7px; }
  .module-list { grid-template-columns: minmax(0,1fr); }
  .wizard-progress li { font-size: 12px; }
  .invoice-amounts { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .invoice-amounts > :last-child { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: no-preference) {
  [role="tabpanel"]:not([hidden]), [data-org-step]:not([hidden]) { animation: panel-in .16s ease-out; }
  @keyframes panel-in { from { opacity: .6; } to { opacity: 1; } }
}
@media (prefers-reduced-motion: reduce) {
  .btn,.icon-btn,.nav-btn,.settings-tabs button { transition: none; }
}
