/* smallbuss — interface styles.
   Layout from the agreed mockups in docs/design/screens, look of the Linka brand
   (docs/design/brand-redesign). Colours, typography and shapes come from tokens.css,
   which the MudTheme mirrors. */

@import url('tokens.css');

/* ─────────────────────────── Base ─────────────────────────── */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--sb-bg);
  color: var(--sb-text);
  font-family: var(--sb-font-ui);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
svg { display: block; }
.num { font-family: var(--sb-font-num); font-variant-numeric: tabular-nums; }
.muted { color: var(--sb-text-muted); }
.faint { color: var(--sb-text-faint); }

/* ─────────────────────────── Logo ─────────────────────────── */
.logo { display: flex; align-items: center; gap: 10px; }
.logo-mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--sb-primary); color: #fff;
  display: grid; place-items: center; flex: none;
}
.logo-mark svg { width: 21px; height: 21px; }
.logo-text { font-family: var(--sb-font-brand); font-weight: 600; font-size: 18px; letter-spacing: -.01em; }
.logo-text small { display: block; font-size: 10px; font-weight: 400; letter-spacing: .08em;
  text-transform: uppercase; color: var(--sb-text-faint); margin-top: -2px; }

/* ─────────────────────────── Shell ─────────────────────────── */
.shell { display: grid; grid-template-columns: var(--sb-sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
  background: var(--sb-sidebar);
  border-right: 1px solid var(--sb-border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar-head { height: var(--sb-topbar-h); display: flex; align-items: center; padding: 0 20px; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 12px 20px; }
.nav-section {
  font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--sb-text-faint); font-weight: 500; padding: 18px 12px 8px;
}
/* A section heading folds its items away; the chevron points down while folded */
button.nav-section {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  background: none; border: 0; font-family: inherit; text-align: left; cursor: pointer;
}
button.nav-section:hover { color: var(--sb-text-muted); }
.nav-chevron { width: 12px; height: 12px; flex: none; transform: rotate(180deg); transition: transform .18s ease; }
.nav-group.collapsed .nav-chevron { transform: none; }
.nav-group.collapsed .nav-item { display: none; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; border-radius: var(--sb-radius-sm);
  color: var(--sb-text); font-size: 14px; font-weight: 400;
  margin-bottom: 2px; cursor: pointer;
}
.nav-item svg { width: 18px; height: 18px; flex: none; color: var(--sb-text-muted); }
.nav-item:hover { background: rgba(23,21,15,.045); }
.nav-item.active { background: var(--sb-surface); color: var(--sb-primary); font-weight: 500; box-shadow: var(--sb-shadow-sm); }
.nav-item.active svg { color: var(--sb-primary); }
.nav-item .nav-count {
  margin-left: auto; font-family: var(--sb-font-num); font-size: 11px;
  background: var(--sb-primary-soft); color: var(--sb-primary);
  padding: 1px 7px; border-radius: var(--sb-radius-pill);
}
.nav-note {
  margin: 4px 12px; padding: 10px 12px; border: 1px dashed var(--sb-border-strong);
  border-radius: var(--sb-radius-sm); color: var(--sb-text-faint); font-size: 12px;
}
.sidebar-foot { border-top: 1px solid var(--sb-border); padding: 12px; }

/* ─────────────────────────── Topbar ─────────────────────────── */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: var(--sb-topbar-h); background: var(--sb-surface);
  border-bottom: 1px solid var(--sb-border);
  display: flex; align-items: center; gap: 16px; padding: 0 24px;
  position: sticky; top: 0; z-index: 20;
}
.topsearch {
  flex: 1; max-width: 460px; display: flex; align-items: center; gap: 10px;
  background: var(--sb-surface-alt); border: 1px solid var(--sb-border);
  border-radius: var(--sb-radius-pill); padding: 8px 14px; color: var(--sb-text-faint);
}
.topsearch svg { width: 16px; height: 16px; }
.topsearch input {
  border: 0; background: transparent; outline: 0; font: inherit;
  color: var(--sb-text); width: 100%;
}
.topsearch kbd {
  font-family: var(--sb-font-num); font-size: 11px; color: var(--sb-text-faint);
  border: 1px solid var(--sb-border-strong); border-radius: 5px; padding: 1px 5px;
}
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.environment-badge {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  padding: 4px 9px;
  border: 1px solid currentColor;
  border-radius: 999px;
  background: var(--sb-warning-soft);
  color: #7D4E09;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}

.environment-badge-short { display: none; }
@media (max-width: 600px) {
  .environment-badge-full { display: none; }
  .environment-badge-short { display: inline; }
}
.icon-btn {
  width: 36px; height: 36px; border-radius: var(--sb-radius-sm); border: 0; background: transparent;
  display: grid; place-items: center; color: var(--sb-text-muted); cursor: pointer; position: relative;
}
.icon-btn:hover { background: var(--sb-neutral-soft); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn .dot {
  position: absolute; top: 7px; right: 8px; width: 7px; height: 7px;
  border-radius: 50%; background: var(--sb-danger); border: 2px solid var(--sb-surface);
}

/* Organisation (tenant) switcher — top right */
.tenant {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--sb-border); border-radius: var(--sb-radius-pill);
  padding: 5px 12px 5px 6px; background: var(--sb-surface); cursor: pointer;
}
.tenant:hover { border-color: var(--sb-border-strong); }
.tenant-avatar {
  width: 28px; height: 28px; border-radius: 50%; flex: none;
  background: #17150F; color: #fff; display: grid; place-items: center;
  font-family: var(--sb-font-brand); font-weight: 600; font-size: 11px; letter-spacing: -.02em;
}
.tenant-name { font-weight: 500; font-size: 13px; line-height: 1.15; }
.tenant-role { font-size: 11px; color: var(--sb-text-faint); line-height: 1.15; }
.tenant svg { width: 14px; height: 14px; color: var(--sb-text-faint); }
.divider-v { width: 1px; height: 26px; background: var(--sb-border); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--sb-primary-soft);
  color: var(--sb-primary); display: grid; place-items: center;
  font-weight: 600; font-size: 12px; border: 1px solid var(--sb-border);
}

/* ─────────────────────────── Page ─────────────────────────── */
.page { padding: 28px 32px 56px; max-width: 1560px; width: 100%; }
.page-head { display: flex; align-items: flex-start; gap: 20px; flex-wrap: wrap; margin-bottom: 24px; }
.page-title { font-family: var(--sb-font-brand); font-size: 28px; font-weight: 600; letter-spacing: -.02em; margin: 0; }
.page-sub { color: var(--sb-text-muted); margin: 4px 0 0; font-size: 14px; }
.page-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.breadcrumb { display: flex; gap: 8px; align-items: center; color: var(--sb-text-faint); font-size: 12.5px; margin-bottom: 8px; }

/* Bar with the decisive action of a form screen; it stays in sight while the page scrolls */
.actionbar {
  position: sticky; bottom: 14px; z-index: 18; margin-top: 20px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 12px 16px; border: 1px solid var(--sb-border);
  border-radius: var(--sb-radius); background: var(--sb-surface);
  box-shadow: var(--sb-shadow-lg);
}
.actionbar .ab-lab { color: var(--sb-text-muted); font-size: 12.5px; }
.actionbar .ab-val { font-family: var(--sb-font-brand); font-size: 20px; font-weight: 600; }
.actionbar .ab-actions { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }

/* ─────────────────────────── Buttons ─────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  border-radius: var(--sb-radius-sm); border: 1px solid var(--sb-border);
  background: var(--sb-surface); color: var(--sb-text);
  padding: 0 16px; min-height: 40px; font: inherit; font-weight: 500; font-size: 13.5px;
  box-shadow: var(--sb-shadow-sm); white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { border-color: var(--sb-border-strong); background: var(--sb-surface-alt); }
.btn-primary { background: var(--sb-primary); border-color: var(--sb-primary); color: var(--sb-primary-text); }
.btn-primary:hover { background: var(--sb-primary-hover); border-color: var(--sb-primary-hover); }
.btn-primary svg { color: var(--sb-signal); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--sb-text-muted); }
.btn-ghost:not(.btn-block) { padding: 0 12px; }
.btn-ghost:hover { background: var(--sb-neutral-soft); }
.btn-block { width: 100%; justify-content: center; min-height: 46px; font-size: 15px; }
.btn[disabled], .btn.is-disabled { opacity: .5; pointer-events: none; }

/* ─────────────────────────── Karty ─────────────────────────── */
.card {
  background: var(--sb-surface); border: 1px solid var(--sb-border);
  border-radius: var(--sb-radius-lg); box-shadow: var(--sb-shadow-sm);
}
.card-head { display: flex; align-items: center; gap: 14px; padding: 18px 20px; border-bottom: 1px solid var(--sb-border); }
.card-title { font-family: var(--sb-font-brand); font-size: 16px; font-weight: 600; margin: 0; }
.card-sub { font-size: 12.5px; color: var(--sb-text-muted); margin: 2px 0 0; }
.card-head .spacer { margin-left: auto; }
.card-body { padding: 20px; }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--sb-border); display: flex; align-items: center; gap: 12px; }

/* Statistic tiles */
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat {
  background: var(--sb-surface); border: 1px solid var(--sb-border);
  border-radius: var(--sb-radius-lg); padding: 18px 20px; box-shadow: var(--sb-shadow-sm);
  cursor: pointer;
}
.stat:hover { border-color: var(--sb-border-strong); }
.stat.is-selected { border-color: var(--sb-primary); box-shadow: 0 0 0 1px var(--sb-primary); }
.stat-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.stat-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; }
.stat-ico svg { width: 17px; height: 17px; }
.stat-value { font-family: var(--sb-font-num); font-size: 26px; font-weight: 600; letter-spacing: -.02em; }
.stat-label { color: var(--sb-text-muted); font-size: 13px; margin-top: 2px; }
.stat-meta { font-size: 12px; color: var(--sb-text-faint); margin-top: 10px; }

/* ─────────────────────────── Chipy / stavy ─────────────────────────── */
.chip {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  padding: 3px 10px; border-radius: var(--sb-radius-pill);
  font-size: 12px; font-weight: 500; background: var(--sb-neutral-soft); color: var(--sb-text-muted);
}
.chip::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip-new        { background: var(--sb-info-soft);    color: var(--sb-info); }
.chip-confirmed  { background: var(--sb-primary-soft); color: var(--sb-primary); }
.chip-ready      { background: var(--sb-warning-soft); color: var(--sb-warning); }
.chip-completed  { background: var(--sb-success-soft); color: var(--sb-success); }
.chip-cancelled  { background: var(--sb-neutral-soft); color: var(--sb-text-faint); }
.chip-paid       { background: var(--sb-success-soft); color: var(--sb-success); }
.chip-unpaid     { background: var(--sb-danger-soft);  color: var(--sb-danger); }
.chip-manual     { background: var(--sb-neutral-soft); color: var(--sb-text-muted); }
.chip-eshop      { background: var(--sb-info-soft);    color: var(--sb-info); }
.chip-plain::before { display: none; }

/* ─────────────────────────── Filtre ─────────────────────────── */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 16px 20px; border-bottom: 1px solid var(--sb-border); }
.field-search {
  display: flex; align-items: center; gap: 9px; min-width: 280px;
  border: 1px solid var(--sb-border); border-radius: var(--sb-radius-sm);
  padding: 8px 12px; background: var(--sb-surface-alt); color: var(--sb-text-faint);
}
.field-search svg { width: 16px; height: 16px; }
.field-search input { border: 0; outline: 0; background: transparent; font: inherit; color: var(--sb-text); width: 100%; }
.select {
  appearance: none; font: inherit; font-size: 13.5px; color: var(--sb-text);
  border: 1px solid var(--sb-border); border-radius: var(--sb-radius-sm);
  background: var(--sb-surface) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' stroke='%237C7468' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M3 5l4 4 4-4'/></svg>") no-repeat right 10px center;
  padding: 9px 32px 9px 12px; cursor: pointer;
}
.seg { display: inline-flex; background: var(--sb-surface-alt); border: 1px solid var(--sb-border); border-radius: var(--sb-radius-sm); padding: 3px; gap: 2px; }
.seg button {
  border: 0; background: transparent; font: inherit; font-size: 13px; color: var(--sb-text-muted);
  padding: 6px 12px; border-radius: 6px; cursor: pointer;
}
.seg button.active { background: var(--sb-surface); color: var(--sb-text); font-weight: 500; box-shadow: var(--sb-shadow-sm); }

/* ─────────────────────────── Table ─────────────────────────── */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl thead th {
  text-align: left; font-size: 11px; letter-spacing: .07em; text-transform: uppercase;
  color: var(--sb-text-faint); font-weight: 500; padding: 12px 16px;
  border-bottom: 1px solid var(--sb-border); white-space: nowrap; background: var(--sb-surface-alt);
}
.tbl tbody td { padding: 14px 16px; border-bottom: 1px solid var(--sb-border); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: var(--sb-surface-alt); }
.tbl .t-right { text-align: right; }
/* Sortable header: the whole title is a button, the arrow shows the direction of the active column */
.tbl thead th[aria-sort] { padding: 0; }
.th-sort {
  display: inline-flex; align-items: center; gap: 4px; width: 100%; padding: 12px 16px;
  border: 0; background: transparent; cursor: pointer;
  font: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit;
}
.t-right > .th-sort { justify-content: flex-end; }
.th-sort:hover, .th-sort.is-active { color: var(--sb-text); }
.th-sort:focus-visible { outline: 2px solid var(--sb-primary); outline-offset: -2px; }
.th-sort svg { width: 12px; height: 12px; flex: none; opacity: .3; transition: transform .15s; }
.th-sort.is-active svg { opacity: 1; }
.th-sort.is-asc svg { transform: rotate(180deg); }
/* Row of column filters right under the headers */
.tbl thead tr.tbl-filters th { padding: 8px 6px; text-transform: none; letter-spacing: 0; background: var(--sb-surface); }
.col-filter {
  width: 100%; min-width: 0; font: inherit; font-size: 13px; color: var(--sb-text);
  border: 1px solid var(--sb-border); border-radius: 6px; background: var(--sb-surface); padding: 6px 8px;
}
.col-filter:focus { outline: 0; border-color: var(--sb-primary); box-shadow: 0 0 0 3px var(--sb-primary-soft); }
.col-filter-short { max-width: 90px; }
.col-range { display: flex; gap: 4px; min-width: 120px; }
.col-range-dates { min-width: 250px; }
.col-stack { display: flex; flex-direction: column; gap: 4px; min-width: 130px; }
.filter-count {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--sb-primary-soft); color: var(--sb-primary); font-size: 11px; font-weight: 600;
}
/* An open order past its due day */
.due-overdue { color: var(--sb-danger); font-weight: 600; }
/* Piece count of the order; read at a glance when choosing the box */
.pieces {
  display: inline-block; min-width: 32px; padding: 3px 9px; border-radius: 999px; text-align: center;
  font-family: var(--sb-font-num); font-weight: 600; background: var(--sb-surface-alt); border: 1px solid var(--sb-border);
}
.cell-strong { font-weight: 500; }
.cell-sub { font-size: 12px; color: var(--sb-text-faint); margin-top: 2px; }
.order-no { font-family: var(--sb-font-num); font-weight: 600; color: var(--sb-primary); }
.amount { font-family: var(--sb-font-num); font-weight: 600; }
.cust { display: flex; align-items: center; gap: 12px; }
.cust-avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-size: 12px; font-weight: 600; background: var(--sb-primary-soft); color: var(--sb-primary);
}
.badge-kind {
  font-size: 11px; padding: 2px 7px; border-radius: 6px;
  background: var(--sb-neutral-soft); color: var(--sb-text-muted);
}
/* Paging */
.pager { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.pager button {
  min-width: 32px; height: 32px; border-radius: 7px; border: 1px solid var(--sb-border);
  background: var(--sb-surface); font: inherit; font-size: 13px; color: var(--sb-text-muted); cursor: pointer;
}
.pager button.active { background: var(--sb-primary); border-color: var(--sb-primary); color: #fff; font-weight: 500; }

/* ─────────────────────────── Forms ─────────────────────────── */
.form-grid { display: grid; gap: 18px; }
.field label, .field .lbl { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; }
.field .hint { font-size: 12px; color: var(--sb-text-faint); margin-top: 6px; }
.field .err { font-size: 12px; color: var(--sb-danger); margin-top: 6px; display: flex; gap: 6px; align-items: center; }
.field .err svg { width: 14px; height: 14px; }
.input {
  display: flex; align-items: center; gap: 10px; width: 100%;
  border: 1px solid var(--sb-border-strong); border-radius: var(--sb-radius-sm);
  background: var(--sb-surface); padding: 11px 13px; color: var(--sb-text-faint);
}
.input svg { width: 17px; height: 17px; flex: none; }
.input input { border: 0; outline: 0; background: transparent; font: inherit; color: var(--sb-text); width: 100%; }
.input.focused { border-color: var(--sb-primary); box-shadow: 0 0 0 3px var(--sb-primary-soft); }
.input.invalid { border-color: var(--sb-danger); }
.input .prefix { color: var(--sb-text-faint); font-family: var(--sb-font-num); font-size: 13px; }
.input .suffix { margin-left: auto; color: var(--sb-text-faint); }
.check-row { display: flex; align-items: center; gap: 9px; font-size: 13.5px; }

/* ─────────────────────────── Account screens ─────────────────────────── */
.auth {
  min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr;
}
.auth-aside {
  background: linear-gradient(170deg, var(--sb-sidebar) 0%, var(--sb-primary-soft) 100%);
  padding: 48px; display: flex; flex-direction: column; gap: 28px; position: relative; overflow: hidden;
}
.auth-aside .claim { font-family: var(--sb-font-brand); font-size: 32px; font-weight: 600; letter-spacing: -.02em; max-width: 14ch; line-height: 1.15; }
.auth-aside .claim-sub { color: var(--sb-text-muted); max-width: 40ch; margin-top: 10px; }
.auth-scene { margin: auto 0; width: 100%; }
.auth-main { display: flex; flex-direction: column; padding: 40px 48px; background: var(--sb-bg); }
.auth-lang { align-self: flex-end; padding: 2px; }
.auth-lang button { padding: 4px 11px; font-size: 12px; font-weight: 500; letter-spacing: .04em; }
.auth-card {
  width: 100%; max-width: 420px; margin: auto;
  background: var(--sb-surface); border: 1px solid var(--sb-border);
  border-radius: var(--sb-radius-lg); box-shadow: var(--sb-shadow); padding: 32px;
}
.auth-card > .environment-badge { margin-bottom: 16px; }
.auth-card > .environment-badge .environment-badge-full { display: inline; }
.auth-card > .environment-badge .environment-badge-short { display: none; }
.auth-card h1 { font-family: var(--sb-font-brand); font-size: 24px; font-weight: 600; margin: 0 0 6px; letter-spacing: -.02em; }
.auth-card .lead { color: var(--sb-text-muted); margin: 0 0 24px; }
.auth-foot { text-align: center; color: var(--sb-text-muted); font-size: 13.5px; margin-top: 20px; }
.auth-foot a { color: var(--sb-primary); font-weight: 500; }

/* Stepper */
.stepper { display: flex; align-items: center; gap: 10px; margin-bottom: 26px; }
.step { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--sb-text-faint); }
.step .bullet {
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid var(--sb-border-strong); font-size: 11px; font-family: var(--sb-font-num);
}
.step.done .bullet { background: var(--sb-success-soft); border-color: var(--sb-success); color: var(--sb-success); }
.step.active { color: var(--sb-text); font-weight: 500; }
.step.active .bullet { background: var(--sb-primary); border-color: var(--sb-primary); color: #fff; }
.step-line { flex: 1; height: 1px; background: var(--sb-border-strong); }


/* ─────────────────────────── Responsive ─────────────────────────── */
@media (max-width: 1180px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .auth { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .page { padding: 20px 16px 48px; }
}

/* ═══════════════ Additional components (screen batch 2) ═══════════════ */

/* Two-column layout of a detail screen */
.detail-grid { display: grid; grid-template-columns: minmax(0,1fr) 360px; gap: 20px; align-items: start; }
.stack { display: grid; gap: 20px; align-content: start; }
.detail-grid > *, .stack > * { min-width: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; }
@media (max-width: 1240px) { .detail-grid { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--sb-border); padding: 0 20px; }
.tabs button {
  border: 0; background: transparent; font: inherit; font-size: 13.5px; color: var(--sb-text-muted);
  padding: 13px 12px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs button.active { color: var(--sb-primary); font-weight: 500; border-bottom-color: var(--sb-primary); }

/* Data list */
.kv { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; }
.kv-row { display: flex; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--sb-border); font-size: 13.5px; }
.kv-row:last-child { border-bottom: 0; }
.kv-row dt { color: var(--sb-text-muted); min-width: 148px; margin: 0; }
.kv-row dd { margin: 0; flex: 1; min-width: 0; overflow-wrap: anywhere; }

/* Price breakdown */
.sum-row { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; font-size: 13.5px; }
.sum-row.total {
  border-top: 1px solid var(--sb-border-strong); margin-top: 8px; padding-top: 14px;
  font-size: 16px; font-weight: 600; font-family: var(--sb-font-brand);
}
.sum-row .num { font-family: var(--sb-font-num); }

/* Timeline of states */
.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ''; position: absolute; left: 8px; top: 6px; bottom: 6px; width: 2px; background: var(--sb-border); }
.tl-item { position: relative; padding: 0 0 18px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: ''; position: absolute; left: -22px; top: 4px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--sb-surface); border: 2px solid var(--sb-border-strong);
}
.tl-item.done::before { background: var(--sb-success); border-color: var(--sb-success); }
.tl-item.current::before { background: var(--sb-primary); border-color: var(--sb-primary); box-shadow: 0 0 0 4px var(--sb-primary-soft); }
.tl-title { font-size: 13.5px; font-weight: 500; }
.tl-meta { font-size: 12px; color: var(--sb-text-faint); }

/* Notice banner */
.banner {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px;
  border-radius: var(--sb-radius); font-size: 13.5px; border: 1px solid transparent;
}
.banner svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.banner-info    { background: var(--sb-info-soft);    color: #204A6E; border-color: #CFE0EE; }
.banner-warning { background: var(--sb-warning-soft); color: #7D4E09; border-color: #EEDCB7; }
.banner-success { background: var(--sb-success-soft); color: #23603F; border-color: #C9E3D5; }
.banner-neutral { background: var(--sb-surface-alt);  color: var(--sb-text-muted); border-color: var(--sb-border); }
.banner strong { display: block; margin-bottom: 2px; color: inherit; }

/* Switch */
.switch { width: 38px; height: 22px; border-radius: 999px; background: var(--sb-border-strong); position: relative; flex: none; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--sb-shadow-sm); }
.switch.on { background: var(--sb-primary); }
.switch.on::after { left: 19px; }

/* Choice card (delivery method, item kind) */
.radio-card {
  display: flex; gap: 12px; align-items: flex-start; padding: 13px 14px; cursor: pointer;
  border: 1px solid var(--sb-border); border-radius: var(--sb-radius); background: var(--sb-surface);
}
.radio-card:hover { border-color: var(--sb-border-strong); }
/* A choice card inside a form field keeps its row, not the block of an ordinary field label */
.field label.radio-card { display: flex; margin-bottom: 0; font-weight: 400; }
.radio-card.selected { border-color: var(--sb-primary); background: var(--sb-primary-soft); }
/* The mark reads as a real radio button: an empty ring, filled in the chosen card.
   The size is fixed on every side, so no layout may squeeze it into an ellipse. */
.radio-dot {
  width: 17px; height: 17px; min-width: 17px; min-height: 17px; flex: 0 0 17px;
  box-sizing: border-box; border-radius: 50%; border: 1.5px solid var(--sb-border-strong);
  background: #fff; margin-top: 1px; position: relative; display: block;
}
.radio-card.selected .radio-dot { border-color: var(--sb-primary); }
.radio-card.selected .radio-dot::after {
  content: ''; position: absolute; inset: 3px; border-radius: 50%; background: var(--sb-primary);
}
.radio-card .t { font-size: 13.5px; font-weight: 500; }
.radio-card .s { font-size: 12px; color: var(--sb-text-muted); }

/* Code / token */
.codebox {
  display: flex; align-items: center; gap: 10px; background: var(--sb-ink); color: #F0EDE8;
  border-radius: var(--sb-radius-sm); padding: 12px 14px; font-family: var(--sb-font-num);
  font-size: 12.5px; word-break: break-all;
}
.codebox button { margin-left: auto; flex: none; }

/* Dialog */
.dialog-demo { position: relative; background: rgba(23,21,15,.28); border-radius: var(--sb-radius-lg); padding: 40px 20px; }
.dialog {
  max-width: 480px; margin: 0 auto; background: var(--sb-surface); border-radius: var(--sb-radius-lg);
  box-shadow: var(--sb-shadow-lg); overflow: hidden;
}

/* Product thumbnail */
.thumb {
  width: 42px; height: 42px; border-radius: 10px; flex: none; display: grid; place-items: center;
  background: var(--sb-primary-soft); color: var(--sb-primary);
}
.thumb svg { width: 20px; height: 20px; }
.thumb-lg { width: 100%; aspect-ratio: 4/3; border-radius: var(--sb-radius); background: var(--sb-surface-alt);
  border: 1px dashed var(--sb-border-strong); display: grid; place-items: center; color: var(--sb-text-faint); }

/* Bar of state actions */
.actionbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 14px 20px; background: var(--sb-surface-alt); border-bottom: 1px solid var(--sb-border);
}
.actionbar .spacer { margin-left: auto; }

/* Small table without a frame */
.tbl-compact thead th { background: transparent; }
.tbl-compact tbody td { padding: 11px 16px; }

/* Quick actions on the dashboard */
.quick {
  display: flex; align-items: center; gap: 14px; padding: 16px 18px; background: var(--sb-surface);
  border: 1px solid var(--sb-border); border-radius: var(--sb-radius-lg); box-shadow: var(--sb-shadow-sm); cursor: pointer;
}
.quick:hover { border-color: var(--sb-primary); }
.quick .next-ico, .quick .qi {
  width: 38px; height: 38px; border-radius: 11px; background: var(--sb-primary-soft); color: var(--sb-primary);
  display: grid; place-items: center; flex: none;
}
.quick .qi svg { width: 18px; height: 18px; }
.quick .t { display: block; font-weight: 500; font-size: 14px; }
.quick .s { display: block; font-size: 12px; color: var(--sb-text-muted); }

/* ═══════════════ Changes from feedback (batch 3) ═══════════════ */

/* Sidebar header: the organisation leads, the brand follows */
.org-head { display: flex; align-items: center; gap: 12px; width: 100%; }
.org-logo { width: 34px; height: 34px; flex: none; display: grid; place-items: center; }
.org-logo img { width: 100%; height: auto; display: block; }
.org-head .org-name {
  font-family: var(--sb-font-brand); font-weight: 600; font-size: 17px;
  letter-spacing: -.01em; line-height: 1.15; color: var(--sb-text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.org-head .org-owner { font-size: 11px; color: var(--sb-text-faint); line-height: 1.2; margin-top: 1px; }
.sidebar-head { height: auto; min-height: var(--sb-topbar-h); padding: 14px 18px; }
.sidebar-brand {
  display: flex; align-items: center; gap: 6px; padding: 10px 14px 0;
  font-size: 11px; color: var(--sb-text-faint); letter-spacing: .04em;
}
.sidebar-brand img { height: 13px; width: auto; opacity: .75; }

/* User menu in the top right */
.usermenu-wrap { position: relative; }
.userbtn {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  border: 1px solid transparent; border-radius: var(--sb-radius-pill);
  padding: 4px 10px 4px 4px; background: transparent; font: inherit;
}
.userbtn:hover { background: var(--sb-neutral-soft); }
.userbtn .un { font-size: 13px; font-weight: 500; line-height: 1.15; text-align: left; }
.userbtn .uo { font-size: 11px; color: var(--sb-text-faint); line-height: 1.15; text-align: left; }
.userbtn svg { width: 14px; height: 14px; color: var(--sb-text-faint); }
.usermenu {
  position: absolute; right: 0; top: calc(100% + 8px); width: 268px; z-index: 40;
  background: var(--sb-surface); border: 1px solid var(--sb-border);
  border-radius: var(--sb-radius); box-shadow: var(--sb-shadow-lg); padding: 6px;
}
.usermenu .um-head { padding: 10px 12px 12px; border-bottom: 1px solid var(--sb-border); margin-bottom: 6px; }
.usermenu .um-head .n { font-weight: 500; font-size: 13.5px; }
.usermenu .um-head .e { font-size: 12px; color: var(--sb-text-muted); }
.um-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  border-radius: var(--sb-radius-sm); font-size: 13.5px; cursor: pointer;
}
.um-item:hover { background: var(--sb-surface-alt); }
.um-item svg { width: 16px; height: 16px; color: var(--sb-text-muted); }
.um-item .check { margin-left: auto; color: var(--sb-primary); }
.um-section {
  font-size: 10.5px; letter-spacing: .09em; text-transform: uppercase;
  color: var(--sb-text-faint); padding: 10px 12px 4px;
}
.um-sep { height: 1px; background: var(--sb-border); margin: 6px 0; }
.um-org { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: var(--sb-radius-sm); cursor: pointer; }
.um-org:hover { background: var(--sb-surface-alt); }
.um-org.active { background: var(--sb-primary-tint); }
.um-org .oa {
  width: 26px; height: 26px; border-radius: 8px; flex: none; display: grid; place-items: center;
  background: var(--sb-primary-soft); color: var(--sb-primary); font-size: 10.5px; font-weight: 600;
}
.um-org .on { font-size: 13px; font-weight: 500; }
.um-org .os { font-size: 11px; color: var(--sb-text-faint); }

/* Error banner */
.banner-danger { background: var(--sb-danger-soft); color: #8A2A1F; border-color: #EFD2CD; }

/* List / cards view switcher */
.viewtoggle { display: inline-flex; border: 1px solid var(--sb-border); border-radius: var(--sb-radius-sm); padding: 3px; gap: 2px; background: var(--sb-surface-alt); }
.viewtoggle button {
  display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent;
  font: inherit; font-size: 13px; color: var(--sb-text-muted); padding: 6px 10px; border-radius: 6px; cursor: pointer;
}
.viewtoggle button svg { width: 15px; height: 15px; }
.viewtoggle button.active { background: var(--sb-surface); color: var(--sb-text); font-weight: 500; box-shadow: var(--sb-shadow-sm); }

/* Product cards */
.prodgrid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 16px; padding: 20px; }
@media (max-width: 1280px) { .prodgrid { grid-template-columns: repeat(3, minmax(0,1fr)); } }
@media (max-width: 900px)  { .prodgrid { grid-template-columns: repeat(2, minmax(0,1fr)); } }
.prodcard {
  border: 1px solid var(--sb-border); border-radius: var(--sb-radius-lg);
  background: var(--sb-surface); overflow: hidden; cursor: pointer;
}
.prodcard:hover { border-color: var(--sb-border-strong); box-shadow: var(--sb-shadow); }
.prodcard .ph {
  aspect-ratio: 4/3; display: grid; place-items: center; position: relative;
  background: var(--sb-primary-soft); color: var(--sb-primary);
}
.prodcard .ph svg { width: 40px; height: 40px; opacity: .55; }
.prodcard .ph .chip { position: absolute; top: 10px; right: 10px; background: var(--sb-surface); }
.prodcard .pb { padding: 13px 14px 15px; }
.prodcard .pn { font-weight: 500; font-size: 13.5px; line-height: 1.3; }
.prodcard .ps { font-size: 12px; color: var(--sb-text-faint); margin-top: 2px; }
.prodcard .pf { display: flex; align-items: baseline; gap: 8px; margin-top: 10px; }
.prodcard .pf .amount { font-size: 15px; }
.prodcard .pf .muted { font-size: 12px; }

/* Photo gallery on the product detail */
.gallery { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.gallery .g-main { grid-column: span 4; aspect-ratio: 16/10; }
.gallery .shot {
  border-radius: var(--sb-radius); border: 1px solid var(--sb-border);
  background: var(--sb-primary-soft); color: var(--sb-primary);
  display: grid; place-items: center; aspect-ratio: 1; position: relative; overflow: hidden;
}
.gallery .shot svg { width: 22px; height: 22px; opacity: .5; }
.gallery .g-main svg { width: 54px; height: 54px; }
.gallery .shot.add { background: var(--sb-surface-alt); border-style: dashed; color: var(--sb-text-faint); }
.gallery .shot .badge-main {
  position: absolute; left: 8px; bottom: 8px; font-size: 10.5px; font-weight: 500;
  background: var(--sb-surface); color: var(--sb-text-muted); padding: 2px 7px; border-radius: 6px;
}

/* Modal window over the content */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(26,23,18,.35); z-index: 60;
  display: grid; place-items: center; padding: 24px;
}
.modal {
  width: 100%; max-width: 520px; background: var(--sb-surface);
  border-radius: var(--sb-radius-lg); box-shadow: var(--sb-shadow-lg); overflow: hidden;
}

/* Combo box with an open list (sample) */
.combo { position: relative; }
.combo-list {
  margin-top: 6px; border: 1px solid var(--sb-border); border-radius: var(--sb-radius-sm);
  background: var(--sb-surface); box-shadow: var(--sb-shadow); padding: 5px; max-width: 320px;
}
.combo-opt { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 6px; font-size: 13.5px; cursor: pointer; }
.combo-opt:hover { background: var(--sb-surface-alt); }
.combo-opt.selected { background: var(--sb-primary-soft); color: var(--sb-primary); font-weight: 500; }
.combo-opt svg { width: 15px; height: 15px; margin-left: auto; }

/* ═══════════════ Changes from feedback (batch 4) ═══════════════ */

/* Checkbox — a filled tile with a white tick */
.checkbox {
  width: 19px; height: 19px; border-radius: 6px; border: 1.5px solid var(--sb-border-strong);
  background: var(--sb-surface); display: inline-block; vertical-align: middle; position: relative;
}
.checkbox.checked { background: var(--sb-primary); border-color: var(--sb-primary); }
.checkbox.checked::after {
  content: ''; position: absolute; inset: 0; width: auto; height: auto;
  background: no-repeat center / 12px 12px
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'><path d='M5 12.5l4.6 4.6L19 7.4'/></svg>");
  border: 0; transform: none;
}

/* The combo box matches the height of a text field */
.select {
  padding: 11px 34px 11px 13px; font-size: 14px; line-height: 1.5;
  border-color: var(--sb-border-strong); border-radius: var(--sb-radius-sm);
}
.select:focus { outline: 0; border-color: var(--sb-primary); box-shadow: 0 0 0 3px var(--sb-primary-soft); }

/* The expanded combo box list sits above the content and is anchored to the field */
.combo { position: relative; }
.field > .combo { display: block; }
.combo > .combo-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 30;
  max-width: none; margin-top: 0;
}
.combo.open > .input { border-color: var(--sb-primary); box-shadow: 0 0 0 3px var(--sb-primary-soft); }
.combo:not(.open) > .combo-list { display: none; }
.combo > .input { cursor: pointer; }

/* Top bar: hamburger, search icon, user */
.navtoggle {
  width: 36px; height: 36px; border-radius: var(--sb-radius-sm); border: 0; background: transparent;
  display: grid; place-items: center; color: var(--sb-text-muted); cursor: pointer; flex: none;
}
.navtoggle:hover { background: var(--sb-neutral-soft); }
.navtoggle svg { width: 19px; height: 19px; }
.topbar { gap: 10px; }
.topbar .topbar-title {
  font-family: var(--sb-font-brand); font-size: 15px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Search panel under the bar */
.searchpanel {
  display: none; background: var(--sb-surface); border-bottom: 1px solid var(--sb-border);
  padding: 14px 24px; position: sticky; top: var(--sb-topbar-h); z-index: 19;
}
body.search-open .searchpanel { display: block; }
.searchpanel .field-search { width: 100%; min-width: 0; padding: 11px 14px; background: var(--sb-surface-alt); }
.searchpanel .hint { margin-top: 8px; font-size: 12px; color: var(--sb-text-faint); }

/* Collapsing the left navigation */
.nav-backdrop { display: none; }

@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    display: flex; position: fixed; top: 0; bottom: 0; left: 0; width: 284px; z-index: 70;
    transform: translateX(-100%); transition: transform .18s ease; height: 100vh;
  }
  body.nav-open .sidebar { transform: none; box-shadow: var(--sb-shadow-lg); }
  body.nav-open .nav-backdrop { display: block; position: fixed; inset: 0; background: rgba(26,23,18,.35); z-index: 60; }
}

/* In a narrow window the user button shrinks to a glyph */
@media (max-width: 1080px) {
  .userbtn .un, .userbtn .uo, .userbtn > svg { display: none; }
  .userbtn { padding: 4px; gap: 0; }
}

/* Sidebar header: the organisation on top, the brand below it */
.org-head { align-items: center; }
.org-head .org-brand {
  display: flex; align-items: center; gap: 5px; margin-top: 3px;
  font-size: 11px; color: var(--sb-text-faint);
}
.org-head .org-brand img { height: 12px; width: auto; opacity: .8; }

/* ═══════════════ Trend charts ═══════════════ */

/* Compact count tiles that filter the list below them */
.statrow { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; margin-bottom: 16px; }
.statmini {
  display: flex; align-items: center; gap: 10px; cursor: pointer; text-align: left;
  background: var(--sb-surface); border: 1px solid var(--sb-border);
  border-radius: var(--sb-radius); padding: 10px 12px; font: inherit; color: inherit;
}
.statmini:hover { border-color: var(--sb-border-strong); }
.statmini.is-selected { border-color: var(--sb-primary); background: var(--sb-primary-tint); }
.statmini .mi { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; flex: none; }
.statmini .mi svg { width: 15px; height: 15px; }
.statmini .mv { font-family: var(--sb-font-num); font-size: 18px; font-weight: 600; line-height: 1.1; }
.statmini .ml { font-size: 12px; color: var(--sb-text-muted); line-height: 1.2; }
.statmini .mc { margin-left: auto; font-size: 11px; color: var(--sb-text-faint); font-family: var(--sb-font-num); }
@media (max-width: 900px) { .statrow { grid-template-columns: repeat(2, minmax(0,1fr)); } }
/* A row with more tiles fills the width instead of wrapping into a half-empty second line */
.statrow.statrow-fluid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }

/* Graf */
.chart-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 16px; margin-bottom: 20px; }
@media (max-width: 1100px) { .chart-grid { grid-template-columns: 1fr; } }
.chart { width: 100%; height: auto; display: block; }
.chart .grid-line { stroke: var(--sb-chart-grid); stroke-width: 1; }
.chart .axis-line { stroke: var(--sb-border-strong); stroke-width: 1; }
.chart .tick { fill: var(--sb-text-faint); font-family: 'Inter', sans-serif; font-size: 11px; }
.chart .bar-label { fill: var(--sb-text-muted); font-family: 'Inter', sans-serif; font-size: 11px; font-weight: 600; }
.chart .bar-now { fill: var(--sb-chart-series); }
.chart .bar-prev { fill: var(--sb-chart-compare); }
.chart g.b:hover .bar-now, .chart g.b:hover .bar-prev { opacity: .82; }

.legend { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; font-size: 12.5px; color: var(--sb-text-muted); }
.legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; margin-right: 7px; vertical-align: -1px; }
.legend .now i { background: var(--sb-chart-series); }
.legend .prev i { background: var(--sb-chart-compare); }

.kpi { display: flex; gap: 22px; flex-wrap: wrap; margin-bottom: 14px; }
.kpi .k-val { font-family: var(--sb-font-num); font-size: 22px; font-weight: 600; letter-spacing: -.01em; }
.kpi .k-lab { font-size: 12px; color: var(--sb-text-muted); }
.delta { font-size: 12px; font-weight: 600; font-family: var(--sb-font-num); }
.delta.up { color: var(--sb-success); }
.delta.down { color: var(--sb-danger); }

/* Finance overview by month: the result leads, money and VAT step back */
.tbl-months .fin-result { font-weight: 600; font-size: 15px; background: var(--sb-surface-alt); }
.tbl-months .fin-result.positive { color: var(--sb-success); }
.tbl-months .fin-minor { font-size: 13px; color: var(--sb-text-faint); }

details.table-view { margin-top: 14px; }
details.table-view summary {
  cursor: pointer; font-size: 12.5px; color: var(--sb-text-muted);
  list-style: none; display: inline-flex; align-items: center; gap: 6px;
}
details.table-view summary::-webkit-details-marker { display: none; }
details.table-view summary::before { content: '▸'; font-size: 10px; }
details.table-view[open] summary::before { content: '▾'; }
details.table-view .table-wrap { margin-top: 10px; border: 1px solid var(--sb-border); border-radius: var(--sb-radius); }

/* ═══════════════ Changes from feedback (batch 5) ═══════════════ */

/* Search: a field in the bar on desktop, only the magnifier in a narrow window */
.topbar .topsearch { display: flex; }
.topbar .searchtoggle { display: none; }
@media (max-width: 1024px) {
  .topbar .topsearch { display: none; }
  .topbar .searchtoggle { display: grid; }
}
/* The panel under the bar is for narrow windows only */
@media (min-width: 1025px) { body.search-open .searchpanel { display: none; } }

/* In a narrow window only the initials avatar stays with the user */
@media (max-width: 1080px) {
  .userbtn .un, .userbtn .uo, .userbtn > svg { display: none; }
  .userbtn { padding: 4px; gap: 0; }
}

/* Collapsed navigation on desktop: one column, the content stays centred.
   On a narrow window the menu behaves as a drawer, so the rule is limited to wide windows. */
@media (min-width: 981px) {
  body.nav-closed .shell { grid-template-columns: 1fr; }
  body.nav-closed .sidebar { display: none; }
}
.page { margin-left: auto; margin-right: auto; }

/* Sidebar header without the bus glyph */
.org-head { gap: 0; }
.org-head .org-logo { display: none; }
.org-head .org-name { font-size: 18px; }
.org-head .org-brand img { display: none; }
.org-head .org-brand { font-size: 11px; color: var(--sb-text-faint); letter-spacing: .01em; }

/* ── Small trend preview ── */
.trendrow { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; margin-bottom: 16px; }
@media (max-width: 900px) { .trendrow { grid-template-columns: 1fr; } }
.trendcard {
  display: flex; align-items: center; gap: 16px;
  background: var(--sb-surface); border: 1px solid var(--sb-border);
  border-radius: var(--sb-radius); padding: 12px 14px;
}
.trendcard .t-meta { min-width: 116px; }
.trendcard .t-lab { font-size: 12px; color: var(--sb-text-muted); }
.trendcard .t-val { font-family: var(--sb-font-num); font-size: 20px; font-weight: 600; line-height: 1.15; }
.trendcard .t-sub { font-size: 11.5px; color: var(--sb-text-faint); }
.trendcard .chart-mini { flex: 1; min-width: 0; height: 56px; }
.chart-mini .line { fill: none; stroke: var(--sb-chart-series); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chart-mini .area { fill: var(--sb-primary-soft); }
.chart-mini .dot { fill: var(--sb-chart-series); stroke: var(--sb-surface); stroke-width: 2; }
.chart-mini .base { stroke: var(--sb-border); stroke-width: 1; }
.chart-mini .mini-label { fill: var(--sb-text-muted); font-family: 'Inter', sans-serif; font-size: 10px; font-weight: 600; }


/* ═══════════════ Changes from feedback (batch 6) ═══════════════ */

/* Menu header: the organisation name only */
.org-head .org-brand { display: none; }
.org-head .org-name { font-size: 18px; font-weight: 600; color: var(--sb-text); }

/* Menu footer: the platform link with the application version, which opens What's new */
.sidebar-foot { display: flex; align-items: center; gap: 2px; }
.powered {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  border-radius: var(--sb-radius-sm); font-size: 11.5px; color: var(--sb-text-faint);
}
.powered:hover { background: rgba(26,23,18,.045); color: var(--sb-text-muted); }
.powered svg { width: 14px; height: 14px; }
.powered strong { font-weight: 600; color: var(--sb-text-muted); }
.app-version {
  flex: none; padding: 8px 10px; border-radius: var(--sb-radius-sm);
  font-size: 11px; color: var(--sb-text-faint);
}
.app-version:hover { background: rgba(26,23,18,.045); color: var(--sb-primary); }

/* In the top right the user is always just an initials avatar */
.userbtn .un, .userbtn .uo, .userbtn > svg { display: none; }
.userbtn { padding: 3px; gap: 0; }

/* Collapsing the menu with an arrow; once collapsed it points the other way */
.navtoggle svg { transition: transform .18s ease; }
body.nav-closed .navtoggle svg { transform: rotate(180deg); }

/* Module overview on the platform page */
.module-row {
  display: flex; align-items: center; gap: 14px; padding: 14px 0;
  border-bottom: 1px solid var(--sb-border);
}
.module-row:last-child { border-bottom: 0; }
.module-ico {
  width: 38px; height: 38px; border-radius: 11px; flex: none; display: grid; place-items: center;
  background: var(--sb-primary-soft); color: var(--sb-primary);
}
.module-ico svg { width: 18px; height: 18px; }
.module-row .m-name { font-weight: 600; font-size: 14px; }
.module-row > div { min-width: 0; }
.module-row .m-desc { font-size: 12.5px; color: var(--sb-text-muted); margin-top: 1px; }
.module-row .m-state { margin-left: auto; flex: none; }
/* Line caption above its modules, the same as in the left menu */
.module-line {
  display: flex; align-items: center; gap: 8px; padding: 18px 0 2px;
  font: 700 10.5px var(--sb-font-brand); letter-spacing: .14em; text-transform: uppercase; color: var(--sb-text-faint);
}
.module-line .line-badge {
  display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 6px; flex: none;
  background: var(--sb-ink); color: #fff; font: 800 10px var(--sb-font-brand); letter-spacing: 0;
}
.module-line .line-badge-signal { background: var(--sb-signal); color: var(--sb-ink); }
.module-line .line-badge-dashed { background: transparent; color: var(--sb-ink); border: 1.5px dashed currentColor; }
.module-line + .module-row { padding-top: 10px; }

/* ─────────────────── Form validation (Blazor) ─────────────────── */
/* The error shows next to the touched field, not as a block under the form. */
.field .validation-message,
.form-error {
  font-size: 12px; color: var(--sb-danger); margin-top: 6px;
  display: flex; gap: 6px; align-items: center;
}
.field .validation-message::before,
.form-error::before {
  content: "!"; flex: none;
  width: 14px; height: 14px; border-radius: 50%;
  border: 1px solid currentColor; font-size: 10px; font-weight: 600;
  display: grid; place-items: center;
}
.field .input:focus-within { border-color: var(--sb-primary); box-shadow: 0 0 0 3px var(--sb-primary-soft); }
.field .input input.invalid { color: inherit; }
.field .input:has(input.invalid) { border-color: var(--sb-danger); }
.field .input:has(input:disabled, textarea:disabled) { background: var(--sb-surface-alt); cursor: not-allowed; }
.field .input input:disabled, .field .input textarea:disabled { color: var(--sb-text-muted); cursor: not-allowed; }
.auth-card .validation-summary { display: none; }

/* The heading receives focus on navigation; a ring around it does not belong to the mockup. */
h1:focus, h1:focus-visible, [tabindex="-1"]:focus { outline: none; }

/* Native checkbox styled to match the mockup. */
.check-row input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; margin: 0;
  width: 18px; height: 18px; flex: none; cursor: pointer;
  border: 1px solid var(--sb-border-strong); border-radius: 5px;
  background: var(--sb-surface); display: grid; place-items: center;
}
.check-row input[type="checkbox"]:checked {
  background: var(--sb-primary); border-color: var(--sb-primary);
}
.check-row input[type="checkbox"]:checked::after {
  content: ""; width: 9px; height: 5px; margin-top: -2px;
  border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(-45deg);
}
.check-row { cursor: pointer; }

/* Password visibility toggle inside the field. */
.pwd-toggle {
  display: inline-flex; align-items: center; border: 0; background: transparent;
  padding: 0; color: var(--sb-text-faint); cursor: pointer;
}
.pwd-toggle:hover { color: var(--sb-text-muted); }

/* On a narrow screen the account card fits the width. The mockup does not cover this state;
   the visual style stays unchanged; only the inner padding differs. */
@media (max-width: 560px) {
  .auth-main { padding: 24px 16px; }
  .auth-card { padding: 24px 20px; }
}

/* Inputs placed straight into the cells of the order table. */
.cell-input {
  width: 100%; border: 1px solid var(--sb-border); border-radius: var(--sb-radius-sm);
  background: var(--sb-surface); font: inherit; color: var(--sb-text);
  padding: 7px 10px; outline: 0;
}
.cell-input:focus { border-color: var(--sb-primary); box-shadow: 0 0 0 3px var(--sb-primary-soft); }
.cell-input:disabled { background: var(--sb-surface-alt); color: var(--sb-text-muted); }
.cell-input.t-right { text-align: right; }

/* Compact counts per state used as overview filters. */
.statrow .stat {
  border: 1px solid var(--sb-border); border-radius: var(--sb-radius); background: var(--sb-surface);
  padding: 12px 14px; text-align: left; cursor: pointer; font: inherit; color: inherit;
}
.statrow .stat:hover { border-color: var(--sb-border-strong); }
.statrow .stat.active { border-color: var(--sb-primary); background: var(--sb-primary-tint); }
.statrow .stat-label { display: block; font-size: 12.5px; color: var(--sb-text-muted); }
.statrow .stat-value { display: block; font-family: var(--sb-font-brand); font-size: 22px; font-weight: 600; }

/* Product photos: tile content and its controls */
.gallery .shot img { width: 100%; height: 100%; object-fit: cover; }
.gallery .shot .shot-tools {
  position: absolute; right: 6px; top: 6px; display: flex; gap: 6px; opacity: 0; transition: opacity .12s ease;
}
.gallery .shot:hover .shot-tools, .gallery .shot:focus-within .shot-tools { opacity: 1; }
.gallery .shot .shot-tools button {
  border: 1px solid var(--sb-border); background: var(--sb-surface); color: var(--sb-text-muted);
  border-radius: 8px; width: 26px; height: 26px; display: grid; place-items: center; cursor: pointer;
}
.gallery .shot .shot-tools button:hover { color: var(--sb-text); }
.gallery .shot .shot-tools button svg { width: 14px; height: 14px; opacity: 1; }
.gallery label.shot.add { cursor: pointer; }
.gallery label.shot.add input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.prodcard .ph img { width: 100%; height: 100%; object-fit: cover; }
.prodcard .ph img { position: absolute; inset: 0; }

/* Order items: every editable cell starts at the same height and its note hangs under the input. */
.tbl-items tbody td { vertical-align: top; }
.tbl-items tbody td .cell-sub { margin-top: 6px; }
.tbl-items .cell-value { padding: 7px 0; }
.tbl-items .cell-unit { display: flex; align-items: center; gap: 8px; }
.tbl-items .cell-unit .u { font-size: 12px; color: var(--sb-text-faint); }

/* A picker that shows a table needs more room than an ordinary dialog. */
.modal-wide { max-width: 760px; }

/* Choice inside the user menu; it is a form button, so it needs the look of a menu row. */
/* Language of the account: the codes stand side by side, the current one is pressed */
.um-lang { display: flex; align-items: center; gap: 10px; padding: 7px 12px; }
.um-lang svg { width: 16px; height: 16px; color: var(--sb-text-muted); }
.um-lang .lab {
  font-size: 10.5px; letter-spacing: .09em; text-transform: uppercase; color: var(--sb-text-faint);
}
.um-lang .seg { margin-left: auto; padding: 2px; }
.um-lang .seg button { padding: 4px 11px; font-size: 12px; font-weight: 500; letter-spacing: .04em; }

/* Search slot in the top bar: carries the tour anchor and keeps the width of the field */
.topsearch-slot { flex: 1; max-width: 460px; display: flex; min-width: 0; }
.topsearch-slot .topsearch { max-width: none; }

/* ═══════════════ User guide (UI-29) ═══════════════ */
.guide-layout { display: grid; grid-template-columns: minmax(0, 1fr) 232px; gap: 28px; align-items: start; }
.guide-content { min-width: 0; max-width: 980px; }
.guide-part { margin-bottom: 36px; scroll-margin-top: calc(var(--sb-topbar-h) + 16px); }
.guide-part-title {
  font-family: var(--sb-font-brand); font-size: 22px; font-weight: 600; letter-spacing: -.01em;
  margin: 0 0 4px; display: flex; align-items: center; gap: 10px;
}
.guide-part-title .no {
  font-family: var(--sb-font-num); font-size: 12px; font-weight: 600; color: var(--sb-primary);
  background: var(--sb-primary-soft); border-radius: var(--sb-radius-pill); padding: 2px 9px;
}
.guide-part-lead { color: var(--sb-text-muted); margin: 0 0 16px; font-size: 14px; }
.guide-chapter { margin-bottom: 16px; scroll-margin-top: calc(var(--sb-topbar-h) + 16px); }
.guide-chapter .card-body { font-size: 14px; line-height: 1.65; }
.guide-chapter h4 { font-size: 14.5px; font-weight: 600; margin: 22px 0 8px; }
.guide-chapter h4:first-child { margin-top: 0; }
.guide-chapter p { margin: 0 0 12px; }
.guide-chapter ul, .guide-chapter ol { margin: 0 0 12px; padding-left: 22px; }
.guide-chapter li { margin-bottom: 5px; }
.guide-chapter .tbl { margin: 0 0 14px; font-size: 13px; }
.guide-chapter .tbl-wrap { border: 1px solid var(--sb-border); border-radius: var(--sb-radius); overflow-x: auto; margin-bottom: 14px; }
.guide-chapter .tbl-wrap .tbl { margin: 0; }
.guide-chapter .tbl tbody td { padding: 9px 14px; vertical-align: top; line-height: 1.5; }
.guide-chapter .tbl thead th { padding: 9px 14px; }
.guide-chapter .tbl tbody tr:hover { background: transparent; }
.guide-chapter .tbl td:first-child { font-weight: 500; white-space: nowrap; }
.guide-where {
  display: flex; align-items: flex-start; gap: 8px; margin: 0 0 16px; padding: 10px 12px;
  background: var(--sb-surface-alt); border: 1px solid var(--sb-border); border-radius: var(--sb-radius-sm);
  font-size: 13px; color: var(--sb-text-muted);
}
.guide-where svg { width: 16px; height: 16px; flex: none; margin-top: 2px; color: var(--sb-primary); }
.guide-where .lab { font-weight: 600; color: var(--sb-text); margin-right: 4px; }
.guide-chapter .banner { margin: 0 0 14px; font-size: 13.5px; }
.guide-toc { position: sticky; top: calc(var(--sb-topbar-h) + 20px); max-height: calc(100vh - var(--sb-topbar-h) - 40px); overflow-y: auto; font-size: 13px; }
.guide-toc .toc-head {
  font-size: 10.5px; letter-spacing: .09em; text-transform: uppercase; color: var(--sb-text-faint);
  font-weight: 500; margin-bottom: 10px;
}
.guide-toc a { display: block; color: var(--sb-text-muted); text-decoration: none; padding: 3px 0 3px 12px; border-left: 2px solid var(--sb-border); }
.guide-toc a:hover { color: var(--sb-primary); border-left-color: var(--sb-primary); }
.guide-toc a.toc-part { color: var(--sb-text); font-weight: 600; border-left-color: transparent; padding-left: 0; margin-top: 12px; }
.guide-toc a.toc-part:first-of-type { margin-top: 0; }
@media (max-width: 1100px) {
  .guide-layout { grid-template-columns: 1fr; }
  .guide-toc { position: static; max-height: none; order: -1; }
}

/* ═══════════════ Product tour (part of UI-29) ═══════════════ */
.tour { position: fixed; inset: 0; z-index: 90; }
.tour-spot {
  position: fixed; border-radius: var(--sb-radius); box-shadow: 0 0 0 9999px rgba(26,23,18,.5);
  outline: 2px solid var(--sb-primary); transition: all .2s ease; pointer-events: none;
}
.tour-spot.is-empty { left: 50% !important; top: 50% !important; width: 0 !important; height: 0 !important; outline: 0; }
.tour-pop {
  position: fixed; width: 340px; max-width: calc(100vw - 24px);
  background: var(--sb-surface); border: 1px solid var(--sb-border); border-radius: var(--sb-radius-lg);
  box-shadow: var(--sb-shadow-lg); padding: 18px 20px 16px;
}
.tour-pop.is-centered { left: 50%; top: 50%; transform: translate(-50%, -50%); width: 420px; }
.tour-progress { font-family: var(--sb-font-num); font-size: 11.5px; color: var(--sb-text-faint); margin-bottom: 6px; }
.tour-title { font-family: var(--sb-font-brand); font-size: 18px; font-weight: 600; margin: 0 0 6px; }
.tour-text { font-size: 13.5px; line-height: 1.6; color: var(--sb-text-muted); margin: 0 0 16px; }
.tour-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tour-spacer { flex: 1; }

/* ═══════════════ Phone layout (DEC-034) ═══════════════
   Below 640 px nothing may scroll sideways. Tables turn into cards, filters fold into a bottom
   sheet, dialogs rise from the bottom and the decisive action of a screen stays in reach of the
   thumb. Wider screens keep the agreed mockups; every rule below either sits in the phone media
   query or switches a phone-only element off on a wider screen. */

/* Menu icon: the collapse arrow on a wide screen, the hamburger where the menu is a drawer */
.navtoggle .navtoggle-narrow { display: none; }
@media (max-width: 980px) {
  .navtoggle .navtoggle-wide { display: none; }
  .navtoggle .navtoggle-narrow { display: block; }
  .sidebar { height: 100dvh; }
}

/* Search in a narrow window: the magnifier opens the field as a panel under the bar */
@media (max-width: 1024px) {
  body.search-open .topbar .topsearch-slot {
    display: flex; position: absolute; left: 0; right: 0; top: 100%; max-width: none;
    padding: 10px 12px; background: var(--sb-surface); border-bottom: 1px solid var(--sb-border);
    box-shadow: var(--sb-shadow);
  }
  body.search-open .topbar .topsearch-slot .topsearch { display: flex; flex: 1; }
  .topbar .topsearch-slot { display: none; }
  body.search-open .topbar .searchtoggle { background: var(--sb-primary-soft); color: var(--sb-primary); }
}

/* Filter sheet and page actions: on a wide screen the wrappers vanish and the content keeps its place */
.filter-sheet, .filter-sheet-panel, .filter-sheet-body { display: contents; }
.filter-sheet-toggle, .filter-sheet .sheet-head, .filter-sheet .sheet-foot, .sheet-backdrop, .btn-more { display: none; }
@media (min-width: 641px) { .m-only { display: none !important; } }

/* Touch screens have no hover: controls revealed by hovering stay visible */
@media (hover: none) {
  .gallery .shot .shot-tools { opacity: 1; }
  .gallery .shot .shot-tools button { width: 36px; height: 36px; }
}

@media (max-width: 640px) {
  :root { --sb-topbar-h: 56px; }
  .m-hide { display: none !important; }

  /* ── Shell ── */
  .topbar { padding: 0 8px 0 4px; gap: 4px; }
  .topbar .navtoggle, .topbar .icon-btn { width: 44px; height: 44px; }
  .topbar .divider-v { display: none; }
  .shell, .auth { min-height: 100dvh; }
  .page { padding: 14px 12px calc(40px + env(safe-area-inset-bottom)); }
  .usermenu { position: fixed; left: 8px; right: 8px; top: calc(var(--sb-topbar-h) + 6px); width: auto;
    max-height: calc(100dvh - var(--sb-topbar-h) - 20px); overflow-y: auto; }

  /* ── Page head ── */
  .breadcrumb { display: none; }
  .page-head { gap: 12px; margin-bottom: 16px; }
  .page-head > div:first-child { min-width: 0; flex: 1 1 100%; }
  .page-title { font-size: 22px; overflow-wrap: anywhere; }
  .page-sub { font-size: 13px; }
  .page-actions { margin-left: 0; width: 100%; }
  .page-actions > .btn { flex: 1 1 auto; justify-content: center; }
  .card-head { flex-wrap: wrap; padding: 14px; }
  .card-head > div { min-width: 0; }
  .card-body { padding: 14px; }
  .card-foot { padding: 12px 14px; flex-wrap: wrap; }
  .card-foot > .btn { flex: 1 1 auto; justify-content: center; }
  .card { border-radius: var(--sb-radius); }

  /* ── Touch and forms: iOS zooms into a field below 16 px, a finger needs 44 px ── */
  input, select, textarea, .select, .cell-input, .col-filter { font-size: 16px !important; }
  .btn { min-height: 44px; }
  .icon-btn { width: 44px; height: 44px; }
  .checkbox { width: 24px; height: 24px; }
  .check-row input[type="checkbox"] { width: 22px; height: 22px; }
  .pager { flex-wrap: wrap; }
  .pager button { min-width: 44px; height: 44px; }
  .seg { flex-wrap: wrap; }
  .seg button { min-height: 38px; }
  .tabs { overflow-x: auto; padding: 0 8px; scrollbar-width: none; }
  .tabs button { white-space: nowrap; padding: 13px 10px; }
  .field-search { min-width: 0 !important; width: 100%; }
  .kv-row { flex-direction: column; gap: 2px; padding: 8px 0; }
  .kv-row dt { min-width: 0; font-size: 12.5px; }
  .codebox { flex-wrap: wrap; }

  /* ── Count tiles: a 2 × N grid, nothing scrolls sideways ── */
  .statrow, .statrow.statrow-fluid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; margin-bottom: 12px; }
  .statmini { padding: 10px; min-height: 56px; min-width: 0; justify-content: flex-start; }
  .statmini .mc { display: none; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; margin-bottom: 16px; }
  .stat { padding: 12px 14px; border-radius: var(--sb-radius); min-width: 0; }
  .stat-top { margin-bottom: 8px; }
  .stat-value { font-size: 22px; }
  .stat-label { font-size: 12.5px; line-height: 1.3; }
  .trendrow { gap: 8px; margin-bottom: 12px; }
  .trendcard { padding: 10px 12px; gap: 12px; }
  .trendcard .t-meta { min-width: 104px; }
  .trendrow > * { min-width: 0; }
  .trendcard .chart-mini { height: 40px; width: 100%; }
  .trendcard .t-meta { flex: none; }
  .chart-grid { gap: 12px; }

  /* Quick actions of the home screen: three tiles side by side */
  .grid-3.quick-row { grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; }
  .quick-row .quick { flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 12px 6px; border-radius: var(--sb-radius); }
  .quick-row .quick .t { font-size: 12.5px; line-height: 1.25; }
  .quick-row .quick .s { display: none; }

  /* ── Toolbar: search over the full width, the rest behind "Filters" ── */
  .toolbar { padding: 12px; gap: 8px; flex-wrap: nowrap; }
  .toolbar > .field-search { flex: 1 1 auto; }
  .toolbar > :not(.field-search):not(.filter-sheet):not(.m-keep) { display: none; }
  .filter-sheet-toggle { display: inline-flex; flex: none; padding: 0 12px; }

  /* ── Bottom sheet: the filter panel ── */
  .sheet-backdrop { position: fixed; inset: 0; z-index: 79; background: rgba(26,23,18,.4); }
  [data-sheet].is-open > .sheet-backdrop { display: block; }
  .filter-sheet-panel {
    display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 80;
    max-height: 88dvh; flex-direction: column;
    background: var(--sb-surface); border-radius: 18px 18px 0 0; box-shadow: var(--sb-shadow-lg);
  }
  .filter-sheet.is-open .filter-sheet-panel { display: flex; }
  .sheet-head {
    display: flex !important; align-items: center; gap: 8px; padding: 10px 8px 10px 16px;
    border-bottom: 1px solid var(--sb-border);
  }
  .sheet-head h2 { font-family: var(--sb-font-brand); font-size: 17px; font-weight: 600; margin: 0; flex: 1; }
  .filter-sheet-body { display: grid; gap: 14px; padding: 16px; overflow-y: auto; }
  .filter-sheet-body > * { width: 100%; min-width: 0 !important; margin: 0 !important; }
  .filter-sheet-body > .btn { justify-content: center; }
  .filter-sheet-body .seg { display: flex; }
  .filter-sheet-body .seg button { flex: 1 1 auto; }
  .filter-sheet-body .muted { margin: 0 !important; }
  .sheet-foot {
    display: flex !important; gap: 8px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--sb-border);
  }
  .sheet-foot .btn { flex: 1; justify-content: center; }
  .sheet-field > label, .sheet-field > .lbl { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; }
  .sheet-range { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .sheet-field .col-filter, .sheet-field .select { width: 100%; padding: 10px 12px; }

  /* ══ Table → list of cards ══
     One markup: the cells carry data-cell and the row wraps into a card. Cells without a role take
     a whole line and show their column name from data-label. */
  .table-wrap:has(> .tbl-cards), .table-wrap:has(> .tbl-form) { overflow: visible; }
  .tbl-cards, .tbl-cards > tbody, .tbl-form, .tbl-form > tbody { display: block; }
  .tbl-cards > thead, .tbl-form > thead { display: none; }
  .tbl-cards > tbody > tr {
    position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px;
    padding: 12px 14px; border-bottom: 1px solid var(--sb-border);
  }
  .tbl-cards > tbody > tr:last-child { border-bottom: 0; }
  .tbl-cards > tbody > tr:hover { background: transparent; }
  .tbl-cards > tbody > tr:active { background: var(--sb-surface-alt); }
  .tbl.tbl-cards > tbody > tr > td { display: block; padding: 0; border: 0; min-width: 0; text-align: left; overflow-wrap: anywhere; }
  /* Layout defaults stay weak, so every data-cell role below overrides them */
  :where(.tbl-cards > tbody > tr) > td { order: 9; flex: 1 1 100%; }
  .tbl-cards > tbody > tr > td[data-label]:not([data-cell])::before {
    content: attr(data-label) ": "; color: var(--sb-text-faint); font-size: 12.5px;
  }
  .tbl-cards > tbody > tr > td[data-label]:not([data-cell]) > div { display: inline; }
  .tbl-cards [data-cell="hide"] { display: none !important; }
  .tbl-cards [data-cell="title"]   { order: 1; flex: 1 1 50%; }
  .tbl-cards [data-cell="meta"]    { order: 2; flex: 0 0 auto; font-size: 12.5px; text-align: right !important; }
  .tbl-cards [data-cell="who"]     { order: 3; flex: 1 1 50%; }
  .tbl-cards [data-cell="amount"]  { order: 4; flex: 0 0 auto; text-align: right !important; }
  .tbl-cards [data-cell="sub"]     { order: 5; font-size: 13px; color: var(--sb-text-muted); }
  .tbl-cards [data-cell="status"]  { order: 6; flex: 0 0 auto; margin-top: 4px; }
  .tbl-cards [data-cell="status2"] { order: 7; flex: 0 0 auto; margin-top: 4px; }
  .tbl-cards [data-cell="extra"]   { order: 8; flex: 1 1 auto; margin-top: 4px; text-align: right !important;
                                     font-size: 12.5px; color: var(--sb-text-faint); }
  .tbl-cards [data-cell="actions"] { order: 10; display: flex !important; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 6px; }
  .tbl-cards [data-cell="actions"] > * { position: relative; z-index: 1; }
  .tbl-cards [data-cell="who"] .cell-strong, .tbl-cards [data-cell="title"] .cell-strong { font-size: 15px; }
  .tbl-cards .amount { font-size: 15px; }
  .tbl-cards .cell-sub { margin-top: 0; }
  .tbl-cards .m-inline .cell-sub, .tbl-cards [data-cell="sub"] .cell-sub { display: inline; margin-left: 4px; }
  .tbl-cards .cust { gap: 8px; }
  .tbl-cards.tbl-months .fin-result { background: none; }
  .tbl-cards [data-cell="extra"] .cell-sub { display: none; }
  .tbl-cards .cust-avatar { display: none; }
  .tbl-cards .thumb { width: 36px; height: 36px; }
  /* The whole card opens the record: the main link stretches over the row */
  .tbl-cards .row-link::after { content: ''; position: absolute; inset: 0; }
  .tbl-cards > tbody > tr > td[colspan] { text-align: center; padding: 20px 0; }

  /* ══ Editable rows (order and invoice items) → a card with labelled fields ══ */
  .tbl-form > tbody > tr {
    position: relative; display: flex; flex-wrap: wrap; gap: 10px 8px;
    padding: 14px; border-bottom: 1px solid var(--sb-border);
  }
  .tbl-form > tbody > tr:hover { background: transparent; }
  .tbl.tbl-form > tbody > tr > td { display: block; padding: 0; border: 0; min-width: 0; text-align: left; }
  :where(.tbl-form > tbody > tr) > td { flex: 1 1 100%; }
  .tbl-form [data-cell="main"]  { padding-right: 48px !important; }
  .tbl-form [data-cell="field"] { flex: 1 1 28%; min-width: 92px; }
  .tbl-form [data-cell="del"]   { position: absolute; top: 8px; right: 6px; flex: none; }
  .tbl-form [data-cell="total"] { display: flex !important; justify-content: space-between; align-items: baseline;
                                  padding-top: 8px !important; border-top: 1px dashed var(--sb-border) !important; }
  .tbl-form [data-cell="hide"]  { display: none !important; }
  .tbl-form td[data-label]::before {
    content: attr(data-label); display: block; font-size: 12px; color: var(--sb-text-muted); margin-bottom: 4px;
  }
  .tbl-form td[data-cell="total"][data-label]::before { display: inline; margin: 0; font-size: 13.5px; color: var(--sb-text); font-weight: 500; }
  .tbl-form .t-right { text-align: left; }
  .tbl-form [data-cell="total"] .cell-value { padding: 0; }
  .tbl-form .cell-input { padding: 9px 10px; }
  .tbl-form > tbody > tr > td[colspan] { text-align: center; }

  /* ── Floating button of a new record on an overview ── */
  .btn-fab {
    position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 40;
    min-height: 56px; padding: 0 20px 0 16px; border-radius: 28px; flex: none !important;
    font-size: 15px; font-weight: 600; box-shadow: var(--sb-shadow-lg);
  }
  .btn-fab svg { width: 22px; height: 22px; }
  .page:has(.btn-fab) { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }

  /* ── Actions of a detail: a bar pinned to the bottom, the rest behind "more" ── */
  .page-actions-bar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; margin: 0; width: auto;
    display: flex; flex-wrap: wrap; gap: 8px;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    background: var(--sb-surface); border-top: 1px solid var(--sb-border); box-shadow: 0 -6px 18px rgba(26,23,18,.06);
  }
  .page-actions-bar:not(:has(> .btn:not(.btn-more))) { display: none; }
  .page:has(.page-actions-bar > .btn:not(.btn-more)) { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  .page-actions-bar > .btn { min-height: 48px; flex: 1 1 0; justify-content: center; }
  /* More than one action: only the primary one stays, the others wait behind "more" */
  .page-actions-bar:has(> .btn:not(.btn-more) ~ .btn:not(.btn-more)) > .btn-more { display: inline-flex; flex: 0 0 48px; padding: 0; }
  .page-actions-bar:has(> .btn:not(.btn-more) ~ .btn:not(.btn-more)):has(> .btn-primary) > .btn:not(.btn-primary):not(.btn-more) { display: none; }
  /* Without a primary action the first action stays in the bar and the others wait behind "more" */
  .page-actions-bar:not(:has(> .btn-primary)) > .btn:not(.btn-more) ~ .btn:not(.btn-more) { display: none; }
  .page-actions-bar.is-open > .btn:not(.btn-primary):not(.btn-more) {
    display: inline-flex !important; order: -1; flex: 1 1 100%; justify-content: flex-start;
  }
  /* The bar is its own stacking layer: it dims the page with its shadow and keeps the backdrop under its buttons */
  .page-actions-bar.is-open { z-index: 81; border-radius: 18px 18px 0 0; box-shadow: 0 0 0 100vmax rgba(26,23,18,.4); }
  .page-actions-bar > .sheet-backdrop { z-index: -1; background: transparent; }

  /* ── Dialogs rise from the bottom and scroll inside ── */
  .modal-overlay { place-items: end stretch; padding: 0; }
  .modal, .modal-wide {
    max-width: none; max-height: 92dvh; display: flex; flex-direction: column;
    border-radius: 18px 18px 0 0;
  }
  .modal > .card-body, .modal > div[style*="overflow"] { overflow-y: auto; min-height: 0; flex: 1 1 auto; }
  .modal > .card-head, .modal > .card-foot, .modal > .toolbar { flex: none; }
  .modal > .card-foot { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .modal > .card-foot > .btn { flex: 1 1 auto; justify-content: center; }
  .modal > .toolbar { flex-wrap: wrap; }
  .modal > .toolbar > * { display: flex !important; flex: 1 1 100% !important; margin-left: 0 !important; min-width: 0 !important; }

  /* ── The bar with the decisive action of a form spans the width at the bottom ── */
  .actionbar {
    position: sticky; bottom: 0; margin: 20px -12px 0; border-radius: 0; border-left: 0; border-right: 0;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); gap: 10px;
  }
  .actionbar .ab-actions { margin-left: 0; width: 100%; }
  .actionbar .ab-actions > .btn { flex: 1 1 auto; justify-content: center; }

  .radio-card .t, .radio-card .s { display: block; }

  /* Detail head: an arrow back to the overview replaces the breadcrumb */
  .backlink {
    display: inline-flex; align-items: center; gap: 4px; min-height: 36px; margin: -6px 0 2px -6px;
    padding: 0 6px; color: var(--sb-text-muted); font-size: 13.5px; border-radius: var(--sb-radius-sm);
  }
  .backlink svg { width: 18px; height: 18px; }
  /* Summary at the top of a detail whose price column lands at the very end of a phone page */
  .m-summary {
    display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 2px 12px;
    padding: 12px 14px; margin-bottom: 14px; background: var(--sb-surface); color: inherit;
    border: 1px solid var(--sb-border); border-radius: var(--sb-radius);
  }
  .m-summary .lab { font-size: 12px; color: var(--sb-text-muted); }
  .m-summary .val { font-family: var(--sb-font-num); font-size: 22px; font-weight: 600; }
  .m-summary .chips { grid-row: span 2; grid-column: 2; display: grid; gap: 6px; justify-items: end; }
  /* A row of a box and its button: the button drops under the content over the full width */
  .m-wrap { flex-wrap: wrap; }
  .m-wrap > .btn { flex: 1 1 100%; justify-content: center; margin-left: 0 !important; }
  .field-search.m-wrap > input { flex: 1 1 0; min-width: 0; width: auto; }

  /* Product cards and photos */
  .prodgrid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; padding: 12px; }
  .gallery { grid-template-columns: repeat(3, 1fr); }
  .gallery .g-main { grid-column: span 3; }

  /* User guide tables keep their first column readable without forcing the width */
  .guide-chapter .tbl td:first-child { white-space: normal; }
  .guide-layout { gap: 16px; }

  /* Tour bubble fits the phone */
  .tour-pop.is-centered { width: calc(100vw - 24px); }
}


/* ═══════════════ Linka shell (DEC-037) ═══════════════
   Dark airy menu: the platform screens on top, one foldable section per line with a quiet
   caption and the line badge of the brand map, the organisation as one card in the footer
   and below it the platform with the version. Collapsed on a wide screen it is a rail of
   icons; on a narrow screen it stays a drawer. Source: docs/design/brand-redesign/assets/sidebar.css. */

.sidebar { background: var(--sb-ink); border-right: 0; color: #D9D7D2; overflow: hidden; }
.sidebar-head { min-height: var(--sb-topbar-h); height: var(--sb-topbar-h); padding: 0 16px; }
.org-head { display: flex; align-items: center; gap: 11px; min-width: 0; width: 100%; padding: 6px 8px 6px 6px; border-radius: 10px; }
.org-head:hover { background: rgba(255,255,255,.06); }
.org-head .org-mark {
  width: 32px; height: 32px; border-radius: 9px; flex: none; display: grid; place-items: center;
  background: var(--sb-signal); color: var(--sb-ink); font: 800 13px var(--sb-font-brand);
}
.org-head .org-name { font: 700 15.5px var(--sb-font-brand); color: #fff; letter-spacing: -.01em; }

.sidebar-nav { padding: 8px 12px 16px; }
.sidebar .nav-item {
  height: 38px; padding: 0 12px; gap: 12px; border-radius: 10px; margin-bottom: 2px;
  color: #D9D7D2; font-size: 14px; font-weight: 500; white-space: nowrap;
}
.sidebar .nav-item svg { width: 19px; height: 19px; color: #8C8982; }
.sidebar .nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar .nav-item.active { background: var(--sb-signal); color: var(--sb-ink); font-weight: 650; box-shadow: none; }
.sidebar .nav-item.active svg { color: var(--sb-ink); }
.sidebar .nav-item .nav-count { background: rgba(255,255,255,.1); color: #fff; }
.sidebar .nav-item.active .nav-count { background: var(--sb-ink); color: var(--sb-signal); }

/* Line caption: a quiet heading, the chevron shows on hover or while folded */
.nav-line { margin-top: 18px; }
.sidebar button.nav-section {
  height: 26px; padding: 0 12px; margin-bottom: 4px; gap: 8px; justify-content: flex-start;
  font: 700 10.5px var(--sb-font-brand); letter-spacing: .14em; text-transform: uppercase;
  color: #8C8982; border-radius: 8px;
}
.sidebar button.nav-section:hover { color: #D9D7D2; }
.nav-section .line-badge {
  display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 5px; flex: none;
  background: #fff; color: var(--sb-ink); font: 800 9.5px var(--sb-font-brand); letter-spacing: 0;
}
.nav-section .line-badge-signal { background: var(--sb-signal); }
.sidebar .nav-chevron { margin-left: auto; width: 14px; height: 14px; opacity: 0; transform: none; transition: transform .15s, opacity .15s; }
.sidebar button.nav-section:hover .nav-chevron,
.sidebar button.nav-section:focus-visible .nav-chevron,
.sidebar .nav-group.collapsed .nav-chevron { opacity: 1; }
.sidebar .nav-group.collapsed .nav-chevron { transform: rotate(-90deg); }

/* Footer: the organisation card, below it the platform and the version */
.sidebar-foot { display: block; border-top: 0; padding: 8px 12px 14px; }
.org-card {
  display: flex; align-items: center; gap: 11px; padding: 10px; border-radius: 12px;
  background: rgba(255,255,255,.045); color: #D9D7D2; transition: background .15s;
}
.org-card:hover { background: rgba(255,255,255,.08); }
.org-card .oc-ic { width: 32px; height: 32px; border-radius: 9px; background: rgba(255,255,255,.07); display: grid; place-items: center; flex: none; }
.org-card .oc-ic svg { width: 17px; height: 17px; color: #B9B6AF; }
.org-card .oc-txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.org-card .oc-txt b { font-size: 13.5px; font-weight: 600; color: #fff; }
.org-card .oc-txt small { font-size: 11.5px; color: #8C8982; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.org-card .oc-chev { margin-left: auto; width: 15px; height: 15px; color: #6F6C66; flex: none; }
.org-card.active { background: var(--sb-signal); }
.org-card.active .oc-ic { background: rgba(21,23,28,.12); }
.org-card.active .oc-ic svg, .org-card.active .oc-chev, .org-card.active .oc-txt b { color: var(--sb-ink); }
.org-card.active .oc-txt small { color: rgba(21,23,28,.8); }
.foot-meta { display: flex; align-items: center; justify-content: space-between; padding: 12px 4px 0 6px; }
.sidebar .powered { flex: none; display: flex; align-items: center; gap: 7px; padding: 0; opacity: .8; background: none; transition: opacity .15s; }
.sidebar .powered:hover { opacity: 1; background: none; }
.sidebar .powered .pb { font-size: 11px; color: #B9B6AF; }
.sidebar .powered img { height: 14px; width: auto; display: block; }
.sidebar .app-version {
  padding: 2px 7px; border-radius: 99px; border: 1px solid #33363E;
  font: 600 11px var(--sb-font-num); color: #8C8982;
}
.sidebar .app-version:hover { background: none; color: #fff; border-color: #5A5D66; }

/* Collapsed on a wide screen: a rail of icons; the lines are separated by their badges */
@media (min-width: 981px) {
  body.nav-closed .shell { grid-template-columns: 72px 1fr; }
  body.nav-closed .sidebar { display: flex; }
  body.nav-closed .sidebar-head { padding: 0; justify-content: center; }
  body.nav-closed .org-head { width: auto; padding: 6px; }
  body.nav-closed .org-head .org-name,
  body.nav-closed .sidebar .nav-item .lbl,
  body.nav-closed .sidebar .nav-count,
  body.nav-closed .nav-section .name,
  body.nav-closed .sidebar .nav-chevron,
  body.nav-closed .sidebar .powered,
  body.nav-closed .org-card .oc-txt,
  body.nav-closed .org-card .oc-chev { display: none; }
  body.nav-closed .sidebar-nav { padding: 8px 10px 16px; }
  body.nav-closed .sidebar .nav-item { justify-content: center; padding: 0; height: 42px; }
  body.nav-closed .sidebar button.nav-section { justify-content: center; padding: 0; }
  body.nav-closed .sidebar .nav-group.collapsed .nav-item { display: flex; }
  body.nav-closed .sidebar-foot { padding: 10px; }
  body.nav-closed .org-card { justify-content: center; padding: 6px; background: transparent; }
  body.nav-closed .org-card.active { background: var(--sb-signal); }
  body.nav-closed .foot-meta { justify-content: center; padding: 8px 0 0; }
  body.nav-closed .navtoggle svg { transform: rotate(180deg); }
}

/* Tabs that join the screens of one section, for example the organisation (UI-34) */
.page-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--sb-border); margin: 0 0 22px; overflow-x: auto; scrollbar-width: none; }
.page-tabs a {
  position: relative; padding: 11px 14px; white-space: nowrap;
  font-size: 14px; font-weight: 600; color: var(--sb-text-muted);
}
.page-tabs a:hover { color: var(--sb-text); }
.page-tabs a.active { color: var(--sb-text); }
.page-tabs a.active::after {
  content: ''; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 3px;
  border-radius: 3px 3px 0 0; background: var(--sb-signal);
}
.page-tabs a:focus-visible { outline: 2px solid var(--sb-ink); outline-offset: -2px; border-radius: 6px; }

/* ═══════════════ Linka account screens (DEC-036) ═══════════════
   A dark panel with the brand map and the claim, the form on paper without a card frame.
   Source: docs/design/brand-redesign/login.html. */
.auth { grid-template-columns: 1.2fr 1fr; }
.auth-aside {
  background: var(--sb-ink); color: #fff; padding: 40px 52px; gap: 0;
}
.auth-aside::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(600px 300px at 70% 45%, rgba(245,184,46,.08), transparent 70%);
}
.auth-aside > * { position: relative; z-index: 1; }
.auth-logo { align-self: flex-start; }
.auth-logo img { height: 34px; width: auto; display: block; }
.auth-scene { margin: auto -12px; width: calc(100% + 24px); }
.auth-aside .claim {
  font: 800 52px/1.02 var(--sb-font-brand); letter-spacing: -.04em; max-width: none; color: #fff; margin-bottom: 16px;
}
.auth-aside .claim em { font-style: normal; color: var(--sb-signal); }
.auth-aside .claim-sub { color: #A9A59D; max-width: 46ch; margin: 0; font-size: 16px; }

.auth-main { background: #FBF8F1; padding: 28px 56px; }
.auth-logo-mobile { display: none; }
.auth-lang { background: var(--sb-surface); border: 1px solid var(--sb-border); border-radius: 99px; }
.auth-lang button { border-radius: 99px; font-weight: 700; }
.auth-lang button.active { background: var(--sb-ink); color: #fff; }
.auth-card {
  max-width: 400px; background: transparent; border: 0; box-shadow: none; padding: 32px 0;
}
.auth-card h1 { font: 800 36px/1.1 var(--sb-font-brand); letter-spacing: -.035em; margin: 0 0 8px; }
.auth-card .lead { font-size: 15px; margin: 0 0 30px; }
.auth-card .input { height: 48px; border-radius: 12px; border-width: 1.5px; background: var(--sb-surface); }
.auth-card .input:focus-within, .auth-card .input.focused {
  border-color: var(--sb-ink); box-shadow: 0 0 0 4px rgba(245,184,46,.38);
}
.auth-card .btn-primary.btn-block { height: 52px; border-radius: 12px; font-size: 15px; }
.auth-foot a {
  color: var(--sb-ink); font-weight: 650; text-decoration: underline;
  text-decoration-color: var(--sb-signal); text-decoration-thickness: 2px; text-underline-offset: 4px;
}

@media (max-width: 980px) {
  .auth { grid-template-columns: 1fr; }
  .auth-main { padding: 20px 22px; }
  .auth-logo-mobile { display: block; position: absolute; top: 22px; left: 22px; }
  .auth-logo-mobile img { height: 28px; width: auto; display: block; }
  .auth-main { position: relative; }
  .auth-card { padding: 40px 0 24px; }
  .auth-card h1 { font-size: 30px; }
}

/* ═══════════════ Linka screens (DEC-036) ═══════════════
   Lists, tiles and trends follow docs/design/brand-redesign/app-objednavky.html: display
   numbers in Plus Jakarta, quiet uppercase table headers, states as dots. */
.page-head { align-items: flex-end; }
.page-title { font-weight: 800; font-size: 30px; line-height: 1.1; letter-spacing: -.03em; }
.page-sub { font-size: 14.5px; margin-top: 6px; }
.breadcrumb { font-size: 13px; margin-bottom: 6px; }

/* Count tiles: a coloured dot with the label, the number below, the amount on the right.
   The tile markup keeps its icon element; the brand draws it as the dot in its colour. */
.statrow { gap: 14px; margin-bottom: 14px; }
.statrow.statrow-fluid { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.statmini {
  /* The number spans two auto tracks, so it never shrinks; the amount takes the rest and may wrap. */
  display: grid; grid-template-columns: auto auto minmax(0, 1fr); grid-template-areas: "dot lab lab" "val val amt";
  align-items: center; gap: 2px 8px; padding: 16px 18px; border-radius: var(--sb-radius-lg);
  transition: border-color .15s, box-shadow .15s;
}
.statmini:hover { box-shadow: var(--sb-shadow); }
.statmini > span:not([class]) { display: contents; }
.statmini .mi { grid-area: dot; width: 9px; height: 9px; border-radius: 50%; background: currentColor !important; box-shadow: 0 0 0 3px var(--sb-neutral-soft); }
.statmini .mi svg { display: none; }
.statmini .ml { grid-area: lab; font-size: 13px; font-weight: 600; line-height: 1.3; }
.statmini .mv { grid-area: val; font-family: var(--sb-font-brand); font-size: 30px; font-weight: 800; line-height: 1.15; letter-spacing: -.03em; margin-top: 6px; white-space: nowrap; }
.statmini .mc { grid-area: amt; align-self: end; margin: 0; padding-bottom: 6px; text-align: right; font-size: 13px; font-weight: 600; line-height: 1.35; color: var(--sb-text-muted); }
/* Tiles with a longer note put it under the number instead of beside it */
.statrow-stacked .statmini { grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "dot lab" "val val" "amt amt"; align-content: start; }
.statrow-stacked .statmini .mc { text-align: left; padding: 4px 0 0; font-weight: 500; }
.statmini.is-selected { background: var(--sb-ink); border-color: var(--sb-ink); color: #fff; }
.statmini.is-selected .ml, .statmini.is-selected .mc { color: #B9B6AF; }
.statmini.is-selected .mi { box-shadow: 0 0 0 3px rgba(255,255,255,.14); }

/* Trend cards: an ink line over a pale yellow area */
.trendrow { gap: 14px; margin-bottom: 24px; }
.trendcard { padding: 16px 18px; border-radius: var(--sb-radius-lg); gap: 16px; }
.trendcard .t-meta { min-width: 170px; }
.trendcard .t-lab { font-size: 13px; font-weight: 600; }
.trendcard .t-val { display: flex; align-items: center; gap: 8px; margin-top: 2px; font-family: var(--sb-font-brand); font-size: 24px; font-weight: 800; letter-spacing: -.02em; white-space: nowrap; }
.trendcard .t-sub { font-size: 12px; }
.trendcard .chart-mini { height: 64px; }
.chart-mini .line { stroke: var(--sb-ink); stroke-width: 2.5; }
.chart-mini .area { fill: var(--sb-primary-soft); fill-opacity: .6; }
.chart-mini .dot { stroke: var(--sb-ink); }
.t-val .delta { font: 700 12px var(--sb-font-ui); letter-spacing: 0; padding: 2px 7px; border-radius: 99px; }
.t-val .delta.up { background: var(--sb-success-soft); }
.t-val .delta.down { background: var(--sb-danger-soft); }

/* State tabs in the card header; the count sits in a small pill */
.tabs { gap: 4px; padding: 0 12px; overflow-x: auto; scrollbar-width: none; }
.tabs button {
  position: relative; display: flex; align-items: center; gap: 7px; height: 50px; padding: 0 12px;
  border: 0; background: transparent; font: inherit; font-size: 13.5px; font-weight: 600;
  color: var(--sb-text-muted); white-space: nowrap; cursor: pointer;
}
.tabs button small { font-size: 11px; font-weight: 700; color: var(--sb-text-faint); background: var(--sb-bg); padding: 1px 7px; border-radius: 99px; }
.tabs button:hover, .tabs button.active { color: var(--sb-text); }
.tabs button.active::after {
  content: ''; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 3px;
  border-radius: 3px 3px 0 0; background: var(--sb-signal);
}
.tabs button.active small { background: var(--sb-ink); color: #fff; }
.tabs button:focus-visible { outline: 2px solid var(--sb-ink); outline-offset: -2px; border-radius: 6px; }

/* Toolbar and table */
.toolbar { padding: 14px 16px; }
.toolbar .field-search { flex: 1; max-width: 340px; background: var(--sb-surface); }
.tbl thead th, .th-sort { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; }
.tbl thead th { padding: 11px 14px; }
.th-sort { padding: 11px 14px; }
.tbl tbody td { padding: 13px 14px; border-bottom-color: #F1EFEA; font-size: 13.5px; }
/* Numbers, states and amounts stay on one line; names and texts may wrap */
.tbl-cards tbody td:is([data-cell="amount"], [data-cell="status"], [data-cell="status2"], [data-cell="meta"], .num) { white-space: nowrap; }
.tbl-cards tbody td[data-cell="sub"] { min-width: 190px; }
/* A long column title may take two lines rather than widen the table */
.tbl-months thead th, .tbl-months .th-sort { white-space: normal; }
/* A long e-mail in the main cell breaks instead of pushing the last columns out of the card */
.tbl-cards tbody td[data-cell="title"] { overflow-wrap: anywhere; }
.cell-strong { font-weight: 600; }
.order-no { font-family: var(--sb-font-brand); font-size: 13px; font-weight: 700; letter-spacing: -.01em; color: var(--sb-ink); }
.order-no .hash { color: var(--sb-text-faint); font-weight: 600; }
.amount { font-weight: 700; font-variant-numeric: tabular-nums; }
.cust { gap: 10px; }
.cust-avatar { width: 32px; height: 32px; font: 700 11.5px var(--sb-font-brand); background: #F0EEE9; color: #5E5B54; }
/* Kind of an order or item under its text: a small marker, a round yellow one for custom work */
.cell-sub .badge-kind {
  display: inline-flex; align-items: center; gap: 5px; padding: 0; margin-right: 8px; background: transparent;
  font-size: 11.5px; font-weight: 600; color: var(--sb-text-muted);
}
.cell-sub .badge-kind::before { content: ''; width: 6px; height: 6px; border-radius: 2px; background: var(--sb-border-strong); }
.cell-sub .badge-kind.is-custom::before { background: var(--sb-signal); border-radius: 50%; }

/* States as chips with a dot; payment is just a coloured dot and word */
.chip { height: 24px; padding: 0 10px 0 8px; font-weight: 600; }
.chip::before { width: 7px; height: 7px; }
.chip-confirmed { background: var(--sb-amber-soft); color: var(--sb-amber-text); }
.chip-ready     { background: var(--sb-violet-soft); color: var(--sb-violet); }
/* Payment as a chip is a coloured dot and word without a fill, as in the brand guide */
.chip.chip-paid, .chip.chip-unpaid { background: transparent; padding-left: 0; }
.paystate { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.paystate::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.paystate.is-paid { color: var(--sb-success); }
.paystate.is-unpaid { color: var(--sb-danger); }
.pager button.active { background: var(--sb-ink); border-color: var(--sb-ink); font-weight: 600; }
/* Home tiles and choice cards */
.stat-value { font-family: var(--sb-font-brand); font-size: 30px; font-weight: 800; letter-spacing: -.03em; line-height: 1.15; }
.stat-label { font-weight: 600; }
.radio-card .t, .radio-card .s { display: block; }
.radio-card .t { font-weight: 600; }
/* A narrow list drops the delivery column first; the open column filters bring it back.
   Only above the phone layout: a container would trap the fixed filter sheet. */
@media (min-width: 641px) {
  .card:has(> .table-wrap > .tbl-cards) { container-type: inline-size; }
  @container (max-width: 1240px) {
    .table-wrap:not(:has(.tbl-filters)) .col-delivery { display: none; }
  }
}

@media (max-width: 980px) {
  .statmini .mv { font-size: 26px; }
  .trendcard .t-meta { min-width: 140px; }
}
@media (max-width: 640px) {
  .page-title { font-size: 24px; }
  .statrow, .statrow.statrow-fluid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
  .statmini { grid-template-areas: "dot lab" "val val"; grid-template-columns: auto minmax(0, 1fr); padding: 12px 14px; border-radius: var(--sb-radius); }
  .statmini .mv { font-size: 24px; margin-top: 4px; }
  .trendcard { padding: 12px 14px; flex-wrap: wrap; gap: 8px; }
  .trendcard .t-meta { min-width: 0; flex: 1 1 100%; }
  .trendcard .chart-mini { flex: 1 1 100%; }
  .trendcard .t-val { font-size: 20px; }
  .trendcard .chart-mini { height: 40px; }
  .tabs { padding: 0 6px; }
  .tabs button { height: 46px; padding: 0 10px; }
  .tbl-cards tbody td { white-space: normal; }
  .tbl-cards tbody td[data-cell="sub"] { min-width: 0; }
}

/* ═══════════════ Linka forms and detail screens (DEC-036) ═══════════════
   Fields, alerts, choices and the state timeline follow the components of the brand
   guide (docs/design/brand-redesign/index.html, section Komponenty). */
.card-title { font-weight: 700; letter-spacing: -.01em; }
.field label, .field .lbl { font-size: 13.5px; font-weight: 600; margin-bottom: 7px; }
.field .hint { font-size: 12.5px; color: var(--sb-text-muted); }
/* Stacked fields keep a gap; grids space their own cells */
:not(.form-grid, .grid-2, .grid-3) > .field + .field,
:not(.form-grid, .grid-2, .grid-3) > .field + .grid-2,
:not(.form-grid, .grid-2, .grid-3) > .grid-2 + .field { margin-top: 18px; }
.input { min-height: 46px; padding: 10px 14px; border-width: 1.5px; border-radius: 12px; }
.input svg { color: var(--sb-text-faint); }
.input input::placeholder, .cell-input::placeholder, .field-search input::placeholder { color: #9C988E; }
.input.focused, .field .input:focus-within, .auth-card .input:focus-within, .auth-card .input.focused {
  border-color: var(--sb-ink); box-shadow: var(--sb-focus);
}
.field .input:has(input.invalid):focus-within { box-shadow: 0 0 0 4px rgba(201,58,34,.16); }
.cell-input { border-color: var(--sb-border-strong); border-radius: 9px; }
.field-search { background: var(--sb-surface); border-radius: 10px; }
.field-search:focus-within { border-color: var(--sb-ink); box-shadow: var(--sb-focus); }
.field .field-search { min-height: 46px; border-width: 1.5px; border-color: var(--sb-border-strong); border-radius: 12px; padding: 10px 14px; }
.cell-input:focus, .col-filter:focus, .select:focus {
  border-color: var(--sb-ink); box-shadow: var(--sb-focus);
}
/* Selects share the field look; outside a table cell they are as tall as a text field */
.select, select.cell-input {
  appearance: none; padding-right: 34px; cursor: pointer;
  background: var(--sb-surface) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239C988E' stroke-width='2.4' stroke-linecap='round'><path d='m6 9 6 6 6-6'/></svg>") no-repeat right 12px center;
}
.select { border-width: 1.5px; border-radius: 12px; font-weight: 500; }
:not(td) > select.cell-input { min-height: 46px; padding: 10px 34px 10px 14px; border-width: 1.5px; border-radius: 12px; }
select.cell-input:disabled { background-color: var(--sb-surface-alt); cursor: default; }
/* A month field keeps the look of a select but has its own picker icon, not the chevron */
input.select { background-image: none; padding-right: 12px; }
.toolbar > .spacer { margin-left: auto; }
.toolbar .icon-btn.active { background: var(--sb-primary-soft); color: var(--sb-ink); }

/* Alerts: soft fills without a frame */
.banner { border: 0; border-radius: 14px; font-size: 14px; }
.banner svg { width: 19px; height: 19px; }
.banner strong { font-weight: 650; }
.banner-info    { color: #1B4FB3; }
.banner-success { color: #11663A; }
.banner-warning { color: #8A5000; }
.banner-neutral { background: var(--sb-neutral-soft); }

/* Choices: an ink ring with a yellow centre, the chosen card on a pale yellow */
.radio-card { border-width: 1.5px; border-radius: 12px; }
.radio-card.selected { border-color: var(--sb-ink); background: var(--sb-primary-tint); }
.radio-dot { width: 20px; height: 20px; min-width: 20px; min-height: 20px; flex-basis: 20px; margin-top: 0; }
.radio-card.selected .radio-dot { border: 6px solid var(--sb-ink); background: var(--sb-signal); }
.radio-card.selected .radio-dot::after { display: none; }
.checkbox { width: 20px; height: 20px; }
.checkbox.checked { background-color: var(--sb-ink); border-color: var(--sb-ink); }
.checkbox.checked::after {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23F5B82E' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'><path d='M5 12.5l4.6 4.6L19 7.4'/></svg>");
}

.check-row input[type="checkbox"] { width: 20px; height: 20px; border-width: 1.5px; border-radius: 6px; }
.check-row input[type="checkbox"]:checked::after { border-color: var(--sb-signal); border-width: 0 0 2.5px 2.5px; }
.check-row input[type="checkbox"]:focus-visible { outline: 0; box-shadow: var(--sb-focus); }

/* State timeline: passed stops are ink, the current stop is yellow in an ink ring */
.timeline::before { background: var(--sb-border-strong); }
.tl-item::before { width: 12px; height: 12px; left: -23px; top: 3px; }
.tl-item.done::before { background: var(--sb-ink); border-color: var(--sb-ink); }
.tl-item.current::before { background: var(--sb-signal); border: 3px solid var(--sb-ink); box-shadow: 0 0 0 4px var(--sb-primary-soft); }
.tl-title { font-weight: 600; }

/* Price summary: the total in display type */
.sum-row.total { font-size: 18px; font-weight: 800; letter-spacing: -.02em; }
.actionbar .ab-val { font-weight: 800; letter-spacing: -.02em; }

@media (max-width: 640px) {
  :not(td) > select.cell-input { min-height: 44px; }
  /* The search keeps the room; the count of the list is in its footer */
  .toolbar > .spacer { margin-left: 0; gap: 2px !important; }
  .toolbar > .spacer > .muted { display: none; }
}

/* ═══════════════ Clickable table rows ═══════════════
   A click anywhere on a row opens the record, the same as its main link: the link stretches
   over the row. Checkboxes, other links and buttons in the row stay above it. */
.tbl tbody tr:has(.row-link) { position: relative; cursor: pointer; }
.tbl .row-link::after { content: ''; position: absolute; inset: 0; }
.tbl tbody tr:has(.row-link) :is(a:not(.row-link), button, input, select, textarea, label, .checkbox) { position: relative; z-index: 1; }
.tbl .row-link:focus-visible { outline: 0; }
.tbl tbody tr:has(.row-link:focus-visible) { outline: 2px solid var(--sb-ink); outline-offset: -2px; }

/* A select or text area placed inside a field box takes the box's look instead of drawing its own */
.input > select, .input > .select {
  flex: 1; min-width: 0; width: 100%; min-height: 0; padding: 0 26px 0 0; border: 0; border-radius: 0;
  box-shadow: none !important; background-color: transparent; font-size: inherit; font-weight: 400;
  background-position: right 0 center;
}
.input:has(> textarea) { align-items: flex-start; }
.input > textarea {
  flex: 1; width: 100%; min-height: 64px; border: 0; outline: 0; background: transparent; resize: vertical;
  font: inherit; color: var(--sb-text);
}
.input > textarea::placeholder, .card-body > textarea::placeholder { color: #9C988E; }
/* A free text area straight in a card */
.card-body > textarea {
  display: block; width: 100%; min-height: 96px; padding: 12px 14px; resize: vertical;
  border: 1.5px solid var(--sb-border-strong); border-radius: 12px; background: var(--sb-surface);
  font: inherit; color: var(--sb-text); outline: 0;
}
.card-body > textarea:focus { border-color: var(--sb-ink); box-shadow: var(--sb-focus); }

/* File choice: a branded button over the hidden native input */
.file-btn { position: relative; cursor: pointer; }
.file-btn .file-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font-size: 0; }
.file-btn:focus-within { border-color: var(--sb-ink); box-shadow: var(--sb-focus); }
.file-btn:has(.file-input:disabled) { opacity: .55; cursor: default; }
/* A native select inside a field box gets the brand chevron */
.input > select {
  appearance: none; cursor: pointer; outline: 0; color: var(--sb-text);
  background: transparent url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239C988E' stroke-width='2.4' stroke-linecap='round'><path d='m6 9 6 6 6-6'/></svg>") no-repeat right 0 center;
}
/* Row actions stay side by side */
.tbl tbody td[data-cell="actions"] { white-space: nowrap; }
.tbl tbody td[data-cell="actions"] > .btn + .btn { margin-left: 6px; }
@media (max-width: 640px) { .tbl tbody td[data-cell="actions"] { white-space: normal; } }
.file-btn + .hint { margin-top: 8px; font-size: 12.5px; color: var(--sb-text-muted); }
.sheet-head h2, .modal-head h2, .modal h2 { font-weight: 700; letter-spacing: -.01em; }

/* ═══════════════ Platform administration shell ═══════════════ */
.platform-badge {
  display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 7px;
  background: var(--sb-ink); color: #fff; font: 700 11px var(--sb-font-brand); letter-spacing: .04em;
}
.platform-nav { display: flex; gap: 6px; }
.platform-nav .btn { color: var(--sb-text-muted); }
.platform-nav .btn:hover { color: var(--sb-text); }
.platform-nav .btn.is-active { color: var(--sb-ink); background: var(--sb-primary-soft); }

/* ─────────────────────────── Terms of service consent ───────────────────────────
   The acceptance on the registration, invitation, organisation and terms screens and the
   links to the terms and the privacy policy on the landing page. */
.consent { display: grid; gap: 6px; margin-top: 4px; }
.consent .check-row { align-items: flex-start; line-height: 1.45; }
.consent .check-row input[type="checkbox"] { margin-top: 1px; }
.legal-links { display: inline-flex; flex-wrap: wrap; gap: 8px; font-size: 13px; color: var(--sb-text-faint); }
.legal-links a { color: var(--sb-text-muted); text-decoration: underline; text-underline-offset: 3px; }
.legal-links a:hover { color: var(--sb-text); }
.consent-links { padding-left: 27px; }
.auth-legal { justify-content: center; margin-top: 18px; }
.about-legal { display: flex; margin-top: 10px; }
