:root {
  --bg: #f0f0f0;
  --sidebar-bg: #000000;
  --sidebar-text: #cccccc;
  --gold: #C9A44C;
  --gold-dark: #a07c30;
  --gold-light: #e8c97e;
  --gold-bg: #fdf6e3;
  --white: #ffffff;
  --text: #111111;
  --text-muted: #666666;
  --border: #e0e0e0;
  --card: #ffffff;
  --danger: #c0392b;
  --danger-bg: #fdf0f0;
  --success: #27ae60;
  --success-bg: #f0fdf4;
  --warning: #d4ac0d;
  --warning-bg: #fefce8;
  --radius: 8px;
  --shadow: 0 1px 4px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.12);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  overflow-x: hidden;
  max-width: 100vw;
}

/* ── LOGIN ──────────────────────────────────────────────────────────────── */

.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.login-card {
  background: var(--white);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  padding: 48px 40px;
  width: 380px;
}

.login-logo-above {
  text-align: center;
  margin-bottom: 20px;
}

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

.login-logo h1 {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 4px;
  color: var(--text);
}

.login-logo span {
  color: var(--gold);
}

.login-logo p {
  color: var(--text-muted);
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-top: 4px;
}

.login-card .form-group { margin-bottom: 18px; }
.login-card .form-group label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.login-card input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.login-card input:focus { border-color: var(--gold); }

.login-error {
  background: var(--danger-bg);
  color: var(--danger);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
}

/* ── LAYOUT ─────────────────────────────────────────────────────────────── */

.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 220px;
  min-width: 220px;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transform: translateX(0);
  transition: transform 0.25s ease;
}

.sidebar.collapsed {
  transform: translateX(-220px);
}

.sidebar-toggle {
  position: fixed;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  z-index: 101;
  background: var(--sidebar-bg);
  color: var(--gold);
  border: none;
  border-radius: 0 6px 6px 0;
  width: 22px;
  height: 56px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  writing-mode: vertical-rl;
  letter-spacing: 1px;
  transition: left 0.25s ease, background 0.15s;
  box-shadow: 2px 0 8px rgba(0,0,0,0.2);
}

.sidebar-toggle:hover { background: #222; }

.sidebar-toggle.open {
  left: 220px;
}

.sidebar-logo {
  padding: 28px 24px 20px;
  border-bottom: 1px solid #2a2a2a;
}

.sidebar-logo h1 {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 4px;
  color: var(--white);
}

.sidebar-logo h1 span { color: var(--gold); }

.sidebar-logo p {
  font-size: 10px;
  color: #666;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 0;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 24px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
  cursor: pointer;
  border-left: 3px solid transparent;
}

.sidebar-nav a:hover {
  background: #1e1e1e;
  color: var(--white);
}

.sidebar-nav a.active {
  background: #1e1e1e;
  color: var(--gold);
  border-left-color: var(--gold);
}

.sidebar-nav a .nav-icon { font-size: 16px; width: 20px; text-align: center; }

.sidebar-footer {
  padding: 16px 24px;
  border-top: 1px solid #2a2a2a;
}

.sidebar-user {
  font-size: 12px;
  color: #888;
  margin-bottom: 12px;
}

.sidebar-user strong { display: block; color: #ccc; font-size: 13px; }

.main-content {
  margin-left: 220px;
  flex: 1;
  transition: margin-left 0.25s ease;
  padding: 32px;
  min-height: 100vh;
}

/* ── PAGE HEADER ─────────────────────────────────────────────────────────── */

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

.page-header h2 {
  font-size: 22px;
  font-weight: 700;
}

.page-header p {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 2px;
}

/* ── CARDS ───────────────────────────────────────────────────────────────── */

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  border: 1px solid var(--border);
}

.card-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ── STATS GRID ──────────────────────────────────────────────────────────── */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

@keyframes flash-alert {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.15; }
}

.flash-alert {
  display: inline-block;
  color: #dc2626;
  font-size: 14px;
  animation: flash-alert 1.2s ease-in-out infinite;
}

.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 20px 24px;
  height: 96px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  box-sizing: border-box;
}

.stat-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.stat-value {
  font-size: 30px;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}

.stat-value.gold { color: var(--gold); }
.stat-value.small { font-size: 22px; }

/* ── BUTTONS ─────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  text-decoration: none;
}

.btn-gold {
  background: var(--gold);
  color: #111;
}

.btn-gold:hover { background: var(--gold-dark); color: #fff; }

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1.5px solid var(--border);
}

.btn-outline:hover { border-color: var(--text); background: var(--bg); }

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1.5px solid #f5c6c6;
}

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

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  padding: 6px 10px;
}

.btn-ghost:hover { color: var(--text); background: var(--bg); }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-xs { padding: 4px 9px; font-size: 11px; }

/* ── BADGES ──────────────────────────────────────────────────────────────── */

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.badge-active { background: var(--success-bg); color: var(--success); }
.badge-inactive { background: #f0f0f0; color: #888; }
.badge-archived { background: #f0f0f0; color: #aaa; }
.badge-gold { background: var(--gold-bg); color: var(--gold-dark); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }

/* ── FORMS ───────────────────────────────────────────────────────────────── */

.form-group { margin-bottom: 16px; }

.form-group label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  font-family: inherit;
  background: var(--white);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color: var(--gold); }

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

.form-row {
  display: grid;
  gap: 12px;
}

.form-row.cols-2 { grid-template-columns: 1fr 1fr; }
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }

.days-picker {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.day-btn {
  padding: 5px 10px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--white);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.day-btn.selected {
  background: var(--gold);
  border-color: var(--gold);
  color: #111;
}

.star-picker {
  display: flex;
  gap: 6px;
}

.star-btn {
  font-size: 24px;
  cursor: pointer;
  color: #ddd;
  transition: color 0.1s;
  background: none;
  border: none;
  padding: 2px;
}

.star-btn.active { color: var(--gold); }

/* ── TABLE ───────────────────────────────────────────────────────────────── */

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
}

thead th {
  background: #fafafa;
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid #f4f4f4;
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }

tbody tr:hover { background: #fafafa; }

.client-name-cell {
  font-weight: 600;
  color: var(--text);
}

.client-name-cell .sub {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
}

/* ── SEARCH / FILTER BAR ─────────────────────────────────────────────────── */

.filter-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-bar input {
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  outline: none;
  min-width: 200px;
  background: var(--white);
}

.filter-bar input:focus { border-color: var(--gold); }

.filter-bar select {
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  background: var(--white);
  outline: none;
  cursor: pointer;
}

/* ── CLIENT PROFILE ──────────────────────────────────────────────────────── */

.profile-header {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 24px;
}

.profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 800;
  color: #111;
  flex-shrink: 0;
}

.profile-meta { flex: 1; }

.profile-meta h2 {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 6px;
}

.profile-meta .badges { display: flex; gap: 6px; flex-wrap: wrap; }

.profile-actions { display: flex; gap: 8px; }

.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.profile-grid .card-wide {
  grid-column: span 2;
}

.info-list { list-style: none; }

.info-list li {
  display: flex;
  padding: 8px 0;
  border-bottom: 1px solid #f4f4f4;
  gap: 12px;
}

.info-list li:last-child { border-bottom: none; }

.info-list .info-label {
  min-width: 130px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.info-list .info-val {
  font-size: 13px;
  color: var(--text);
}

/* ── SCHEDULE / CALENDAR ─────────────────────────────────────────────────── */

.cal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.cal-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cal-nav button {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--white);
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.cal-nav button:hover { border-color: var(--gold); color: var(--gold); }

.cal-date-label {
  font-size: 16px;
  font-weight: 700;
  min-width: 180px;
  text-align: center;
}

.view-toggle {
  display: flex;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--white);
}

.view-toggle button {
  padding: 7px 14px;
  border: none;
  background: none;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.15s;
}

.view-toggle button.active {
  background: var(--gold);
  color: #111;
}

/* Week view */
.cal-week {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}

.cal-week-head {
  display: grid;
  grid-template-columns: 60px repeat(7, 1fr);
  border-bottom: 2px solid var(--border);
  background: #fafafa;
  overflow-y: scroll;
  scrollbar-width: none;
}
.cal-week-head::-webkit-scrollbar { display: none; }

.cal-week-head .day-col-head {
  padding: 12px 8px;
  text-align: center;
  border-left: 1px solid var(--border);
  font-size: 12px;
}

.cal-week-head .day-col-head .dow {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 10px;
  color: var(--text-muted);
}

.cal-week-head .day-col-head .dom {
  font-size: 20px;
  font-weight: 800;
  line-height: 1.2;
}

.cal-week-head .day-col-head.today .dom { color: var(--gold); }
.cal-week-head .day-col-head.today .dow { color: var(--gold); }

.cal-week-body {
  display: grid;
  grid-template-columns: 60px 1fr;
  max-height: 640px;
  overflow-y: scroll;
  scrollbar-gutter: stable;
}

.time-col .time-slot {
  height: 60px;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 4px 8px 0 0;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid #f4f4f4;
}

.day-col {
  border-left: 1px solid var(--border);
  position: relative;
}

.day-col .hour-slot {
  height: 60px;
  border-bottom: 1px solid #f4f4f4;
  cursor: pointer;
  transition: background 0.1s;
}

.day-col .hour-slot:hover { background: var(--gold-bg); }

.day-col .hour-slot.blocked {
  background: repeating-linear-gradient(
    45deg,
    #f8f8f8,
    #f8f8f8 4px,
    #f0f0f0 4px,
    #f0f0f0 8px
  );
  cursor: not-allowed;
}

.cal-session {
  position: absolute;
  left: 2px;
  right: 2px;
  border-radius: 5px;
  padding: 4px 7px;
  font-size: 11px;
  font-weight: 600;
  overflow: hidden;
  cursor: pointer;
  z-index: 2;
  line-height: 1.3;
  border-left: 3px solid var(--gold-dark);
  background: var(--gold-bg);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.cal-session:hover { filter: brightness(0.96); }

.cal-session .ses-client { font-weight: 700; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-session .ses-time { font-size: 10px; color: var(--text-muted); }

.cal-session.cancelled {
  border-left-color: #ccc;
  background: #f8f8f8;
  color: #999;
  text-decoration: line-through;
}

.cal-session.completed {
  border-left-color: var(--success);
  background: var(--success-bg);
}

/* Month view */
.cal-month {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}

.cal-month-head {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: #fafafa;
  border-bottom: 2px solid var(--border);
}

.cal-month-head span {
  padding: 10px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.cal-month-body {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.month-day {
  min-height: 90px;
  padding: 8px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.1s;
}

.month-day:nth-child(7n) { border-right: none; }
.month-day:hover { background: #fafafa; }
.month-day.other-month { opacity: 0.35; }
.month-day.today .day-num { color: var(--gold); font-weight: 800; }

.day-num {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 4px;
}

.month-session-dot {
  background: var(--gold-bg);
  border-left: 2px solid var(--gold);
  padding: 2px 5px;
  border-radius: 3px;
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
  font-weight: 600;
}

.month-blocked-dot {
  background: #f0f0f0;
  border-left: 2px solid #bbb;
  padding: 2px 5px;
  border-radius: 3px;
  font-size: 10px;
  color: #999;
  margin-bottom: 2px;
}

/* Day view */
.cal-day {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}

.cal-day-head {
  padding: 16px 20px;
  border-bottom: 2px solid var(--border);
  background: #fafafa;
  font-size: 16px;
  font-weight: 700;
}

.cal-day-body {
  display: grid;
  grid-template-columns: 60px 1fr;
  max-height: 640px;
  overflow-y: auto;
}

/* ── SESSION CARD (list) ─────────────────────────────────────────────────── */

.session-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid #f4f4f4;
}

.session-item:last-child { border-bottom: none; }

.session-time-badge {
  background: var(--gold-bg);
  color: var(--gold-dark);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  min-width: 60px;
  text-align: center;
  flex-shrink: 0;
}

.session-info { flex: 1; }
.session-info .name { font-weight: 600; font-size: 14px; }
.session-info .sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ── PROGRESS ENTRY ──────────────────────────────────────────────────────── */

.progress-entry {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  background: var(--white);
}

.progress-entry .entry-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.progress-entry .entry-date {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}

.progress-entry .entry-client {
  font-weight: 700;
  font-size: 13px;
}

.stars {
  color: var(--gold);
  font-size: 14px;
  letter-spacing: 1px;
}

.stars.small { font-size: 12px; }

.progress-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 3px;
}

.progress-section-text {
  font-size: 13px;
  color: var(--text);
  white-space: pre-wrap;
}

/* ── LOW CREDIT WARNING ──────────────────────────────────────────────────── */

.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 13px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

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

.alert-danger {
  background: var(--danger-bg);
  border: 1px solid #fca5a5;
  color: var(--danger);
}

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

.alert-info {
  background: var(--gold-bg);
  border: 1px solid #fde68a;
  color: #78350f;
}

.alert .alert-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }

/* ── REVENUE ─────────────────────────────────────────────────────────────── */

.revenue-filters {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.range-btn {
  padding: 7px 14px;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  background: var(--white);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.range-btn.active { background: var(--gold); border-color: var(--gold); color: #111; }
.range-btn:hover:not(.active) { border-color: var(--text); }

.custom-range {
  display: flex;
  align-items: center;
  gap: 6px;
}

.custom-range input[type="date"] {
  padding: 6px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 12px;
  background: var(--white);
  outline: none;
}

.custom-range input[type="date"]:focus { border-color: var(--gold); }

/* ── PACKAGE CARD ────────────────────────────────────────────────────────── */

.pkg-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  background: var(--white);
  margin-bottom: 10px;
}

.pkg-card .pkg-name { font-weight: 700; font-size: 14px; margin-bottom: 6px; }

.pkg-meta { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 8px; }
.pkg-meta-item { font-size: 12px; color: var(--text-muted); }
.pkg-meta-item strong { color: var(--text); }

.credit-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  margin-top: 10px;
  overflow: hidden;
}

.credit-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--gold);
  transition: width 0.3s;
}

.credit-bar-fill.low { background: var(--danger); }

/* ── MODAL ───────────────────────────────────────────────────────────────── */

#modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

#modal-overlay.hidden { display: none; }

#modal-box {
  background: var(--white);
  border-radius: 12px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: var(--white);
  z-index: 1;
}

.modal-header h3 { font-size: 16px; font-weight: 700; }

.modal-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: var(--bg);
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all 0.15s;
}

.modal-close:hover { background: var(--border); color: var(--text); }

.modal-body { padding: 20px 24px; }

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  position: sticky;
  bottom: 0;
  background: var(--white);
}

/* ── BACK BUTTON ─────────────────────────────────────────────────────────── */

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 20px;
  background: none;
  border: none;
  padding: 0;
  transition: color 0.15s;
}

.back-btn:hover { color: var(--text); }

/* ── TOAST ───────────────────────────────────────────────────────────────── */

#toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast-msg {
  background: #111;
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  animation: slideIn 0.2s ease;
  pointer-events: auto;
}

.toast-msg.success { border-left: 3px solid var(--gold); }
.toast-msg.error { border-left: 3px solid var(--danger); }

@keyframes slideIn {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ── PORTAL ──────────────────────────────────────────────────────────────── */

.portal-layout {
  min-height: 100vh;
  background: var(--bg);
}

.portal-header {
  background: var(--sidebar-bg);
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.portal-header .brand {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 4px;
  color: var(--white);
}

.portal-header .brand span { color: var(--gold); }

.portal-content {
  padding: 32px;
  max-width: 900px;
  margin: 0 auto;
}

.portal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

/* ── SETTINGS ────────────────────────────────────────────────────────────── */

.pkg-template-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  margin-bottom: 10px;
}

.pkg-template-card .pkg-info { flex: 1; }
.pkg-template-card .pkg-info .name { font-weight: 700; font-size: 14px; }
.pkg-template-card .pkg-info .meta { font-size: 12px; color: var(--text-muted); margin-top: 3px; }

/* ── MISC ────────────────────────────────────────────────────────────────── */

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}

.empty-state .empty-icon { font-size: 40px; margin-bottom: 12px; opacity: 0.4; }
.empty-state p { font-size: 14px; }

/* ── SKELETON SCREENS ────────────────────────────────────────────────────── */

@keyframes shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position: 600px 0; }
}

.skel {
  background: linear-gradient(90deg, #e8e8e8 25%, #f5f5f5 50%, #e8e8e8 75%);
  background-size: 600px 100%;
  animation: shimmer 1.4s infinite linear;
  border-radius: 6px;
}

.skel-text  { height: 14px; margin-bottom: 8px; }
.skel-title { height: 22px; width: 40%; margin-bottom: 20px; }
.skel-card  { height: 96px; border-radius: var(--radius); }
.skel-row   { height: 48px; border-radius: 6px; margin-bottom: 8px; }
.skel-block { height: 200px; border-radius: var(--radius); }

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

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.three-col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }

.section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.injury-tag {
  display: inline-block;
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #fca5a5;
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
  margin: 2px;
}

.credit-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  background: var(--gold-bg);
  color: var(--gold-dark);
}

.credit-pill.low { background: var(--danger-bg); color: var(--danger); }
.credit-pill.zero { background: #f0f0f0; color: #aaa; }

@keyframes exp-flash {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.2; }
}

.exp-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #fff;
  background: var(--danger);
  border-radius: 3px;
  padding: 1px 4px;
  transform: rotate(-12deg);
  animation: exp-flash 1s ease-in-out infinite;
  vertical-align: middle;
}

.text-muted { color: var(--text-muted); }
.text-gold { color: var(--gold-dark); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.fw-bold { font-weight: 700; }
.mt-0 { margin-top: 0; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }

/* ── HALF-STAR PICKER ────────────────────────────────────────────────────── */

.half-star-picker {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: wrap;
}

.star-slot {
  position: relative;
  display: inline-block;
  width: 28px;
  height: 28px;
  cursor: pointer;
}

.star-char {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #ddd;
  pointer-events: none;
  transition: color 0.1s;
  line-height: 1;
}

.star-slot.full .star-char  { color: var(--gold); }
.star-slot.half .star-char  { color: #ddd; }

.star-slot.half::after {
  content: '★';
  position: absolute;
  left: 0; top: 0;
  width: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  font-size: 24px;
  color: var(--gold);
  pointer-events: none;
  line-height: 1.15;
}

.star-half {
  position: absolute;
  top: 0;
  height: 100%;
  width: 50%;
  z-index: 1;
}

.star-half.left  { left: 0; }
.star-half.right { right: 0; }

/* ── DAY + AM/PM GRID ────────────────────────────────────────────────────── */

.day-grid {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.day-grid-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.day-period-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.period-btn {
  padding: 3px 6px;
  border-radius: 4px;
  border: 1.5px solid var(--border);
  background: var(--white);
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.period-btn.selected {
  background: var(--gold);
  border-color: var(--gold);
  color: #111;
}

/* ── MOBILE ──────────────────────────────────────────────────────────────── */

@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .profile-grid { grid-template-columns: 1fr; }
  .profile-grid .card-wide { grid-column: span 1; }
  .two-col, .portal-grid, .three-col { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .sidebar { transform: translateX(-220px); }
  .sidebar:not(.collapsed) { transform: translateX(0); }
  .main-content { margin-left: 0 !important; padding: 16px 12px; width: 100%; }
  .dash-grid { grid-template-columns: 1fr 1fr !important; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 14px 16px; }
  .stat-value { font-size: 24px; }
  .page-header { flex-wrap: wrap; gap: 10px; }
  .page-header h2 { font-size: 18px; }
  .card { padding: 16px; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-bar input, .filter-bar select { min-width: unset; width: 100%; }
  .profile-header { flex-wrap: wrap; gap: 12px; }
  .profile-actions { flex-wrap: wrap; }
  .modal-body { padding: 14px 16px; }
  .modal-header { padding: 14px 16px 12px; }
  .form-row.cols-2, .form-row.cols-3 { grid-template-columns: 1fr; }
  #modal-box { max-width: 100% !important; margin: 0 8px; border-radius: 10px; }
  .table-wrap { font-size: 12px; }
  thead th, tbody td { padding: 8px 10px; }
  .revenue-filters { flex-wrap: wrap; }
  .custom-range { flex-wrap: wrap; }
  .portal-content { padding: 16px 12px; }
  .portal-header { padding: 12px 16px; }
  .cal-date-label { font-size: 13px; min-width: unset; }
  .login-card { padding: 28px 20px; width: 100%; max-width: 360px; }
  .sidebar-toggle { width: 18px; height: 48px; font-size: 10px; }
}
