/* Garage-inspired UI theme for the vehicle inspection workspace. */
:root {
  --garage-steel-950: #18212d;
  --garage-steel-900: #202b3a;
  --garage-steel-800: #2b394b;
  --garage-steel-700: #40536b;
  --garage-steel-500: #4f7df3;
  --garage-steel-100: #e6ebf2;
  --garage-steel-50: #f2f5f9;
  --garage-paper: #ffffff;
  --garage-ink: #2b3441;
  --garage-muted: #6c7888;
  --garage-line: #dfe5ec;
  --garage-green: #169b68;
  --garage-amber: #d99118;
  --garage-red: #d94841;
  --garage-radius: 10px;
  --garage-shadow: 0 1px 2px rgba(35, 47, 62, .06), 0 5px 18px rgba(35, 47, 62, .06);
  --garage-sidebar-width: 248px;
}

html, body { min-height: 100%; }
body { background: var(--garage-steel-50) !important; color: var(--garage-ink); }
button, input, select, textarea { font-family: 'Sarabun', sans-serif; }

/* Login */
#loginScreen {
  min-height: 100vh;
  padding: 1rem;
  background: linear-gradient(135deg, #1a2a3a 0%, #2d3e55 50%, #1a2a3a 100%) !important;
}
#loginScreen .login-card {
  max-width: 420px;
  padding: 0 !important;
  overflow: hidden;
  background: var(--garage-paper) !important;
  border: 0 !important;
  border-radius: 16px !important;
  box-shadow: 0 24px 64px rgba(0, 0, 0, .35) !important;
}
#loginScreen .login-card > .text-center {
  margin-bottom: 0 !important;
  padding: 2rem 2rem 1.75rem;
  color: #fff;
  background: linear-gradient(135deg, #2d3e55, #3d5a80);
}
#loginScreen #loginLogoBox {
  width: 60px !important;
  height: 60px !important;
  margin-bottom: 1rem !important;
  border-radius: 16px !important;
  background: rgba(255, 255, 255, .15) !important;
  box-shadow: none !important;
}
#loginScreen #loginShopName { color: #fff !important; font-size: 1.4rem !important; }
#loginScreen .text-blue-300 { color: rgba(255, 255, 255, .75) !important; }
#loginScreen #loginForm { padding: 2rem; }
#loginScreen #loginForm label { color: #374151 !important; }
#loginScreen #loginForm .relative { position: relative !important; }
#loginScreen #loginForm .relative > i {
  position: absolute !important;
  left: 1rem !important;
  top: 50% !important;
  z-index: 2;
  transform: translateY(-50%) !important;
}
#loginScreen #loginForm .login-input { padding-left: 2.55rem !important; }
#loginScreen #loginForm #password { padding-right: 3rem !important; }
#loginScreen #loginForm button[type='button'] {
  position: absolute !important;
  right: .55rem !important;
  top: 50% !important;
  width: 36px;
  height: 36px;
  padding: 0;
  color: #8793a3 !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: 8px;
  transform: translateY(-50%) !important;
}
#loginScreen #loginForm button[type='button']:hover { color: var(--garage-steel-700) !important; background: var(--garage-steel-50) !important; }
#loginScreen .login-input {
  color: var(--garage-ink) !important;
  background: #fff !important;
  border: 1.5px solid #e5e7eb !important;
  border-radius: 10px !important;
  padding-top: .65rem !important;
  padding-bottom: .65rem !important;
}
#loginScreen .login-input:focus {
  border-color: #2d3e55 !important;
  background: #fff !important;
  box-shadow: 0 0 0 3px rgba(45, 62, 85, .12) !important;
}
#loginScreen .login-input::placeholder { color: #9ca3af !important; }
#loginScreen #loginForm .text-gray-400 { color: #9ca3af !important; }
#loginScreen #loginForm .text-gray-300 { color: #6b7280 !important; }
#loginScreen #loginForm .text-gray-400:hover { color: #2d3e55 !important; }
#loginScreen .login-btn {
  margin-top: .5rem !important;
  padding: .75rem !important;
  color: #fff !important;
  background: linear-gradient(135deg, #2d3e55, #3d5a80) !important;
  border-radius: 10px !important;
}
#loginScreen .login-btn:hover { box-shadow: none !important; opacity: .9; }
#loginScreen #loginError { margin: 1rem 2rem 1.5rem; }

/* Fixed steel sidebar, matching the garage management layout. */
#appScreen { min-height: 100vh; background: var(--garage-steel-50); }
#sidebar {
  position: fixed !important;
  inset: 0 auto 0 0;
  z-index: 1030;
  width: var(--garage-sidebar-width) !important;
  min-height: 100vh;
  overflow-y: auto;
  background: var(--garage-steel-900) !important;
  color: #e7edf5;
  box-shadow: 2px 0 12px rgba(20, 30, 42, .08);
}
#sidebar .sidebar-logo-bg {
  padding: 1rem !important;
  background: transparent !important;
  border-bottom: 1px solid rgba(255, 255, 255, .12);
  border-radius: 0 !important;
}
#sidebar .sidebar-logo-bg > button {
  color: #aeb9c8 !important;
}
#sidebar .sidebar-logo-bg > button:hover { color: #fff !important; }
#sidebar #navLogoBox {
  width: 56px !important;
  height: 56px !important;
  border-radius: 14px !important;
  background: rgba(255, 255, 255, .12) !important;
  border: 2px solid rgba(255, 255, 255, .2);
}
#sidebar #navShopName { color: #f7f9fc !important; font-size: .97rem !important; }
#sidebar .text-blue-400 { color: #aab8c9 !important; }
#sidebar > .p-4:first-child { padding: 0 !important; }
#sidebar > .p-4:first-child > .bg-white\/5 {
  margin: .9rem .9rem 0;
  padding: .75rem !important;
  background: rgba(255, 255, 255, .07) !important;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 10px !important;
}
#sidebar > nav { padding-bottom: 1.25rem; }
#sidebar .nav-section {
  padding: 1.15rem .95rem .35rem;
  color: #9ba8b8;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}
#sidebar .nav-section::after {
  content: '';
  flex: 1;
  height: 1px;
  margin-left: 4px;
  background: rgba(255, 255, 255, .1);
}
#sidebar .nav-item {
  margin: 1px .7rem !important;
  padding: .58rem .8rem !important;
  gap: .7rem !important;
  color: #d5dde8 !important;
  border-radius: 8px !important;
  font-size: .92rem !important;
  background: transparent;
  box-shadow: none !important;
}
#sidebar .nav-item:hover { color: #fff !important; background: var(--garage-steel-800) !important; }
#sidebar .nav-item.active {
  color: #fff !important;
  font-weight: 600;
  background: var(--garage-steel-500) !important;
  box-shadow: 0 4px 14px rgba(79, 125, 243, .25) !important;
}
#sidebar .nav-item i { width: 1.15rem; color: inherit; }
#sidebar .logout-btn {
  margin: 4px 0 !important;
  padding: .58rem .8rem !important;
  color: #f0a09a !important;
  background: rgba(217, 72, 65, .12) !important;
  border: 1px solid rgba(217, 72, 65, .18) !important;
  border-radius: 8px !important;
}
#sidebar .logout-btn:hover { color: #fff !important; background: rgba(217, 72, 65, .28) !important; }

/* Main content and topbar */
#appScreen > .flex-1 {
  width: calc(100% - var(--garage-sidebar-width));
  min-width: 0;
  min-height: 100vh;
  margin-left: var(--garage-sidebar-width);
}
#topbar {
  min-height: 62px;
  padding: .7rem 1.5rem !important;
  background: var(--garage-paper) !important;
  border-bottom: 1px solid var(--garage-line);
  box-shadow: none !important;
}
#topbar h2 { color: var(--garage-ink) !important; font-size: 1.25rem !important; }
#topbar p { color: var(--garage-muted) !important; }
#topbar > div:last-child {
  padding: .35rem .75rem !important;
  background: var(--garage-steel-50) !important;
  border: 1px solid var(--garage-line);
  border-radius: 999px !important;
}
#topbar > div:last-child > div:first-child {
  background: var(--garage-steel-500) !important;
}
#topbar #topUserName { color: var(--garage-ink) !important; }
#topbar #topUserRole { color: var(--garage-muted) !important; }
#appScreen main { padding: 1.6rem 1.75rem 3rem !important; }

/* Surfaces, statistics, shortcut cards and data tables. */
#appScreen .stat-card,
#appScreen .menu-card,
#appScreen main .bg-white.rounded-2xl,
#appScreen main .bg-white.rounded-xl,
#appScreen main .bg-white.rounded-lg {
  border: 1px solid var(--garage-line) !important;
  border-radius: var(--garage-radius) !important;
  box-shadow: var(--garage-shadow) !important;
}
#appScreen .stat-card {
  padding: 1rem 1.1rem !important;
  background: var(--garage-paper) !important;
}
#appScreen .stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(35, 47, 62, .1) !important; }
#appScreen .stat-card .text-gray-800 { color: var(--garage-ink) !important; }
#appScreen .stat-card .text-gray-400 { color: var(--garage-muted) !important; }
#appScreen .menu-card { border: 0 !important; border-radius: var(--garage-radius) !important; }
#appScreen .menu-card:hover { box-shadow: 0 8px 22px rgba(35, 47, 62, .14) !important; }
#appScreen .data-table th {
  color: var(--garage-muted) !important;
  background: #f8fafc !important;
  border-bottom-color: var(--garage-line) !important;
}
#appScreen .data-table td { border-bottom-color: #edf1f5 !important; }
#appScreen .data-table tbody tr:hover { background: #f8fafc !important; }
#appScreen .badge-success { color: var(--garage-green) !important; background: #e2f5eb !important; }
#appScreen .badge-warning { color: var(--garage-amber) !important; background: #fff4dc !important; }
#appScreen .badge-danger { color: var(--garage-red) !important; background: #fde7e5 !important; }

/* Make the existing form controls feel like the garage forms. */
#appScreen input:not([type='checkbox']):not([type='radio']),
#appScreen select,
#appScreen textarea {
  border-color: var(--garage-line) !important;
  border-radius: 8px !important;
  box-shadow: none;
}
#appScreen input:not([type='checkbox']):not([type='radio']):focus,
#appScreen select:focus,
#appScreen textarea:focus {
  border-color: var(--garage-steel-500) !important;
  box-shadow: 0 0 0 3px rgba(79, 125, 243, .12) !important;
}
#appScreen .form-label { color: var(--garage-ink) !important; }
#appScreen .section-panel h2,
#appScreen .section-panel .text-indigo-700 { color: var(--garage-steel-700) !important; }
#appScreen .section-panel .border-indigo-100 { border-color: var(--garage-steel-100) !important; }
#appScreen .section-panel .bg-gray-50 { background: #f8fafc !important; }
#appScreen .section-panel .border-gray-200 { border-color: var(--garage-line) !important; }
#appScreen .section-panel .text-gray-600,
#appScreen .section-panel .text-gray-700 { color: var(--garage-ink) !important; }

/* Keep the layout usable on tablets and phones. */
@media (max-width: 768px) {
  #sidebar {
    transform: translateX(-100%);
    transition: transform .25s ease;
  }
  #sidebar.mob-open { transform: translateX(0); }
  #appScreen > .flex-1 { width: 100%; margin-left: 0; }
  #appScreen main { padding: 1rem !important; }
  #topbar { padding: .7rem 1rem !important; }
  #sidebarOverlay.active { display: block !important; position: fixed; inset: 0; z-index: 1020; background: rgba(14, 22, 33, .42); }
}

@media print {
  #sidebar, #topbar, #quickMenu, .no-print { display: none !important; }
  #appScreen > .flex-1 { width: 100% !important; margin-left: 0 !important; }
  #appScreen main { padding: 0 !important; }
}

/* Insurance module */
#section-insurance-create .insurance-form-divider {
  padding: .7rem 0;
  margin-top: .35rem;
  color: var(--steel-700);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-weight: 700;
}
#section-insurance-create .input-group .btn { white-space: nowrap; }
#section-insurance-create input[readonly] { color: var(--ink-soft); font-weight: 700; }
#section-insurance-list .insurance-table,
#section-insurance-expiry .insurance-table,
#section-insurance-reports .insurance-table { min-width: 980px; }
.insurance-type-pill {
  display: inline-flex;
  padding: .25rem .5rem;
  color: var(--steel-700);
  background: var(--blue-soft);
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 700;
  white-space: nowrap;
}
.insurance-table tbody td { vertical-align: middle; }
.insurance-table tbody tr.is-expired { background: #fff6f6; }
.insurance-table tbody tr.is-urgent { background: #fffaf0; }
.insurance-days, .insurance-status {
  display: inline-flex;
  align-items: center;
  padding: .25rem .5rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 700;
  white-space: nowrap;
}
.insurance-days.is-expired, .insurance-status.is-expired { color: #b42318; background: #fde7e5; }
.insurance-days.is-urgent, .insurance-status.is-urgent { color: #9a6700; background: #fff0c2; }
.insurance-days.is-upcoming, .insurance-status.is-upcoming { color: #087443; background: #e3f7ef; }
.insurance-stat-row, .insurance-report-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}
.insurance-stat, .insurance-report-stats > div {
  min-height: 92px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .2rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow-sm);
}
.insurance-stat strong, .insurance-report-stats strong { color: var(--steel-700); font-size: 1.45rem; }
.insurance-stat span, .insurance-report-stats span { color: var(--ink-soft); font-size: .78rem; }
.insurance-stat.is-danger strong { color: #b42318; }
.insurance-stat.is-warning strong { color: #b7791f; }
.insurance-stat.is-info strong { color: var(--steel-500); }
.insurance-stat.is-total strong { color: #7255c7; }
.insurance-report-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.insurance-report-stats > div:nth-child(2) strong { color: #168451; }
.insurance-report-stats > div:nth-child(3) strong { color: #7255c7; }
.insurance-report-stats > div:nth-child(4) strong { color: #168451; }
.insurance-report-tabs {
  display: flex;
  gap: .25rem;
  padding: 0 .9rem;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
.insurance-report-tab {
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--ink-soft);
  padding: .85rem 1.15rem .7rem;
  white-space: nowrap;
  font-size: .9rem;
  cursor: pointer;
}
.insurance-report-tab:hover { color: var(--steel-700); }
.insurance-report-tab.active {
  color: #1769e0;
  border-bottom-color: #1769e0;
  font-weight: 700;
}
.insurance-report-tab-panel { min-height: 120px; }
.insurance-report-tab-panel .table-responsive { border-radius: 0 0 var(--radius) var(--radius); }
.insurance-settings-card {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--steel-50);
}
.insurance-settings-card h4 {
  margin-bottom: .8rem;
  color: var(--steel-700);
  font-size: .95rem;
  font-weight: 700;
}
.insurance-setting-row {
  display: flex;
  align-items: center;
  gap: .45rem;
  margin-bottom: .5rem;
}
.insurance-setting-row .form-control { min-width: 0; }
.insurance-directory-head,
.insurance-directory-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(110px, .8fr) 34px;
  align-items: center;
  gap: .45rem;
}
.insurance-directory-head {
  padding: 0 .35rem .35rem;
  color: var(--ink-soft);
  font-size: .72rem;
  font-weight: 700;
}
.insurance-directory-row { margin-bottom: .5rem; }
.telegram-settings-card {
  padding: 1.25rem;
  border: 1px solid #c9dced;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #f4f9ff, #fff);
}
.telegram-settings-card h4 { color: #198ed1; font-weight: 700; }
.telegram-settings-card .form-switch .form-check-input { cursor: pointer; }
.sms-settings-card {
  padding: 1.25rem;
  border: 1px solid #b9dfe6;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #f0fbfd, #fff);
}
.sms-settings-card h4 { color: #087d91; font-weight: 700; }
.sms-settings-card code { color: #075985; }
@media (max-width: 768px) {
  .insurance-stat-row, .insurance-report-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .insurance-directory-head, .insurance-directory-row { grid-template-columns: 1fr; }
  .insurance-directory-head { display: none; }
}

/*
 * Bootstrap-first compatibility bridge.
 * The legacy markup still contains a small set of utility names. These
 * structural aliases keep the existing feature views intact while all new
 * components use Bootstrap 5 classes and its responsive grid.
 */
.flex { display: flex; }
.flex-col { flex-direction: column !important; }
.flex-wrap { flex-wrap: wrap !important; }
.flex-1 { flex: 1 1 0% !important; }
.flex-shrink-0 { flex-shrink: 0 !important; }
.items-center { align-items: center !important; }
.items-end { align-items: flex-end !important; }
.justify-between { justify-content: space-between !important; }
.justify-center { justify-content: center !important; }
.justify-end { justify-content: flex-end !important; }
.grid { display: grid !important; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)) !important; }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
.col-span-2 { grid-column: span 2 / span 2 !important; }
.col-span-3 { grid-column: span 3 / span 3 !important; }
.min-w-0 { min-width: 0 !important; }
.w-full { width: 100% !important; }
.relative { position: relative !important; }
.absolute { position: absolute !important; }
.hidden { display: none !important; }
.block { display: block !important; }
.inline-block { display: inline-block !important; }
.overflow-hidden { overflow: hidden !important; }
.overflow-auto { overflow: auto !important; }
.overflow-x-auto { overflow-x: auto !important; }
.overflow-y-auto { overflow-y: auto !important; }
.text-center { text-align: center !important; }
.whitespace-nowrap { white-space: nowrap !important; }
.space-y-1 > :not([hidden]) ~ :not([hidden]) { margin-top: .25rem !important; }
.space-y-2 > :not([hidden]) ~ :not([hidden]) { margin-top: .5rem !important; }
.space-y-3 > :not([hidden]) ~ :not([hidden]) { margin-top: .75rem !important; }
.space-y-4 > :not([hidden]) ~ :not([hidden]) { margin-top: 1rem !important; }
.space-y-5 > :not([hidden]) ~ :not([hidden]) { margin-top: 1.25rem !important; }
.space-y-6 > :not([hidden]) ~ :not([hidden]) { margin-top: 1.5rem !important; }
.gap-1 { gap: .25rem !important; }
.gap-1\.5 { gap: .375rem !important; }
.gap-2 { gap: .5rem !important; }
.gap-3 { gap: .75rem !important; }
.gap-4 { gap: 1rem !important; }
.mr-1 { margin-right: .3rem !important; }
.mr-2 { margin-right: .55rem !important; }
.mr-3 { margin-right: .75rem !important; }
.ml-1 { margin-left: .3rem !important; }
.ml-2 { margin-left: .55rem !important; }

/* Utility colors retained for the existing feature screens. */
.text-gray-300 { color: #9aa6b5 !important; }
.text-gray-400 { color: #8793a3 !important; }
.text-gray-500 { color: #6c7888 !important; }
.text-gray-600 { color: #536173 !important; }
.text-gray-700 { color: #3e4a59 !important; }
.text-gray-800 { color: #2b3441 !important; }
.text-blue-300 { color: #91a7cf !important; }
.text-blue-400 { color: #7895c6 !important; }
.text-blue-500, .text-blue-600, .text-blue-700 { color: #4f7df3 !important; }
.text-green-500, .text-green-600, .text-green-700 { color: #169b68 !important; }
.text-orange-500, .text-orange-600, .text-orange-700 { color: #d99118 !important; }
.text-red-400, .text-red-500 { color: #d94841 !important; }
.text-purple-500, .text-purple-600, .text-purple-700 { color: #7255c7 !important; }
.text-indigo-500, .text-indigo-700 { color: #536aa9 !important; }
.text-white { color: #fff !important; }
.bg-white { background-color: #fff !important; }
.bg-gray-50 { background-color: #f8fafc !important; }
.bg-gray-100 { background-color: #eef2f6 !important; }
.bg-blue-50, .bg-blue-100 { background-color: #eaf0ff !important; }
.bg-green-50, .bg-green-100 { background-color: #e5f5ed !important; }
.bg-orange-50, .bg-orange-100 { background-color: #fff4dc !important; }
.bg-purple-50, .bg-purple-100 { background-color: #f0ebff !important; }
.bg-pink-50, .bg-pink-100 { background-color: #fcecf5 !important; }
.bg-red-100 { background-color: #fde7e5 !important; }
.border-gray-100, .border-gray-200 { border-color: var(--garage-line) !important; }
.border-blue-100, .border-indigo-100 { border-color: var(--garage-steel-100) !important; }
.rounded-2xl, .rounded-xl { border-radius: var(--garage-radius) !important; }
.rounded-full { border-radius: 999px !important; }

/* Tailwind-like gradients are kept only as visual tokens for legacy cards. */
.bg-gradient-to-br, .bg-gradient-to-r {
  background-image: linear-gradient(135deg, var(--garage-gradient-from, #4f7df3), var(--garage-gradient-to, #3d5a80)) !important;
}
.from-blue-500, .from-blue-600 { --garage-gradient-from: #4f7df3; }
.to-blue-600, .to-indigo-600 { --garage-gradient-to: #3d5a80; }
.from-teal-500 { --garage-gradient-from: #21a88b; }
.to-emerald-600 { --garage-gradient-to: #169b68; }
.from-orange-500 { --garage-gradient-from: #e29d29; }
.to-red-500 { --garage-gradient-to: #d94841; }
.from-purple-500 { --garage-gradient-from: #8b6bd9; }
.to-violet-600 { --garage-gradient-to: #7255c7; }
.from-gray-600 { --garage-gradient-from: #536173; }
.to-gray-800 { --garage-gradient-to: #2b3441; }

@media (min-width: 768px) {
  .md\:block { display: block !important; }
  .md\:hidden { display: none !important; }
  .md\:grid-cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)) !important; }
  .md\:gap-5 { gap: 1.25rem !important; }
  .md\:p-6 { padding: 1.5rem !important; }
}
@media (min-width: 576px) {
  .sm\:block { display: block !important; }
}
@media (min-width: 992px) {
  .lg\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
  .lg\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
  .lg\:col-span-2 { grid-column: span 2 / span 2 !important; }
}

/* ============================================================
   Garage components
   These are intentionally the same visual primitives used by D:\php\garage:
   steel sidebar, paper panels, quiet form surfaces and solid action buttons.
   ============================================================ */
:root {
  --steel-900: oklch(0.24 0.030 250);
  --steel-800: oklch(0.30 0.035 250);
  --steel-700: oklch(0.38 0.050 248);
  --steel-500: oklch(0.48 0.085 245);
  --steel-400: oklch(0.58 0.080 244);
  --steel-100: oklch(0.93 0.015 245);
  --steel-50: oklch(0.965 0.008 245);
  --paper: oklch(0.995 0.002 245);
  --ink: oklch(0.26 0.020 250);
  --ink-soft: oklch(0.50 0.020 250);
  --line: oklch(0.88 0.012 245);
  --blue-soft: oklch(0.94 0.030 245);
  --red: oklch(0.55 0.180 25);
  --red-soft: oklch(0.95 0.035 25);
  --radius: 10px;
  --shadow: 0 1px 2px oklch(0.3 0.03 250 / 0.06), 0 4px 14px oklch(0.3 0.03 250 / 0.05);
  --sidebar-w: 248px;
}

body {
  background: var(--steel-50) !important;
  color: var(--ink);
  font-size: .95rem;
}

#sidebar.sidebar {
  width: var(--sidebar-w) !important;
  background: var(--steel-900) !important;
  color: oklch(0.90 0.01 245);
}
#sidebar .menu {
  padding: .25rem .75rem 1.5rem !important;
}
#sidebar .nav-section {
  margin: 1.2rem .55rem .45rem !important;
  color: oklch(0.62 0.04 246) !important;
  font-size: .7rem !important;
  letter-spacing: .1em;
}
#sidebar .nav-item {
  margin-bottom: 2px;
  padding: .56rem .8rem !important;
  border-radius: 8px !important;
  color: oklch(0.86 0.015 245) !important;
  font-size: .92rem;
  box-shadow: none !important;
}
#sidebar .nav-item:hover { background: var(--steel-800) !important; color: #fff !important; }
#sidebar .nav-item.active { background: var(--steel-500) !important; color: #fff !important; }

#appScreen > .main-wrap {
  width: auto;
  margin-left: var(--sidebar-w);
}
#topbar.topbar {
  min-height: 62px;
  padding: .7rem 1.5rem !important;
  background: var(--paper) !important;
  border-bottom: 1px solid var(--line);
  box-shadow: none !important;
}
#appScreen main.content { padding: 1.6rem 1.75rem 3rem !important; }

.panel {
  background: var(--paper) !important;
  border: 1px solid var(--line) !important;
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow) !important;
}
.panel .panel-head {
  min-height: 58px;
  padding: .95rem 1.25rem;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-weight: 600;
}
.panel .panel-body { padding: 1.25rem; }
.page-title { margin: 0; color: var(--ink) !important; font-size: 1.35rem !important; letter-spacing: -.01em; }
.page-sub { color: var(--ink-soft); font-size: .9rem; font-weight: 400; }

.form-label,
#section-receipt label:not(.form-check-label) {
  color: var(--ink) !important;
  font-size: .85rem !important;
  font-weight: 600 !important;
}
.form-control,
.form-select,
.form-input,
#section-receipt input:not([type='checkbox']):not([type='radio']),
#section-receipt select,
#section-receipt textarea {
  min-height: 38px;
  padding: .45rem .7rem !important;
  color: var(--ink) !important;
  background-color: #fff !important;
  border: 1px solid var(--line) !important;
  border-radius: 8px !important;
  font-size: .92rem !important;
  box-shadow: none !important;
}
.form-control:focus,
.form-select:focus,
.form-input:focus,
#section-receipt input:not([type='checkbox']):not([type='radio']):focus,
#section-receipt select:focus,
#section-receipt textarea:focus {
  border-color: var(--steel-400) !important;
  box-shadow: 0 0 0 .2rem oklch(0.58 0.08 244 / .18) !important;
  outline: 0;
}
.btn {
  border-radius: 8px !important;
  font-weight: 600 !important;
  font-size: .9rem !important;
  box-shadow: none !important;
}
.btn-primary {
  color: #fff !important;
  background: var(--steel-500) !important;
  border-color: var(--steel-500) !important;
  background-image: none !important;
}
.btn-primary:hover,
.btn-primary:focus { background: var(--steel-700) !important; border-color: var(--steel-700) !important; }
.btn-outline-secondary {
  color: var(--ink) !important;
  background: #fff !important;
  border-color: var(--line) !important;
  background-image: none !important;
}
.btn-outline-secondary:hover { color: var(--ink) !important; background: var(--steel-100) !important; }

/* Garage uses solid functional actions; legacy gradients remain on dashboard shortcuts only. */
#appScreen .section-panel button.bg-gradient-to-r:not(.menu-card),
#appScreen .section-panel a.bg-gradient-to-r:not(.menu-card) {
  color: #fff !important;
  background: var(--steel-500) !important;
  background-image: none !important;
  border: 1px solid var(--steel-500) !important;
  border-radius: 8px !important;
  box-shadow: none !important;
}

/* Receipt form: remove the previous decorative skin and use Garage panels. */
#section-receipt .receipt-panel { overflow: hidden; }
#section-receipt #receiptForm {
  align-items: start;
  gap: 1.25rem !important;
}
#section-receipt .receipt-column {
  min-width: 0;
  padding: 0;
}
#section-receipt .receipt-section-title {
  margin: .15rem 0 .75rem;
  padding: 0 0 .6rem !important;
  color: var(--ink) !important;
  border-bottom: 1px solid var(--line) !important;
  font-size: 1rem !important;
  font-weight: 600 !important;
}
#section-receipt .receipt-section-title i {
  width: 1.15rem;
  margin-right: .45rem !important;
  display: inline-block;
  color: var(--steel-500) !important;
  text-align: center;
}
#section-receipt label > i { margin-right: .35rem !important; }
#section-receipt .branch-locked-field {
  min-height: 38px;
  padding: .45rem .7rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  color: var(--ink);
  background: var(--steel-50);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: .9rem;
}
#section-receipt .branch-locked-value {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-weight: 600;
}
#section-receipt .branch-locked-value > i { color: var(--steel-500); }
#section-receipt .branch-lock-badge {
  padding: .12rem .48rem;
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  color: var(--steel-700);
  background: var(--blue-soft);
  border-radius: 999px;
  font-size: .7rem;
  font-weight: 600;
  white-space: nowrap;
}
#section-receipt .branch-locked-field.is-unassigned { color: var(--red); background: var(--red-soft); }
#section-receipt .expiry-date-control {
  display: flex;
  align-items: center;
  gap: .45rem;
}
#section-receipt .expiry-date-control .form-control {
  min-width: 0;
  flex: 1 1 auto;
}
#section-receipt .expiry-date-control .btn {
  min-height: 38px;
  padding-inline: .65rem !important;
  color: var(--steel-500);
  border-color: var(--steel-400);
  font-weight: 600;
}
#section-receipt .expiry-date-control .btn:hover {
  color: #fff;
  background: var(--steel-500);
}
#section-receipt .expiry-date-control + .form-text {
  margin-top: .28rem;
  color: var(--ink-soft);
  font-size: .72rem;
}
#section-receipt .receipt-subpanel {
  padding: 1rem !important;
  background: var(--steel-50) !important;
  background-image: none !important;
  border: 1px solid var(--line) !important;
  border-radius: var(--radius) !important;
}
#section-receipt #serviceItemsList {
  max-height: none !important;
  padding: 0 !important;
  overflow: visible !important;
  background: transparent !important;
}
#section-receipt .service-item-row {
  min-height: 66px;
  padding: .75rem 1rem !important;
  background: #fff !important;
  border: 1px solid var(--line) !important;
  border-radius: var(--radius) !important;
  transition: border-color .15s ease, box-shadow .15s ease;
}
#section-receipt .service-item-row:hover {
  border-color: var(--steel-400) !important;
  box-shadow: 0 2px 8px oklch(0.3 0.03 250 / .06);
}
#section-receipt .receipt-total {
  position: static !important;
  padding: .85rem 1rem !important;
  background: var(--blue-soft) !important;
  background-image: none !important;
  border: 1px solid var(--steel-100) !important;
  border-radius: var(--radius) !important;
}
#section-receipt #totalAmount {
  color: var(--steel-500) !important;
  font-size: 1.55rem !important;
  font-variant-numeric: tabular-nums;
}
#section-receipt input[type='checkbox'],
#section-receipt input[type='radio'] {
  accent-color: var(--steel-500);
}

@media (max-width: 991.98px) {
  #sidebar.sidebar { transform: translateX(-100%); }
  #sidebar.sidebar.mob-open { transform: translateX(0); }
  #appScreen > .main-wrap { width: 100%; margin-left: 0; }
  #appScreen main.content { padding: 1.1rem 1rem 2.5rem !important; }
  #section-receipt .panel-head { align-items: flex-start; }
}

@media (max-width: 575.98px) {
  #section-receipt .panel-body { padding: 1rem; }
  #section-receipt .grid-cols-2,
  #section-receipt .grid-cols-3 { grid-template-columns: 1fr !important; }
  #section-receipt .col-span-3 { grid-column: auto !important; }
  #section-receipt .service-item-row { align-items: stretch !important; flex-direction: column; gap: .55rem !important; }
}

/* ============================================================
   Garage layout rebuild — real components, not legacy card skins
   ============================================================ */
#sidebar.sidebar,
#sidebar.sidebar.collapsed {
  width: var(--sidebar-w) !important;
  min-width: var(--sidebar-w) !important;
  min-height: 100vh;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 1030;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--steel-900) !important;
}
#sidebar .brand {
  padding: 1.4rem 1.25rem 1.2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
  text-align: center;
  border-bottom: 1px solid oklch(0.34 0.03 250);
}
#sidebar .brand-logo-placeholder,
#sidebar #navLogoBox {
  width: 58px !important;
  height: 58px !important;
  min-width: 58px;
  display: flex !important;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: rgba(255,255,255,.82) !important;
  background: rgba(255,255,255,.12) !important;
  background-image: none !important;
  border: 2px solid rgba(255,255,255,.22);
  border-radius: 14px !important;
  box-shadow: 0 2px 10px rgba(0,0,0,.22);
  font-size: 1.45rem;
}
#sidebar #navLogoBox img { width: 100%; height: 100%; object-fit: cover; }
#sidebar .shop-name {
  max-width: 100%;
  color: oklch(0.97 0.005 245) !important;
  font-size: .97rem !important;
  font-weight: 700;
  line-height: 1.35;
}
#sidebar .shop-tag {
  margin-top: -.2rem;
  color: oklch(0.70 0.05 244);
  font-size: .68rem;
  letter-spacing: .1em;
  text-transform: uppercase;
}
#sidebar .menu {
  flex: 1;
  min-height: 0;
  padding: .9rem .75rem 1.5rem !important;
  overflow-y: auto;
}
#sidebar .branch-filter {
  margin-bottom: .85rem;
  padding: .75rem;
  background: rgba(255,255,255,.055);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 9px;
}
#sidebar .branch-filter label {
  display: block;
  margin-bottom: .45rem;
  color: oklch(0.72 0.045 245);
  font-size: .72rem;
  font-weight: 600;
}
#sidebar .branch-filter select {
  width: 100%;
  padding: .42rem .6rem;
  color: oklch(0.9 0.01 245);
  background: var(--steel-800);
  border: 1px solid oklch(0.42 0.04 248);
  border-radius: 7px;
  font-size: .82rem;
}
#sidebar .nav-section {
  display: block !important;
  margin: 1.15rem .55rem .42rem !important;
  color: oklch(0.62 0.04 246) !important;
  font-size: .68rem !important;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
}
#sidebar .nav-section:first-of-type { margin-top: .2rem !important; }
#sidebar .nav-item,
#sidebar.collapsed .nav-item {
  min-height: 39px;
  margin-bottom: 2px;
  padding: .56rem .8rem !important;
  display: flex;
  align-items: center;
  justify-content: flex-start !important;
  gap: .7rem;
  color: oklch(0.86 0.015 245) !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: 8px !important;
  font-size: .92rem;
  cursor: pointer;
  box-shadow: none !important;
}
#sidebar .nav-item i,
#sidebar.collapsed .nav-item i {
  width: 1.15rem;
  margin: 0 !important;
  color: inherit !important;
  font-size: .92rem !important;
  text-align: center;
  opacity: .88;
}
#sidebar .nav-item:hover { color: #fff !important; background: var(--steel-800) !important; }
#sidebar .nav-item.active { color: #fff !important; background: var(--steel-500) !important; font-weight: 600; }
#sidebar .nav-alert-badge {
  min-width: 1.35rem;
  height: 1.35rem;
  margin-left: auto;
  padding: 0 .32rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: #f97316;
  border: 2px solid var(--steel-900);
  border-radius: 999px;
  font-size: .7rem;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 2px 5px rgba(15, 23, 42, .22);
}
#sidebar .nav-item.active .nav-alert-badge { border-color: var(--steel-500); }

.customer-expiry-stack { display: flex; flex-direction: column; align-items: flex-start; gap: .28rem; min-width: 145px; }
.customer-expiry-badge { display: inline-flex; align-items: center; gap: .35rem; padding: .23rem .48rem; border: 1px solid #dbe5ee; border-radius: 999px; color: #36516b; background: #f7fafc; font-size: .72rem; line-height: 1.15; white-space: nowrap; }
.customer-expiry-badge b { font-weight: 800; }
.customer-expiry-badge.is-tax { border-color: #c8dcf0; background: #eff7ff; }
.customer-expiry-badge.is-prb { border-color: #dfd2f5; background: #f7f1ff; }
.customer-expiry-badge.is-urgent { border-color: #f4c76d; color: #8a5200; background: #fff8e7; }
.customer-expiry-badge.is-expired { border-color: #f2b8b5; color: #a52c27; background: #fff0ef; }
.customer-expiry-badge.is-empty { color: #8795a5; background: #fafbfc; }
#sidebar.collapsed .nav-text,
#sidebar.collapsed .section-title { display: inline !important; }
#sidebar .sidebar-foot {
  padding: .8rem .9rem;
  border-top: 1px solid oklch(0.34 0.03 250);
}
#sidebar .sidebar-logout {
  width: 100%;
  padding: .55rem .75rem;
  display: flex;
  align-items: center;
  gap: .65rem;
  color: #eaa09b;
  background: rgba(217,72,65,.1);
  border: 1px solid rgba(217,72,65,.18);
  border-radius: 8px;
  font-size: .86rem;
}
#sidebar .sidebar-logout:hover { color: #fff; background: rgba(217,72,65,.24); }

#appScreen > .main-wrap {
  width: auto !important;
  min-height: 100vh;
  margin-left: var(--sidebar-w) !important;
  background: var(--steel-50);
}
#topbar.topbar {
  min-height: 62px;
  padding: .7rem 1.5rem !important;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1020;
  background: var(--paper) !important;
  border-bottom: 1px solid var(--line);
}
#topbar .topbar-date { color: var(--ink-soft); font-size: .88rem; }
#topbar > .user-chip,
#topbar > div:last-child {
  padding: 0 !important;
  display: flex;
  align-items: center;
  gap: .65rem;
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
}
#topbar .avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--steel-500) !important;
  border-radius: 50%;
  font-size: .78rem;
}
#topbar .role-chip {
  padding: .15rem .6rem;
  color: var(--steel-700) !important;
  background: var(--blue-soft) !important;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 600;
}
#topbar #topUserName { color: var(--ink) !important; font-size: .9rem; }
#topbar .topbar-logout {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  color: var(--ink-soft);
  background: transparent;
  border: 0;
  border-radius: 8px;
}
#topbar .topbar-logout:hover { color: var(--red); background: var(--red-soft); }
#appScreen main.content { padding: 1.6rem 1.75rem 3rem !important; }

/* Dashboard copied from the Garage visual grammar. */
#section-dashboard .dashboard-heading .page-title { font-size: 1.7rem !important; }
#section-dashboard .stat-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .9rem;
}
#section-dashboard .stat {
  min-height: 126px;
  padding: .95rem 1.1rem .9rem;
  color: #fff;
  border: 1px solid transparent;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform .2s ease, box-shadow .2s ease;
}
#section-dashboard .stat:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(31,42,55,.14); }
#section-dashboard .stat-gradient-blue { background: linear-gradient(135deg,#4f7df3 0%,#3b5bdb 100%) !important; }
#section-dashboard .stat-gradient-green { background: linear-gradient(135deg,#10b981 0%,#059669 100%) !important; }
#section-dashboard .stat-gradient-purple { background: linear-gradient(135deg,#8b5cf6 0%,#7c3aed 100%) !important; }
#section-dashboard .stat-gradient-orange { background: linear-gradient(135deg,#f59e0b 0%,#d97706 100%) !important; }
#section-dashboard .stat-label { color: rgba(255,255,255,.78); font-size: .8rem; }
#section-dashboard .stat-value { color: #fff; font-size: 1.55rem; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
#section-dashboard .stat-value small { color: rgba(255,255,255,.76); font-size: .85rem; font-weight: 500; }
#section-dashboard .stat-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: #fff;
  background: rgba(255,255,255,.18);
  border-radius: 10px;
  font-size: 1.05rem;
}
#section-dashboard .panel { height: 100%; }
#section-dashboard .panel-head { min-height: 54px; font-size: .95rem; }
#section-dashboard .panel-head i { color: var(--steel-500); }
#section-dashboard .dashboard-chart-body {
  min-height: 240px;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
#section-dashboard .chart-canvas-wrap {
  width: 180px;
  height: 180px;
  flex: 0 0 180px;
  display: grid;
  place-items: center;
}
#section-dashboard .chart-canvas-wrap canvas { width: 180px !important; height: 180px !important; max-height: 180px !important; }
#section-dashboard .chart-legend { min-width: 0; flex: 1; }
#section-dashboard .dashboard-legend-row {
  padding: .55rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--line);
  font-size: .86rem;
}
#section-dashboard .dashboard-legend-row:last-child { border-bottom: 0; }
#section-dashboard .dashboard-legend-label { min-width: 0; display: flex; align-items: center; gap: .55rem; }
#section-dashboard .dashboard-legend-label span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#section-dashboard .dashboard-legend-dot { width: 9px; height: 9px; flex: 0 0 9px; border-radius: 50%; }
#section-dashboard .dashboard-legend-row strong { color: var(--ink); font-weight: 600; white-space: nowrap; }
#section-dashboard .dashboard-legend-value { display: flex; align-items: baseline; gap: .45rem; white-space: nowrap; }
#section-dashboard .dashboard-legend-value small { color: var(--ink-soft); }
#section-dashboard .dashboard-empty { width: 100%; padding: 1.5rem .75rem; }
#section-dashboard .comparison-panel-body { max-width: 720px; }

@media (max-width: 1199.98px) {
  #section-dashboard .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 991.98px) {
  #sidebar.sidebar,
  #sidebar.sidebar.collapsed { transform: translateX(-100%); }
  #sidebar.sidebar.mob-open { transform: translateX(0); }
  #appScreen > .main-wrap { width: 100% !important; margin-left: 0 !important; }
  #appScreen main.content { padding: 1.1rem 1rem 2.5rem !important; }
}
@media (max-width: 575.98px) {
  #section-dashboard .stat-row { grid-template-columns: 1fr; }
  #section-dashboard .dashboard-chart-body { min-height: 0; flex-direction: column; align-items: stretch; }
  #section-dashboard .chart-canvas-wrap { margin: 0 auto; }
  #section-dashboard .dashboard-heading .btn { width: 100%; }
  #topbar .role-chip { display: none; }
}

/* ============================================================
   Remaining application screens
   ============================================================ */
#appScreen .page-heading .page-title { font-size: 1.7rem !important; }
#appScreen .page-heading { min-height: 48px; }
#appScreen .panel-head > span:first-child i { color: var(--steel-500); }
#appScreen .filter-panel .panel-body { padding: 1rem 1.25rem; }
#appScreen .filter-panel .form-label { margin-bottom: .35rem; }
#appScreen .count-badge {
  padding: .18rem .65rem;
  color: var(--ink-soft);
  background: var(--steel-100);
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 500;
}
#appScreen .table-panel { overflow: hidden; }
#appScreen .table-responsive { width: 100%; overflow-x: auto; }
#appScreen .table {
  --bs-table-bg: transparent;
  --bs-table-hover-bg: oklch(0.97 0.01 245);
  margin-bottom: 0;
}
#appScreen .table thead th,
#appScreen .data-table thead th {
  padding: .65rem 1rem !important;
  color: var(--ink-soft) !important;
  background: oklch(0.975 0.006 245) !important;
  border-bottom: 1px solid var(--line) !important;
  font-size: .76rem !important;
  font-weight: 600 !important;
  letter-spacing: .035em;
  text-transform: uppercase;
  white-space: nowrap;
}
#appScreen .table tbody td,
#appScreen .data-table tbody td {
  padding: .72rem 1rem !important;
  color: var(--ink);
  border-color: var(--line) !important;
  vertical-align: middle;
}
#appScreen .data-table tbody tr:last-child td { border-bottom: 0; }
#appScreen .data-table tbody tr:hover { background: oklch(0.97 0.01 245) !important; }
#appScreen .data-table a { color: var(--steel-500) !important; text-decoration: none; }
#appScreen .data-table a:hover { color: var(--steel-700) !important; }
#appScreen .data-table .inline-flex {
  display: inline-flex !important;
  align-items: center;
  gap: .3rem;
  padding: .18rem .55rem !important;
  border-radius: 6px !important;
  font-size: .75rem !important;
  font-weight: 600;
}
#appScreen .data-table tbody button {
  width: 30px !important;
  height: 30px !important;
  padding: 0 !important;
  display: inline-grid !important;
  place-items: center;
  background: #fff !important;
  border: 1px solid var(--line) !important;
  border-radius: 7px !important;
  box-shadow: none !important;
}
#appScreen .data-table tbody button:hover { background: var(--steel-100) !important; border-color: var(--steel-400) !important; }
#appScreen .data-table .badge,
#appScreen .badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .2rem .55rem;
  border-radius: 6px;
  font-size: .73rem;
  font-weight: 600;
}
#appScreen .panel-pagination {
  min-height: 0;
  padding: .75rem 1rem;
  border-top: 1px solid var(--line);
}
#appScreen .panel-pagination:empty { display: none; }
#appScreen .page-btn {
  min-width: 32px;
  height: 32px;
  padding: 0 .55rem;
  color: var(--ink-soft);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: .8rem;
}
#appScreen .page-btn:hover { color: var(--ink); background: var(--steel-100); }
#appScreen .page-btn.active { color: #fff; background: var(--steel-500); border-color: var(--steel-500); }
#appScreen .panel-search {
  width: min(260px, 45vw);
  position: relative;
}
#appScreen .panel-search > i {
  position: absolute;
  left: .65rem;
  top: 50%;
  z-index: 2;
  color: var(--ink-soft);
  font-size: .75rem;
  transform: translateY(-50%);
}
#appScreen .panel-search input { padding-left: 2rem !important; }

/* Members: compact identity rows with clear status and actions. */
#section-users .users-table { min-width: 760px; }
#section-users .users-table thead th:first-child { width: 22%; }
#section-users .users-table thead th:nth-child(2) { width: 25%; }
#section-users .users-table thead th:nth-child(3) { width: 21%; }
#section-users .users-table thead th:nth-child(4) { width: 15%; }
#section-users .users-table thead th:last-child { width: 17%; text-align: right; }
#section-users .users-table tbody tr { transition: background-color .18s ease, box-shadow .18s ease; }
#section-users .users-table tbody tr:hover { background: #f5f8fc !important; box-shadow: inset 3px 0 0 var(--steel-500); }
#section-users .users-table tbody td { height: 76px; }
#section-users .user-identity { display: flex; align-items: center; gap: .7rem; }
#section-users .user-avatar {
  width: 36px; height: 36px; flex: 0 0 36px; display: inline-grid; place-items: center;
  color: var(--steel-600); background: var(--steel-100); border: 1px solid #dce7f3; border-radius: 11px;
}
#section-users .user-username, #section-users .user-name { color: var(--ink); font-weight: 700; line-height: 1.25; }
#section-users .user-meta, #section-users .user-no-branch { color: var(--ink-soft); font-size: .72rem; margin-top: .2rem; }
#section-users .user-branches { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .35rem; }
#section-users .user-branch-badge { padding: .16rem .45rem !important; border-radius: 999px !important; font-size: .68rem !important; }
#section-users .user-role-badge, #section-users .user-status-badge { border-radius: 999px !important; padding: .3rem .6rem !important; }
#section-users .user-role-badge i { font-size: .72rem; }
#section-users .user-role-super { color: #8a5a00; background: #fff5d6; border: 1px solid #f4dc8a; }
#section-users .user-role-admin { color: #a65b00; background: #fff1dc; border: 1px solid #f2d0a0; }
#section-users .user-role-staff { color: #16775e; background: #e3f7ef; border: 1px solid #bfe9d7; }
#section-users .user-status-badge { gap: .38rem; }
#section-users .user-status-badge.is-active { color: #16775e; background: #e3f7ef; border: 1px solid #bfe9d7; }
#section-users .user-status-badge.is-inactive { color: #a84444; background: #fde9e8; border: 1px solid #f3c5c3; }
#section-users .status-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
#section-users .user-actions { display: flex; justify-content: flex-end; gap: .4rem; }
#section-users .user-action-btn { color: var(--ink-soft); }
#section-users .user-action-btn.is-edit { color: #bf7100; }
#section-users .user-action-btn.is-disable { color: #64748b; }
#section-users .user-action-btn.is-enable { color: #198754; }
#section-users .user-action-btn.is-delete { color: #d14b4b; }
#section-users .user-action-btn:hover { color: var(--ink) !important; transform: translateY(-1px); }
#section-users .user-action-btn.is-edit:hover { color: #a85c00 !important; background: #fff5d6 !important; }
#section-users .user-action-btn.is-delete:hover { color: #b42323 !important; background: #fde9e8 !important; }

/* Expiry alerts: readable at a glance, with a compact batch-print workflow. */
#section-expiry .expiry-stat-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .9rem;
}
#section-expiry .expiry-stat {
  min-height: 96px;
  padding: 1rem 1.1rem;
  position: relative;
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
#section-expiry .expiry-stat-label { color: var(--ink-soft); font-size: .8rem; }
#section-expiry .expiry-stat-value {
  margin-top: .2rem;
  color: var(--ink);
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
#section-expiry .expiry-stat-icon {
  width: 38px;
  height: 38px;
  position: absolute;
  right: 1rem;
  top: 50%;
  display: grid;
  place-items: center;
  border-radius: 10px;
  transform: translateY(-50%);
}
#section-expiry .expiry-stat.is-danger .expiry-stat-value,
#section-expiry .expiry-stat.is-danger .expiry-stat-icon { color: var(--red); }
#section-expiry .expiry-stat.is-danger .expiry-stat-icon { background: var(--red-soft); }
#section-expiry .expiry-stat.is-warning .expiry-stat-value,
#section-expiry .expiry-stat.is-warning .expiry-stat-icon { color: #b7791f; }
#section-expiry .expiry-stat.is-warning .expiry-stat-icon { background: #fff4dc; }
#section-expiry .expiry-stat.is-info .expiry-stat-value,
#section-expiry .expiry-stat.is-info .expiry-stat-icon { color: var(--steel-500); }
#section-expiry .expiry-stat.is-info .expiry-stat-icon { background: var(--blue-soft); }
#section-expiry .expiry-stat.is-total .expiry-stat-value,
#section-expiry .expiry-stat.is-total .expiry-stat-icon { color: #7255c7; }
#section-expiry .expiry-stat.is-total .expiry-stat-icon { background: #f0ebff; }
#section-expiry .expiry-filter-bar {
  display: flex;
  align-items: end;
  gap: .75rem;
  flex-wrap: wrap;
}
#section-expiry .expiry-filter-bar .form-group { min-width: 150px; }
#section-expiry .expiry-filter-bar .form-group:first-child { min-width: 210px; }
#section-expiry .expiry-select-all { color: var(--ink-soft); font-size: .8rem; white-space: nowrap; }
#section-expiry .expiry-table { min-width: 940px; }
#section-expiry .expiry-table .expiry-check-col { width: 44px; text-align: center; }
#section-expiry .expiry-table tbody td { height: 66px; }
#section-expiry .expiry-table tbody tr { transition: background-color .16s ease, box-shadow .16s ease; }
#section-expiry .expiry-table tbody tr:hover {
  background: #f5f8fc !important;
  box-shadow: inset 3px 0 0 var(--steel-500);
}
#section-expiry .expiry-table tbody tr.expiry-row.is-expired { background: #fff7f7; }
#section-expiry .expiry-table tbody tr.expiry-row.is-urgent { background: #fffaf1; }
#section-expiry .expiry-plate { color: var(--ink); font-weight: 800; }
#section-expiry .expiry-province,
#section-expiry .expiry-branch { color: var(--ink-soft); font-size: .75rem; }
#section-expiry .expiry-customer { color: var(--ink); font-weight: 600; }
#section-expiry .expiry-type-badge,
#section-expiry .expiry-status {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .24rem .55rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 700;
  white-space: nowrap;
}
#section-expiry .expiry-type-badge.is-tax { color: #2563a8; background: #e8f1ff; }
#section-expiry .expiry-type-badge.is-prb { color: #7255c7; background: #f0ebff; }
#section-expiry .expiry-days { color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }
#section-expiry .expiry-days.is-expired,
#section-expiry .expiry-status.is-expired { color: var(--red); }
#section-expiry .expiry-days.is-urgent,
#section-expiry .expiry-status.is-urgent { color: #b7791f; }
#section-expiry .expiry-status.is-expired { background: var(--red-soft); }
#section-expiry .expiry-status.is-urgent { background: #fff4dc; }
#section-expiry .expiry-status.is-upcoming { color: #16775e; background: #e3f7ef; }
#section-expiry .expiry-status .status-dot {
  width: 6px;
  height: 6px;
  display: inline-block;
  border-radius: 50%;
  background: currentColor;
}
#section-expiry .expiry-actions { display: flex; gap: .35rem; white-space: nowrap; }
#section-expiry .expiry-action-print,
#section-expiry .expiry-action-sms,
#section-expiry .expiry-action-done {
  width: 30px;
  height: 30px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  color: var(--steel-500);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
}
#section-expiry .expiry-action-print:hover { color: var(--steel-700); background: var(--steel-100); border-color: var(--steel-400); }
#section-expiry .expiry-action-sms { color: #087d91; }
#section-expiry .expiry-action-sms:hover { color: #075985; background: #ecfeff; border-color: #67e8f9; }
#section-expiry .expiry-action-sms:disabled { opacity: .35; cursor: not-allowed; }
#section-expiry .expiry-action-done { color: #138a5b; }
#section-expiry .expiry-action-done:hover { color: #087044; background: #ecfdf5; border-color: #6ee7b7; }
#section-expiry .expiry-empty { padding: 3rem 1rem !important; color: var(--ink-soft); text-align: center; }

/* Reports */
#section-reports .report-stat-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .9rem;
}
#section-reports .report-stat {
  min-height: 104px;
  padding: 1rem 1.1rem;
  position: relative;
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
#section-reports .report-stat-label { color: var(--ink-soft); font-size: .8rem; }
#section-reports .report-stat-value { margin-top: .2rem; color: var(--ink); font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }
#section-reports .report-stat.is-money .report-stat-value { color: var(--steel-500); }
#section-reports .report-stat-icon {
  width: 38px;
  height: 38px;
  position: absolute;
  right: 1rem;
  top: 50%;
  display: grid;
  place-items: center;
  color: var(--steel-500);
  background: var(--blue-soft);
  border-radius: 10px;
  transform: translateY(-50%);
}
#section-reports .service-summary-list > div {
  padding: .65rem 0 !important;
  border-bottom: 1px solid var(--line) !important;
}
#section-reports .service-summary-list > div:last-child { border-bottom: 0 !important; }
#section-reports tfoot tr { background: var(--blue-soft) !important; background-image: none !important; }
#section-reports tfoot td { border-top: 2px solid var(--steel-400) !important; }

/* Settings: one neutral component system across every tab. */
#section-settings .settings-panel { overflow: hidden; }
#section-settings .settings-tabs {
  display: flex;
  gap: 0;
  overflow-x: auto;
  background: var(--steel-50) !important;
  border-bottom: 1px solid var(--line) !important;
}
#section-settings .settings-tab {
  min-height: 48px;
  padding: .7rem 1rem !important;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  color: var(--ink-soft) !important;
  background: transparent !important;
  border: 0 !important;
  border-bottom: 2px solid transparent !important;
  border-radius: 0 !important;
  font-size: .84rem !important;
  font-weight: 600;
  white-space: nowrap;
}
#section-settings .settings-tab:hover { color: var(--ink) !important; background: var(--steel-100) !important; }
#section-settings .settings-tab.active { color: var(--steel-500) !important; background: var(--paper) !important; border-bottom-color: var(--steel-500) !important; }
#section-settings .settings-tab-content { padding: 1.25rem !important; }
#section-settings .settings-tab-content.hidden { display: none !important; }
#section-settings .settings-tab-content > div[class*='bg-'],
#section-settings .settings-tab-content .bg-white,
#section-settings .settings-tab-content .bg-gray-50,
#section-settings .settings-tab-content .bg-blue-50,
#section-settings .settings-tab-content .bg-green-50,
#section-settings .settings-tab-content .bg-orange-50,
#section-settings .settings-tab-content .bg-purple-50,
#section-settings .settings-tab-content .bg-rose-50 {
  background: var(--steel-50) !important;
  background-image: none !important;
  border: 1px solid var(--line) !important;
  border-radius: var(--radius) !important;
  box-shadow: none !important;
}
#section-settings .settings-tab-content h4,
#section-settings .settings-tab-content [class*='text-blue-7'],
#section-settings .settings-tab-content [class*='text-green-7'],
#section-settings .settings-tab-content [class*='text-orange-7'],
#section-settings .settings-tab-content [class*='text-purple-7'],
#section-settings .settings-tab-content [class*='text-rose-7'] { color: var(--ink) !important; }
#section-settings .settings-tab-content h4 i { color: var(--steel-500) !important; }
#section-settings .settings-form button { border-radius: 8px !important; font-weight: 600 !important; background-image: none !important; }
#section-settings .settings-tab-content > button[type='submit'] {
  width: auto !important;
  min-height: 40px;
  padding: .5rem 1.25rem !important;
  color: #fff !important;
  background: var(--steel-500) !important;
  border: 1px solid var(--steel-500) !important;
  box-shadow: none !important;
}
#section-settings .settings-tab-content > button[type='submit']:hover { background: var(--steel-700) !important; }
#section-settings .settings-tab-content button[class*='border-dashed'] {
  color: var(--steel-500) !important;
  background: #fff !important;
  border: 1px dashed var(--steel-400) !important;
}
#section-settings .settings-tab-content button[class*='bg-blue-100'],
#section-settings .settings-tab-content button[class*='bg-green-100'],
#section-settings .settings-tab-content button[class*='bg-purple-100'] {
  color: var(--ink) !important;
  background: var(--steel-100) !important;
  border: 1px solid var(--line) !important;
}
#section-settings .settings-tab-content [id$='Preview'] {
  background: #fff !important;
  border-color: var(--line) !important;
}
#section-settings #settingLogoPreview,
#section-settings #settingQrPreview,
#section-settings #settingQrMapsPreview,
#section-settings #settingQrLinePreview {
  flex: 0 0 80px !important;
  width: 80px !important;
  min-width: 80px !important;
  height: 80px !important;
  min-height: 80px !important;
}
#section-settings #settingLogoPreview img,
#section-settings #settingQrPreview img,
#section-settings #settingQrMapsPreview img,
#section-settings #settingQrLinePreview img {
  display: block;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
}
#section-settings #branchesList > div,
#section-settings #inspectionOptionsList > div,
#section-settings #prbOptionsList > div {
  padding: .55rem .65rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}
#section-settings #branchesList > div > button,
#section-settings #inspectionOptionsList > div > button,
#section-settings #prbOptionsList > div > button {
  width: 32px;
  height: 32px;
  padding: 0 !important;
  display: grid;
  place-items: center;
  color: var(--red) !important;
  background: var(--red-soft) !important;
  border: 1px solid transparent !important;
  border-radius: 7px !important;
}
#section-settings #letterPreviewWrap { background: #e8edf3 !important; }
#section-settings #letterPreview {
  border: 0 !important;
  background: #fff !important;
  box-shadow: 0 12px 32px rgba(26,36,48,.14) !important;
}
#section-settings .letter-preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  flex-wrap: wrap;
}
#section-settings .letter-preview-title { flex: 0 0 auto; white-space: nowrap; }
#section-settings .letter-preview-controls { min-width: 0; margin-left: auto; }
#section-settings .letter-preview-controls select { width: min(210px, 52vw); }
#section-settings .letter-layout-settings > div:not(:first-child) {
  box-shadow: none !important;
}

/* SweetAlert forms are the app's add/edit modals. */
.swal2-popup {
  color: var(--ink) !important;
  background: var(--paper) !important;
  border: 1px solid var(--line) !important;
  border-radius: 14px !important;
  box-shadow: 0 24px 60px rgba(26,36,48,.2) !important;
  font-family: 'Sarabun', sans-serif !important;
}
.swal2-title { color: var(--ink) !important; font-size: 1.35rem !important; }
.swal2-html-container { color: var(--ink-soft) !important; }
.swal2-html-container input,
.swal2-html-container select,
.swal2-html-container textarea {
  border-color: var(--line) !important;
  border-radius: 8px !important;
  box-shadow: none !important;
}
.swal2-confirm { background: var(--steel-500) !important; border-radius: 8px !important; box-shadow: none !important; }
.swal2-cancel { color: var(--ink) !important; background: var(--steel-100) !important; border-radius: 8px !important; box-shadow: none !important; }

/* Branch overview and dedicated Super Admin branch management. */
.branch-summary-table thead th,
.branch-management-table thead th {
  padding: .78rem 1rem;
  color: var(--ink-soft);
  background: #f4f7fa;
  border-bottom: 1px solid var(--line);
  font-size: .78rem;
  font-weight: 700;
  white-space: nowrap;
}
.branch-summary-table tbody td,
.branch-management-table tbody td { padding: .85rem 1rem; border-color: #e8edf3; }
.branch-summary-table tbody tr:hover,
.branch-management-table tbody tr:hover { background: #f8fbff; }
.dashboard-branch-name { display: inline-flex; align-items: center; gap: .65rem; font-weight: 700; }
.dashboard-branch-name i { width: 31px; height: 31px; display: grid; place-items: center; color: var(--steel-600); background: #e7eff8; border-radius: 8px; }
.branch-name-cell { display: flex; align-items: center; gap: .75rem; min-width: 220px; }
.branch-name-cell .branch-icon { width: 38px; height: 38px; display: grid; place-items: center; flex: 0 0 auto; color: #fff; background: linear-gradient(135deg,var(--steel-500),var(--steel-700)); border-radius: 10px; }
.branch-name-cell strong,.branch-name-cell small { display: block; }
.branch-name-cell small { margin-top: .15rem; color: var(--muted); font-size: .72rem; }
.branch-count { display: inline-grid; min-width: 38px; min-height: 28px; place-items: center; padding: .2rem .55rem; color: var(--ink-soft); background: #eef3f8; border-radius: 99px; font-weight: 700; }

/* Receipt form grouping after moving document fields to the service column. */
.receipt-document-panel { background: linear-gradient(135deg,#f8fbff,#f2f6fb) !important; border-color: #d6e1ec !important; }
.receipt-appointment-panel { background: #fffdf6 !important; border-color: #eadfbe !important; }

.expiry-row.is-followed-up { opacity: .72; background: #ecfdf5 !important; }
.expiry-status.is-followed-up,.expiry-days.is-followed-up { color: #047857 !important; background: #d1fae5 !important; }

@media (max-width: 767.98px) {
  #section-reports .report-stat-row { grid-template-columns: 1fr; }
  #section-expiry .expiry-stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #appScreen .panel-head { align-items: flex-start; }
  #appScreen .panel-search { width: 100%; }
  #section-settings .settings-panel-head .page-sub { display: none; }
  .branch-management-table { min-width: 760px; }
}
