/* ============ Design tokens ============ */
:root {
  --color-brand-amber: #FEAA0A;
  --color-brand-orange: #FE4708;
  --color-bg-app: #F5F5F8;
  --color-bg-card: #FFFFFF;
  --color-ink: #1F1F22;
  --color-ink-soft: #46464C;
  --color-text-muted: #8A8A93;
  --color-border: #E7E7EC;
  --gradient-brand: linear-gradient(135deg, #FEAA0A 0%, #FE4708 100%);

  --font-base: "Urbanist", sans-serif;

  --radius-card: 20px;
  --radius-input: 14px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(31, 31, 34, 0.04), 0 1px 1px rgba(31, 31, 34, 0.03);
  --shadow-md: 0 8px 24px rgba(31, 31, 34, 0.08);

  --sidebar-w: 264px;
  --sidebar-w-collapsed: 84px;
  --topbar-h: 76px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font-base);
  background: var(--color-bg-app);
  color: var(--color-ink);
  -webkit-font-smoothing: antialiased;
}

button {
  font-family: inherit;
  cursor: pointer;
}

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

/* ============ App shell ============ */
.app {
  display: flex;
  min-height: 100vh;
}

/* ============ Sidebar ============ */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--color-bg-card);
  border-right: 1px solid var(--color-border);
  padding: 20px 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: width .22s ease, padding .22s ease;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 20px;
  position: relative;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--gradient-brand);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.brand-name {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar__collapse {
  margin-left: auto;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--color-border);
  background: var(--color-bg-card);
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .15s ease, color .15s ease, transform .22s ease;
}

.sidebar__collapse:hover {
  background: var(--color-bg-app);
  color: var(--color-ink);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav__group { display: flex; flex-direction: column; }

.nav__item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 12px;
  border: none;
  background: transparent;
  border-radius: 12px;
  color: var(--color-ink-soft);
  font-size: 14.5px;
  font-weight: 500;
  text-align: left;
  transition: background .15s ease, color .15s ease;
}

.nav__item:hover { background: var(--color-bg-app); color: var(--color-ink); }

.nav__item.is-active {
  background: linear-gradient(0deg, rgba(254,170,10,0.12), rgba(254,170,10,0.12));
  color: var(--color-ink);
  font-weight: 600;
  position: relative;
}

.nav__item.is-active::before {
  content: "";
  position: absolute;
  left: -16px;
  top: 8px;
  bottom: 8px;
  width: 4px;
  border-radius: var(--radius-pill);
  background: var(--gradient-brand);
}

.nav__icon {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: inherit;
}

.nav__label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav__chevron {
  flex-shrink: 0;
  color: var(--color-text-muted);
  transition: transform .18s ease;
}

.nav__parent[aria-expanded="true"] .nav__chevron { transform: rotate(90deg); }

.nav__submenu {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 2px 0 6px 40px;
  overflow: hidden;
  max-height: 0;
  transition: max-height .22s ease;
}

.nav__submenu.is-open {
  max-height: 320px;
}

.nav__subitem {
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 13.5px;
  color: var(--color-text-muted);
  transition: background .15s ease, color .15s ease;
}

.nav__subitem:hover { background: var(--color-bg-app); color: var(--color-ink); }
.nav__subitem.is-active { color: var(--color-brand-orange); font-weight: 600; background: var(--color-bg-app); }

/* Collapsed state */
.sidebar.is-collapsed { width: var(--sidebar-w-collapsed); padding: 20px 12px 24px; }
.sidebar.is-collapsed .brand-name,
.sidebar.is-collapsed .nav__label,
.sidebar.is-collapsed .nav__chevron,
.sidebar.is-collapsed .nav__submenu { display: none; }
.sidebar.is-collapsed .sidebar__brand { justify-content: center; padding-bottom: 20px; }
.sidebar.is-collapsed .sidebar__collapse { margin-left: 0; position: absolute; right: -14px; top: 0; background: var(--color-bg-card); box-shadow: var(--shadow-sm); }
.sidebar.is-collapsed .sidebar__collapse svg { transform: rotate(180deg); }
.sidebar.is-collapsed .nav__item { justify-content: center; }
.sidebar.is-collapsed .nav__item.is-active::before { left: -12px; }

/* ============ Main / Topbar ============ */
.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--topbar-h);
  min-height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 28px;
  background: var(--color-bg-card);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar__left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  flex: 1 1 120px;
  overflow: hidden;
}

.topbar__title {
  min-width: 0;
}

.topbar__title h1 {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar__breadcrumb {
  display: block;
  font-size: 12.5px;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  flex-shrink: 0;
}

#mobileNavBtn { display: none; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  transition: transform .12s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }
.btn--icon:active { transform: scale(.8); }

.btn--xs { height: 28px; padding: 0 10px; border-radius: 8px; font-size: 12px; }

/* Square icon-only action button (pairs with a size + colour variant) */
.btn--icon { padding: 0; justify-content: center; }
.btn--icon.btn--xs { width: 28px; }
.btn--icon svg { width: 15px; height: 15px; display: block; }

.btn--ink { background: var(--color-ink); color: #fff; }
.btn--ink:hover { background: #000; }

.btn--amber { background: var(--color-brand-amber); color: #fff; }
.btn--amber:hover { filter: brightness(0.95); }

.btn--ok { background: #23a35f; color: #fff; }
.btn--ok:hover { filter: brightness(0.95); }

.btn--primary {
  background: var(--gradient-brand);
  color: #fff;
  box-shadow: 0 6px 16px rgba(254, 71, 8, 0.28);
}
.btn--primary:hover { box-shadow: 0 8px 20px rgba(254, 71, 8, 0.36); }

.btn--outline {
  background: var(--color-bg-card);
  color: var(--color-ink-soft);
  border-color: var(--color-border);
}
.btn--outline:hover { background: var(--color-bg-app); border-color: #d9d9e0; color: var(--color-ink); }

.btn--dropdown { padding-right: 12px; }
.btn .chev, .dropdown__menu ~ .chev { color: var(--color-text-muted); }

/* ---- Icon button ---- */
.icon-btn {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--color-border);
  background: var(--color-bg-card);
  color: var(--color-ink-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s ease, color .15s ease;
}
.icon-btn:hover { background: var(--color-bg-app); color: var(--color-ink); }
.icon-btn--ghost { border-color: transparent; }

.badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: var(--radius-pill);
  background: var(--color-brand-orange);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--color-bg-card);
}

/* ---- Clock ---- */
.topbar__clock {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-ink-soft);
  padding: 0 4px;
  white-space: nowrap;
}

/* ---- Profile button ---- */
.profile-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--color-border);
  background: var(--color-bg-card);
  border-radius: var(--radius-pill);
  padding: 5px 12px 5px 5px;
  color: var(--color-ink);
  transition: background .15s ease;
}
.profile-btn:hover { background: var(--color-bg-app); }

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--gradient-brand);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.profile-btn__name {
  font-size: 13.5px;
  font-weight: 600;
}

/* ---- Dropdown ---- */
.dropdown { position: relative; }

.dropdown__menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 190px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  box-shadow: var(--shadow-md);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity .15s ease, transform .15s ease, visibility .15s;
  z-index: 30;
}

.dropdown.is-open .dropdown__menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown__menu a {
  padding: 9px 10px;
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--color-ink-soft);
  transition: background .15s ease, color .15s ease;
}
.dropdown__menu a:hover { background: var(--color-bg-app); color: var(--color-ink); }

.dropdown__menu--wide { min-width: 280px; }

.dropdown__header {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--color-text-muted);
  padding: 6px 10px 8px;
}

.dropdown__notif {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 10px;
  font-size: 13.5px;
  color: var(--color-ink-soft);
}
.dropdown__notif:hover { background: var(--color-bg-app); color: var(--color-ink); }

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot--warn { background: var(--color-brand-amber); }
.dot--danger { background: #E5484D; }
.dot--ok { background: #30A46C; }

/* ============ Content ============ */
.content {
  padding: 28px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.placeholder {
  height: 100%;
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  font-size: 14px;
  border: 1.5px dashed var(--color-border);
  border-radius: var(--radius-card);
  background: var(--color-bg-card);
}

/* ============ Scope bar ============ */
.scope-bar {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.scope-field {
  display: flex;
  align-items: center;
  gap: 10px;
}

.scope-field__label {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-muted);
}

.scope-select {
  height: 38px;
  padding: 0 32px 0 12px;
  border-radius: 12px;
  border: 1px solid var(--color-border);
  background: var(--color-bg-card) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'><path d='M6 9l6 6 6-6' stroke='%238A8A93' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/></svg>") no-repeat right 10px center;
  background-size: 14px;
  font-family: var(--font-base);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--color-ink);
  appearance: none;
  cursor: pointer;
}

.scope-select--sm {
  height: 34px;
  font-size: 12.5px;
  font-weight: 500;
}

/* ============ Section header ============ */
.dash-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

.dash-section__title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--color-ink);
  letter-spacing: -0.01em;
}

.link-more {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-brand-orange);
  padding: 4px 2px;
}
.link-more:hover { color: var(--color-ink); }
.link-more svg { transition: transform .15s ease; }
.link-more:hover svg { transform: translateX(2px); }

/* ============ Stat cards ============ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}

.stat-grid--narrow {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  text-align: left;
  transition: border-color .15s ease, box-shadow .15s ease, transform .12s ease;
}

.stat-card:hover {
  border-color: #d9d9e0;
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.stat-card:active { transform: translateY(0) scale(.99); }

.stat-card__icon {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-card__icon--neutral { background: var(--color-bg-app); color: var(--color-ink-soft); }
.stat-card__icon--brand { background: rgba(254, 170, 10, 0.14); color: var(--color-brand-orange); }
.stat-card__icon--warn { background: rgba(254, 170, 10, 0.16); color: #B36B00; }
.stat-card__icon--danger { background: rgba(229, 72, 77, 0.12); color: #E5484D; }
.stat-card__icon--ok { background: rgba(48, 164, 108, 0.14); color: #30A46C; }

.stat-card__body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.stat-card__value {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-ink);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.stat-card__value-sub {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-muted);
}

.stat-card__label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--color-text-muted);
}

.stat-card__delta {
  font-size: 11.5px;
  font-weight: 700;
  margin-top: 2px;
}

.stat-card__delta--up { color: #30A46C; }
.stat-card__delta--down { color: var(--color-text-muted); }

.stat-card--alert .stat-card__value { color: var(--color-ink); }

/* ============ Card shell ============ */
.card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  overflow: hidden;
}

.card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
  flex-wrap: wrap;
}

.card__header--tabs { padding-bottom: 0; }

.card__title {
  margin: 0;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--color-ink);
}

.card__header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 12px;
}

/* ---- Tabs ---- */
.tabs {
  display: flex;
  gap: 4px;
}

.tab {
  border: none;
  background: transparent;
  padding: 14px 4px;
  margin-bottom: -1px;
  font-family: var(--font-base);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--color-text-muted);
  border-bottom: 2px solid transparent;
  transition: color .15s ease, border-color .15s ease;
}

.tabs .tab + .tab { margin-left: 18px; }

.tab:hover { color: var(--color-ink); }

.tab.is-active {
  color: var(--color-ink);
  border-bottom-color: var(--color-brand-orange);
}

.tab-panel { display: none; padding: 4px 20px 20px; }
.tab-panel.is-active { display: block; }

.tab__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  margin-left: 5px;
  border-radius: 999px;
  background: var(--color-bg-app);
  color: var(--color-text-muted);
  font-size: 11px;
  font-weight: 700;
  transition: background-color .15s ease, color .15s ease;
}

.tab.is-active .tab__count {
  background: var(--color-brand-orange);
  color: #fff;
}

/* ---- Tab panel footer ---- */
.table-footer {
  display: flex;
  justify-content: flex-end;
  padding-top: 12px;
}

.btn-text {
  border: none;
  background: transparent;
  padding: 4px 2px;
  font-family: var(--font-base);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--color-brand-orange);
  cursor: pointer;
  transition: color .15s ease;
}

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

/* ---- Date input ---- */
.date-input {
  height: 34px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid var(--color-border);
  background: var(--color-bg-app);
  font-family: var(--font-base);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--color-ink);
}

.btn--sm { height: 34px; padding: 0 12px; font-size: 12.5px; }

/* ---- Data table ---- */
.table-wrap { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.data-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

.data-table td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-ink-soft);
  white-space: nowrap;
}

.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--color-bg-app); }

.cell-sub { font-size: 11.5px; color: var(--color-text-muted); font-weight: 500; }

/* ---- Service type row ---- */
.type-row { display: flex; align-items: center; gap: 12px; }

.type-icon {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: var(--color-bg-app);
  color: var(--color-ink-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.type-row strong { font-size: 13.5px; font-weight: 700; color: var(--color-ink); }

/* ---- Owner row (name + avatar) ---- */
.owner-row { display: flex; align-items: center; gap: 12px; }

.owner-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--color-bg-app);
  color: var(--color-ink-soft);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.owner-row strong { font-size: 13.5px; font-weight: 700; color: var(--color-ink); }

.cars-count-link { color: var(--color-brand-orange); font-weight: 700; }

.text-link { color: var(--color-brand-orange); font-weight: 700; }
.text-link:hover { color: var(--color-ink); }

/* ---- Car thumbnail (list rows) ---- */
.car-thumb-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.car-thumb {
  width: 52px;
  height: 38px;
  border-radius: 10px;
  overflow: hidden;
  flex-shrink: 0;
  background: linear-gradient(135deg, #f4f4f7, #e9e9ee);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
}

.car-thumb img { width: 100%; height: 100%; object-fit: cover; }

.car-thumb-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.car-thumb-info strong { font-size: 13.5px; font-weight: 700; color: var(--color-ink); white-space: nowrap; }
.car-thumb-info span { font-size: 11.5px; color: var(--color-text-muted); white-space: nowrap; }

/* ---- Fuel gauge ---- */
.fuel-gauge { display: flex; align-items: center; gap: 8px; }

.fuel-gauge__bar {
  width: 46px;
  height: 7px;
  border-radius: 999px;
  background: var(--color-bg-app);
  overflow: hidden;
  flex-shrink: 0;
}

.fuel-gauge__fill { height: 100%; border-radius: 999px; background: var(--color-brand-orange); }
.fuel-gauge__label { font-size: 12px; font-weight: 600; color: var(--color-ink-soft); }

/* ---- Pills ---- */
.pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  font-weight: 700;
}

.pill--ok { background: rgba(48, 164, 108, 0.12); color: #218958; }
.pill--warn { background: rgba(254, 170, 10, 0.16); color: #B36B00; }
.pill--danger { background: rgba(229, 72, 77, 0.12); color: #E5484D; }
.pill--neutral { background: var(--color-bg-app); color: var(--color-text-muted); }
.pill--outline { background: transparent; border: 1px solid var(--color-border); color: var(--color-ink-soft); font-weight: 600; }
.pill--brand { background: rgba(254, 71, 8, 0.1); color: var(--color-brand-orange); }

.pill--xs { padding: 2px 7px; font-size: 10px; margin-left: 6px; vertical-align: middle; }

/* ---- Row actions (table action buttons) ---- */
.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
}

/* ---- Overdue row highlight ---- */
tr.row-overdue { background: rgba(229, 72, 77, 0.04); }
tr.row-overdue td:first-child { box-shadow: inset 3px 0 0 #E5484D; }

/* ---- Needs-attention row highlight (e.g. pending items) ---- */
tr.row-flagged { background: rgba(254, 170, 10, 0.05); }
tr.row-flagged td:first-child { box-shadow: inset 3px 0 0 var(--color-brand-amber); }

.btn--outline-danger {
  background: var(--color-bg-card);
  color: #E5484D;
  border-color: rgba(229, 72, 77, 0.3);
}
.btn--outline-danger:hover { background: rgba(229, 72, 77, 0.08); border-color: rgba(229, 72, 77, 0.45); }

/* ---- Filter bar ---- */
.filter-bar {
  padding: 18px 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px 16px;
}

.filter-bar__grid {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 16px;
  flex: 1;
}

.filter-bar__actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1 1 150px;
  min-width: 150px;
}

.filter-field__label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--color-text-muted);
}

.field-input {
  height: 38px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid var(--color-border);
  background: var(--color-bg-app);
  font-family: var(--font-base);
  font-size: 13px;
  font-weight: 600;
  color: var(--color-ink);
}

.field-input::placeholder { color: var(--color-text-muted); font-weight: 500; }

.filter-field .scope-select.filter-field__input { width: 100%; }

/* ---- Pagination ---- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px 18px;
  border-top: 1px solid var(--color-border);
  flex-wrap: wrap;
  gap: 10px;
}

.pagination__info { font-size: 12.5px; color: var(--color-text-muted); }
.pagination__controls { display: flex; gap: 8px; }

/* ---- Empty state ---- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 6px;
  padding: 40px 20px;
  color: var(--color-text-muted);
}

.empty-state__icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--color-bg-app);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  margin-bottom: 4px;
}

.empty-state__title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--color-ink);
}

.empty-state__text {
  margin: 0;
  font-size: 12.5px;
}

/* ============ Fleet cards row ============ */
.fleet-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.fleet-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  overflow: hidden;
  transition: border-color .15s ease, box-shadow .15s ease, transform .12s ease;
}

.fleet-card:hover {
  border-color: #d9d9e0;
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.fleet-card__media {
  position: relative;
  height: 110px;
  background: linear-gradient(135deg, #f4f4f7, #e9e9ee);
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 12px;
  overflow: hidden;
}

.fleet-card__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .25s ease;
}

.fleet-card:hover .fleet-card__img { transform: scale(1.04); }

.fleet-card__status {
  position: relative;
  z-index: 1;
  color: #fff;
  box-shadow: 0 1px 6px rgba(0,0,0,0.25);
  backdrop-filter: blur(2px);
}

.fleet-card__status.pill--ok { background: #23a35f; }
.fleet-card__status.pill--danger { background: #e5484d; }
.fleet-card__status.pill--warn { background: #d98c00; }

.fleet-card__body {
  padding: 14px 16px 16px;
}

.fleet-card__title {
  margin: 0 0 2px;
  font-size: 14px;
  font-weight: 700;
  color: var(--color-ink);
}

.fleet-card__meta {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--color-text-muted);
}

.fleet-card__rate {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--color-ink);
}

.fleet-card__rate span {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-muted);
}

/* ============ Charts ============ */
.chart-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 16px;
  align-items: stretch;
}

.chart-card { display: flex; flex-direction: column; }

.chart-card .card__header { border-bottom: none; padding-bottom: 4px; }

/* ---- Bar chart ---- */
.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 18px;
  height: 190px;
  padding: 20px 24px 8px;
}

.bar-chart__group {
  flex: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 5px;
  height: 100%;
  position: relative;
}

.bar-chart__bar {
  width: 12px;
  border-radius: 5px 5px 2px 2px;
  min-height: 4px;
}

.bar-chart__bar--income { background: var(--gradient-brand); }
.bar-chart__bar--expense { background: var(--color-ink-soft); opacity: .35; }

.bar-chart__label {
  position: absolute;
  bottom: -22px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-muted);
}

/* ---- Legend ---- */
.chart-legend {
  display: flex;
  gap: 18px;
  padding: 12px 24px 20px;
  flex-wrap: wrap;
}

.chart-legend--col {
  flex-direction: column;
  gap: 10px;
  padding: 0;
  justify-content: center;
}

.chart-legend__item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--color-ink-soft);
  white-space: nowrap;
}

.chart-legend__value {
  margin-left: auto;
  color: var(--color-text-muted);
  font-weight: 700;
}

.chart-legend__dot {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  flex-shrink: 0;
}

.chart-legend__dot--income { background: var(--gradient-brand); }
.chart-legend__dot--expense { background: var(--color-ink-soft); opacity: .35; }

/* ---- Donut ---- */
.donut-wrap {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 12px 24px 24px;
  flex-wrap: wrap;
  justify-content: center;
}

.donut {
  position: relative;
  width: 152px;
  height: 152px;
  border-radius: 50%;
  flex-shrink: 0;
}

.donut__center {
  position: absolute;
  inset: 24px;
  border-radius: 50%;
  background: var(--color-bg-card);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.donut__center strong {
  font-size: 20px;
  color: var(--color-ink);
}

.donut__center small {
  font-size: 11px;
  color: var(--color-text-muted);
  font-weight: 600;
}

/* ============ Toasts ============ */
.toast-stack {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 100;
}

.toast {
  background: var(--color-ink);
  color: #fff;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .2s ease, transform .2s ease;
  max-width: 320px;
}

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

/* ============ Form modal (demo overlay) ============ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(31, 31, 34, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 200;
  opacity: 0;
  transition: opacity .18s ease;
}

.modal-overlay.is-visible { opacity: 1; }

.modal {
  background: var(--color-bg-card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-md);
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  transform: translateY(10px) scale(.98);
  transition: transform .18s ease;
}

.modal-overlay.is-visible .modal { transform: translateY(0) scale(1); }

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.modal__title { margin: 0; font-size: 15.5px; font-weight: 700; color: var(--color-ink); }

.modal__close {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  border-radius: 8px;
  color: var(--color-text-muted);
  cursor: pointer;
}

.modal__close:hover { background: var(--color-bg-app); color: var(--color-ink); }

.modal__body {
  padding: 20px 22px;
  overflow-y: auto;
}

.modal__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
}

.modal__field--full { grid-column: 1 / -1; }

.modal__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 22px;
  border-top: 1px solid var(--color-border);
  flex-shrink: 0;
}

.dropzone {
  border: 1.5px dashed var(--color-border);
  border-radius: var(--radius-input);
  background: var(--color-bg-app);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--color-text-muted);
}

.dropzone:hover { border-color: var(--color-brand-amber); color: var(--color-ink-soft); }

.dropzone__preview {
  margin-top: 12px;
  max-width: 160px;
  max-height: 100px;
  border-radius: 10px;
  display: none;
  object-fit: cover;
}

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

.modal__note {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--color-ink-soft);
}

.summary-list { display: flex; flex-direction: column; }

.summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 13px;
}

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

.summary-row__label { color: var(--color-text-muted); font-weight: 600; }
.summary-row__value { color: var(--color-ink); font-weight: 700; text-align: right; }

/* ============ Settings list (read-only rows) ============ */
.settings-list {
  padding: 4px 20px 8px;
}

.settings-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 14px 0;
  border-bottom: 1px solid var(--color-border);
}

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

.settings-row__label {
  font-weight: 600;
  font-size: 14px;
  color: var(--color-ink);
}

.settings-row__desc {
  font-size: 12.5px;
  color: var(--color-text-muted);
}

/* ============ Responsive ============ */
@media (max-width: 1580px) {
  .topbar__clock { display: none; }
}

@media (max-width: 1460px) {
  .btn--outline .btn-label { display: none; }
}

@media (max-width: 1300px) {
  .topbar__title { display: none; }
}

@media (max-width: 1080px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 40; transform: translateX(-100%); box-shadow: var(--shadow-md); }
  .sidebar.is-mobile-open { transform: translateX(0); }
  #mobileNavBtn { display: flex; }
  .topbar { padding: 0 16px; }
}

@media (max-width: 640px) {
  .btn--dropdown .btn-label { display: none; }
  .profile-btn__name { display: none; }
}

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