/* =============================================
   NOA — Design System
   Novo Education Internal Tool
   v2.0
   ============================================= */

:root {
  /* ── Brand ── */
  --primary:       #D4703A;
  --primary-dark:  #BE6230;
  --primary-light: #FDF0E8;
  --primary-ring:  rgba(212, 112, 58, 0.18);

  /* ── Microsoft SSO ── */
  --ms:      #0078D4;
  --ms-dark: #006CBE;

  /* ── Semantic ── */
  --success:        #22C55E;
  --success-bg:     #F0FDF4;
  --success-border: #BBF7D0;
  --success-text:   #166534;

  --error:        #EF4444;
  --error-bg:     #FEF2F2;
  --error-border: #FECACA;
  --error-text:   #991B1B;

  --warning:        #F59E0B;
  --warning-bg:     #FFFBEB;
  --warning-border: #FED7AA;
  --warning-text:   #92400E;

  /* ── Surfaces ── */
  --bg:      #FAFAFA;
  --bg-warm: #F5F3EF;
  --surface: #FFFFFF;

  /* ── Borders ── */
  --border:        #E6E0D8;
  --border-strong: #CEC7BB;

  /* ── Text ── */
  --text:   #1A1A1A;
  --text-2: #666666;
  --text-3: #9A9289;

  /* ── Shadows ── */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.03);
  --shadow:    0 2px 6px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 12px 28px rgba(0,0,0,0.10), 0 4px 8px rgba(0,0,0,0.05);
  --shadow-xl: 0 24px 56px rgba(0,0,0,0.12), 0 8px 20px rgba(0,0,0,0.06);

  /* ── Radius ── */
  --r-xs: 4px;
  --r-sm: 6px;
  --r:    8px;
  --r-md: 10px;
  --r-lg: 12px;
  --r-xl: 16px;

  /* ── Typography ── */
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

  /* ── Legacy aliases (backward-compat with inline CSS vars in HTML) ── */
  --primary-color:  #D4703A;
  --primary-hover:  #BE6230;
  --success-color:  #22C55E;
  --danger-color:   #EF4444;
  --bg-color:       #FAFAFA;
  --card-bg:        #FFFFFF;
  --text-primary:   #1A1A1A;
  --text-secondary: #666666;
  --border-color:   #E6E0D8;
  --text-color:     #1A1A1A;
}

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

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

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

/* ── Layout ── */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 24px;
}

/* =============================================
   HEADER / NAVIGATION
   ============================================= */

.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 56px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-xs);
  position: sticky;
  top: 0;
  z-index: 100;
}

/* Brand / Logo */
.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.header-logo {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.02em;
  line-height: 1;
}

.header-sep {
  width: 1px;
  height: 16px;
  background: var(--border);
  flex-shrink: 0;
}

.header-page-title {
  font-size: 0.875rem;
  color: var(--text-2);
  font-weight: 500;
}

/* Legacy support — h1 inside header */
.header > h1 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

/* Nav */
.header-nav {
  display: flex;
  gap: 2px;
  align-items: center;
}

.header-nav a {
  text-decoration: none;
  color: var(--text-2);
  padding: 6px 12px;
  border-radius: var(--r-sm);
  transition: background 0.15s, color 0.15s;
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
}

.header-nav a:hover {
  background: var(--bg-warm);
  color: var(--text);
}

.header-nav a.active {
  background: var(--primary-light);
  color: var(--primary);
}

/* User info */
.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 16px;
  border-left: 1px solid var(--border);
  flex-shrink: 0;
}

.user-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
}

.role-badge {
  font-size: 0.7rem;
  padding: 2px 7px;
  border-radius: 9999px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.role-badge.admin {
  background: var(--primary-light);
  color: var(--primary-dark);
}

.role-badge.staff {
  background: var(--bg-warm);
  color: var(--text-2);
}

.btn-logout {
  padding: 5px 12px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-2);
  transition: all 0.15s;
  font-family: var(--font);
}

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

/* =============================================
   CARDS & SECTIONS
   ============================================= */

.card {
  background: var(--surface);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 32px;
  margin-bottom: 24px;
}

.card h2 {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  margin-bottom: 6px;
}

.section {
  background: var(--surface);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 28px 32px;
  margin-bottom: 24px;
}

.section h2 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  letter-spacing: -0.01em;
}

/* =============================================
   FORMS
   ============================================= */

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

.form-group label {
  display: block;
  margin-bottom: 7px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  font-size: 0.9375rem;
  font-family: var(--font);
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-3);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}

.form-group textarea {
  resize: vertical;
  line-height: 1.6;
  min-height: 200px;
}

/* =============================================
   BUTTONS
   ============================================= */

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 11px 20px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--r);
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  letter-spacing: -0.01em;
}

.btn-primary:hover {
  background: var(--primary-dark);
  box-shadow: 0 2px 8px rgba(212, 112, 58, 0.3);
}

.btn-primary:active {
  transform: translateY(1px);
}

.btn-primary:disabled {
  background: var(--border-strong);
  color: white;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  background: var(--surface);
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: var(--font);
  transition: all 0.15s;
  text-align: center;
}

.btn-secondary:hover {
  background: var(--bg-warm);
  border-color: var(--border-strong);
}

/* Microsoft SSO button */
.btn-microsoft {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 11px 20px;
  background: #0078D4;
  color: white;
  border: none;
  border-radius: var(--r);
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
  letter-spacing: -0.01em;
}

.btn-microsoft:hover {
  background: #006CBE;
  box-shadow: 0 2px 8px rgba(0, 120, 212, 0.3);
}

.btn-microsoft:active {
  transform: translateY(1px);
}

.btn-microsoft svg {
  flex-shrink: 0;
}

/* =============================================
   ALERTS
   ============================================= */

.alert {
  padding: 11px 14px;
  border-radius: var(--r);
  margin-bottom: 20px;
  font-size: 0.875rem;
  line-height: 1.5;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.alert.error {
  background: var(--error-bg);
  color: var(--error-text);
  border: 1px solid var(--error-border);
}

.alert.warning {
  background: var(--warning-bg);
  color: var(--warning-text);
  border: 1px solid var(--warning-border);
}

.alert.success {
  background: var(--success-bg);
  color: var(--success-text);
  border: 1px solid var(--success-border);
}

/* =============================================
   LOGIN PAGE
   ============================================= */

.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: var(--bg-warm);
  padding: 24px;
}

.login-card {
  background: var(--surface);
  padding: 44px 40px 40px;
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 420px;
  border: 1px solid var(--border);
}

.login-brand {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  background: var(--primary);
  color: white;
  border-radius: var(--r-lg);
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 14px;
}

.login-brand h1 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 6px;
}

.login-brand .org-name {
  font-size: 0.85rem;
  color: var(--text-2);
  font-weight: 400;
}

/* SSO section */
.login-sso {
  margin-bottom: 24px;
}

/* Divider */
.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.login-divider span {
  font-size: 0.8rem;
  color: var(--text-3);
  white-space: nowrap;
  font-weight: 500;
}

.login-card h2 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
  letter-spacing: 0;
}

.login-footer {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.login-footer-note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  border-radius: var(--r);
  padding: 12px 14px;
}

.login-footer-note .note-icon {
  font-size: 0.9rem;
  flex-shrink: 0;
  margin-top: 1px;
}

.login-footer-note .note-text {
  font-size: 0.8rem;
  color: var(--warning-text);
  line-height: 1.5;
}

.login-footer-note .note-text strong {
  display: block;
  margin-bottom: 2px;
}

/* =============================================
   SOP REVIEW PAGE
   ============================================= */

.sop-review-container {
  max-width: 860px;
  margin: 0 auto;
}

/* File drop zone */
.file-drop-zone {
  position: relative;
  border: 2px dashed var(--border-strong);
  border-radius: var(--r-lg);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  background: var(--bg);
  margin-bottom: 8px;
}

.file-drop-zone:hover,
.file-drop-zone.drag-over {
  border-color: var(--primary);
  background: var(--primary-light);
}

.file-drop-zone:hover .drop-icon,
.file-drop-zone.drag-over .drop-icon {
  color: var(--primary);
}

.file-input-hidden {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
  font-size: 0;
}

.drop-icon {
  color: var(--text-3);
  margin-bottom: 12px;
  transition: color 0.2s;
}

.drop-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.drop-title span {
  color: var(--primary);
}

.drop-sub {
  font-size: 0.8125rem;
  color: var(--text-3);
}

.file-selected-badge {
  display: none;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  border-radius: var(--r-sm);
  padding: 6px 12px;
  font-size: 0.8125rem;
  color: var(--success-text);
  font-weight: 500;
}

.file-selected-badge.visible {
  display: inline-flex;
}

.word-count-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 7px;
  font-size: 0.8125rem;
  color: var(--text-3);
}

.word-count-row #word-count {
  font-weight: 600;
  color: var(--text-2);
}

/* Section divider label */
.section-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

/* Review results card */
.review-summary-card {
  background: var(--bg);
  border-left: 3px solid var(--primary);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  padding: 28px 28px 28px 28px;
}

.review-summary-header {
  margin-bottom: 20px;
}

.review-summary-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 5px 0;
  letter-spacing: -0.01em;
}

.review-summary-header p {
  font-size: 0.875rem;
  color: var(--text-2);
}

.review-summary-content {
  margin-bottom: 28px;
  line-height: 1.7;
  color: var(--text);
  font-size: 0.9375rem;
}

.review-summary-content p {
  margin: 0 0 14px 0;
}

.review-summary-content h4 {
  font-size: 0.9rem;
  font-weight: 600;
  margin: 20px 0 10px 0;
  color: var(--text);
}

.review-summary-content ul {
  margin: 0;
  padding-left: 20px;
}

.review-summary-content li {
  margin-bottom: 7px;
  line-height: 1.55;
}

.review-summary-actions {
  text-align: center;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.review-summary-actions .btn-primary {
  max-width: 280px;
  font-size: 0.9375rem;
  padding: 13px 24px;
}

.review-summary-actions p {
  margin-top: 10px;
  font-size: 0.8125rem;
  color: var(--text-3);
}

/* Loading section */
.loading-section-inner {
  padding: 64px 24px;
  text-align: center;
}

.spinner-wrap {
  position: relative;
  width: 52px;
  height: 52px;
  margin: 0 auto 20px;
}

.spinner {
  width: 52px;
  height: 52px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

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

.loading-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}

.loading-sub {
  font-size: 0.875rem;
  color: var(--text-2);
  margin-bottom: 24px;
}

.loading-bar {
  width: 220px;
  height: 3px;
  background: var(--border);
  border-radius: 9999px;
  margin: 0 auto;
  overflow: hidden;
}

.loading-bar::after {
  content: '';
  display: block;
  height: 100%;
  width: 45%;
  background: var(--primary);
  border-radius: 9999px;
  animation: loading-sweep 1.6s ease-in-out infinite;
}

@keyframes loading-sweep {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(600%); }
}

/* =============================================
   CHAT PAGE
   ============================================= */

.chat-container {
  display: flex;
  gap: 20px;
  height: calc(100vh - 56px - 56px);
  min-height: 480px;
}

.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
  min-width: 0;
}

/* Chat messages area */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
  width: 4px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 9999px;
}

/* Messages */
.message {
  max-width: 76%;
  display: flex;
  flex-direction: column;
}

.message.user {
  align-self: flex-end;
  align-items: flex-end;
}

.message.assistant {
  align-self: flex-start;
  align-items: flex-start;
}

.message-content {
  padding: 10px 15px;
  border-radius: var(--r-md);
  line-height: 1.55;
  font-size: 0.9375rem;
  word-break: break-word;
}

.message.user .message-content {
  background: var(--primary);
  color: white;
  border-bottom-right-radius: var(--r-xs);
}

.message.assistant .message-content {
  background: var(--bg-warm);
  color: var(--text);
  border: 1px solid var(--border);
  border-bottom-left-radius: var(--r-xs);
}

.message-meta {
  font-size: 0.7rem;
  color: var(--text-3);
  margin-top: 4px;
  padding: 0 4px;
}

/* Chat input */
.chat-input-container {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  align-items: flex-end;
  background: var(--surface);
}

.chat-input {
  flex: 1;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  font-size: 0.9375rem;
  resize: none;
  font-family: var(--font);
  color: var(--text);
  max-height: 120px;
  transition: border-color 0.15s, box-shadow 0.15s;
  line-height: 1.5;
}

.chat-input::placeholder {
  color: var(--text-3);
}

.chat-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}

.btn-send {
  padding: 10px 18px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--r);
  font-weight: 600;
  font-size: 0.875rem;
  font-family: var(--font);
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
  flex-shrink: 0;
  height: 42px;
}

.btn-send:hover {
  background: var(--primary-dark);
  box-shadow: 0 2px 8px rgba(212, 112, 58, 0.25);
}

.btn-send:disabled {
  background: var(--border-strong);
  cursor: not-allowed;
  box-shadow: none;
}

/* Chat sidebar */
.chat-sidebar {
  width: 260px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sidebar-card {
  background: var(--surface);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 20px;
}

.sidebar-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 12px;
}

.sidebar-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-actions .btn-secondary {
  justify-content: flex-start;
  font-size: 0.8125rem;
  padding: 8px 12px;
}

.sidebar-about {
  font-size: 0.8125rem;
  color: var(--text-2);
  line-height: 1.6;
}

.sidebar-about strong {
  color: var(--text);
  font-weight: 600;
}

/* Chat empty state */
.chat-empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 32px;
  text-align: center;
}

.chat-empty-logo {
  width: 52px;
  height: 52px;
  background: var(--primary-light);
  border-radius: var(--r-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.03em;
}

.chat-empty-state h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 7px;
  letter-spacing: -0.01em;
}

.chat-empty-state p {
  font-size: 0.875rem;
  color: var(--text-2);
  max-width: 280px;
  line-height: 1.55;
}

.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 20px;
}

.chat-suggestion-pill {
  font-size: 0.8125rem;
  color: var(--text-2);
  background: var(--bg-warm);
  border: 1px solid var(--border);
  border-radius: 9999px;
  padding: 5px 13px;
  cursor: pointer;
  transition: all 0.15s;
}

.chat-suggestion-pill:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

/* =============================================
   ADMIN PAGE
   ============================================= */

.admin-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Stats grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
}

.stat-card {
  background: var(--surface);
  padding: 24px 20px;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--primary);
  opacity: 0.7;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.04em;
  line-height: 1;
  margin-bottom: 6px;
}

.stat-label {
  font-size: 0.8125rem;
  color: var(--text-2);
  font-weight: 500;
}

/* Table */
.table {
  width: 100%;
  border-collapse: collapse;
}

.table th {
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  color: var(--text-3);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1.5px solid var(--border);
  white-space: nowrap;
}

.table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
  color: var(--text);
  vertical-align: middle;
}

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

.table tr:hover td {
  background: var(--bg);
}

.table .status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.table .status-badge.enabled {
  background: var(--success-bg);
  color: var(--success-text);
}

.table .status-badge.disabled {
  background: var(--error-bg);
  color: var(--error-text);
}

/* Admin notes */
.admin-notes {
  font-size: 0.875rem;
  color: var(--text-2);
  line-height: 1.7;
}

.admin-notes p { margin-bottom: 5px; }

.admin-notes ul {
  margin-left: 20px;
  margin-top: 8px;
}

.admin-notes li { margin-bottom: 4px; }

/* Quick actions */
.quick-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* =============================================
   AUDIT LOG PAGE
   ============================================= */

.audit-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.audit-filters {
  background: var(--surface);
  padding: 20px 24px;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex;
  gap: 14px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.filter-group {
  flex: 1;
  min-width: 180px;
}

.filter-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  font-size: 0.8125rem;
  color: var(--text-2);
}

.filter-group select,
.filter-group input {
  width: 100%;
  padding: 8px 11px;
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  font-size: 0.875rem;
  font-family: var(--font);
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
}

.filter-group select:focus,
.filter-group input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}

.audit-filter-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  align-items: flex-end;
  padding-bottom: 0;
}

.audit-filter-actions .btn-primary {
  width: auto;
  padding: 8px 18px;
  font-size: 0.875rem;
}

.audit-filter-actions .btn-secondary {
  padding: 8px 14px;
  font-size: 0.875rem;
}

/* Audit log list */
.audit-log {
  background: var(--surface);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.log-entry {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: 158px 160px 1fr 1fr;
  gap: 12px;
  align-items: center;
  transition: background 0.1s;
}

.log-entry:last-child {
  border-bottom: none;
}

.log-entry:hover {
  background: var(--bg);
}

.log-timestamp {
  color: var(--text-3);
  font-size: 0.78rem;
  font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
  white-space: nowrap;
}

.log-action {
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
}

.log-action.login_success    { color: var(--success); }
.log-action.login_failed     { color: var(--error); }
.log-action.logout           { color: var(--text-2); }
.log-action.unauthorized_admin_access { color: var(--error); }
.log-action.chat_message     { color: var(--primary); }
.log-action.user_toggled     { color: var(--warning); }

.log-user {
  font-size: 0.8125rem;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.log-details {
  font-size: 0.8125rem;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.audit-footer-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* =============================================
   EMPTY & LOADING STATES
   ============================================= */

.loading {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-2);
  font-size: 0.875rem;
}

.empty-state {
  text-align: center;
  padding: 64px 24px;
  color: var(--text-2);
}

.empty-state-icon {
  font-size: 2.5rem;
  margin-bottom: 14px;
  opacity: 0.6;
}

.empty-state h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 7px;
  color: var(--text);
  letter-spacing: -0.01em;
}

.empty-state p {
  font-size: 0.875rem;
  line-height: 1.55;
}

/* =============================================
   UTILITY
   ============================================= */

.text-secondary  { color: var(--text-2) !important; }
.text-muted      { color: var(--text-3) !important; }
.text-primary-c  { color: var(--primary) !important; }
.font-mono       { font-family: 'SF Mono', 'Cascadia Code', monospace; }

/* =============================================
   RESPONSIVE
   ============================================= */

@media (max-width: 900px) {
  .chat-container {
    flex-direction: column;
    height: auto;
  }

  .chat-sidebar {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .sidebar-card {
    flex: 1;
    min-width: 200px;
  }

  .log-entry {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  .log-details { grid-column: 1 / -1; }
}

@media (max-width: 768px) {
  .container {
    padding: 20px 16px;
  }

  .header {
    padding: 0 16px;
    gap: 8px;
  }

  .header-brand .header-sep,
  .header-brand .header-page-title {
    display: none;
  }

  .header-nav a {
    padding: 5px 9px;
    font-size: 0.8125rem;
  }

  .user-name {
    display: none;
  }

  .card,
  .section {
    padding: 20px;
  }

  .login-card {
    padding: 32px 24px 28px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .audit-filters {
    flex-direction: column;
  }

  .audit-filter-actions {
    width: 100%;
  }

  .audit-filter-actions .btn-primary,
  .audit-filter-actions .btn-secondary {
    flex: 1;
  }

  .log-entry {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

/* Hamburger button - hidden on desktop */
.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: var(--text);
}
.hamburger svg {
  width: 24px;
  height: 24px;
}

@media (max-width: 480px) {
  .hamburger {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .header {
    position: relative;
  }
  .header-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--card, #fff);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    flex-direction: column;
    padding: 8px 0;
    z-index: 100;
  }
  .header-nav.open {
    display: flex;
  }
  .header-nav a {
    padding: 12px 20px;
    border-bottom: 1px solid var(--border, #eee);
    font-size: 0.9375rem;
  }
  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }
  .message {
    max-width: 90%;
  }
}
