:root {
  color-scheme: light;
  font-family: "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  background: #f5f6fa;
  color: #171c34;
  font-synthesis: none;
  --canvas: #f5f6fa;
  --surface: #fff;
  --surface-soft: #f7f8fc;
  --ink: #171c34;
  --muted: #565e74;
  --line: #e1e5ef;
  --line-strong: #cbd1df;
  --navy: #242447;
  --navy-raised: #353568;
  --navy-deep: #17172f;
  --nav-text: #454d64;
  --brand-accent: #bab7fe;
  --primary: #4644b0;
  --primary-hover: #39378f;
  --primary-soft: #eeedfb;
  --blue-soft: var(--primary-soft);
  --focus: #5755cf;
  --radius: 13px;
  --shadow: 0 1px 2px #171c3409, 0 6px 18px #27305804;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  min-width: 280px;
  margin: 0;
  font-size: 1rem;
  line-height: 1.48;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button[disabled] { cursor: not-allowed; opacity: .6; }
a { color: var(--primary); }
a, button { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

:where(button, a, input, select, textarea, summary):focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  inset: .65rem auto auto 1rem;
  z-index: 100;
  padding: .65rem .9rem;
  transform: translateY(-160%);
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.skip-link:focus { transform: translateY(0); }

.shell {
  display: grid;
  grid-template-columns: 246px minmax(0, 1fr);
  min-height: 100dvh;
}

.sidebar {
  position: sticky;
  inset-block-start: 0;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: auto;
  border-inline-end: 1px solid var(--line);
  color: var(--ink);
  background: var(--surface);
}

.brand {
  display: flex;
  align-items: center;
  gap: .76rem;
  padding: 1.24rem .15rem 1.2rem;
  margin: 0 1.08rem .77rem;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  position: relative;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid #5553bd;
  border-radius: 11px;
  background: var(--primary);
  box-shadow: inset 0 1px 0 #ffffff26, 0 2px 4px #382d962b;
  color: #fff;
}

.brand-glyph {
  position: relative;
  display: block;
  width: 20px;
  height: 16px;
  border-inline: 3px solid currentColor;
  border-radius: 1px;
}

.brand-glyph::before, .brand-glyph::after {
  position: absolute;
  inset-block-start: 0;
  width: 3px;
  height: 12px;
  border-radius: 1px;
  background: currentColor;
  transform-origin: top center;
  content: "";
}

.brand-glyph::before { inset-inline-start: -2px; transform: rotate(-39deg); }
.brand-glyph::after { inset-inline-end: -2px; transform: rotate(39deg); }

.brand-text, .profile-info { display: grid; min-width: 0; }

.brand-text strong {
  font-size: 1.15rem;
  font-weight: 770;
  line-height: 1.16;
  letter-spacing: -.035em;
}

.brand-text small {
  margin-top: .17rem;
  color: var(--muted);
  font-size: .78rem;
  white-space: nowrap;
}

.navigation {
  display: grid;
  align-content: start;
  gap: .24rem;
  padding: .12rem .82rem 1rem;
}

.section-nav-label {
  display: block;
  padding: .84rem .57rem .26rem;
  color: var(--muted);
  font-size: .73rem;
  font-weight: 700;
  letter-spacing: .062em;
  text-transform: uppercase;
}

.section-nav-label:first-child { padding-top: .4rem; }

.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: .67rem;
  min-height: 43px;
  padding: .54rem .63rem;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--nav-text);
  text-decoration: none;
  font-size: .91rem;
  font-weight: 620;
  line-height: 1.2;
}

.nav-link:hover, .logout:hover { color: var(--ink); background: var(--surface-soft); }
.nav-link .icon { color: #69738c; }

.nav-link[aria-current="page"], .nav-link.hr-entry[aria-current="location"] {
  border-color: #e9e6fb;
  color: var(--primary-hover);
  background: var(--primary-soft);
  font-weight: 680;
}

.nav-link[aria-current="page"]::before, .nav-link.hr-entry[aria-current="location"]::before {
  position: absolute;
  inset: .65rem auto .65rem -1px;
  width: 3px;
  border-radius: 4px;
  background: var(--primary);
  content: "";
}

.nav-link[aria-current="page"] .icon, .nav-link.hr-entry[aria-current="location"] .icon { color: var(--primary); }

.nav-link.hr-entry { margin-top: .55rem; }

.icon {
  width: 19px;
  height: 19px;
  flex: 0 0 19px;
  vertical-align: middle;
}

.sidebar-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: .76rem .68rem .83rem .84rem;
  margin-top: auto;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.profile { display: flex; align-items: center; gap: .59rem; min-width: 0; }

.avatar {
  display: grid;
  flex: 0 0 34px;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid #e5e1f9;
  border-radius: 9px;
  background: var(--primary-soft);
  color: var(--primary-hover);
  font-size: .81rem;
  font-weight: 750;
}

.profile-info strong {
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .85rem;
}

.profile-info small { color: var(--muted); font-size: .75rem; }

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
}

.icon-button:hover { background: var(--surface-soft); color: var(--ink); }
.logout { flex: 0 0 38px; }

.main-shell { min-width: 0; }

.topbar {
  position: sticky;
  inset-block-start: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  gap: .7rem;
  padding: .64rem clamp(1rem, 2.55vw, 2.45rem);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.topbar-start, .topbar-end { display: flex; align-items: center; gap: .72rem; }
.topbar-title { overflow-wrap: anywhere; font-size: .96rem; font-weight: 720; letter-spacing: -.018em; }

.today-date {
  padding: .34rem .52rem;
  color: var(--muted);
  font-size: .85rem;
  font-weight: 600;
  white-space: nowrap;
}

.menu-toggle, .menu-backdrop { display: none; }

#content {
  width: 100%;
  max-width: 1500px;
  min-width: 0;
  padding: clamp(1.15rem, 2.65vw, 2.5rem);
  margin-inline: auto;
  scroll-margin-top: 76px;
}

#content:focus { outline: none; }

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: .7rem 1rem;
  margin-bottom: 1.5rem;
}

.page-heading h1 {
  margin: 0;
  font-size: clamp(1.75rem, 2.5vw, 2.45rem);
  line-height: 1.1;
  letter-spacing: -.046em;
  overflow-wrap: anywhere;
}

.page-heading p {
  max-width: 43rem;
  margin: .35rem 0 0;
  color: var(--muted);
  font-size: .98rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .43rem;
  min-height: 43px;
  padding: .48rem .88rem;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: .89rem;
  font-weight: 680;
  line-height: 1.25;
  white-space: nowrap;
  text-decoration: none;
}

.button .icon { width: 16px; height: 16px; flex-basis: 16px; }
.primary { background: var(--primary); color: #fff; border-color: var(--primary); box-shadow: 0 1px 2px #25235e28; }
.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.secondary { color: var(--ink); background: var(--surface); border-color: var(--line-strong); }
.secondary:hover { color: var(--primary-hover); background: var(--primary-soft); border-color: #c8c5ee; }
.quiet { color: var(--primary-hover); background: transparent; }
.quiet:hover { background: var(--primary-soft); }

.text-button {
  padding: .31rem .12rem;
  border: 0;
  background: none;
  color: var(--primary);
  font-size: .85rem;
  font-weight: 660;
  white-space: nowrap;
  text-decoration: none;
}

.text-button:hover { text-decoration: underline; }
.action-row { display: flex; flex-wrap: wrap; gap: .52rem; }

.dashboard-hero {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  justify-content: space-between;
  overflow: hidden;
  min-height: 148px;
  gap: 1.15rem;
  padding: clamp(1.18rem, 2.7vw, 2.45rem);
  border: 1px solid #303056;
  border-radius: var(--radius);
  background: linear-gradient(108deg, var(--navy-deep), var(--navy));
}

.dashboard-hero::before, .dashboard-hero::after {
  position: absolute;
  z-index: -1;
  pointer-events: none;
  content: "";
}
.dashboard-hero::before {
  inset: 0 0 0 30%;
  background-image: radial-gradient(circle, #e7e5ff36 1px, transparent 1.5px);
  background-size: 17px 17px;
  mask-image: linear-gradient(90deg, transparent, #000 72%);
}
.dashboard-hero::after {
  width: 31rem;
  height: 22rem;
  inset: -7.8rem -7rem auto auto;
  border: 1px solid #b9b6fe23;
  border-radius: 50%;
  box-shadow: 0 0 0 28px #b9b6fe12, 0 0 0 60px #b9b6fe09;
  transform: rotate(-27deg);
}

.dashboard-hero h1, .dashboard-hero h2 {
  margin: 0;
  color: #fff;
  font-size: clamp(1.72rem, 3.2vw, 2.75rem);
  line-height: 1.06;
  letter-spacing: -.058em;
}

.dashboard-hero p {
  margin: .55rem 0 0;
  color: #d5d7ee;
  font-size: .94rem;
}

.dashboard-hero .action-row { flex-shrink: 0; }
.dashboard-hero .primary { border-color: #fff; background: #fff; color: var(--primary-hover); }
.dashboard-hero .primary:hover { background: #efedff; }
.dashboard-hero .secondary { border-color: #8b89ab; background: #363657; color: #fff; }
.dashboard-hero .secondary:hover { border-color: #c6c5e3; background: #47466b; }
.dashboard-hero :focus-visible { outline-color: var(--brand-accent); }

.ready-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .42rem;
  color: #356158;
  font-size: .85rem;
  font-weight: 600;
}

.ready-line .icon { width: 16px; height: 16px; flex-basis: 16px; }

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .92rem;
  margin: .95rem 0 1.18rem;
}

.stat {
  display: flex;
  flex-direction: row-reverse;
  align-items: flex-start;
  justify-content: space-between;
  gap: .76rem;
  min-width: 0;
  min-height: 103px;
  padding: .91rem .95rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--ink);
  text-decoration: none;
}

.stat:hover { border-color: #b5b1ea; box-shadow: 0 2px 8px #35317316; }
.stat > span:not(.stat-icon) { display: flex; flex-direction: column-reverse; min-width: 0; }

.stat-icon {
  display: grid;
  flex: 0 0 38px;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid #e6e2fa;
  border-radius: 9px;
  background: var(--primary-soft);
  color: var(--primary);
}

.stat-icon.teal { border-color: #d7e8e3; background: #eaf5f0; color: #20614e; }
.stat-icon.amber { border-color: #f1e3c9; background: #fbf3e3; color: #865218; }
.stat-icon.violet { border-color: #e0e7ec; background: #f1f5f7; color: #4c667b; }
.stat-label { display: block; margin-bottom: .37rem; color: var(--muted); font-size: .85rem; font-weight: 610; line-height: 1.3; overflow-wrap: anywhere; }
.stat-value { font-size: clamp(1.62rem, 2.25vw, 2.06rem); font-weight: 750; letter-spacing: -.053em; line-height: 1; font-variant-numeric: tabular-nums; }

.dashboard-grid, .dashboard-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  align-items: start;
  gap: 1.08rem;
}

.dashboard-side, .order-work { display: grid; align-content: start; gap: .8rem; min-width: 0; }
.dashboard-history { margin-top: 1.08rem; }
.dashboard-history .ops-queue time {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: .83rem;
  font-weight: 620;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .52rem .8rem;
  min-height: 59px;
  padding: .72rem 1rem;
  border-bottom: 1px solid var(--line);
}

.panel-header h2 { margin: 0; font-size: 1.06rem; font-weight: 730; letter-spacing: -.024em; }
.panel-meta { color: var(--muted); font-size: .79rem; line-height: 1.3; }
.panel-content { padding: .83rem; }

.empty {
  display: grid;
  justify-items: center;
  gap: .29rem;
  padding: 1.55rem 1rem;
  color: var(--muted);
  text-align: center;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 41px;
  height: 41px;
  margin-bottom: .16rem;
  border: 1px solid #e8e5f6;
  border-radius: 9px;
  background: var(--primary-soft);
  color: var(--primary);
}

.empty strong { color: var(--ink); font-weight: 700; }
.empty p { max-width: 31rem; margin: 0; font-size: .85rem; }
.empty .button { margin-top: .31rem; }

.stack-list, .timeline-list, :is(ul, ol).ops-queue {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}

.stack-list > li, :is(ul, ol).ops-queue > li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .46rem;
  min-width: 0;
  padding: .61rem .83rem;
}

.stack-list > li + li, .timeline-list > li + li, :is(ul, ol).ops-queue > li + li {
  border-top: 1px solid var(--line);
}

.stack-main { display: grid; min-width: 0; gap: .14rem; overflow-wrap: anywhere; }
.stack-main strong, .agenda-row strong { font-size: .9rem; }
.stack-main small, .cell-meta, .muted { color: var(--muted); }
.stack-main .text-button { padding: 0; white-space: normal; }

.timeline-list > li, .agenda-row {
  display: grid;
  grid-template-columns: minmax(48px, auto) minmax(0, 1fr) auto;
  align-items: center;
  gap: .62rem;
  min-width: 0;
  padding: .62rem .83rem;
}

.agenda-row time, .agenda-time {
  color: var(--primary-hover);
  font-size: .84rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.agenda-row small { display: block; color: var(--muted); font-size: .79rem; }
.agenda-main { min-width: 0; overflow-wrap: anywhere; }
.agenda-main .text-button { padding: 0; white-space: normal; text-align: left; }
.agenda-date { max-width: 100%; padding: .32rem .45rem; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface-soft); color: var(--ink); font-size: .82rem; }
.ops-queue-row { min-width: 0; }
.ops-queue .text-button { white-space: normal; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: .32rem;
  min-height: 24px;
  width: fit-content;
  padding: .12rem .49rem;
  border: 1px solid transparent;
  border-radius: 99px;
  font-size: .73rem;
  font-weight: 720;
  white-space: nowrap;
}

.badge::before { width: 5px; height: 5px; border-radius: 50%; background: currentColor; content: ""; }
.badge.blue { border-color: #dce2fa; background: #edf0ff; color: #3d4c96; }
.badge.gray { border-color: #e1e5ef; background: #f1f3f8; color: #4f586e; }
.badge.green { border-color: #cce4db; background: #def1e8; color: #1f614d; }
.badge.amber { border-color: #ebd8b8; background: #faedd7; color: #754916; }
.badge.red { border-color: #f0d6dc; background: #faecef; color: #863447; }

.list-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .65rem;
  padding: .78rem .95rem;
  border-bottom: 1px solid var(--line);
}

.filters { display: flex; align-items: center; flex-wrap: wrap; gap: .53rem; }
.list-controls { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem; }
.list-pager { display: flex; align-items: center; gap: .32rem; }
.list-pager:empty { display: none; }
.list-pager .button { min-height: 34px; padding-block: .26rem; font-size: .8rem; }

.search-box {
  display: flex;
  align-items: center;
  gap: .44rem;
  max-width: 24rem;
  padding-inline-start: .53rem;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #fff;
  color: var(--muted);
}

.search-box input {
  display: block;
  width: 100%;
  min-height: 39px;
  padding: .43rem .49rem .43rem 0;
  border: 0;
  border-radius: inherit;
  background: transparent;
  color: var(--ink);
}

.search-box:focus-within { outline: 2px solid var(--focus); outline-offset: 1px; }
.search-box input:focus-visible { outline: none; }
.count { color: var(--muted); font-size: .81rem; white-space: nowrap; }
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: .92rem;
  white-space: nowrap;
}

th, td { padding: .65rem .95rem; border-bottom: 1px solid #e9ebf3; }

th {
  background: var(--surface-soft);
  color: var(--muted);
  font-size: .81rem;
  font-weight: 700;
  letter-spacing: .01em;
}

tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f8f8fd; }
th:last-child, td:last-child { text-align: right; }
td a { color: var(--primary-hover); font-weight: 660; text-decoration: none; }
td a:hover { text-decoration: underline; }

.cell-meta {
  display: block;
  overflow: hidden;
  max-width: 22rem;
  color: var(--muted);
  text-overflow: ellipsis;
  font-size: .78rem;
}

.row-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: .33rem; }
.row-actions .button { min-height: 36px; }

.invoice-note {
  padding: .61rem .77rem;
  margin: 0 0 .85rem;
  border: 1px solid #e8d7b9;
  border-radius: 8px;
  background: #fff8eb;
  color: #6d4d26;
  font-size: .89rem;
}

.invoice-table td { vertical-align: top; }
.invoice-reference { display: grid; min-width: 0; overflow-wrap: anywhere; }
.invoice-reference .cell-meta, .invoice-message { white-space: normal; overflow-wrap: anywhere; }
.invoice-message { margin-top: .22rem; }

.vin {
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
  white-space: normal;
}

.plate {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .095rem .39rem;
  border: 1px solid #c3d2dc;
  border-inline-start: 3px solid #7899a9;
  border-radius: 4px;
  background: #f7fafa;
  font-size: .79rem;
  font-weight: 780;
  letter-spacing: .035em;
}

.dialog {
  width: min(610px, calc(100vw - 1.4rem));
  max-height: calc(100dvh - 1.4rem);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 20px 54px #0c223554;
}

.dialog::backdrop { background: #0c1f30a8; }

.dialog-header {
  position: sticky;
  inset-block-start: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .72rem;
  padding: .6rem .75rem .6rem 1rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.dialog-header h2 { margin: 0; font-size: 1.17rem; letter-spacing: -.027em; }
.dialog-body { padding: .92rem 1rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .73rem; }
.field { display: grid; align-content: start; gap: .27rem; min-width: 0; }
.field-wide { grid-column: 1 / -1; }
.field label { font-size: .845rem; font-weight: 680; }

.billing-details { border: 1px solid var(--line); border-radius: 8px; }
.billing-details summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  padding: .46rem .65rem;
  border-radius: 8px;
  list-style: none;
  font-size: .89rem;
  font-weight: 700;
  cursor: pointer;
}

.billing-details summary::-webkit-details-marker { display: none; }
.billing-details summary::after { color: var(--primary); font-size: 1.15rem; line-height: 1; content: "+"; }
.billing-details[open] summary::after { content: "−"; }
.billing-content { padding: .65rem; border-top: 1px solid var(--line); }
.billing-content > p { margin: 0 0 .65rem; }
.billing-content > p, .billing-hint { color: var(--muted); font-size: .82rem; }
.billing-hint { margin: -.39rem 0 0; }
.billing-type-fields { display: contents; }

.control, .filters select {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: .43rem .59rem;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background-color: var(--surface);
  color: var(--ink);
}

.control:disabled { background: var(--surface-soft); color: var(--muted); }

select.control, .filters select {
  appearance: none;
  padding-inline-end: 1.95rem;
  background-image: linear-gradient(45deg, transparent 50%, #536d7b 51%),
    linear-gradient(135deg, #536d7b 50%, transparent 51%);
  background-position: right .91rem center, right .57rem center;
  background-size: .34rem .34rem;
  background-repeat: no-repeat;
}

.filters select { width: auto; min-height: 40px; font-size: .85rem; }
textarea.control { min-height: 79px; resize: vertical; }
input[type="file"].control { padding: .32rem; }

input[type="file"]::file-selector-button {
  margin-inline-end: .44rem;
  padding: .29rem .51rem;
  border: 0;
  border-radius: 5px;
  background: var(--primary-soft);
  color: var(--primary-hover);
  cursor: pointer;
}

.form-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: .47rem; margin-top: .77rem; }
.form-error { margin: .65rem 0 0; color: #8f293d; font-size: .86rem; }
.appointment-summary { display: grid; gap: .2rem; margin: 0 0 .8rem; color: var(--muted); overflow-wrap: anywhere; }
.appointment-summary strong { color: var(--ink); }
.appointment-summary .button, .appointment-summary .plate { justify-self: start; }
.related-field { display: grid; gap: .32rem; align-content: start; min-width: 0; }
.related-field .button { justify-self: start; min-height: 32px; padding-block: .25rem; }
.tariff-filters {
  display: grid;
  grid-template-columns: minmax(8rem, 1fr) minmax(5.5rem, .4fr) minmax(10rem, 1.2fr);
  gap: .75rem;
  margin-bottom: .9rem;
}
.tariff-table th[scope="row"] { font-weight: 590; text-align: left; }
@media (max-width: 600px) {
  .tariff-filters { grid-template-columns: minmax(0, 1fr) minmax(0, .55fr); }
  .tariff-filters .field:last-child { grid-column: 1 / -1; }
  .tariff-table th[scope="row"] { padding: 0; border: 0; background: none; }
}

.toast {
  position: fixed;
  inset: auto 1rem 1rem auto;
  z-index: 40;
  max-width: min(29rem, calc(100vw - 2rem));
  padding: .63rem .82rem;
  border: 1px solid #4f4b8d;
  border-radius: 8px;
  background: var(--navy);
  box-shadow: 0 8px 22px #17172f31;
  color: #fff;
  overflow-wrap: anywhere;
}

.toast.error { border-color: #a24e5c; background: #873244; }
.loading { padding: 1.4rem .8rem; color: var(--muted); }
.details-top { display: grid; gap: .43rem; margin-bottom: .73rem; }
.details-top .page-heading { margin: 0; }
.details-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: .8rem; }
.record { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .62rem .85rem; margin: 0; }
.record div { min-width: 0; }
.record dt { color: var(--muted); font-size: .76rem; font-weight: 680; }
.record dd { margin: .11rem 0 0; font-size: .91rem; overflow-wrap: anywhere; }

.photo-form { padding-bottom: .71rem; margin-bottom: .71rem; border-bottom: 1px solid var(--line); }
.camera-choice { position: relative; display: flex; align-items: center; flex-wrap: wrap; gap: .45rem; margin-top: .56rem; overflow-wrap: anywhere; }
.camera-choice label { cursor: pointer; }
.camera-choice input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.camera-choice:has(input:focus-visible) label { outline: 2px solid var(--focus); outline-offset: 2px; }
.upload-note { margin-inline-end: auto; color: var(--muted); }
.photo-form .form-actions { align-items: center; }
.gallery { display: grid; gap: .7rem; }
.photo-group h3 { margin: .18rem 0 .44rem; font-size: .89rem; }
.photo-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; }
.photo { display: grid; gap: .2rem; min-width: 0; color: var(--ink); text-decoration: none; }
.photo img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-soft); }
.photo span { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; font-size: .76rem; }
.photo:hover span { color: var(--primary); text-decoration: underline; }

@media (max-width: 1130px) {
  .shell { grid-template-columns: 215px minmax(0, 1fr); }
  .stat { gap: .52rem; padding-inline: .73rem; }
  .stat-icon { flex-basis: 32px; width: 32px; height: 32px; }
}

@media (max-width: 850px) {
  .shell { display: block; }

  .sidebar {
    position: fixed;
    z-index: 35;
    inset: 0 auto 0 0;
    width: min(17rem, 88vw);
    visibility: hidden;
    transform: translateX(-101%);
    transition: transform 160ms ease, visibility 160ms;
    box-shadow: 12px 0 34px #10253328;
  }

  .sidebar.open { visibility: visible; transform: translateX(0); }
  .menu-backdrop { position: fixed; z-index: 30; inset: 0; display: block; border: 0; background: #0c213480; }
  .menu-toggle { display: inline-grid; margin-inline-start: -.32rem; }
  .topbar { min-height: 60px; }
  .nav-link { min-height: 44px; }
}

@media (max-width: 700px) {
  .dashboard-grid, .dashboard-workspace, .details-grid { grid-template-columns: 1fr; }
  .dashboard-hero { align-items: flex-start; flex-direction: column; min-height: auto; }
  .dashboard-hero .action-row { flex-shrink: 1; }
  .page-heading { align-items: flex-start; }
  .page-heading .button { flex-shrink: 0; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
  .table-wrap, table, tbody { display: block; }

  thead {
    position: absolute;
    overflow: hidden;
    width: 1px;
    height: 1px;
    clip-path: inset(50%);
  }

  tbody tr {
    display: grid;
    gap: .46rem;
    padding: .71rem .68rem;
    border-bottom: 1px solid var(--line);
  }

  tbody tr:last-child { border-bottom: 0; }

  td, td:last-child {
    display: grid;
    grid-template-columns: minmax(6.9rem, .56fr) minmax(0, 1fr);
    align-items: start;
    gap: .13rem .36rem;
    min-width: 0;
    padding: 0;
    border-bottom: 0;
    white-space: normal;
    text-align: left;
    overflow-wrap: anywhere;
  }

  td::before {
    grid-row: 1 / span 3;
    color: var(--muted);
    font-size: .74rem;
    font-weight: 680;
    content: attr(data-label);
  }

  td .button, td .badge, td .plate { justify-self: start; }
  td .cell-meta { grid-column: 2; white-space: normal; }
  .row-actions { justify-content: start; }
  .invoice-reference .cell-meta { grid-column: 1; }
  .table-wrap table { white-space: normal; }
}

@media (max-width: 470px) {
  #content { padding: .95rem .8rem 1.25rem; }
  .today-date { display: none; }
  .topbar-start, .topbar-end { gap: .26rem; }
  .topbar { padding-inline: .7rem; }
  .topbar-start { min-width: 0; }
  .topbar-title { font-size: .84rem; }
  .page-heading { flex-wrap: wrap; }
  .stats { gap: .61rem; margin-block: .82rem .88rem; }
  .stat { min-height: 84px; padding: .65rem; }
  .stat-label { font-size: .77rem; }
  .stat-icon { flex-basis: 29px; width: 29px; height: 29px; }
  .stat-icon .icon { width: 16px; height: 16px; flex-basis: 16px; }
  .panel-header, .panel-content { padding-inline: .67rem; }
  .list-toolbar { align-items: flex-start; padding-inline: .67rem; }
  .filters { min-width: 0; flex: 1 1 100%; }
  .list-pager .button { min-height: 44px; }
  .search-box { width: 100%; }
  .form-grid { grid-template-columns: 1fr; gap: .64rem; }
  .dialog-body { padding: .72rem; }
  .button { min-height: 44px; }
  .row-actions .button { min-height: 42px; }
  .filters select, .control { font-size: 1rem; }
}

.search-entry[aria-current="page"] {
  border-color: #c8c5ee;
  background: var(--primary-soft);
  color: var(--primary-hover);
}

.record-search {
  margin-bottom: 1rem;
  padding: clamp(.75rem, 2.3vw, 1.2rem);
}

.record-search-form { display: grid; gap: .36rem; }
.record-search-form label { font-size: .85rem; font-weight: 690; }
.record-search-input { position: relative; display: flex; gap: .55rem; }
.record-search-input > .icon {
  position: absolute;
  inset-inline-start: .76rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
.record-search-input input {
  width: 100%;
  min-width: 0;
  min-height: 45px;
  padding-inline-start: 2.38rem;
}
.record-search-input .button { min-width: 4.9rem; }

.record-search-kinds { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .72rem; }
.record-search-kinds .button {
  min-height: 38px;
  padding-inline: .64rem;
  border-color: var(--line);
  font-size: .8rem;
}
.record-search-kinds .button[aria-pressed="true"] {
  border-color: #c8c5ee;
  background: var(--primary-soft);
  color: var(--primary-hover);
}

.record-search-list { margin: 0; padding: 0; list-style: none; }
.record-search-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) minmax(12rem, .5fr);
  align-items: start;
  gap: .77rem;
  padding: .85rem clamp(.75rem, 2.3vw, 1.2rem);
  border-bottom: 1px solid var(--line);
}
.record-search-row:last-child { border-bottom: 0; }
.record-search-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 9px;
  background: var(--primary-soft);
  color: var(--primary-hover);
}
.record-search-main { min-width: 0; }
.record-search-type {
  display: block;
  margin-bottom: .12rem;
  color: var(--muted);
  font-size: .75rem;
  font-weight: 650;
}
.record-search-title {
  color: var(--ink);
  font-size: 1rem;
  font-weight: 730;
  text-decoration: none;
  overflow-wrap: anywhere;
}
.record-search-title:hover { color: var(--primary-hover); text-decoration: underline; }
.record-search-relations { display: flex; flex-wrap: wrap; gap: .2rem .8rem; padding: 0; margin: .26rem 0 0; list-style: none; }
.record-search-relations li { color: var(--muted); font-size: .8rem; overflow-wrap: anywhere; }
.record-search-relations .text-button { font-size: inherit; }
.record-search-matches {
  display: grid;
  gap: .27rem;
  min-width: 0;
  margin: 0;
  padding: .52rem .65rem;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-soft);
}
.record-search-matches dt { color: var(--muted); font-size: .74rem; font-weight: 650; }
.record-search-matches dd { margin: 0; font-size: .82rem; overflow-wrap: anywhere; }
.record-search-pages {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
  padding: .65rem clamp(.75rem, 2.3vw, 1.2rem);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .84rem;
}
.record-search-pages div { display: flex; gap: .35rem; }
.record-search-pages .button:disabled { opacity: .5; cursor: not-allowed; }

@media (max-width: 600px) {
  .record-search-row { grid-template-columns: 32px minmax(0, 1fr); gap: .5rem .58rem; }
  .record-search-icon { width: 32px; height: 32px; }
  .record-search-matches { grid-column: 2; }
  .record-search-kinds .button { min-height: 44px; }
}

@media (max-width: 470px) {
  .search-entry { flex-shrink: 0; width: 44px; padding: 0; }
  .search-entry span { display: none; }
  .search-entry .icon { width: 19px; height: 19px; flex-basis: 19px; }
  .record-search-input .button { min-width: 3.45rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

