:root {
  --bg-page: #f1f5f9;
  --bg-surface: #ffffff;
  --bg-subtle: #f8fafc;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: #eff6ff;
  --price-green: #15803d;
  --border: #e2e8f0;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
  --base-size: 16px;
}

/* Map legacy preference values to clean modern scaling */
html[data-font-size="xx-small"] { --base-size: 13px; }
html[data-font-size="x-small"]  { --base-size: 14px; }
html[data-font-size="small"]    { --base-size: 15px; }
html[data-font-size="medium"]   { --base-size: 16px; }
html[data-font-size="large"]    { --base-size: 18px; }
html[data-font-size="x-large"]  { --base-size: 20px; }
html[data-font-size="xx-large"] { --base-size: 22px; }

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

html {
  font-size: var(--base-size);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Helvetica, Arial, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Sticky App Header & Navigation */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.header-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0.75rem 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.brand-link {
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--text-primary);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.brand-badge {
  background: var(--accent);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
}

@media (min-width: 640px) {
  .nav-controls {
    width: auto;
  }
}

.nav-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
}

.nav-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* Main Container */
.container {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 1.25rem 1rem 2.5rem;
  flex: 1;
}

/* Typography */
h1, h2, h3 {
  margin-top: 0;
  color: var(--text-primary);
  line-height: 1.25;
}

h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

h3 {
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  margin: 1.75rem 0 0.75rem;
}

/* Card & List Grids (Replaces legacy div.li / a.li) */
.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.65rem;
}

@media (min-width: 600px) {
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.85rem;
  }
}

@media (min-width: 840px) {
  .card-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.list-card,
div.li > a.li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
  padding: 0.85rem 1rem;
  background: var(--bg-surface);
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: transform 0.12s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.list-card::after,
div.li > a.li::after {
  content: "›";
  font-size: 1.35rem;
  line-height: 1;
  color: var(--text-muted);
  margin-left: 0.75rem;
  transition: transform 0.15s ease, color 0.15s ease;
}

.list-card:hover,
.list-card:focus-visible,
div.li > a.li:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.list-card:hover::after,
div.li > a.li:hover::after {
  color: var(--accent);
  transform: translateX(3px);
}

.list-card:active {
  transform: scale(0.99);
}

/* Legacy fallback if other subpages still output div.li */
div.li {
  margin-bottom: 0.65rem;
  border: none;
}

/* Panels & Surface Boxes */
.panel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.alert-panel {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.alert-panel a {
  color: #b45309;
  font-weight: 600;
  text-decoration: underline;
}

/* Forms & Touch Controls (16px font prevents iOS zoom on focus) */
.form-group {
  margin-bottom: 1.15rem;
}

.form-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}

input[type="text"],
input[type="password"],
input[type="number"],
select {
  width: 100%;
  min-height: 46px;
  padding: 0.65rem 0.85rem;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text-primary);
  background-color: var(--bg-surface);
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.nav-form select {
  min-height: 40px;
  padding: 0.4rem 0.75rem;
  font-size: 0.95rem;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0.65rem 1.25rem;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s ease, transform 0.1s ease;
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
  width: 100%;
}

@media (min-width: 480px) {
  .btn-primary {
    width: auto;
    min-width: 140px;
  }
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--bg-subtle);
  border-color: #cbd5e1;
}

/* Responsive Data Tables (for subpages like trims/pricing) */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin: 1rem 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th, td {
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--border);
}

th {
  background: var(--bg-subtle);
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-secondary);
}

.price {
  text-decoration: none;
  font-weight: 700;
  color: var(--price-green);
  white-space: nowrap;
}

/* Login Page Specific */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 1.5rem 1rem;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem 1.5rem;
  box-shadow: var(--shadow-md);
}

.login-header {
  text-align: center;
  margin-bottom: 1.75rem;
}

.login-header h1 {
  font-size: 1.5rem;
  margin-bottom: 0.25rem;
}

.login-header p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Footer */
.app-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-surface);
  padding: 1.25rem 1rem;
  margin-top: auto;
}

.footer-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

@media (min-width: 600px) {
  .footer-inner {
    flex-direction: row;
    justify-content: space-between;
  }
}

.footer-links {
  display: flex;
  gap: 1.25rem;
}

.footer-links a {
  color: var(--text-secondary);
  font-weight: 600;
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--accent);
}
/* Breadcrumbs & Vehicle Summary Header */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}

.breadcrumb a {
  color: var(--accent);
  text-decoration: none;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.breadcrumb-sep {
  color: var(--text-muted);
}

.meta-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1.25rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
  font-size: 0.925rem;
  box-shadow: var(--shadow-sm);
}

.meta-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-secondary);
}

/* Trim List Cards (cars.php) */
.trim-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.trim-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 58px;
  padding: 0.85rem 1rem;
  background: var(--bg-surface);
  color: var(--text-primary);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: transform 0.12s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.trim-card:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.trim-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.trim-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
}

.trim-sub {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.trim-price-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.trim-chevron {
  font-size: 1.35rem;
  line-height: 1;
  color: var(--text-muted);
}

/* Change Log Pills & Cards (changes.php) */
.pill-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1.5rem;
}

.pill-link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0.35rem 0.85rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.pill-link:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.changelog-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
  scroll-margin-top: 80px;
}

.changelog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
  margin-bottom: 0.75rem;
}

.changelog-header h3 {
  margin: 0;
  text-transform: none;
  letter-spacing: normal;
  font-size: 1.05rem;
  color: var(--text-primary);
}

.changelog-list {
  margin: 0;
  padding-left: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.changelog-list li {
  font-size: 0.95rem;
  color: var(--text-primary);
}

.changelog-date {
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}

/* Color Cards & Swatches (colors.php) */
.color-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem 1.15rem;
  margin-bottom: 0.85rem;
  box-shadow: var(--shadow-sm);
}

.color-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-bottom: 0.65rem;
  margin-bottom: 0.65rem;
  border-bottom: 1px solid var(--border);
}

.color-title-group {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 700;
}

.swatch {
  display: inline-block;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 1px solid rgba(15, 23, 42, 0.22);
  flex-shrink: 0;
}

.swatch-sm {
  width: 18px;
  height: 18px;
  border-radius: 4px;
}

.color-combo-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.color-combo-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.925rem;
  padding: 0.35rem 0;
}

.req-badge {
  display: inline-block;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.2rem 0.55rem;
  font-size: 0.825rem;
  color: var(--text-secondary);
}

.back-top-link {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  white-space: nowrap;
}

.back-top-link:hover {
  color: var(--accent);
}
/* Highlighted Banner Card (Change Log link on models.php) */
.highlight-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.1rem;
  margin-bottom: 1.25rem;
  background: var(--accent-soft);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-md);
  color: var(--accent-hover);
  font-weight: 700;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: background-color 0.15s ease, transform 0.12s ease;
}

.highlight-card:hover {
  background: #dbeafe;
  transform: translateY(-1px);
}

/* Feature & Option Cards (standard.php, options.php) */
.section-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem 1.15rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
  scroll-margin-top: 80px;
}

.section-card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  padding-bottom: 0.6rem;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.section-card-header h3 {
  margin: 0;
  text-transform: none;
  letter-spacing: normal;
  font-size: 1.05rem;
  color: var(--text-primary);
}

.section-desc {
  display: block;
  font-size: 0.825rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.feature-row {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

.feature-row:last-child {
  border-bottom: none;
  padding-bottom: 0.15rem;
}

.feature-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.feature-name {
  font-size: 0.95rem;
  color: var(--text-primary);
}

.feature-name a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.feature-name a:hover {
  text-decoration: underline;
}

.code-tag {
  display: inline-block;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.82rem;
  font-weight: 700;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 0.05rem 0.4rem;
  border-radius: 5px;
  margin-right: 0.35rem;
}

.constraint-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding-left: 0.5rem;
  border-left: 2px solid var(--border);
}

.constraint-item {
  font-size: 0.84rem;
  color: var(--text-secondary);
}

.constraint-item a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.constraint-item a:hover {
  text-decoration: underline;
}

.sub-price-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.35rem;
  padding: 0.45rem 0.65rem;
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

/* Specs Table Rows (specs.php) */
.spec-list {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.spec-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

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

.spec-row:nth-child(even) {
  background: var(--bg-subtle);
}

.spec-label {
  font-size: 0.925rem;
  color: var(--text-secondary);
}

.spec-note {
  font-size: 0.825rem;
  color: var(--text-muted);
}

.spec-value {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
  text-align: right;
  white-space: nowrap;
}

.spec-unit {
  font-weight: 400;
  font-style: italic;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Trim Comparison Grid & Status Badges (trimcomp.php) */
.comp-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.comp-sticky-header {
  position: sticky;
  top: 56px;
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(68px, 110px) minmax(68px, 110px) 1fr;
  gap: 0.65rem;
  align-items: center;
  background: var(--text-primary);
  color: #ffffff;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 0.85rem;
  box-shadow: var(--shadow-md);
}

.comp-sticky-header span:nth-child(1),
.comp-sticky-header span:nth-child(2) {
  text-align: center;
  overflow-wrap: break-word;
  word-break: break-word;
}

.comp-row {
  display: grid;
  grid-template-columns: minmax(68px, 110px) minmax(68px, 110px) 1fr;
  gap: 0.65rem;
  align-items: center;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
}

@media (min-width: 640px) {
  .comp-sticky-header,
  .comp-row {
    grid-template-columns: minmax(90px, 140px) minmax(90px, 140px) 1fr;
    gap: 0.85rem;
  }

  .comp-sticky-header {
    font-size: 0.85rem;
  }
}

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

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 28px;
  margin: 0 auto;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
}

.status-std {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.status-opt {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

.status-na {
  background: var(--bg-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
/* Advantages Rich Comparison Content (adv-compdetails.php) */
.vs-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.vs-vehicle {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
}

.vs-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.adv-rich-content {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-primary);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.adv-rich-content ul,
.adv-rich-content ol {
  padding-left: 1.25rem;
  margin: 0.5rem 0;
}

.adv-rich-content li {
  margin-bottom: 0.4rem;
}

.adv-rich-content table {
  width: 100%;
  min-width: 320px;
  border-collapse: collapse;
  margin: 0.75rem 0;
  font-size: 0.875rem;
}

.adv-rich-content th,
.adv-rich-content td {
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
}

.adv-rich-content img {
  max-width: 100%;
  height: auto;
}
/* Admin Upload & Progress Log (admin/upload.php, admin/upload_receiver.php) */
input[type="file"] {
  width: 100%;
  padding: 0.55rem;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-subtle);
  border: 1px dashed #94a3b8;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

input[type="file"]::file-selector-button {
  min-height: 36px;
  padding: 0.4rem 0.85rem;
  margin-right: 0.75rem;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
}

.progress-log {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.85rem;
  color: var(--text-secondary);
  max-height: 280px;
  overflow-y: auto;
}

.code-error {
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius-sm);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.8rem;
  color: #991b1b;
  white-space: pre-wrap;
  word-break: break-word;
}

/* iOS / iPadOS Standalone Safe-Area Insets */
@supports (padding: env(safe-area-inset-top)) {
  .app-header {
    padding-top: env(safe-area-inset-top);
  }
  .app-footer {
    padding-bottom: calc(1.25rem + env(safe-area-inset-bottom));
  }
}