:root {
  --bg:           #eae9e6;
  --bg-light:     #f2f1ef;
  --bg-dark:      #d8d6d1;
  --accent:       #9f9a87;
  --accent-dark:  #7a7666;
  --accent-mid:   #b5b0a0;
  --accent-faint: #e8e6e0;

  --surface:      #ffffff;
  --surface-2:    #f7f6f4;

  --text:         #2e2d2a;
  --text-2:       #6a6960;
  --text-3:       #a09e97;

  --border:       #d8d6d1;
  --border-light: #e8e6e2;

  --sb-bg:        #1c1b19;
  --sb-hover:     rgba(255,255,255,0.07);
  --sb-active:    rgba(159,154,135,0.18);
  --sb-text:      #9a9890;
  --sb-text-on:   #eae9e6;

  --danger:       #b84040;
  --danger-bg:    #fdf5f5;
  --success:      #4a8c5c;

  --sidebar-w:    230px;
  --radius:       10px;
  --radius-sm:    7px;
  --shadow-sm:    0 1px 3px rgba(0,0,0,0.07);
  --shadow:       0 2px 8px rgba(0,0,0,0.09);
  --shadow-lg:    0 8px 32px rgba(0,0,0,0.14);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

/* ══════════════════════════════════════════
   LOGIN PAGE
══════════════════════════════════════════ */
body.login-body {
  background: var(--sb-bg);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  padding-top: max(1.5rem, env(safe-area-inset-top));
  padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
}

.login-wrap {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

.login-card {
  background: var(--surface);
  border-radius: 18px;
  padding: 2.5rem 2.5rem 2rem;
  width: 100%;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
  border-top: 3px solid var(--accent);
  animation: fadeUp 0.35s ease;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.login-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 1.75rem;
}
.login-wordmark {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text);
}
.login-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  margin-bottom: 0.3rem;
}
.login-sub {
  font-size: 0.85rem;
  color: var(--text-2);
  text-align: center;
  margin-bottom: 1.6rem;
}

.login-error {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(184,64,64,0.25);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.9rem;
  font-size: 0.85rem;
  margin-bottom: 1.25rem;
  display: none;
  align-items: center;
  gap: 0.5rem;
}

.pwd-field { position: relative; }
.pwd-field input { padding-right: 3rem !important; }
.pwd-toggle {
  position: absolute;
  right: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-3);
  padding: 0.3rem;
  border-radius: 5px;
  line-height: 1;
  transition: color 0.15s;
  font-family: inherit;
  min-height: 32px;
  display: flex;
  align-items: center;
}
.pwd-toggle:hover { color: var(--text-2); }

.login-submit {
  width: 100%;
  margin-top: 1.5rem;
  padding: 0.85rem !important;
  font-size: 0.95rem !important;
  justify-content: center;
  min-height: 50px;
}

.login-footer {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.2);
  text-align: center;
}

/* ══════════════════════════════════════════
   APP SHELL
══════════════════════════════════════════ */
.app {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ── Sidebar ─────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--sb-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  height: 100dvh;
  z-index: 50;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-logo {
  padding: 1.6rem 1.5rem 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  text-decoration: none;
  flex-shrink: 0;
}
.sidebar-logo svg { width: 38px; height: auto; }
.sidebar-logo .wordmark {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--sb-text-on);
  text-transform: uppercase;
  opacity: 0.85;
  white-space: nowrap;
}

.sidebar-nav {
  padding: 0.85rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--sb-text);
  font-size: 0.88rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  min-height: 46px;
  font-family: inherit;
}
.nav-item svg { flex-shrink: 0; opacity: 0.65; transition: opacity 0.15s; }
.nav-item:hover { background: var(--sb-hover); color: var(--sb-text-on); }
.nav-item:hover svg { opacity: 1; }
.nav-item.active { background: var(--sb-active); color: var(--sb-text-on); font-weight: 600; }
.nav-item.active svg { opacity: 1; }

.nav-label { white-space: nowrap; }

.sidebar-bottom {
  flex-shrink: 0;
  padding: 0.75rem;
  border-top: 1px solid rgba(255,255,255,0.07);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 0.9rem 0.6rem;
}
.user-avatar-sm {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: rgba(159,154,135,0.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem; font-weight: 700;
  color: var(--sb-text-on);
  flex-shrink: 0;
}
.user-name {
  font-size: 0.82rem;
  color: var(--sb-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-logout { color: var(--sb-text); }
.nav-logout:hover { color: #e08080 !important; background: rgba(184,64,64,0.1) !important; }

/* ── Main content ─────────────────────────── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  min-width: 0;
}

.page-header {
  background: var(--bg-light);
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.75rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 40;
}
.page-header h1 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  flex: 1;
  min-width: 0;
}
.page-header .header-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.content {
  padding: 1.75rem;
  flex: 1;
}

/* ── Badges ────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.65rem;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--accent-faint);
  color: var(--accent-dark);
}

/* ── Buttons ───────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.1rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  white-space: nowrap;
  font-family: inherit;
  min-height: 44px;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-ghost { background: transparent; color: var(--text-2); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--surface); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #9c3535; }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.8rem; min-height: 36px; }
.btn-icon { padding: 0.4rem; border-radius: 6px; min-height: 36px; min-width: 36px; justify-content: center; }

/* ── Search ─────────────────────────────────── */
.search-wrap { position: relative; flex: 1; min-width: 160px; max-width: 360px; }
.search-wrap svg {
  position: absolute;
  left: 0.75rem; top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
}
.search-input {
  width: 100%;
  padding: 0.6rem 0.85rem 0.6rem 2.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 16px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  min-height: 44px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(159,154,135,0.15);
}

/* ── Customer Grid ─────────────────────────── */
.customer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s, transform 0.15s, border-color 0.15s;
}
.card:hover { box-shadow: var(--shadow); transform: translateY(-2px); border-color: var(--accent-mid); }
.card:active { transform: translateY(0); }
.card-link {
  display: block;
  padding: 1rem 1.15rem;
  text-decoration: none;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}
.card-name { font-size: 0.95rem; font-weight: 700; color: var(--text); margin-bottom: 0.45rem; }
.card-meta { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.78rem; color: var(--text-2); }
.card-meta span { display: flex; align-items: center; gap: 0.4rem; }
.card-meta .icon { font-size: 0.72rem; opacity: 0.55; }

/* ── Empty state ───────────────────────────── */
.empty-state { text-align: center; padding: 4rem 2rem; color: var(--text-3); }
.empty-state .empty-icon { width: 52px; height: 52px; margin: 0 auto 1.1rem; opacity: 0.22; }
.empty-state h3 { font-size: 1rem; color: var(--text-2); margin-bottom: 0.35rem; }
.empty-state p { font-size: 0.85rem; margin-bottom: 1.4rem; }

/* ── Customer hero ─────────────────────────── */
.customer-hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
  flex-wrap: wrap;
}
.customer-hero .avatar {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--accent-faint);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; font-weight: 700;
  color: var(--accent-dark);
  flex-shrink: 0;
}
.customer-hero .info { flex: 1; min-width: 0; }
.customer-hero .info h2 { font-size: 1.3rem; font-weight: 800; color: var(--text); margin-bottom: 0.5rem; }
.customer-hero .info .fields {
  display: flex; flex-wrap: wrap;
  gap: 0.3rem 1.25rem;
  font-size: 0.8rem; color: var(--text-2);
}
.customer-hero .info .fields span { display: flex; align-items: center; gap: 0.3rem; }
.customer-hero .actions { display: flex; gap: 0.5rem; flex-shrink: 0; }

/* ── Section box ───────────────────────────── */
.section-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.section-box + .section-box { margin-top: 1.25rem; }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--border-light);
  background: var(--surface-2);
  gap: 0.75rem;
  flex-wrap: wrap;
}
.section-head h3 {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: flex; align-items: center; gap: 0.5rem;
}

/* ── Table ─────────────────────────────────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left;
  padding: 0.65rem 1rem;
  font-size: 0.71rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-3);
  border-bottom: 1px solid var(--border-light);
  background: var(--surface-2);
  white-space: nowrap;
}
tbody tr { border-bottom: 1px solid var(--border-light); transition: background 0.1s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg-light); }
tbody td { padding: 0.8rem 1rem; font-size: 0.85rem; vertical-align: middle; color: var(--text); }
.td-price { font-weight: 600; color: var(--accent-dark); white-space: nowrap; }
.td-actions { display: flex; gap: 0.3rem; align-items: center; white-space: nowrap; }
.td-muted { color: var(--text-3); }
.td-empty td { text-align: center; padding: 2.5rem; color: var(--text-3); font-size: 0.85rem; font-style: italic; }

/* ── Stats ─────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.4rem;
  box-shadow: var(--shadow-sm);
}
.kpi-label { font-size: 0.71rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-3); margin-bottom: 0.5rem; }
.kpi-value { font-size: 1.75rem; font-weight: 800; color: var(--text); line-height: 1; margin-bottom: 0.3rem; }
.kpi-sub { font-size: 0.75rem; color: var(--text-3); }

.chart-wrap { padding: 1.4rem; }
.chart-title { font-size: 0.71rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-3); margin-bottom: 1rem; }

.stats-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

.treatment-bar-row {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.5rem 0; border-bottom: 1px solid var(--border-light);
}
.treatment-bar-row:last-child { border-bottom: none; }
.treatment-bar-name { font-size: 0.82rem; color: var(--text); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.treatment-bar-track { width: 80px; height: 6px; background: var(--bg-dark); border-radius: 3px; flex-shrink: 0; overflow: hidden; }
.treatment-bar-fill { height: 100%; background: var(--accent); border-radius: 3px; }
.treatment-bar-count { font-size: 0.78rem; font-weight: 600; color: var(--accent-dark); white-space: nowrap; min-width: 28px; text-align: right; }

.hairdresser-row { display: flex; align-items: center; justify-content: space-between; padding: 0.6rem 0; border-bottom: 1px solid var(--border-light); gap: 0.75rem; }
.hairdresser-row:last-child { border-bottom: none; }
.hairdresser-name { font-size: 0.88rem; color: var(--text); font-weight: 500; }
.hairdresser-stats { font-size: 0.78rem; color: var(--text-3); text-align: right; }
.hairdresser-stats strong { color: var(--accent-dark); font-weight: 600; display: block; }

/* ── Modal ─────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(20,19,18,0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; padding: 1rem;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--surface);
  border-radius: 14px;
  width: 100%; max-width: 520px;
  max-height: 90vh; max-height: 90dvh;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}
.modal-head {
  padding: 1.2rem 1.5rem;
  border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0;
  background: var(--surface); z-index: 1;
}
.modal-head h3 { font-size: 1rem; font-weight: 700; color: var(--text); }
.modal-close {
  background: none; border: none; cursor: pointer;
  color: var(--text-3); padding: 0.3rem; border-radius: 5px;
  font-size: 1.1rem; line-height: 1; transition: color 0.15s;
  font-family: inherit; min-height: 36px; min-width: 36px;
  display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { color: var(--danger); }
.modal-body { padding: 1.4rem; }
.modal-foot {
  padding: 1rem 1.4rem;
  border-top: 1px solid var(--border-light);
  display: flex; gap: 0.75rem; justify-content: flex-end;
  background: var(--surface-2);
}

/* ── Forms ─────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-grid .full { grid-column: 1 / -1; }
.form-group { display: flex; flex-direction: column; gap: 0.35rem; }
.form-group label { font-size: 0.78rem; font-weight: 600; color: var(--text-2); }
.form-group input,
.form-group textarea,
.form-group select {
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  outline: none;
  min-height: 46px;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(159,154,135,0.15);
}
.form-group textarea { resize: vertical; min-height: 80px; }

/* ── Confirm dialog ────────────────────────── */
.confirm-overlay {
  position: fixed; inset: 0;
  background: rgba(20,19,18,0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 300; padding: 1rem;
}
.confirm-overlay.hidden { display: none; }
.confirm-box {
  background: var(--surface);
  border-radius: 16px; padding: 2rem;
  max-width: 360px; width: 100%;
  text-align: center;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  animation: fadeUp 0.2s ease;
}
.confirm-box .c-icon { font-size: 2.5rem; margin-bottom: 0.75rem; }
.confirm-box h4 { font-size: 1rem; font-weight: 700; margin-bottom: 0.4rem; }
.confirm-box p { color: var(--text-2); font-size: 0.85rem; margin-bottom: 1.4rem; line-height: 1.5; }
.confirm-box .c-btns { display: flex; gap: 0.75rem; justify-content: center; }

/* ── Toast ─────────────────────────────────── */
#toast {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm); font-size: 0.85rem; font-weight: 600;
  box-shadow: var(--shadow-lg); z-index: 400;
  transform: translateY(80px); opacity: 0;
  transition: all 0.28s cubic-bezier(0.34,1.56,0.64,1);
  background: var(--success); color: #fff; max-width: 300px;
}
#toast.show { transform: translateY(0); opacity: 1; }
#toast.error { background: var(--danger); }

/* ── Misc ──────────────────────────────────── */
.spinner {
  display: inline-block; width: 20px; height: 20px;
  border: 2.5px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.mt-1 { margin-top: 1rem; }
.mt-15 { margin-top: 1.25rem; }

/* ══════════════════════════════════════════
   TABLET  768 – 1023 px
   Icon-only sidebar
══════════════════════════════════════════ */
@media (min-width: 768px) and (max-width: 1023px) {
  :root { --sidebar-w: 68px; }

  .sidebar-logo {
    padding: 1.25rem 0;
    align-items: center;
    gap: 0;
  }
  .sidebar-logo svg { width: 30px; }
  .sidebar-logo .wordmark { display: none; }

  .sidebar-nav { padding: 0.6rem 0.55rem; }
  .nav-item {
    justify-content: center;
    padding: 0.75rem;
    gap: 0;
    border-radius: 8px;
  }
  .nav-item svg { width: 20px; height: 20px; }
  .nav-label { display: none; }

  .sidebar-bottom { padding: 0.55rem; }
  .sidebar-user { justify-content: center; padding: 0.5rem; }
  .user-name { display: none; }

  .content { padding: 1.4rem; }
  .page-header { padding: 0.9rem 1.4rem; }

  .stats-cols { grid-template-columns: 1fr; }
}

/* ══════════════════════════════════════════
   MOBILE  < 768 px
══════════════════════════════════════════ */
@media (max-width: 767px) {
  .app { flex-direction: column; }

  /* Sidebar becomes bottom nav */
  .sidebar {
    width: 100%;
    height: auto;
    position: fixed;
    top: auto; bottom: 0; left: 0;
    flex-direction: row;
    border-top: 1px solid rgba(255,255,255,0.09);
    padding-bottom: env(safe-area-inset-bottom);
    overflow: visible;
    z-index: 100;
  }
  .sidebar-logo { display: none; }
  .sidebar-footer { display: none; }
  .sidebar-bottom { display: none; }

  .sidebar-nav {
    flex-direction: row;
    padding: 0;
    gap: 0;
    width: 100%;
    flex: 1;
  }
  .nav-item {
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.22rem;
    padding: 0.55rem 0.25rem;
    border-radius: 0;
    min-height: 58px;
    -webkit-tap-highlight-color: transparent;
  }
  .nav-item svg { width: 21px; height: 21px; }
  .nav-label { font-size: 0.62rem; font-weight: 500; }

  /* Main area */
  .main {
    margin-left: 0;
    padding-bottom: calc(58px + env(safe-area-inset-bottom));
  }

  /* Mobile top header */
  .mobile-topbar {
    background: var(--sb-bg);
    padding: 0.9rem 1.25rem;
    padding-top: max(0.9rem, env(safe-area-inset-top));
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: sticky;
    top: 0; z-index: 40;
  }
  .mobile-topbar svg { flex-shrink: 0; }
  .mobile-topbar .wordmark {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    color: var(--sb-text-on);
    text-transform: uppercase;
    flex: 1;
  }
  .mobile-logout {
    color: var(--sb-text);
    padding: 0.5rem;
    border-radius: 7px;
    display: flex;
    -webkit-tap-highlight-color: transparent;
    text-decoration: none;
  }
  .mobile-logout:hover { background: var(--sb-hover); }

  .page-header { padding: 0.85rem 1.1rem; gap: 0.6rem; }
  .page-header h1 { font-size: 1rem; }
  .header-meta { gap: 0.5rem; }
  .search-wrap { max-width: none; flex-basis: 100%; order: 3; }

  .content { padding: 1rem; }

  /* Cards: full width, no hover lift */
  .customer-grid { grid-template-columns: 1fr; gap: 0.75rem; }
  .card:hover { transform: none; }
  .card:active { background: var(--bg-light); }

  /* KPIs: 2 columns */
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .kpi-value { font-size: 1.4rem; }

  .stats-cols { grid-template-columns: 1fr; }

  /* Customer hero */
  .customer-hero { padding: 1.1rem; gap: 0.85rem; }
  .customer-hero .info h2 { font-size: 1.15rem; }
  .customer-hero .actions { width: 100%; }
  .customer-hero .actions .btn { flex: 1; justify-content: center; }

  /* Section head */
  .section-head { padding: 0.75rem 1rem; }

  /* Table cells: slightly smaller on mobile */
  tbody td { padding: 0.65rem 0.75rem; font-size: 0.82rem; }
  thead th { padding: 0.55rem 0.75rem; }

  /* Forms: single column */
  .form-grid { grid-template-columns: 1fr; }

  /* Modal: slide up from bottom */
  .modal-overlay { align-items: flex-end; padding: 0; backdrop-filter: none; background: rgba(0,0,0,0.45); }
  .modal {
    border-radius: 20px 20px 0 0;
    max-height: 93vh; max-height: 93dvh;
    max-width: 100%;
    animation: slideUp 0.28s cubic-bezier(0.32,0.72,0,1);
  }
  .modal-foot { border-radius: 0; }
  @keyframes slideUp {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
  }

  /* Confirm: always centered on mobile too */
  .confirm-overlay { align-items: center; padding: 1rem; }

  /* Toast: full width bottom (above nav) */
  #toast {
    bottom: calc(68px + env(safe-area-inset-bottom));
    left: 1rem; right: 1rem;
    max-width: none;
    text-align: center;
  }

  /* Login on mobile */
  .login-card { padding: 2rem 1.4rem 1.75rem; }
}

/* Hide mobile topbar on tablet+ */
@media (min-width: 768px) {
  .mobile-topbar { display: none; }
}
