@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400;1,600&family=Montserrat:wght@300;400;500;600;700&display=swap');

:root {
  --gold: #B8975A;
  --gold-light: #D4AF72;
  --gold-pale: #F0E6D3;
  --cream: #FAF8F4;
  --cream-dark: #F2EDE4;
  --charcoal: #1C1C1C;
  --charcoal-light: #3A3A3A;
  --gray: #8A8A8A;
  --gray-light: #E8E4DC;
  --white: #FFFFFF;
  --success: #4CAF50;
  --warning: #FF9800;
  --danger: #E53935;
  --info: #1E88E5;
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.08);
  --shadow: 0 4px 20px rgba(0,0,0,0.10);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.14);
  --radius: 10px;
  --radius-lg: 16px;
  --transition: all 0.2s ease;
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Montserrat', sans-serif;
  background: var(--cream);
  color: var(--charcoal);
  line-height: 1.6;
  min-height: 100vh;
}

h1, h2, h3, h4, h5 {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  line-height: 1.2;
  color: var(--charcoal);
}

h1 { font-size: 2.4rem; }
h2 { font-size: 1.9rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.2rem; }

a { color: var(--gold); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--gold-light); }

/* ── Layout ── */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  min-height: 100vh;
  background: var(--charcoal);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  z-index: 100;
  transition: var(--transition);
}

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

.sidebar-logo img { height: 36px; }

.sidebar-logo .app-subtitle {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  margin-top: 6px;
}

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

.nav-section-label {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--gray);
  padding: 16px 24px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 24px;
  color: rgba(255,255,255,0.65);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  border-left: 3px solid transparent;
}

.nav-item:hover {
  background: rgba(255,255,255,0.05);
  color: var(--white);
}

.nav-item.active {
  background: rgba(184,151,90,0.15);
  color: var(--gold-light);
  border-left-color: var(--gold);
}

.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; }

.sidebar-footer {
  padding: 20px 24px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--gold);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Cormorant Garamond', serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--white);
  flex-shrink: 0;
}

.user-name { font-size: 0.8rem; font-weight: 600; color: var(--white); }
.user-role { font-size: 0.65rem; color: var(--gold); text-transform: uppercase; letter-spacing: 0.08em; }

.logout-btn {
  margin-left: auto;
  background: none; border: none;
  color: var(--gray); cursor: pointer;
  padding: 4px; border-radius: 4px;
  transition: var(--transition);
}
.logout-btn:hover { color: var(--danger); }

.main-content {
  margin-left: 260px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--gray-light);
  padding: 0 32px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0; z-index: 50;
  box-shadow: var(--shadow-sm);
}

.topbar-title { font-family: 'Cormorant Garamond', serif; font-size: 1.4rem; font-weight: 600; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }

.page-body {
  padding: 32px;
  flex: 1;
}

/* ── Cards ── */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-light);
}

.card-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--gray-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title { font-family: 'Cormorant Garamond', serif; font-size: 1.2rem; font-weight: 600; }
.card-body { padding: 20px 24px; }

.stat-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  border: 1px solid var(--gray-light);
  box-shadow: var(--shadow-sm);
}

.stat-label { font-size: 0.7rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--gray); margin-bottom: 6px; }
.stat-value { font-family: 'Cormorant Garamond', serif; font-size: 2rem; font-weight: 600; color: var(--charcoal); }
.stat-sub { font-size: 0.75rem; color: var(--gray); margin-top: 4px; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 20px;
  border-radius: var(--radius);
  font-family: 'Montserrat', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: var(--gold);
  color: var(--white);
}
.btn-primary:hover { background: var(--charcoal); color: var(--white); }

.btn-secondary {
  background: var(--cream-dark);
  color: var(--charcoal);
  border: 1px solid var(--gray-light);
}
.btn-secondary:hover { background: var(--gray-light); }

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

.btn-ghost {
  background: none;
  color: var(--gold);
  border: 1px solid var(--gold);
}
.btn-ghost:hover { background: var(--gold); color: var(--white); }

.btn-sm { padding: 6px 14px; font-size: 0.74rem; }
.btn-lg { padding: 13px 28px; font-size: 0.88rem; }

/* ── Forms ── */
.form-group { margin-bottom: 20px; }

label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--charcoal-light);
  margin-bottom: 7px;
}

input, select, textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--gray-light);
  border-radius: var(--radius);
  font-family: 'Montserrat', sans-serif;
  font-size: 0.85rem;
  color: var(--charcoal);
  background: var(--white);
  transition: var(--transition);
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(184,151,90,0.12);
}

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

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.badge-gold { background: var(--gold-pale); color: var(--gold); }
.badge-green { background: #E8F5E9; color: #2E7D32; }
.badge-red { background: #FFEBEE; color: #C62828; }
.badge-blue { background: #E3F2FD; color: #1565C0; }
.badge-gray { background: var(--gray-light); color: var(--gray); }

/* ── Progress ── */
.progress-bar {
  background: var(--gray-light);
  border-radius: 20px;
  height: 8px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--gold-light));
  border-radius: 20px;
  transition: width 0.6s ease;
}

/* ── Tables ── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
}

.data-table th {
  text-align: left;
  padding: 10px 16px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gray);
  border-bottom: 2px solid var(--gray-light);
  background: var(--cream);
}

.data-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--gray-light);
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--cream); }

/* ── Candyland Journey ── */
.journey-map {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.month-block {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-light);
  overflow: hidden;
}

.month-header {
  background: var(--charcoal);
  color: var(--white);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.month-title { font-family: 'Cormorant Garamond', serif; font-size: 1.1rem; font-weight: 600; }

.weeks-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
}

.week-card {
  padding: 16px;
  border-right: 1px solid var(--gray-light);
  border-top: 1px solid var(--gray-light);
  cursor: pointer;
  transition: var(--transition);
}

.week-card:last-child { border-right: none; }
.week-card:hover { background: var(--cream); }
.week-card.current { background: rgba(184,151,90,0.06); border-top-color: var(--gold); }
.week-card.completed { background: #F1F8E9; }

.week-number {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gray);
  margin-bottom: 4px;
}

.week-card.current .week-number { color: var(--gold); }
.week-card.completed .week-number { color: #558B2F; }

.week-progress { margin-top: 8px; }
.week-progress-text { font-size: 0.7rem; color: var(--gray); margin-top: 4px; }

/* ── Tabs ── */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--gray-light);
  margin-bottom: 24px;
  gap: 0;
}

.tab-btn {
  padding: 11px 20px;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gray);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: var(--transition);
  letter-spacing: 0.04em;
}

.tab-btn:hover { color: var(--charcoal); }
.tab-btn.active { color: var(--gold); border-bottom-color: var(--gold); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Checklist ── */
.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--gray-light);
}

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

.check-box {
  width: 20px; height: 20px;
  border: 2px solid var(--gray-light);
  border-radius: 4px;
  flex-shrink: 0;
  margin-top: 2px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}

.check-box:hover { border-color: var(--gold); }
.check-box.checked { background: var(--gold); border-color: var(--gold); }
.check-box.checked::after { content: '✓'; color: white; font-size: 11px; font-weight: 700; }

.checklist-item.completed .check-label { text-decoration: line-through; color: var(--gray); }

.check-label { font-size: 0.85rem; font-weight: 500; }
.check-desc { font-size: 0.75rem; color: var(--gray); margin-top: 2px; }

/* ── Ticket Thread ── */
.ticket-message {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.ticket-message.from-gdc { flex-direction: row-reverse; }

.message-bubble {
  max-width: 70%;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 0.83rem;
  line-height: 1.5;
}

.ticket-message:not(.from-gdc) .message-bubble {
  background: var(--cream-dark);
  border-bottom-left-radius: 4px;
}

.ticket-message.from-gdc .message-bubble {
  background: var(--gold);
  color: var(--white);
  border-bottom-right-radius: 4px;
}

.message-meta { font-size: 0.68rem; color: var(--gray); margin-top: 4px; }

/* ── Login Page ── */
.login-page {
  min-height: 100vh;
  background: var(--charcoal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 48px 44px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}

.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo img { height: 48px; }
.login-logo h2 { margin-top: 16px; font-size: 1.5rem; }
.login-logo p { font-size: 0.8rem; color: var(--gray); margin-top: 4px; }

.login-divider {
  text-align: center;
  font-size: 0.7rem;
  color: var(--gray);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin: 24px 0;
  position: relative;
}

.login-divider::before, .login-divider::after {
  content: '';
  position: absolute;
  top: 50%; width: calc(50% - 24px);
  height: 1px; background: var(--gray-light);
}
.login-divider::before { left: 0; }
.login-divider::after { right: 0; }

/* ── Grid Helpers ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }

/* ── Alerts ── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 0.82rem;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.alert-error { background: #FFEBEE; color: #C62828; border: 1px solid #FFCDD2; }
.alert-success { background: #E8F5E9; color: #2E7D32; border: 1px solid #C8E6C9; }
.alert-info { background: #E3F2FD; color: #1565C0; border: 1px solid #BBDEFB; }
.alert-warning { background: #FFF8E1; color: #E65100; border: 1px solid #FFE082; }

/* ── Loading ── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--gray-light);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  position: fixed; inset: 0;
  background: rgba(250,248,244,0.85);
  display: flex; align-items: center; justify-content: center;
  z-index: 999;
  backdrop-filter: blur(2px);
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-260px); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .weeks-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .weeks-grid { grid-template-columns: 1fr 1fr; }
  .page-body { padding: 20px 16px; }
}

/* ── Utility ── */
.text-gold { color: var(--gold); }
.text-gray { color: var(--gray); }
.text-sm { font-size: 0.8rem; }
.text-xs { font-size: 0.72rem; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.justify-between { justify-content: space-between; }
.hidden { display: none !important; }
