*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── EClips Salon Design Tokens ── */
:root {
  --cream:        #FDF8F5;
  --warm-white:   #FFFAF8;
  --blush:        #F9EEF0;
  --blush-mid:    #F0D4DA;
  --blush-deep:   #D4919F;
  --rose:         #C07080;
  --rose-dark:    #8B4D5A;
  --sage:         #B8C9B5;
  --sage-light:   #E8F0E6;
  --text-primary: #3D2630;
  --text-secondary: #7A5560;
  --text-muted:   #A88090;
  --border:       #EDD5DB;
  --success-bg:   #E8F5E9;
  --success-text: #2E7D32;
  --danger-bg:    #FDECEA;
  --danger-text:  #C0392B;
  --warning-bg:   #FFF8E1;
  --warning-text: #856404;
  --radius:       14px;
  --radius-sm:    10px;
  --radius-pill:  999px;
  --nav-height:   64px;
  --top-height:   56px;
  --sidebar-width: 210px;
}

/* ── Base ── */
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--cream);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

/* ── Top bar (mobile) ── */
.top-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--top-height);
  background: var(--warm-white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 100;
}
.top-bar-title {
  font-family: Georgia, 'Times New Roman', serif;
  font-style: italic;
  font-size: 18px;
  font-weight: normal;
  color: var(--rose-dark);
  letter-spacing: 0.3px;
}
.top-bar-actions a,
.top-bar-actions button {
  font-size: 13px;
  color: var(--rose);
  background: var(--blush);
  border: 1px solid var(--blush-mid);
  border-radius: var(--radius-pill);
  padding: 7px 16px;
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}

/* ── Hamburger ── */
.hamburger-wrap { position: relative; }
.hamburger-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.3rem;
  cursor: pointer;
  padding: .2rem .4rem;
}
.ham-menu {
  display: none;
  flex-direction: column;
  position: absolute;
  right: 0; top: 110%;
  background: var(--warm-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 150px;
  z-index: 200;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(140,77,90,0.1);
}
.ham-menu a {
  padding: .75rem 1rem;
  text-decoration: none;
  color: var(--text-secondary);
  font-size: .9rem;
}
.ham-menu a:hover { background: var(--blush); color: var(--rose-dark); }

/* ── Main content ── */
.main-content {
  padding: 16px;
  min-height: 100vh;
}
.main-content.with-nav {
  padding-top: calc(var(--top-height) + 16px);
  padding-bottom: calc(var(--nav-height) + 24px);
}

/* iOS Safari fix — prevents overflow containers from breaking fixed nav */
@media (max-width: 767px) {
  body {
    -webkit-overflow-scrolling: auto;
  }
  .main-content {
    overflow-x: hidden;
  }
}

/* ── Bottom nav (mobile) ── */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--nav-height);
  background: var(--warm-white);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
}
.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 500;
  padding: 8px 0;
  transition: color 0.15s;
}
.nav-item svg { width: 22px; height: 22px; }
.nav-item.active { color: var(--rose); }
.nav-item--primary { color: var(--rose-dark); }
.nav-item--primary svg {
  background: var(--blush-mid);
  border-radius: 50%;
  padding: 5px;
  width: 36px;
  height: 36px;
  color: var(--rose);
}

/* ── Desktop sidebar layout ── */
@media (min-width: 768px) {
  .top-bar { display: none; }
  .bottom-nav { display: none; }
  .hamburger-wrap { display: none; }

  body { display: flex; min-height: 100vh; }

  .sidebar {
    display: flex !important;
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: var(--blush);
    border-right: 1px solid var(--border);
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
  }
  .sidebar-brand {
    padding: 24px 20px 18px;
    border-bottom: 1px solid var(--border);
  }
  .sidebar-brand-name {
    font-family: Georgia, serif;
    font-style: italic;
    font-size: 17px;
    color: var(--rose-dark);
    letter-spacing: 0.3px;
    display: block;
  }
  .sidebar-brand-sub {
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: 1px;
    margin-top: 3px;
    display: block;
  }
  .sidebar-nav {
    padding: 14px 10px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
  }
  .sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.15s;
  }
  .sidebar-link svg { width: 18px; height: 18px; flex-shrink: 0; }
  .sidebar-link:hover { background: var(--blush-mid); color: var(--rose-dark); }
  .sidebar-link.active {
    background: var(--warm-white);
    color: var(--rose-dark);
    font-weight: 500;
    box-shadow: 0 1px 3px rgba(180,100,120,0.1);
  }
  .sidebar-footer {
    padding: 12px 10px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 2px;
  }
  .main-content {
    margin-left: var(--sidebar-width);
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    flex: 1;
  }
  .main-content.with-nav {
    padding-top: 0;
    padding-bottom: 0;
  }
  .desktop-topbar {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    height: 60px;
    background: var(--warm-white);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 50;
  }
  .desktop-topbar-title {
    font-family: Georgia, serif;
    font-style: italic;
    font-size: 19px;
    color: var(--text-primary);
    font-weight: normal;
  }
  .desktop-topbar-actions { display: flex; gap: 10px; align-items: center; }
  .page-body { padding: 24px 28px; flex: 1; }
}

/* Hide sidebar and desktop topbar on mobile */
.sidebar { display: none; }
.desktop-topbar { display: none; }

/* ── Cards ── */
.card {
  background: var(--warm-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}
.card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s;
  font-family: inherit;
}
.btn:active { opacity: 0.8; }
.btn--primary { background: var(--rose); color: #fff; }
.btn--primary:hover { background: var(--rose-dark); }
.btn--secondary { background: var(--blush); color: var(--rose-dark); border: 1px solid var(--blush-mid); }
.btn--secondary:hover { background: var(--blush-mid); }
.btn--danger { background: var(--danger-bg); color: var(--danger-text); border: 1px solid #f5c6c6; }
.btn--sm { padding: 6px 14px; font-size: 12px; }
.btn--full { width: 100%; justify-content: center; }

/* ── Forms ── */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

/* Force light inputs — overrides any system dark theme */
.form-input,
input,
select,
textarea {
  width: 100% !important;
  padding: 11px 14px !important;
  border: 1.5px solid var(--border) !important;
  border-radius: var(--radius-sm) !important;
  background: var(--warm-white) !important;
  background-color: #FFFAF8 !important;
  color: var(--text-primary) !important;
  -webkit-text-fill-color: var(--text-primary) !important;
  font-size: 15px !important;
  font-family: inherit !important;
  transition: border-color 0.15s;
  -webkit-appearance: none !important;
  appearance: none !important;
  outline: none !important;
  box-shadow: none !important;
}
.form-input:focus,
input:focus,
select:focus,
textarea:focus {
  border-color: var(--rose) !important;
  background-color: #FFFAF8 !important;
}
.form-input::placeholder,
input::placeholder,
textarea::placeholder {
  color: var(--text-muted) !important;
  -webkit-text-fill-color: var(--text-muted) !important;
}
textarea.form-input,
textarea { min-height: 80px !important; resize: vertical !important; }

/* ── Flash messages ── */
.flash-messages { margin-bottom: 14px; }
.flash {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 8px;
}
.flash--success { background: var(--blush); color: var(--rose-dark); border: 1px solid var(--blush-mid); }
.flash--error   { background: var(--danger-bg);  color: var(--danger-text); }
.flash--warning { background: var(--warning-bg); color: var(--warning-text); }

/* ── List items ── */
.list-item {
  background: var(--warm-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-decoration: none;
  color: var(--text-primary);
  transition: border-color 0.15s;
}
.list-item:hover { border-color: var(--blush-deep); }
.list-item:last-child { margin-bottom: 0; }

/* ── Badges ── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.3px;
}
.badge--scheduled { background: var(--blush); color: var(--rose-dark); }
.badge--completed { background: var(--sage-light); color: #4A6B47; }
.badge--cancelled { background: #F0F0F0; color: #888; }
.badge--no-show   { background: var(--danger-bg); color: var(--danger-text); }
.badge--warning   { background: var(--warning-bg); color: var(--warning-text); }

/* ── Stats / summary cards ── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.stat-card {
  background: var(--warm-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
}
.stat-value {
  font-size: 22px;
  font-weight: 600;
  color: var(--rose-dark);
  font-family: Georgia, serif;
}
.stat-value.income { color: #3D5C3A; }
.stat-value.expense { color: var(--rose); }
.stat-label { font-size: 11px; color: var(--text-muted); margin-top: 3px; letter-spacing: 0.5px; }

/* ── Section header ── */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
}

/* ── Search ── */
.search-input {
  width: 100%;
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--border);
  background: var(--warm-white) !important;
  background-color: #FFFAF8 !important;
  color: var(--text-primary) !important;
  -webkit-text-fill-color: var(--text-primary) !important;
  font-size: 14px;
  margin-bottom: 14px;
  -webkit-appearance: none;
  appearance: none;
  outline: none;
}
.search-input:focus { border-color: var(--rose); }

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}
.empty-state p { margin-top: 8px; font-size: 14px; }

/* ── Inventory / stock ── */
.stock-low { color: var(--danger-text); font-weight: 600; }
.stock-ok  { color: var(--text-secondary); }

/* ── Avatar initials ── */
.avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--blush-mid);
  color: var(--rose-dark);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
  flex-shrink: 0;
}

/* ── Service chips ── */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  border: 1.5px solid var(--border);
  background: var(--warm-white);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}
.chip.selected,
.chip:hover { background: var(--blush); border-color: var(--rose); color: var(--rose-dark); }

/* ── Two column form row ── */
.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ── Page title ── */
.page-title {
  font-family: Georgia, serif;
  font-style: italic;
  font-size: 20px;
  color: var(--text-primary);
  font-weight: normal;
  margin-bottom: 20px;
}
/* ── iOS Safari fixed nav fix ── */
@supports (-webkit-touch-callout: none) {
  .bottom-nav {
    padding-bottom: max(env(safe-area-inset-bottom), 8px);
  }
  .main-content.with-nav {
    padding-bottom: calc(var(--nav-height) + max(env(safe-area-inset-bottom), 8px) + 16px);
  }
}
/* ── Mobile sticky sub-headers ── */
@media (max-width: 767px) {
  .cal-sticky-header {
    position: sticky;
    top: var(--top-height);
    z-index: 40;
    background: var(--cream);
  }
}
/* ── Mobile sticky sub-headers ── */
@media (max-width: 767px) {
  :root {
    --top-height: 72px;
  }
  .top-bar {
    height: var(--top-height);
    padding: 8px 16px;
  }
  .top-bar-title {
    font-size: 16px;
    line-height: 1.2;
  }
  .cal-sticky-header {
    position: sticky;
    top: var(--top-height);
    z-index: 40;
    background: var(--cream);
  }
}