/* ── Reset & Base ─────────────────────────────────────────────────────────── */

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

:root {
  --bg:        #0a0a0f;
  --card-bg:   #111122;
  --border:    #1e1e3a;
  --purple:    #cb6ce6;
  --purple-dim: rgba(203, 108, 230, 0.15);
  --blue:      #7ed7ed;
  --text:      #e2e8f0;
  --muted:     #94a3b8;
  --success:   #16a34a;
  --success-dim: rgba(22, 163, 74, 0.15);
  --warning:   #ca8a04;
  --warning-dim: rgba(202, 138, 4, 0.15);
  --danger:    #dc2626;
  --danger-dim: rgba(220, 38, 38, 0.15);
  --blue-dim:  rgba(126, 215, 237, 0.15);
  --radius:    8px;
  --radius-lg: 12px;
  --sidebar-w: 240px;
}

html, body {
  height: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--blue);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ── Utility ──────────────────────────────────────────────────────────────── */

.text-muted { color: var(--muted); }
.text-purple { color: var(--purple); }
.text-blue { color: var(--blue); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-sm { font-size: 12px; }
.font-mono { font-family: 'Courier New', monospace; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.w-full { width: 100%; }

/* ── Animations ───────────────────────────────────────────────────────────── */

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

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes pulse-purple {
  0%, 100% { box-shadow: 0 0 0 0 rgba(203, 108, 230, 0.5); }
  50%       { box-shadow: 0 0 0 6px rgba(203, 108, 230, 0); }
}

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

.fade-in {
  animation: fadeIn 0.25s ease-out both;
}

/* ── Loading Spinner ──────────────────────────────────────────────────────── */

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--purple);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 48px auto;
}

.loading-container {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 64px;
}

/* ── Login Page ───────────────────────────────────────────────────────────── */

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
  padding: 24px;
  animation: fadeIn 0.3s ease-out both;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
}

.login-logo {
  display: block;
  max-width: 180px;
  margin: 0 auto 32px;
}

.login-card h1 {
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 8px;
  color: var(--text);
}

.login-card .subtitle {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  margin-bottom: 32px;
}

/* ── Form Elements ────────────────────────────────────────────────────────── */

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

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.input {
  display: block;
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  padding: 10px 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}

.input:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px var(--purple-dim);
}

.input::placeholder {
  color: var(--muted);
  opacity: 0.6;
}

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

select.input {
  cursor: pointer;
  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;
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 9px 18px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  text-decoration: none;
  line-height: 1;
}

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

.btn--primary {
  background: var(--purple);
  border-color: var(--purple);
  color: #fff;
}

.btn--primary:hover:not(:disabled) {
  background: #d980f5;
  border-color: #d980f5;
}

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

.btn--secondary:hover:not(:disabled) {
  border-color: var(--purple);
  color: var(--purple);
}

.btn--danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.btn--danger:hover:not(:disabled) {
  background: #ef4444;
  border-color: #ef4444;
}

.btn--ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}

.btn--ghost:hover:not(:disabled) {
  color: var(--text);
  background: rgba(255,255,255,0.05);
}

.btn--small {
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 6px;
}

.btn--full {
  width: 100%;
}

.btn--icon {
  padding: 6px;
  width: 30px;
  height: 30px;
}

/* ── Error / Messages ─────────────────────────────────────────────────────── */

.error {
  color: var(--danger);
  font-size: 13px;
  margin-top: 8px;
}

.success-msg {
  color: var(--success);
  font-size: 13px;
  margin-top: 8px;
}

/* ── Toast ────────────────────────────────────────────────────────────────── */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  animation: slideInRight 0.25s ease-out both;
  pointer-events: auto;
  min-width: 260px;
  max-width: 380px;
}

.toast--success {
  border-color: var(--success);
  color: var(--text);
}

.toast--success::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
}

.toast--error {
  border-color: var(--danger);
  color: var(--text);
}

.toast--error::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  flex-shrink: 0;
}

.toast--info {
  border-color: var(--blue);
  color: var(--text);
}

.toast--info::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--blue);
  flex-shrink: 0;
}

/* ── Sidebar ──────────────────────────────────────────────────────────────── */

.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--card-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
}

.sidebar__top {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar__logo {
  display: block;
  max-height: 32px;
  width: auto;
}

.sidebar__nav {
  flex: 1;
  padding: 12px 0;
  list-style: none;
}

.sidebar__item {
  display: block;
}

.sidebar__link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  border-left: 3px solid transparent;
  text-decoration: none;
}

.sidebar__link:hover {
  color: var(--text);
  background: rgba(255,255,255,0.04);
  text-decoration: none;
}

.sidebar__link.active {
  color: var(--purple);
  border-left-color: var(--purple);
  background: var(--purple-dim);
}

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

.sidebar__divider {
  height: 1px;
  background: var(--border);
  margin: 8px 20px;
}

.sidebar__bottom {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

.sidebar__user {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
}

.sidebar__user-name {
  color: var(--text);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Main Content ─────────────────────────────────────────────────────────── */

.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 32px 36px;
  min-height: 100vh;
  animation: fadeIn 0.2s ease-out both;
}

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

.page-header__left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.page-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
}

.page-subtitle {
  font-size: 14px;
  color: var(--muted);
  margin-top: 2px;
}

.back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}

.back-btn:hover {
  color: var(--text);
  border-color: var(--purple);
}

/* ── Card ─────────────────────────────────────────────────────────────────── */

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

.card + .card,
.card + .section,
.section + .card {
  margin-top: 20px;
}

.card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.card__title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

/* ── Badges ───────────────────────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.badge--active {
  background: var(--success-dim);
  color: #4ade80;
  border: 1px solid rgba(74, 222, 128, 0.3);
}

.badge--prospect {
  background: var(--blue-dim);
  color: var(--blue);
  border: 1px solid rgba(126, 215, 237, 0.3);
}

.badge--onboarding {
  background: var(--warning-dim);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.3);
}

.badge--completed {
  background: rgba(148, 163, 184, 0.1);
  color: var(--muted);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.badge--pending {
  background: rgba(148, 163, 184, 0.1);
  color: var(--muted);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.badge--in_progress {
  background: var(--purple-dim);
  color: var(--purple);
  border: 1px solid rgba(203, 108, 230, 0.3);
}

/* Grade badges */
.badge--A {
  background: var(--success-dim);
  color: #4ade80;
  border: 1px solid rgba(74, 222, 128, 0.3);
}

.badge--B {
  background: var(--blue-dim);
  color: var(--blue);
  border: 1px solid rgba(126, 215, 237, 0.3);
}

.badge--C {
  background: var(--warning-dim);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.3);
}

.badge--D {
  background: rgba(251, 146, 60, 0.15);
  color: #fb923c;
  border: 1px solid rgba(251, 146, 60, 0.3);
}

.badge--F {
  background: var(--danger-dim);
  color: #f87171;
  border: 1px solid rgba(248, 113, 113, 0.3);
}

/* ── Table ────────────────────────────────────────────────────────────────── */

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table th {
  background: rgba(255,255,255,0.03);
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(30,30,58,0.5);
  color: var(--text);
  vertical-align: middle;
}

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

.table tbody tr:nth-child(even) td {
  background: rgba(255,255,255,0.015);
}

.table tbody tr:hover td {
  background: rgba(203, 108, 230, 0.04);
}

.table--clickable tbody tr {
  cursor: pointer;
}

/* ── Tabs ─────────────────────────────────────────────────────────────────── */

.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  padding: 10px 18px;
  transition: all 0.15s;
  margin-bottom: -1px;
}

.tab:hover {
  color: var(--text);
}

.tab.active {
  color: var(--purple);
  border-bottom-color: var(--purple);
}

/* ── Stepper ──────────────────────────────────────────────────────────────── */

.stepper {
  display: flex;
  align-items: flex-start;
  gap: 0;
  padding: 8px 0;
}

.stepper__step {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.stepper__step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 12px;
  left: calc(50% + 12px);
  right: calc(-50% + 12px);
  height: 2px;
  background: var(--border);
  z-index: 0;
}

.stepper__step.completed::after {
  background: var(--success);
}

.stepper__step.in_progress::after {
  background: linear-gradient(to right, var(--success), var(--border));
}

.stepper__dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  transition: all 0.2s;
}

.stepper__dot--pending {
  background: rgba(148, 163, 184, 0.15);
  border: 2px solid var(--border);
  color: var(--muted);
}

.stepper__dot--in_progress {
  background: var(--purple-dim);
  border: 2px solid var(--purple);
  color: var(--purple);
  animation: pulse-purple 2s ease-in-out infinite;
}

.stepper__dot--completed {
  background: var(--success);
  border: 2px solid var(--success);
  color: #fff;
}

.stepper__label {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  margin-top: 8px;
  line-height: 1.3;
  max-width: 90px;
}

.stepper__step.completed .stepper__label {
  color: var(--text);
}

.stepper__step.in_progress .stepper__label {
  color: var(--purple);
  font-weight: 600;
}

.stepper__link {
  font-size: 10px;
  color: var(--blue);
  text-decoration: none;
  font-weight: 500;
}

.stepper__link:hover {
  text-decoration: underline;
}

/* ── Modal ────────────────────────────────────────────────────────────────── */

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
}

.modal__content {
  position: relative;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 100%;
  max-width: 500px;
  z-index: 1;
  animation: fadeIn 0.2s ease-out both;
  box-shadow: 0 24px 64px rgba(0,0,0,0.6);
}

.modal__title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text);
}

.modal__body {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 24px;
  line-height: 1.6;
}

.modal__actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ── Citation Grid ────────────────────────────────────────────────────────── */

.grid-3x3 {
  display: grid;
  grid-template-columns: 80px repeat(3, 1fr);
  gap: 1px;
  background: var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 12px;
}

.grid-3x3__header {
  background: rgba(255,255,255,0.03);
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.grid-3x3__row-label {
  background: rgba(255,255,255,0.02);
  padding: 8px 10px;
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  display: flex;
  align-items: center;
}

.citation-cell {
  background: var(--card-bg);
  padding: 10px;
  cursor: pointer;
  transition: background 0.15s;
  min-height: 56px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.citation-cell:hover {
  background: rgba(203, 108, 230, 0.06);
}

.citation-cell__name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.citation-cell__empty {
  color: var(--muted);
  font-size: 11px;
  opacity: 0.5;
}

/* ── Score Gauge ──────────────────────────────────────────────────────────── */

.score-gauge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.score-gauge svg {
  overflow: visible;
}

.score-gauge__number {
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}

.score-gauge__label {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

/* ── Portal ───────────────────────────────────────────────────────────────── */

.portal {
  min-height: 100vh;
  background: var(--bg);
  padding: 40px 24px;
  animation: fadeIn 0.25s ease-out both;
}

.portal__inner {
  max-width: 800px;
  margin: 0 auto;
}

.portal__header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 36px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.portal__logo {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--card-bg);
  border: 1px solid var(--border);
}

.portal__logo-placeholder {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  background: var(--purple-dim);
  border: 1px solid rgba(203, 108, 230, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
  color: var(--purple);
  flex-shrink: 0;
}

.portal__brand {
  flex: 1;
}

.portal__business-name {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
}

.portal__tagline {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}

.portal__aeothis {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.portal__aeothis img {
  height: 20px;
  opacity: 0.7;
}

/* ── Field Row (portal profile) ───────────────────────────────────────────── */

.field-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(30,30,58,0.6);
}

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

.field-row__label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  width: 120px;
  flex-shrink: 0;
  padding-top: 2px;
}

.field-row__value {
  flex: 1;
  font-size: 14px;
  color: var(--text);
  word-break: break-word;
  line-height: 1.5;
}

.field-row__flag {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  transition: all 0.15s;
}

.field-row__flag:hover {
  background: var(--warning-dim);
  border-color: rgba(202, 138, 4, 0.3);
  color: var(--warning);
}

/* ── Current Work Card ────────────────────────────────────────────────────── */

.current-work-card {
  background: var(--purple-dim);
  border: 1px solid rgba(203, 108, 230, 0.3);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.current-work-card__icon {
  font-size: 24px;
  flex-shrink: 0;
}

.current-work-card__text {
  flex: 1;
}

.current-work-card__label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--purple);
  margin-bottom: 4px;
}

.current-work-card__value {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

/* ── Layer checklist (admin progress tab) ─────────────────────────────────── */

.layer-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.layer-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid rgba(30,30,58,0.6);
}

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

.layer-item__number {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  flex-shrink: 0;
}

.layer-item__label {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.layer-item__status {
  cursor: pointer;
}

.layer-url-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
}

.layer-url-link {
  font-size: 12px;
  color: var(--blue);
  text-decoration: none;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
}

.layer-url-link:hover {
  text-decoration: underline;
}

.btn--xs {
  padding: 2px 4px;
  font-size: 11px;
  line-height: 1;
  min-height: 0;
}

/* ── Filters / Search bar ─────────────────────────────────────────────────── */

.filters {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filters .input {
  max-width: 260px;
}

/* ── Action log ───────────────────────────────────────────────────────────── */

.action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 28px;
}

/* ── Job status ───────────────────────────────────────────────────────────── */

.job-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  font-size: 13px;
  margin-top: 16px;
}

.job-status--queued .job-dot,
.job-status--running .job-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warning);
  animation: pulse-purple 1.5s infinite;
}

.job-status--completed .job-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
}

.job-status--failed .job-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
}

/* ── Settings page ────────────────────────────────────────────────────────── */

.settings-section {
  max-width: 560px;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */

.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  padding: 0;
}

.hamburger span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text);
  border-radius: 1px;
  transition: all 0.2s;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 99;
}

@media (max-width: 768px) {
  .hamburger {
    display: flex;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 200;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay.visible {
    display: block;
  }

  .main {
    margin-left: 0;
    padding: 20px 16px;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .filters {
    flex-direction: column;
    align-items: stretch;
  }

  .filters .input {
    max-width: 100%;
  }

  .action-buttons {
    flex-direction: column;
  }

  .grid-3x3 {
    font-size: 11px;
  }

  .portal {
    padding: 24px 16px;
  }

  .stepper__label {
    font-size: 10px;
    max-width: 64px;
  }

  .modal__content {
    padding: 20px;
  }
}

/* ── Pre-wrap for output blocks ───────────────────────────────────────────── */

.output-block {
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  color: var(--muted);
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 240px;
  overflow-y: auto;
  margin-top: 12px;
}

/* ── Chart container ──────────────────────────────────────────────────────── */

.chart-container {
  position: relative;
  height: 220px;
  width: 100%;
}

/* ── Score row (admin client list) ───────────────────────────────────────── */

.score-cell {
  font-weight: 700;
  font-size: 15px;
}

/* ── Empty state ──────────────────────────────────────────────────────────── */

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

.empty-state__icon {
  font-size: 32px;
  margin-bottom: 12px;
}

.empty-state__text {
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text);
}

.empty-state__sub {
  font-size: 13px;
}

/* ── Citation list (expanded) ─────────────────────────────────────────────── */

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

.citation-group__header {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--purple);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

.citation-form {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 10px;
}

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

.citation-form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
}

.citation-copy-wrap {
  position: relative;
  flex: 1;
}

/* ── Profile form ─────────────────────────────────────────────────────────── */

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

.profile-form-grid .form-group--full {
  grid-column: 1 / -1;
}

.profile-form-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

@media (max-width: 600px) {
  .profile-form-grid {
    grid-template-columns: 1fr;
  }

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