/* ========================================
   Salon Reservation System
   "Luxe Spa" Design System
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@300;400;500;600;700;800&family=Inter:wght@300;400;500;600;700;800&display=swap');
@import url('https://fonts.googleapis.com/icon?family=Material+Icons+Round');

:root {
  /* Luxe Spa Color Tokens */
  --primary: #8B6F5C;
  --primary-dark: #6D5548;
  --primary-light: #C4A882;
  --primary-container: #F5EDE4;
  --on-primary: #FFFFFF;
  --on-primary-container: #3E2E23;

  --accent: #C9956B;
  --accent-dark: #A87A53;
  --accent-container: #FFF0E1;
  --on-accent: #FFFFFF;
  --on-accent-container: #5C3A1A;

  --surface: #FDFAF7;
  --surface-dim: #F5F0EB;
  --surface-container: #F0EAE3;
  --surface-container-low: #F7F3EE;
  --surface-container-high: #EAE3DB;
  --surface-bright: #FFFFFF;

  --on-surface: #2C2420;
  --on-surface-variant: #7D6E63;
  --outline: #BEB0A4;
  --outline-variant: #DDD3C8;

  --success: #5D8C61;
  --success-container: #E8F2E9;
  --on-success: #FFFFFF;
  --warning: #D4A053;
  --warning-container: #FFF4E0;
  --error: #C25B56;
  --error-container: #FCE8E7;
  --on-error: #FFFFFF;
  --info: #6B8CAE;
  --info-container: #E4EDF5;

  --sidebar-bg: #2C2420;
  --sidebar-text: #E8DDD3;
  --sidebar-active: rgba(201,149,107,0.2);
  --sidebar-active-text: #C9956B;
  --sidebar-hover: rgba(232,221,211,0.08);

  /* Elevation - Warm Brown Shadows */
  --elevation-1: 0 1px 3px rgba(44,36,32,0.08), 0 1px 2px rgba(44,36,32,0.06);
  --elevation-2: 0 4px 6px rgba(44,36,32,0.07), 0 2px 4px rgba(44,36,32,0.06);
  --elevation-3: 0 10px 15px rgba(44,36,32,0.08), 0 4px 6px rgba(44,36,32,0.05);
  --elevation-4: 0 20px 25px rgba(44,36,32,0.08), 0 10px 10px rgba(44,36,32,0.04);

  /* Shape */
  --shape-xs: 6px;
  --shape-sm: 10px;
  --shape-md: 16px;
  --shape-lg: 20px;
  --shape-xl: 28px;
  --shape-full: 9999px;

  /* Typography */
  --display-large: 800 57px/64px 'Inter', 'Noto Sans JP', sans-serif;
  --display-medium: 700 45px/52px 'Inter', 'Noto Sans JP', sans-serif;
  --display-small: 700 36px/44px 'Inter', 'Noto Sans JP', sans-serif;
  --headline-large: 700 32px/40px 'Inter', 'Noto Sans JP', sans-serif;
  --headline-medium: 600 28px/36px 'Inter', 'Noto Sans JP', sans-serif;
  --headline-small: 600 24px/32px 'Inter', 'Noto Sans JP', sans-serif;
  --title-large: 600 22px/28px 'Inter', 'Noto Sans JP', sans-serif;
  --title-medium: 600 16px/24px 'Inter', 'Noto Sans JP', sans-serif;
  --title-small: 500 14px/20px 'Inter', 'Noto Sans JP', sans-serif;
  --body-large: 400 16px/24px 'Noto Sans JP', 'Inter', sans-serif;
  --body-medium: 400 14px/20px 'Noto Sans JP', 'Inter', sans-serif;
  --body-small: 400 12px/16px 'Noto Sans JP', 'Inter', sans-serif;
  --label-large: 500 14px/20px 'Inter', 'Noto Sans JP', sans-serif;
  --label-medium: 500 12px/16px 'Inter', 'Noto Sans JP', sans-serif;
  --label-small: 500 11px/16px 'Inter', 'Noto Sans JP', sans-serif;

  /* Motion */
  --motion-standard: cubic-bezier(0.2, 0, 0, 1);
  --motion-emphasized: cubic-bezier(0.2, 0, 0, 1);
  --motion-duration-short: 200ms;
  --motion-duration-medium: 400ms;
}

/* ---- Reset ---- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font: var(--body-large);
  color: var(--on-surface);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--motion-duration-short) var(--motion-standard);
}
a:hover { color: var(--accent); }

.material-icons-round { vertical-align: middle; }

/* ---- Selection ---- */
::selection {
  background: var(--primary-container);
  color: var(--on-primary-container);
}

/* ========== Buttons ========== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: var(--label-large); letter-spacing: 0.3px;
  border: none; cursor: pointer; border-radius: var(--shape-full);
  padding: 10px 28px; min-height: 40px;
  transition: all var(--motion-duration-short) var(--motion-standard);
  position: relative; overflow: hidden;
  text-decoration: none;
}
.btn::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  background: currentColor; opacity: 0; transition: opacity var(--motion-duration-short);
}
.btn:hover::after { opacity: 0.08; }
.btn:active::after { opacity: 0.14; }
.btn:active { transform: scale(0.97); }
.btn .material-icons-round { font-size: 18px; }

/* Filled */
.btn-filled {
  background: var(--primary); color: var(--on-primary);
  box-shadow: var(--elevation-1);
}
.btn-filled:hover { box-shadow: var(--elevation-2); background: var(--primary-dark); }

/* Filled Tonal */
.btn-tonal {
  background: var(--primary-container); color: var(--on-primary-container);
}
.btn-tonal:hover { background: #EDE2D6; }

/* Outlined */
.btn-outlined {
  background: transparent; color: var(--primary);
  border: 1.5px solid var(--outline);
}
.btn-outlined:hover { border-color: var(--primary); background: rgba(139,111,92,0.04); }

/* Text */
.btn-text {
  background: transparent; color: var(--primary); padding: 10px 16px;
}
.btn-text:hover { background: rgba(139,111,92,0.06); }

/* Elevated */
.btn-elevated {
  background: var(--surface-bright); color: var(--primary);
  box-shadow: var(--elevation-1);
}
.btn-elevated:hover { box-shadow: var(--elevation-2); }

/* Danger */
.btn-danger {
  background: var(--error); color: var(--on-error);
  box-shadow: var(--elevation-1);
}
.btn-danger:hover { background: #B34E49; box-shadow: var(--elevation-2); }

/* Success */
.btn-success {
  background: var(--success); color: var(--on-success);
  box-shadow: var(--elevation-1);
}
.btn-success:hover { background: #4E7A52; box-shadow: var(--elevation-2); }

.btn-sm { padding: 6px 18px; min-height: 32px; font: var(--label-medium); }
.btn-lg { padding: 14px 36px; min-height: 48px; font: var(--label-large); font-size: 16px; }
.btn-block { width: 100%; }
.btn-icon-only { width: 40px; height: 40px; padding: 0; border-radius: 50%; }
.btn:disabled, .btn[disabled] {
  opacity: 0.45; cursor: not-allowed; pointer-events: none;
}

/* ========== FAB ========== */
.fab {
  position: fixed; bottom: 24px; right: 24px; z-index: 100;
  width: 56px; height: 56px; border-radius: var(--shape-md); border: none;
  background: var(--accent); color: var(--on-accent);
  box-shadow: var(--elevation-3); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--motion-duration-short) var(--motion-standard);
}
.fab:hover { box-shadow: var(--elevation-4); background: var(--accent-dark); transform: translateY(-2px); }
.fab .material-icons-round { font-size: 24px; }

/* ========== Cards ========== */
.card {
  background: var(--surface-bright); border-radius: var(--shape-md);
  box-shadow: var(--elevation-1); padding: 24px;
  transition: all var(--motion-duration-short) var(--motion-standard);
}
.card:hover { box-shadow: var(--elevation-2); transform: translateY(-1px); }
.card-elevated {
  background: var(--surface-bright); box-shadow: var(--elevation-2);
  border-radius: var(--shape-md); padding: 24px;
}
.card-filled {
  background: var(--surface-container); box-shadow: none;
  border-radius: var(--shape-md); padding: 24px;
}
.card-outlined {
  background: var(--surface-bright); box-shadow: none;
  border: 1px solid var(--outline-variant);
  border-radius: var(--shape-md); padding: 24px;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px;
}
.card-title { font: var(--title-medium); color: var(--on-surface); }
.card-subtitle { font: var(--body-small); color: var(--on-surface-variant); margin-top: 2px; }

/* ========== Chips ========== */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 16px; border-radius: var(--shape-full); height: 32px;
  font: var(--label-large); border: 1px solid var(--outline);
  background: transparent; color: var(--on-surface); cursor: pointer;
  transition: all var(--motion-duration-short) var(--motion-standard);
}
.chip:hover { background: rgba(139,111,92,0.08); border-color: var(--primary-light); }
.chip.active {
  background: var(--primary-container); color: var(--on-primary-container);
  border-color: var(--primary-light);
}
.chip .material-icons-round { font-size: 18px; }

/* ========== Badges ========== */
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 12px;
  border-radius: var(--shape-full); font: var(--label-small); letter-spacing: 0.3px;
  font-weight: 600;
}
.badge-primary { background: var(--primary-container); color: var(--on-primary-container); }
.badge-secondary { background: var(--accent-container); color: var(--on-accent-container); }
.badge-success { background: var(--success-container); color: #2D5A30; }
.badge-warning { background: var(--warning-container); color: #7C5B1E; }
.badge-error { background: var(--error-container); color: #8B3A37; }
.badge-info { background: var(--info-container); color: #3A5D7D; }

/* ========== Forms ========== */
.form-group { margin-bottom: 20px; position: relative; }
.form-label {
  display: block; font: var(--label-medium); font-weight: 500;
  color: var(--on-surface-variant); margin-bottom: 6px;
  letter-spacing: 0.3px; text-transform: none;
}
.form-control {
  width: 100%; padding: 11px 15px; font: var(--body-large);
  border: 2px solid var(--outline-variant); border-radius: var(--shape-sm);
  background: var(--surface-bright); color: var(--on-surface);
  transition: border-color var(--motion-duration-short) var(--motion-standard),
              box-shadow var(--motion-duration-short) var(--motion-standard);
  box-sizing: border-box;
}
.form-control:hover { border-color: var(--outline); }
.form-control:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(139,111,92,0.1);
}
.form-control::placeholder { color: var(--outline); }
select.form-control {
  appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath fill='%237D6E63' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 44px;
}
textarea.form-control { min-height: 100px; resize: vertical; }
.form-helper { font: var(--body-small); color: var(--on-surface-variant); margin-top: 4px; }
.form-error { font: var(--body-small); color: var(--error); margin-top: 4px; }

/* ========== Switch / Toggle ========== */
.switch { position: relative; display: inline-block; cursor: pointer; width: 52px; height: 32px; vertical-align: middle; flex-shrink: 0; }
.switch input { display: none; }
.switch-track,
.switch > span:last-child,
.switch > div:last-child {
  display: block; width: 52px; height: 32px; border-radius: 16px;
  background: var(--outline-variant); border: 2px solid var(--outline);
  position: relative; box-sizing: border-box;
  transition: background 0.2s, border-color 0.2s;
}
.switch-thumb,
.switch-track > span,
.switch-track > div {
  position: absolute; top: 50%; transform: translateY(-50%);
  left: 4px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--outline);
  transition: left 0.2s, width 0.2s, height 0.2s, background 0.2s;
}
.switch input:checked + .switch-track,
.switch input:checked + span,
.switch input:checked + div {
  background: var(--primary); border-color: var(--primary);
}
.switch input:checked + .switch-track .switch-thumb,
.switch input:checked + .switch-track > span,
.switch input:checked + .switch-track > div,
.switch input:checked + span > span,
.switch input:checked + div > div {
  left: 22px; width: 24px; height: 24px; background: var(--on-primary);
}

/* ========== Tables ========== */
.table-wrapper {
  overflow-x: auto; border-radius: var(--shape-md);
  background: var(--surface-bright);
  box-shadow: var(--elevation-1);
}
table { width: 100%; border-collapse: collapse; }
thead { background: var(--surface-container); }
th {
  padding: 14px 20px; text-align: left; font: var(--label-medium);
  color: var(--on-surface-variant); white-space: nowrap;
  letter-spacing: 0.3px; text-transform: none;
  border-bottom: 1.5px solid var(--outline-variant);
}
td {
  padding: 14px 20px; font: var(--body-medium);
  border-bottom: 1px solid var(--outline-variant);
  color: var(--on-surface);
}
tr { transition: background var(--motion-duration-short); }
tbody tr:hover { background: var(--primary-container); }
tbody tr:last-child td { border-bottom: none; }

/* ========== Pagination ========== */
.pagination {
  display: flex; align-items: center; justify-content: center; gap: 4px;
  padding: 16px 0;
}
.pagination a, .pagination span {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 36px; height: 36px; padding: 0 8px;
  border-radius: var(--shape-full); font: var(--label-large);
  color: var(--on-surface-variant); text-decoration: none;
  transition: all var(--motion-duration-short) var(--motion-standard);
}
.pagination a:hover { background: rgba(139,111,92,0.08); color: var(--on-surface); }
.pagination .active {
  background: var(--primary); color: var(--on-primary); font-weight: 600;
}

/* ========== Tabs ========== */
.tabs {
  display: flex; gap: 4px; overflow-x: auto; -webkit-overflow-scrolling: touch;
  padding: 4px; background: var(--surface-dim); border-radius: var(--shape-full);
}
.tab {
  flex: 0 0 auto; padding: 10px 24px; font: var(--label-large);
  color: var(--on-surface-variant); cursor: pointer; position: relative;
  white-space: nowrap; transition: all var(--motion-duration-short);
  border: none; background: none; border-radius: var(--shape-full);
  letter-spacing: 0.2px;
}
.tab:hover { color: var(--on-surface); background: rgba(139,111,92,0.06); }
.tab.active {
  color: var(--on-primary-container); background: var(--surface-bright);
  box-shadow: var(--elevation-1); font-weight: 600;
}

/* ========== Navigation Rail (Admin Sidebar) ========== */
.nav-rail {
  position: fixed; top: 0; left: 0; width: 280px; height: 100vh;
  background: var(--sidebar-bg);
  display: flex; flex-direction: column; z-index: 50;
  transition: transform var(--motion-duration-medium) var(--motion-emphasized);
}
.nav-rail-header {
  padding: 24px 24px 20px; display: flex; align-items: center; gap: 14px;
  border-bottom: 1px solid rgba(232,221,211,0.1);
}
.nav-rail-logo {
  width: 40px; height: 40px; border-radius: var(--shape-sm);
  background: linear-gradient(135deg, var(--accent), var(--primary-light));
  display: flex; align-items: center; justify-content: center;
  color: #FFFFFF; font-weight: 800; font-size: 17px;
  box-shadow: 0 2px 8px rgba(201,149,107,0.3);
}
.nav-rail-brand {
  font: var(--title-medium); color: var(--sidebar-text);
  letter-spacing: 0.3px;
}
.nav-rail-menu { flex: 1; overflow-y: auto; padding: 16px 12px; }
.nav-rail-section { margin-bottom: 8px; }
.nav-rail-section-title {
  font: var(--label-small); color: rgba(232,221,211,0.4);
  padding: 12px 16px 6px; text-transform: uppercase; letter-spacing: 1px;
}
.nav-item {
  display: flex; align-items: center; gap: 14px;
  padding: 11px 16px; border-radius: var(--shape-sm);
  font: var(--label-large); color: var(--sidebar-text);
  cursor: pointer; transition: all var(--motion-duration-short);
  text-decoration: none; margin-bottom: 2px;
  letter-spacing: 0.2px; opacity: 0.75;
}
.nav-item:hover {
  background: var(--sidebar-hover); color: var(--sidebar-text); opacity: 1;
}
.nav-item.active {
  background: var(--sidebar-active);
  color: var(--sidebar-active-text);
  opacity: 1; font-weight: 600;
}
.nav-item .material-icons-round { font-size: 22px; }
.nav-item-badge {
  margin-left: auto; background: var(--accent); color: var(--on-accent);
  border-radius: var(--shape-full); padding: 0 8px;
  font: var(--label-small); min-width: 20px; text-align: center; line-height: 20px;
}

.nav-rail-footer {
  padding: 16px 20px; border-top: 1px solid rgba(232,221,211,0.1);
  display: flex; align-items: center; gap: 12px;
  position: relative;
  cursor: pointer; transition: background 0.15s;
}
.nav-rail-footer:hover { background: rgba(255,255,255,0.06); }
.nav-rail-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--primary-light));
  display: flex; align-items: center; justify-content: center;
  color: #FFFFFF; font-weight: 600; font-size: 15px;
}
.nav-rail-user-name { font: var(--title-small); color: var(--sidebar-text); }
.nav-rail-user-role { font: var(--body-small); color: rgba(232,221,211,0.5); }

/* User Popover */
.user-popover {
  display: none; position: absolute; bottom: calc(100% + 8px); left: 12px; right: 12px;
  background: var(--surface-bright, #fff); border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.22); z-index: 100;
  overflow: hidden; animation: popover-in 0.15s ease;
}
.user-popover.show { display: block; }
.user-popover-header {
  padding: 16px; display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid var(--outline-variant, #DDD3C8);
}
.user-popover-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent, #C9956B), var(--primary-light, #C4A882));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 600; font-size: 16px;
}
.user-popover-name { font: var(--title-small); color: var(--on-surface, #2C2420); }
.user-popover-role { font: var(--body-small); color: var(--on-surface-variant, #7D6E63); }
.user-popover-menu { padding: 6px 0; }
.user-popover-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; font: var(--label-large); color: var(--on-surface, #2C2420);
  cursor: pointer; transition: background 0.12s; text-decoration: none;
}
.user-popover-item:hover { background: var(--surface-container, #F0EAE3); }
.user-popover-item .material-icons-round { font-size: 20px; color: var(--on-surface-variant, #7D6E63); }
.user-popover-item.logout { color: var(--error, #C25B56); }
.user-popover-item.logout .material-icons-round { color: var(--error, #C25B56); }
.user-popover-divider { height: 1px; background: var(--outline-variant, #DDD3C8); margin: 2px 0; }
@keyframes popover-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========== Top App Bar (Admin) ========== */
.top-bar {
  position: sticky; top: 0; z-index: 40; padding: 16px 32px;
  background: rgba(253,250,247,0.85); backdrop-filter: blur(12px);
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--outline-variant);
}
.top-bar-title { font: var(--headline-small); color: var(--on-surface); }
.top-bar-actions { display: flex; align-items: center; gap: 8px; }

/* ========== Admin Layout ========== */
.admin-layout { display: flex; min-height: 100vh; background: var(--surface-dim); }
.admin-content { flex: 1; margin-left: 280px; transition: margin-left 0.25s ease; }
.admin-page { padding: 32px; max-width: 1400px; }

/* ===== Sidebar Toggle ===== */
.nav-toggle {
  width: 28px; height: 28px; border-radius: 50%;
  background: transparent; border: none;
  color: var(--sidebar-text); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s; margin-left: auto; flex-shrink: 0;
  opacity: 0.5;
}
.nav-toggle:hover { background: rgba(255,255,255,0.12); opacity: 1; }
.nav-toggle .material-icons-round { font-size: 16px; }

/* ===== Collapsed Sidebar ===== */
.nav-rail.collapsed { width: 68px; }
.nav-rail.collapsed .nav-rail-brand,
.nav-rail.collapsed .nav-rail-user-name,
.nav-rail.collapsed .nav-rail-user-role,
.nav-rail.collapsed .nav-rail-logo { display: none; }
.nav-rail.collapsed .nav-rail-header { padding: 16px 14px; justify-content: center; }
.nav-rail.collapsed .nav-toggle { margin-left: 0; opacity: 0.7; }
.nav-rail.collapsed .nav-rail-menu { padding: 12px 8px; }
.nav-rail.collapsed .nav-item {
  justify-content: center; padding: 11px 0; gap: 0;
  font-size: 0; /* hide text */
}
.nav-rail.collapsed .nav-item .material-icons-round { font-size: 24px; margin: 0; }
.nav-rail.collapsed .nav-rail-footer { padding: 14px; justify-content: center; }
.nav-rail.collapsed .nav-rail-avatar { width: 36px; height: 36px; }
.nav-rail.collapsed .user-popover { left: 68px; }
.nav-rail.collapsed + .admin-content { margin-left: 68px; }

/* ========== Stat Cards Grid ========== */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px; margin-bottom: 28px;
}
.stat-card {
  background: var(--surface-bright); border-radius: var(--shape-md); padding: 24px;
  box-shadow: var(--elevation-1); display: flex; align-items: flex-start; gap: 16px;
  transition: all var(--motion-duration-short) var(--motion-standard);
  position: relative; overflow: hidden;
}
.stat-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  border-radius: 0 4px 4px 0;
}
.stat-card:nth-child(1)::before { background: var(--primary); }
.stat-card:nth-child(2)::before { background: var(--accent); }
.stat-card:nth-child(3)::before { background: var(--success); }
.stat-card:nth-child(4)::before { background: var(--info); }
.stat-card:hover { box-shadow: var(--elevation-2); transform: translateY(-2px); }
.stat-icon {
  width: 52px; height: 52px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon.purple { background: var(--primary-container); color: var(--primary); }
.stat-icon.pink { background: var(--accent-container); color: var(--accent-dark); }
.stat-icon.green { background: var(--success-container); color: var(--success); }
.stat-icon.amber { background: var(--warning-container); color: var(--warning); }
.stat-icon.blue { background: var(--info-container); color: var(--info); }
.stat-label { font: var(--body-small); color: var(--on-surface-variant); margin-bottom: 4px; }
.stat-value { font: var(--headline-medium); color: var(--on-surface); }
.stat-change {
  font: var(--label-small); display: flex; align-items: center; gap: 4px; margin-top: 4px;
}
.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--error); }

/* ========== User-facing Styles ========== */
.user-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: white; padding: 16px 24px; display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
}
.user-header-title { font: var(--title-large); color: white; }
.user-header-back { color: white; display: flex; align-items: center; gap: 4px; font: var(--label-large); }

.user-container { max-width: 480px; margin: 0 auto; padding: 16px; }
.user-container-wide { max-width: 640px; margin: 0 auto; padding: 16px; }

/* Stepper */
.stepper { display: flex; align-items: center; justify-content: center; padding: 24px 16px 16px; gap: 0; overflow-x: auto; }
.step { display: flex; flex-direction: column; align-items: center; gap: 4px; flex-shrink: 0; }
.step-number {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font: var(--label-large); background: var(--surface-container); color: var(--on-surface-variant);
  transition: all var(--motion-duration-short);
  border: 2px solid var(--outline-variant); font-size: 12px;
}
.step.active .step-number {
  background: var(--primary); color: var(--on-primary);
  border-color: var(--primary); box-shadow: 0 2px 8px rgba(139,111,92,0.3);
}
.step.done .step-number {
  background: var(--success); color: white;
  border-color: var(--success);
}
.step-label { font-size: 10px; color: var(--on-surface-variant); white-space: nowrap; }
.step.active .step-label { color: var(--primary); font-weight: 600; }
.step.done .step-label { color: var(--success); }
.step-line { width: 24px; height: 2px; background: var(--outline-variant); margin: 0 2px; flex-shrink: 0; align-self: flex-start; margin-top: 14px; }
.step.done + .step-line, .step.done ~ .step-line { background: var(--success); }

/* Menu Card (User) */
.menu-card {
  background: var(--surface-bright); border-radius: var(--shape-md);
  border: 1.5px solid var(--outline-variant); padding: 18px 20px;
  margin-bottom: 12px; cursor: pointer;
  transition: all var(--motion-duration-short) var(--motion-standard);
  display: flex; align-items: center; gap: 16px;
}
.menu-card:hover { border-color: var(--primary-light); background: var(--primary-container); }
.menu-card.selected {
  border-color: var(--primary); border-width: 2px;
  background: var(--primary-container);
  box-shadow: 0 0 0 3px rgba(139,111,92,0.12);
}
.menu-card-icon {
  width: 56px; height: 56px; border-radius: var(--shape-sm); flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary-container), var(--accent-container));
  display: flex; align-items: center; justify-content: center;
  color: var(--primary);
}
.menu-card-body { flex: 1; }
.menu-card-name { font: var(--title-medium); }
.menu-card-desc { font: var(--body-small); color: var(--on-surface-variant); margin-top: 2px; }
.menu-card-meta { display: flex; align-items: center; gap: 12px; margin-top: 6px; }
.menu-card-price { font: var(--title-small); color: var(--accent-dark); font-weight: 700; }
.menu-card-time { font: var(--body-small); color: var(--on-surface-variant); display: flex; align-items: center; gap: 4px; }

/* Staff Card (User) */
.staff-card {
  background: var(--surface-bright); border-radius: var(--shape-md);
  border: 1.5px solid var(--outline-variant); padding: 20px 16px;
  cursor: pointer; transition: all var(--motion-duration-short);
  text-align: center;
}
.staff-card:hover { border-color: var(--primary-light); box-shadow: var(--elevation-1); }
.staff-card.selected {
  border-color: var(--primary); border-width: 2px;
  background: var(--primary-container);
  box-shadow: 0 0 0 3px rgba(139,111,92,0.12);
}
.staff-avatar {
  width: 72px; height: 72px; border-radius: 50%; margin: 0 auto 12px;
  background: linear-gradient(135deg, var(--primary-container), var(--accent-container));
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 700; color: var(--primary);
}
.staff-name { font: var(--title-small); color: var(--on-surface); }
.staff-role { font: var(--body-small); color: var(--on-surface-variant); margin-top: 2px; }

/* Calendar */
.calendar { background: var(--surface-bright); border-radius: var(--shape-md); overflow: hidden; }
.calendar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; background: var(--surface-container);
}
.calendar-title { font: var(--title-medium); }
.calendar-nav { display: flex; gap: 8px; }
.calendar-nav button {
  width: 36px; height: 36px; border-radius: 50%; border: none;
  background: transparent; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--on-surface); transition: background var(--motion-duration-short);
}
.calendar-nav button:hover { background: var(--outline-variant); }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; padding: 4px; box-sizing: border-box; }
.calendar-day-label {
  padding: 8px; text-align: center; font: var(--label-medium);
  color: var(--on-surface-variant);
}
.calendar-day-label:first-child { color: var(--error); }
.calendar-day-label:last-child { color: var(--info); }
.calendar-day {
  padding: 8px; text-align: center; cursor: pointer;
  border-radius: var(--shape-sm);
  font: var(--body-medium); transition: all var(--motion-duration-short);
}
.calendar-day:hover { background: rgba(139,111,92,0.08); }
.calendar-day.today {
  border: 2px solid var(--primary); font-weight: 600; color: var(--primary);
}
.calendar-day.selected {
  background: var(--primary); color: var(--on-primary); font-weight: 600;
  box-shadow: 0 2px 6px rgba(139,111,92,0.3);
}
.calendar-day.disabled { color: var(--outline); cursor: not-allowed; }
.calendar-day.disabled:hover { background: transparent; }
.calendar-day.holiday { color: var(--error); }

/* Time Slots */
.time-slots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 16px; }
.time-slot {
  padding: 12px 8px; text-align: center; border-radius: var(--shape-sm);
  border: 1.5px solid var(--outline-variant); font: var(--label-large);
  cursor: pointer; transition: all var(--motion-duration-short);
}
.time-slot:hover { border-color: var(--primary); background: rgba(139,111,92,0.04); }
.time-slot.selected {
  background: var(--primary); color: var(--on-primary); border-color: var(--primary);
  box-shadow: 0 2px 6px rgba(139,111,92,0.3);
}
.time-slot.unavailable {
  background: var(--surface-dim); color: var(--outline); cursor: not-allowed; border-color: transparent;
}
.time-slot.few-left { border-color: var(--warning); color: var(--warning); }

/* ========== Shift Calendar (Admin) ========== */
.shift-calendar {
  display: grid; grid-template-columns: 120px repeat(7, 1fr);
  gap: 1px; background: var(--outline-variant); border-radius: var(--shape-md); overflow: hidden;
}
.shift-cell {
  background: var(--surface-bright); padding: 8px; min-height: 60px; font: var(--body-small);
}
.shift-cell.header {
  background: var(--surface-container); font: var(--label-medium);
  color: var(--on-surface-variant); display: flex; align-items: center;
  justify-content: center; min-height: 44px;
}
.shift-cell.staff-name {
  background: var(--surface-container-low); font: var(--label-large);
  display: flex; align-items: center; padding-left: 12px;
}
.shift-block {
  padding: 4px 8px; border-radius: var(--shape-xs); font: var(--label-small);
  margin-bottom: 2px;
}
.shift-block.early { background: #E4EDF5; color: var(--info); }
.shift-block.late { background: var(--warning-container); color: #7C5B1E; }
.shift-block.full { background: var(--primary-container); color: var(--on-primary-container); }
.shift-block.off { background: var(--surface-dim); color: var(--on-surface-variant); }

/* ========== Reservation Board (Time Grid) ========== */
.reservation-board {
  position: relative; overflow-x: auto; overflow-y: visible;
  background: var(--surface-bright); border-radius: var(--shape-md);
  box-shadow: var(--elevation-1);
}
.board-header {
  display: flex; position: sticky; top: 0; z-index: 10;
  background: var(--surface-container); border-bottom: 1.5px solid var(--outline-variant);
  min-height: 44px;
}
.board-time-label {
  flex-shrink: 0; width: 60px; text-align: center;
  font: var(--label-small); color: var(--on-surface-variant);
  padding: 12px 0; border-right: 1px solid var(--outline-variant);
  letter-spacing: 0.3px;
}
.board-row {
  display: flex; position: relative; min-height: 56px;
  border-bottom: 1px solid var(--outline-variant);
}
.board-row:last-child { border-bottom: none; }
.board-row:hover { background: rgba(139,111,92,0.02); }
.board-row-label {
  position: sticky; left: 0; z-index: 5;
  width: 120px; min-width: 120px; flex-shrink: 0;
  padding: 8px 12px; font: var(--label-large); color: var(--on-surface);
  background: var(--surface-container-low);
  border-right: 1.5px solid var(--outline-variant);
  display: flex; align-items: center; gap: 8px;
}
.board-cell {
  flex-shrink: 0; width: 60px; min-height: 56px;
  border-right: 1px solid var(--outline-variant);
  position: relative;
}
.board-cell:nth-child(even) { border-right-style: dashed; }
.board-block {
  position: absolute; top: 4px; bottom: 4px;
  border-radius: var(--shape-xs); padding: 4px 8px;
  font: var(--label-small); color: #FFFFFF;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  cursor: pointer; z-index: 3;
  transition: all var(--motion-duration-short);
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}
.board-block:hover {
  z-index: 4; box-shadow: var(--elevation-2);
  filter: brightness(1.05);
}

/* Reservation Block Color Variations */
.block-facial   { background: linear-gradient(135deg, #C9956B, #D4A87E); }
.block-body     { background: linear-gradient(135deg, #8B6F5C, #A08474); }
.block-oxygen   { background: linear-gradient(135deg, #6B8CAE, #82A3C5); }
.block-hydrogen { background: linear-gradient(135deg, #5D8C61, #74A378); }
.block-eye      { background: linear-gradient(135deg, #9B7DB8, #B094CC); }
.block-bridal   { background: linear-gradient(135deg, #D4A053, #E0B76A); }
.block-set      { background: linear-gradient(135deg, #7D8B6F, #95A387); }
.block-idle     { background: var(--surface-dim); color: var(--on-surface-variant); box-shadow: none; border: 1px dashed var(--outline); }
.block-break    { background: repeating-linear-gradient(135deg, var(--surface-container), var(--surface-container) 4px, var(--surface-dim) 4px, var(--surface-dim) 8px); color: var(--on-surface-variant); box-shadow: none; }

.board-now-line {
  position: absolute; top: 0; bottom: 0; width: 2px;
  background: var(--error); z-index: 8;
  box-shadow: 0 0 6px rgba(194,91,86,0.4);
}
.board-now-line::before {
  content: ''; position: absolute; top: -4px; left: -4px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--error);
}

.board-legend {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 12px 16px; border-top: 1px solid var(--outline-variant);
  background: var(--surface-container-low);
}
.board-legend-item {
  display: inline-flex; align-items: center; gap: 6px;
  font: var(--label-small); color: var(--on-surface-variant);
}
.board-legend-item::before {
  content: ''; display: inline-block;
  width: 14px; height: 14px; border-radius: var(--shape-xs);
}
.board-legend-item.legend-facial::before   { background: #C9956B; }
.board-legend-item.legend-body::before     { background: #8B6F5C; }
.board-legend-item.legend-oxygen::before   { background: #6B8CAE; }
.board-legend-item.legend-hydrogen::before { background: #5D8C61; }
.board-legend-item.legend-eye::before      { background: #9B7DB8; }
.board-legend-item.legend-bridal::before   { background: #D4A053; }
.board-legend-item.legend-set::before      { background: #7D8B6F; }
.board-legend-item.legend-idle::before     { background: var(--surface-dim); border: 1px dashed var(--outline); }
.board-legend-item.legend-break::before    { background: repeating-linear-gradient(135deg, var(--surface-container), var(--surface-container) 2px, var(--surface-dim) 2px, var(--surface-dim) 4px); }

/* ========== Snackbar ========== */
.snackbar {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--sidebar-bg); color: var(--sidebar-text);
  padding: 14px 24px; border-radius: var(--shape-sm);
  font: var(--body-medium); box-shadow: var(--elevation-3); z-index: 200;
  display: none; align-items: center; gap: 12px;
}
.snackbar.show { display: flex; animation: snackbar-in 300ms var(--motion-standard); }
@keyframes snackbar-in {
  from { transform: translateX(-50%) translateY(100%); opacity: 0; }
  to { transform: translateX(-50%) translateY(0); opacity: 1; }
}
.snackbar-action { color: var(--accent); font: var(--label-large); background: none; border: none; cursor: pointer; }

/* ========== Modal / Dialog ========== */
.dialog-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(44,36,32,0.5); z-index: 1000;
  align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.dialog-overlay.active { display: flex; }
.dialog {
  background: var(--surface-bright); border-radius: var(--shape-xl);
  padding: 28px; min-width: 280px; max-width: 560px; width: 90%;
  max-height: 90vh; overflow-y: auto; box-shadow: var(--elevation-4);
  animation: dialog-in 300ms var(--motion-standard);
}
@keyframes dialog-in {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.dialog-icon { text-align: center; margin-bottom: 16px; color: var(--accent); }
.dialog-icon .material-icons-round { font-size: 28px; }
.dialog-title { font: var(--headline-small); text-align: center; margin-bottom: 16px; color: var(--on-surface); }
.dialog-body { font: var(--body-medium); color: var(--on-surface-variant); margin-bottom: 24px; line-height: 1.6; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ========== O2 Brand Theme ========== */
body[data-brand="o2"] {
  --primary: #4A7A9B; --primary-dark: #3A6280; --primary-light: #7BA4C0;
  --primary-container: #DDE9F2;
  --accent: #5B8DB8; --accent-container: #E0ECF5;
  --surface: #EFF4F9; --surface-dim: #E4ECF2;
  --surface-container: #DAE4ED; --surface-bright: #FAFCFE;
  --on-surface: #1A2D3D; --on-surface-variant: #5A7A8E;
  --outline: #94AAB8; --outline-variant: #C2D2DC;
  --success: #4A9B6E; --success-container: #E0F2E8;
  --warning: #C49A4A; --warning-container: #FFF4E0;
  --error: #C25B56; --error-container: #FCE8E7;
  --info: #5B8DB8; --info-container: #E0ECF5;
  --sidebar-bg: #1A2D3D; --sidebar-text: #CADAE8;
  --sidebar-active: rgba(91,141,184,0.22); --sidebar-active-text: #7BB8E0;
}
body[data-brand="o2"] .nav-rail { background: var(--sidebar-bg); }
body[data-brand="o2"] .nav-rail-header { border-bottom-color: rgba(202,218,232,0.12); }
body[data-brand="o2"] .nav-rail-logo { background: var(--accent) !important; }
body[data-brand="o2"] .nav-rail-brand { color: var(--sidebar-text) !important; }
body[data-brand="o2"] .nav-item { color: rgba(202,218,232,0.7) !important; }
body[data-brand="o2"] .nav-item:hover { background: rgba(91,141,184,0.14) !important; color: var(--sidebar-text) !important; }
body[data-brand="o2"] .nav-item.active { background: var(--sidebar-active) !important; color: var(--sidebar-active-text) !important; }
body[data-brand="o2"] .nav-rail-footer { border-top-color: rgba(202,218,232,0.12); }
body[data-brand="o2"] .nav-rail-footer:hover { background: rgba(202,218,232,0.08); }
body[data-brand="o2"] .nav-rail-avatar { background: var(--accent) !important; }
body[data-brand="o2"] .nav-rail-user-name { color: var(--sidebar-text) !important; }
body[data-brand="o2"] .nav-rail-user-role { color: rgba(202,218,232,0.5) !important; }
body[data-brand="o2"] .top-bar { background: rgba(250,252,254,0.9); border-bottom-color: rgba(74,122,155,0.10); }
body[data-brand="o2"] .admin-page { background: var(--surface); }
body[data-brand="o2"] .stat-card { background: var(--surface-bright); }
body[data-brand="o2"] .stat-card:hover { box-shadow: 0 4px 20px rgba(26,45,61,0.10); }
body[data-brand="o2"] .card { background: var(--surface-bright) !important; box-shadow: 0 2px 12px rgba(26,45,61,0.06) !important; }
body[data-brand="o2"] thead th { background: var(--surface-dim) !important; }
body[data-brand="o2"] tbody tr:hover { background: rgba(221,233,242,0.5) !important; }
body[data-brand="o2"] .chip.active { background: var(--primary) !important; border-color: var(--primary) !important; }
body[data-brand="o2"] .btn-filled { background: var(--primary) !important; }
body[data-brand="o2"] .btn-filled:hover { background: var(--primary-dark) !important; }
body[data-brand="o2"] .btn-outlined { border-color: var(--outline) !important; color: var(--primary) !important; }
body[data-brand="o2"] .btn-tonal { background: var(--primary-container) !important; color: var(--primary-dark) !important; }
body[data-brand="o2"] .btn-text { color: var(--primary) !important; }
body[data-brand="o2"] .badge-primary { background: var(--primary-container) !important; color: var(--primary-dark) !important; }
body[data-brand="o2"] .badge-secondary { background: var(--accent-container) !important; color: var(--primary-dark) !important; }
body[data-brand="o2"] .brand-switcher { background: var(--surface-dim); }
body[data-brand="o2"] .search-bar { background: var(--surface-container); }
body[data-brand="o2"] .search-bar:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(74,122,155,0.08); }
body[data-brand="o2"] .form-control:focus { border-color: var(--primary) !important; box-shadow: 0 0 0 3px rgba(74,122,155,0.1) !important; }
body[data-brand="o2"] .dialog { border-color: rgba(74,122,155,0.10); }

/* ========== Responsive ========== */
@media (max-width: 768px) {
  .nav-rail { transform: translateX(-100%); }
  .nav-rail.open { transform: translateX(0); }
  .admin-content { margin-left: 0; }
  .admin-page { padding: 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .time-slots { grid-template-columns: repeat(3, 1fr); }
  .shift-calendar { grid-template-columns: 80px repeat(7, 1fr); }
  .top-bar { padding: 12px 16px; }
  .top-bar-title { font: var(--title-large); }
  .tabs { border-radius: var(--shape-sm); }
  .board-row-label { width: 90px; min-width: 90px; font: var(--label-medium); }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .time-slots { grid-template-columns: repeat(2, 1fr); }
  .dialog { width: 95%; padding: 20px; border-radius: var(--shape-lg); }
}

/* ========== Utilities ========== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-primary { color: var(--primary); }
.text-accent { color: var(--accent); }
.text-error { color: var(--error); }
.text-success { color: var(--success); }
.text-muted { color: var(--on-surface-variant); }
.d-flex { display: flex; }
.d-grid { display: grid; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.gap-3 { gap: 24px; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mr-1 { margin-right: 8px; }
.ml-auto { margin-left: auto; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Search Bar ---- */
.search-bar {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface-container); border-radius: var(--shape-full);
  padding: 10px 20px; border: 1.5px solid transparent;
  transition: all var(--motion-duration-short);
}
.search-bar:focus-within { border-color: var(--primary); background: var(--surface-bright); box-shadow: 0 0 0 3px rgba(139,111,92,0.08); }
.search-bar .material-icons-round { color: var(--on-surface-variant); font-size: 20px; }
.search-bar input {
  border: none; background: transparent; outline: none;
  font: var(--body-large); color: var(--on-surface); flex: 1;
}
.search-bar input::placeholder { color: var(--outline); }

/* ---- Divider ---- */
.divider { height: 1px; background: var(--outline-variant); margin: 16px 0; }

/* ---- Avatar ---- */
.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 16px; flex-shrink: 0;
}
.avatar-sm { width: 32px; height: 32px; font-size: 13px; }
.avatar-lg { width: 56px; height: 56px; font-size: 22px; }
.avatar-purple { background: var(--primary-container); color: var(--primary); }
.avatar-pink { background: var(--accent-container); color: var(--accent-dark); }
.avatar-teal { background: #E0F0ED; color: #3D6B5E; }
.avatar-amber { background: var(--warning-container); color: #7C5B1E; }

/* ---- Tooltip ---- */
[data-tooltip] { position: relative; }
[data-tooltip]:hover::after {
  content: attr(data-tooltip); position: absolute; bottom: calc(100% + 8px); left: 50%;
  transform: translateX(-50%); background: var(--sidebar-bg); color: var(--sidebar-text);
  padding: 6px 14px; border-radius: var(--shape-xs); font: var(--body-small);
  white-space: nowrap; z-index: 100; box-shadow: var(--elevation-2);
}

/* ---- Chart Placeholder ---- */
.chart-placeholder {
  background: var(--surface-container); border-radius: var(--shape-md);
  display: flex; align-items: center; justify-content: center;
  color: var(--on-surface-variant); font: var(--body-medium);
  min-height: 240px; border: 2px dashed var(--outline-variant);
}

/* ---- Empty State ---- */
.empty-state { text-align: center; padding: 48px 24px; color: var(--on-surface-variant); }
.empty-state .material-icons-round { font-size: 64px; margin-bottom: 16px; color: var(--outline); }
.empty-state h3 { font: var(--title-large); color: var(--on-surface); margin-bottom: 8px; }
.empty-state p { font: var(--body-medium); }

/* ---- Progress Indicator ---- */
.progress { height: 4px; background: var(--surface-container); border-radius: 2px; overflow: hidden; }
.progress-bar {
  height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 2px; transition: width 0.6s ease;
}

/* ---- Notification Dot ---- */
.notification-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--error);
  position: absolute; top: 8px; right: 8px;
  box-shadow: 0 0 0 2px var(--surface-bright);
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--outline-variant); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--outline); }

/* ---- Focus Visible (Accessibility) ---- */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
