/* ============================================================
   ServicePro — Design System
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ── Variables ── */
:root {
  --ink:         #0A0A0B;
  --ink-2:       #3F3F46;
  --ink-3:       #71717A;
  --ink-4:       #A1A1AA;
  --surface:     #FFFFFF;
  --surface-2:   #FAFAFA;
  --surface-3:   #F4F4F5;
  --border:      #E4E4E7;
  --border-2:    #D4D4D8;

  --violet:      #7C3AED;
  --violet-dark: #6D28D9;
  --violet-bg:   #F5F3FF;
  --violet-mid:  #DDD6FE;

  --emerald:     #059669;
  --emerald-bg:  #ECFDF5;
  --rose:        #E11D48;
  --rose-bg:     #FFF1F2;
  --amber:       #D97706;
  --amber-bg:    #FFFBEB;
  --sky:         #0284C7;

  --sidebar-bg:  #18181B;
  --sidebar-h:   #27272A;
  --sidebar-a:   #3F3F46;

  --r:    6px;
  --r-md: 10px;
  --r-lg: 14px;

  /* Legacy aliases kept for PHP files that use them */
  --text:          var(--ink);
  --muted:         var(--ink-3);
  --border-color:  var(--border);
  --primary:       var(--violet);
  --primary-dark:  var(--violet-dark);
  --primary-light: var(--violet-bg);
  --primary-mid:   var(--violet-mid);
  --success:       var(--emerald);
  --danger:        var(--rose);
  --warning:       var(--amber);
  --bg:            var(--surface-2);
  --radius-sm:     var(--r);
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--surface-2);
  color: var(--ink-2);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--violet); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { color: var(--ink); font-weight: 700; line-height: 1.3; }

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: 240px;
  height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  z-index: 300;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 20px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.sidebar-logo a {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.sidebar-logo-icon {
  width: 32px;
  height: 32px;
  background: var(--violet);
  border-radius: var(--r);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: .85rem;
  font-weight: 800;
  flex-shrink: 0;
  letter-spacing: -1px;
}

.sidebar-logo-name {
  font-size: .95rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -.3px;
}

.sidebar-logo-name span {
  color: var(--violet-mid);
}

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

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--r);
  font-size: .875rem;
  font-weight: 500;
  color: var(--ink-4);
  text-decoration: none;
  transition: background .15s, color .15s;
}

.sidebar-nav a:hover {
  background: var(--sidebar-h);
  color: #e4e4e7;
  text-decoration: none;
}

.sidebar-nav a.active {
  background: var(--violet);
  color: #fff;
}

.sidebar-nav a .nav-icon {
  width: 20px;
  text-align: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 12px 8px;
  border-top: 1px solid rgba(255,255,255,.06);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
}

.sidebar-avatar {
  width: 32px;
  height: 32px;
  background: var(--violet);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-username {
  font-size: .82rem;
  font-weight: 600;
  color: #d4d4d8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-logout {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--r);
  font-size: .82rem;
  font-weight: 600;
  color: #fca5a5;
  background: rgba(239,68,68,.08);
  text-decoration: none;
  transition: background .15s;
}

.btn-logout:hover {
  background: rgba(239,68,68,.18);
  color: #fca5a5;
  text-decoration: none;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
  margin-left: 240px;
  min-height: 100vh;
}

.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px 60px;
}

.page-sm {
  max-width: 640px;
  margin: 0 auto;
  padding: 32px 24px 60px;
}

/* ============================================================
   TOP BAR (mobile only)
   ============================================================ */
.top-bar {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 300;
}

.top-bar-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
}

.top-bar-brand-icon {
  width: 28px;
  height: 28px;
  background: var(--violet);
  border-radius: var(--r);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  font-weight: 800;
  color: #fff;
}

.top-bar-brand-name {
  font-size: .9rem;
  font-weight: 800;
  color: var(--ink);
}

.top-bar-brand-name span { color: var(--violet); }

.hamburger {
  width: 36px;
  height: 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: all .2s;
}

/* ── Mobile overlay ── */
.mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 400;
  opacity: 0;
  transition: opacity .25s;
}

.mobile-overlay.open {
  display: block;
  opacity: 1;
}

.mobile-menu {
  position: absolute;
  top: 0; left: 0;
  width: 260px;
  height: 100%;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform .25s;
  overflow-y: auto;
}

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

.mobile-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.mobile-menu-logo {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
}

.mobile-menu-logo-icon {
  width: 28px;
  height: 28px;
  background: var(--violet);
  border-radius: var(--r);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  color: #fff;
  font-weight: 800;
}

.mobile-menu-logo-name {
  font-size: .9rem;
  font-weight: 800;
  color: #fff;
}

.mobile-menu-close {
  background: none;
  border: none;
  color: var(--ink-4);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

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

.mobile-menu-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r);
  font-size: .875rem;
  font-weight: 500;
  color: var(--ink-4);
  text-decoration: none;
  transition: background .15s, color .15s;
}

.mobile-menu-nav a:hover {
  background: var(--sidebar-h);
  color: #e4e4e7;
  text-decoration: none;
}

.mobile-menu-nav a.active {
  background: var(--violet);
  color: #fff;
  text-decoration: none;
}

.mobile-menu-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,.06);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mobile-menu-user {
  font-size: .8rem;
  color: var(--ink-4);
}

/* ── Bottom nav ── */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 56px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 300;
  justify-content: space-around;
  overflow-x: auto;
}

.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 8px;
  font-size: .62rem;
  font-weight: 600;
  color: var(--ink-3);
  text-decoration: none;
  white-space: nowrap;
  flex: 1;
  min-width: 48px;
  height: 100%;
  transition: color .15s;
}

.bottom-nav a .bn-icon {
  font-size: 1.1rem;
  display: block;
}

.bottom-nav a.active,
.bottom-nav a:hover {
  color: var(--violet);
  text-decoration: none;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 20px;
  margin-bottom: 16px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-title {
  font-size: .95rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -.2px;
  margin-bottom: 16px;
}

/* ============================================================
   KPI / STAT CARDS
   ============================================================ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 18px 20px;
}

.kpi-card .kpi-label {
  font-size: .72rem;
  font-weight: 600;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 8px;
}

.kpi-card .kpi-num {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -.5px;
  line-height: 1;
  margin-bottom: 6px;
}

.kpi-card .kpi-sub {
  font-size: .775rem;
  color: var(--ink-3);
}

/* Legacy stat-card styles */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 16px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--violet);
  border-radius: var(--r-md);
  padding: 16px 18px;
}

.stat-card .num {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -.5px;
  line-height: 1;
  margin-bottom: 4px;
}

.stat-card .lbl {
  font-size: .775rem;
  font-weight: 600;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: .4px;
}

.stat-card .sub {
  font-size: .72rem;
  color: var(--ink-4);
  margin-top: 4px;
}

/* ============================================================
   FORMS
   ============================================================ */
.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 6px;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
select,
textarea {
  width: 100%;
  padding: 9px 12px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--r);
  font-family: inherit;
  font-size: .875rem;
  color: var(--ink);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  appearance: none;
  -webkit-appearance: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--violet);
  box-shadow: 0 0 0 3px rgba(124,58,237,.12);
  background: var(--surface);
}

input::placeholder,
textarea::placeholder { color: var(--ink-4); }

textarea {
  resize: vertical;
  min-height: 80px;
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2371717A' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--r);
  font-family: inherit;
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: background .15s, border-color .15s, color .15s;
  white-space: nowrap;
  line-height: 1.4;
}

.btn:hover { text-decoration: none; }

.btn-violet,
.btn-primary {
  background: var(--violet);
  color: #fff;
  border-color: var(--violet);
}

.btn-violet:hover,
.btn-primary:hover {
  background: var(--violet-dark);
  border-color: var(--violet-dark);
  color: #fff;
}

.btn-ghost,
.btn-outline {
  background: var(--surface);
  color: var(--ink-2);
  border-color: var(--border-2);
}

.btn-ghost:hover,
.btn-outline:hover {
  background: var(--surface-3);
  color: var(--ink);
  border-color: var(--border-2);
}

.btn-danger {
  background: var(--rose);
  color: #fff;
  border-color: var(--rose);
}

.btn-danger:hover {
  background: #be123c;
  border-color: #be123c;
  color: #fff;
}

.btn-sm { padding: 6px 12px; font-size: .8rem; }
.btn-lg { padding: 11px 22px; font-size: 1rem; }
.btn-full,
.btn-block { width: 100%; }

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
  padding: 10px 14px;
  border-radius: var(--r);
  font-size: .875rem;
  font-weight: 500;
  margin-bottom: 14px;
  line-height: 1.5;
}

.alert-success {
  background: var(--emerald-bg);
  color: #065f46;
  border: 1px solid #6ee7b7;
}

.alert-error {
  background: var(--rose-bg);
  color: #9f1239;
  border: 1px solid #fda4af;
}

.alert-info {
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

.alert-warning {
  background: var(--amber-bg);
  color: #92400e;
  border: 1px solid #fde68a;
}

/* ============================================================
   TABLES
   ============================================================ */
.tbl-wrap,
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}

thead th {
  text-align: left;
  font-size: .72rem;
  font-weight: 700;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--surface-3); }

tbody td {
  padding: 10px 12px;
  vertical-align: middle;
}

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 600;
  border: 1px solid transparent;
}

.badge-violet {
  background: var(--violet-bg);
  color: var(--violet);
  border-color: var(--violet-mid);
}

.badge-green,
.badge-success {
  background: var(--emerald-bg);
  color: var(--emerald);
  border-color: #6ee7b7;
}

.badge-red,
.badge-danger {
  background: var(--rose-bg);
  color: var(--rose);
  border-color: #fda4af;
}

.badge-yellow,
.badge-warning {
  background: var(--amber-bg);
  color: var(--amber);
  border-color: #fde68a;
}

.badge-agency {
  background: var(--violet-bg);
  color: var(--violet);
  border-color: var(--violet-mid);
}

.badge-serviceman {
  background: var(--emerald-bg);
  color: var(--emerald);
  border-color: #6ee7b7;
}

.badge-assigned {
  background: #eff6ff;
  color: var(--sky);
  border-color: #bfdbfe;
}

/* ============================================================
   AUTH PAGES
   ============================================================ */
.auth-screen,
.auth-wrap {
  min-height: 100vh;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.auth-card,
.auth-box {
  width: 100%;
  max-width: 420px;
}

.auth-logo {
  text-align: center;
  margin-bottom: 24px;
}

.auth-logo .icon {
  width: 52px;
  height: 52px;
  background: var(--violet);
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  margin: 0 auto 12px;
  color: #fff;
}

.auth-logo h1 {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -.4px;
  margin-bottom: 4px;
}

.auth-logo p {
  font-size: .875rem;
  color: var(--ink-3);
}

.auth-switch {
  text-align: center;
  font-size: .875rem;
  color: var(--ink-3);
  margin-top: 14px;
}

.auth-switch a {
  color: var(--violet);
  font-weight: 600;
  text-decoration: none;
}

/* ============================================================
   LANDING PAGE
   ============================================================ */
.hero {
  background: var(--sidebar-bg);
  color: #fff;
  text-align: center;
  padding: 80px 24px;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  color: #fff;
  letter-spacing: -.8px;
  line-height: 1.15;
  margin-bottom: 18px;
}

.hero h1 span { color: var(--violet-mid); }

.hero > p {
  font-size: 1.05rem;
  color: #a1a1aa;
  max-width: 560px;
  margin: 0 auto 32px;
  line-height: 1.7;
}

.hero-btns {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 48px;
}

.hero-btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: var(--violet);
  color: #fff;
  border-radius: var(--r);
  font-size: .95rem;
  font-weight: 700;
  text-decoration: none;
  transition: background .15s;
}

.hero-btn-primary:hover {
  background: var(--violet-dark);
  color: #fff;
  text-decoration: none;
}

.hero-btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: transparent;
  color: #e4e4e7;
  border: 1.5px solid #3f3f46;
  border-radius: var(--r);
  font-size: .95rem;
  font-weight: 600;
  text-decoration: none;
  transition: border-color .15s, color .15s;
}

.hero-btn-outline:hover {
  border-color: #71717a;
  color: #fff;
  text-decoration: none;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 40px;
  flex-wrap: wrap;
  border-top: 1px solid rgba(255,255,255,.06);
  padding-top: 32px;
}

.hero-stat .num {
  font-size: 1.8rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -.5px;
}

.hero-stat .lbl {
  font-size: .8rem;
  color: #71717a;
  font-weight: 500;
  margin-top: 2px;
}

.section { padding: 72px 24px; }

.section-center {
  max-width: 1000px;
  margin: 0 auto;
  text-align: center;
}

.section-tag {
  display: inline-block;
  padding: 3px 12px;
  background: var(--violet-bg);
  color: var(--violet);
  border: 1px solid var(--violet-mid);
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 16px;
}

.section-title-lg {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -.5px;
  margin-bottom: 12px;
}

.section-sub {
  font-size: 1rem;
  color: var(--ink-3);
  max-width: 520px;
  margin: 0 auto 40px;
  line-height: 1.7;
}

.feat-grid,
.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  text-align: left;
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 22px 20px;
  transition: border-color .15s;
}

.feature-card:hover { border-color: var(--violet-mid); }

.feature-icon { font-size: 1.6rem; margin-bottom: 12px; }

.feature-title {
  font-size: .95rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 8px;
}

.feature-desc {
  font-size: .85rem;
  color: var(--ink-3);
  line-height: 1.6;
}

.step-grid,
.how-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  text-align: center;
}

.step-num {
  width: 44px;
  height: 44px;
  background: var(--violet);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 800;
  margin: 0 auto 14px;
}

.step-title {
  font-size: .95rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 8px;
}

.step-desc {
  font-size: .85rem;
  color: var(--ink-3);
  line-height: 1.6;
}

.roles-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  text-align: left;
  margin-top: 40px;
}

.role-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 28px 24px;
}

.role-card.agency  { border-top: 3px solid var(--violet); }
.role-card.serviceman { border-top: 3px solid var(--emerald); }

.role-emoji { font-size: 2rem; margin-bottom: 12px; }

.role-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 16px;
}

.role-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.role-list li {
  font-size: .875rem;
  color: var(--ink-2);
  padding-left: 20px;
  position: relative;
}

.role-list li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--emerald);
  font-weight: 700;
}

.cta-section {
  background: var(--sidebar-bg);
  text-align: center;
  padding: 72px 24px;
}

.cta-section h2 {
  font-size: 2rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 12px;
}

.cta-section p {
  font-size: 1rem;
  color: #a1a1aa;
  margin-bottom: 28px;
}

.cta-btns {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

footer {
  background: #09090b;
  text-align: center;
  padding: 24px;
  font-size: .85rem;
  color: #71717a;
}

footer a { color: #a1a1aa; text-decoration: none; }
footer a:hover { color: #fff; }

/* ============================================================
   CALENDAR
   ============================================================ */
.cal-head,
.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.cal-title {
  font-size: .95rem;
  font-weight: 700;
  color: var(--ink);
}

.cal-nav {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--r);
  color: var(--ink-3);
  font-size: 1.2rem;
  text-decoration: none;
  transition: background .15s, color .15s;
}

.cal-nav:hover {
  background: var(--surface-3);
  color: var(--ink);
  text-decoration: none;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}

.cal-dow {
  text-align: center;
  font-size: .7rem;
  font-weight: 700;
  color: var(--ink-3);
  padding: 4px 0 8px;
  text-transform: uppercase;
  letter-spacing: .3px;
}

.cal-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  font-weight: 500;
  color: var(--ink-2);
  border-radius: var(--r);
  position: relative;
  gap: 1px;
}

.cal-day.today {
  border: 2px solid var(--violet);
  color: var(--violet);
  font-weight: 700;
}

.cal-day.has-service,
.cal-day.has-data {
  background: var(--violet);
  color: #fff;
  font-weight: 700;
}

.cal-day.has-service.today,
.cal-day.has-data.today {
  background: var(--violet-dark);
  border-color: var(--violet-dark);
}

.cal-count {
  font-size: .62rem;
  font-weight: 700;
  opacity: .85;
}

/* ============================================================
   SERVICE COUNT WIDGET
   ============================================================ */
.qty-wrap,
.count-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.qty-btn,
.count-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--r);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  transition: background .15s;
  flex-shrink: 0;
}

.qty-btn:hover,
.count-btn:hover {
  background: var(--violet-bg);
  border-color: var(--violet-mid);
  color: var(--violet);
}

.qty-input,
.count-input-wrap input[type="number"] {
  text-align: center;
  font-weight: 700;
  font-size: 1rem;
  width: 70px;
  flex-shrink: 0;
}

/* ============================================================
   SUMMARY PILLS
   ============================================================ */
.pill-row,
.summary-row {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.pill,
.sum-pill {
  flex: 1;
  min-width: 90px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 16px;
  text-align: center;
}

.pill .num,
.sum-pill .num {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -.3px;
  line-height: 1;
  margin-bottom: 4px;
}

.pill .lbl,
.sum-pill .lbl {
  font-size: .72rem;
  font-weight: 600;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: .4px;
}

/* ============================================================
   ENTRY ROWS
   ============================================================ */
.entry-row,
.entry-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.entry-row:last-child,
.entry-card:last-child { border-bottom: none; }

.entry-count-bubble {
  width: 36px;
  height: 36px;
  background: var(--violet-bg);
  border: 1.5px solid var(--violet-mid);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .85rem;
  font-weight: 800;
  color: var(--violet);
  flex-shrink: 0;
}

.entry-info { flex: 1; min-width: 0; overflow: hidden; }
.entry-name {
  font-size: .9rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.entry-meta {
  font-size: .78rem;
  color: var(--ink-3);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  row-gap: 3px;
}
.entry-meta .sep { color: var(--border-2); }
.entry-meta .entry-date { white-space: nowrap; }
.entry-meta .entry-time { white-space: nowrap; }

/* ============================================================
   DRAG ORDER LIST
   ============================================================ */
.order-list {
  list-style: none;
  display: flex;
  flex-direction: column;
}

.order-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  cursor: grab;
  background: var(--surface);
}

.order-item:last-child { border-bottom: none; }
.order-item:hover { background: var(--surface-3); }
.order-item.dragging { opacity: .5; }
.order-item.drag-over { background: var(--violet-bg); }

.order-handle,
.drag-handle {
  color: var(--ink-4);
  font-size: 1.1rem;
  cursor: grab;
  padding: 0 4px;
  flex-shrink: 0;
  user-select: none;
}

.order-num {
  width: 24px;
  font-size: .8rem;
  font-weight: 700;
  color: var(--ink-3);
  text-align: center;
  flex-shrink: 0;
}

.order-info { flex: 1; min-width: 0; }
.order-name { font-size: .9rem; font-weight: 700; color: var(--ink); }
.order-phone { font-size: .8rem; color: var(--ink-3); margin-top: 2px; }

.move-btns { display: flex; gap: 4px; flex-shrink: 0; }

.move-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--r);
  font-size: .85rem;
  cursor: pointer;
  color: var(--ink-2);
  transition: background .1s;
}

.move-btn:hover:not([disabled]) {
  background: var(--violet-bg);
  border-color: var(--violet-mid);
  color: var(--violet);
}

.move-btn[disabled] { opacity: .3; cursor: default; }

/* Save bar */
.save-bar {
  position: fixed;
  bottom: calc(var(--bottom-nav-h, 64px) + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--violet);
  color: #fff;
  border: none;
  border-radius: var(--r-md);
  padding: 12px 28px;
  font-family: inherit;
  font-size: .9rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(124,58,237,.35);
  transition: transform .25s, background .15s;
  z-index: 100;
}

.save-bar.visible { transform: translateX(-50%) translateY(0); }
.save-bar:hover { background: var(--violet-dark); }

@media (min-width: 769px) {
  .save-bar { bottom: 28px; }
}

.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--emerald);
  color: #fff;
  padding: 10px 22px;
  border-radius: var(--r);
  font-size: .875rem;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
  z-index: 100;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============================================================
   BILLING
   ============================================================ */
.bill-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.bill-row:last-child { border-bottom: none; }

.bill-avatar {
  width: 36px;
  height: 36px;
  background: var(--violet-bg);
  border: 1.5px solid var(--violet-mid);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .85rem;
  font-weight: 800;
  color: var(--violet);
  flex-shrink: 0;
}

.bill-info { flex: 1; min-width: 0; }
.bill-name { font-size: .9rem; font-weight: 700; color: var(--ink); }
.bill-phone { font-size: .78rem; color: var(--ink-3); margin-top: 2px; }

.bill-amounts { text-align: right; flex-shrink: 0; }
.amount-pending { font-size: .85rem; font-weight: 700; color: var(--rose); }
.amount-paid { font-size: .75rem; color: var(--emerald); margin-top: 2px; }
.amount-zero { font-size: .85rem; font-weight: 700; color: var(--emerald); }

.pay-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.pay-item:last-child { border-bottom: none; }

.pay-icon {
  width: 36px;
  height: 36px;
  background: var(--emerald-bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .9rem;
  font-weight: 700;
  color: var(--emerald);
  flex-shrink: 0;
}

.pay-info { flex: 1; }
.pay-amount { font-size: .95rem; font-weight: 700; color: var(--ink); }
.pay-meta { font-size: .78rem; color: var(--ink-3); margin-top: 3px; }

/* ============================================================
   CUSTOMER ROWS (assign-customers)
   ============================================================ */
.cust-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.cust-row:last-child { border-bottom: none; }

.cust-avatar {
  width: 36px;
  height: 36px;
  background: var(--violet-bg);
  border: 1.5px solid var(--violet-mid);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .85rem;
  font-weight: 800;
  color: var(--violet);
  flex-shrink: 0;
}

.cust-meta { flex: 1; min-width: 0; }
.cust-name { font-size: .9rem; font-weight: 700; color: var(--ink); }
.cust-phone { font-size: .78rem; color: var(--ink-3); margin-top: 2px; }

.assigned-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.assigned-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  background: var(--violet-bg);
  border: 1px solid var(--violet-mid);
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  color: var(--violet);
}

.assigned-badge button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink-3);
  font-size: .8rem;
  padding: 0;
  line-height: 1;
  display: flex;
  align-items: center;
}
.assigned-badge button:hover { color: var(--rose); }

.assign-form {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.assign-form select {
  flex: 1;
  min-width: 160px;
  padding: 6px 10px;
  font-size: .8rem;
}

/* Serviceman tabs */
.sm-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.sm-tab {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: .82rem;
  font-weight: 600;
  color: var(--ink-3);
  border: 1.5px solid var(--border);
  background: var(--surface);
  text-decoration: none;
  transition: all .15s;
}

.sm-tab:hover { border-color: var(--border-2); color: var(--ink); text-decoration: none; }
.sm-tab.active { background: var(--violet); color: #fff; border-color: var(--violet); }

/* History items (my-services.php) */
.hist-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.hist-item:last-child { border-bottom: none; }

.hist-bubble {
  width: 36px;
  height: 36px;
  background: var(--violet-bg);
  border: 1.5px solid var(--violet-mid);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .85rem;
  font-weight: 800;
  color: var(--violet);
  flex-shrink: 0;
}

.hist-date { font-size: .875rem; font-weight: 600; color: var(--ink); }
.hist-time { font-size: .78rem; color: var(--ink-3); margin-left: 8px; }
.hist-note { font-size: .78rem; color: var(--ink-3); margin-top: 3px; }

/* Today badge */
.today-badge {
  display: inline-block;
  padding: 5px 14px;
  background: var(--violet-bg);
  border: 1.5px solid var(--violet-mid);
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 700;
  color: var(--violet);
}

/* ============================================================
   UTILITIES
   ============================================================ */
.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

.text-muted { color: var(--ink-3); }
.text-center { text-align: center; }

.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-5 { margin-top: 20px; }

/* ============================================================
   SERVICE ENTRY TABS (mobile only)
   ============================================================ */
.se-tabs {
  display: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 4px;
  gap: 4px;
  margin-bottom: 14px;
}
.se-tab {
  flex: 1;
  padding: 10px 12px;
  border: none;
  border-radius: var(--r);
  background: transparent;
  font-family: inherit;
  font-size: .875rem;
  font-weight: 600;
  color: var(--ink-3);
  cursor: pointer;
  transition: background .15s, color .15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.se-tab.active {
  background: var(--violet);
  color: #fff;
}
.se-count {
  background: rgba(255,255,255,.25);
  border-radius: 20px;
  padding: 1px 7px;
  font-size: .72rem;
  font-weight: 700;
}
.se-tab:not(.active) .se-count {
  background: var(--surface-3);
  color: var(--ink-3);
}

/* On desktop: always show both panels */
.se-panel { display: block; }

/* ============================================================
   SPLIT LAYOUT HELPER  (2-col → 1-col on mobile)
   ============================================================ */
.split-2 {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
  align-items: start;
}
.split-entry {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 20px;
  align-items: start;
}
.split-half {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.split-half-sm {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.billing-split {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
  align-items: start;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .sidebar { display: none; }

  .main-content {
    margin-left: 0;
    padding-top: 56px;
    padding-bottom: 80px;
  }

  .top-bar { display: flex; }
  .bottom-nav { display: flex; }

  .page { padding: 16px 14px 40px; }

  /* Service entry tabs on mobile */
  .se-tabs { display: flex; }
  .se-panel { display: none; }
  .se-panel.se-active { display: block; }

  /* All two-column layouts collapse to single column */
  .split-2,
  .split-entry,
  .billing-split { grid-template-columns: 1fr; }

  /* Sticky form loses sticky on mobile */
  .split-2 > *:last-child,
  .split-entry > *:last-child,
  .billing-split > *:last-child { position: static !important; }

  /* Half-col stays 2-col on mobile (date+time etc.) */
  .split-half    { grid-template-columns: 1fr 1fr; }
  .split-half-sm { grid-template-columns: 1fr 1fr; }

  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .stats    { grid-template-columns: repeat(2, 1fr); }

  .feat-grid,
  .features-grid { grid-template-columns: 1fr; }

  .step-grid,
  .how-grid { grid-template-columns: 1fr; }

  .roles-grid { grid-template-columns: 1fr; }

  .hero    { padding: 48px 16px; }
  .section { padding: 40px 16px; }

  /* Tables scroll */
  .tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tbl-wrap table { min-width: 520px; }

  /* Cards */
  .card { padding: 16px 14px; }
}

@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .stats    { grid-template-columns: 1fr 1fr; }
  .hero-stats { gap: 20px; }
  .pill-row, .summary-row { gap: 8px; }
  .split-half,
  .split-half-sm { grid-template-columns: 1fr 1fr; }
}
