/* ═══════════════════════════════════════════════════════════
   Cloudflare Mail Forge — Dark Precision UI
   "Cold Luxury · 克制中带着奢华"
   ═══════════════════════════════════════════════════════════ */

/* ── Design Tokens ───────────────────────────────────────── */
:root {
  /* Void Palette */
  --void:      #07070a;
  --void-1:    #0d0d11;
  --void-2:    #131318;

  /* Glass Surfaces */
  --glass-0:   rgba(255, 251, 240, 0.032);
  --glass-1:   rgba(255, 251, 240, 0.056);
  --glass-2:   rgba(255, 251, 240, 0.09);

  /* Text Hierarchy — 深色背景下保证可读性 */
  --text-1:    #ede8df;
  --text-2:    rgba(237, 232, 223, 0.72);   /* 次要文字，标签、描述 */
  --text-3:    rgba(237, 232, 223, 0.52);   /* 三级文字，表头、占位符 */
  --text-4:    rgba(237, 232, 223, 0.30);   /* 四级，仅装饰性元素 */

  /* Borders */
  --border:    rgba(255, 251, 240, 0.072);
  --border-2:  rgba(255, 251, 240, 0.13);
  --border-3:  rgba(255, 251, 240, 0.22);

  /* Aged Brass — the single accent */
  --gold:         #c2a45a;
  --gold-dim:     rgba(194, 164, 90, 0.1);
  --gold-border:  rgba(194, 164, 90, 0.32);
  --gold-glow:    rgba(194, 164, 90, 0.06);

  /* Semantics — muted, not shouty */
  --ok:        #4d8a66;
  --ok-dim:    rgba(77, 138, 102, 0.1);
  --ok-border: rgba(77, 138, 102, 0.28);
  --fail:      #994040;
  --fail-dim:  rgba(153, 64, 64, 0.1);
  --fail-border: rgba(153, 64, 64, 0.28);

  /* Radii — deliberate, not excessive */
  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;
  --r-xl: 22px;

  /* Blur */
  --blur: blur(24px) saturate(160%);
}

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

/* ── Base ────────────────────────────────────────────────── */
html {
  min-height: 100%;
  color-scheme: dark; /* 让浏览器原生控件（select 下拉等）使用深色 */
}

body {
  background: var(--void);
  color: var(--text-1);
  font-family: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  position: relative;
  overflow-x: hidden;
}

/* ── Ambient Background ──────────────────────────────────── */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 110% 60% at 18% -8%,  rgba(194, 164, 90, 0.062) 0%, transparent 50%),
    radial-gradient(ellipse  80% 50% at 82% 108%, rgba(194, 164, 90, 0.038) 0%, transparent 50%),
    radial-gradient(ellipse  60% 40% at 50%  55%, rgba(255, 251, 240, 0.014) 0%, transparent 55%);
  pointer-events: none;
  z-index: 0;
}

/* ── Grid Overlay ────────────────────────────────────────── */
.background-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(rgba(255, 251, 240, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 251, 240, 0.018) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image:
    radial-gradient(ellipse 75% 65% at 50% 0%, rgba(0,0,0,0.9) 0%, transparent 70%);
}

/* ── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar            { width: 5px; height: 5px; }
::-webkit-scrollbar-track      { background: transparent; }
::-webkit-scrollbar-thumb      { background: var(--border-2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover{ background: var(--border-3); }

/* ══════════════════════════════════════════════════════════
   TOP NAVIGATION
   ══════════════════════════════════════════════════════════ */
.top-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 52px;
  z-index: 100;
  background: rgba(7, 7, 10, 0.82);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: 1520px;
  margin: 0 auto;
  padding: 0 28px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 32px;
}

/* Brand */
.nav-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--gold);
  flex-shrink: 0;
}

.nav-brand-name {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  color: var(--text-1);
}

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

.nav-tab {
  position: relative;
  padding: 6px 16px;
  border-radius: var(--r-sm);
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: color 0.18s, background 0.18s;
  white-space: nowrap;
}

.nav-tab:hover {
  color: var(--text-1);
  background: var(--glass-1);
}

.nav-tab.active {
  color: var(--text-1);
}

/* Active underline */
.nav-tab.active::after {
  content: "";
  position: absolute;
  bottom: -14px;
  left: 12px;
  right: 12px;
  height: 1px;
  background: var(--gold);
  border-radius: 1px;
}

/* Nav Right */
.nav-end {
  margin-left: auto;
  flex-shrink: 0;
}

.nav-health {
  font-size: 0.78rem;
}

/* ── Page Sections ───────────────────────────────────────── */
.page-section {
  padding-top: 52px; /* offset fixed nav */
}

/* ── App Shell ───────────────────────────────────────────── */
.app-shell {
  position: relative;
  z-index: 1;
  max-width: 1520px;
  margin: 0 auto;
  padding: 36px 28px 96px;
}

/* ══════════════════════════════════════════════════════════
   PANEL SYSTEM
   ══════════════════════════════════════════════════════════ */
.panel {
  position: relative;
  background: var(--glass-0);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  overflow: hidden;
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  transition: border-color 0.3s;
}

/* Inner gradient shimmer */
.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    155deg,
    rgba(255, 251, 240, 0.048) 0%,
    transparent 45%
  );
  pointer-events: none;
  border-radius: inherit;
  z-index: 0;
}

/* Top-edge light line — the luxury detail */
.panel::after {
  content: "";
  position: absolute;
  top: 0;
  left: 14px;
  right: 14px;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 251, 240, 0.14) 30%,
    rgba(255, 251, 240, 0.14) 70%,
    transparent 100%
  );
  pointer-events: none;
  z-index: 1;
}

/* All panel content sits above overlays */
.panel > * {
  position: relative;
  z-index: 2;
}

/* ══════════════════════════════════════════════════════════
   HERO
   ══════════════════════════════════════════════════════════ */
.hero {
  display: grid;
  gap: 40px;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.65fr);
  margin-bottom: 24px;
  padding: 52px 52px 44px;
}

.hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  color: var(--gold);
  font-size: 0.715rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  display: block;
  width: 24px;
  height: 1px;
  background: currentColor;
  opacity: 0.75;
  flex-shrink: 0;
}

.hero-copy h1 {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 700;
  font-size: clamp(3.2rem, 5.5vw, 6.2rem);
  line-height: 0.88;
  letter-spacing: -0.045em;
  color: var(--text-1);
  margin-bottom: 24px;
}

.hero-text {
  color: var(--text-2);
  font-size: 0.94rem;
  line-height: 1.8;
  max-width: 50ch;
}

/* ── Stat Tiles ──────────────────────────────────────────── */
.hero-stats {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: center;
}

.stat-tile {
  padding: 22px 20px 18px;
  background: var(--glass-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  position: relative;
  overflow: hidden;
  transition: border-color 0.25s;
}

.stat-tile::after {
  content: "";
  position: absolute;
  top: 0; left: 10px; right: 10px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,251,240,0.11), transparent);
}

.stat-tile:hover {
  border-color: var(--border-2);
}

.stat-label {
  display: block;
  font-size: 0.71rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 10px;
}

.stat-tile strong {
  display: block;
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(2.6rem, 3.8vw, 4.2rem);
  font-weight: 600;
  letter-spacing: -0.05em;
  line-height: 1;
  color: var(--text-1);
}

.stat-tile.accent {
  background: var(--gold-dim);
  border-color: var(--gold-border);
}

.stat-tile.accent::after {
  background: linear-gradient(90deg, transparent, rgba(194, 164, 90, 0.22), transparent);
}

.stat-tile.accent .stat-label {
  color: rgba(194, 164, 90, 0.55);
}

.stat-tile.accent strong {
  color: var(--gold);
}

/* ══════════════════════════════════════════════════════════
   WORKSPACE GRID
   ══════════════════════════════════════════════════════════ */
.workspace-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(12, minmax(0, 1fr));
}

.workspace-grid > .panel {
  padding: 28px 28px 24px;
}

.workspace-grid > .panel:nth-child(1),
.workspace-grid > .panel:nth-child(2),
.workspace-grid > .panel:nth-child(3) {
  grid-column: span 4;
}

.rules-panel {
  grid-column: 1 / -1;
}

.log-panel {
  margin-top: 20px;
  padding: 28px;
}

/* ── Panel Head ──────────────────────────────────────────── */
.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.panel-head h2 {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  font-size: 1.4rem;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--text-1);
  margin: 0;
}

/* ── Badge & Meta ────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid var(--border-2);
  background: var(--glass-1);
  font-size: 0.78rem;
  color: var(--text-2);
  white-space: nowrap;
}

.badge::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ok);
  flex-shrink: 0;
  box-shadow: 0 0 6px var(--ok);
}

.meta-text {
  color: var(--text-2);
  font-size: 0.8rem;
  line-height: 1.4;
}

/* ══════════════════════════════════════════════════════════
   FORMS
   ══════════════════════════════════════════════════════════ */
.stack-form {
  display: grid;
  gap: 16px;
}

.compact-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

label {
  display: grid;
  gap: 8px;
}

label > span:not(.zone-name):not(.zone-chip):not(.status-pill):not(.meta-text) {
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.025em;
  color: var(--text-2);
}

/* ── Inputs ──────────────────────────────────────────────── */
input,
textarea,
select {
  width: 100%;
  padding: 11px 15px;
  border: 1px solid var(--border-2);
  border-radius: var(--r-md);
  background: rgba(255, 251, 240, 0.026);
  color: var(--text-1);
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.5;
  outline: none;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
  appearance: none;
}

input:hover,
textarea:hover,
select:hover {
  border-color: var(--border-3);
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--gold-border);
  background: rgba(255, 251, 240, 0.042);
  box-shadow: 0 0 0 3px rgba(194, 164, 90, 0.08);
}

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

/* Select — solid dark background 确保下拉弹层也是深色（配合 html color-scheme: dark） */
select {
  background-color: #131318;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='8' viewBox='0 0 14 8'%3E%3Cpath d='M1 1l6 6 6-6' stroke='rgba(237,232,223,0.55)' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
  cursor: pointer;
  color-scheme: dark;
}

select option {
  background-color: #131318;
  color: var(--text-1);
}

/* Search cancel button */
input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

/* ── Actions ─────────────────────────────────────────────── */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding-top: 6px;
  margin-top: 4px;
  border-top: 1px solid var(--border);
}

.toolbar,
.inline-actions,
.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.toolbar {
  margin-bottom: 16px;
}

.rules-toolbar {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 12px;
  margin-bottom: 0;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

/* ══════════════════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════════════════ */
.button,
.tiny-button,
.mode-chip {
  font-family: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.18s, border-color 0.18s, color 0.18s, box-shadow 0.18s;
  white-space: nowrap;
  text-decoration: none;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 999px;
  padding: 9px 22px;
  font-size: 0.865rem;
  font-weight: 500;
  letter-spacing: 0.015em;
  background: transparent;
}

/* Primary — gold outline, restrained */
.button.primary {
  color: var(--gold);
  background: var(--gold-dim);
  border-color: var(--gold-border);
}

.button.primary:hover {
  background: rgba(194, 164, 90, 0.17);
  border-color: rgba(194, 164, 90, 0.5);
  box-shadow: 0 0 16px rgba(194, 164, 90, 0.1);
}

/* Ghost */
.button.ghost {
  color: var(--text-2);
  border-color: var(--border-2);
}

.button.ghost:hover {
  color: var(--text-1);
  background: var(--glass-2);
  border-color: var(--border-3);
}

/* Danger */
.button.danger {
  color: var(--fail);
  border-color: var(--fail-border);
}

.button.danger:hover {
  background: var(--fail-dim);
  border-color: rgba(153, 64, 64, 0.45);
}

/* Tiny buttons in table rows */
.tiny-button {
  padding: 4px 12px;
  font-size: 0.77rem;
  border-radius: 999px;
  border-color: var(--border-2);
  background: transparent;
  color: var(--text-2);
  font-family: inherit;
  cursor: pointer;
}

.tiny-button:hover {
  background: var(--glass-2);
  border-color: var(--border-3);
  color: var(--text-1);
}

.tiny-button.warn {
  color: var(--fail);
  border-color: var(--fail-border);
}

.tiny-button.warn:hover {
  background: var(--fail-dim);
}

.tiny-button.success {
  color: var(--ok);
  border-color: var(--ok-border);
}

.tiny-button.success:hover {
  background: var(--ok-dim);
}

/* ══════════════════════════════════════════════════════════
   MODE SWITCH
   ══════════════════════════════════════════════════════════ */
.mode-switch {
  display: inline-flex;
  gap: 3px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(255, 251, 240, 0.038);
  border: 1px solid var(--border);
  width: fit-content;
}

.mode-chip {
  border-radius: 999px;
  padding: 8px 18px;
  font-size: 0.845rem;
  font-weight: 500;
  color: var(--text-2);
  background: transparent;
  border: 1px solid transparent;
  transition: all 0.18s;
}

.mode-chip.active {
  color: var(--gold);
  background: var(--gold-dim);
  border-color: var(--gold-border);
}

.mode-chip:not(.active):hover {
  color: var(--text-1);
  background: var(--glass-1);
}

/* ══════════════════════════════════════════════════════════
   ZONE LIST
   ══════════════════════════════════════════════════════════ */
.zone-list {
  display: grid;
  gap: 8px;
  max-height: 340px;
  overflow-y: auto;
  padding-right: 2px;
}

.zone-card {
  padding: 13px 16px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: transparent;
  transition: border-color 0.2s, background 0.2s;
}

.zone-card:hover {
  border-color: var(--border-2);
  background: var(--glass-1);
}

.zone-card.selected {
  border-color: var(--gold-border);
  background: var(--gold-dim);
}

.zone-card-head,
.zone-card-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.zone-card-head { margin-bottom: 8px; }

.zone-name {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text-1);
}

.zone-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  border: 1px solid var(--border-2);
  color: var(--text-3);
  background: transparent;
}

/* Checkbox inside zone cards */
.checkbox-line {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.checkbox-line input {
  width: auto;
  padding: 0;
  border: none;
  background: none;
  flex-shrink: 0;
  accent-color: var(--gold);
}

/* ══════════════════════════════════════════════════════════
   STATUS PILLS
   ══════════════════════════════════════════════════════════ */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.73rem;
  letter-spacing: 0.05em;
  border: 1px solid var(--border-2);
  color: var(--text-3);
}

.status-pill::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
  background: currentColor;
}

.status-pill.enabled {
  color: var(--ok);
  border-color: var(--ok-border);
  background: var(--ok-dim);
}

.status-pill.disabled {
  color: var(--fail);
  border-color: var(--fail-border);
  background: var(--fail-dim);
}

/* ══════════════════════════════════════════════════════════
   TABLE
   ══════════════════════════════════════════════════════════ */
.table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: rgba(255, 251, 240, 0.016);
  margin-top: 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 880px;
}

thead {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(7, 7, 10, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

th {
  padding: 12px 14px;
  text-align: left;
  color: var(--text-3);
  font-size: 0.71rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 13px 14px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid rgba(255, 251, 240, 0.042);
}

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

tbody tr {
  transition: background 0.15s;
}

tbody tr:hover td {
  background: rgba(255, 251, 240, 0.022);
}

.rule-address {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-1);
}

.rule-destinations {
  font-family: "IBM Plex Mono", "Courier New", monospace;
  font-size: 0.78rem;
  color: var(--text-3);
  margin-top: 3px;
}

/* ── Select All Checkbox ─────────────────────────────────── */
input[type="checkbox"] {
  accent-color: var(--gold);
  width: auto;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
}

/* ══════════════════════════════════════════════════════════
   OPERATION LOG
   ══════════════════════════════════════════════════════════ */
.log-list {
  display: grid;
  gap: 5px;
  max-height: 240px;
  overflow-y: auto;
  padding-right: 4px;
}

.log-entry {
  padding: 9px 14px 9px 16px;
  border-radius: var(--r-xs);
  border-left: 2px solid var(--border-2);
  font-family: "IBM Plex Mono", "Courier New", monospace;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--text-2);
  background: transparent;
  transition: background 0.15s;
}

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

.log-entry.info {
  border-left-color: rgba(194, 164, 90, 0.3);
}

.log-entry.success {
  color: var(--ok);
  border-left-color: var(--ok);
}

.log-entry.error {
  color: var(--fail);
  border-left-color: var(--fail);
}

/* ══════════════════════════════════════════════════════════
   UTILITY
   ══════════════════════════════════════════════════════════ */
.empty-state,
.empty-cell {
  color: var(--text-3);
  text-align: center;
  padding: 48px 20px;
  font-size: 0.875rem;
  letter-spacing: 0.02em;
}

.hidden {
  display: none !important;
}

/* ══════════════════════════════════════════════════════════
   REVEAL ANIMATION — staggered rise
   ══════════════════════════════════════════════════════════ */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  animation: rise 700ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Hero */
.hero.reveal { animation-delay: 0ms; }

/* Workspace panels */
.workspace-grid > .reveal:nth-child(1) { animation-delay: 90ms; }
.workspace-grid > .reveal:nth-child(2) { animation-delay: 170ms; }
.workspace-grid > .reveal:nth-child(3) { animation-delay: 250ms; }
.workspace-grid > .reveal:nth-child(4) { animation-delay: 330ms; }

/* Log panel */
.log-panel { animation-delay: 420ms; }

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

/* ══════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════ */
@media (max-width: 1200px) {
  .hero,
  .workspace-grid {
    grid-template-columns: 1fr;
  }

  .workspace-grid > .panel:nth-child(1),
  .workspace-grid > .panel:nth-child(2),
  .workspace-grid > .panel:nth-child(3),
  .rules-panel {
    grid-column: auto;
  }

  .hero-stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .app-shell {
    padding: 20px 16px 56px;
  }

  .hero {
    padding: 32px 28px;
  }

  .workspace-grid > .panel,
  .log-panel {
    padding: 22px 20px;
  }

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

  .rules-toolbar {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 580px) {
  .hero-copy h1 {
    font-size: 2.8rem;
  }

  .compact-grid {
    grid-template-columns: 1fr;
  }

  .panel-head {
    flex-direction: column;
    align-items: flex-start;
  }

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

/* ══════════════════════════════════════════════════════════
   HELP PAGE
   ══════════════════════════════════════════════════════════ */

/* Shell */
.help-shell {
  max-width: 820px;
  margin: 0 auto;
  padding: 40px 28px 96px;
}

/* Help Hero */
.help-hero {
  padding: 44px 52px 40px;
  margin-bottom: 24px;
}

.help-hero h1 {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 700;
  font-size: clamp(2.4rem, 4vw, 3.6rem);
  letter-spacing: -0.04em;
  line-height: 0.95;
  margin-bottom: 16px;
}

.help-hero-sub {
  color: var(--text-2);
  font-size: 0.95rem;
  line-height: 1.7;
}

/* Help Body */
.help-body {
  display: grid;
  gap: 16px;
}

/* Section */
.help-section {
  padding: 36px 40px;
}

.help-section-label {
  display: flex;
  align-items: baseline;
  gap: 18px;
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.help-num {
  font-family: "Fraunces", Georgia, serif;
  font-size: 2.4rem;
  font-weight: 300;
  letter-spacing: -0.04em;
  color: var(--gold);
  opacity: 0.65;
  line-height: 1;
  flex-shrink: 0;
}

.help-section-label h2 {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--text-1);
  margin: 0;
  line-height: 1.2;
}

/* Section body text */
.help-section > p {
  color: var(--text-2);
  font-size: 0.92rem;
  line-height: 1.8;
  margin-bottom: 16px;
}

.help-section h3 {
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-2);
  margin: 22px 0 10px;
}

/* Lists */
.help-list,
.help-steps {
  color: var(--text-2);
  font-size: 0.9rem;
  line-height: 1.8;
  padding-left: 0;
  list-style: none;
  display: grid;
  gap: 6px;
  margin-bottom: 16px;
}

.help-list li {
  padding-left: 18px;
  position: relative;
}

.help-list li::before {
  content: "—";
  position: absolute;
  left: 0;
  color: var(--gold);
  opacity: 0.5;
  font-size: 0.8em;
}

.help-steps {
  counter-reset: step;
}

.help-steps li {
  padding-left: 28px;
  position: relative;
  counter-increment: step;
}

.help-steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 18px;
  height: 18px;
  line-height: 18px;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--gold);
  border: 1px solid var(--gold-border);
  border-radius: 50%;
  background: var(--gold-dim);
  margin-top: 3px;
}

/* Help Table */
.help-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
}

.help-table th {
  padding: 10px 14px;
  background: rgba(255, 251, 240, 0.04);
  color: var(--text-3);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.help-table td {
  padding: 12px 14px;
  color: var(--text-2);
  font-size: 0.88rem;
  border-bottom: 1px solid rgba(255, 251, 240, 0.05);
  vertical-align: top;
}

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

.help-table tbody tr:hover td {
  background: rgba(255, 251, 240, 0.02);
}

/* Code inline */
code {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.84em;
  color: var(--gold);
  background: var(--gold-dim);
  border: 1px solid rgba(194, 164, 90, 0.18);
  border-radius: 4px;
  padding: 1px 6px;
}

/* Callout boxes */
.help-callout {
  display: flex;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--r-md);
  font-size: 0.875rem;
  line-height: 1.65;
  margin: 16px 0;
}

.help-callout.warn {
  background: var(--fail-dim);
  border: 1px solid var(--fail-border);
  color: rgba(237, 232, 223, 0.75);
}

.help-callout.warn strong {
  color: var(--fail);
}

.help-callout.info {
  background: var(--gold-dim);
  border: 1px solid var(--gold-border);
  color: rgba(237, 232, 223, 0.75);
}

.help-callout.info strong {
  color: var(--gold);
}

/* FAQ Accordion */
.help-faq {
  display: grid;
  gap: 8px;
}

.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  transition: border-color 0.2s;
}

.faq-item:hover {
  border-color: var(--border-2);
}

.faq-item[open] {
  border-color: var(--gold-border);
}

.faq-item summary {
  padding: 14px 18px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-1);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: background 0.15s;
  user-select: none;
}

.faq-item summary:hover {
  background: var(--glass-1);
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "+";
  font-size: 1.1rem;
  color: var(--gold);
  opacity: 0.7;
  flex-shrink: 0;
  font-weight: 300;
  transition: transform 0.2s;
}

.faq-item[open] summary::after {
  transform: rotate(45deg);
}

.faq-item > p {
  padding: 0 18px 16px;
  font-size: 0.875rem;
  color: var(--text-2);
  line-height: 1.75;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

/* Staggered reveals for help page */
.help-hero.reveal        { animation-delay: 0ms; }
.help-section.reveal:nth-of-type(1) { animation-delay: 80ms; }
.help-section.reveal:nth-of-type(2) { animation-delay: 140ms; }
.help-section.reveal:nth-of-type(3) { animation-delay: 200ms; }
.help-section.reveal:nth-of-type(4) { animation-delay: 260ms; }
.help-section.reveal:nth-of-type(5) { animation-delay: 320ms; }
.help-section.reveal:nth-of-type(6) { animation-delay: 380ms; }

/* Help page responsive */
@media (max-width: 680px) {
  .help-shell {
    padding: 24px 16px 64px;
  }

  .help-hero {
    padding: 28px 24px;
  }

  .help-section {
    padding: 28px 22px;
  }

  .help-section-label {
    gap: 12px;
  }

  .help-num {
    font-size: 1.8rem;
  }
}
