:root {
  --ri-black: #050505;
  --ri-dark: #0B0F14;
  --ri-red: #ED1C24;
  --ri-red-2: #F01822;
  --ri-yellow: #FFC400;
  --ri-yellow-2: #FFD000;
  --ri-green: #16A34A;
  --ri-gray: #F4F6F8;
  --ri-white: #FFFFFF;
  --ri-ink: #121820;
  --ri-muted: #6B7280;
  --ri-line: #E4E8EF;
  --ri-card: #FFFFFF;
  --ri-shadow: 0 16px 40px rgba(11, 15, 20, .08);
  --ri-soft-shadow: 0 10px 24px rgba(11, 15, 20, .07);
}

* { box-sizing: border-box; }

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  background: var(--ri-gray);
  color: var(--ri-ink);
  font: 15px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a { color: inherit; text-decoration: none; }

.ri-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.ri-logo {
  display: inline-grid;
  gap: 2px;
  line-height: 1;
}

.ri-logo.is-text strong,
.ri-logo.is-text b {
  display: inline;
  font-size: 28px;
  font-weight: 950;
  font-style: italic;
}

.ri-logo.is-text strong { color: var(--ri-red); }
.ri-logo.is-text b { color: var(--ri-white); }

.ri-logo small {
  display: block;
  margin-top: 4px;
  color: var(--ri-yellow);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.ri-logo.is-image {
  display: block;
  max-width: 190px;
  max-height: 64px;
  object-fit: contain;
}

.app {
  min-height: 100vh;
  display: block;
  align-items: stretch;
  max-width: 100%;
}

.sidebar {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  position: fixed;
  inset: 0 auto 0 0;
  width: 280px;
  height: 100dvh;
  min-height: 0;
  padding: 24px 18px;
  color: var(--ri-white);
  background:
    radial-gradient(circle at top left, rgba(237, 28, 36, .28), transparent 34%),
    linear-gradient(160deg, var(--ri-black), #141A21 55%, #07090C);
  overflow-x: hidden;
  overflow-y: hidden;
  overscroll-behavior: contain;
  z-index: 10;
}

.sidebar .nav {
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 4px;
  scrollbar-gutter: stable;
}

.brand {
  display: grid;
  gap: 4px;
  padding: 8px 8px 22px;
  letter-spacing: 0;
}

.brand > span:not(.ri-logo),
.mobile-brand > span:not(.ri-logo) {
  font-size: 25px;
  font-weight: 950;
}

.brand b,
.mobile-brand b { color: var(--ri-red); }

.brand small {
  color: #AEB6C2;
  font-size: 12px;
  font-weight: 700;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 45px;
  padding: 9px 11px;
  border-radius: 14px;
  color: #D8DEE8;
  font-weight: 780;
  border: 1px solid transparent;
}

.nav a:hover,
.nav a.active {
  background: linear-gradient(135deg, var(--ri-red), #A60D14);
  color: var(--ri-white);
  box-shadow: 0 12px 24px rgba(237, 28, 36, .28);
}

.nav a.disabled {
  opacity: .48;
  cursor: not-allowed;
}

.nav a.disabled:hover {
  background: transparent;
  box-shadow: none;
}

.nav-icon {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .1);
  color: var(--ri-yellow);
}

.sidebar-location {
  margin-top: 26px;
  padding: 15px;
  border-radius: 18px;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .11);
}

.sidebar-location span {
  display: block;
  color: #AEB6C2;
  font-size: 12px;
  margin-bottom: 4px;
}

.main {
  margin-left: 280px;
  min-width: 0;
  max-width: 100%;
  min-height: 100vh;
  overflow-x: hidden;
}

.topbar {
  min-height: 76px;
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 16px 28px;
  background: rgba(255, 255, 255, .9);
  border-bottom: 1px solid var(--ri-line);
  position: sticky;
  top: 0;
  z-index: 4;
  backdrop-filter: blur(16px);
}

.mobile-brand { display: none; }

.muted {
  color: var(--ri-muted);
}

.topbar-search {
  min-height: 48px;
  display: flex;
  align-items: center;
  padding: 0 18px;
  border: 1px solid var(--ri-line);
  border-radius: 16px;
  background: #F9FAFB;
  color: #8A93A3;
  font-weight: 700;
}

.actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.notification-dot {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 14px;
  background: #111827;
  color: var(--ri-yellow);
}

.notification-bell::after {
  content: "";
  position: absolute;
  top: 7px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--ri-red);
  border: 2px solid #111827;
  opacity: 0;
}

.user-pill {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 0 13px;
  border-radius: 999px;
  background: #FFFFFF;
  border: 1px solid var(--ri-line);
  font-weight: 800;
}

.user-avatar {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--ri-red);
  color: var(--ri-white);
  font-size: 12px;
  font-weight: 950;
}

.user-text {
  display: grid;
  gap: 0;
  min-width: 0;
}

.user-text strong,
.user-text small {
  display: block;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-text small {
  color: var(--ri-muted);
  font-size: 11px;
  font-weight: 800;
}

.logout-icon { display: none; }

.content {
  width: 100%;
  padding: 26px 28px 40px;
  max-width: 1500px;
  margin: 0 auto;
  overflow-x: hidden;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.page-head h1 {
  font-size: 28px;
  margin: 0;
  font-weight: 950;
}

.panel,
.invoice-box,
.dashboard-card {
  background: var(--ri-card);
  border: 1px solid rgba(228, 232, 239, .9);
  border-radius: 18px;
  box-shadow: var(--ri-soft-shadow);
  max-width: 100%;
  overflow: hidden;
}

.panel,
.invoice-box {
  padding: 18px;
}

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.stat {
  border-radius: 18px;
  background: var(--ri-card);
  padding: 18px;
  border: 1px solid var(--ri-line);
  box-shadow: var(--ri-soft-shadow);
}

.stat b {
  display: block;
  font-size: 30px;
  font-weight: 950;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 9px 15px;
  border-radius: 13px;
  border: 1px solid var(--ri-line);
  background: var(--ri-white);
  font-weight: 850;
  cursor: pointer;
}

.btn .ri-icon {
  width: 16px;
  height: 16px;
}

.btn-primary { background: var(--ri-red); border-color: var(--ri-red); color: var(--ri-white); }
.btn-blue { background: #111827; border-color: #111827; color: var(--ri-white); }
.btn-danger { background: var(--ri-red); border-color: var(--ri-red); color: var(--ri-white); }
.btn-yellow { background: var(--ri-yellow); border-color: var(--ri-yellow); color: #161616; }
.btn-green { background: var(--ri-green); border-color: var(--ri-green); color: var(--ri-white); }
.btn-dark { background: var(--ri-dark); border-color: var(--ri-dark); color: var(--ri-white); }
.btn-sm { min-height: 34px; padding: 7px 11px; font-size: 13px; }

.span-2 { grid-column: 1 / -1; }

.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
}

.field { margin-bottom: 13px; }

label {
  display: block;
  font-weight: 850;
  margin-bottom: 7px;
}

.field-label-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
}

.field-label-actions label {
  margin-bottom: 0;
}

.field-label-actions .btn {
  flex: 0 0 auto;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--ri-line);
  border-radius: 13px;
  padding: 9px 11px;
  font: inherit;
  background: var(--ri-white);
}

textarea { min-height: 92px; }

.table-wrap,
.table-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--ri-line);
  border-radius: 16px;
  background: var(--ri-white);
}

table {
  width: 100%;
  border-collapse: collapse;
}

.table-scroll table {
  min-width: 720px;
  width: 100%;
  border-collapse: collapse;
}

.table-scroll.table-wide table {
  min-width: 960px;
}

.table-scroll-hint {
  display: none;
  margin-bottom: 8px;
  color: #64748B;
  font-size: 12px;
  font-weight: 700;
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--ri-line);
  text-align: left;
  vertical-align: top;
}

th {
  background: #F8FAFC;
  font-size: 12px;
  text-transform: uppercase;
  color: #64748B;
}

.table-actions,
td.actions {
  display: flex;
  gap: 6px;
  align-items: center;
  white-space: nowrap;
}

.nowrap {
  white-space: nowrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 900;
}

.badge-success { background: #DCFCE7; color: #15803D; }
.badge-danger { background: #FEE2E2; color: #B91C1C; }
.badge-warning { background: #FEF3C7; color: #B45309; }
.badge-secondary { background: #E5E7EB; color: #374151; }

.alert {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border-radius: 16px;
  padding: 12px 14px;
  margin-bottom: 16px;
  border: 1px solid;
  font-weight: 780;
}

.alert-close {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 10px;
  background: rgba(11, 15, 20, .08);
  color: currentColor;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.alert-success { background: #ECFDF5; border-color: #BBF7D0; }
.alert-danger { background: #FEF2F2; border-color: #FECACA; }
.empty-state { text-align: center; padding: 34px; }
.bottom-nav,
.more-sheet { display: none; }
.item-row { display: grid; grid-template-columns: 2fr 90px; gap: 9px; margin-bottom: 9px; }

.mechanic-account {
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px solid var(--ri-line);
}

.mechanic-account__head {
  margin-bottom: 18px;
}

.mechanic-account__head h2 {
  margin: 4px 0 6px;
  font-size: 19px;
}

.mechanic-account__head p {
  max-width: 680px;
  margin: 0;
  color: var(--ri-muted);
  line-height: 1.5;
}

.section-kicker {
  color: var(--ri-red);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.dashboard-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 22px;
  align-items: start;
}

.dashboard-main,
.dashboard-side {
  display: grid;
  gap: 18px;
}

.hero-card {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 220px;
  padding: 28px;
  border-radius: 24px;
  color: var(--ri-white);
  background:
    linear-gradient(120deg, rgba(5, 5, 5, .96), rgba(11, 15, 20, .88)),
    radial-gradient(circle at 80% 10%, rgba(237, 28, 36, .35), transparent 34%);
  box-shadow: var(--ri-shadow);
}

.hero-card::before,
.hero-card::after {
  content: "";
  position: absolute;
  z-index: 0;
  pointer-events: none;
  height: 5px;
  border-radius: 999px;
  transform: skewX(-24deg);
}

.hero-card::before {
  right: -40px;
  bottom: 54px;
  width: 320px;
  background: var(--ri-yellow);
}

.hero-card::after {
  right: 34px;
  bottom: 34px;
  width: 220px;
  background: var(--ri-red);
}

.hero-card h1 {
  position: relative;
  z-index: 1;
  max-width: 620px;
  margin: 0;
  font-size: clamp(28px, 4vw, 46px);
  line-height: 1.02;
  font-weight: 950;
}

.mobile-copy { display: none; }

.hero-card p {
  position: relative;
  z-index: 1;
  max-width: 620px;
  margin: 14px 0 20px;
  color: #D9E0EA;
  font-size: 16px;
}

.hero-location {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: #312A13;
  color: var(--ri-yellow);
  font-weight: 900;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.kpi-card {
  padding: 18px;
}

.kpi-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.kpi-icon {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 16px;
  background: #111827;
  color: var(--ri-yellow);
  font-weight: 950;
}

.kpi-icon.red { background: #FEE2E2; color: var(--ri-red); }
.kpi-icon.yellow { background: #FEF3C7; color: #A16207; }
.kpi-icon.green { background: #DCFCE7; color: var(--ri-green); }

.kpi-value {
  margin-top: 15px;
  font-size: 30px;
  font-weight: 950;
}

.kpi-trend {
  margin-top: 4px;
  color: var(--ri-muted);
  font-size: 13px;
  font-weight: 780;
}

.dashboard-card {
  padding: 18px;
}

.card-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.card-title h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 950;
}

.chart-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, .8fr);
  gap: 16px;
}

.bar-chart {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  align-items: end;
  gap: 12px;
  height: 190px;
  padding-top: 16px;
}

.bar {
  position: relative;
  min-height: 26px;
  border-radius: 12px 12px 5px 5px;
  background: linear-gradient(180deg, var(--ri-red), #8F1218);
}

.bar:nth-child(even) { background: linear-gradient(180deg, var(--ri-yellow), #C89100); }
.bar span {
  position: absolute;
  left: 50%;
  bottom: -24px;
  transform: translateX(-50%);
  color: var(--ri-muted);
  font-size: 12px;
  font-weight: 800;
}

.status-list {
  display: grid;
  gap: 13px;
}

.status-row {
  display: grid;
  gap: 7px;
}

.status-meta {
  display: flex;
  justify-content: space-between;
  font-weight: 850;
}

.status-track {
  height: 10px;
  border-radius: 999px;
  background: #EEF2F7;
  overflow: hidden;
}

.status-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--ri-red);
}

.wo-mobile-list { display: none; }

.side-widget {
  display: grid;
  gap: 11px;
}

.quick-actions {
  display: grid;
  gap: 10px;
}

.quick-actions .btn {
  justify-content: flex-start;
  min-height: 48px;
}

.mini-list {
  display: grid;
  gap: 10px;
}

.mini-item {
  display: grid;
  gap: 3px;
  padding: 12px;
  border-radius: 15px;
  background: #F8FAFC;
  border: 1px solid var(--ri-line);
}

.mini-item strong {
  font-size: 14px;
}

.mobile-quick-actions { display: none; }

.ajax-status {
  display: block;
  min-height: 18px;
  margin-top: 6px;
  color: var(--ri-muted);
  font-size: 12px;
  font-weight: 760;
}

.js-enabled form[data-ajax-search] button[type="submit"] {
  display: none;
}

.js-enabled form[data-ajax-search] .form-row {
  grid-template-columns: minmax(0, 1fr);
}

.js-enabled form[data-ajax-search] select {
  max-width: 260px;
}

.ajax-autocomplete {
  position: relative;
  z-index: 50;
}

.ajax-autocomplete-results {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 9999;
  display: none;
  max-height: 280px;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--ri-line);
  border-radius: 14px;
  background: var(--ri-white);
  box-shadow: 0 18px 45px rgba(15, 23, 42, .18);
}

.ajax-autocomplete-results.is-open {
  display: grid;
  gap: 4px;
}

.ajax-option {
  width: 100%;
  display: grid;
  gap: 2px;
  padding: 10px 11px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.work-order-form {
  padding: 26px;
}

.work-order-picker-grid,
.work-order-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.work-order-picker {
  position: relative;
  min-width: 0;
  margin-bottom: 0;
}

.work-order-picker:focus-within {
  z-index: 60;
}

.work-order-picker .ajax-autocomplete-results {
  position: absolute;
  top: calc(100% + 7px);
  left: 0;
  right: 0;
  margin-top: 0;
  max-height: 240px;
  border-radius: 12px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, .18);
  background: #FFFFFF;
}

.work-order-picker .ajax-option {
  padding: 9px 10px;
  border: 1px solid transparent;
  background: #FFFFFF;
}

.work-order-picker .ajax-option:hover,
.work-order-picker .ajax-option:focus-visible {
  border-color: #F6C900;
  background: #FFF9E8;
}

.work-order-picker .ajax-status {
  display: block;
  min-height: 18px;
  margin-top: 6px;
}

.work-order-detail-grid {
  margin-top: 18px;
  align-items: start;
}

.work-order-detail-grid textarea {
  min-height: 104px;
}

.reminder-override-panel {
  margin-bottom: 20px;
}

.reminder-override-panel h2 {
  margin: 0;
  font-size: 19px;
}

.reminder-override-grid {
  display: grid;
  grid-template-columns: minmax(230px, 1.4fr) minmax(210px, 1.2fr) repeat(3, minmax(140px, .7fr)) auto;
  gap: 14px;
  align-items: end;
}

.reminder-override-submit {
  min-width: 144px;
}

.reminder-override-empty {
  margin: 16px 0 0;
}

.reminder-template-variable-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0 0 18px;
}

.reminder-template-variable-list code {
  padding: 5px 8px;
  border: 1px solid var(--ri-line);
  border-radius: 7px;
  background: #fff;
  color: var(--ri-muted);
  font-size: 12px;
}

.reminder-template-panel {
  margin-bottom: 18px;
}

.reminder-template-panel h2 {
  margin: 0;
  font-size: 20px;
}

.reminder-template-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(260px, .85fr);
  gap: 18px;
  align-items: stretch;
}

.reminder-template-grid textarea {
  min-height: 230px;
  resize: vertical;
}

.reminder-template-preview {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  padding: 16px;
  border: 1px solid #F6D765;
  border-radius: 12px;
  background: #FFFCED;
}

.reminder-template-preview__label {
  margin-bottom: 10px;
  color: #865D00;
  font-size: 12px;
  font-weight: 850;
}

.reminder-template-preview pre {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: inherit;
  line-height: 1.55;
}

@media (max-width: 768px) {
  .work-order-form { padding: 18px; }
  .work-order-picker-grid,
  .work-order-detail-grid { grid-template-columns: 1fr; gap: 14px; }
  .work-order-detail-grid { margin-top: 14px; }
  .work-order-picker .ajax-autocomplete-results { max-height: 190px; }
  .reminder-override-grid { grid-template-columns: 1fr; gap: 12px; }
  .reminder-override-submit { min-width: 0; }
  .reminder-template-grid { grid-template-columns: 1fr; gap: 14px; }
  .reminder-template-grid textarea { min-height: 190px; }
}

.ajax-option:hover,
.ajax-option:focus {
  background: #F3F6FA;
  outline: 0;
}

.ajax-option strong {
  font-size: 14px;
}

.ajax-option small {
  color: var(--ri-muted);
}

fieldset {
  min-width: 0;
  padding: 0;
  margin: 0;
  border: 0;
}

fieldset:disabled {
  opacity: .58;
}

.invoice-search-row {
  align-items: start;
}

.ri-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  place-items: center;
  padding: 18px;
}

.ri-modal.is-open {
  display: grid;
}

.ri-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(5, 5, 5, .68);
  backdrop-filter: blur(5px);
}

.ri-modal__card {
  position: relative;
  width: min(420px, 100%);
  padding: 22px;
  border-radius: 18px;
  background: var(--ri-white);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .32);
  border: 1px solid rgba(255, 255, 255, .4);
}

.ri-modal__card--wide {
  width: min(720px, 100%);
}

.ri-modal__card h2 {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 950;
}

.ri-modal__card p {
  margin: 0 0 20px;
  color: var(--ri-muted);
}

.ri-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.crud-card-list {
  display: none;
}

.crud-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border-radius: 16px;
  background: var(--ri-white);
  border: 1px solid var(--ri-line);
  box-shadow: var(--ri-soft-shadow);
}

.crud-card__head,
.crud-card__actions {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.crud-card__meta {
  color: var(--ri-muted);
  font-size: 13px;
}

.role-check-grid,
.role-overview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.role-check {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 22px;
  align-items: center;
  gap: 12px;
  min-height: 76px;
  margin: 0;
  padding: 13px 14px;
  border: 1px solid var(--ri-line);
  border-radius: 16px;
  background: linear-gradient(180deg, #FFFFFF, #F8FAFC);
  box-shadow: 0 8px 18px rgba(11, 15, 20, .04);
  cursor: pointer;
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease, background .16s ease;
}

.role-check:hover {
  border-color: #CBD5E1;
  box-shadow: 0 12px 26px rgba(11, 15, 20, .07);
  transform: translateY(-1px);
}

.role-check:has(input:checked) {
  border-color: rgba(237, 28, 36, .48);
  background: linear-gradient(180deg, #FFF7F7, #FFFFFF);
  box-shadow: 0 12px 28px rgba(237, 28, 36, .10);
}

.role-check input[type="checkbox"] {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  min-width: 0;
  min-height: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  opacity: 0;
  pointer-events: none;
}

.role-check__copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.role-check__copy strong {
  color: var(--ri-ink);
  font-size: 14px;
  line-height: 1.2;
  font-weight: 900;
}

.role-check__copy small {
  color: var(--ri-muted);
  font-size: 12px;
  line-height: 1.25;
  font-weight: 760;
}

.role-check__mark {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 2px solid #CBD5E1;
  background: var(--ri-white);
  box-shadow: inset 0 0 0 4px var(--ri-white);
}

.role-check input[type="checkbox"]:checked ~ .role-check__mark {
  border-color: var(--ri-red);
  background: var(--ri-red);
  box-shadow: inset 0 0 0 5px var(--ri-white);
}

.role-readonly {
  margin-top: 22px;
}

.role-readonly .card-title .btn {
  min-width: 118px;
  white-space: nowrap;
}

.role-access-intro {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid #FDE68A;
  border-radius: 14px;
  background: #FFFBEB;
  color: #713F12;
}

.role-access-intro span {
  color: #854D0E;
}

.role-overview--access {
  margin-bottom: 22px;
}

.role-block__type {
  display: block;
  margin-top: 4px;
  color: var(--ri-muted);
  font-size: 12px;
  font-weight: 800;
}

.role-block__actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.role-block__actions form {
  margin: 0;
}

.role-access-form__head {
  margin: 26px 0 14px;
  padding-top: 20px;
  border-top: 1px solid var(--ri-line);
}

.role-access-form__head h2 {
  margin: 0;
  font-size: 18px;
}

.role-access-form__head p {
  margin: 5px 0 0;
  color: var(--ri-muted);
}

.permission-groups {
  display: grid;
  gap: 10px;
}

.permission-group {
  overflow: hidden;
  border: 1px solid var(--ri-line);
  border-radius: 14px;
  background: var(--ri-white);
}

.permission-group summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 15px;
  color: var(--ri-ink);
  font-weight: 900;
  cursor: pointer;
}

.permission-group summary small {
  color: var(--ri-muted);
  font-size: 12px;
  font-weight: 800;
}

.permission-choice-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--ri-line);
  background: #F8FAFC;
}

.permission-choice {
  display: flex;
  align-items: center;
  min-height: 42px;
  gap: 9px;
  padding: 9px 10px;
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  background: var(--ri-white);
  color: var(--ri-ink);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.permission-choice:has(input:checked) {
  border-color: rgba(237, 28, 36, .45);
  background: #FFF7F7;
}

.permission-choice input {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: var(--ri-red);
  flex: 0 0 auto;
}

.role-matrix-wrap,
.role-selector-wrap {
  margin-bottom: 20px;
  border: 1px solid var(--ri-line);
  border-radius: 14px;
  background: var(--ri-white);
}

.role-matrix,
.role-selector {
  width: 100%;
  min-width: 820px;
  border-collapse: separate;
  border-spacing: 0;
}

.role-matrix th,
.role-matrix td,
.role-selector th,
.role-selector td {
  border-bottom: 1px solid var(--ri-line);
}

.role-matrix thead th,
.role-selector thead th {
  padding: 14px 16px;
  background: #F8FAFC;
  color: #64748B;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.role-matrix thead th:first-child,
.role-selector thead th:first-child {
  position: sticky;
  left: 0;
  z-index: 3;
  min-width: 250px;
  text-align: left;
}

.role-matrix__role {
  min-width: 150px;
  text-align: center;
  text-transform: none !important;
}

.role-matrix__role strong,
.role-matrix__role small {
  display: block;
}

.role-matrix__role strong {
  color: var(--ri-ink);
  font-size: 13px;
}

.role-matrix__role small {
  margin-top: 3px;
  color: var(--ri-muted);
  font-size: 11px;
  font-weight: 750;
  text-transform: none;
}

.role-matrix__section th,
.role-selector__section th {
  padding: 10px 16px;
  background: #111820;
  color: var(--ri-white);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-align: left;
}

.role-matrix__permission,
.role-selector tbody > tr:not(.role-selector__section) > th {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 250px;
  padding: 12px 16px;
  background: var(--ri-white);
  color: var(--ri-ink);
  font-size: 13px;
  font-weight: 800;
  text-align: left;
}

.role-matrix__status {
  width: 150px;
  padding: 10px;
  text-align: center;
}

.role-matrix__status .ri-icon {
  width: 19px;
  height: 19px;
}

.role-matrix__status.is-allowed { color: #15803D; }
.role-matrix__status.is-denied { color: #94A3B8; }

.role-matrix tbody tr:last-child th,
.role-matrix tbody tr:last-child td,
.role-selector tbody tr:last-child th,
.role-selector tbody tr:last-child td { border-bottom: 0; }

.role-matrix-actions { margin-top: 0; }
.role-matrix-actions h2 { margin: 0 0 12px; font-size: 18px; }
.role-matrix-actions__list { display: grid; gap: 8px; }
.role-matrix-actions__list > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 0;
  border-bottom: 1px solid var(--ri-line);
}
.role-matrix-actions__list > div:last-child { border-bottom: 0; }
.role-matrix-actions__list span:first-child { display: grid; gap: 3px; }
.role-matrix-actions__list small { color: var(--ri-muted); font-size: 12px; }
.role-matrix-actions__list form { margin: 0; }

.role-selector { min-width: 460px; }
.role-selector thead th:last-child { width: 140px; text-align: center; }
.role-selector td { width: 140px; padding: 9px 16px; text-align: center; }
.permission-toggle {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  cursor: pointer;
}
.permission-toggle input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.permission-toggle__mark {
  position: relative;
  width: 22px;
  height: 22px;
  border: 2px solid #CBD5E1;
  border-radius: 6px;
  background: var(--ri-white);
}
.permission-toggle input:checked + .permission-toggle__mark {
  border-color: #16A34A;
  background: #16A34A;
}
.permission-toggle input:checked + .permission-toggle__mark::after {
  position: absolute;
  top: 3px;
  left: 6px;
  width: 6px;
  height: 10px;
  border: solid var(--ri-white);
  border-width: 0 2px 2px 0;
  content: '';
  transform: rotate(45deg);
}
.permission-toggle input:focus-visible + .permission-toggle__mark { outline: 3px solid rgba(37, 99, 235, .35); outline-offset: 3px; }

.settings-shell {
  width: min(100%, 1240px);
  margin: 0 auto;
}

.system-update-shell {
  width: min(100%, 1240px);
  margin: 0 auto;
}

.settings-head {
  align-items: flex-end;
}

.settings-form {
  padding: 22px;
}

.settings-form .form-row {
  gap: 16px;
}

.settings-form .field {
  margin-bottom: 16px;
}

.settings-tabs { display:flex; gap:8px; overflow-x:auto; margin:0 0 18px; padding-bottom:2px; }
.settings-tabs a { flex:0 0 auto; padding:9px 13px; border:1px solid var(--ri-line); border-radius:9px; color:var(--ri-muted); font-weight:800; text-decoration:none; }
.settings-tabs a.is-active { color:var(--ri-white); background:var(--ri-dark); border-color:var(--ri-dark); }
.top-gap { margin-top: 12px; }
.booking-payment-action { display:grid; gap:8px; min-width:210px; }.booking-payment-action textarea { min-height:58px; }.booking-payment-action > div { display:flex; gap:6px; flex-wrap:wrap; }.booking-payment-action input { min-width:150px; margin-bottom:6px; }

.update-summary-grid .panel,
.update-panel {
  overflow-wrap: anywhere;
}

.update-panel {
  margin-top: 18px;
}

.branding-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 4px 0 16px;
}

.branding-field {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--ri-line);
  border-radius: 16px;
  background: linear-gradient(180deg, #FFFFFF, #F8FAFC);
}

.branding-field__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.branding-field__head label {
  margin-bottom: 4px;
}

.branding-field__head small {
  display: block;
  color: var(--ri-muted);
  font-size: 12px;
  font-weight: 760;
}

.branding-preview {
  display: inline-grid;
  place-items: center;
  width: 92px;
  height: 56px;
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid var(--ri-line);
  border-radius: 14px;
  background: #111827;
  color: var(--ri-yellow);
  font-weight: 950;
}

.branding-preview.is-favicon {
  width: 56px;
}

.branding-preview img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.settings-form .branding-field > img,
.settings-form .branding-field > picture,
.settings-form .branding-field > .branding-image-preview {
  display: block;
  width: min(100%, 320px);
  max-height: 180px;
  object-fit: contain;
  border-radius: 14px;
  background: #F8FAFC;
}

.settings-form img {
  max-width: min(100%, 320px);
  max-height: 180px;
  object-fit: contain;
}

.branding-picker {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}

.settings-form .branding-grid {
  gap: 16px;
  align-items: start;
}

.settings-form .branding-field {
  padding: 16px;
}

.settings-form .branding-picker {
  grid-template-columns: 1fr;
}

.role-block {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--ri-line);
  border-radius: 16px;
  background: #F8FAFC;
}

.role-block p {
  margin: 0;
}

.permission-list {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.permission-list span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--ri-white);
  border: 1px solid var(--ri-line);
  color: #475569;
  font-size: 12px;
  font-weight: 800;
}

.field-error {
  display: block;
  margin-top: 6px;
  color: #B91C1C;
  font-size: 12px;
  font-weight: 800;
}

.quick-form-errors {
  display: grid;
  gap: 4px;
  margin-bottom: 10px;
}

.required {
  color: var(--ri-red);
  font-weight: 950;
}

.is-invalid {
  border-color: #FCA5A5;
  background: #FEF2F2;
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 18% 8%, rgba(237, 28, 36, .34), transparent 30%),
    radial-gradient(circle at 90% 92%, rgba(255, 196, 0, .22), transparent 26%),
    linear-gradient(145deg, var(--ri-black), #111820 58%, #050505);
  color: var(--ri-white);
}

.login-shell {
  width: min(440px, 100%);
  display: grid;
  gap: 18px;
}

.login-brand {
  text-align: center;
}

.login-brand .ri-logo {
  margin-inline: auto;
  justify-items: center;
}

.login-brand .login-logo {
  padding: 0;
  border: 0;
  border-radius: 0;
  outline: 0;
  background: transparent;
  box-shadow: none;
  filter: none;
}

.login-brand .ri-logo.is-image {
  width: var(--login-logo-width, 150px);
  max-width: min(100%, var(--login-logo-width, 150px));
  max-height: none;
}

.login-brand .ri-logo.is-text strong,
.login-brand .ri-logo.is-text b {
  font-size: clamp(28px, calc(var(--login-logo-width, 150px) / 3.6), 72px);
}

.login-brand .ri-logo small {
  font-size: clamp(9px, calc(var(--login-logo-width, 150px) / 15), 16px);
}

.login-brand h1 {
  margin: 18px 0 8px;
  font-size: clamp(28px, 8vw, 38px);
  line-height: 1.05;
  font-weight: 950;
}

.login-brand p {
  margin: 0;
  color: #D8DEE8;
}

.login-card {
  position: relative;
  overflow: hidden;
  padding: 22px;
  border-radius: 22px;
  background: rgba(255, 255, 255, .96);
  border: 1px solid rgba(255, 255, 255, .22);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .36);
  color: var(--ri-ink);
}

.login-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  background: linear-gradient(90deg, var(--ri-red), var(--ri-yellow));
}

.input-icon {
  position: relative;
}

.input-icon .ri-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ri-muted);
}

.input-icon input {
  padding-left: 42px;
}

.input-suffix {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.input-suffix span {
  color: var(--ri-muted);
  font-weight: 900;
}

.login-submit {
  width: 100%;
  min-height: 48px;
}

.login-footer {
  margin: 0;
  color: #AEB6C2;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
}

.invoice-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  margin-bottom: 18px;
  padding: 28px;
  border-radius: 22px;
  color: var(--ri-white);
  background:
    linear-gradient(120deg, rgba(5, 5, 5, .96), rgba(11, 15, 20, .87)),
    radial-gradient(circle at 82% 18%, rgba(237, 28, 36, .42), transparent 34%);
  box-shadow: var(--ri-shadow);
}

.invoice-hero::before,
.invoice-hero::after {
  content: "";
  position: absolute;
  z-index: 0;
  pointer-events: none;
  right: -36px;
  height: 5px;
  border-radius: 999px;
  transform: skewX(-24deg);
}

.invoice-hero::before {
  bottom: 54px;
  width: 280px;
  background: var(--ri-yellow);
}

.invoice-hero::after {
  bottom: 34px;
  width: 200px;
  background: var(--ri-red);
}

.invoice-hero h1 {
  position: relative;
  z-index: 1;
  margin: 12px 0 8px;
  font-size: clamp(30px, 5vw, 44px);
  line-height: 1.04;
  font-weight: 950;
}

.invoice-hero em {
  color: var(--ri-red);
  font-style: italic;
}

.invoice-hero p {
  position: relative;
  z-index: 1;
  margin: 0;
  color: #D8DEE8;
}

.invoice-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  gap: 16px;
  align-items: start;
}

.invoice-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.invoice-steps button {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  padding: 7px 10px;
  border: 1px solid var(--ri-line);
  border-radius: 999px;
  background: var(--ri-white);
  color: var(--ri-muted);
  font: inherit;
  font-size: 12px;
  font-weight: 950;
  white-space: nowrap;
  cursor: pointer;
}

.invoice-steps button:focus-visible {
  outline: 3px solid rgba(237, 28, 36, .18);
  outline-offset: 2px;
}

.invoice-steps .is-active {
  border-color: rgba(237, 28, 36, .24);
  background: #FFF1F2;
  color: var(--ri-red);
}

.invoice-main,
.invoice-aside {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.invoice-section,
.invoice-summary-card,
.invoice-actions-card,
.invoice-preview-card {
  max-width: 100%;
  padding: 18px;
  border: 1px solid var(--ri-line);
  border-radius: 18px;
  background: var(--ri-white);
  box-shadow: var(--ri-soft-shadow);
}

.invoice-section {
  overflow: visible;
  scroll-margin-top: 92px;
}

.invoice-summary-card,
.invoice-actions-card,
.invoice-preview-card {
  overflow: hidden;
  scroll-margin-top: 92px;
}

.invoice-section-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.invoice-section-head h2,
.invoice-summary-card h2,
.invoice-actions-card h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 950;
}

.invoice-section-head p {
  margin: 2px 0 0;
  color: var(--ri-muted);
}

.section-step {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 12px;
  background: var(--ri-black);
  color: var(--ri-yellow);
  font-weight: 950;
}

.invoice-item-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.invoice-items-list {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.invoice-line-card {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) auto auto auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--ri-line);
  border-radius: 14px;
  background: #F8FAFC;
}

.invoice-line-card strong,
.preview-item span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.invoice-line-card > div {
  display: flex;
  min-width: 0;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.invoice-line-card > span {
  color: var(--ri-muted);
  font-weight: 800;
  white-space: nowrap;
}

.invoice-item-panel {
  position: relative;
  z-index: 40;
  display: grid;
  gap: 14px;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid #FDE68A;
  border-radius: 16px;
  background: #FFFBEB;
  overflow: visible;
}

.invoice-item-panel[hidden] {
  display: none;
}

.invoice-item-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.manual-item-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 90px 150px;
  gap: 9px;
  margin-bottom: 9px;
}

.invoice-summary-card,
.invoice-actions-card,
.invoice-preview-card {
  display: grid;
  gap: 12px;
}

.summary-line,
.summary-total {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
}

.summary-line span {
  color: var(--ri-muted);
}

.summary-line.danger strong {
  color: var(--ri-red);
}

.summary-total {
  padding: 14px;
  border-radius: 14px;
  background: #FFF7DB;
  border: 1px solid #FDE68A;
  font-size: 18px;
  font-weight: 950;
}

.invoice-actions-card .btn {
  width: 100%;
}

.preview-logo.is-text strong,
.preview-logo.is-text b {
  color: var(--ri-red);
}

.preview-logo.is-text b {
  color: var(--ri-black);
}

.preview-items {
  display: grid;
  gap: 8px;
  color: var(--ri-muted);
}

.preview-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--ri-line);
  color: var(--ri-ink);
  font-size: 13px;
  font-weight: 800;
}

.invoice-mobile-actions {
  display: none;
}

@media (max-width: 1180px) {
  .dashboard-shell { grid-template-columns: 1fr; }
  .dashboard-side { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settings-shell { max-width: 100%; }
  .system-update-shell { max-width: 100%; }
  .settings-form .branding-grid { grid-template-columns: 1fr; }
}

@media (min-width: 769px) {
  body {
    background:
      linear-gradient(90deg, #07090C 0 280px, var(--ri-gray) 280px 100%);
  }

  .sidebar-location {
    margin-top: 14px;
  }

  .sidebar .nav::-webkit-scrollbar { width: 7px; }

  .sidebar .nav::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, .04);
  }

  .sidebar .nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, .18);
    border-radius: 999px;
  }
}

@media (max-width: 768px) {
  .main,
  .content {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .main {
    margin-left: 0;
    min-height: 0;
  }

  .table-scroll-hint {
    display: block;
  }

  .table-wrap,
  .table-scroll {
    border-radius: 12px;
  }
}

@media (max-width: 768px) {
  body {
    background: #EEF1F5;
  }

  .app { display: block; }
  .sidebar { display: none; }

  .topbar {
    min-height: 62px;
    grid-template-columns: 1fr auto;
    gap: 8px;
    padding: 10px 14px 11px;
    background: linear-gradient(135deg, var(--ri-black), #151B24);
    color: var(--ri-white);
    border-bottom: 0;
    border-radius: 0 0 20px 20px;
  }

  .mobile-brand { display: block; }
  .mobile-logo.ri-logo.is-image {
    max-width: 92px;
    max-height: 48px;
  }
  .mobile-brand small {
    display: block;
    color: #B6C0CE;
    font-size: 12px;
    font-weight: 800;
    margin-top: -3px;
  }
  .topbar-search { display: none; }
  .actions {
    gap: 8px;
    justify-content: flex-end;
    flex-wrap: nowrap;
    min-width: 0;
  }
  .notification-dot { display: none; }
  .user-pill {
    min-width: 0;
    max-width: 146px;
    min-height: 34px;
    padding: 4px 7px;
    background: rgba(255,255,255,.1);
    border-color: rgba(255,255,255,.14);
    color: var(--ri-white);
  }
  .user-avatar {
    width: 28px;
    height: 28px;
    flex: 0 0 auto;
  }
  .user-text strong {
    max-width: 88px;
    color: var(--ri-white);
    font-size: 13px;
    line-height: 1.1;
  }
  .user-text small {
    max-width: 88px;
    color: #FACC15;
    font-size: 11px;
  }
  .logout-trigger {
    width: 42px;
    min-width: 42px;
    height: 42px;
    padding: 0;
    border-color: rgba(255,255,255,.16);
    background: rgba(255,255,255,.1);
    color: var(--ri-white);
  }
  .logout-word { display: none; }
  .logout-icon {
    display: inline;
    font-size: 20px;
    font-weight: 950;
  }

  .content {
    padding: 16px 12px 112px;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .page-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .page-head h1 { font-size: 24px; }
  .grid-2,
  .grid-3,
  .form-row,
  .branding-grid,
  .branding-picker,
  .role-check-grid,
  .role-overview,
  .chart-grid,
  .dashboard-side,
  .invoice-workspace,
  .invoice-item-grid {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: auto;
  }

  .hero-card {
    min-height: 190px;
    padding: 22px;
    border-radius: 22px;
  }

  .hero-card::before {
    right: -100px;
    bottom: 48px;
    width: 190px;
  }

  .hero-card::after {
    right: -70px;
    bottom: 28px;
    width: 128px;
  }

  .hero-card h1 { font-size: 30px; }
  .invoice-hero {
    min-height: 190px;
    padding: 22px;
    border-radius: 22px;
  }

  .invoice-hero::before {
    right: -100px;
    bottom: 48px;
    width: 190px;
  }

  .invoice-hero::after {
    right: -70px;
    bottom: 28px;
    width: 128px;
  }
  .invoice-hero h1 { font-size: 30px; }
  .invoice-section,
  .invoice-summary-card,
  .invoice-actions-card,
  .invoice-preview-card {
    padding: 14px;
    border-radius: 16px;
  }
  .invoice-steps {
    grid-template-columns: repeat(4, max-content);
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }
  .invoice-aside {
    order: 2;
  }
  .invoice-line-card {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
  .invoice-line-card > span,
  .invoice-line-card > strong {
    white-space: normal;
  }
  .manual-item-row {
    grid-template-columns: 1fr;
  }
  .invoice-mobile-actions {
    position: sticky;
    bottom: 86px;
    z-index: 3;
    display: block;
    padding: 10px;
    border-radius: 18px;
    background: rgba(255, 255, 255, .92);
    border: 1px solid var(--ri-line);
    box-shadow: var(--ri-soft-shadow);
    backdrop-filter: blur(12px);
  }
  .invoice-mobile-actions .btn {
    width: 100%;
  }
  .desktop-copy { display: none; }
  .mobile-copy { display: inline; }
  .hero-card p { font-size: 14px; }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .kpi-card { padding: 14px; border-radius: 18px; }
  .kpi-icon { width: 38px; height: 38px; border-radius: 14px; }
  .kpi-value { font-size: 24px; }

  .table-scroll-hint {
    display: block;
  }

  .crud-responsive-table-hint {
    display: none;
  }

  .wo-desktop-table-hint {
    display: none;
  }

  .table-wrap,
  .table-scroll {
    border-radius: 12px;
  }

  .crud-responsive-table {
    display: none;
  }

  .crud-card-list {
    display: grid;
    gap: 10px;
  }

  .crud-card__actions .btn,
  .actions .btn {
    min-height: 40px;
  }

  form.panel .actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  form.panel .actions .btn {
    width: 100%;
  }

  .ri-modal__actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .wo-desktop-table { display: none; }
  .wo-mobile-list {
    display: grid;
    gap: 10px;
  }

  .wo-card {
    display: grid;
    gap: 8px;
    padding: 14px;
    border-radius: 16px;
    background: #FFFFFF;
    border: 1px solid var(--ri-line);
  }

  .wo-card-head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: flex-start;
  }

  .bar-chart { height: 150px; }

  .mobile-quick-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .bottom-nav {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 7px;
    padding: 4px 5px;
    background: linear-gradient(135deg, var(--ri-black), #171D25);
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 19px;
    z-index: 10;
    box-shadow: 0 18px 40px rgba(0, 0, 0, .28);
  }

  .bottom-nav a,
  .bottom-nav button {
    display: grid;
    place-items: center;
    gap: 1px;
    min-height: 46px;
    padding: 3px 2px;
    border: 0;
    background: transparent;
    color: #B6C0CE;
    font: inherit;
    font-size: 10.5px;
    font-weight: 850;
    cursor: pointer;
  }

  .bottom-nav a span,
  .bottom-nav button span {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 9px;
    background: rgba(255, 255, 255, .08);
    font-size: 10px;
  }

  .bottom-nav a.active {
    color: var(--ri-red);
  }

  .bottom-nav a.active span {
    background: rgba(237, 28, 36, .16);
  }

  .more-sheet {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: none;
  }

  .more-sheet.is-open {
    display: block;
  }

  .more-sheet__overlay {
    position: absolute;
    inset: 0;
    border: 0;
    background: rgba(5, 5, 5, .62);
  }

  .more-sheet__panel {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    display: grid;
    gap: 14px;
    max-height: min(78vh, 640px);
    overflow: auto;
    padding: 18px 14px 106px;
    border-radius: 24px 24px 0 0;
    background: var(--ri-white);
    box-shadow: 0 -18px 50px rgba(0, 0, 0, .24);
  }

  .more-sheet__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }

  .more-sheet__head strong {
    display: block;
    font-size: 20px;
    font-weight: 950;
  }

  .more-sheet__head span {
    color: var(--ri-muted);
    font-size: 12px;
    font-weight: 800;
  }

  .more-sheet__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .more-sheet__grid a,
  .more-sheet__grid button {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    align-items: center;
    gap: 9px;
    min-height: 58px;
    padding: 10px;
    border: 1px solid var(--ri-line);
    border-radius: 16px;
    background: #F8FAFC;
    color: var(--ri-ink);
    text-align: left;
    font: inherit;
    cursor: pointer;
  }

  .more-sheet__grid a span,
  .more-sheet__grid button span {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 13px;
    background: var(--ri-black);
    color: var(--ri-yellow);
  }

  .more-sheet__grid strong {
    overflow: hidden;
    font-size: 13px;
    font-weight: 950;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .more-sheet__grid small {
    color: var(--ri-muted);
    font-size: 11px;
    font-weight: 800;
  }

  .more-sheet__grid .disabled {
    opacity: .48;
  }

  .item-row { grid-template-columns: 1fr 90px; }
}

.check-inline { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-weight: 850; }
.check-inline input { width: 18px; height: 18px; margin: 0; accent-color: var(--ri-red); }
.item-warranty-note { display: block; margin-top: 4px; color: var(--ri-muted); font-size: 12px; font-weight: 750; }
.warranty-card-grid, .claim-card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.warranty-card, .claim-card, .claim-summary { max-width: 100%; padding: 14px; border: 1px solid var(--ri-line); border-radius: 14px; background: #f8fafc; }
.warranty-card__head, .claim-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.warranty-card__head strong, .claim-card__head strong, .claim-card h3 { display: block; margin: 0; font-size: 15px; }
.claim-card__head span:not(.badge), .claim-card p, .warranty-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; margin: 7px 0 0; color: var(--ri-muted); font-size: 12px; font-weight: 700; }
.warranty-meta span b { color: var(--ri-ink); }
.warranty-card .btn, .claim-card .btn { margin-top: 12px; }
.claim-layout { display: grid; grid-template-columns: minmax(240px, .75fr) minmax(0, 1.25fr); gap: 16px; align-items: start; }
.claim-summary h2 { margin: 10px 0 4px; font-size: 21px; }
.claim-summary p { margin: 0; color: var(--ri-muted); }

@media (max-width: 768px) {
  .warranty-card-grid, .claim-card-grid, .claim-layout { grid-template-columns: 1fr; }
  .warranty-card, .claim-card, .claim-summary { padding: 13px; border-radius: 13px; }
}

/* Desktop owns one scrolling surface: the content area. */
@media (min-width: 769px) {
  html,
  body,
  .app {
    height: 100%;
  }

  body {
    overflow: hidden;
  }

  .sidebar {
    position: fixed;
    top: 0;
    right: auto;
    bottom: 0;
    left: 0;
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
  }

  .sidebar .brand,
  .sidebar-location {
    flex: 0 0 auto;
  }

  .sidebar .nav {
    flex: 1 1 auto;
    min-height: 0;
    overscroll-behavior: contain;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .main {
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}

@media (max-width: 768px) {
  body {
    overflow-y: auto;
  }

  .main {
    height: auto;
    overflow-y: visible;
  }
}

.motor-profile-hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: stretch;
  padding: 24px;
  border-radius: 18px;
  background: linear-gradient(135deg, #090d12, #1b232d);
  color: var(--ri-white);
  box-shadow: var(--ri-shadow);
}

.motor-profile-hero h1 {
  margin: 10px 0 2px;
  font-size: 34px;
  font-weight: 950;
  letter-spacing: 0;
}

.motor-profile-hero p { margin: 0; color: #c5ceda; font-weight: 700; }
.motor-profile-owner { display: inline-flex; align-items: center; gap: 7px; margin-top: 16px; color: var(--ri-yellow); font-weight: 850; }
.motor-profile-owner a { text-decoration: underline; text-underline-offset: 3px; }
.motor-profile-km { display: grid; align-content: center; min-width: 210px; padding: 16px; border: 1px solid rgba(255,255,255,.14); border-radius: 14px; background: rgba(255,255,255,.07); }
.motor-profile-km span, .motor-profile-km small { color: #c5ceda; font-weight: 750; }
.motor-profile-km strong { margin: 3px 0; color: var(--ri-yellow); font-size: 29px; line-height: 1; }
.motor-profile-actions { margin: 14px 0; }

.motor-stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.motor-stat-grid article { display: grid; gap: 4px; padding: 16px; border: 1px solid var(--ri-line); border-radius: 14px; background: var(--ri-white); box-shadow: var(--ri-soft-shadow); }
.motor-stat-grid span, .motor-stat-grid small { color: var(--ri-muted); font-size: 12px; font-weight: 750; }
.motor-stat-grid strong { overflow-wrap: anywhere; font-size: 21px; line-height: 1.18; }

.motor-profile-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(300px, .75fr); gap: 16px; align-items: start; }
.motor-profile-section { max-width: 100%; padding: 18px; border: 1px solid var(--ri-line); border-radius: 16px; background: var(--ri-white); box-shadow: var(--ri-soft-shadow); }
.motor-media-panel { margin-bottom: 16px; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.section-title span { display: block; color: var(--ri-red); font-size: 12px; font-weight: 900; text-transform: uppercase; }
.section-title h2 { margin: 2px 0 0; font-size: 20px; }
.section-title small { color: var(--ri-muted); font-weight: 750; }

.motor-warranty-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.motor-warranty-card { padding: 14px; border: 1px solid #b7efca; border-radius: 14px; background: #f0fdf4; }
.motor-warranty-card > div:first-child { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.motor-warranty-card strong { font-size: 14px; }
.motor-warranty-card p, .motor-warranty-card__meta { margin: 7px 0 0; color: #4b6353; font-size: 12px; font-weight: 750; }
.motor-warranty-card__meta { display: grid; gap: 3px; }
.motor-warranty-card a { display: inline-block; margin-top: 11px; color: #15803d; font-size: 12px; font-weight: 900; text-decoration: underline; text-underline-offset: 3px; }

.motor-timeline { display: grid; gap: 0; }
.motor-timeline__item { position: relative; display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 12px; padding: 0 0 18px; }
.motor-timeline__item:not(:last-child)::before { content: ""; position: absolute; top: 36px; bottom: 0; left: 17px; width: 2px; background: var(--ri-line); }
.motor-timeline__icon { position: relative; z-index: 1; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 12px; background: #121820; color: var(--ri-yellow); }
.motor-timeline__content { min-width: 0; padding: 11px 12px; border: 1px solid var(--ri-line); border-radius: 13px; background: #fbfcfe; }
.motor-timeline__head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.motor-timeline__head strong, .motor-timeline__head small { display: block; }
.motor-timeline__head small, .motor-timeline__content p { color: var(--ri-muted); font-size: 12px; font-weight: 700; }
.motor-timeline__content p { margin: 7px 0 0; overflow-wrap: anywhere; }
.motor-timeline__content a { display: inline-block; margin-top: 9px; color: var(--ri-red); font-size: 12px; font-weight: 900; }

.motor-invoice-list { display: grid; gap: 8px; }
.motor-invoice-row { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 12px; border: 1px solid var(--ri-line); border-radius: 12px; background: #fbfcfe; }
.motor-invoice-row:hover { border-color: rgba(237, 28, 36, .35); background: #fff8f8; }
.motor-invoice-row div:last-child { display: grid; justify-items: end; gap: 5px; }
.motor-invoice-row strong, .motor-invoice-row span { display: block; }
.motor-invoice-row > div:first-child span { margin-top: 3px; color: var(--ri-muted); font-size: 12px; font-weight: 700; }

.package-components { margin: 22px 0; padding: 18px; border: 1px solid var(--ri-line); border-radius: 14px; background: #fbfcfe; }
.package-components .section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.package-components .section-heading h3 { margin: 0; font-size: 18px; }
.package-components > .muted { display: block; margin: 8px 0 14px; }
#packageItemRows { display: grid; gap: 10px; }
.package-item-row { display: grid; grid-template-columns: 130px minmax(190px, 1.6fr) repeat(3, minmax(110px, .7fr)) minmax(120px, .7fr) auto; gap: 10px; align-items: end; padding: 12px; border: 1px solid var(--ri-line); border-radius: 12px; background: var(--ri-white); }
.package-item-row .field { min-width: 0; }
.package-item-row .check-field { padding-bottom: 8px; }
.package-item-row .check-field label { display: flex; gap: 7px; align-items: center; margin: 0; font-size: 13px; }
.package-item-row .check-field input { width: 16px; height: 16px; }
.wo-media-panel { margin-top: 18px; }
.wo-media-upload { display: grid; grid-template-columns: minmax(190px, 1.25fr) minmax(140px, .75fr) minmax(220px, 1.2fr) minmax(165px, .85fr) auto; gap: 12px; align-items: end; }
.wo-media-upload .field { min-width: 0; }
.wo-media-public { padding: 12px 0; font-size: 13px; font-weight: 700; }
.wo-media-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.wo-media-card { overflow: hidden; border: 1px solid var(--ri-line); border-radius: 8px; background: var(--ri-white); }
.wo-media-card > a { display: block; background: #edf1f5; }
.wo-media-card img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.wo-media-card__body { display: grid; gap: 7px; padding: 11px; }
.wo-media-card__body strong { font-size: 13px; text-transform: capitalize; }
.wo-media-card__caption { display: -webkit-box; margin: 0; overflow: hidden; color: var(--ri-muted); font-size: 12px; line-height: 1.45; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.wo-media-card__body small { color: var(--ri-muted); font-size: 11px; font-weight: 700; }

.report-filter { margin-bottom: 18px; }
.report-filter__action { align-self: end; }
.report-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.report-metrics article { min-width: 0; padding: 18px; border: 1px solid var(--ri-border); border-radius: 8px; background: #fff; box-shadow: var(--ri-shadow); }
.report-metrics span, .report-metrics small { display: block; color: var(--ri-muted); font-size: 12px; font-weight: 700; }
.report-metrics strong { display: block; margin: 8px 0 6px; font-size: 20px; line-height: 1.2; overflow-wrap: anywhere; }
.report-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px; }
.report-grid .panel { margin: 0; min-width: 0; }
.report-section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.report-section-head h2 { margin: 0 0 4px; font-size: 18px; }
.report-section-head p { margin: 0; }
.report-status-list { display: grid; gap: 8px; }
.report-status-list > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--ri-border); }
.report-status-list > div:last-child { border-bottom: 0; }

@media (max-width: 980px) {
  .motor-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .motor-profile-layout { grid-template-columns: 1fr; }
  .motor-warranty-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .package-item-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .wo-media-upload { grid-template-columns: 1fr 1fr; }
  .wo-media-caption { grid-column: 1 / -1; }
  .wo-media-public, .wo-media-upload .btn { grid-column: auto; }
  .wo-media-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .report-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .role-overview--access,
  .permission-choice-grid { grid-template-columns: 1fr; }
  .role-access-intro { align-items: flex-start; padding: 13px 14px; }
  .permission-group summary { padding: 12px 13px; }
  .permission-choice-grid { padding: 10px; }
  .role-matrix-wrap,
  .role-selector-wrap { border-radius: 12px; }
  .role-matrix { min-width: 700px; }
  .role-matrix__role,
  .role-matrix__status { width: 112px; min-width: 112px; }
  .role-matrix thead th:first-child,
  .role-matrix__permission,
  .role-selector thead th:first-child,
  .role-selector tbody > tr:not(.role-selector__section) > th { min-width: 205px; }
  .role-matrix thead th,
  .role-selector thead th { padding: 12px; }
  .role-matrix__permission,
  .role-selector tbody > tr:not(.role-selector__section) > th { padding: 11px 12px; }
  .role-matrix-actions__list > div { align-items: flex-start; flex-direction: column; }
  .role-matrix-actions__list .table-actions { width: 100%; }
  .motor-profile-hero { display: grid; gap: 16px; padding: 18px; border-radius: 16px; }
  .motor-profile-hero h1 { font-size: 29px; }
  .motor-profile-km { min-width: 0; padding: 14px; }
  .motor-stat-grid, .motor-warranty-grid { grid-template-columns: 1fr; }
  .motor-profile-section { padding: 14px; border-radius: 14px; }
  .section-title { align-items: flex-start; }
  .section-title h2 { font-size: 18px; }
  .motor-timeline__head { display: grid; }
  .motor-timeline__head .badge { justify-self: start; }
  .motor-invoice-row { align-items: flex-start; }
  .motor-invoice-row div:last-child { justify-items: start; }
  .package-components { padding: 14px; }
  .package-components .section-heading { align-items: flex-start; }
  .package-item-row { grid-template-columns: 1fr 1fr; padding: 11px; }
  .package-item-row .component-source { grid-column: 1 / -1; }
  .package-item-row > .btn { grid-column: 1 / -1; justify-self: start; }
  .wo-media-upload { grid-template-columns: 1fr; }
  .wo-media-caption { grid-column: auto; }
  .wo-media-public { padding: 0; }
  .wo-media-upload .btn { justify-self: start; }
  .wo-media-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-metrics { grid-template-columns: 1fr; gap: 10px; }
  .report-metrics article { padding: 15px; }
  .report-metrics strong { font-size: 18px; }
  .report-section-head { align-items: stretch; flex-direction: column; }
  .report-section-head .btn { width: fit-content; }
}
