/* ============================================================
   RMKCET Parent Connect – Global Styles
   Dark glass-morphism theme
   ============================================================ */

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

:root {
  --bg-primary:   #0a0c14;
  --bg-secondary: #0f1219;
  --bg-card:      rgba(20, 30, 50, 0.65);
  --bg-card-hover:rgba(30, 42, 70, 0.75);
  --bg-input:     rgba(15, 20, 35, 0.8);
  --border:       rgba(102, 126, 234, 0.18);
  --border-light: rgba(255,255,255,0.06);

  --primary:    #667eea;
  --primary-d:  #5a6fd6;
  --secondary:  #764ba2;
  --accent:     #a78bfa;
  --success:    #25D366;
  --warning:    #f59e0b;
  --danger:     #ef4444;
  --info:       #3b82f6;

  --text:       #e2e8f0;
  --text-strong:#f8fafc;
  --text-dim:   #94a3b8;
  --text-muted: #64748b;

  --radius:     12px;
  --radius-sm:  8px;
  --radius-lg:  16px;
  --shadow:     0 8px 32px rgba(0,0,0,0.35);
  --transition: .25s ease;

  --sidebar-w:  260px;
  --sidebar-collapsed: 68px;
  --header-h:   64px;
}

html { font-size: 15px; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

body.light-theme {
  --bg-primary: #f5f7fb;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.95);
  --bg-card-hover: rgba(255, 255, 255, 1);
  --bg-input: #ffffff;
  --border: rgba(148, 163, 184, 0.35);
  --border-light: rgba(148, 163, 184, 0.22);
  --text: #0f172a;
  --text-strong: #020617;
  --text-dim: #334155;
  --text-muted: #64748b;
}

html.preload-light-theme {
  --bg-primary: #f5f7fb;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.95);
  --bg-card-hover: rgba(255, 255, 255, 1);
  --bg-input: #ffffff;
  --border: rgba(148, 163, 184, 0.35);
  --border-light: rgba(148, 163, 184, 0.22);
  --text: #0f172a;
  --text-strong: #020617;
  --text-dim: #334155;
  --text-muted: #64748b;
}

html.preload-light-theme body {
  background: var(--bg-primary);
  color: var(--text);
}

body.light-theme .sidebar {
  background: linear-gradient(180deg, #ffffff 0%, #eef3fb 100%);
}

body.light-theme .top-header {
  background: rgba(255, 255, 255, 0.85);
}

body.light-theme .logo-title,
body.light-theme .user-name,
body.light-theme .page-title,
body.light-theme .card-title,
body.light-theme .metric-value {
  color: var(--text);
}

body.light-theme .nav-link:hover,
body.light-theme .btn-outline:hover {
  color: var(--text);
}

body.light-theme .logout-btn:hover {
  color: #b91c1c;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--accent); }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 3px; }

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  position: fixed; left: 0; top: 0;
  width: var(--sidebar-w); height: 100vh;
  background: linear-gradient(180deg, rgba(15,18,25,.95) 0%, rgba(10,12,20,.98) 100%);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  z-index: 1000;
  transition: transform var(--transition);
  backdrop-filter: blur(24px);
}

.sidebar-header {
  display: flex; align-items: center; flex-direction: column;
  padding: 16px 12px; border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 3;
  background: inherit;
}
.sidebar-close {
  display: none;
  position: absolute;
  right: 8px;
  top: 8px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-dim);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
}
.sidebar-close:hover { color: var(--text); }
.logo-area { 
  display: flex; flex-direction: column; align-items: center; gap: 8px; 
  width: 100%;
}
.logo-image { 
  width: 190px;
  max-width: 190px;
  height: 130px;
  min-height: 130px;
  max-height: 130px;
  background-image: url('../assets/shine-logo.png');
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  object-fit: contain;
  object-position: center;
  margin-bottom: 2px;
  display: block;
  flex-shrink: 0;
  transition: none !important;
}
.logo-text { 
  display: flex; flex-direction: column; line-height: 1.3; 
  text-align: center; width: 100%;
}
.logo-title { font-weight: 800; font-size: 1.05rem; color: var(--text-strong); }
.logo-subtitle-main { 
  font-size: .72rem; color: var(--text-dim); 
  font-weight: 500; text-align: center;
}

.sidebar-nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; margin-bottom: 4px;
  border-radius: var(--radius-sm);
  color: var(--text-dim); font-size: .9rem; font-weight: 500;
  transition: all var(--transition);
}
.nav-link:hover { background: rgba(102,126,234,.1); color: #fff; }
.nav-link.active { background: linear-gradient(135deg, var(--primary), var(--secondary)); color: #fff; }
.nav-link i { width: 20px; text-align: center; font-size: .95rem; }
.nav-link span { transition: opacity var(--transition), width var(--transition); white-space: nowrap; }

.sidebar-footer {
  padding: 14px 16px; border-top: 1px solid var(--border);
  position: sticky;
  bottom: 0;
  z-index: 3;
  background: inherit;
}
.user-info { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: grid; place-items: center; font-weight: 700; font-size: .95rem; color: #fff;
}
.user-details { display: flex; flex-direction: column; }
.user-name { font-size: .85rem; font-weight: 600; color: var(--text-strong); }
.user-role { font-size: .7rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 1px; }
.user-scope {
  margin-top: 2px;
  font-size: .68rem;
  color: var(--text-muted);
  line-height: 1.2;
  max-width: 190px;
  word-break: break-word;
}
.user-department-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 4px;
  max-width: 210px;
}
.user-department-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: .66rem;
  font-weight: 700;
  letter-spacing: .35px;
}
.user-department-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  display: inline-block;
}
.user-department-chip.is-active {
  background: rgba(37, 211, 102, .14);
  color: var(--success);
  border-color: rgba(37, 211, 102, .28);
}
.user-department-chip.is-active .user-department-dot {
  background: var(--success);
}
.user-department-chip.is-disabled {
  background: rgba(239, 68, 68, .14);
  color: var(--danger);
  border-color: rgba(239, 68, 68, .3);
}
.user-department-chip.is-disabled .user-department-dot {
  background: var(--danger);
}
.logout-btn {
  display: block; text-align: center; padding: 9px;
  border-radius: var(--radius-sm);
  background: rgba(239,68,68,.12); color: var(--danger);
  font-size: .82rem; font-weight: 600;
  transition: all var(--transition);
}
.logout-btn:hover { background: rgba(239,68,68,.25); color: #fca5a5; }

/* Sidebar Banner */
.sidebar-banner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px; 
  border-top: 1px solid var(--border);
  margin-top: auto;
}
.banner-image {
  max-width: 60%;
  height: auto;
  max-height: 40px;
  opacity: 0.85;
}
.banner-text {
  font-size: .7rem;
  color: var(--text-dim);
  font-weight: 600;
  text-align: center;
  line-height: 1.3;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition);
}
.login-layout {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
  background: radial-gradient(ellipse at 30% 20%, rgba(102,126,234,.12) 0%, transparent 60%),
              radial-gradient(ellipse at 70% 80%, rgba(118,75,162,.1) 0%, transparent 60%),
              var(--bg-primary);
  position: relative;
  overflow: hidden;
  isolation: isolate;
  --login-triangle-span: 52vw;
  --login-triangle-tip: 50vw;
}

.login-layout::before {
  content: "";
  position: absolute;
  left: 0;
  top: -12vh;
  width: var(--login-triangle-span);
  height: 124vh;
  background-image: url('../assets/login.jpg');
  background-size: cover;
  background-position: 32% center;
  clip-path: polygon(0 0, 0 100%, var(--login-triangle-tip) 50%);
  opacity: .86;
  z-index: 0;
  pointer-events: none;
}

.login-layout::after {
  content: "";
  position: absolute;
  right: 0;
  top: -12vh;
  width: var(--login-triangle-span);
  height: 124vh;
  background-image: url('../assets/login.jpg');
  background-size: cover;
  background-position: 68% center;
  clip-path: polygon(100% 0, 100% 100%, calc(var(--login-triangle-span) - var(--login-triangle-tip)) 50%);
  opacity: .86;
  z-index: 0;
  pointer-events: none;
}

/* ---------- Header ---------- */
.top-header {
  height: var(--header-h);
  display: flex; align-items: center; gap: 16px;
  padding: 0 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(15,18,25,.6);
  backdrop-filter: blur(16px);
  position: sticky; top: 0; z-index: 100;
}
.mobile-toggle { display: none; background: none; border: none; color: var(--text-dim); font-size: 1.2rem; cursor: pointer; }
.page-title { font-size: 1.25rem; font-weight: 700; color: var(--text-strong); }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.header-badge {
  font-size: .78rem; padding: 5px 12px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 20px; color: var(--text-dim);
}

/* Icon group for theme/settings */
.icon-group {
  display: flex; gap: 8px; align-items: center;
}
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px 12px;
  font-size: .8rem;
}
.icon-btn span {
  white-space: nowrap;
}

.smtp-status-btn.smtp-ready {
  border-color: rgba(34,197,94,.45);
  color: #22c55e;
}

.smtp-status-btn.smtp-error,
.smtp-status-btn.smtp-missing {
  border-color: rgba(239,68,68,.45);
  color: #f87171;
}

.smtp-status-btn.smtp-test,
.smtp-status-btn.smtp-unknown {
  border-color: rgba(59,130,246,.45);
  color: #60a5fa;
}

/* Search suggestions dropdown */
.search-suggestions {
  position: absolute; top: 100%; left: 0; right: 0;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); margin-top: 4px;
  list-style: none; z-index: 10;
  max-height: 200px; overflow-y: auto;
}
.search-suggestions li {
  padding: 10px 12px; cursor: pointer; font-size: .85rem;
  transition: background var(--transition);
}
.search-suggestions li:hover {
  background: rgba(102, 126, 234, 0.15);
}

.global-action-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.filter-tray {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 8px;
  padding: 10px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: rgba(102, 126, 234, 0.06);
}

/* ---------- Content ---------- */
.content-area { padding: 24px 28px; flex: 1; }

/* ============================================================
   FLASH MESSAGES
   ============================================================ */
.flash-container { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.flash {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: var(--radius-sm);
  font-size: .88rem; font-weight: 500;
  animation: slideIn .3s ease;
}
.flash-success { background: rgba(37,211,102,.12); border: 1px solid rgba(37,211,102,.25); color: var(--success); }
.flash-error   { background: rgba(239,68,68,.12);  border: 1px solid rgba(239,68,68,.25);  color: var(--danger); }
.flash-warning { background: rgba(245,158,11,.12); border: 1px solid rgba(245,158,11,.25); color: var(--warning); }
.flash-info    { background: rgba(59,130,246,.12);  border: 1px solid rgba(59,130,246,.25); color: var(--info); }
.flash-close { background: none; border: none; color: inherit; opacity: .6; cursor: pointer; margin-left: auto; }
.flash-close:hover { opacity: 1; }

@keyframes slideIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ============================================================
   CARDS & GLASS
   ============================================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(12px);
  padding: 20px;
  transition: all var(--transition);
  animation: cardFadeIn .4s ease-out backwards;
}
.card:nth-child(1) { animation-delay: 0s; }
.card:nth-child(2) { animation-delay: .05s; }
.card:nth-child(3) { animation-delay: .1s; }
.card:nth-child(4) { animation-delay: .15s; }
.card:nth-child(5) { animation-delay: .2s; }
.card:hover { border-color: rgba(102,126,234,.3); transform: translateY(-2px); }
.card-title {
  font-size: 1rem; font-weight: 700; color: var(--text-strong);
  margin-bottom: 12px; display: flex; align-items: center; gap: 8px;
}

@keyframes cardFadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ------ metric cards ------ */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px; margin-bottom: 24px;
}
.metric-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  backdrop-filter: blur(12px);
  position: relative; overflow: hidden;
  animation: metricSlideIn .5s ease-out backwards;
  transition: transform var(--transition), border-color var(--transition);
}
.metric-card:nth-child(1) { animation-delay: .1s; }
.metric-card:nth-child(2) { animation-delay: .2s; }
.metric-card:nth-child(3) { animation-delay: .3s; }
.metric-card:nth-child(4) { animation-delay: .4s; }
.metric-card:hover { transform: translateY(-3px); border-color: var(--primary); }

@keyframes metricSlideIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.metric-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
}
.metric-label { font-size: .78rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px; }
.metric-value { font-size: 1.8rem; font-weight: 800; color: var(--text-strong); }
.metric-icon { position: absolute; right: 18px; top: 50%; transform: translateY(-50%); font-size: 2.2rem; opacity: .12; color: var(--primary); }

/* ============================================================
   TABS
   ============================================================ */
.tabs {
  display: flex; gap: 4px; flex-wrap: wrap;
  padding: 4px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius);
  margin-bottom: 24px;
}
.tab-btn {
  padding: 10px 18px; border: none; background: none;
  color: var(--text-dim); font-family: inherit; font-size: .85rem; font-weight: 600;
  border-radius: var(--radius-sm); cursor: pointer;
  transition: all var(--transition);
}
.tab-btn:hover { color: #fff; background: rgba(255,255,255,.05); }
.tab-btn.active {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff; box-shadow: 0 4px 12px rgba(102,126,234,.35);
}
.tab-panel { display: none; opacity: 0; transform: translateY(8px); }
.tab-panel.active { 
  display: block; 
  animation: tabFadeIn .35s ease forwards;
}
@keyframes tabFadeIn { 
  0% { opacity: 0; transform: translateY(8px); } 
  100% { opacity: 1; transform: translateY(0); } 
}

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block; margin-bottom: 6px; font-size: .82rem;
  font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: .5px;
}
.form-control {
  width: 100%; padding: 10px 14px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-family: inherit; font-size: .9rem;
  transition: border-color var(--transition);
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(102,126,234,.15); }
.form-control::placeholder { color: var(--text-muted); }

/* Keep browser autofill colors aligned with active theme (dark/light). */
input.form-control:-webkit-autofill,
input.form-control:-webkit-autofill:hover,
input.form-control:-webkit-autofill:focus,
textarea.form-control:-webkit-autofill,
select.form-control:-webkit-autofill {
  -webkit-text-fill-color: var(--text) !important;
  caret-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px var(--bg-input) inset !important;
  box-shadow: 0 0 0 1000px var(--bg-input) inset !important;
  border: 1px solid var(--border) !important;
  transition: background-color 9999s ease-in-out 0s;
}

input.form-control:-moz-autofill,
textarea.form-control:-moz-autofill,
select.form-control:-moz-autofill {
  box-shadow: 0 0 0 1000px var(--bg-input) inset !important;
  -moz-text-fill-color: var(--text) !important;
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
}

select.form-control { appearance: none; 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'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
select.form-control option { background: #1a1f2e; color: var(--text); }
body.light-theme select.form-control option { background: #ffffff; color: #0f172a; }

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

.form-check { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.form-check input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  width: 46px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(148, 163, 184, 0.25);
  position: relative;
  cursor: pointer;
  transition: background-color .2s ease, border-color .2s ease, opacity .2s ease;
  flex-shrink: 0;
}
.form-check input[type="checkbox"]::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  top: 2px;
  left: 2px;
  box-shadow: 0 2px 5px rgba(15, 23, 42, 0.35);
  transition: transform .2s ease;
}
.form-check input[type="checkbox"]:checked {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-color: transparent;
}
.form-check input[type="checkbox"]:checked::after {
  transform: translateX(20px);
}
.form-check input[type="checkbox"]:disabled {
  opacity: .55;
  cursor: not-allowed;
}
.form-check label { font-size: .88rem; color: var(--text); cursor: pointer; }

.tutorial-toggle-group {
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: rgba(102,126,234,.04);
}

.tutorial-toggle-group.is-disabled {
  opacity: .55;
}

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

/* file input */
.file-input-wrapper {
  position: relative; padding: 24px; text-align: center;
  border: 2px dashed var(--border); border-radius: var(--radius);
  background: rgba(102,126,234,.04); cursor: pointer;
  transition: all var(--transition);
}
.file-input-wrapper:hover { border-color: var(--primary); background: rgba(102,126,234,.08); }
.file-input-wrapper input[type="file"] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer;
}
.file-input-wrapper i { font-size: 2rem; color: var(--primary); margin-bottom: 8px; display: block; }
.file-input-wrapper .file-text { font-size: .85rem; color: var(--text-dim); }
.file-input-wrapper .file-name { margin-top: 6px; font-size: .82rem; color: var(--success); font-weight: 600; display: none; }

.scope-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.scope-item {
  border: 1px solid var(--border);
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 8px;
}

.scope-item-title {
  font-size: .78rem;
  font-weight: 700;
  color: var(--text-strong);
  margin-bottom: 6px;
}

.scope-year-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.scope-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: .72rem;
  color: var(--text-dim);
  cursor: pointer;
}

.scope-chip input[type="checkbox"] {
  width: 14px;
  height: 14px;
  margin: 0;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 10px 20px; border: none;
  border-radius: var(--radius-sm); font-family: inherit;
  font-size: .88rem; font-weight: 600; cursor: pointer;
  transition: all var(--transition); text-decoration: none;
}
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--secondary)); color: #fff; }
.btn-primary:hover { box-shadow: 0 6px 20px rgba(102,126,234,.4); transform: translateY(-1px); color: #fff; }
.btn-success { background: rgba(37,211,102,.15); color: var(--success); border: 1px solid rgba(37,211,102,.3); }
.btn-success:hover { background: rgba(37,211,102,.25); color: var(--success); }
.btn-danger  { background: rgba(239,68,68,.15); color: var(--danger); border: 1px solid rgba(239,68,68,.3); }
.btn-danger:hover  { background: rgba(239,68,68,.25); color: var(--danger); }
.btn-warning { background: rgba(245,158,11,.15); color: var(--warning); border: 1px solid rgba(245,158,11,.3); }
.btn-warning:hover { background: rgba(245,158,11,.25); color: var(--warning); }
.btn-outline {
  background: transparent; color: var(--text-dim);
  border: 1px solid var(--border);
}
.btn-outline:hover { border-color: var(--primary); color: #fff; }
.btn-sm { padding: 6px 14px; font-size: .8rem; }
.btn-icon { padding: 8px 10px; }

.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* ============================================================
   TABLES
   ============================================================ */
.table-wrapper { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
table {
  width: 100%; border-collapse: collapse;
  font-size: .88rem;
}
thead th {
  padding: 12px 16px; text-align: left;
  background: rgba(102,126,234,.1);
  color: var(--text-dim); font-weight: 600; font-size: .78rem;
  text-transform: uppercase; letter-spacing: .5px;
  white-space: nowrap;
}
tbody td {
  padding: 11px 16px; border-top: 1px solid var(--border-light);
  color: var(--text);
}
tbody tr:hover { background: rgba(102,126,234,.04); }

#userTable thead th {
  padding: 14px 18px;
}

#userTable tbody td {
  padding: 14px 18px;
  vertical-align: middle;
}

#userTable tbody tr {
  transition: background-color var(--transition);
}

#userTable tbody tr:hover {
  background: rgba(102, 126, 234, 0.09);
}

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px;
  font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
}
.badge-success { background: rgba(37,211,102,.15); color: var(--success); }
.badge-danger  { background: rgba(239,68,68,.15);  color: var(--danger); }
.badge-warning { background: rgba(245,158,11,.15); color: var(--warning); }
.badge-info    { background: rgba(59,130,246,.15);  color: var(--info); }
.badge-primary { background: rgba(102,126,234,.15); color: var(--primary); }
.badge-muted   { background: rgba(100,116,139,.15); color: var(--text-muted); }

.badge-role-admin {
  background: rgba(59,130,246,.18);
  color: #60a5fa;
}

.badge-role-chief {
  background: rgba(168,85,247,.18);
  color: #c084fc;
}

.badge-role-counselor {
  background: rgba(6,182,212,.18);
  color: #22d3ee;
}

.btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.global-footer {
  position: sticky;
  bottom: 0;
  z-index: 80;
  background: linear-gradient(90deg, rgba(15,18,25,.95), rgba(10,12,20,.95));
  border-top: 1px solid var(--border);
  backdrop-filter: blur(12px);
}

body.light-theme .global-footer {
  background: linear-gradient(90deg, rgba(255,255,255,.96), rgba(241,245,249,.96));
}

.global-footer-inner {
  min-height: 72px;
  padding: 12px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.global-footer-left {
  display: flex;
  align-items: center;
  gap: 18px;
}

.global-footer-banner-image {
  max-height: 60px;
  width: auto;
  display: block;
  transform: scale(1.32);
  transform-origin: left center;
  opacity: .88;
}

body.light-theme .global-footer-banner-image {
  opacity: 1;
}

.global-footer-text {
  font-size: .76rem;
  color: var(--text-dim);
  font-weight: 600;
}

.global-footer-links {
  display: flex;
  align-items: center;
  gap: 12px;
}

.global-footer-link {
  color: var(--text-dim);
  font-size: .76rem;
  font-weight: 600;
  border: none;
  background: transparent;
  cursor: pointer;
}

.global-footer-link:hover {
  color: var(--text);
}

.global-footer-btn {
  font-family: inherit;
  padding: 0;
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-box {
  width: 100%; max-width: 420px; padding: 40px 36px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
  position: relative;
  z-index: 2;
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo-image {
  width: 76px;
  height: auto;
  margin: 0 auto 10px;
  display: block;
}

.login-banner-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,.08);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 8px 12px;
  margin: 0 auto 12px;
}

.login-banner-image {
  width: min(100%, 280px);
  height: auto;
  margin: 0;
  display: block;
}

body.light-theme .login-banner-wrap {
  background: rgba(255,255,255,.95);
  border: 1px solid rgba(148,163,184,.3);
}
.login-logo h2 { font-size: 1.4rem; font-weight: 800; color: var(--text-strong); }
.login-logo p { font-size: .82rem; color: var(--text-dim); margin-top: 4px; }
.login-box .btn-primary { width: 100%; justify-content: center; padding: 12px; font-size: .95rem; }

/* ============================================================
   USER CARDS (Admin)
   ============================================================ */
.user-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.user-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px;
  backdrop-filter: blur(12px); transition: all var(--transition);
}
.user-card:hover { border-color: rgba(102,126,234,.3); transform: translateY(-2px); box-shadow: var(--shadow); }
.user-card-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.user-card-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: grid; place-items: center; font-weight: 700; font-size: 1.1rem; color: #fff;
  flex-shrink: 0;
}
.user-card-info h3 { font-size: .95rem; font-weight: 700; color: var(--text-strong); }
.user-card-info p { font-size: .78rem; color: var(--text-dim); }
.user-card-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.user-card-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ============================================================
   ACTIVITY CARDS
   ============================================================ */
.activity-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  margin-bottom: 16px;
}
.activity-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; margin: 14px 0; }
.activity-stat {
  text-align: center; padding: 10px;
  background: rgba(255,255,255,.02); border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}
.activity-stat .num { font-size: 1.3rem; font-weight: 800; color: var(--text-strong); }
.activity-stat .lbl { font-size: .7rem; color: var(--text-dim); text-transform: uppercase; }

.progress-bar-outer {
  height: 6px; background: rgba(255,255,255,.08);
  border-radius: 3px; margin-top: 10px; overflow: hidden;
}
.progress-bar-inner {
  height: 100%; border-radius: 3px;
  background: linear-gradient(90deg, var(--primary), var(--success));
  transition: width .6s ease;
}

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.6); backdrop-filter: blur(4px);
  z-index: 2000;
  align-items: flex-start;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
}
.modal-overlay.open { display: grid; }
.modal {
  width: 90%; max-width: 560px; max-height: 90vh; overflow-y: auto;
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 28px;
  font-size: .92rem;
  line-height: 1.45;
  box-shadow: 0 24px 48px rgba(0,0,0,.5);
  animation: modalIn .25s ease;
}
.modal .card {
  line-height: 1.45;
}
.modal .card > div {
  white-space: normal;
  overflow-wrap: anywhere;
}
@keyframes modalIn { from { opacity: 0; transform: scale(.95); } }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-header h3 { font-size: 1.1rem; font-weight: 700; color: var(--text-strong); }
.modal-close { background: none; border: none; color: var(--text-dim); font-size: 1.2rem; cursor: pointer; }
.modal-close:hover { color: var(--text-strong); }

/* ============================================================
   GUIDED TUTORIAL
   ============================================================ */
.tutorial-overlay {
  position: fixed;
  inset: 0;
  z-index: 2600;
  display: none;
  pointer-events: none;
}

.tutorial-overlay.open {
  display: block;
  touch-action: manipulation;
}

.tutorial-overlay.welcome-mode {
  pointer-events: auto;
}

.tutorial-overlay-backdrop {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 20% 15%, rgba(37, 99, 235, 0.22), rgba(2, 6, 23, 0.82));
  backdrop-filter: blur(0);
  -webkit-backdrop-filter: blur(0);
  pointer-events: none;
}

.tutorial-overlay.welcome-mode .tutorial-overlay-backdrop {
  pointer-events: auto;
}

body.light-theme .tutorial-overlay-backdrop {
  background: radial-gradient(circle at 20% 15%, rgba(59, 130, 246, 0.2), rgba(15, 23, 42, 0.5));
}

.tutorial-overlay.spotlight-active .tutorial-overlay-backdrop {
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.tutorial-highlight {
  position: fixed;
  border-radius: 12px;
  border: none;
  background: transparent;
  box-shadow: 0 0 0 9999px rgba(2, 6, 23, 0.62);
  pointer-events: none;
  z-index: 2601;
  display: none;
}

body.light-theme .tutorial-highlight {
  box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.35);
}

.tutorial-spotlight-target {
  position: relative !important;
  z-index: 2603 !important;
  opacity: 1 !important;
  filter: none !important;
  pointer-events: auto !important;
  outline: none !important;
  box-shadow: none !important;
}

.tutorial-spotlight-target.tutorial-clickable {
  animation: none;
}

body.light-theme .tutorial-spotlight-target {
  outline: none !important;
  box-shadow: none !important;
}

.tutorial-card {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: min(520px, calc(100vw - 30px));
  max-height: calc(100vh - 36px);
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  border: 1px solid rgba(148, 163, 184, 0.45);
  border-radius: var(--radius);
  background: linear-gradient(165deg, rgba(15, 23, 42, 0.97), rgba(30, 58, 138, 0.93));
  box-shadow: 0 26px 54px rgba(2, 6, 23, 0.62), inset 0 0 0 1px rgba(191, 219, 254, 0.16);
  backdrop-filter: blur(6px);
  z-index: 2602;
  pointer-events: auto;
  padding: 18px 20px;
}

body.light-theme .tutorial-card {
  border-color: rgba(37, 99, 235, 0.35);
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.98), rgba(239, 246, 255, 0.97));
  box-shadow: 0 22px 46px rgba(15, 23, 42, 0.24), inset 0 0 0 1px rgba(96, 165, 250, 0.28);
}

.tutorial-overlay.welcome-mode .tutorial-card {
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  width: min(760px, calc(100vw - 40px));
  bottom: 24px;
  padding: 22px 24px;
}

.tutorial-overlay.welcome-mode .tutorial-card-title {
  font-size: 1.22rem;
}

.tutorial-overlay.welcome-mode .tutorial-card-text {
  font-size: .96rem;
  line-height: 1.65;
}

.tutorial-card-title {
  margin: 0;
  color: #f8fafc;
  font-size: 1.1rem;
  font-weight: 700;
}

.tutorial-card-text {
  margin: 10px 0;
  font-size: .98rem;
  color: #e2e8f0;
  line-height: 1.72;
}

.tutorial-card-meta {
  margin: 0;
  color: #bfdbfe;
  font-size: .86rem;
  font-weight: 600;
}

body.light-theme .tutorial-card-title {
  color: #0f172a;
}

body.light-theme .tutorial-card-text {
  color: #1e293b;
}

body.light-theme .tutorial-card-meta {
  color: #1d4ed8;
  font-weight: 600;
}

.tutorial-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.tutorial-actions .btn {
  flex: 0 0 auto;
  min-width: 116px;
}

.tutorial-actions .btn-primary {
  min-width: 150px;
}

@media (max-width: 768px) {
  .tutorial-card {
    right: 10px;
    left: 10px;
    width: auto;
    top: calc(var(--header-h) + env(safe-area-inset-top, 0px) + 8px);
    bottom: auto;
    max-height: calc(100dvh - var(--header-h) - env(safe-area-inset-top, 0px) - 22px);
    overflow: auto;
    border-radius: 14px;
    padding: 14px;
  }

  .tutorial-overlay.welcome-mode .tutorial-card {
    left: 10px;
    right: 10px;
    transform: none;
    width: auto;
    top: calc(var(--header-h) + env(safe-area-inset-top, 0px) + 8px);
    bottom: auto;
    padding: 18px;
  }

  .tutorial-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .tutorial-actions .btn {
    width: 100%;
    min-width: 0;
  }

  .tutorial-highlight {
    border-radius: 10px;
  }
}

@media (max-width: 480px) {
  .tutorial-card {
    top: calc(var(--header-h) + env(safe-area-inset-top, 0px) + 6px);
    bottom: auto;
    max-height: calc(100dvh - var(--header-h) - env(safe-area-inset-top, 0px) - 14px);
  }

  .tutorial-actions {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   STUDENT TABLE (Counselor)
   ============================================================ */
.student-row { cursor: default; }
.student-row td:first-child { font-weight: 600; color: var(--primary); }

/* ============================================================
   REPORT CARDS
   ============================================================ */
.report-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; margin-bottom: 12px;
}
.report-card h4 { font-size: .95rem; font-weight: 700; color: var(--text-strong); margin-bottom: 6px; }
.report-marks { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.mark-chip {
  padding: 4px 12px; background: rgba(102,126,234,.1);
  border: 1px solid var(--border); border-radius: 20px;
  font-size: .8rem; color: var(--text);
}

.counselor-insights-stack {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.counselor-insight-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.student-performance-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.student-performance-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  padding: 10px 12px;
}

.student-performance-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.student-performance-name {
  font-weight: 700;
  color: var(--text-strong);
}

.student-performance-gpa {
  font-size: .82rem;
  font-weight: 700;
  color: var(--primary);
}

.student-performance-submarks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.student-performance-submarks .mark-chip {
  background: var(--bg-input);
  border-color: var(--border);
  padding: 3px 10px;
  font-size: .76rem;
}

.wa-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; background: rgba(37,211,102,.15);
  border: 1px solid rgba(37,211,102,.3); border-radius: var(--radius-sm);
  color: var(--success); font-weight: 600; font-size: .85rem;
  text-decoration: none; transition: all var(--transition);
}
.wa-btn:hover { background: rgba(37,211,102,.3); color: var(--success); }

.wa-preview {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: linear-gradient(180deg, rgba(16, 28, 22, 0.95), rgba(18, 20, 30, 0.95));
}

.wa-chat-header {
  padding: 10px 12px;
  font-size: .82rem;
  font-weight: 700;
  color: #dcf8c6;
  border-bottom: 1px solid rgba(255,255,255,.08);
  background: rgba(0,0,0,.18);
}

.wa-preview textarea.form-control {
  border: none;
  border-radius: 0;
  background: rgba(17, 27, 33, 0.85);
  color: #e6ffec;
  min-height: 240px;
  font-family: inherit;
}

.wa-preview textarea.form-control:focus {
  box-shadow: none;
  border: none;
}

/* ============================================================
   SESSION MONITORING
   ============================================================ */
.logout-reasons-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.reason-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-input);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.reason-name {
  font-size: 0.9rem;
  color: var(--text);
}

.reason-count {
  font-size: 0.85rem;
}

/* Configuration Preview */
.theme-preview {
  animation: gradientShift 3s ease infinite;
  background-size: 200% 200%;
}

@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.color-preview {
  font-family: monospace;
  font-size: 0.85rem;
  min-width: 90px;
  text-align: center;
}

/* Session Conflict Alert */
.session-conflict-alert {
  margin-top: 12px;
}

/* Activity Progress Bar */
.progress-bar-outer {
  width: 100%;
  height: 8px;
  background: var(--bg-input);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 12px;
}

.progress-bar-inner {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 4px;
  transition: width 0.5s ease;
}

/* Activity Stats Grid */
.activity-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 20px 0;
}

.activity-stat {
  text-align: center;
  padding: 16px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.activity-stat .num {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--primary);
}

.activity-stat .lbl {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 4px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  html.mobile-sidebar-open,
  body.mobile-sidebar-open {
    overflow: hidden;
  }

  body.mobile-sidebar-open .main-content {
    pointer-events: none;
  }

  body.mobile-sidebar-open .sidebar {
    pointer-events: auto;
  }

  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-w);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    max-height: 100dvh;
    overflow: hidden;
    transition: transform var(--transition);
    z-index: 2400;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: inline-flex; align-items: center; justify-content: center; }
  .sidebar-header { padding: 10px 12px 8px; }
  .logo-image { width: 156px; max-width: 156px; height: 92px; min-height: 92px; max-height: 92px; }
  .sidebar-nav { overflow-y: auto; min-height: 0; }
  .sidebar-footer {
    position: sticky;
    bottom: 0;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    z-index: 2;
  }
  .main-content { margin-left: 0; }
  .mobile-toggle { display: block; }
  .header-actions .icon-btn:not(.smtp-status-btn) {
    width: 36px;
    min-width: 36px;
    padding: 8px;
    justify-content: center;
  }
  .header-actions .icon-btn:not(.smtp-status-btn) span {
    display: none;
  }
  .form-row { grid-template-columns: 1fr; }
  .student-performance-item { padding: 10px; }
  .student-performance-main {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }
  .student-performance-gpa { font-size: .78rem; }
  .metrics-grid { grid-template-columns: 1fr 1fr; }
  .content-area { padding: 10px; }
  .card { padding: 14px; }
  .form-control { padding: 8px 10px; font-size: .84rem; }
  .btn { padding: 8px 12px; font-size: .8rem; }
  .metrics-grid { grid-template-columns: 1fr; gap: 10px; }
  thead th { padding: 8px 10px; font-size: .72rem; }
  tbody td { padding: 8px 10px; font-size: .8rem; }
  #userTable thead th { padding: 9px 10px; }
  #userTable tbody td { padding: 9px 10px; }
  .user-cards { grid-template-columns: 1fr; }
  .global-footer-inner { min-height: 64px; padding: 10px 16px; }
  .global-footer-banner-image { max-height: 51px; transform: scale(1.2); }
  .login-layout {
    --login-triangle-span: 74vw;
  }
  .login-layout::before,
  .login-layout::after {
    top: -6vh;
    height: 112vh;
    opacity: .48;
  }
  .login-layout::before {
    clip-path: polygon(0 0, 0 100%, var(--login-triangle-tip) 52%);
  }
  .login-layout::after {
    clip-path: polygon(100% 0, 100% 100%, calc(var(--login-triangle-span) - var(--login-triangle-tip)) 52%);
  }
  .login-box { max-width: min(92vw, 420px); }
  .login-banner-wrap { padding: 6px 10px; }
  .login-banner-image { width: min(100%, 230px); }
  .desktop-only { display: none !important; }
}

/* ============================================================
   MISC UTILITIES
   ============================================================ */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-muted   { color: var(--text-muted); }
.text-primary { color: var(--primary); }
.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; }
.gap-2 { gap: 16px; }
.d-flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-100 { width: 100%; }
.hidden { display: none !important; }

.empty-state {
  text-align: center; padding: 48px 24px; color: var(--text-dim);
}
.empty-state i { font-size: 3rem; margin-bottom: 12px; display: block; opacity: .3; }
.empty-state h3 { font-size: 1.1rem; color: var(--text-dim); margin-bottom: 6px; }
.empty-state p { font-size: .85rem; }

.section-title {
  font-size: 1.05rem; font-weight: 700; color: var(--text-strong);
  margin-bottom: 16px; display: flex; align-items: center; gap: 8px;
}

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

/* ---------- Color Configuration Grid ---------- */
.color-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}
.color-item {
  background: var(--bg-input);
  padding: 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.color-item .form-label {
  margin-bottom: 8px;
  font-size: .85rem;
  display: block;
}
.color-item small {
  display: block;
  font-size: .7rem;
  color: var(--text-muted);
  margin-top: 6px;
}
.color-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.color-input-row input[type="color"] {
  width: 50px;
  height: 36px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: transparent;
}
.color-input-row input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 2px;
}
.color-input-row input[type="color"]::-webkit-color-swatch {
  border-radius: 4px;
  border: none;
}
.color-hex {
  font-family: 'SF Mono', Monaco, 'Courier New', monospace;
  font-size: .8rem;
  color: var(--text-dim);
  background: rgba(0,0,0,.2);
  padding: 4px 8px;
  border-radius: 4px;
}
.status-preview {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
}

/* Collapsible sections */
.collapse-header {
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; padding: 12px 0;
}
.collapse-header:hover { color: #fff; }
.collapse-body { display: none; padding-top: 8px; }
.collapse-body.open { display: block; animation: fadeUp .2s ease; }

/* ============================================================
   CREDITS PAGE
   ============================================================ */
.credits-page {
  width: min(1240px, 100%);
  margin: 0 auto;
  padding: 8px 2px 18px;
}

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

.credits-page-kicker {
  text-transform: uppercase;
  letter-spacing: .11em;
  font-size: .72rem;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.credits-page-title {
  font-size: clamp(1.3rem, 2.2vw, 2rem);
  line-height: 1.2;
  color: var(--text-strong);
  margin-bottom: 6px;
}

.credits-page-subtitle {
  font-size: .9rem;
  color: var(--text-dim);
  max-width: 720px;
}

.credits-back-btn {
  white-space: nowrap;
  margin-top: 8px;
}

.credits-page-body {
  background:
    radial-gradient(circle at 12% 4%, rgba(102,126,234,.16), transparent 45%),
    radial-gradient(circle at 94% 84%, rgba(118,75,162,.12), transparent 40%),
    var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.credits-compiled-shell {
  padding: 22px;
}

.credits-compiled-header {
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
  padding-bottom: 12px;
}

.credits-compiled-title {
  color: var(--text-strong);
  font-size: clamp(1.1rem, 1.8vw, 1.5rem);
  margin-bottom: 4px;
}

.credits-compiled-subtitle,
.credits-compiled-generated {
  color: var(--text-dim);
  font-size: .82rem;
}

.credits-compiled-generated {
  margin-top: 3px;
}

.credits-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.credits-column {
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 12px;
}

.credits-column-title {
  color: var(--text-strong);
  font-size: .92rem;
  font-weight: 700;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.credits-column-empty {
  font-size: .85rem;
  color: var(--text-dim);
}

.credits-section-title {
  margin: 12px 0 8px;
  font-size: .78rem;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.credits-person-card {
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.02);
  margin-bottom: 8px;
}

.credits-person-name {
  color: var(--text-strong);
  font-size: .95rem;
  margin-bottom: 4px;
}

.credits-person-meta {
  color: var(--text-dim);
  font-size: .8rem;
  line-height: 1.4;
  margin-bottom: 8px;
}

.credits-person-list {
  margin-left: 18px;
  color: var(--text);
  display: grid;
  gap: 3px;
  font-size: .82rem;
  line-height: 1.4;
}

.credits-compiled-fallback {
  max-height: 62vh;
  overflow: auto;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text);
  white-space: pre-wrap;
  font: 500 .84rem/1.5 'JetBrains Mono', 'Fira Code', 'Consolas', 'Monaco', monospace;
}

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

  .credits-page-hero {
    flex-direction: column;
    align-items: stretch;
  }

  .credits-back-btn {
    align-self: flex-start;
    margin-top: 2px;
  }
}
