/* ==========================================================================
   SC Owner Web Portal - Design System & Global Styles
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Outfit:wght@400;600;800;900&display=swap');

:root {
  /* Brand Colors */
  --red: #DA2A2E;
  --red-dark: #A51C1F;
  --red-light: rgba(218, 42, 46, 0.06);
  
  /* Grays & Backgrounds - Overhauled for UI UX Pro Max (Red/White focus) */
  --dark: #111111; /* Stark contrast for text instead of washed gray */
  --mid: #555555;
  --muted: #999999;
  --bg: #FDFDFE; /* Ultra-light pearl/snow background */
  --white: #FFFFFF;
  --border: rgba(218, 42, 46, 0.12); /* Red-tinted sleek borders */
  --border-light: rgba(218, 42, 46, 0.05);

  /* Status Colors */
  --status-pending: #8E8E93;
  --status-reg: #2196F3;
  --status-inspect: #FF9800;
  --status-est: #9C27B0;
  --status-appr: #009688;
  --status-repair: #1565C0;
  --status-rej: #DA2A2E;
  --status-hold: #FFB300;
  --status-ready: #4CAF50;
  --status-deliv: #1B5E20;
  
  /* Other Functional Colors */
  --green: #25D366; /* WhatsApp */
  --green-light: rgba(37, 211, 102, 0.08);
  
  /* Sizing & Layout */
  --sidebar-width: 230px; /* Compact width for laptop/desktop views */
  --sidebar-toggle-gutter: 34px;
  --header-height: 60px; /* Compact header height */
  --dashboard-header-height: 82px;
  --radius-card: 16px; /* Classic cute smoother corners */
  --radius-btn: 8px; /* Cute compact button radius */
  --radius-input: 8px; /* Cute compact input radius */
  
  /* Shadows - Upgraded to elegant soft glow/red-tinted drops */
  --shadow-sm: 0 4px 15px rgba(218, 42, 46, 0.04);
  --shadow-md: 0 8px 25px rgba(218, 42, 46, 0.06);
  --shadow-lg: 0 16px 40px rgba(218, 42, 46, 0.1);
  --shadow-red: 0 6px 18px rgba(218, 42, 46, 0.2);

  /* Typography */
  --font-primary: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ================== GLOBAL RESET ================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg);
  color: var(--dark);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-primary);
  color: var(--dark);
  margin-bottom: 0.5rem;
}

a {
  text-decoration: none;
  color: var(--red);
  transition: var(--transition);
}

a:hover {
  color: var(--red-dark);
}

button {
  font-family: var(--font-primary);
  cursor: pointer;
  border: none;
  background: none;
  transition: var(--transition);
}

input, textarea, select {
  font-family: var(--font-body);
  transition: var(--transition);
}

.hidden {
  display: none !important;
}

/* ================== TYPOGRAPHY UTILS ================== */
.text-h1 { font-size: 24px; font-weight: 900; letter-spacing: -0.5px; }
.text-h2 { font-size: 20px; font-weight: 900; letter-spacing: -0.3px; }
.text-h3 { font-size: 15px; font-weight: 800; }
.text-subtitle { font-size: 12px; font-weight: 600; color: var(--mid); }
.text-label { font-size: 10px; font-weight: 800; letter-spacing: 1.5px; color: var(--muted); text-transform: uppercase; }
.text-body { font-size: 13px; color: var(--mid); line-height: 1.4; }
.text-small { font-size: 11px; color: var(--muted); }

.color-red { color: var(--red); }
.color-green { color: var(--green); }
.color-dark { color: var(--dark); }

/* ================== BUTTONS ================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius-btn);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.btn-primary {
  background-color: var(--red);
  color: var(--white);
  box-shadow: var(--shadow-red);
}

.btn-primary:hover {
  background-color: var(--red-dark);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(218, 42, 46, 0.3);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary:disabled {
  background-color: var(--muted);
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

.btn-outline {
  background-color: transparent;
  color: var(--red);
  border: 1.5px solid var(--red);
}

.btn-outline:hover {
  background-color: var(--red-light);
}

.btn-whatsapp {
  background-color: var(--green-light);
  color: var(--green);
  border: 1px solid rgba(37, 211, 102, 0.2);
}

.btn-whatsapp:hover {
  background-color: rgba(37, 211, 102, 0.15);
}

.job-pdf-split {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.job-pdf-menu-btn {
  padding: 8px 10px !important;
  min-width: 34px;
  background: #fff4f4;
  color: var(--red);
  border: 1px solid rgba(218, 42, 46, 0.25);
}

.job-pdf-menu-btn:hover {
  background: #ffe8e8;
}

.job-pdf-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 40;
  min-width: 168px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.12);
  overflow: hidden;
}

.job-pdf-dropdown button {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 0;
  background: transparent;
  color: #333;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
}

.job-pdf-dropdown button:hover {
  background: #fff4f4;
  color: var(--red);
}

.job-pdf-dropdown button i {
  width: 14px;
  color: var(--red);
}

.btn-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: var(--bg);
  color: var(--mid);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  background-color: var(--border);
  color: var(--dark);
}

/* ================== FORM CONTROLS ================== */
.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 4px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  background-color: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  font-size: 13px;
  color: var(--dark);
  outline: none;
  transition: all 0.2s ease;
}

.form-control:focus {
  border-color: var(--red);
  background-color: var(--white);
  box-shadow: 0 4px 15px rgba(218, 42, 46, 0.08);
}

.form-control::placeholder {
  color: var(--muted);
}

.password-wrapper {
  position: relative;
  width: 100%;
}

.password-wrapper .form-control {
  padding-right: 44px;
}

.password-toggle-icon {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--dark);
  cursor: pointer;
  z-index: 2;
}

.password-toggle-icon:hover {
  color: var(--red);
}

textarea.form-control {
  min-height: 100px;
  resize: vertical;
}

.form-row {
  display: flex;
  gap: 16px;
}
.form-row > * { flex: 1; }

.radio-group {
  display: flex;
  gap: 16px;
}

.radio-card {
  flex: 1;
  position: relative;
}

.radio-card input {
  position: absolute;
  opacity: 0;
}

.radio-label {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  background-color: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-input);
  font-size: 13px;
  font-weight: 600;
  color: var(--mid);
  cursor: pointer;
  transition: var(--transition);
}

.radio-card input:checked + .radio-label {
  background-color: var(--red-light);
  border-color: var(--red);
  color: var(--red);
}

/* ================== CARDS & BADGES ================== */
.card {
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: var(--radius-card);
  padding: 20px;
  box-shadow: 0 8px 30px rgba(218, 42, 46, 0.04), inset 0 2px 4px rgba(255, 255, 255, 0.6);
  margin-bottom: 20px;
  transition: var(--transition);
}

.card:hover {
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 12px 40px rgba(218, 42, 46, 0.08), inset 0 2px 4px rgba(255, 255, 255, 0.8);
  transform: translateY(-2px);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 30px;
  font-size: 10px;
  font-weight: 900;
  font-family: var(--font-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-outline {
  border: 1px solid currentColor;
  background: transparent;
}

.badge-filled {
  color: var(--white);
}

/* Status-specific badges */
.status-pre_registered { background-color: var(--bg); color: var(--muted); }
.status-registered { background-color: rgba(33, 150, 243, 0.1); color: var(--status-reg); }
.status-inspection { background-color: rgba(255, 152, 0, 0.1); color: var(--status-inspect); }
.status-estimation_sent { background-color: rgba(156, 39, 176, 0.1); color: var(--status-est); }
.status-approved { background-color: rgba(0, 150, 136, 0.1); color: var(--status-appr); }
.status-repair_in_progress { background-color: rgba(21, 101, 192, 0.1); color: var(--status-repair); }
.status-customer_rejected { background-color: rgba(211, 47, 47, 0.1); color: var(--status-rej); }
.status-on_hold { background-color: rgba(255, 179, 0, 0.1); color: var(--status-hold); }
.status-ready { background-color: rgba(76, 175, 80, 0.1); color: var(--status-ready); }
.status-delivered { background-color: rgba(27, 94, 32, 0.1); color: var(--status-deliv); }

/* ================== LOGIN PAGE ================== */
#login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--bg) 0%, #EAEBEE 100%);
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  text-align: center;
  padding: 40px;
}

/* ================== FORGOT PASSWORD ================== */
#forgot-password-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 24px;
  background:
    radial-gradient(circle at 15% 15%, rgba(218, 42, 46, 0.09), transparent 30%),
    linear-gradient(135deg, #f8f8fa 0%, #eceef2 100%);
}

.fp-identity-msg { min-height:14px; margin:0 0 9px; text-align:left !important; color:var(--muted); font-size:9px !important; font-weight:600; line-height:1.35; }
.fp-identity-msg.is-valid { color:#18794e; }
.fp-identity-msg.is-invalid { color:#b42318; }
.forgot-password-card .btn:disabled { opacity:.55; cursor:not-allowed; box-shadow:none; }
.fp-recaptcha-container { min-height:0; margin:0 0 14px; display:flex; justify-content:center; overflow:hidden; border-radius:4px; }
.fp-recaptcha-container:empty { display:none; }

.forgot-password-card {
  width: 100%;
  max-width: 440px;
  padding: 34px 38px 30px;
  text-align: center;
  border: 1px solid rgba(218, 42, 46, 0.12);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 24px 70px rgba(30, 30, 35, 0.13);
}

.step-indicator {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
}

.step-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #dedee3;
  transition: width 0.2s ease, background 0.2s ease;
}

.step-dot.active {
  width: 28px;
  background: var(--red);
}

.forgot-password-card .form-group { margin-bottom: 18px !important; }
.forgot-password-card .form-label { display: block; margin-bottom: 7px; }
.forgot-password-card .form-control { width: 100%; }

.phone-prefix-wrapper { position: relative; }
.phone-prefix {
  position: absolute;
  left: 14px;
  top: 50%;
  z-index: 1;
  transform: translateY(-50%);
  padding-right: 11px;
  border-right: 1px solid var(--border);
  color: var(--dark);
  font-size: 13px;
  font-weight: 800;
}
.phone-prefix-input { padding-left: 65px !important; }

.alert-msg {
  margin: 0 0 18px;
  padding: 11px 13px;
  border: 1px solid transparent;
  border-radius: 10px;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}
.alert-error { color: #b42318; background: #fff1f0; border-color: #fecaca; }
.alert-success { color: #18794e; background: #ecfdf3; border-color: #bbf7d0; }

.fp-back-to-login {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 18px;
  color: var(--mid);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.fp-back-to-login::before { content: '\2190'; margin-right: 7px; }
.fp-back-to-login:hover { color: var(--red); }

.resend-container {
  min-height: 22px;
  margin-top: 15px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.resend-link { color: var(--red); cursor: pointer; }
.resend-link:hover { text-decoration: underline; }

.forgot-password-card .password-wrapper { position: relative; }
.forgot-password-card .password-toggle-icon {
  position: absolute;
  right: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  cursor: pointer;
}

@media (max-width: 520px) {
  #forgot-password-screen { padding: 14px; align-items: flex-start; }
  .forgot-password-card { margin-top: 18px; padding: 26px 20px 24px; border-radius: 18px; }
  .forgot-password-card .login-logo-replacement img { height: 48px !important; }
}

 .login-logo {
  height: 96px;
  object-fit: contain;
  margin-bottom: 24px;
}

.shop-badge {
  background-color: var(--red-light);
  border: 1px solid rgba(218, 42, 46, 0.3);
  color: var(--red);
  padding: 8px 16px;
  border-radius: 20px;
  font-family: var(--font-primary);
  font-weight: 800;
  font-size: 14px;
  line-height: 1.2;
  /* Size to content; allow long shop names to wrap instead of overflowing. */
  display: inline-block;
  max-width: 100%;
  text-align: center;
  white-space: normal;
  word-break: break-word;
  margin-top: 16px;
  margin-bottom: 24px;
}

/* ================== APP SHELL (SIDEBAR + MAIN) ================== */
#app-shell {
  /* Keep fixed header/sidebar out of flex sizing so the dashboard content cannot be pushed sideways. */
  display: block;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--white);
  border-right: none;
  box-shadow: 4px 0 30px rgba(218, 42, 46, 0.04);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: width 0.3s ease, transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
  color: var(--dark);
}

.sidebar-toggle-btn {
  position: absolute;
  top: 16px;
  right: -32px;
  width: 33px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-left: 0;
  border-radius: 0 12px 12px 0;
  background: var(--white);
  color: var(--red);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  z-index: 3;
  transition: var(--transition);
}

.sidebar-toggle-btn::before,
.sidebar-toggle-btn::after {
  content: "";
  position: absolute;
  left: -1px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--bg);
  pointer-events: none;
}

.sidebar-toggle-btn::before {
  top: -5px;
}

.sidebar-toggle-btn::after {
  bottom: -5px;
}

.sidebar-toggle-btn:hover {
  background: var(--red);
  color: var(--white);
  transform: translateX(2px);
}

.sidebar-header {
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border);
  text-align: center;
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin-bottom: 12px;
}

.sidebar-logo-frame {
  width: 190px;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.sidebar-brand img {
  width: 190px;
  height: 78px;
  object-fit: contain;
  transform: scale(1.42);
}

.sidebar-brand span {
  font-family: var(--font-primary);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.5px;
  color: var(--dark);
  text-transform: uppercase;
  line-height: 1.2;
}

.sidebar-header-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
}

.sidebar-shop-info {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-credits {
  margin-top: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: var(--red-light);
  padding: 4px 10px;
  border-radius: 20px;
  font-family: var(--font-primary);
  font-size: 11px;
  font-weight: 800;
  color: var(--red);
  letter-spacing: 0.5px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 14px 0 12px;
  list-style: none;
}

.nav-section-label {
  padding: 0 16px;
  margin-bottom: 4px;
  margin-top: 14px;
  font-size: 10px;
  font-weight: 800;
  color: var(--muted);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.nav-section-label:first-child {
  margin-top: 0;
}

.nav-item {
  margin: 2px 10px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--mid);
  font-weight: 600;
  font-size: 13px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid transparent;
}

.nav-link i {
  font-size: 15px;
  width: 20px;
  text-align: center;
  transition: transform 0.3s ease;
}

.nav-link:hover {
  background-color: var(--bg);
  color: var(--dark);
  transform: translateX(2px);
}

.nav-link:hover i {
  transform: scale(1.1);
  color: var(--red);
}

.nav-link.active {
  background-color: var(--red-light);
  color: var(--red);
  font-weight: 800;
  box-shadow: inset 3px 0 0 var(--red);
  border: 1px solid rgba(218, 42, 46, 0.1);
}

.sidebar-footer {
  padding: 12px 14px 16px;
  border-top: 1px solid var(--border);
}

.sidebar-powered-by {
  margin-top: 14px;
  text-align: center;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

 .sidebar-footer-logo {
  display: block;
  width: 219px;
  height: 69px;
  margin: 2px auto 0;
  object-fit: contain;
}

.sidebar-company-info {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 10px;
  color: var(--mid);
  line-height: 1.4;
}
.sidebar-company-name {
  font-weight: 800;
  color: var(--dark);
  font-size: 11px;
  letter-spacing: 0.3px;
  margin-bottom: 4px;
}
.sidebar-company-meta { margin-bottom: 2px; }
.sidebar-company-meta a { color: var(--primary); text-decoration: none; }
.sidebar-company-meta a:hover { text-decoration: underline; }
.sidebar-support-line {
  background: #fef2f2;
  border: 1px solid rgba(239, 68, 68, 0.15);
  border-radius: 4px;
  padding: 3px 4px;
  margin-top: 4px;
  margin-bottom: 4px;
}
.sidebar-company-addr { font-size: 9px; color: var(--muted); margin-top: 4px; }

.logout-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px;
  background-color: var(--bg);
  border-radius: 8px;
  color: var(--mid);
  font-weight: 600;
  font-size: 12px;
}

.logout-btn:hover {
  background-color: var(--border);
  color: var(--dark);
}

.sidebar-footer {
  position: relative;
}

.owner-logout-confirm {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 12px;
  box-sizing: border-box;
  border-radius: 12px;
  border: 1px solid #F2B8B8;
  background: var(--white);
  box-shadow: 0 16px 38px rgba(26, 26, 27, 0.18);
  z-index: 100001;
  white-space: nowrap;
}

.owner-logout-confirm-sidebar {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: calc(100% + 8px);
  display: grid;
  grid-template-columns: 1fr 1fr;
  row-gap: 8px;
  column-gap: 8px;
  white-space: normal;
}

.owner-logout-confirm-top {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
}

#sidebar-logout-confirm.owner-logout-confirm,
#top-logout-confirm.owner-logout-confirm {
  background: #fff;
}

.owner-logout-confirm span {
  color: var(--dark);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.owner-logout-confirm-sidebar span {
  grid-column: 1 / -1;
}

.owner-logout-confirm button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  padding: 7px 10px;
  font-family: var(--font-primary);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  min-width: 0;
}

.owner-logout-confirm .owner-logout-confirm-yes {
  background: #D32F2F !important;
  color: #fff !important;
}

.owner-logout-confirm .owner-logout-confirm-no {
  background: var(--bg) !important;
  color: var(--mid) !important;
}

.logout-confirm-popover {
  position: fixed;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--white);
  box-shadow: 0 16px 38px rgba(26, 26, 27, 0.14);
  z-index: 100001;
  white-space: nowrap;
}

.logout-confirm-popover span {
  color: var(--dark);
  font-size: 12px;
  font-weight: 800;
}

.logout-confirm-popover button {
  border: 0;
  border-radius: 8px;
  padding: 7px 10px;
  font-family: var(--font-primary);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.logout-confirm-popover .confirm-logout {
  background: var(--primary);
  color: #fff;
}

.logout-confirm-popover .cancel-logout {
  background: var(--bg);
  color: var(--mid);
}

/* Top Navbar (Mobile) */
.top-navbar {
  display: none;
  height: var(--header-height);
  background-color: var(--white);
  border-bottom: 1px solid var(--border);
  align-items: center;
  padding: 0 16px;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 90;
}

.hamburger-btn {
  font-size: 24px;
  color: var(--dark);
  padding: 8px;
}

.mobile-brand {
  text-align: center;
  font-family: var(--font-primary);
  font-weight: 900;
  font-size: 18px;
}

.mobile-brand-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* Main Content */
.main-content {
  /* Reserve horizontal space for the fixed desktop sidebar and its collapse handle. */
  margin-left: calc(var(--sidebar-width) + var(--sidebar-toggle-gutter));
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.3s ease;
}

@media (min-width: 769px) {
  #app-shell.sidebar-collapsed .sidebar {
    width: 76px;
  }

  #app-shell.sidebar-collapsed .main-content {
    margin-left: calc(76px + var(--sidebar-toggle-gutter));
  }

  #app-shell.sidebar-collapsed .sidebar-toggle-btn i {
    transform: rotate(180deg);
  }

  #app-shell.sidebar-collapsed .sidebar-header {
    padding: 18px 8px 14px;
  }

  #app-shell.sidebar-collapsed .sidebar-brand {
    margin-bottom: 0;
  }

  #app-shell.sidebar-collapsed .sidebar-brand img {
    width: 48px;
    height: 32px;
    transform: none;
  }

  #app-shell.sidebar-collapsed .sidebar-logo-frame {
    width: 48px;
    height: 32px;
  }

  #app-shell.sidebar-collapsed #sidebar-shop-name,
  #app-shell.sidebar-collapsed .sidebar-header-meta,
  #app-shell.sidebar-collapsed .sidebar-shop-info,
  #app-shell.sidebar-collapsed .sidebar-credits,
  #app-shell.sidebar-collapsed .nav-label,
  #app-shell.sidebar-collapsed .nav-section-label,
  #app-shell.sidebar-collapsed .sidebar-powered-by {
    display: none;
  }

  #app-shell.sidebar-collapsed .sidebar-nav {
    padding-top: 14px;
  }

  #app-shell.sidebar-collapsed .nav-item {
    margin: 4px 10px;
  }

  #app-shell.sidebar-collapsed .nav-link {
    justify-content: center;
    gap: 0;
    padding: 10px;
  }

  #app-shell.sidebar-collapsed .nav-link i {
    width: auto;
    font-size: 17px;
  }

  #app-shell.sidebar-collapsed .nav-link:hover {
    transform: none;
  }

  #app-shell.sidebar-collapsed .sidebar-footer {
    padding: 12px 10px 16px;
  }

   #app-shell.sidebar-collapsed .sidebar-footer-logo {
    width: 60px;
    height: 38px;
    margin-top: 6px;
  }

  #app-shell.sidebar-collapsed .logout-btn {
    padding: 10px;
  }
}

.page-container {
  padding: 20px 24px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.page-container.dashboard-full-width {
  max-width: none;
  margin: 0;
  padding: 20px 28px 32px;
}

.page-container.page-full-width {
  max-width: none;
  margin: 0;
  padding: 20px 28px 32px;
}

.page-header {
  margin-bottom: 20px;
}

/* ================== DASHBOARD SPECIFIC ================== */
.dashboard-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
}

.dashboard-page-header h1,
.dashboard-page-header p {
  margin-bottom: 0;
}

.dashboard-center-heading {
  min-width: 0;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 12px;
}

.dashboard-center-heading h1 {
  text-transform: uppercase;
  line-height: 1.1;
}

.dashboard-center-copy {
  min-width: 0;
}

.shop-profile-photo {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #FFFFFF;
  background: var(--white);
  box-shadow: 0 6px 18px rgba(83, 22, 24, 0.12);
  flex: 0 0 auto;
}

.top-navbar .shop-profile-photo {
  width: 32px;
  height: 32px;
}

.dashboard-center-meta {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.dashboard-center-name-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.dashboard-center-name-row .text-h1 {
  min-width: 0;
}

.dashboard-center-credits {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--red-light);
  color: var(--red);
  font-family: var(--font-primary);
  font-weight: 800;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.dashboard-center-gst {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border: 1px solid #F2CACA;
    border-radius: 999px;
    background: #FFF7F7;
    color: var(--red);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .25px;
}

.dashboard-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  position: relative;
  gap: 10px;
}

@media (min-width: 769px) {
  /* Desktop header is always fixed so refresh/navigation cannot leave it in the middle of the page. */
  .app-desktop-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 110;
    height: var(--dashboard-header-height);
    margin: 0;
    padding: 12px 28px;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 5px 22px rgba(17, 17, 17, 0.045);
  }

  /* Start the fixed sidebar below the fixed header so they do not overlap. */
  .sidebar {
    top: var(--dashboard-header-height);
  }

  /* Align the sidebar collapse handle with the shortened sidebar top. */
  .sidebar-toggle-btn {
    top: 14px;
  }

  /* Push page content below the fixed header. */
  .main-content {
    padding-top: var(--dashboard-header-height);
  }

  /* Let header actions consume remaining header width without overflowing. */
  .app-desktop-header .dashboard-header-actions {
    flex: 1;
    min-width: 0;
  }

  /* Keep search usable on desktop while preventing it from crowding the profile controls. */
  .app-desktop-header .dashboard-search {
    width: clamp(280px, 30vw, 430px);
  }

  #app-shell.dashboard-active .sidebar {
    top: var(--dashboard-header-height);
  }

  #app-shell.dashboard-active .sidebar-toggle-btn {
    top: 14px;
  }

  #app-shell.dashboard-active .main-content {
    padding-top: var(--dashboard-header-height);
  }

  #app-shell.dashboard-active .dashboard-page-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 110;
    height: var(--dashboard-header-height);
    margin: 0;
    padding: 12px 28px;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 5px 22px rgba(17, 17, 17, 0.045);
  }

  #app-shell.dashboard-active .dashboard-header-actions {
    flex: 1;
    min-width: 0;
  }

  #app-shell.dashboard-active .dashboard-search {
    width: clamp(280px, 30vw, 430px);
  }
}

.dashboard-search {
  width: clamp(220px, 24vw, 360px);
  height: 40px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--white);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.025);
  transition: var(--transition);
}

.dashboard-search:focus-within {
  border-color: rgba(218, 42, 46, 0.35);
  box-shadow: 0 0 0 3px rgba(218, 42, 46, 0.07);
  transform: translateY(-1px);
}

.dashboard-search i {
  color: var(--muted);
  font-size: 12px;
}

.dashboard-search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--dark);
  font-family: var(--font-body);
  font-size: 12px;
}

.dashboard-icon-btn {
  width: 40px;
  height: 40px;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--white);
  color: var(--mid);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.dashboard-icon-btn:hover,
.dashboard-icon-btn:focus-visible {
  transform: translateY(-3px) rotate(-4deg);
  color: var(--red);
  border-color: rgba(218,42,46,0.28);
}

.dashboard-notification-count {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  border: 2px solid var(--white);
  border-radius: 10px;
  background: var(--red);
  color: var(--white);
  font-size: 9px;
  font-weight: 800;
}

.dashboard-profile {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 11px 4px 5px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--white);
  color: var(--dark);
  box-shadow: var(--shadow-sm);
  text-align: left;
  transition: var(--transition);
}

.dashboard-profile:hover,
.dashboard-profile:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(218,42,46,0.1);
}

.dashboard-owner-avatar {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #EF4444, #B91C1C);
  color: var(--white);
  font-family: var(--font-primary);
  font-size: 11px;
  font-weight: 900;
}

.dashboard-owner-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.dashboard-owner-copy strong {
  font-size: 11px;
}

.dashboard-owner-copy small {
  color: var(--muted);
  font-size: 9px;
}

.dashboard-profile-panel {
  position: fixed;
  top: 72px;
  right: 24px;
  z-index: 100002;
  width: min(420px, calc(100vw - 32px));
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--white);
  box-shadow: 0 18px 45px rgba(17, 17, 17, 0.16);
}

.dashboard-profile-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.dashboard-profile-panel-head strong,
.dashboard-profile-panel-head small {
  display: block;
}

.dashboard-profile-panel-head strong { font-size: 15px; color: var(--dark); }
.dashboard-profile-panel-head small { margin-top: 3px; font-size: 10px; color: var(--muted); }
.dashboard-profile-panel-head button { border: 0; background: transparent; color: var(--muted); cursor: pointer; }

.dashboard-profile-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding-top: 14px;
}

.dashboard-profile-details div { min-width: 0; }
.dashboard-profile-details span { display: block; margin-bottom: 3px; color: var(--muted); font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.dashboard-profile-details strong { display: block; color: var(--dark); font-size: 11px; overflow-wrap: anywhere; }
.dashboard-profile-details .profile-detail-wide { grid-column: 1 / -1; }

/* The notification panel lives after the app content in the DOM, so it must be
   fixed to the header instead of participating in the page's document flow. */
.notification-panel {
  position: fixed;
  top: 72px;
  right: 24px;
  z-index: 100001;
  width: min(390px, calc(100vw - 32px));
  max-height: min(620px, calc(100vh - 96px));
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--white);
  box-shadow: 0 18px 45px rgba(17, 17, 17, 0.18);
}

.notification-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.notification-header h3 { margin: 0; color: var(--dark); font-size: 14px; }

.notification-items-container {
  max-height: calc(min(620px, 100vh - 96px) - 58px);
  overflow-y: auto;
}

.notification-item {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-light);
  background: var(--white);
  cursor: pointer;
  transition: var(--transition);
}

.notification-item:hover { background: var(--bg); }
.notification-item.unread { background: rgba(218, 42, 46, 0.045); }
.notification-icon-wrapper { width: 30px; height: 30px; flex: 0 0 30px; display: flex; align-items: center; justify-content: center; border-radius: 9px; background: var(--red-light); color: var(--red); }
.notification-icon-wrapper.credit_alert_medium,
.notification-icon-wrapper.subscription_expiry_medium { background: rgba(245, 158, 11, 0.14); color: #D97706; }
.notification-icon-wrapper.credit_alert_danger,
.notification-icon-wrapper.subscription_expiry_danger { background: rgba(220, 38, 38, 0.12); color: #DC2626; }
.notification-item-content { min-width: 0; flex: 1; }
.notification-item-title { color: var(--dark); font-size: 12px; font-weight: 800; }
.notification-item-body { margin-top: 3px; color: var(--mid); font-size: 11px; line-height: 1.4; }
.notification-item-time { margin-top: 5px; color: var(--muted); font-size: 9px; font-weight: 700; }
.notification-item-dismiss {
  flex: 0 0 auto;
  align-self: flex-start;
  margin-left: 8px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 6px;
  border-radius: 8px;
  transition: var(--transition);
  min-width: 28px;
  min-height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.notification-item-dismiss:hover { background: rgba(0, 0, 0, 0.06); color: var(--red); }
.no-notifications { padding: 36px 18px; color: var(--muted); font-size: 12px; font-weight: 700; text-align: center; }

@media (max-width: 768px) {
  .dashboard-profile-panel,
  .notification-panel {
    top: 66px;
    right: 16px;
    left: 16px;
    width: auto;
  }
}

@keyframes dashboardRise {
  from { opacity: 0; transform: translateY(16px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes heroShine {
  0% { transform: translateX(-140%) skewX(-18deg); }
  55%, 100% { transform: translateX(240%) skewX(-18deg); }
}

@keyframes heroFloatOne {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(-12px, 10px, 0) scale(1.08); }
}

@keyframes heroFloatTwo {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(-8px, -12px, 0); }
}

@keyframes chartDraw {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}

@keyframes pointPop {
  0% { opacity: 0; transform: scale(0); }
  70% { transform: scale(1.2); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes cardBreathe {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

@keyframes cardSheen {
  0%, 62% { transform: translateX(-160%) skewX(-20deg); opacity: 0; }
  72% { opacity: 0.65; }
  100% { transform: translateX(260%) skewX(-20deg); opacity: 0; }
}

@keyframes iconPulse {
  0%, 100% { transform: scale(1) rotate(0deg); }
  45% { transform: scale(1.14) rotate(-4deg); }
  65% { transform: scale(1.08) rotate(4deg); }
}

@keyframes progressGlow {
  0%, 100% { filter: brightness(1); opacity: 0.75; }
  50% { filter: brightness(1.35); opacity: 1; }
}

@keyframes rowSlideIn {
  from { opacity: 0; transform: translateX(24px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes sectionBreathe {
  0%, 100% { box-shadow: 0 10px 24px rgba(74, 25, 27, 0.055), inset 0 1px 0 #FFFFFF; }
  50% { box-shadow: 0 16px 34px rgba(218, 42, 46, 0.095), inset 0 1px 0 #FFFFFF; }
}

.dashboard-top-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(360px, 0.75fr);
  gap: 16px;
  align-items: stretch;
  margin-bottom: 18px;
}

#dashboard-hero,
#dashboard-hero .hero-card {
  height: 100%;
}

.hero-card {
  background: linear-gradient(135deg, #C8232A 0%, #A01820 100%);
  border-radius: 16px;
  padding: 24px 28px;
  color: var(--white);
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow:
    0 14px 30px rgba(165, 28, 31, 0.2),
    inset 0 1px 0 rgba(255,255,255,0.24),
    inset 0 -2px 0 rgba(95, 10, 13, 0.18);
  border: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 0;
  position: relative;
  overflow: clip;
  animation: dashboardRise 0.55s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  /* Allow child flex/grid items to shrink instead of forcing overflow or empty side space. */
  min-width: 0;
}

.hero-card::before {
  content: "";
  position: absolute;
  inset: -30% auto -30% -25%;
  width: 20%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.16), transparent);
  pointer-events: none;
  animation: heroShine 5.5s ease-in-out 1.2s infinite;
}
.hero-left {
  position: relative;
  z-index: 2;
  /* Allow long owner/shop text to wrap inside the red hero card. */
  min-width: 0;
  /* Give the text column enough desktop space while still allowing the KPI group to fit. */
  flex: 1 1 260px;
}

.hero-city {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: rgba(255,255,255,0.15);
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.hero-title {
  font-size: 24px;
  font-weight: 900;
  letter-spacing: -0.3px;
  margin-bottom: 4px;
  margin-top: 0;
  color: var(--white) !important;
}

/* Hero card change: align welcome text and workshop pill in one row inside the red card. */
.hero-welcome-row .hero-title,
.hero-welcome-row .hero-service-center-name {
  /* Remove vertical margins so the title and shop pill align cleanly in the same row. */
  margin-top: 0;
  margin-bottom: 0;
}

.hero-welcome-row {
  /* Flex lets the title and shop pill sit together on wide screens and wrap when space is tight. */
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  /* Prevent long text from increasing the hero width. */
  min-width: 0;
}

.hero-welcome-row .hero-title {
  /* Let long owner names wrap instead of overlapping KPI cards. */
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.15;
}

.hero-subtitle {
  opacity: 0.75;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.5px;
  margin: 0;
}

.hero-kpi-group {
  display: flex;
  gap: 10px;
  position: relative;
  z-index: 2;
  /* Keep KPI cards compact on wide layouts while allowing shrink at narrower widths. */
  flex: 0 1 380px;
  /* Prevent KPI cards from forcing the hero wider than its grid column. */
  min-width: 0;
  justify-content: flex-end;
}

.hero-service-center-name {
  width: fit-content;
  /* Keep the shop pill inside the hero card even for long service-center names. */
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 0;
  padding: 7px 12px;
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 10px;
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.92);
  font-family: var(--font-primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.7px;
  backdrop-filter: blur(5px);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.16),
    0 5px 12px rgba(76, 6, 9, 0.12);
  transition: transform 0.25s ease, background 0.25s ease;
}

.hero-service-center-name span {
  /* Ellipsize long shop names so the pill fills available space without spilling out. */
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hero-service-center-name:hover {
  transform: translateY(-2px);
  background: rgba(255,255,255,0.16);
}

.hero-service-center-name i {
  color: #FFD7D8;
}

.hero-credits-box {
  /* Flex sizing keeps KPI cards responsive instead of leaving unused hero space. */
  flex: 1 1 106px;
  min-width: 96px;
  max-width: 124px;
  background: rgba(255,255,255,0.13);
  padding: 13px 12px;
  border-radius: 12px;
  text-align: center;
  border: 1px solid rgba(255,255,255,0.2);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.24),
    inset 0 -2px 0 rgba(88, 8, 11, 0.14),
    0 8px 16px rgba(88, 8, 11, 0.12);
  backdrop-filter: blur(5px);
  position: relative;
  z-index: 2;
  transition: transform 0.25s ease, background 0.25s ease;
}

.hero-credits-box:hover {
  transform: translateY(-3px);
  background: rgba(255,255,255,0.18);
}

.hero-credits-label {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: rgba(255,255,255,0.7);
}

.hero-credits-value {
  font-size: 24px;
  font-weight: 900;
  color: var(--white);
  line-height: 1;
  margin-top: 2px;
}
.hero-circle-1 {
  position: absolute;
  right: 15%;
  top: -60px;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
  z-index: 1;
  pointer-events: none;
  animation: heroFloatOne 7s ease-in-out infinite;
}

.hero-circle-2 {
  position: absolute;
  right: -30px;
  bottom: -40px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  z-index: 1;
  pointer-events: none;
  animation: heroFloatTwo 8s ease-in-out infinite;
}

.alert-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-radius: 16px;
  margin-bottom: 24px;
  color: var(--white);
  font-weight: 600;
  font-size: 14px;
}

.alert-critical { background-color: var(--red); }
.alert-warning { background-color: #F57C00; }

.filter-tabs {
  display: inline-flex;
  gap: 4px;
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.8);
  padding: 4px;
  border-radius: 20px;
  margin-bottom: 0;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05), inset 0 2px 4px rgba(255, 255, 255, 0.6);
  overflow-x: auto;
}

.dashboard-control-panel {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: linear-gradient(145deg, #FFFFFF 0%, #FFF8F8 100%);
  box-shadow:
    0 10px 24px rgba(83, 22, 24, 0.07),
    inset 0 1px 0 #FFFFFF,
    inset 0 -1px 0 rgba(218, 42, 46, 0.05);
  animation: dashboardRise 0.55s cubic-bezier(0.2, 0.8, 0.2, 1) 0.08s both;
}

.dashboard-control-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  color: var(--dark);
  font-family: var(--font-primary);
  font-size: 13px;
  font-weight: 800;
}

.dashboard-control-title i {
  color: var(--red);
}

.dashboard-toolbar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  margin-bottom: 0;
  min-width: 0;
  white-space: nowrap;
}

.dashboard-control-panel .filter-tabs {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}

.dashboard-quick-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  min-width: 0;
}

.dashboard-action-btn {
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: linear-gradient(180deg, #FFFFFF 0%, #FFF9F9 100%);
  color: var(--mid);
  font-family: var(--font-primary);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: var(--transition);
  box-shadow:
    0 4px 9px rgba(85, 28, 30, 0.07),
    inset 0 1px 0 #FFFFFF,
    inset 0 -2px 0 rgba(218, 42, 46, 0.07);
}

.dashboard-action-btn i {
  color: var(--red);
  font-size: 13px;
}

.dashboard-action-btn:hover,
.dashboard-action-btn:focus-visible {
  color: var(--red);
  border-color: rgba(218, 42, 46, 0.25);
  background: var(--red-light);
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 10px 18px rgba(218, 42, 46, 0.15);
}

.dashboard-action-btn:hover i,
.dashboard-action-btn:focus-visible i {
  animation: iconPulse 0.55s ease;
}

.filter-tab {
  padding: 6px 16px;
  border-radius: 16px;
  border: none;
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  color: var(--mid);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  white-space: nowrap;
}

.filter-tab:hover {
  color: var(--dark);
  transform: translateY(-2px) scale(1.03);
}

.filter-tab.active {
  background: var(--white);
  color: var(--red);
  font-weight: 800;
  box-shadow:
    0 5px 11px rgba(211, 47, 47, 0.13),
    inset 0 1px 0 #FFFFFF,
    inset 0 -2px 0 rgba(218, 42, 46, 0.07);
  transform: translateY(-1px);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.kpi-row {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  overflow-x: auto;
  padding-bottom: 6px;
}

@media (min-width: 769px) {
  .kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    overflow-x: visible;
    padding-bottom: 0;
  }
}

.kpi-card {
  appearance: none;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  flex: 1;
  min-width: 140px;
  padding: 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--white);
  box-shadow:
    0 8px 18px rgba(74, 25, 27, 0.055),
    inset 0 1px 0 #FFFFFF,
    inset 0 -2px 0 rgba(218, 42, 46, 0.045);
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  animation: dashboardRise 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.kpi-card::after {
  content: "";
  position: absolute;
  top: -30%;
  bottom: -30%;
  left: -35%;
  width: 22%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.9), transparent);
  pointer-events: none;
  opacity: 0;
}

.kpi-card:nth-child(1) { animation-delay: 0.12s; }
.kpi-card:nth-child(2) { animation-delay: 0.18s; }
.kpi-card:nth-child(3) { animation-delay: 0.24s; }
.kpi-card:nth-child(4) { animation-delay: 0.30s; }
.kpi-card:nth-child(5) { animation-delay: 0.36s; }
.kpi-card:nth-child(6) { animation-delay: 0.42s; }

@media (min-width: 769px) {
  .kpi-card {
    min-width: 0;
  }
}

.kpi-card:hover {
  background: var(--white);
  border-color: #E0E0E8;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
  transform: translateY(-5px) rotateX(1deg);
  box-shadow:
    0 8px 15px rgba(218, 42, 46, 0.12),
    inset 0 1px 0 #FFFFFF;
}

.kpi-card:hover::after,
.kpi-card:focus-within::after {
  animation: cardSheen 0.85s ease;
}

.kpi-card:hover .stat-icon,
.kpi-card:focus-within .stat-icon {
  animation: iconPulse 0.6s ease;
}

.dashboard-action-btn:active {
  transform: translateY(1px);
  box-shadow:
    inset 0 2px 5px rgba(121, 27, 30, 0.14),
    0 1px 2px rgba(0,0,0,0.04);
}

.kpi-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.kpi-title {
  font-size: 10px;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.kpi-value {
  font-family: var(--font-primary);
  font-size: 26px;
  font-weight: 900;
  color: var(--dark);
  line-height: 1;
}

.kpi-subtitle {
  min-height: 14px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
}

.kpi-progress {
  height: 3px;
  margin-top: 11px;
  overflow: hidden;
  border-radius: 3px;
  background: var(--border);
}

.kpi-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  transform-origin: left;
  animation: dashboardRise 0.65s ease both;
  transition: filter 0.25s ease, opacity 0.25s ease;
}

.kpi-card:hover .kpi-progress span,
.kpi-card:focus-within .kpi-progress span {
  filter: brightness(1.35);
  opacity: 1;
}

.stat-card {
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background-color: var(--white);
}

.stat-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.stat-icon {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}

.stat-title {
  font-size: 10px;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-family: var(--font-primary);
  font-size: 20px;
  font-weight: 900;
  color: var(--dark);
}

.dashboard-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.dashboard-section-card {
  margin-bottom: 18px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--white);
  box-shadow:
    0 10px 24px rgba(74, 25, 27, 0.055),
    inset 0 1px 0 #FFFFFF;
  position: relative;
  overflow: hidden;
  animation: dashboardRise 0.55s cubic-bezier(0.2, 0.8, 0.2, 1) 0.35s both;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.dashboard-section-card::before {
  content: "";
  position: absolute;
  top: -40%;
  bottom: -40%;
  left: -30%;
  width: 14%;
  background: linear-gradient(90deg, transparent, rgba(218,42,46,0.07), transparent);
  pointer-events: none;
  opacity: 0;
}

.dashboard-insights-grid .dashboard-section-card:nth-child(2) {
  animation-delay: 0.45s;
}

.dashboard-section-card:hover {
  transform: translateY(-3px);
  box-shadow:
    0 16px 32px rgba(74, 25, 27, 0.08),
    inset 0 1px 0 #FFFFFF;
}

.dashboard-section-card:hover::before,
.dashboard-section-card:focus-within::before {
  animation: cardSheen 0.95s ease;
}

.dashboard-insights-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  align-items: stretch;
}

.dashboard-insights-grid .dashboard-section-card {
  min-width: 0;
}

.dashboard-section-caption {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}

.revenue-chart-card {
  background: var(--white);
}

.revenue-chart-card .dashboard-section-header {
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
}

.revenue-chart-eyebrow {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.revenue-chart-total {
  margin-top: 13px;
  color: var(--dark);
  font-family: var(--font-primary);
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
}

.revenue-chart-total::after {
  content: attr(data-period-label);
  display: block;
  margin-top: 4px;
  color: var(--mid);
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 600;
}

.technician-chart {
  display: flex;
  flex-direction: column;
  gap: 13px;
  min-height: 190px;
}

.technician-workload-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
}

.technician-workload-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--mid);
  font-size: 9px;
  font-weight: 700;
}

.technician-workload-legend i {
  width: 9px;
  height: 9px;
  border-radius: 3px;
}

.technician-workload-legend i.is-active { background: var(--red); }
.technician-workload-legend i.is-completed { background: #22A447; }

.technician-workload-row {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-light);
  transition: var(--transition);
}

.technician-workload-row:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.technician-workload-row:hover {
  transform: translateX(4px);
}

.technician-workload-avatar {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 900;
}

.technician-workload-avatar.color-0 { background:#EFF6FF; color:#2563EB; }
.technician-workload-avatar.color-1 { background:#F0FDF4; color:#16A34A; }
.technician-workload-avatar.color-2 { background:#FFFBEB; color:#D97706; }
.technician-workload-avatar.color-3 { background:#F5F3FF; color:#7C3AED; }

.technician-workload-content {
  flex: 1;
  min-width: 0;
}

.technician-workload-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.technician-workload-heading strong {
  overflow: hidden;
  color: var(--dark);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.technician-workload-heading span,
.technician-workload-content small {
  color: var(--muted);
  font-size: 9px;
  font-weight: 600;
}

.technician-workload-metric {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  margin-top: 5px;
}

.technician-workload-metric-label {
  display: flex;
  justify-content: space-between;
  gap: 5px;
  color: var(--mid);
  font-size: 9px;
  font-weight: 600;
}

.technician-workload-metric-label strong {
  color: var(--dark);
  font-size: 10px;
}

.technician-workload-track {
  height: 5px;
  overflow: hidden;
  border-radius: 4px;
  background: var(--border-light);
}

.technician-workload-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--red), #F87171);
  transform-origin: left;
  animation: technicianBarGrow 0.75s ease both;
}

.technician-workload-track.is-completed span {
  background: linear-gradient(90deg, #16A34A, #4ADE80);
}

@media (max-width: 520px) {
  .technician-workload-metric {
    grid-template-columns: 68px minmax(0, 1fr);
  }
}

.technician-chart-empty {
  min-height: 170px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
}

.technician-chart-empty i {
  font-size: 24px;
  color: rgba(218,42,46,0.3);
}

@keyframes technicianBarGrow {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

.revenue-chart {
  width: 100%;
  min-height: 150px;
  margin-top: 14px;
}

.revenue-bars {
  width: 100%;
  height: 150px;
  display: grid;
  grid-template-columns: repeat(var(--revenue-bar-count, 7), minmax(0, 1fr));
  align-items: end;
  gap: 10px;
  padding: 0 4px;
  border-bottom: 1px solid var(--border-light);
}

.revenue-bar-item {
  height: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
}

.revenue-bar-track {
  width: 100%;
  height: 122px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.revenue-bar {
  width: min(30px, 72%);
  height: var(--bar-height);
  min-height: 8px;
  display: block;
  border-radius: 7px 7px 2px 2px;
  background: #F5B9A8;
  transform: scaleY(0);
  transform-origin: bottom;
  animation: revenueBarRise 0.65s cubic-bezier(0.2, 0.8, 0.2, 1) var(--bar-delay) forwards;
  transition: background-color 0.2s ease, translate 0.2s ease;
}

.revenue-bar.is-highlighted {
  background: #C93429;
  box-shadow: 0 7px 16px rgba(201, 52, 41, 0.18);
}

.revenue-bar-item:hover .revenue-bar {
  background: var(--red);
  translate: 0 -3px;
}

.revenue-bar-label {
  margin-top: 8px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}

@keyframes revenueBarRise {
  from { transform: scaleY(0); }
  to { transform: scaleY(1); }
}

.revenue-chart-svg {
  width: 100%;
  height: 190px;
  overflow: visible;
}

.revenue-axis {
  stroke: rgba(218, 42, 46, 0.14);
  stroke-width: 1;
}

.revenue-line {
  fill: none;
  stroke: var(--red);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: chartDraw 1.25s cubic-bezier(0.4, 0, 0.2, 1) 0.25s forwards;
}

.revenue-point {
  fill: var(--white);
  stroke: var(--red);
  stroke-width: 3;
  transform-box: fill-box;
  transform-origin: center;
  animation: pointPop 0.45s ease 1.1s both;
}

.revenue-label {
  fill: var(--muted);
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 600;
}

.dashboard-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.dashboard-section-header h3 {
  margin: 0;
}

.dashboard-section-header a {
  color: var(--red);
  font-size: 11px;
  font-weight: 700;
}

.dashboard-jobs-card {
  padding: 0;
  overflow: hidden;
}

.dashboard-jobs-card .dashboard-section-header {
  padding: 18px 20px 0;
}

.dashboard-jobs-card .data-table-container {
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.reg-item-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 8px;
  box-shadow: none;
  transition: var(--transition);
  animation: rowSlideIn 0.5s ease both;
}

.reg-item-card:nth-child(2) { animation-delay: 0.12s; }
.reg-item-card:nth-child(3) { animation-delay: 0.24s; }

.reg-item-card:hover {
  background: var(--red-light);
  transform: translateX(4px);
  box-shadow: 0 4px 15px rgba(218, 42, 46, 0.04);
}

.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.quick-action-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 12px;
  font-family: var(--font-primary);
  font-weight: 800;
  font-size: 12px;
  color: var(--dark);
  box-shadow: 0 4px 15px rgba(218, 42, 46, 0.03), inset 0 1px 2px rgba(255, 255, 255, 0.6);
  transition: var(--transition);
}

.quick-action-btn i { font-size: 16px; }
.quick-action-btn:hover {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(218, 42, 46, 0.2);
  color: var(--red);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(218, 42, 46, 0.06);
}

/* ================== JOBS & LISTS ================== */
.job-card {
  display: flex;
  flex-direction: column;
  padding: 20px;
  border-radius: var(--radius-card);
  background-color: var(--white);
  border: 1.5px solid var(--border);
  margin-bottom: 16px;
  transition: var(--transition);
}

.job-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-light);
}

.job-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.job-id {
  font-family: var(--font-primary);
  font-size: 15px;
  font-weight: 900;
  color: var(--dark);
}

.job-tool-info {
  margin-bottom: 16px;
}

.job-category {
  font-size: 10px;
  font-weight: 800;
  color: var(--muted);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.job-model {
  font-family: var(--font-primary);
  font-size: 18px;
  font-weight: 900;
  color: var(--dark);
}

.job-issue-box {
  background-color: #FFF8F8;
  border: 1px solid rgba(218, 42, 46, 0.1);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 16px;
}

.job-issue-title {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--red);
  font-weight: 800;
  font-size: 12px;
}

.job-issue-desc {
  font-size: 11px;
  font-style: italic;
  color: var(--mid);
  margin-top: 6px;
}

.job-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.job-customer {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--mid);
}

/* Data Table */
.data-table-container {
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(218, 42, 46, 0.04);
  margin-bottom: 20px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  background-color: transparent;
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 900;
  color: var(--red);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1.5px solid var(--border-light);
}

.data-table td {
  padding: 10px 16px;
  font-size: 13px;
  color: var(--dark);
  font-weight: 500;
  border-bottom: 1px solid var(--border-light);
}

.data-table tbody tr {
  transition: all 0.2s ease;
  cursor: pointer;
  animation: rowSlideIn 0.48s ease both;
}

.data-table tbody tr:nth-child(2) { animation-delay: 0.08s; }
.data-table tbody tr:nth-child(3) { animation-delay: 0.16s; }
.data-table tbody tr:nth-child(4) { animation-delay: 0.24s; }
.data-table tbody tr:nth-child(5) { animation-delay: 0.32s; }

.data-table tbody tr:hover {
  background-color: var(--red-light);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

/* Tabs */
.tabs-scrollable {
  display: flex;
  overflow-x: auto;
  border-bottom: 2px solid var(--border);
  margin-bottom: 24px;
  background-color: var(--white);
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 0 40px;
  margin-left: -40px;
  margin-right: -40px;
}

.tab {
  padding: 16px 24px;
  font-family: var(--font-primary);
  font-weight: 800;
  font-size: 13px;
  color: var(--muted);
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}

.tab:hover { color: var(--dark); }
.tab.active {
  color: var(--red);
  border-bottom-color: var(--red);
}

/* Search Bar */
.search-bar {
  display: flex;
  align-items: center;
  background-color: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-input);
  padding: 0 16px;
  margin-bottom: 24px;
}

.search-bar i {
  color: var(--muted);
  font-size: 18px;
}

.search-bar input {
  flex: 1;
  border: none;
  padding: 14px;
  background: transparent;
  outline: none;
  font-size: 14px;
}

/* ================== MODAL ================== */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal-box {
  background-color: var(--white);
  border-radius: var(--radius-card);
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  transform: translateY(20px);
  transition: transform 0.3s;
}

.modal-overlay.active .modal-box {
  transform: translateY(0);
}

.modal-header {
  padding: 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-primary);
  font-size: 18px;
  font-weight: 800;
}

.modal-close {
  font-size: 24px;
  color: var(--muted);
}

.modal-close:hover { color: var(--red); }

.modal-body {
  padding: 24px;
  overflow-y: auto;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Detail Items inside Modal */
.detail-item {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.detail-icon {
  color: var(--muted);
  font-size: 18px;
  margin-top: 2px;
}

.detail-content { flex: 1; }
.detail-label { font-size: 11px; font-weight: 700; color: var(--muted); margin-bottom: 4px; }
.detail-value { font-size: 14px; font-weight: 600; color: var(--dark); }

.divider {
  height: 1px;
  background-color: var(--border);
  margin: 24px 0;
}

/* ================== CUSTOMER REGISTRY ================== */
.customers-shell {
  /* Reserve a right-hand column for the selected-customer panel so list content never slides underneath it. */
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 380px);
  align-items: start;
  gap: 18px;
  width: 100%;
}

.customers-list-section {
  min-width: 0;
}

.customer-card-grid {
  /* Auto-fit customer cards so the registry remains usable across laptop and tablet widths. */
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.customer-card {
  border: 1.5px solid rgba(255, 255, 255, 0.8);
}

.customer-card.selected {
  /* Highlight the selected row/card because the detail panel can stay visible independently of scroll position. */
  border-color: rgba(218, 42, 46, 0.46);
  box-shadow: 0 12px 34px rgba(218, 42, 46, 0.12), inset 0 0 0 1px rgba(218, 42, 46, 0.12);
  transform: translateY(-2px);
}

.customer-detail-panel {
  /* Keep details visible while preserving the grid column, so controls and cards never sit underneath it. */
  position: sticky;
  top: calc(var(--dashboard-header-height) + 18px);
  align-self: start;
  width: 100%;
  max-height: calc(100vh - var(--dashboard-header-height) - 36px);
  overflow-y: auto;
  min-width: 0;
  border: 1px solid rgba(218, 42, 46, 0.14);
  border-radius: var(--radius-card);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 14px 38px rgba(218, 42, 46, 0.08);
  padding: 18px;
  z-index: 2;
}

#app-shell.sidebar-collapsed .customer-detail-panel {
  width: 100%;
}

.customer-detail-empty,
.customer-detail-loading {
  min-height: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--muted);
}

.customer-detail-empty-icon {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  margin-bottom: 14px;
  border-radius: 50%;
  background: var(--red-light);
  color: var(--red);
  font-size: 22px;
}

.customer-detail-empty h3 {
  margin: 0 0 6px;
  color: var(--dark);
  font-size: 18px;
}

.customer-detail-empty p {
  max-width: 260px;
  color: var(--mid);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
}

.customer-detail-loading i {
  margin-bottom: 10px;
  color: var(--red);
  font-size: 24px;
}

.customer-detail-loading p {
  color: var(--mid);
  font-size: 12px;
  font-weight: 700;
}

.customer-detail-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.customer-detail-avatar {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  flex: 0 0 46px;
  border-radius: 50%;
  background: var(--red);
  color: var(--white);
  box-shadow: var(--shadow-red);
}

.customer-detail-title {
  min-width: 0;
}

.customer-detail-title span {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.customer-detail-title h3 {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--dark);
  font-size: 19px;
  line-height: 1.15;
  text-transform: uppercase;
}

.customer-detail-info-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid rgba(218, 42, 46, 0.15);
  border-radius: 12px;
  background: var(--red-light);
}

.customer-history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.customer-history-header .btn {
  flex: 0 0 auto;
  white-space: nowrap;
}

/* ================== WALK-IN REGISTRATION ================== */
.walkin-layout-card {
  width: 100%;
  padding: 0;
  overflow: hidden;
}

.walkin-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.walkin-panel {
  min-width: 0;
  padding: 26px 28px 18px;
}

.walkin-panel + .walkin-panel {
  border-left: 1px solid var(--border);
}

.walkin-section-title {
  color: var(--red);
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
  margin-bottom: 24px;
}

.walkin-submit-row {
  display: flex;
  justify-content: flex-end;
  padding: 18px 28px;
  border-top: 1px solid var(--border);
  background: linear-gradient(90deg, var(--bg), var(--white));
}

.walkin-submit-row .btn {
  min-width: 180px;
}

/* ================== QR GENERATOR ================== */
.qr-container {
  display: grid;
  grid-template-columns: minmax(300px, 0.8fr) minmax(440px, 1.2fr);
  align-items: stretch;
  gap: 24px;
  width: 100%;
}

.qr-instructions-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 36px;
  border: 1px solid rgba(218, 42, 46, 0.18);
  background:
    radial-gradient(circle at top left, rgba(218, 42, 46, 0.09), transparent 42%),
    var(--white);
}

.qr-instructions-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin-bottom: 20px;
  border-radius: 16px;
  background: var(--red-light);
  color: var(--red);
  font-size: 24px;
}

.qr-instructions-card h2 {
  margin-bottom: 10px;
  font-size: 24px;
}

.qr-instructions-lead {
  color: var(--mid);
  font-size: 14px;
  line-height: 1.65;
}

.qr-step-list {
  display: grid;
  gap: 12px;
  margin: 26px 0;
}

.qr-step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
}

.qr-step span {
  display: grid;
  place-items: center;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--red);
  color: var(--white);
  font-size: 12px;
  font-weight: 800;
}

.qr-step p {
  margin: 0;
  color: var(--mid);
  font-size: 13px;
  line-height: 1.45;
}

.qr-instructions-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(37, 211, 102, 0.3);
  border-radius: 12px;
  background: var(--green-light);
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
}

.qr-generator-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  min-width: 0;
}

.qr-card {
  background-color: var(--white);
  padding: 32px;
  border-radius: var(--radius-card);
  border: 2px solid var(--border);
  text-align: center;
  box-shadow: var(--shadow-lg);
  max-width: 540px;
  width: 100%;
}

.qr-frame {
  padding: 24px;
  background-color: var(--white);
  border: 4px solid var(--bg);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 24px;
  position: relative;
}

.qr-code-center {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

#qrcode-canvas {
  width: 200px;
  height: 200px;
  flex: 0 0 200px;
}

#qrcode-canvas canvas,
#qrcode-canvas img {
  display: block;
  width: 200px !important;
  height: 200px !important;
  margin: 0 !important;
}

.qr-badge {
  background-color: var(--dark);
  color: var(--white);
  padding: 8px 16px;
  border-radius: 20px;
  font-family: var(--font-primary);
  font-weight: 800;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.url-box {
  background-color: var(--bg);
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px dashed var(--muted);
  font-family: monospace;
  font-size: 12px;
  word-break: break-all;
  color: var(--mid);
  margin-bottom: 24px;
  cursor: pointer;
}

.url-box:hover {
  border-color: var(--red);
  background-color: var(--red-light);
  color: var(--red);
}

.qr-mode-selector {
  display: flex;
  background-color: var(--white);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  max-width: 540px;
  width: 100%;
}

.qr-mode-btn {
  flex: 1;
  padding: 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  border-radius: 0;
}

.qr-mode-btn.active {
  background-color: var(--red-light);
  color: var(--red);
}

.qr-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
}

/* ================== RESPONSIVE DESIGN ================== */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { flex-direction: column; gap: 0; }

  .walkin-columns,
  .qr-container {
    grid-template-columns: 1fr;
  }

  .customers-shell {
    /* Stack list and details on tablets where a side-by-side panel would be too cramped. */
    grid-template-columns: 1fr;
  }

  .customer-detail-panel {
    /* Disable desktop stickiness so the detail panel participates in normal responsive flow. */
    position: static;
    right: auto;
    bottom: auto;
    width: 100%;
    max-height: none;
    order: -1;
  }

  .walkin-panel + .walkin-panel {
    border-top: 1px solid var(--border);
    border-left: 0;
  }

  .qr-instructions-card {
    justify-content: flex-start;
  }

  .dashboard-search {
    width: min(280px, 32vw);
  }

  .dashboard-owner-copy {
    display: none;
  }

  .dashboard-profile {
    padding-right: 5px;
  }

  .dashboard-top-layout {
    grid-template-columns: 1fr;
  }

  .dashboard-control-panel .dashboard-toolbar {
    flex-direction: row;
    align-items: center;
  }

  .dashboard-control-panel .filter-tabs {
    width: auto;
    min-width: 330px;
  }

  .dashboard-control-panel .dashboard-quick-actions {
    display: flex;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .dashboard-insights-grid {
    grid-template-columns: 1fr;
  }
}

/* Medium desktop: fill the hero card without dead space while keeping controls beside it. */
@media (min-width: 1025px) and (max-width: 1320px) {
  .dashboard-top-layout {
    /* Keep the hero and controls in two columns, but give the controls a stable minimum width. */
    grid-template-columns: minmax(0, 1fr) minmax(330px, 0.68fr);
    /* Avoid stretching the hero to match a taller controls panel. */
    align-items: start;
  }

  #dashboard-hero,
  #dashboard-hero .hero-card {
    /* Let the red card height follow its content instead of preserving blank vertical space. */
    height: auto;
  }

  .hero-card {
    align-items: flex-start;
    /* Stack text and KPIs vertically at this width to avoid overlap. */
    flex-direction: column;
    justify-content: flex-start;
    gap: 10px;
    /* Reduce vertical padding so the compact stacked layout does not feel empty. */
    padding-block: 18px;
  }

  .hero-left,
  .hero-kpi-group {
    /* Let both hero rows use the full card width. */
    width: 100%;
  }

  .hero-left {
    /* Remove the desktop 260px flex basis so the title row does not create vertical blank space. */
    flex: 0 1 auto;
  }

  .hero-kpi-group {
    /* Grid makes all KPI cards fill the card evenly at medium desktop widths. */
    display: grid;
    flex-basis: auto;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    justify-content: stretch;
  }

  .hero-credits-box {
    /* Remove the desktop max-width so KPI cards can fill each grid column. */
    max-width: none;
  }
}

@media (max-width: 768px) {
  .sidebar-toggle-btn {
    display: none;
  }

  .sidebar {
    transform: translateX(-100%);
  }
  
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  
  .top-navbar {
    display: flex;
  }

  .app-desktop-header {
    /* Mobile uses the compact top-navbar, so hide the desktop dashboard header. */
    display: none;
  }
  
  .main-content {
    margin-left: 0;
    padding-top: var(--header-height);
  }
  
  .page-container {
    padding: 24px 16px;
  }

  .customer-card-grid {
    /* Use a single column on phones so customer cards do not squeeze text or controls. */
    grid-template-columns: 1fr;
  }

  .customer-detail-panel {
    padding: 16px;
  }

  .customer-detail-info-grid {
    /* Stack profile facts on narrow screens to avoid cramped two-column labels. */
    grid-template-columns: 1fr;
  }

  .customer-history-header {
    /* Put the WhatsApp action below the heading when horizontal space is limited. */
    align-items: stretch;
    flex-direction: column;
  }

  .customer-history-header .btn {
    width: 100%;
  }

  .walkin-panel,
  .qr-instructions-card,
  .qr-card {
    padding: 22px 18px;
  }

  .walkin-submit-row {
    padding: 16px 18px;
  }

  .walkin-submit-row .btn {
    width: 100%;
  }

  .qr-actions {
    flex-wrap: wrap;
  }

  .qr-actions .btn {
    flex: 1 1 150px;
  }

  .dashboard-page-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .dashboard-header-actions {
    width: 100%;
  }

  .dashboard-search {
    width: auto;
    flex: 1;
  }

  .dashboard-profile {
    flex: 0 0 auto;
  }
  
  .hero-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 24px;
  }

  .hero-kpi-group {
    width: 100%;
    overflow-x: auto;
  }

  .hero-credits-box {
    min-width: 112px;
  }

  .dashboard-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .dashboard-control-panel .dashboard-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .dashboard-control-panel .filter-tabs {
    width: 100%;
    min-width: 0;
  }

  .dashboard-quick-actions {
    width: 100%;
    padding-bottom: 3px;
  }

  .dashboard-action-btn {
    flex: 0 0 auto;
  }
  
  .stats-grid { grid-template-columns: 1fr; }
  .quick-actions-grid { grid-template-columns: 1fr; }
  
  .job-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  .tabs-scrollable {
    padding: 0 16px;
    margin-left: -16px;
    margin-right: -16px;
  }
}

/* ================== GLOBAL CUSTOM SCROLLBARS ================== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(218, 42, 46, 0.2);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(218, 42, 46, 0.4);
}

@media (prefers-reduced-motion: reduce) {
  .hero-card,
  .hero-card::before,
  .hero-circle-1,
  .hero-circle-2,
  .dashboard-control-panel,
  .dashboard-action-btn,
  .kpi-card,
  .kpi-card::after,
  .kpi-card .stat-icon,
  .kpi-progress span,
  .dashboard-section-card,
  .dashboard-section-card::before,
  .reg-item-card,
  .data-table tbody tr,
  .revenue-line,
  .revenue-point,
  .revenue-bar {
    animation: none !important;
  }

  .revenue-bar {
    transform: scaleY(1);
  }

  .dashboard-action-btn,
  .filter-tab,
  .hero-service-center-name,
  .hero-credits-box,
  .kpi-card,
  .dashboard-section-card {
    transition: none !important;
  }
}

/* ================== OWNER PORTAL RESPONSIVE HARDENING ================== */
html {
  width: 100%;
  min-width: 0;
}

body,
#app-shell,
.main-content,
.page-container {
  min-width: 0;
}

img,
canvas,
svg,
iframe {
  max-width: 100%;
}

.page-header,
.dashboard-section-header,
.modal-header,
.modal-footer,
.job-footer,
.customer-history-header {
  min-width: 0;
}

.page-header h1,
.page-header p,
.text-h1,
.text-h2,
.text-h3,
.job-id,
.job-model,
.job-customer,
.detail-value,
.dashboard-center-heading h1,
.dashboard-center-meta,
.dashboard-section-header h3 {
  overflow-wrap: anywhere;
}

.btn,
.badge,
.tab,
.filter-tab,
.dashboard-action-btn,
.qr-mode-btn,
.portal-qr-mode {
  min-width: 0;
}

.data-table-container {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  min-width: 720px;
}

.data-table th,
.data-table td {
  white-space: nowrap;
}

.data-table td {
  vertical-align: middle;
}

.tabs-scrollable,
.filter-tabs,
.dashboard-quick-actions,
.kpi-row {
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.modal-overlay {
  padding: 18px;
}

.modal-box {
  width: min(560px, 100%);
  max-height: min(90vh, 760px);
}

.modal-body {
  min-width: 0;
}

.customer-detail-panel {
  top: calc(var(--dashboard-header-height) + 18px);
}

.walkin-panel,
.qr-instructions-card,
.qr-card,
.dashboard-section-card,
.job-card,
.customer-card {
  min-width: 0;
}

@media (max-width: 1180px) {
  .app-desktop-header {
    gap: 14px;
  }

  .dashboard-center-heading {
    flex: 1 1 auto;
  }

  .dashboard-center-meta {
    flex-wrap: wrap;
  }

  .app-desktop-header .dashboard-search,
  #app-shell.dashboard-active .dashboard-search {
    width: clamp(220px, 24vw, 330px);
  }

  .dashboard-top-layout {
    grid-template-columns: 1fr;
  }

  #dashboard-hero,
  #dashboard-hero .hero-card {
    height: auto;
  }

  .dashboard-insights-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-insights-grid .dashboard-section-card:first-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 980px) and (min-width: 769px) {
  :root {
    --sidebar-width: 82px;
    --sidebar-toggle-gutter: 18px;
  }

  .sidebar {
    width: var(--sidebar-width);
  }

  .sidebar-toggle-btn {
    display: none;
  }

  .sidebar .nav-label,
  .sidebar .nav-section-label,
  .sidebar-powered-by,
  .sidebar-shop-info,
  .sidebar-credits,
  #sidebar-shop-name {
    display: none;
  }

  .sidebar-nav {
    padding-top: 12px;
  }

  .nav-item {
    margin: 4px 10px;
  }

  .nav-link {
    justify-content: center;
    padding: 11px;
  }

  .nav-link i {
    width: auto;
    font-size: 17px;
  }

  .logout-btn {
    padding: 11px;
  }

   .sidebar-footer-logo {
    width: 58px;
    height: 38px;
  }

  .app-desktop-header {
    padding: 10px 18px;
  }

  .dashboard-owner-copy {
    display: none;
  }
}

@media (max-width: 900px) {
  .dashboard-insights-grid,
  .dashboard-grid-2col {
    grid-template-columns: 1fr;
  }

  .dashboard-insights-grid .dashboard-section-card:first-child {
    grid-column: auto;
  }

  .hero-card {
    align-items: stretch;
    flex-direction: column;
    gap: 16px;
  }

  .hero-kpi-group {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    flex-basis: auto;
  }

  .hero-credits-box {
    max-width: none;
  }
}

@media (max-width: 768px) {
  body {
    overflow-x: hidden;
  }

  .top-navbar {
    gap: 8px;
    padding: 0 10px;
  }

  .hamburger-btn,
  .bell-btn,
  #top-logout-btn {
    flex: 0 0 auto;
  }

  .mobile-brand {
    min-width: 0;
    overflow: hidden;
    font-size: 15px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .top-navbar .lang-select {
    width: 58px;
    min-width: 58px;
  }

  .page-container,
  .page-container.dashboard-full-width,
  .page-container.page-full-width {
    width: 100%;
    max-width: 100%;
    padding: 16px 12px 24px;
  }

  .page-header {
    display: flex;
    flex-direction: column;
    align-items: stretch !important;
    gap: 10px;
    margin-bottom: 16px;
  }

  .page-header > div,
  .page-header .btn {
    min-width: 0;
  }

  .page-header .btn {
    width: 100%;
  }

  .text-h1 {
    font-size: 22px;
    line-height: 1.12;
  }

  .card {
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 14px;
  }

  .card:hover,
  .dashboard-section-card:hover,
  .job-card:hover,
  .customer-card.selected {
    transform: none;
  }

  .form-row,
  .radio-group {
    flex-direction: column;
    gap: 10px;
  }

  .radio-label {
    min-height: 44px;
  }

  .search-bar {
    width: 100%;
    margin-bottom: 16px;
    padding: 0 12px;
  }

  .search-bar input {
    min-width: 0;
    padding: 12px 8px;
  }

  .tabs-scrollable {
    position: relative;
    top: auto;
    padding: 0 12px;
    margin: 0 -12px 16px;
  }

  .tab {
    padding: 13px 16px;
    font-size: 12px;
  }

  .dashboard-control-panel {
    padding: 14px;
  }

  .dashboard-control-panel .filter-tabs {
    display: flex;
    width: 100%;
    overflow-x: auto;
  }

  .dashboard-control-panel .filter-tab {
    flex: 1 0 82px;
    text-align: center;
  }

  .dashboard-quick-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: visible;
  }

  .dashboard-action-btn {
    width: 100%;
  }

  .kpi-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: visible;
  }

  .kpi-card {
    min-width: 0;
  }

  .hero-kpi-group {
    grid-template-columns: 1fr;
  }

  .hero-title {
    font-size: 22px;
  }

  .job-card {
    padding: 16px;
  }

  .job-footer {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
  }

  .job-footer > div:last-child,
  .job-footer > div:last-child > div,
  .job-footer .btn {
    width: 100%;
  }

  .job-customer {
    align-items: flex-start;
    line-height: 1.45;
  }

  .modal-overlay {
    align-items: flex-end;
    padding: 10px;
  }

  .modal-box {
    width: 100%;
    max-height: calc(100vh - 20px);
    border-radius: 14px;
  }

  .modal-header,
  .modal-body,
  .modal-footer {
    padding: 16px;
  }

  .modal-footer {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .modal-footer .btn {
    width: 100%;
    margin-right: 0 !important;
  }

  .detail-item {
    align-items: flex-start;
  }

  .customers-shell {
    display: flex;
    flex-direction: column;
  }

  .customer-detail-panel {
    order: 2;
  }

  .customers-list-section {
    order: 1;
  }

  .walkin-columns {
    display: flex;
    flex-direction: column;
  }

  .walkin-panel {
    padding: 18px 16px;
  }

  .walkin-submit-row {
    position: sticky;
    bottom: 0;
    z-index: 5;
    padding: 12px 16px;
  }

  .qr-container,
  .portal-qr-layout {
    grid-template-columns: 1fr !important;
  }

  #reports-list,
  #tech-list {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 520px) {
  .login-card,
  .forgot-password-card {
    padding: 24px 18px;
  }

  .top-navbar > div:last-child {
    gap: 8px !important;
  }

  .dashboard-quick-actions,
  .kpi-row,
  .quick-actions-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-section-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .revenue-bars {
    gap: 6px;
  }

  .revenue-bar {
    width: min(22px, 82%);
  }

  .customer-card [style*="justify-content:space-between"],
  .reg-item-card [style*="justify-content:space-between"] {
    gap: 10px;
  }

  .portal-qr-code-box,
  #portal-qr-canvas,
  #portal-qr-canvas canvas,
  #portal-qr-canvas img,
  #qrcode-canvas,
  #qrcode-canvas canvas,
  #qrcode-canvas img {
    width: 180px !important;
    height: 180px !important;
    flex-basis: 180px !important;
  }

  .portal-qr-poster {
    padding: 20px 14px;
  }

  .portal-qr-modes {
    flex-direction: column;
  }

  .btn {
    width: 100%;
    min-height: 42px;
    white-space: normal;
  }

  .btn-icon,
  .dashboard-icon-btn,
  .hamburger-btn,
  .bell-btn,
  #top-logout-btn {
    width: 40px;
    min-width: 40px;
  }
}

/* Flutter owner-app parity: below 900px the native app uses an AppBar + Drawer,
   two-column dashboard stats/actions, and comfortable 20px mobile gutters. */
@media (max-width: 899px) {
  :root {
    --header-height: 60px;
  }

  body {
    background: #F8F9FA;
  }

  .app-desktop-header,
  .sidebar-toggle-btn {
    display: none !important;
  }

  .top-navbar {
    display: flex !important;
    height: 60px;
    background: #FFFFFF;
    border-bottom: 1px solid #F2F2F7;
    box-shadow: none;
  }

  .sidebar {
    top: 0 !important;
    width: min(320px, 86vw) !important;
    transform: translateX(-100%);
    z-index: 140;
    box-shadow: none;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 18px 0 40px rgba(17, 17, 17, 0.18);
  }

  .sidebar .nav-label,
  .sidebar .nav-section-label,
  .sidebar-powered-by,
  .sidebar-shop-info,
  .sidebar-credits,
  #sidebar-shop-name {
    display: initial;
  }

  .sidebar-nav {
    padding: 12px 0;
  }

  .nav-section-label {
    display: block;
    padding: 12px 22px 4px;
  }

  .nav-item {
    margin: 4px 16px;
  }

  .nav-link {
    justify-content: flex-start;
    gap: 16px;
    min-height: 46px;
    padding: 12px 16px;
    border-radius: 12px;
  }

  .nav-link i {
    width: 20px;
    font-size: 20px;
  }

  .nav-link.active {
    background: var(--red);
    color: var(--white);
    box-shadow: none;
    border-color: var(--red);
  }

  .nav-link.active i {
    color: var(--white);
  }

  .logout-btn {
    min-height: 46px;
    justify-content: flex-start;
    padding: 12px 16px;
    border-radius: 12px;
  }

   .sidebar-footer-logo {
    width: 168px;
    height: 53px;
  }

  .main-content {
    margin-left: 0 !important;
    padding-top: 60px !important;
  }

  .page-container,
  .page-container.dashboard-full-width,
  .page-container.page-full-width {
    padding: 20px 20px 32px;
  }

  .dashboard-top-layout {
    display: block;
  }

  #dashboard-hero,
  #dashboard-hero .hero-card {
    height: auto !important;
    min-height: 0 !important;
  }

  .hero-card {
    display: flex;
    align-items: stretch;
    justify-content: flex-start;
    flex-direction: column;
    gap: 18px;
    margin-bottom: 20px;
    padding: 24px;
    border-radius: 24px;
  }

  .hero-left {
    flex: 0 1 auto;
    width: 100%;
  }

  .hero-welcome-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .hero-kpi-group {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    flex: 0 1 auto;
    justify-content: stretch;
    overflow: visible;
  }

  .hero-credits-box {
    width: 100%;
    min-width: 0;
    max-width: none;
  }

  .dashboard-control-panel {
    margin-bottom: 20px;
    border-radius: 20px;
  }

  .dashboard-toolbar,
  .dashboard-control-panel .dashboard-toolbar {
    display: flex;
    align-items: stretch;
    flex-direction: column !important;
    gap: 12px;
    white-space: normal;
  }

  .dashboard-control-panel .filter-tabs {
    width: 100%;
    min-width: 0 !important;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    overflow: visible;
  }

  .dashboard-control-panel .filter-tab {
    min-width: 0;
    padding: 9px 8px;
    overflow: hidden;
    text-align: center;
    text-overflow: ellipsis;
  }

  .kpi-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    overflow: visible;
  }

  .kpi-card {
    min-width: 0;
    padding: 16px 8px;
    border-radius: 18px;
    text-align: center;
  }

  .kpi-header {
    align-items: center;
    flex-direction: column-reverse;
    gap: 10px;
    margin-bottom: 8px;
  }

  .kpi-header .stat-icon {
    width: 36px !important;
    height: 36px !important;
    border-radius: 50%;
  }

  .kpi-value {
    font-size: 22px;
    color: var(--red);
  }

  .kpi-title {
    max-width: 100%;
    overflow: hidden;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .kpi-progress {
    display: none;
  }

  .dashboard-quick-actions,
  .quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    overflow: visible;
  }

  .dashboard-action-btn,
  .quick-action-btn {
    min-height: 78px;
    height: auto;
    flex-direction: column;
    gap: 8px;
    border-radius: 20px;
    color: var(--white);
    background: linear-gradient(135deg, #D32F2F, #DA2A2E);
    box-shadow: 0 8px 16px rgba(218, 42, 46, 0.22);
  }

  .dashboard-action-btn i,
  .quick-action-btn i {
    color: var(--white);
    font-size: 22px;
  }

  .dashboard-action-btn span,
  .quick-action-btn span {
    max-width: 100%;
    overflow: hidden;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.5px;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
  }

  .dashboard-insights-grid,
  .dashboard-grid-2col,
  .customers-shell,
  .walkin-columns,
  .qr-container {
    grid-template-columns: 1fr !important;
  }

  [style*="grid-template-columns: 1fr 1fr"],
  [style*="grid-template-columns: repeat(auto-fill"],
  [style*="grid-template-columns: repeat(auto-fit"] {
    grid-template-columns: 1fr !important;
  }

  .card,
  .dashboard-section-card,
  .job-card,
  .customer-card,
  .customer-detail-panel,
  .qr-card,
  .qr-instructions-card {
    border-color: #EBEBEB;
    border-radius: 24px;
    background: #FFFFFF;
    box-shadow: 0 8px 16px rgba(17, 17, 17, 0.025);
  }

  .job-card {
    padding: 20px;
  }

  .job-header {
    align-items: flex-start;
  }

  .job-id::before {
    content: "\f0ad";
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    margin-right: 10px;
    border-radius: 50%;
    background: #F2F2F7;
    color: #1A1A1B;
    font-family: "Font Awesome 6 Free";
    font-size: 14px;
    font-weight: 900;
    vertical-align: middle;
  }

  .job-issue-box {
    border-radius: 16px;
  }

  .badge {
    border-radius: 999px;
  }

  .customer-detail-panel {
    position: static;
    width: 100%;
    max-height: none;
  }
}

@media (min-width: 900px) and (max-width: 1180px) {
  #dashboard-hero,
  #dashboard-hero .hero-card {
    height: auto !important;
    min-height: 0 !important;
  }

  .hero-card {
    align-items: stretch;
    justify-content: flex-start;
    flex-direction: column;
    gap: 18px;
  }

  .hero-left,
  .hero-kpi-group {
    width: 100%;
  }

  .hero-kpi-group {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    flex-basis: auto;
    justify-content: stretch;
  }

  .hero-credits-box {
    max-width: none;
  }

  .dashboard-control-panel .dashboard-toolbar {
    align-items: stretch;
    flex-direction: column !important;
    white-space: normal;
  }

  .dashboard-control-panel .filter-tabs {
    width: 100%;
    min-width: 0;
  }

  .dashboard-control-panel .dashboard-quick-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    overflow: visible;
  }

  .dashboard-action-btn {
    min-width: 0;
    overflow: hidden;
  }

  .dashboard-action-btn span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@media (max-width: 380px) {
  .page-container,
  .page-container.dashboard-full-width,
  .page-container.page-full-width {
    padding-inline: 14px;
  }

  .kpi-row,
  .dashboard-quick-actions,
  .quick-actions-grid {
    grid-template-columns: 1fr;
  }
}

/* Dashboard KPI layout: keep all seven status cards on one row when the
   workspace is wide, then reduce columns deliberately instead of allowing a
   single orphan card to wrap onto the next row. These rules are placed after
   the general responsive hardening so they remain the final KPI breakpoints. */
@media (min-width: 1181px) {
  #dash-stats.kpi-row {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr)) !important;
    width: 100%;
    overflow: visible;
  }

  #dash-stats .kpi-card {
    min-width: 0;
    padding-inline: 14px;
  }
}

@media (min-width: 769px) and (max-width: 1180px) {
  #dash-stats.kpi-row {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }
}

@media (min-width: 521px) and (max-width: 768px) {
  #dash-stats.kpi-row {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 520px) {
  #dash-stats.kpi-row {
    grid-template-columns: 1fr !important;
  }
}

/* ========================================================================== 
   Print Styles
   ========================================================================== */

@media print {
  @page {
    size: A4;
    margin: 0;
  }

  body {
    visibility: hidden;
  }

  .print-preview-modal,
  .print-preview-content {
    visibility: visible;
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
  }

  .print-preview-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
  }

  .print-preview-content h2 {
    display: none;
  }

  .print-preview-content p {
    display: none;
  }

  .print-preview-actions {
    display: none;
  }

  .sticker-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 50mm;
    height: 25mm;
    border: 1px solid #000;
    padding: 2px;
    background: white;
    box-sizing: border-box;
  }

  .sticker-qr {
    width: 10mm;
    height: 10mm;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .sticker-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    margin-top: 1px;
    width: 100%;
  }

  .sticker-jobid {
    font-family: 'Courier New', monospace;
    font-size: 10px;
    font-weight: bold;
    text-align: center;
    line-height: 1.1;
  }

  .sticker-tool {
    font-family: 'Courier New', monospace;
    font-size: 8px;
    font-weight: 600;
    text-align: center;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .sticker-status {
    font-family: 'Courier New', monospace;
    font-size: 7px;
    font-weight: bold;
    text-align: center;
    line-height: 1.1;
    padding: 1px 3px;
    background: #f0f0f0;
    border: 1px solid #000;
    border-radius: 2px;
  }

  .sticker-print-area {
    width: 50mm;
    height: 25mm;
  }
}

/* ==========================================================================
   Print Modal Styles
   ========================================================================== */

.print-preview-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.print-preview-content {
  background: white;
  border-radius: 16px;
  padding: 32px;
  max-width: 450px;
  width: 90%;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    transform: translateY(-20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.print-preview-content h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 8px;
  text-align: center;
}

.print-preview-content > p {
  font-size: 14px;
  color: var(--muted);
  text-align: center;
  margin-bottom: 24px;
}

.print-preview-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 24px;
}

/* Status Badge Styles */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.badge-outline {
  border: 2px solid transparent;
}

.badge-reg {
  background: #E3F2FD;
  color: #1976D2;
}

.badge-inspect {
  background: #FFF3E0;
  color: #F57C00;
}

.badge-est {
  background: #F3E5F5;
  color: #7B1FA2;
}

.badge-appr {
  background: #E8F5E9;
  color: #388E3C;
}

.badge-repair {
  background: #BBDEFB;
  color: #1976D2;
}

.badge-rej {
  background: #FFEBEE;
  color: #D32F2F;
}

.badge-hold {
  background: #FFF8E1;
  color: #F9A825;
}

.badge-ready {
  background: #C8E6C9;
  color: #388E3C;
}

.badge-deliv {
  background: #A5D6A7;
  color: #2E7D32;
}

/* ================== HISTORY PAGE ================== */
/* Compact, responsive summary cards — fit a row when space allows, else wrap. */
.history-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 118px), 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.history-summary-card {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--white);
  border: 1px solid var(--border);
  box-shadow: 0 3px 10px rgba(74, 25, 27, 0.04), inset 0 1px 0 #FFFFFF;
  transition: var(--transition);
  overflow: hidden;
}

.history-summary-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(218, 42, 46, 0.07);
}

.history-summary-icon {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  flex-shrink: 0;
}

.history-summary-purchased .history-summary-icon {
  background: rgba(76, 175, 80, 0.1);
  color: #2E7D32;
}

/* Complimentary credits card — sits beside Total Purchased */
.history-summary-complimentary .history-summary-icon {
  background: rgba(123, 31, 162, 0.1);
  color: #7B1FA2;
}

.history-summary-used .history-summary-icon {
  background: rgba(218, 42, 46, 0.1);
  color: var(--red);
}

.history-summary-balance .history-summary-icon {
  background: rgba(33, 150, 243, 0.1);
  color: #1565C0;
}

.history-summary-spent .history-summary-icon {
  background: rgba(255, 152, 0, 0.1);
  color: #E65100;
}

.history-summary-content {
  min-width: 0;
  flex: 1;
}

.history-summary-label {
  font-size: 8px;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-summary-value {
  font-family: var(--font-primary);
  font-size: 14px;
  font-weight: 900;
  color: var(--dark);
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-summary-unit {
  font-size: 8px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.2px;
  margin-top: 0;
}

.history-subscription-card {
  border-left: 4px solid var(--status-ready);
}

.history-subscription-card .history-subscription-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.history-subscription-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-primary);
  font-size: 15px;
  font-weight: 800;
  color: var(--dark);
}

.history-subscription-title i {
  color: var(--red);
}

.history-subscription-body {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

@media (max-width: 520px) {
  .history-subscription-body {
    grid-template-columns: 1fr;
  }
}

.history-subscription-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.history-subscription-label {
  font-size: 10px;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.history-subscription-value {
  font-family: var(--font-primary);
  font-size: 14px;
  font-weight: 800;
  color: var(--dark);
}

.history-log-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.history-log-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.history-filter-select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  font-size: 12px;
  font-weight: 600;
  color: var(--dark);
  outline: none;
  cursor: pointer;
  transition: var(--transition);
}

.history-filter-select:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(218, 42, 46, 0.07);
}

.history-filter-date {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  font-size: 12px;
  font-weight: 600;
  color: var(--dark);
  outline: none;
  transition: var(--transition);
}

.history-filter-date:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(218, 42, 46, 0.07);
}

.history-transactions-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.history-transaction-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 14px;
  background: var(--white);
  border: 1px solid var(--border);
  box-shadow: 0 4px 12px rgba(74, 25, 27, 0.04);
  transition: var(--transition);
  animation: rowSlideIn 0.35s ease both;
}

.history-transaction-card:hover {
  box-shadow: 0 8px 22px rgba(218, 42, 46, 0.08);
  transform: translateX(4px);
}

.history-type-purchase {
  border-left: 4px solid #2E7D32;
}

.history-type-usage {
  border-left: 4px solid var(--red);
}

.history-type-subscription {
  border-left: 4px solid #1565C0;
}

.history-type-complimentary {
  border-left: 4px solid #9C27B0;
}

.history-type-refund {
  border-left: 4px solid #FF9800;
}

.history-transaction-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  background: var(--bg);
  color: var(--mid);
}

.history-transaction-body {
  flex: 1;
  min-width: 0;
}

.history-transaction-title {
  font-family: var(--font-primary);
  font-size: 13px;
  font-weight: 800;
  color: var(--dark);
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-transaction-meta {
  display: block;
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  line-height: 1.35;
}

.history-transaction-initiator {
  display: inline;
  padding: 0;
  border-radius: 0;
  background: transparent;
  font-size: 10px;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
  color: var(--muted);
}

.history-transaction-invoice {
  font-size: 13px;
  color: var(--dark);
  font-weight: 800;
  margin: 0 0 2px;
  font-family: var(--font-primary);
}

.history-transaction-amounts {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  flex-shrink: 0;
  margin-left: 8px;
}

.history-transaction-credits {
  font-family: var(--font-primary);
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
}

.history-amount-positive {
  color: #2E7D32;
}

.history-amount-negative {
  color: var(--red);
}

.history-transaction-money {
  font-size: 12px;
  font-weight: 800;
  color: var(--dark);
}

.history-transaction-amounts .badge {
  margin: 0 !important;
}

.history-loading {
  padding: 48px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.history-empty {
  padding: 48px 20px;
  text-align: center;
  color: var(--muted);
}

.history-empty i {
  font-size: 48px;
  margin-bottom: 12px;
  display: block;
  opacity: 0.5;
}

.history-empty p {
  font-size: 14px;
  font-weight: 700;
}

.history-load-more {
  text-align: center;
  padding: 20px;
}

.history-download-wrap {
  position: relative;
  display: inline-flex;
}

.history-download-btn {
  min-width: 42px;
  padding: 8px 12px !important;
}

.history-download-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 40;
  min-width: 140px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.12);
  overflow: hidden;
}

.history-download-item {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 10px;
  border: 0;
  background: transparent;
  padding: 11px 14px;
  font-size: 13px;
  font-weight: 700;
  color: var(--dark);
  cursor: pointer;
  text-align: left;
}

.history-download-item:hover {
  background: #f7f7f8;
}

.history-download-item i.fa-file-pdf {
  color: #d32f2f;
}

.history-download-item i.fa-file-csv {
  color: #2e7d32;
}

@media (max-width: 720px) {
  .history-summary-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 132px), 1fr));
  }
}

@media (max-width: 520px) {
  .history-summary-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }

  .history-summary-card {
    padding: 7px 8px;
    gap: 5px;
  }

  .history-summary-icon {
    width: 24px;
    height: 24px;
    font-size: 10px;
  }

  .history-summary-value {
    font-size: 13px;
  }

  .history-log-header {
    flex-direction: column;
    align-items: stretch;
  }

  .history-log-filters {
    flex-direction: column;
  }

  .history-filter-select,
  .history-filter-date {
    width: 100%;
  }

  .history-transaction-card {
    flex-wrap: wrap;
  }

  .history-transaction-amounts {
    flex-direction: row;
    align-items: center;
    gap: 10px;
    width: 100%;
    justify-content: flex-end;
  }
}
