/* ============================================================
   ProStudy Sim Editor - Stylesheet
   Brand Theme with Dark Navy + Teal accent
   ============================================================ */

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

:root {
  /* ProStudy Brand */
  --brand-navy: #0D3B4C;
  --brand-navy-deep: #091F2C;
  --brand-navy-light: #112E3C;
  --brand-teal: #2D9596;
  --brand-teal-hover: #35ADAE;
  --brand-teal-dim: rgba(45, 149, 150, 0.15);
  --brand-green: #4ADE80;
  --brand-green-dim: rgba(74, 222, 128, 0.1);

  /* Surfaces */
  --bg-app: #091F2C;
  --bg-panel: #0D3B4C;
  --bg-card: #112E3C;
  --bg-input: #0A2F3D;
  --bg-hover: #153D4D;

  /* Text */
  --text-primary: #E8F1F2;
  --text-secondary: #8BA4AD;
  --text-muted: #5A7A85;

  /* Borders */
  --border-subtle: #1A4A5A;
  --border-accent: #2D9596;

  /* Status */
  --success: #4ADE80;
  --warning: #FBBF24;
  --error: #F87171;
  --info: #60A5FA;

  /* Legacy aliases for compatibility */
  --bg-deep: var(--bg-app);
  --accent: var(--brand-teal);
  --accent-hover: var(--brand-teal-hover);
  --text: var(--text-primary);
  --text-dim: var(--text-muted);
  --terminal-bg: var(--bg-app);
  --terminal-text: var(--brand-green);
  --bezel: #0A1F2A;
  --input-bg: var(--bg-input);
  --border: var(--border-subtle);

  /* Misc */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --phone-scale: 0.7;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
  --font-ui: 'Inter', 'Nunito', -apple-system, system-ui, sans-serif;
}

html, body {
  height: 100vh;
  overflow: hidden;
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-app);
  -webkit-font-smoothing: antialiased;
  margin: 0;
  padding: 0;
}

[x-cloak] {
  display: none !important;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 14px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-ui);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.97);
}

.btn:disabled {
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-primary {
  background: var(--brand-teal);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--brand-teal-hover);
  box-shadow: 0 0 12px rgba(45, 149, 150, 0.3);
}

.btn-full {
  width: 100%;
}

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

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

.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--brand-teal);
}

.btn-send {
  background: var(--brand-teal);
  color: #fff;
  padding: 10px 20px;
  min-width: 80px;
}

.btn-send:hover:not(:disabled) {
  background: var(--brand-teal-hover);
  box-shadow: 0 0 12px rgba(45, 149, 150, 0.3);
}

.btn-send:disabled {
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: not-allowed;
  box-shadow: none;
}

.btn-stop {
  background: var(--error);
  color: #fff;
  padding: 10px 16px;
}

.btn-stop:hover:not(:disabled) {
  background: #EF4444;
}


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

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-panel);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  box-shadow: var(--shadow-md), 0 0 40px rgba(45, 149, 150, 0.05);
  border: 1px solid var(--border-subtle);
}

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

.login-brand svg {
  margin-bottom: 16px;
}

.login-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.login-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
}

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

.login-form label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.login-form input {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font-ui);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.login-form input:focus {
  border-color: var(--brand-teal);
  box-shadow: 0 0 0 2px rgba(45, 149, 150, 0.15);
}

.login-error {
  color: var(--error);
  font-size: 13px;
  margin-bottom: 12px;
  text-align: center;
}

/* ---------- Editor Layout ---------- */
.editor-layout {
  display: grid;
  grid-template-rows: auto 1fr;
  height: 100vh;
  overflow: hidden;
}

/* ---------- Header ---------- */
.editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-subtle);
  gap: 12px;
  min-height: 48px;
  flex-shrink: 0;
}

.header-left {
  flex-shrink: 0;
}

.header-brand {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.header-center {
  flex: 1;
  max-width: 720px;
  margin: 0 auto;
}

.cascade-selectors {
  display: flex;
  align-items: center;
  gap: 4px;
}

.cascade-select {
  padding: 6px 24px 6px 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 12px;
  font-family: var(--font-ui);
  cursor: pointer;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='%238BA4AD'%3E%3Cpath d='M1 1l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
  min-width: 80px;
  max-width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: border-color 0.15s;
}

.cascade-select-wide {
  min-width: 120px;
  max-width: 200px;
}

.cascade-select:focus {
  border-color: var(--brand-teal);
  box-shadow: 0 0 0 2px rgba(45, 149, 150, 0.15);
}

.cascade-select:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.cascade-select option {
  background: var(--bg-panel);
  color: var(--text-primary);
}

.cascade-arrow {
  color: var(--text-muted);
  font-size: 16px;
  font-weight: 700;
  flex-shrink: 0;
  user-select: none;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.status-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}

.status-dot.dot-idle {
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
}

.status-dot.dot-working {
  background: var(--warning);
  animation: pulse-dot 1.5s ease-in-out infinite;
}

.status-dot.dot-queued {
  background: var(--warning);
  animation: pulse-dot 2s ease-in-out infinite;
}

.status-dot.dot-error,
.status-dot.dot-disconnected {
  background: var(--error);
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.status-text {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.session-counter {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  font-family: var(--font-mono);
  background: var(--bg-input);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}

/* ---------- Main 3-Column Grid ---------- */
.editor-main {
  display: grid;
  grid-template-columns: 38% 34% 28%;
  gap: 1px;
  background: var(--border-subtle);
  overflow: hidden;
  min-height: 0; /* critical for grid overflow fix */
}

/* ---------- Panels ---------- */
.panel {
  display: flex;
  flex-direction: column;
  background: var(--bg-panel);
  overflow: hidden;
  min-height: 0; /* critical for flex overflow fix */
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-subtle);
  min-height: 36px;
  flex-shrink: 0;
}

.panel-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.panel-body {
  flex: 1;
  overflow: hidden;
  position: relative;
  min-height: 0;
}

.panel-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 24px;
}

.panel-placeholder p {
  color: var(--text-muted);
  font-size: 14px;
}

/* ---------- PDF Panel ---------- */
.pdf-iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: #fff;
}

/* ---------- Phone Preview ---------- */
.phone-container {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 20px 12px 12px;
  overflow: hidden;
}

.phone-scaler {
  transform-origin: top center;
  flex-shrink: 0;
}

.phone-frame {
  width: 376px;
  height: 828px;
  border-radius: 44px;
  border: 3px solid var(--border-subtle);
  background: #000;
  box-shadow: var(--shadow-md), 0 0 30px rgba(45, 149, 150, 0.05);
  overflow: hidden;
  position: relative;
}

.phone-notch {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 28px;
  background: var(--bezel);
  border-radius: 0 0 18px 18px;
  z-index: 2;
}

.phone-iframe {
  width: 360px;
  height: 800px;
  border: none;
  background: #fff;
}

.file-size-badge {
  font-size: 12px;
  font-weight: 600;
  color: var(--brand-teal);
  background: var(--brand-teal-dim);
  padding: 2px 8px;
  border-radius: 10px;
  font-family: var(--font-mono);
}


/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  .editor-main {
    grid-template-columns: 50% 50%;
  }

  .panel-chat {
    display: none;
  }
}

@media (max-width: 900px) {
  .editor-main {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr;
  }

  .panel-history {
    display: none;
  }

  .phone-container {
    padding: 12px 8px;
  }

  .header-center {
    max-width: 300px;
  }

  .cascade-selectors {
    flex-wrap: wrap;
  }

  .cascade-arrow {
    display: none;
  }
}

/* ---------- Scrollbar Styling ---------- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--brand-teal);
}

/* ---------- Selection ---------- */
::selection {
  background: rgba(45, 149, 150, 0.3);
  color: var(--text-primary);
}

/* ========================= */
/* Review Mode Styles        */
/* ========================= */

.btn-review-start {
  background: var(--brand-teal);
  color: #fff;
  padding: 6px 14px;
  font-size: 13px;
}
.btn-review-start:hover:not(:disabled) {
  background: var(--brand-teal-hover);
  box-shadow: 0 0 12px rgba(45, 149, 150, 0.3);
}

.btn-review-exit {
  background: var(--error);
  color: #fff;
  padding: 6px 14px;
  font-size: 13px;
}
.btn-review-exit:hover:not(:disabled) {
  background: #EF4444;
}

.review-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.review-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.btn-nav {
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  width: 32px;
  height: 32px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}
.btn-nav:hover:not(:disabled) {
  border-color: var(--brand-teal);
  color: var(--brand-teal);
}

.review-page-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  min-width: 100px;
  text-align: center;
}

.review-dots {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  flex: 1;
  justify-content: center;
}

.review-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}
.review-dot.dot-pending {
  background: var(--text-muted);
}
.review-dot.dot-skipped {
  background: var(--brand-green);
}
.review-dot.dot-edited {
  background: var(--info);
}
.review-dot.dot-current {
  background: var(--brand-teal);
  box-shadow: 0 0 6px var(--brand-teal);
  transform: scale(1.3);
}
.review-dot:hover {
  transform: scale(1.4);
}

.review-progress-text {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.review-status-badge {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 4px;
}
.review-status-badge.review-in_progress {
  color: var(--warning);
  background: rgba(251, 191, 36, 0.1);
}
.review-status-badge.review-completed {
  color: var(--success);
  background: var(--brand-green-dim);
}
.review-status-badge.review-approved {
  color: var(--brand-teal);
  background: var(--brand-teal-dim);
}
.review-status-badge.review-rejected {
  color: var(--error);
  background: rgba(248, 113, 113, 0.1);
}

.btn-skip {
  background: var(--success);
  color: #000;
  padding: 10px 20px;
  min-width: 80px;
  font-weight: 600;
}
.btn-skip:hover:not(:disabled) {
  background: #5AEE90;
}
.btn-skip:disabled {
  opacity: 0.3;
}

/* Review page list in right panel */
.review-page-list {
  padding: 8px;
}

.review-page-entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  margin-bottom: 4px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-primary);
  transition: background 0.15s;
}
.review-page-entry:hover {
  background: var(--bg-hover);
}
.review-page-entry.review-page-current {
  background: var(--bg-card);
  border-left: 3px solid var(--brand-teal);
}

.review-page-status {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: 4px;
}
.review-page-status.rstatus-pending {
  color: var(--text-muted);
  background: rgba(90, 122, 133, 0.1);
}
.review-page-status.rstatus-skipped {
  color: var(--success);
  background: var(--brand-green-dim);
}
.review-page-status.rstatus-edited {
  color: var(--brand-teal);
  background: var(--brand-teal-dim);
}

/* ========================= */
/* Admin Page Styles          */
/* ========================= */

.admin-layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.admin-stats {
  font-size: 13px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

.admin-filters {
  display: flex;
  gap: 4px;
  padding: 12px 24px;
  background: var(--bg-app);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.filter-tab {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font-ui);
  display: flex;
  align-items: center;
  gap: 6px;
}
.filter-tab:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.filter-tab.active {
  background: var(--brand-teal);
  color: #fff;
}

.filter-count {
  font-size: 11px;
  font-family: var(--font-mono);
  background: rgba(255,255,255,0.15);
  padding: 1px 6px;
  border-radius: 4px;
}

.admin-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
  min-height: 0;
}

.admin-table-wrapper {
  background: var(--bg-panel);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.admin-table th {
  text-align: left;
  padding: 12px 16px;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-card);
}
.admin-table td {
  padding: 12px 16px;
  color: var(--text-primary);
  border-bottom: 1px solid rgba(26, 74, 90, 0.5);
}
.admin-table tr:hover td {
  background: var(--bg-hover);
}
.td-sim {
  font-family: var(--font-mono);
  font-weight: 500;
}

.admin-status {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.03em;
}
.admin-status.astatus-in_progress {
  color: var(--warning);
  background: rgba(251, 191, 36, 0.1);
}
.admin-status.astatus-completed {
  color: var(--success);
  background: var(--brand-green-dim);
}
.admin-status.astatus-approved {
  color: var(--brand-teal);
  background: var(--brand-teal-dim);
}
.admin-status.astatus-rejected {
  color: var(--error);
  background: rgba(248, 113, 113, 0.1);
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

.btn-approve {
  background: var(--success);
  color: #000;
  font-weight: 600;
}
.btn-approve:hover:not(:disabled) {
  background: #5AEE90;
}

.btn-reject {
  background: var(--error);
  color: #fff;
  font-weight: 600;
}
.btn-reject:hover:not(:disabled) {
  background: #EF4444;
}

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

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(9, 31, 44, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.modal-card {
  background: var(--bg-app);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  width: 90vw;
  max-width: 1000px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
}

.modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}
.modal-header h2 {
  font-size: 16px;
  font-weight: 600;
  font-family: var(--font-mono);
  flex: 1;
  color: var(--text-primary);
}
.modal-header .btn-ghost {
  font-size: 18px;
}

.modal-body {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

.modal-preview {
  flex: 0 0 400px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-subtle);
  overflow: hidden;
  min-height: 0;
}

.modal-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 10px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  flex-shrink: 0;
}

.modal-phone-frame {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12px;
  overflow: auto;
  min-height: 0;
}

.modal-phone-iframe {
  width: 360px;
  height: 640px;
  border: none;
  border-radius: var(--radius-md);
  background: #fff;
}

.modal-details {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  min-height: 0;
}
.modal-details h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 12px;
}

.modal-page-list {
  max-height: 300px;
  overflow-y: auto;
  margin-bottom: 20px;
}

.modal-page-entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  margin-bottom: 2px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-primary);
  transition: background 0.15s;
}
.modal-page-entry:hover {
  background: var(--bg-hover);
}
.modal-page-entry.modal-page-current {
  background: var(--bg-card);
  border-left: 3px solid var(--brand-teal);
}

.modal-actions {
  border-top: 1px solid var(--border-subtle);
  padding-top: 16px;
}

.admin-notes {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 13px;
  padding: 10px;
  resize: vertical;
  margin-bottom: 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.admin-notes:focus {
  outline: none;
  border-color: var(--brand-teal);
  box-shadow: 0 0 0 2px rgba(45, 149, 150, 0.15);
}

.modal-buttons {
  display: flex;
  gap: 8px;
}

.admin-existing-notes {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 12px;
  font-style: italic;
}

/* ========================= */
/* Smart Review Toggle       */
/* ========================= */
.btn-toggle {
  padding: 4px 10px;
  font-size: 11px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  font-family: var(--font-ui);
  font-weight: 500;
  transition: all 0.15s;
}
.btn-toggle:hover {
  color: var(--text-primary);
  border-color: var(--brand-teal);
  background: var(--bg-hover);
}
.btn-toggle-active {
  padding: 4px 10px;
  font-size: 11px;
  border-radius: var(--radius-sm);
  background: var(--brand-teal);
  color: #fff;
  border: 1px solid var(--brand-teal);
  cursor: pointer;
  font-family: var(--font-ui);
  font-weight: 500;
}
.btn-toggle-active:hover {
  background: var(--brand-teal-hover);
}

/* ============================================
   AI Chat Panel
   ============================================ */
.panel-chat {
  display: flex;
  flex-direction: column;
  background: var(--bg-app);
  overflow: hidden;
  min-height: 0;
}

.chat-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}

.chat-msg {
  max-width: 88%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  line-height: 1.5;
  word-wrap: break-word;
}

.chat-user {
  align-self: flex-end;
  background: var(--brand-teal);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-ai {
  align-self: flex-start;
  background: var(--brand-green-dim);
  color: var(--brand-green);
  border-bottom-left-radius: 4px;
  font-family: var(--font-mono);
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-system {
  align-self: center;
  background: var(--brand-teal-dim);
  color: var(--brand-teal);
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 20px;
}

.chat-progress {
  align-self: flex-start;
  background: var(--brand-green-dim);
  color: var(--brand-green);
  font-family: var(--font-mono);
  font-size: 11px;
  white-space: pre-wrap;
  word-break: break-word;
  max-width: 95%;
  border-radius: var(--radius-md);
  border-bottom-left-radius: 4px;
  padding: 10px 14px;
}

.chat-time {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
}

.chat-input-area {
  padding: 10px 12px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.quick-fix-select {
  width: 100%;
  padding: 7px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 12px;
  font-family: var(--font-ui);
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s;
}

.quick-fix-select:focus {
  border-color: var(--brand-teal);
  box-shadow: 0 0 0 2px rgba(45, 149, 150, 0.15);
}

.chat-textarea {
  flex: 1;
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font-ui);
  resize: none;
  min-height: 40px;
  max-height: 100px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.chat-textarea:focus {
  border-color: var(--brand-teal);
  box-shadow: 0 0 0 2px rgba(45, 149, 150, 0.15);
}

.chat-textarea:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ============================================
   PDF Controls
   ============================================ */
.pdf-controls {
  display: flex;
  gap: 4px;
  align-items: center;
  margin-left: auto;
}

/* ============================================
   Chat scrollbar
   ============================================ */
.chat-body::-webkit-scrollbar {
  width: 6px;
}

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

.chat-body::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: 3px;
}

.chat-body::-webkit-scrollbar-thumb:hover {
  background: var(--brand-teal);
}

/* ============================================
   Keyboard Shortcut Hints Bar
   ============================================ */
.shortcut-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 6px 16px;
  background: var(--bg-card);
  border-top: 1px solid var(--border-subtle);
  font-size: 11px;
  color: var(--text-muted);
}

.shortcut-bar kbd {
  background: var(--bg-input);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 10px;
  margin-right: 4px;
}

/* ============================================
   Review Checklist
   ============================================ */
.review-checklist input[type="checkbox"] {
  accent-color: var(--brand-green);
  width: 14px;
  height: 14px;
  cursor: pointer;
}

.review-checklist label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 4px;
  cursor: pointer;
  transition: color 0.15s;
}

.review-checklist label:hover {
  color: var(--text-primary);
}

/* ============================================
   Common Issue Buttons
   ============================================ */
.issue-btn {
  padding: 3px 8px;
  font-size: 10px;
  border-radius: 4px;
  background: rgba(248, 113, 113, 0.1);
  color: var(--error);
  border: 1px solid rgba(248, 113, 113, 0.2);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
  font-family: var(--font-ui);
}

.issue-btn:hover {
  background: rgba(248, 113, 113, 0.2);
}

.undo-btn {
  padding: 3px 8px;
  font-size: 10px;
  border-radius: 4px;
  background: rgba(251, 191, 36, 0.1);
  color: var(--warning);
  border: 1px solid rgba(251, 191, 36, 0.2);
  cursor: pointer;
  white-space: nowrap;
  margin-left: auto;
  transition: background 0.15s;
  font-family: var(--font-ui);
}

.undo-btn:hover {
  background: rgba(251, 191, 36, 0.2);
}

/* ============================================
   Session Dashboard
   ============================================ */
.session-dashboard {
  background: linear-gradient(135deg, var(--bg-panel), var(--bg-card));
  border: 1px solid var(--brand-teal);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 0 20px rgba(45, 149, 150, 0.08);
}

/* ============================================
   Approve button animation
   ============================================ */
@keyframes approveGlow {
  0% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.4); }
  70% { box-shadow: 0 0 0 8px rgba(74, 222, 128, 0); }
  100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); }
}

.btn-approve-ready {
  animation: approveGlow 1.5s ease-in-out infinite;
}

/* ============================================
   Toast Notification
   ============================================ */
.toast {
  position: fixed;
  top: 60px;
  right: 20px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 13px;
  z-index: 1000;
  animation: toastSlide 0.3s ease-out;
  box-shadow: var(--shadow-md);
}

.toast-success {
  background: rgba(74, 222, 128, 0.15);
  color: var(--brand-green);
  border: 1px solid rgba(74, 222, 128, 0.3);
}

.toast-info {
  background: rgba(96, 165, 250, 0.15);
  color: var(--info);
  border: 1px solid rgba(96, 165, 250, 0.3);
}

.toast-warning {
  background: rgba(251, 191, 36, 0.15);
  color: var(--warning);
  border: 1px solid rgba(251, 191, 36, 0.3);
}

.toast-error {
  background: rgba(248, 113, 113, 0.15);
  color: var(--error);
  border: 1px solid rgba(248, 113, 113, 0.3);
}

@keyframes toastSlide {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ============================================
   Loading / Spinner States
   ============================================ */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border-subtle);
  border-top-color: var(--brand-teal);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ============================================
   Focus States (Accessibility)
   ============================================ */
:focus-visible {
  outline: 2px solid var(--brand-teal);
  outline-offset: 2px;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--brand-teal);
  outline-offset: 2px;
}
