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

:root {
  --bg:           #F4F3F0;
  --bg-white:     #FFFFFF;
  --sidebar-bg:   #0F172A;
  --sidebar-text: #94A3B8;
  --sidebar-hover:#1E293B;
  --sidebar-act:  #F97316;
  --text:         #0F172A;
  --text-2:       #475569;
  --text-3:       #94A3B8;
  --accent:       #F97316;
  --accent-soft:  #FFF7ED;
  --accent-border:#FED7AA;
  --border:       #E2E8F0;
  --border-2:     #CBD5E1;
  --success:      #10B981;
  --success-soft: #ECFDF5;
  --warning:      #F59E0B;
  --warning-soft: #FFFBEB;
  --danger:       #EF4444;
  --danger-soft:  #FEF2F2;
  --info:         #3B82F6;
  --info-soft:    #EFF6FF;
  --radius-sm:    6px;
  --radius:       10px;
  --radius-lg:    16px;
  --shadow-sm:    0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow:       0 4px 12px rgba(0,0,0,0.08);
  --font:         'Outfit', sans-serif;
  --sidebar-w:    240px;
}

html, body { height: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform .25s ease;
}

.sidebar-brand {
  display: flex; align-items: center; gap: 11px;
  padding: 22px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.brand-icon {
  width: 34px; height: 34px;
  background: var(--accent);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.brand-icon svg { width: 18px; height: 18px; stroke: #fff; fill: none; stroke-width: 2; stroke-linecap: round; }

.brand-text { display: flex; flex-direction: column; gap: 1px; }
.brand-text strong { font-size: 14px; font-weight: 600; color: #F1F0ED; letter-spacing: -.2px; }
.brand-text span { font-size: 10px; color: var(--sidebar-text); text-transform: uppercase; letter-spacing: .06em; }

/* Nav */
.sidebar-nav { padding: 16px 12px; flex: 1; }

.nav-section-label {
  font-size: 10px; font-weight: 500; color: #475569;
  text-transform: uppercase; letter-spacing: .08em;
  padding: 0 8px 8px;
  margin-top: 8px;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-size: 14px; font-weight: 400;
  cursor: pointer;
  transition: background .12s, color .12s;
  margin-bottom: 2px;
  border: none; background: none; width: 100%; text-align: left;
}

.nav-item svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; flex-shrink: 0; }
.nav-item:hover { background: var(--sidebar-hover); color: #CBD5E1; }
.nav-item.active { background: rgba(249,115,22,0.15); color: var(--accent); }
.nav-item.active svg { stroke: var(--accent); }

/* Sidebar footer */
.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.counselor-badge {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.04);
  border-radius: var(--radius-sm);
}

.avatar {
  width: 30px; height: 30px;
  background: var(--accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; color: #fff;
  flex-shrink: 0;
}

.counselor-info { flex: 1; min-width: 0; }
.counselor-name { font-size: 13px; font-weight: 500; color: #CBD5E1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.counselor-role { font-size: 11px; color: #475569; }

.logout-btn {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  border: none; background: none; cursor: pointer;
  color: #475569; border-radius: 6px;
  transition: background .12s, color .12s;
  flex-shrink: 0;
}
.logout-btn:hover { background: rgba(239,68,68,0.15); color: #F87171; }
.logout-btn svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }

/* Main content */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Mobile top bar */
.topbar {
  display: none;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 90;
}

.menu-btn {
  border: none; background: none; cursor: pointer; padding: 6px;
  color: var(--text); border-radius: 6px;
}
.menu-btn svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }

.topbar-title { flex: 1; font-size: 15px; font-weight: 600; text-align: center; }

/* Page */
.page { padding: 32px 36px; max-width: 1100px; }

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

.page-title { font-size: 22px; font-weight: 600; letter-spacing: -.4px; color: var(--text); }
.page-subtitle { font-size: 14px; color: var(--text-2); margin-top: 3px; }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-family: var(--font); font-size: 14px; font-weight: 500;
  cursor: pointer; border: none; transition: all .12s;
  white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #EA6C0A; }

.btn-outline {
  background: var(--bg-white); color: var(--text);
  border: 1px solid var(--border-2);
}
.btn-outline:hover { background: var(--bg); border-color: var(--border-2); }

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

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

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ── Stat cards ───────────────────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}

.stat-label { font-size: 12px; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; font-weight: 500; margin-bottom: 6px; }
.stat-value { font-size: 26px; font-weight: 600; letter-spacing: -.5px; color: var(--text); }
.stat-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* ── Session table / cards ────────────────────────────────────────────────── */
.card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

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

.card-title { font-size: 15px; font-weight: 600; }

/* Table */
.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }

th {
  text-align: left; font-size: 11px; font-weight: 600;
  color: var(--text-3); text-transform: uppercase; letter-spacing: .06em;
  padding: 11px 20px; background: #F8F7F4;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 14px 20px;
  font-size: 14px; color: var(--text);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

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

tbody tr { transition: background .1s; cursor: pointer; }
tbody tr:hover { background: #FAFAF8; }

.teacher-name { font-weight: 500; color: var(--text); }
.teacher-meta { font-size: 12px; color: var(--text-3); margin-top: 1px; }

/* Badges */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 9px; border-radius: 20px;
  font-size: 11px; font-weight: 500; white-space: nowrap;
}

.badge-orange  { background: var(--accent-soft); color: #C2410C; border: 1px solid var(--accent-border); }
.badge-green   { background: var(--success-soft); color: #065F46; border: 1px solid #A7F3D0; }
.badge-blue    { background: var(--info-soft); color: #1E40AF; border: 1px solid #BFDBFE; }
.badge-yellow  { background: var(--warning-soft); color: #92400E; border: 1px solid #FDE68A; }
.badge-gray    { background: #F1F5F9; color: #475569; border: 1px solid var(--border); }
.badge-red     { background: var(--danger-soft); color: #991B1B; border: 1px solid #FECACA; }

/* BANT score bar */
.bant-bar { display: flex; gap: 3px; }
.bant-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); }
.bant-dot.filled { background: var(--accent); }

/* Empty state */
.empty-state {
  text-align: center; padding: 60px 24px;
}
.empty-icon { font-size: 40px; margin-bottom: 12px; opacity: .4; }
.empty-title { font-size: 16px; font-weight: 500; color: var(--text-2); margin-bottom: 6px; }
.empty-sub { font-size: 13px; color: var(--text-3); margin-bottom: 20px; }

/* Loading */
.loading {
  text-align: center; padding: 40px;
  color: var(--text-3); font-size: 14px;
}

/* ── Form ─────────────────────────────────────────────────────────────────── */
.form-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  box-shadow: var(--shadow-sm);
  max-width: 760px;
}

.form-section { margin-bottom: 32px; }
.form-section-title {
  font-size: 13px; font-weight: 600; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .07em;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

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

.form-row.single { grid-template-columns: 1fr; }
.form-row.triple { grid-template-columns: 1fr 1fr 1fr; }

.field { display: flex; flex-direction: column; gap: 6px; }

label {
  font-size: 13px; font-weight: 500; color: var(--text-2);
  display: flex; align-items: center; gap: 4px;
}

label .req { color: var(--accent); font-size: 12px; }

input[type="text"],
input[type="number"],
input[type="email"],
input[type="tel"],
select,
textarea {
  width: 100%; padding: 9px 12px;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font); font-size: 14px;
  color: var(--text);
  outline: none;
  transition: border-color .15s;
  appearance: none;
}

input::placeholder, textarea::placeholder { color: var(--text-3); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(249,115,22,0.08); }

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}

textarea { resize: vertical; min-height: 90px; line-height: 1.5; }

/* BANT sliders */
.bant-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.bant-field { display: flex; flex-direction: column; gap: 8px; }
.bant-label { font-size: 13px; font-weight: 500; color: var(--text-2); display: flex; justify-content: space-between; }
.bant-label span { font-weight: 600; color: var(--accent); }

input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 5px;
  background: var(--border);
  border-radius: 3px; outline: none;
  border: none; padding: 0; box-shadow: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  background: var(--accent);
  border-radius: 50%; cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(249,115,22,.4);
  transition: transform .1s;
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.15); }

.bant-desc { font-size: 11px; color: var(--text-3); }

/* Form actions */
.form-actions {
  display: flex; align-items: center; gap: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}

/* ── Session detail view ──────────────────────────────────────────────────── */
.detail-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-top: 4px;
}

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

.profile-card h3 {
  font-size: 13px; font-weight: 600; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .07em;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.profile-row {
  display: flex; align-items: flex-start;
  padding: 8px 0;
  border-bottom: 1px solid #F1F5F9;
  gap: 12px;
}

.profile-row:last-child { border-bottom: none; }

.profile-key {
  font-size: 12px; color: var(--text-3); font-weight: 500;
  min-width: 140px; flex-shrink: 0; padding-top: 1px;
}

.profile-val { font-size: 14px; color: var(--text); line-height: 1.5; }

/* Stage progress */
.stage-bar {
  display: flex; gap: 0;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
  align-items: center;
}

.stage-step {
  display: flex; flex-direction: column; align-items: center;
  gap: 6px; flex: 1;
}

.stage-dot {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--bg-white);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; color: var(--text-3);
  position: relative; z-index: 1;
  transition: all .2s;
}

.stage-dot.done { background: var(--success); border-color: var(--success); color: #fff; }
.stage-dot.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.stage-label { font-size: 11px; color: var(--text-3); font-weight: 500; text-align: center; }
.stage-label.active { color: var(--accent); font-weight: 600; }

.stage-line { flex: 1; height: 2px; background: var(--border); margin-bottom: 18px; }
.stage-line.done { background: var(--success); }

/* Sidebar overlay on mobile */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 99;
}

/* ── Toast ────────────────────────────────────────────────────────────────── */
#toast {
  position: fixed; bottom: 24px; right: 24px;
  background: #1E293B; color: #F1F0ED;
  padding: 12px 18px; border-radius: var(--radius);
  font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow); z-index: 999;
  transform: translateY(80px); opacity: 0;
  transition: all .25s cubic-bezier(.34,1.56,.64,1);
  max-width: 320px;
}
#toast.show { transform: translateY(0); opacity: 1; }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.show { display: block; }
  .main { margin-left: 0; }
  .topbar { display: flex; }
  .page { padding: 20px 16px; }
  .form-row { grid-template-columns: 1fr; }
  .form-row.triple { grid-template-columns: 1fr; }
  .bant-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .form-card { padding: 20px 16px; }
}

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr; }
}

/* ── Search box ───────────────────────────────────────────────────────────── */
.search-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 260px;
}
.search-bar svg { width: 15px; height: 15px; stroke: var(--text-3); fill: none; stroke-width: 2; stroke-linecap: round; flex-shrink: 0; }
.search-bar input { border: none; background: none; font-family: var(--font); font-size: 14px; color: var(--text); outline: none; width: 100%; padding: 0; }
.search-bar input::placeholder { color: var(--text-3); }
