/* ═══════════════════════════════════════════════════════
   FlyTabs — Global Styles
   Modern, clean, aviation-inspired design system
   ═══════════════════════════════════════════════════════ */

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

/* Ensure hidden attribute works even with display overrides */
[hidden] { display: none !important; }

:root {
  --bg: #f4f7fb;
  --bg-subtle: #f8fafb;
  --surface: #ffffff;
  --text: #0c1222;
  --text-secondary: #3e4c63;
  --text-muted: #6b7a90;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --brand: #2563eb;
  --brand-hover: #1d4ed8;
  --brand-soft: #eff6ff;
  --brand-glow: rgba(37, 99, 235, 0.12);
  --success: #059669;
  --success-soft: #ecfdf5;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --warning: #d97706;
  --warning-soft: #fffbeb;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --transition: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --topbar-height: 56px;
}

html, body { height: 100%; margin: 0; }

body {
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─── Typography ────────────────────────────────────── */

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; color: var(--text); }
p { margin: 0; }

a { color: var(--brand); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--brand-hover); }

/* ─── Form Controls ─────────────────────────────────── */

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

input, select, textarea {
  font: inherit;
  font-size: 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: var(--surface);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}

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

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-glow);
}

input[type="color"] { padding: 4px; height: 40px; cursor: pointer; }
input[type="range"] { padding: 0; height: 28px; accent-color: var(--brand); border: none; background: transparent; }
input[type="range"]:focus { box-shadow: none; }

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

button, .btn {
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
}

button:hover, .btn:hover { background: var(--bg-subtle); border-color: var(--border-strong); }
button:active { transform: translateY(1px); }

button:focus-visible, .btn:focus-visible {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-glow);
}

button:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

button.primary, .btn-primary {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

button.primary:hover, .btn-primary:hover {
  background: var(--brand-hover);
  border-color: var(--brand-hover);
}

button.danger, .btn-danger {
  color: var(--danger);
  border-color: rgba(220, 38, 38, 0.25);
}

button.danger:hover, .btn-danger:hover {
  background: var(--danger-soft);
  border-color: var(--danger);
}

button.block, .btn-block, .block { width: 100%; }

/* ═══════════════════════════════════════════════════════
   Topbar + Responsive Nav
   ═══════════════════════════════════════════════════════ */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 20px;
  height: var(--topbar-height);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px) saturate(1.4);
  border-bottom: 1px solid var(--border);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  flex-shrink: 0;
}

.topbar-brand h1 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  background: transparent;
  border: none;
  cursor: pointer;
}

.topbar-link:hover { color: var(--text); background: var(--bg); }

/* Hamburger */
.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
  border: none;
  background: transparent;
  cursor: pointer;
}

.menu-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all var(--transition);
}

/* Auth pill */
.auth-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--text-muted);
}

.auth-pill.logged-in {
  color: var(--success);
  border-color: rgba(5, 150, 105, 0.25);
  background: var(--success-soft);
}

/* ─── Editor Layout ─────────────────────────────────── */

.layout {
  max-width: 1480px;
  margin: 0 auto;
  padding: 16px;
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 16px;
  align-items: start;
}

.panel, .card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.inspector {
  padding: 16px;
  position: sticky;
  top: calc(var(--topbar-height) + 16px);
}

.designer { padding: 16px; }

.inspector h2, .designer h2 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
}

.mini {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 10px;
  background: var(--bg-subtle);
}

.mini h3 {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

.status { min-height: 20px; margin: 0; font-size: 13px; color: var(--text-muted); }
.status.success { color: var(--success); }
.status.error { color: var(--danger); }

#globalStatus:not(:empty) {
  font-size: 15px;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-weight: 500;
}
#globalStatus.success:not(:empty) {
  background: #f0fdf4; border: 1px solid #bbf7d0;
}
#globalStatus.error:not(:empty) {
  background: #fef2f2; border: 1px solid #fecaca;
}

.muted { color: var(--text-muted); font-size: 13px; margin: 0; }

.muted code {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1px 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

/* ─── Sheet Preview ─────────────────────────────────── */

#sheetHost {
  background:
    linear-gradient(45deg, #f1f5f9 25%, transparent 25%),
    linear-gradient(-45deg, #f1f5f9 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #f1f5f9 75%),
    linear-gradient(-45deg, transparent 75%, #f1f5f9 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  overflow: auto;
}

.sheet-scale-viewport {
  position: relative;
  margin: 0 auto;
}

#selectedHint {
  display: inline-flex;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 4px 10px;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.chip {
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.chip:hover { border-color: var(--brand); color: var(--brand); }
.chip.active { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }

/* ─── Sheet Renderer ────────────────────────────────── */

.sheet {
  margin: 0;
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 58px;
  overflow: hidden;
  position: relative;
  box-sizing: border-box;
  will-change: transform;
}

/* Repeating watermark pattern */
.sheet-watermark {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}

.sheet-watermark-grid {
  position: absolute;
  inset: -50%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 60px;
}

.sheet-watermark-row {
  display: flex;
  justify-content: center;
  gap: 40px;
  white-space: nowrap;
}

.sheet-watermark-row span {
  font-size: clamp(14px, 2.5vw, 22px);
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text);
  user-select: none;
  text-align: center;
  flex-shrink: 0;
}

.rail {
  display: grid;
  min-width: 0;
  background: #fff;
  position: relative;
  z-index: 2;
}

.left-rail { border-right: 1px solid var(--border); }
.right-rail { border-left: 1px solid var(--border); }
.top-rail { border-bottom: 1px solid var(--border); }
.bottom-rail { border-top: 1px solid var(--border); }

.tab {
  border-bottom: 1px solid var(--border);
  background: var(--cell-bg, #f1f5f9);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3px;
  overflow: hidden;
  cursor: pointer;
  user-select: none;
  position: relative;
  transition: box-shadow var(--transition);
}

.tab::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.3) 0%, rgba(255,255,255,0) 100%);
  pointer-events: none;
}

.tab.active { outline: 2px solid var(--brand); outline-offset: -2px; color: var(--text); z-index: 1; }
.tab.selected { box-shadow: inset 0 0 0 2px var(--success); }
.tab.empty { opacity: 0.5; border-style: dashed; }
.tab.drag-source { opacity: 0.4; cursor: grabbing; }
.tab.drag-over { outline: 2px solid var(--brand); outline-offset: -2px; background: color-mix(in srgb, var(--cell-bg, #f1f5f9) 70%, var(--brand) 30%); z-index: 2; }

.tab-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  max-height: 100%;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.08;
  outline: none;
  word-break: break-word;
  letter-spacing: 0.01em;
  text-align: center;
}

.tab-label[contenteditable="true"]:empty::before,
.tab-label:empty::before {
  content: "(empty)";
  color: var(--text-muted);
  font-weight: 500;
}

.tab.v .tab-label { writing-mode: vertical-rl; transform: rotate(180deg); }
.tab.h .tab-label { writing-mode: horizontal-tb; transform: none; }

.center {
  padding: 20px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 12px;
  min-width: 0;
  background: #fff;
  position: relative;
  z-index: 2;
}

.center h1 {
  font-size: 22px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.page-title-editable {
  cursor: pointer;
  border-bottom: 1px dashed transparent;
  transition: border-color 0.15s;
}
.page-title-editable:hover {
  border-bottom-color: var(--border);
}

.page-title-input {
  font-size: 22px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  border: none;
  border-bottom: 2px solid var(--brand);
  outline: none;
  background: transparent;
  width: 100%;
  padding: 0 0 2px;
  margin: 0 0 4px;
  font-family: inherit;
}

/* ═══════════════════════════════════════════════════════
   Modal
   ═══════════════════════════════════════════════════════ */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay[hidden] { display: none; }

.modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  padding: 28px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  animation: modalIn 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

.modal-icon {
  font-size: 36px;
  margin-bottom: 12px;
}

.modal-card h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
}

.modal-card p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.6;
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.modal-actions button,
.modal-actions .btn {
  min-width: 100px;
  font-size: 13px;
  padding: 9px 16px;
}

/* ═══════════════════════════════════════════════════════
   Auth Pages — centered card layout
   ═══════════════════════════════════════════════════════ */

.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(37, 99, 235, 0.08) 0%, transparent 100%),
    var(--bg);
}

.auth-page .topbar {
  background: transparent;
  border-bottom: 1px solid transparent;
  backdrop-filter: none;
}

/* Auth page nav — no special override, use same hamburger behavior as all pages */

.auth-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px 48px;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 32px;
}

.auth-card-header {
  text-align: center;
  margin-bottom: 28px;
}

.auth-card-header h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.auth-card-header p { font-size: 14px; color: var(--text-muted); }

.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-form button[type="submit"] { margin-top: 4px; }

.auth-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 13px;
  color: var(--text-muted);
}

.auth-footer a { font-weight: 600; }

/* ═══════════════════════════════════════════════════════
   Account Page
   ═══════════════════════════════════════════════════════ */

.account-layout {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.account-layout .card { padding: 20px; }

.account-layout .card h2 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.account-layout .card-body { display: flex; flex-direction: column; gap: 12px; }

.account-summary-grid {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.account-summary-grid > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.account-summary-grid > div:last-child { border-bottom: none; }

.account-summary-grid dt { margin: 0; font-size: 13px; font-weight: 500; color: var(--text-muted); }
.account-summary-grid dd { margin: 0; font-size: 14px; font-weight: 500; color: var(--text); }

.status-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 100px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--text-secondary);
}

.status-badge.verified {
  border-color: rgba(5, 150, 105, 0.25);
  background: var(--success-soft);
  color: var(--success);
}

.status-badge.unverified {
  border-color: rgba(217, 119, 6, 0.25);
  background: var(--warning-soft);
  color: var(--warning);
}

/* ─── Sessions List ─────────────────────────────────── */

.sessions-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.session-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--surface);
}

.session-item.current {
  border-color: rgba(37, 99, 235, 0.25);
  background: var(--brand-soft);
}

.session-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.session-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
  word-break: break-all;
}

/* ─── Admin ─────────────────────────────────────────── */

.admin-toolbar { display: flex; flex-direction: column; gap: 10px; }
.admin-toolbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }

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

.admin-users-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
  background: var(--surface);
}

.admin-users-table th, .admin-users-table td {
  border-bottom: 1px solid var(--border);
  padding: 10px 12px;
  text-align: left;
  font-size: 13px;
}

.admin-users-table th {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: var(--bg-subtle);
}

.admin-row-actions { display: flex; justify-content: flex-end; }

.admin-actions-menu {
  position: relative;
}

.admin-actions-menu[open] {
  z-index: 3;
}

.admin-actions-toggle {
  list-style: none;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  user-select: none;
}

.admin-actions-toggle::-webkit-details-marker {
  display: none;
}

.admin-actions-list {
  position: fixed;
  top: 0;
  left: 0;
  min-width: 170px;
  max-height: calc(100vh - 16px);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 1100;
}

.admin-actions-list button {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 13px;
}

.admin-actions-list button:hover {
  background: var(--bg-subtle);
}

.admin-actions-list button.danger {
  color: #b91c1c;
}

.admin-pagination { margin-top: 10px; display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.admin-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.admin-nav-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.admin-nav-links .current {
  font-weight: 600;
}
.admin-inline-number {
  width: 92px;
}

/* User cell (table) */
.user-cell { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600; flex-shrink: 0;
}
.user-cell-info { display: flex; flex-direction: column; }
.user-cell-name { font-size: 13px; font-weight: 500; }
.user-cell-sub { font-size: 11px; color: var(--text-muted); }
.user-cell-badges { display: flex; flex-direction: column; gap: 4px; }

/* Mobile user cards */
.admin-cards-wrap { display: flex; flex-direction: column; gap: 12px; }
.user-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--surface);
}
.user-card-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.user-card-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 600; flex-shrink: 0;
}
.user-card-meta { flex: 1; min-width: 120px; }
.user-card-name { font-size: 14px; font-weight: 600; word-break: break-all; }
.user-card-sub { font-size: 12px; color: var(--text-muted); }
.user-card-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.user-card-detail-row {
  display: flex; flex-direction: column; gap: 4px;
  margin-bottom: 10px; padding: 8px 0;
  border-top: 1px solid var(--border);
}
.user-card-actions { display: flex; justify-content: flex-end; }

/* Legacy compat */
.activation-banner {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  border: 1px solid rgba(217, 119, 6, 0.3);
  border-radius: var(--radius-sm);
  background: var(--warning-soft);
  color: #92400e;
  padding: 10px 12px;
  margin-bottom: 10px;
  font-size: 13px;
}

.activation-banner button { margin-left: auto; font-size: 12px; padding: 6px 10px; }

.login-layout { max-width: 640px; grid-template-columns: 1fr; }
.admin-page-layout { max-width: 1120px; grid-template-columns: 1fr; }
.login-panel { padding: 20px; }
.login-panel h2 { margin: 0 0 12px; font-size: 16px; }
.login-panel .mini { margin-bottom: 14px; }

/* ═══════════════════════════════════════════════════════
   Responsive
   ═══════════════════════════════════════════════════════ */

@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; }
  .inspector { position: static; }
}

@media (max-width: 768px) {
  :root { --topbar-height: 48px; }

  .topbar { padding: 0 12px; gap: 8px; }
  .topbar-brand h1 { font-size: 15px; }

  /* Hamburger menu */
  .menu-toggle { display: flex; }

  .topbar-nav {
    display: none;
    position: absolute;
    top: var(--topbar-height);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    padding: 8px;
    z-index: 49;
  }

  .topbar-nav.open { display: flex; }

  .topbar-nav .topbar-link {
    padding: 12px 16px;
    font-size: 14px;
    border-radius: var(--radius-sm);
  }

  .topbar-nav .auth-pill {
    margin: 8px 16px;
    align-self: flex-start;
  }

  /* Editor layout on mobile */
  .layout {
    grid-template-columns: 1fr;
    padding: 8px;
    gap: 8px;
  }

  .inspector { padding: 12px; }
  .designer { padding: 12px; }

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

  /* Auth pages */
  .auth-card {
    padding: 24px 20px;
    border-radius: var(--radius-lg);
  }

  .auth-card-header h2 { font-size: 20px; }
  .auth-container { padding: 16px 12px 32px; }

  /* Account */
  .account-layout { padding: 8px; }
  .account-layout .card { padding: 16px; }

  /* Modal */
  .modal-card { padding: 24px 20px; }
  .modal-actions { flex-direction: column; }
  .modal-actions button, .modal-actions .btn { width: 100%; }
}

@media (max-width: 480px) {
  .row2 { grid-template-columns: 1fr; }
  .row3 { grid-template-columns: 1fr; }

  .topbar-brand h1 { font-size: 14px; }

  .inspector h2, .designer h2 { font-size: 14px; }

  .auth-card { padding: 20px 16px; }
  .auth-card-header h2 { font-size: 18px; }
}

/* ═══════════════════════════════════════════════════════
   Save Status Indicator
   ═══════════════════════════════════════════════════════ */

/* Save toast — floating notification top-right */
.save-toast {
  position: fixed;
  top: 60px;
  right: 16px;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  z-index: 100;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}
.save-toast.visible { opacity: 1; transform: translateY(0); pointer-events: auto; }
.save-toast.saved { color: var(--success); border-color: #bbf7d0; background: #f0fdf4; }
.save-toast.saving { color: var(--text-muted); }
.save-toast.error { color: var(--danger); border-color: #fecaca; background: #fef2f2; }
#exportToast { top: 104px; }

/* ── Share Toggle Switch ────────────────────────────── */

.share-toggle {
  margin-top: 8px;
}

.switch-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  flex-direction: row;
}

.switch-track {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}

.switch-track input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
}

.switch-thumb {
  position: absolute;
  inset: 0;
  background: var(--border-strong);
  border-radius: 100px;
  transition: background var(--transition);
}

.switch-thumb::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  box-shadow: var(--shadow-xs);
  transition: transform var(--transition);
}

.switch-track input:checked + .switch-thumb {
  background: var(--brand);
}

.switch-track input:checked + .switch-thumb::after {
  transform: translateX(16px);
}

.switch-track input:focus-visible + .switch-thumb {
  box-shadow: 0 0 0 3px var(--brand-glow);
}

.switch-text {
  user-select: none;
}

/* ═══════════════════════════════════════════════════════
   Template List
   ═══════════════════════════════════════════════════════ */

.template-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.template-choice {
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  padding: 12px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition);
  text-align: left;
}

.template-choice:hover {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand);
}

/* ═══════════════════════════════════════════════════════
   Content Preview (Semantic Formatting)
   ═══════════════════════════════════════════════════════ */

.content-preview {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  min-height: 520px;
  line-height: 1.5;
  font-size: 14px;
  background: var(--surface);
  cursor: text;
}

/* Double column: two side-by-side panes */
.double-column-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  flex: 1;
  min-height: 0;
}

.double-column-wrap .content-pane {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.double-column-wrap .content-pane:first-child {
  border-right: 1px solid var(--border);
}

.double-column-wrap .content-preview {
  border: none;
  border-radius: 0;
  min-height: 200px;
  flex: 1;
}

.double-column-wrap .content-editor {
  border: none;
  border-radius: 0;
  box-shadow: none;
  min-height: 200px;
  flex: 1;
}

.double-column-wrap .content-pane:first-child .content-editor {
  border-right: 1px solid var(--brand);
}

.content-preview.empty::before {
  content: "Click to edit page content...";
  color: var(--text-muted);
}

.content-editor {
  border: 1px solid var(--brand);
  border-radius: var(--radius-sm);
  padding: 14px;
  min-height: 520px;
  white-space: pre-wrap;
  tab-size: 4;
  line-height: 1.5;
  font-size: 14px;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  background: var(--surface);
  resize: vertical;
  width: 100%;
  box-shadow: 0 0 0 3px var(--brand-glow);
  outline: none;
}

/* Formatted lines */
.fmt-line { margin: 0 0 2px; white-space: pre-wrap; tab-size: 4; }
.fmt-blank { height: 1.2em; }

.fmt-heading {
  font-size: 1.2em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin: 8px 0 4px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 2px;
}

.fmt-check {
  padding-left: 4px;
}

.fmt-check::before { content: ''; }

.fmt-numbered {
  padding-left: 8px;
}

.fmt-callout {
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border-left: 3px solid;
  margin: 4px 0;
}

.fmt-note {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--text);
}

.fmt-note::before { content: 'ℹ '; font-weight: 700; }

.fmt-caution {
  background: var(--warning-soft);
  border-color: var(--warning);
  color: #92400e;
}

.fmt-caution::before { content: '⚠ '; font-weight: 700; }

.fmt-warning {
  background: var(--danger-soft);
  border-color: var(--danger);
  color: var(--danger);
}

.fmt-warning::before { content: '⛔ '; font-weight: 700; }

.fmt-success {
  background: var(--success-soft);
  border-color: var(--success);
  color: #065f46;
}

.fmt-success::before { content: '✓ '; font-weight: 700; }

/* Leader rows */
.fmt-leader {
  display: flex;
  align-items: baseline;
  gap: 4px;
  line-height: 1.4;
}

.fmt-leader .leader-left { white-space: pre-wrap; tab-size: 4; flex-shrink: 0; }
.fmt-leader .leader-right { white-space: nowrap; flex-shrink: 0; }
.fmt-leader .leader-dots {
  flex: 1 1 auto;
  min-width: 20px;
  border-bottom: 1px dotted #475569;
  margin-bottom: 0.2em;
}

/* ═══════════════════════════════════════════════════════
   Image Content
   ═══════════════════════════════════════════════════════ */

.content-image-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 520px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow: hidden;
}

.content-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.content-image-placeholder {
  color: var(--text-muted);
  font-size: 14px;
  text-align: center;
  padding: 40px;
}

/* ═══════════════════════════════════════════════════════
   Landing Page
   ═══════════════════════════════════════════════════════ */

.landing-page {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px;
}

.hero {
  text-align: center;
  padding: 64px 0 48px;
}

.hero h1 {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--text);
  margin-bottom: 20px;
}

.hero-subtitle {
  font-size: 18px;
  line-height: 1.6;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 32px;
}

.hero-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 16px;
  font-weight: 600;
  border-radius: var(--radius);
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--border-strong);
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.btn-outline:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.section {
  padding: 48px 0;
}

.section-alt {
  background: var(--bg-subtle);
  margin: 0 -20px;
  padding: 48px 20px;
}

.section-title {
  font-size: 28px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 36px;
}

.steps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.step-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  text-align: center;
}

.step-number {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  font-size: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.step-card h3 {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 8px;
}

.step-card p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

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

.feature-icon {
  font-size: 28px;
  margin-bottom: 12px;
}

.feature-card h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 6px;
}

.feature-card p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.cta-section {
  text-align: center;
  padding: 56px 0 64px;
}

.cta-section h2 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
}

.cta-section p {
  color: var(--text-muted);
  margin-bottom: 24px;
  font-size: 16px;
}

/* ── Support Page ──────────────────────────────────── */

.support-hero {
  padding-bottom: 24px;
}

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

.support-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 100%;
}

.support-eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand);
}

.support-card h2 {
  font-size: 24px;
  font-weight: 700;
}

.support-card p {
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-secondary);
}

.support-actions {
  margin-top: auto;
}

.support-actions-secondary {
  margin-top: 0;
}

.support-embed-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-subtle);
  box-shadow: var(--shadow-xs);
}

.support-embed {
  display: block;
  width: 100%;
  min-height: 720px;
  border: 0;
  background: transparent;
}

.support-contact {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.support-email {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  word-break: break-word;
}

.support-email:hover {
  color: var(--brand);
}

.support-note {
  font-size: 13px;
  color: var(--text-muted);
}

@media (max-width: 768px) {
  .hero h1 { font-size: 28px; }
  .hero-subtitle { font-size: 16px; }
  .steps-grid { grid-template-columns: 1fr; }
  .features-grid { grid-template-columns: 1fr; }
  .support-grid { grid-template-columns: 1fr; }
}

/* Admin page mobile */
@media (max-width: 639px) {
  .admin-filter-row { flex-wrap: wrap; gap: 8px; }
  .admin-filter-row input,
  .admin-filter-row select,
  .admin-filter-row button { flex: 1 1 auto; min-width: 0; }
  .admin-pagination { flex-wrap: wrap; justify-content: center; }
}

/* Code styling */
.code-value { font-size: 12px; background: var(--bg-subtle); padding: 3px 6px; border-radius: 4px; }
.code-value-lg { font-size: 14px; background: var(--bg-subtle); padding: 4px 8px; border-radius: 4px; }

/* Code card (mobile invitation codes) */
.inv-code-remaining { display: flex; align-items: center; gap: 8px; }
.code-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--surface);
}
.code-card-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.code-card-detail-row { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; padding: 8px 0; border-top: 1px solid var(--border); }
.code-card-edit-row { margin-bottom: 10px; }
.code-card-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.code-card-actions button { font-size: 12px; padding: 6px 10px; }

/* Field validation errors */
input.field-error { border-color: var(--red, #e53e3e) !important; outline: none; box-shadow: 0 0 0 2px rgba(229, 62, 62, 0.25); }
.field-error-msg { display: block; color: var(--red, #e53e3e); font-size: 11px; margin-top: 3px; }
