:root {
  --bg: #090b10;
  --bg-elevated: #0f131a;
  --surface: #141a24;
  --surface-hover: #1a2230;
  --surface-elevated: #1c2534;
  --border: #2a3548;
  --border-subtle: #212b3c;
  --text: #eef2f8;
  --text-secondary: #a8b4c8;
  --muted: #7b8aa3;
  --accent: #4d8dff;
  --accent-hover: #3b7af0;
  --accent-muted: rgba(77, 141, 255, 0.12);
  --ok: #34d399;
  --warn: #fbbf24;
  --err: #f87171;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 32px;
  --font-sans: "Vazirmatn", Vazir, Tahoma, system-ui, -apple-system, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.4);
  --header-height: 60px;
  --content-max: 1120px;
  --transition: 150ms ease;
}

* { box-sizing: border-box; }

html {
  color-scheme: dark;
  direction: rtl;
}

body {
  margin: 0;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(77, 141, 255, 0.1), transparent),
    radial-gradient(ellipse 40% 30% at 100% 0%, rgba(124, 58, 237, 0.05), transparent),
    linear-gradient(180deg, var(--bg) 0%, #0a0d14 100%);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover { color: #7eb0ff; text-decoration: underline; }

/* Header */
.site-header {
  background: rgba(15, 19, 26, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 200;
}

.header-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--space-3) var(--space-4);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3) var(--space-4);
}

.header-brand {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  font-size: 1rem;
}
.brand-link:hover { color: var(--text); text-decoration: none; }

.role-pill {
  gap: 6px;
}
.role-pill-label {
  color: var(--text);
  font-weight: 600;
}
.role-pill-sep {
  color: var(--muted);
  opacity: 0.7;
}

.brand-mark {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  box-shadow: 0 0 12px rgba(77, 141, 255, 0.45);
}

.header-status {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.75rem;
  color: var(--text-secondary);
  padding: var(--space-1) var(--space-3);
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
}

.status-pill-link {
  color: var(--text-secondary);
  text-decoration: none;
  transition: border-color var(--transition), background var(--transition);
}
.status-pill-link:hover {
  color: var(--text);
  text-decoration: none;
  border-color: var(--border);
  background: var(--surface-hover);
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  font-size: 0.8125rem;
}

.site-nav a {
  color: var(--text-secondary);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: background var(--transition), color var(--transition);
}
.site-nav a:hover {
  color: var(--text);
  background: var(--surface-hover);
  text-decoration: none;
}
.site-nav a.active {
  color: var(--text);
  background: var(--accent-muted);
  box-shadow: inset 0 0 0 1px rgba(77, 141, 255, 0.2);
}

/* Layout */
.site-main {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--space-5) var(--space-4) var(--space-7);
}

.site-footer {
  text-align: center;
  padding: var(--space-4) var(--space-4) var(--space-5);
  color: var(--muted);
  font-size: 0.6875rem;
  border-top: 1px solid var(--border-subtle);
}

.footer-path {
  display: inline-block;
  max-width: min(90vw, 480px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

/* Page headers */
.page-header {
  margin-bottom: var(--space-5);
}

.page-header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
}

.page-heading {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.35;
}

.page-title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.4;
}

.page-lead {
  margin: var(--space-2) 0 0;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.section-title {
  margin: var(--space-5) 0 var(--space-3);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--muted);
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
  box-shadow: var(--shadow-sm);
}

.card-flat { padding: var(--space-3) var(--space-4); }

.card-accent {
  border-color: rgba(77, 141, 255, 0.22);
  background: linear-gradient(180deg, rgba(77, 141, 255, 0.04) 0%, var(--surface) 40%);
}

.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.card-head h2,
.card h2 {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.card-intro {
  margin: 0 0 var(--space-4);
}

.card-footnote {
  margin: var(--space-3) 0 0;
}

.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

@media (min-width: 768px) {
  .card-grid { grid-template-columns: 1fr 1fr; }
  .analyze-grid { align-items: start; }
}

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 600;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.stat-ok .stat-value { color: var(--ok); }
.stat-err .stat-value { color: var(--err); }

/* Cost estimate */
.cost-estimate {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  padding: var(--space-3) var(--space-4);
  background: var(--accent-muted);
  border: 1px solid rgba(77, 141, 255, 0.2);
  border-radius: var(--radius);
  flex: 1;
  min-width: min(100%, 320px);
}

.cost-estimate-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(77, 141, 255, 0.18);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8125rem;
  font-weight: 700;
  flex-shrink: 0;
}

.cost-estimate-body { min-width: 0; }

.cost-estimate-label {
  margin: 0;
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 600;
}

.cost-estimate-value {
  margin: var(--space-1) 0 0;
  font-size: 1.125rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.cost-estimate-meta {
  margin: var(--space-1) 0 0;
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  padding: 4px var(--space-2);
  border-radius: 999px;
  font-weight: 600;
  line-height: 1.35;
  white-space: nowrap;
}
.badge.ok { background: rgba(52, 211, 153, 0.14); color: var(--ok); }
.badge.warn { background: rgba(251, 191, 36, 0.14); color: var(--warn); }
.badge.err { background: rgba(248, 113, 113, 0.14); color: var(--err); }
.badge.neutral { background: rgba(123, 138, 163, 0.14); color: var(--text-secondary); }

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
  background: var(--muted);
}
.status-dot.ok { background: var(--ok); box-shadow: 0 0 6px rgba(52, 211, 153, 0.5); }
.status-dot.warn { background: var(--warn); }
.status-dot.err { background: var(--err); }
.status-dot.muted { background: var(--muted); }

.status-dot.pulse {
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

/* Tables */
.table-wrap {
  overflow-x: auto;
  margin: 0 calc(-1 * var(--space-4));
  padding: 0 var(--space-4);
}

.card-table { padding-bottom: var(--space-3); }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table th,
.data-table td {
  text-align: start;
  padding: var(--space-3) var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.data-table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.75rem;
  background: var(--bg-elevated);
  position: sticky;
  top: 0;
}

.data-table tbody tr {
  transition: background var(--transition);
}

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

.data-table tbody tr:hover {
  background: rgba(77, 141, 255, 0.05);
}

.data-table.compact th,
.data-table.compact td {
  padding: var(--space-2) var(--space-3);
}

.data-table .num {
  text-align: end;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

.data-table .truncate {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.data-table .nowrap { white-space: nowrap; }

.empty-cell {
  color: var(--muted);
  padding: var(--space-5) var(--space-3) !important;
  text-align: center;
}

.empty-dataset {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  max-width: 36rem;
  margin: 0 auto;
}

.empty-dataset-title {
  margin: 0;
  font-weight: 600;
  color: var(--text);
}

.empty-dataset-path {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
  word-break: break-all;
}

.empty-dataset-cta {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.row-link { font-weight: 500; }

/* Logs */
.log {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: var(--space-3);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  max-height: 320px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-secondary);
  line-height: 1.45;
}

/* Forms */
.form-field { margin-bottom: var(--space-4); }

label {
  display: block;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
  font-weight: 500;
}

.field-hint {
  margin: var(--space-1) 0 0;
  font-size: 0.75rem;
  color: var(--muted);
}

input[type=text],
input[type=password],
input[type=number],
select,
textarea {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.875rem;
  font-family: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
}

input { margin-bottom: 0; }

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(77, 141, 255, 0.18);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0 var(--space-4);
}

@media (min-width: 640px) {
  .form-grid.two { grid-template-columns: 1fr 1fr; }
}

.stack-form .form-field input { margin-bottom: 0; }

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-4) 0;
}

.form-actions-end {
  justify-content: flex-end;
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-subtle);
}

/* Buttons */
button,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  background: var(--accent);
  color: #fff;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-4);
  font-size: 0.875rem;
  cursor: pointer;
  font-weight: 500;
  font-family: inherit;
  line-height: 1.25;
  text-decoration: none;
  transition: background var(--transition), border-color var(--transition), opacity var(--transition);
}
button:hover:not(:disabled),
.btn:hover {
  background: var(--accent-hover);
  text-decoration: none;
  color: #fff;
}
button:disabled,
.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-sm {
  padding: var(--space-1) var(--space-3);
  font-size: 0.8125rem;
}

.btn-secondary,
button.secondary {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
.btn-secondary:hover:not(:disabled),
button.secondary:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: var(--border);
  color: var(--text);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--surface-hover);
  color: var(--text);
}

.btn-danger-outline {
  background: transparent;
  border-color: rgba(248, 113, 113, 0.4);
  color: #fca5a5;
}
.btn-danger-outline:hover:not(:disabled) {
  background: rgba(248, 113, 113, 0.1);
  border-color: rgba(248, 113, 113, 0.55);
  color: #fecaca;
}

.danger-text { color: var(--err) !important; }

/* Toasts */
.toast-stack {
  position: fixed;
  top: calc(var(--header-height) + var(--space-3));
  inset-inline-start: var(--space-4);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-width: min(420px, calc(100vw - var(--space-8)));
  pointer-events: none;
}

html.spa-loading #app {
  opacity: 0.55;
  transition: opacity 120ms ease;
  pointer-events: none;
}
html.spa-loading {
  cursor: progress;
}

.toast {
  pointer-events: auto;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  font-size: 0.875rem;
  box-shadow: var(--shadow-md);
  border: 1px solid transparent;
  animation: toast-in 0.25s ease;
}

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

.toast-ok {
  background: #0f1f18;
  border-color: rgba(52, 211, 153, 0.3);
  color: #a7f3d0;
}
.toast-err {
  background: #1f1214;
  border-color: rgba(248, 113, 113, 0.3);
  color: #fecaca;
}

.toast a { color: inherit; font-weight: 600; }

/* Legacy flash (fallback) */
.flash, .notice {
  padding: var(--space-3);
  border-radius: var(--radius);
  margin-bottom: var(--space-4);
  font-size: 0.875rem;
}
.flash.ok, .notice.ok {
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.25);
}
.flash.err, .notice.err {
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.25);
}

.pager {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border-subtle);
  font-size: 0.875rem;
}

.pager-info { color: var(--muted); }

.meta {
  font-size: 0.8125rem;
  color: var(--muted);
  margin: 0;
}

.empty-state {
  color: var(--muted);
  font-size: 0.875rem;
  margin: 0;
}

/* Chat detail */
.chat-page {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.chat-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  position: sticky;
  top: calc(var(--header-height) + var(--space-2));
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.back-link {
  font-size: 0.8125rem;
  color: var(--muted);
  flex-shrink: 0;
  padding-top: 2px;
  text-decoration: none;
}
.back-link:hover { color: var(--text); text-decoration: none; }

.chat-topbar-main { flex: 1; min-width: 0; }
.chat-topbar-meta { margin-top: var(--space-1); }
.chat-topbar-badges { flex-shrink: 0; }

.action-toolbar { margin-bottom: 0; }

.toolbar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
}

.toolbar-row + .toolbar-row {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border-subtle);
}

.toolbar-confirm .inline-check {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.toolbar-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  flex-shrink: 0;
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.toolbar-form { display: inline-flex; margin: 0; }

.inline-check {
  display: inline-flex;
  align-items: flex-start;
  gap: var(--space-2);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin: 0;
  cursor: pointer;
  user-select: none;
}

.inline-check input {
  width: auto;
  margin: 0.2rem 0 0;
  accent-color: var(--accent);
}

.cmd-details {
  margin-top: var(--space-3);
  font-size: 0.75rem;
}

.cmd-details summary {
  cursor: pointer;
  color: var(--muted);
  user-select: none;
  padding: var(--space-1) 0;
  list-style-position: inside;
}
.cmd-details summary:hover { color: var(--text); }
.cmd-details[open] summary { margin-bottom: var(--space-2); color: var(--text-secondary); }

.cmd-block { margin-top: var(--space-2); }

cmd {
  display: block;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  word-break: break-all;
  margin: var(--space-1) 0 var(--space-2);
  color: var(--text-secondary);
  line-height: 1.5;
}

.chat-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
  align-items: start;
}

@media (min-width: 900px) {
  .chat-layout {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  }
}

.panel {
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: var(--space-3);
}

.panel-header h2 {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
}

.panel-body { flex: 1; min-height: 0; }

/* Messages */
.chat-thread {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-height: 62vh;
  overflow-y: auto;
  padding-inline-end: var(--space-1);
  scroll-behavior: smooth;
}

.msg-bubble {
  max-width: min(92%, 480px);
  padding: var(--space-3);
  border-radius: 14px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  align-self: flex-start;
}

.msg-bubble.user {
  align-self: flex-end;
  border-color: rgba(77, 141, 255, 0.28);
  background: rgba(77, 141, 255, 0.08);
  border-end-end-radius: 4px;
}

.msg-bubble.support {
  align-self: flex-start;
  border-color: rgba(52, 211, 153, 0.25);
  background: rgba(52, 211, 153, 0.06);
  border-end-start-radius: 4px;
}

.msg-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-1) var(--space-3);
  margin-bottom: var(--space-2);
}

.msg-role {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.msg-time {
  font-size: 0.6875rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.msg-body {
  font-size: 0.875rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  unicode-bidi: plaintext;
}

.msg-body.muted { color: var(--muted); font-style: italic; }

.msg-media { margin-top: var(--space-2); }

.msg-photo-link {
  display: inline-block;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  max-width: 200px;
  transition: border-color var(--transition);
}
.msg-photo-link:hover { border-color: var(--accent); }

.msg-photo-link img {
  display: block;
  width: 100%;
  max-height: 140px;
  object-fit: cover;
}

/* Analysis */
.analysis-panel-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.analysis-goal {
  padding: var(--space-3);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

.analysis-goal-title {
  margin: 0 0 var(--space-1);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
}

.analysis-goal-text {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--text-secondary);
}

.analysis-legacy-hint {
  padding: var(--space-2) var(--space-3);
  background: color-mix(in srgb, var(--warn, #c9a227) 12%, transparent);
  border-radius: var(--radius-sm);
  border: 1px solid color-mix(in srgb, var(--warn, #c9a227) 35%, transparent);
}

.analysis-sections {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.analysis-section-title {
  margin: 0 0 var(--space-1);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}

.field-hint {
  margin: 0 0 var(--space-2);
  font-size: 0.6875rem;
  line-height: 1.4;
  color: var(--muted);
}

.analysis-prose {
  font-size: 0.8125rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  unicode-bidi: plaintext;
  color: var(--text);
}

.analysis-list {
  margin: 0;
  padding-inline-start: 1.25rem;
  font-size: 0.8125rem;
  line-height: 1.55;
}

.analysis-timeline {
  margin: 0;
  padding-inline-start: 1.25rem;
  font-size: 0.8125rem;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.analysis-timeline .tl-when {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  margin-inline-end: var(--space-1);
}

.analysis-timeline .tl-who {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  margin-inline-end: var(--space-1);
}

.kb-draft-body { font-size: 0.8125rem; }

.force-rerun-check.force-rerun-emphasis {
  padding: var(--space-2) var(--space-3);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: var(--radius-sm);
}

.force-rerun-callout {
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--text-secondary);
  padding: var(--space-2) var(--space-3);
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border-subtle);
}

.analysis-fields { margin: 0; }

.field-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: var(--space-2);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.8125rem;
}

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

.field-row dt {
  color: var(--muted);
  font-weight: 500;
}

.field-row dd { margin: 0; color: var(--text); }

.field-row-block {
  grid-template-columns: 1fr;
  gap: var(--space-1);
}

.notes-text {
  white-space: pre-wrap;
  word-break: break-word;
  unicode-bidi: plaintext;
  line-height: 1.55;
}

.analysis-empty,
.analysis-running {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.raw-json-details {
  margin-top: var(--space-2);
  font-size: 0.75rem;
}

.raw-json-details summary {
  cursor: pointer;
  color: var(--muted);
  user-select: none;
}
.raw-json-details summary:hover { color: var(--text); }

pre.json {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  overflow: auto;
  font-size: 0.6875rem;
  font-family: var(--font-mono);
  margin-top: var(--space-2);
  max-height: 240px;
  color: var(--text-secondary);
}

/* Job log */
.log-page-header { margin-bottom: var(--space-4); }

.log-meta-card { margin-bottom: var(--space-4); }

.log-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-3);
  margin: 0;
}

.log-meta-grid .field-row { margin: 0; }

.log-file-path {
  word-break: break-all;
  font-size: 0.75rem;
  font-family: var(--font-mono);
}

.log-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border-subtle);
}

.log-refresh-toggle { margin: 0; }

.log-viewer-card {
  padding: 0;
  overflow: hidden;
}

pre.log-viewer {
  background: var(--bg-elevated);
  border: none;
  border-radius: 0;
  margin: 0;
  padding: var(--space-4);
  overflow: auto;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  line-height: 1.5;
  color: #b8c5d8;
  max-height: min(70vh, 720px);
  white-space: pre-wrap;
  word-break: break-word;
}

.inline-form { display: inline; margin: 0; }

.job-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}

.log-link {
  font-weight: 500;
}

/* Mobile */
@media (max-width: 640px) {
  .site-main { padding: var(--space-4) var(--space-3) var(--space-6); }

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

  .site-nav {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: var(--space-1);
    -webkit-overflow-scrolling: touch;
  }

  .page-heading { font-size: 1.25rem; }

  .toast-stack {
    inset-inline: var(--space-3);
    max-width: none;
  }

  .field-row {
    grid-template-columns: 1fr;
    gap: var(--space-1);
  }

  .chat-topbar { position: static; }
}

/* Legacy aliases */
.stats { display: contents; }
.stat { display: contents; }
.card-actions { display: contents; }
.checkbox-row { display: contents; }
.messages { display: contents; }
.msg { display: contents; }
.divider { display: none; }
.analyze-inline { display: none; }
.job-list { list-style: none; padding: 0; margin: 0; }
.job-list li { padding: var(--space-2) 0; border-bottom: 1px solid var(--border-subtle); }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: var(--space-2); }
.photos img { width: 100%; height: 90px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--border-subtle); }

/* Login */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-image:
    radial-gradient(ellipse 70% 45% at 50% -10%, rgba(77, 141, 255, 0.14), transparent),
    linear-gradient(180deg, var(--bg) 0%, #0a0d14 100%);
}
.login-shell { width: min(420px, 100%); padding: var(--space-4); }
.login-card {
  margin: 0;
  padding: var(--space-5);
  box-shadow: var(--shadow-md);
}
.login-card .page-heading { font-size: 1.35rem; }

/* Custom file upload */
.file-drop {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  padding: var(--space-4);
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
  cursor: pointer;
}
.file-drop:hover:not(.is-disabled),
.file-drop.is-dragover:not(.is-disabled) {
  border-color: var(--accent);
  background: var(--accent-muted);
  box-shadow: 0 0 0 3px rgba(77, 141, 255, 0.12);
}
.file-drop.has-file {
  border-style: solid;
  border-color: rgba(52, 211, 153, 0.35);
  padding: 0;
  overflow: hidden;
  background: #0a0e14;
}
.file-drop.has-file:hover:not(.is-disabled) {
  background: #0a0e14;
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.12);
}
.file-drop.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.file-drop-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}
.file-drop.has-file .file-drop-input {
  pointer-events: none;
  z-index: 0;
}
.file-drop.is-disabled .file-drop-input { cursor: not-allowed; }
.file-drop-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  text-align: center;
  pointer-events: none;
}
.file-drop-body[hidden] {
  display: none;
}
.file-drop-preview {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  background: #0a0e14;
}
.file-drop-preview[hidden] {
  display: none;
}
.file-drop-preview-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  pointer-events: none;
  user-select: none;
}
.file-drop-preview-veil {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    rgba(9, 11, 16, 0.05) 40%,
    rgba(9, 11, 16, 0.72) 100%
  );
}
.file-drop-preview-bar {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  pointer-events: auto;
  direction: rtl;
}
.file-drop-preview-name {
  flex: 1;
  min-width: 0;
  font-size: 0.72rem;
  font-weight: 500;
  color: #eef2f8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
}
.file-drop-preview-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.file-drop-preview-btn {
  appearance: none;
  border: 1px solid rgba(238, 242, 248, 0.22);
  border-radius: var(--radius-sm);
  background: rgba(15, 19, 26, 0.78);
  color: var(--text);
  font: inherit;
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.2;
  padding: 0.35rem 0.55rem;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}
.file-drop-preview-btn:hover,
.file-drop-preview-btn:focus-visible {
  background: rgba(28, 37, 52, 0.95);
  border-color: rgba(77, 141, 255, 0.55);
  outline: none;
  color: #fff;
}
.file-drop-preview-btn-danger {
  border-color: rgba(248, 113, 113, 0.35);
  color: #fecaca;
}
.file-drop-preview-btn-danger:hover,
.file-drop-preview-btn-danger:focus-visible {
  border-color: rgba(248, 113, 113, 0.7);
  background: rgba(127, 29, 29, 0.55);
  color: #fff;
}
.file-drop-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background:
    linear-gradient(135deg, rgba(77, 141, 255, 0.25), rgba(124, 58, 237, 0.2));
  border: 1px solid rgba(77, 141, 255, 0.3);
  position: relative;
}
.file-drop-icon::before,
.file-drop-icon::after {
  content: "";
  position: absolute;
  background: var(--accent);
  border-radius: 1px;
}
.file-drop-icon::before {
  width: 14px;
  height: 2px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
.file-drop-icon::after {
  width: 2px;
  height: 14px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
.file-drop-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}
.file-drop-meta {
  font-size: 0.75rem;
  color: var(--muted);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-drop-hint {
  font-size: 0.7rem;
  color: var(--muted);
  opacity: 0.9;
  line-height: 1.4;
  max-width: 18rem;
}
.file-drop:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(77, 141, 255, 0.18);
}
.file-drop-ctx {
  position: fixed;
  z-index: 100;
  min-width: 12rem;
  padding: 0.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.file-drop-ctx-item {
  display: block;
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.8rem;
  text-align: right;
  cursor: pointer;
}
.file-drop-ctx-item:hover,
.file-drop-ctx-item:focus {
  background: var(--accent-muted);
  outline: none;
}
.stack-form .form-field textarea {
  margin-bottom: 0;
  min-height: 7.5rem;
  resize: vertical;
  line-height: 1.5;
}

.empty-panel {
  padding: var(--space-6) var(--space-4);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  align-items: center;
}

/* UI Shots upload: equal-height columns */
.ui-shot-upload-form {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.ui-shot-upload-grid {
  align-items: stretch;
  gap: var(--space-4);
  margin-bottom: 0;
}

.ui-shot-upload-grid .form-field {
  margin-bottom: 0;
}

.ui-shot-upload-col {
  display: grid;
  grid-template-rows: auto 1fr;
  align-content: stretch;
  min-height: 0;
  height: 100%;
}

.ui-shot-upload-col > label {
  grid-row: 1;
}

.ui-shot-upload-col .file-drop,
.ui-shot-upload-col .ui-shot-caption,
.ui-shot-upload-col textarea.ui-shot-caption {
  grid-row: 2;
  width: 100%;
  min-height: 12rem;
  height: 100%;
  border-radius: var(--radius);
}

.ui-shot-upload-col .file-drop {
  padding: var(--space-5) var(--space-4);
  position: relative;
  overflow: hidden;
}

.ui-shot-upload-col .file-drop.has-file {
  padding: 0;
}

.ui-shot-upload-col .ui-shot-caption,
.ui-shot-upload-col textarea.ui-shot-caption {
  padding: var(--space-3) var(--space-4);
  resize: vertical;
  line-height: 1.6;
  box-sizing: border-box;
}

.ui-shot-upload-hint {
  margin: var(--space-3) 0 0;
  font-size: 0.75rem;
  color: var(--muted);
}

.ui-shot-upload-actions {
  margin: var(--space-4) 0 0;
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-subtle);
  justify-content: flex-start;
  gap: var(--space-3);
}

@media (max-width: 639px) {
  .ui-shot-upload-grid {
    grid-template-columns: 1fr;
    gap: var(--space-3);
  }

  .ui-shot-upload-col .file-drop,
  .ui-shot-upload-col .ui-shot-caption,
  .ui-shot-upload-col textarea.ui-shot-caption {
    min-height: 9rem;
    height: auto;
  }
}

.ui-shots-empty {
  margin-top: var(--space-2);
  padding: var(--space-7) var(--space-5);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  gap: var(--space-3);
}

.ui-shots-empty-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(77, 141, 255, 0.2), rgba(124, 58, 237, 0.14));
  border: 1px solid rgba(77, 141, 255, 0.28);
  position: relative;
  margin-bottom: var(--space-1);
}

.ui-shots-empty-icon::before,
.ui-shots-empty-icon::after {
  content: "";
  position: absolute;
  background: var(--accent);
  border-radius: 1px;
  opacity: 0.85;
}

.ui-shots-empty-icon::before {
  width: 16px;
  height: 2px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.ui-shots-empty-icon::after {
  width: 2px;
  height: 16px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.ui-shots-empty .empty-state {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.ui-shots-empty .meta {
  max-width: 28rem;
  line-height: 1.5;
}

.reset-pw-form {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}
.reset-pw-form input[type=password] {
  width: auto;
  min-width: 160px;
  max-width: 220px;
}

/* UI Shots */
.ui-shots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--space-4);
}
.ui-shot-card {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  background: var(--surface-elevated);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.ui-shot-thumb {
  display: block;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  transition: border-color var(--transition);
}
.ui-shot-thumb:hover { border-color: var(--accent); }
.ui-shot-card img {
  width: 100%;
  height: 148px;
  object-fit: cover;
  display: block;
  margin: 0;
}
.row-muted { opacity: 0.55; }
.strike { text-decoration: line-through; }
.cost-estimate-warn {
  margin: var(--space-2) 0 0;
  color: var(--warn);
  font-size: 0.85rem;
}

/* Exported chat dialogue (Telegram-style) */
.export-chat-header .back-link {
  display: inline-block;
  margin-bottom: var(--space-2);
}

.export-chat-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-2) var(--space-3);
}

.export-chat-id {
  font-size: 0.8125rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
}

.export-chat-counts {
  margin-top: var(--space-2);
}

.export-dialogue {
  padding: 0;
  overflow: hidden;
  background:
    radial-gradient(ellipse 70% 40% at 50% 0%, rgba(77, 141, 255, 0.06), transparent),
    linear-gradient(180deg, #0c1018 0%, var(--surface) 100%);
}

.export-thread {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  max-height: min(72vh, 820px);
  overflow-y: auto;
  padding: var(--space-4);
  scroll-behavior: smooth;
  /* LTR container so flex-start/end map to physical left/right */
  direction: ltr;
}

.export-thread > .empty-state {
  direction: rtl;
  align-self: stretch;
  text-align: center;
}

/* Force physical left/right regardless of page RTL */
.export-bubble {
  position: relative;
  direction: rtl;
  max-width: min(85%, 420px);
  width: fit-content;
  padding: var(--space-2) var(--space-3) var(--space-3);
  border-radius: 16px;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
  transition: opacity var(--transition), border-color var(--transition);
}

.export-bubble--user {
  /* کاربر = LEFT */
  align-self: flex-start;
  background: #182230;
  border-color: rgba(77, 141, 255, 0.22);
  border-bottom-left-radius: 4px;
}

.export-bubble--support {
  /* پشتیبانی = RIGHT */
  align-self: flex-end;
  background: #1a2a24;
  border-color: rgba(52, 211, 153, 0.22);
  border-bottom-right-radius: 4px;
}

.export-bubble--deleted {
  opacity: 0.55;
  border-style: dashed;
}

.export-bubble--photo-dim .export-bubble-media {
  opacity: 0.55;
}

.export-bubble-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-1) var(--space-2);
  margin-bottom: var(--space-1);
}

.export-bubble-role {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.export-bubble--user .export-bubble-role { color: #8eb6ff; }
.export-bubble--support .export-bubble-role { color: #6ee7b7; }

.export-bubble-meta {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.6875rem;
  color: var(--muted);
}

.export-bubble-time {
  font-variant-numeric: tabular-nums;
}

.export-bubble-id {
  font-family: var(--font-mono);
  opacity: 0.8;
}

.export-bubble-status {
  margin: 0 0 var(--space-1);
}

.export-bubble-body {
  font-size: 0.875rem;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  unicode-bidi: plaintext;
}

.export-bubble-body--strike {
  text-decoration: line-through;
  color: var(--text-secondary);
}

.export-bubble-body--empty {
  color: var(--muted);
  font-style: italic;
}

.export-bubble-media {
  margin-top: var(--space-2);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.export-photo-thumb {
  display: block;
  padding: 0;
  margin: 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  overflow: hidden;
  max-width: 220px;
  background: var(--bg);
  cursor: zoom-in;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.export-photo-thumb:hover,
.export-photo-thumb:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-muted);
  outline: none;
}

.export-photo-thumb img {
  display: block;
  width: 100%;
  max-height: 160px;
  object-fit: cover;
}

.export-photo-thumb--dim {
  cursor: default;
  pointer-events: none;
  filter: grayscale(0.35);
}

.export-bubble-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin-top: var(--space-2);
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: opacity var(--transition), max-height var(--transition), margin var(--transition);
}

.export-bubble:hover .export-bubble-actions,
.export-bubble:focus-within .export-bubble-actions,
.export-bubble--deleted .export-bubble-actions,
.export-bubble--photo-dim .export-bubble-actions {
  opacity: 1;
  max-height: 80px;
  margin-top: var(--space-2);
  overflow: visible;
}

.export-action-btn {
  appearance: none;
  border: 1px solid var(--border-subtle);
  background: rgba(15, 19, 26, 0.65);
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
}

.export-action-btn:hover,
.export-action-btn:focus-visible {
  color: var(--text);
  border-color: var(--accent);
  background: var(--accent-muted);
  outline: none;
}

.export-action-btn--restore {
  color: var(--ok);
  border-color: rgba(52, 211, 153, 0.35);
}

.export-action-btn--restore:hover,
.export-action-btn--restore:focus-visible {
  color: #6ee7b7;
  border-color: rgba(52, 211, 153, 0.55);
  background: rgba(52, 211, 153, 0.1);
}

html.export-lightbox-open {
  overflow: hidden;
}

.export-lightbox {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: grid;
  place-items: center;
  padding: var(--space-5);
}

.export-lightbox[hidden] {
  display: none !important;
}

.export-lightbox-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  padding: 0;
  margin: 0;
  background: rgba(4, 6, 10, 0.82);
  cursor: pointer;
}

.export-lightbox-figure {
  position: relative;
  z-index: 1;
  margin: 0;
  max-width: min(92vw, 960px);
  max-height: 88vh;
}

.export-lightbox-figure img {
  display: block;
  max-width: 100%;
  max-height: 88vh;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  object-fit: contain;
  background: #000;
}

.export-lightbox-close {
  position: absolute;
  top: -12px;
  inset-inline-start: -12px;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-elevated);
  color: var(--text);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.export-lightbox-close:hover,
.export-lightbox-close:focus-visible {
  border-color: var(--accent);
  outline: none;
}

@media (hover: none) {
  .export-bubble-actions {
    opacity: 1;
    max-height: none;
    overflow: visible;
  }
}

@media (prefers-reduced-motion: reduce) {
  .export-thread { scroll-behavior: auto; }
  .export-bubble,
  .export-bubble-actions,
  .export-action-btn,
  .export-photo-thumb {
    transition: none;
  }
}

code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  direction: ltr;
  unicode-bidi: isolate;
}
