:root {
  --bg: #f3f6fb;
  --surface: #ffffff;
  --surface-elevated: #ffffff;
  --border: #e3e9f2;
  --border-strong: #d7e0ec;
  --text: #22324a;
  --muted: #7e8ba0;
  --accent: #ff7a13;
  --accent-hover: #ee6900;
  --accent-faint: rgba(255, 122, 19, 0.14);
  --sidebar-bg: #191919;
  --sidebar-text: #b5bfcd;
  --sidebar-active: #ffffff;
  --sidebar-line: rgba(255, 255, 255, 0.08);
  --green: #169c63;
  --green-bg: #cef5df;
  --blue: #2d66df;
  --blue-bg: #dce8ff;
  --red: #d93c35;
  --red-bg: #ffdede;
  --yellow: #b86a00;
  --yellow-bg: #ffeabf;
  --radius: 14px;
  --radius-lg: 22px;
  --shadow: 0 18px 40px rgba(34, 50, 74, 0.08);
  --shadow-soft: 0 8px 24px rgba(86, 104, 131, 0.08);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
}

.hidden {
  display: none !important;
}

/* ——— Shell ——— */

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

.workspace {
  min-width: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

.screen-section {
  padding: 28px 32px 48px;
  max-width: 1120px;
}

/* ——— Sidebar ——— */

.sidebar {
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  border-right: 1px solid var(--sidebar-line);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px;
  border-bottom: 1px solid var(--sidebar-line);
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 14px;
  background: #fff;
  border: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  flex-shrink: 0;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-mark-auth {
  background: transparent;
  border: 0;
}

.sidebar-brand-text {
  min-width: 0;
}

.sidebar-logo {
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #fff;
}

.sidebar-user {
  padding: 14px 16px;
  border-bottom: 1px solid var(--sidebar-line);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-role-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.sidebar-user-button {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  font-size: 0.9rem;
  font-weight: 500;
  color: #f6b388;
  cursor: pointer;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user-button:hover,
.sidebar-user-button.is-active-profile {
  color: #fff;
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 12px 8px;
  gap: 2px;
}

.nav-link {
  appearance: none;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: #94a0b3;
  padding: 12px 14px;
  font-size: 0.95rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.nav-link.is-active {
  background: var(--accent);
  color: #fff;
  box-shadow: none;
}

.sidebar-footer {
  padding: 12px 12px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-top: 1px solid var(--sidebar-line);
  margin-top: auto;
}

.sidebar-footer-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: #b5bfcd;
  font-size: 0.82rem;
  padding: 6px 8px;
  text-align: left;
  cursor: pointer;
  border-radius: 14px;
}

.sidebar-footer-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

/* ——— Top bar ——— */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 18px 26px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.topbar-title-block {
  min-width: 0;
}

.page-heading {
  margin: 0;
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.page-subtitle {
  margin: 4px 0 0;
  font-size: 0.9rem;
  color: var(--muted);
  max-width: 42em;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
}

.topbar-pill {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  color: #97a3b6;
  font-size: 0.9rem;
  white-space: nowrap;
}

.topbar-pill-accent {
  border-color: rgba(255, 122, 19, 0.25);
  background: rgba(255, 122, 19, 0.08);
  color: var(--accent);
}

.mobile-nav-overlay,
.mobile-menu-toggle {
  display: none;
}

.mobile-tabbar {
  display: none;
}

.mobile-menu-toggle {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
}

.mobile-menu-toggle span {
  display: block;
  width: 16px;
  height: 1.5px;
  border-radius: 1px;
  background: var(--text);
}

body.mobile-menu-open {
  overflow: hidden;
}

/* ——— Overview ——— */

.overview-layout {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 30px;
  padding: 18px 20px;
  box-shadow: var(--shadow-soft);
}

.panel-title {
  margin: 0 0 14px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}

.block-title {
  margin-top: 24px;
}

.block-title:first-child {
  margin-top: 0;
}

.toolbar-title {
  margin: 0;
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.segmented-btn {
  border: 0;
  background: #eef3fb;
  color: #475a78;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 0.92rem;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.segmented-btn:hover {
  background: #e6eefb;
}

.segmented-btn.is-active {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
}

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

@media (min-width: 720px) {
  .stat-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.stat-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
  box-shadow: 0 2px 8px rgba(102, 123, 155, 0.04);
}

.stat-card.is-expanded {
  grid-column: 1 / -1;
}

.stat-card-trigger {
  width: 100%;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto 16px;
  gap: 10px;
  align-items: center;
  padding: 12px 12px;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.stat-card-trigger:hover {
  background: rgba(0, 0, 0, 0.02);
}

.stat-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 1.05rem;
  font-weight: 800;
  background: #eef3fb;
  color: #475a78;
}

.stat-card-label {
  font-size: 0.8rem;
  color: var(--muted);
}

.stat-card-value {
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.stat-card-chevron {
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.15s ease;
  opacity: 0.5;
}

.stat-card.is-expanded .stat-card-chevron {
  transform: rotate(225deg);
}

.stat-card-details {
  display: none;
  padding: 0 12px 12px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.stat-card.stat-accent .stat-card-icon {
  background: rgba(246, 114, 18, 0.12);
  color: var(--accent);
}

.stat-card.stat-ok .stat-card-icon {
  background: rgba(22, 156, 99, 0.12);
  color: var(--green);
}

.stat-card.stat-warn .stat-card-icon {
  background: rgba(217, 60, 53, 0.12);
  color: var(--red);
}

.stat-card.stat-neutral .stat-card-icon {
  background: rgba(45, 102, 223, 0.12);
  color: var(--blue);
}

.stat-card-details.is-open {
  display: block;
}

.stat-detail-line {
  font-size: 0.82rem;
  color: var(--muted);
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}

.stat-detail-line:last-child {
  border-bottom: 0;
}

.simple-rows {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.simple-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}

.simple-row:last-child {
  border-bottom: 0;
}

.simple-row-label {
  color: var(--muted);
}

.simple-row-value {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.alert-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.alert-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: start;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  font-size: 0.88rem;
}

.alert-row-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.alert-row-code {
  font-weight: 600;
  letter-spacing: -0.02em;
}

.alert-row-meta {
  line-height: 1.35;
}

.alert-row-pill {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 700;
}

.alert-row-pill.is-ok {
  background: var(--green-bg);
  color: var(--green);
}

.alert-row-pill.is-warn {
  background: var(--red-bg);
  color: var(--red);
}

.alert-row-time {
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ——— Cards & tools ——— */

.content-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 22px 24px;
  box-shadow: var(--shadow);
}

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

.workspace-toolbar.toolbar-tight {
  margin-top: 8px;
  margin-bottom: 14px;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.content-card h3:not(.panel-title) {
  margin: 0 0 8px;
  font-size: 1rem;
  font-weight: 600;
}

.modal-head,
.content-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.modal-card h2 {
  margin: 4px 0 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.section-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 6px;
}

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

/* ——— Forms ——— */

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 9px 11px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  font-size: 0.92rem;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--text);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.06);
}

label span {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted);
}

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

.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.wide {
  grid-column: span 2;
}

.primary-btn {
  border: 0;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  padding: 9px 16px;
  font-weight: 800;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.12s ease, opacity 0.12s ease;
}

.primary-btn:hover {
  background: var(--accent-hover);
}

.primary-btn-small {
  padding: 7px 11px;
  font-size: 0.85rem;
}

.ghost-btn {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 8px 12px;
  font-weight: 500;
  font-size: 0.88rem;
  cursor: pointer;
}

.ghost-btn:hover {
  border-color: var(--text);
}

.icon-refresh {
  min-width: 40px;
  padding-left: 10px;
  padding-right: 10px;
}

.icon-refresh::after {
  content: "↻";
  font-size: 1rem;
  line-height: 1;
}

.danger-btn {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--red);
  padding: 7px 11px;
  font-weight: 500;
  font-size: 0.85rem;
  cursor: pointer;
}

.danger-btn:hover {
  background: var(--red-bg);
}

/* ——— Tables ——— */

.table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 18px;
  margin-top: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1100px;
  font-size: 0.92rem;
}

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

thead th {
  font-size: 0.94rem;
  color: #62748e;
  background: #f9fbfd;
  font-weight: 800;
}

tbody tr:hover {
  background: #fbfcff;
}

.row-index {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: #f2f5fa;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #6d7f98;
}

/* ——— Status ——— */

.status-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.status-filter-chip {
  border: 0;
  border-radius: 999px;
  padding: 10px 15px;
  background: #eef2f7;
  color: #4f617b;
  font-weight: 800;
  cursor: pointer;
}

.status-filter-chip.is-active {
  background: #4f617b;
  color: #fff;
}

.status-chip-ready {
  background: var(--green-bg);
  border-color: transparent;
  color: var(--green);
}

.status-chip-progress {
  background: var(--blue-bg);
  border-color: transparent;
  color: var(--blue);
}

.status-chip-waiting {
  background: var(--red-bg);
  border-color: transparent;
  color: var(--red);
}

.status-filter-select {
  margin-left: auto;
  max-width: 200px;
  font-size: 0.92rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 8px 13px;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 800;
}

.status-ready {
  color: var(--green);
  background: var(--green-bg);
}

.status-progress {
  color: var(--blue);
  background: var(--blue-bg);
}

.status-waiting {
  color: var(--red);
  background: var(--red-bg);
}

.search-wrap {
  flex: 1;
  min-width: 200px;
}

.search-wrap-wide {
  max-width: 420px;
}

/* ——— Bikes & inventory ——— */

.inventory-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.inventory-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  background: var(--surface);
}

.inventory-card.is-low {
  border-color: rgba(185, 28, 28, 0.35);
  background: #fffafa;
}

.inventory-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.88rem;
  font-weight: 500;
  margin-bottom: 6px;
}

.inventory-stock {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 4px 0;
}

.bike-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  background: var(--surface);
  transition: border-color 0.12s ease;
}

.bike-card:hover {
  border-color: var(--border-strong);
}

.bike-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.bike-card-code {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

.bike-card-model {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-top: 4px;
}

.bike-card-history {
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--bg);
  border: 1px solid var(--border);
}

.bike-card-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}

.bike-card-notes {
  margin: 10px 0 0;
  font-size: 0.88rem;
}

.bike-status-select {
  flex: 1;
  min-width: 160px;
  font-size: 0.85rem;
}

.inventory-actions,
.inventory-actions-bike,
.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.inventory-actions-bike {
  justify-content: flex-start;
}

.icon-btn {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 6px 10px;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
}

.icon-btn:hover {
  border-color: var(--text);
}

/* ——— Repairs queue cards ——— */

.stack-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stack-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: var(--bg);
  font-size: 0.9rem;
}

.repair-compact-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.12s ease;
}

.repair-compact-card:hover {
  border-color: var(--border-strong);
}

.repair-compact-head,
.repair-compact-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}

.repair-compact-main .metric-value {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.repair-queue-code {
  font-size: 1.15rem;
  font-weight: 600;
}

.work-order-detail-grid {
  display: grid;
  gap: 12px;
}

.work-order-hero {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg);
}

/* ——— Diagnostics ——— */

.diagnostic-entry-panel {
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg);
}

.diagnostic-category-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

.diagnostic-category-grid-modal {
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}

.diagnostic-category-card,
.diagnostic-fault-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  text-align: left;
  background: var(--surface);
  cursor: pointer;
  font: inherit;
  transition: border-color 0.12s ease;
}

.diagnostic-category-card:hover,
.diagnostic-fault-card:hover {
  border-color: var(--text);
}

.diagnostic-category-card strong,
.diagnostic-fault-card strong {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.diagnostic-category-card p {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.35;
}

.diagnostic-wizard {
  margin-bottom: 14px;
}

.diagnostic-stepper {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.diagnostic-step-chip {
  font-size: 0.75rem;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--bg);
  color: var(--muted);
  font-weight: 500;
}

.diagnostic-step-chip.is-active {
  background: var(--text);
  color: #fff;
}

.diagnostic-step-view {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--surface);
}

.diagnostic-step-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.diagnostic-selection-summary {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  margin-bottom: 12px;
}

.diagnostic-selection-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: var(--bg);
  font-size: 0.85rem;
}

.diagnostic-selection-card strong {
  display: block;
  margin-top: 4px;
  font-weight: 600;
}

.diagnostic-fault-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

.diagnostic-category-tag {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: var(--radius);
  background: var(--bg);
  border: 1px solid var(--border);
}

.severity-pill {
  display: inline-flex;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}

.severity-low {
  background: var(--green-bg);
  color: var(--green);
}

.severity-medium {
  background: var(--yellow-bg);
  color: var(--yellow);
}

.severity-critical {
  background: var(--red-bg);
  color: var(--red);
}

/* ——— Issue checklist ——— */

.issue-checklist-card {
  max-width: 1000px;
}

.issue-checklist-layout {
  display: grid;
  grid-template-columns: minmax(200px, 260px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.issue-checklist-summary {
  position: sticky;
  top: 72px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg);
}

.issue-checklist-summary label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 500;
}

.checklist-progress-track {
  height: 4px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}

.checklist-progress-track span {
  display: block;
  height: 100%;
  background: var(--text);
  transition: width 0.15s ease;
}

.issue-checklist-status {
  width: 100%;
  border: 0;
  padding: 10px 12px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
}

.issue-checklist-status.is-ready {
  background: var(--green);
  color: #fff;
}

.issue-checklist-status.is-blocked {
  background: var(--border);
  color: var(--muted);
  cursor: not-allowed;
}

.issue-checklist-groups {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.issue-checklist-group {
  margin: 0;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.issue-checklist-group legend {
  padding: 0 6px;
  font-size: 0.88rem;
  font-weight: 600;
}

.issue-checklist-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.issue-checklist-item {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 10px;
  align-items: start;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  font-size: 0.88rem;
}

.issue-checklist-item input {
  width: 16px;
  height: 16px;
  margin-top: 2px;
}

/* ——— Owner ——— */

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

.owner-card-wide {
  grid-column: 1 / -1;
}

.big-number {
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  margin: 8px 0;
}

.profile-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.profile-avatar {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  background: var(--bg);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 1rem;
}

.profile-name-display {
  font-weight: 600;
}

.readonly-badge {
  display: inline-flex;
  padding: 6px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--muted);
}

/* ——— Overlays ——— */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.35);
  overflow: auto;
}

.auth-card,
.modal-card {
  width: min(100%, 560px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  max-height: min(90vh, 900px);
  overflow: auto;
}

.auth-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.auth-title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
}

.auth-lead {
  margin: 2px 0 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.auth-note {
  margin-top: 14px;
  font-size: 0.82rem;
  color: var(--muted);
}

.auth-form {
  margin-top: 8px;
}

.success-text {
  color: var(--green);
  font-size: 0.88rem;
  margin-top: 10px;
}

.error-text {
  color: var(--red);
  font-size: 0.88rem;
  margin-top: 10px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.repair-alerts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 100;
  display: grid;
  gap: 8px;
  pointer-events: none;
}

.repair-alert {
  min-width: min(320px, calc(100vw - 32px));
  padding: 12px 14px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--text);
  color: #fff;
  font-size: 0.88rem;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.repair-alert.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.repair-alert p {
  margin: 4px 0 0;
  color: rgba(255, 255, 255, 0.82);
}

/* ——— Focus ——— */

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

.nav-link:focus-visible,
.segmented-btn:focus-visible,
.stat-card-trigger:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 1px;
}

/* ——— Responsive ——— */

@media (max-width: 1080px) {
  .page-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(280px, 88vw);
    z-index: 70;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.08);
  }

  body.mobile-menu-open .sidebar {
    transform: translateX(0);
  }

  .mobile-nav-overlay {
    position: fixed;
    inset: 0;
    z-index: 65;
    display: block;
    background: rgba(0, 0, 0, 0.25);
  }

  .mobile-nav-overlay.hidden {
    display: none;
  }

  .mobile-menu-toggle {
    display: inline-flex;
  }

  .screen-section {
    padding: 20px 18px 40px;
  }

  .topbar {
    padding: 14px 18px;
  }
}

/* iPhone / mobile-first mechanic UX */
@media (max-width: 900px) {
  .topbar-right {
    display: none;
  }

  .screen-section {
    padding: 14px 12px 96px;
  }

  .content-card,
  .panel {
    padding: 16px 14px;
    border-radius: 22px;
  }

  .workspace-toolbar {
    gap: 10px;
  }

  input,
  select,
  textarea {
    min-height: 46px;
    border-radius: 14px;
    padding: 12px 14px;
    font-size: 1rem;
  }

  .primary-btn,
  .ghost-btn,
  .danger-btn,
  .icon-btn {
    min-height: 46px;
    border-radius: 14px;
  }

  /* Replace sidebar with bottom tabbar */
  .sidebar {
    display: none;
  }

  .mobile-nav-overlay {
    display: none !important;
  }

  .mobile-menu-toggle {
    display: none !important;
  }

  .page-shell {
    grid-template-columns: 1fr;
  }

  .mobile-tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 95;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
    padding: 10px 10px 12px;
    background: rgba(25, 25, 25, 0.92);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
  }

  .mobile-tab {
    border: 0;
    background: transparent;
    color: rgba(255, 255, 255, 0.72);
    padding: 8px 6px;
    border-radius: 14px;
    display: grid;
    justify-items: center;
    gap: 4px;
    font-weight: 800;
  }

  .mobile-tab.is-active {
    background: rgba(255, 122, 19, 0.16);
    color: #fff;
  }

  .mobile-tab-icon {
    font-size: 1.05rem;
    line-height: 1;
  }

  .mobile-tab-label {
    font-size: 0.72rem;
    letter-spacing: 0.02em;
  }

  /* Make tables readable on mobile via existing card-layout rules */
  table {
    min-width: 0;
  }
}

@media (max-width: 900px) {
  .owner-grid,
  .form-grid,
  .issue-checklist-layout,
  .diagnostic-selection-summary {
    grid-template-columns: 1fr;
  }

  .wide {
    grid-column: span 1;
  }

  .issue-checklist-summary {
    position: static;
  }

  .status-filter-select {
    margin-left: 0;
    max-width: none;
    width: 100%;
  }
}

@media (max-width: 680px) {
  .stat-grid {
    grid-template-columns: 1fr;
  }

  .stat-card.is-expanded {
    grid-column: auto;
  }

  .topbar-title-block .page-heading {
    font-size: 1.15rem;
  }

  table,
  thead,
  tbody,
  th,
  td,
  tr {
    display: block;
    width: 100%;
  }

  thead {
    display: none;
  }

  tbody {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  tbody tr {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 12px;
    background: var(--surface);
  }

  tbody td {
    border: 0;
    padding: 6px 0;
  }

  tbody td::before {
    content: attr(data-label);
    display: block;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    margin-bottom: 2px;
  }

  tbody td:first-child::before {
    display: none;
  }

  .table-wrap {
    overflow: visible;
    border: 0;
  }

  table {
    min-width: 0;
  }
}

@media print {
  body {
    background: #fff;
  }

  .sidebar,
  .topbar,
  .mobile-nav-overlay,
  .checklist-actions,
  .overlay,
  .screen-section.hidden {
    display: none !important;
  }

  .page-shell {
    display: block;
    min-height: auto;
  }

  .workspace,
  .content-card,
  .screen-section {
    background: #fff;
    border: 0;
    box-shadow: none;
    padding: 0;
  }

  .issue-checklist-card {
    max-width: none;
  }

  .issue-checklist-layout {
    grid-template-columns: 200px 1fr;
  }

  .issue-checklist-summary,
  .issue-checklist-group,
  .issue-checklist-item {
    break-inside: avoid;
  }
}

/* ——— Fleet-like overview extras ——— */

.events-feed {
  display: grid;
  gap: 10px;
}

.event-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 14px 16px;
  border: 1px solid #e5ecf6;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(102, 123, 155, 0.04);
}

.event-title {
  font-weight: 900;
  color: #33415c;
}

.event-time {
  color: #8a97aa;
  font-size: 0.86rem;
  font-weight: 800;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.status-bars {
  display: grid;
  gap: 12px;
}

.status-bar-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-weight: 800;
}

.status-bar-label {
  color: #33415c;
  font-size: 0.92rem;
}

.status-bar-value {
  color: #7c8da8;
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
}

.status-bar-track {
  margin-top: 8px;
  height: 10px;
  border-radius: 999px;
  background: #e7edf6;
  overflow: hidden;
}

.status-bar-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--accent);
}

.bike-filter-toolbar {
  margin-bottom: 14px;
}
