/* ==========================================================================
   alomotion — After Effects-Inspired Pro Motion Studio UI
   Palette: Neutral Obsidian / Charcoal + Spectrum Blue (#2680eb) + Red Playhead
   Zero purple, zero native ugly file inputs, crisp 1px docked panels.
   ========================================================================== */

:root {
  --bg-app: #101012;
  --bg-panel: #18181b;
  --bg-head: #202024;
  --bg-elev: #25252a;
  --bg-input: #111114;
  --bg-hover: #2c2c33;
  --border: #2c2c32;
  --border-strong: #3d3d46;

  --text-1: #ececef;
  --text-2: #9b9ba5;
  --text-3: #6b6b75;

  --blue: #2680eb;
  --blue-hover: #1473e6;
  --blue-text: #5aa9ff;
  --blue-soft: rgba(38, 128, 235, 0.14);

  --playhead: #e5484d;
  --green: #2d9d78;
  --green-soft: rgba(45, 157, 120, 0.16);
  --amber: #e68619;
  --amber-soft: rgba(230, 134, 25, 0.16);
  --red: #d7373f;
  --red-soft: rgba(215, 55, 63, 0.15);

  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
}

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

html, body {
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--bg-app);
  color: var(--text-1);
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

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

/* Scrollbars */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-app); }
::-webkit-scrollbar-thumb { background: #32323a; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #464652; }

/* ==========================================================================
   APP SHELL & TOP MENUBAR (After Effects Style)
   ========================================================================== */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  height: 100vh;
}
@media (max-width: 960px) {
  .app-shell {
    height: auto;
    min-height: 100vh;
    padding-bottom: 58px; /* space for mobile bottom nav */
  }
}

.menubar {
  height: 44px;
  flex-shrink: 0;
  background: var(--bg-head);
  border-bottom: 1px solid var(--border);
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 40;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-1);
  text-decoration: none;
  flex-shrink: 0;
}
.brand-mark:hover { text-decoration: none; }
.brand-word {
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.03em;
  color: var(--text-1);
}

.nav-tabs {
  display: flex;
  align-items: center;
  height: 100%;
  gap: 2px;
}
.nav-tab {
  height: 100%;
  padding: 0 13px;
  border: 0;
  background: transparent;
  color: var(--text-2);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  position: relative;
  transition: color 0.12s, background 0.12s;
}
.nav-tab:hover { color: var(--text-1); background: rgba(255,255,255,0.03); }
.nav-tab.active {
  color: var(--text-1);
  background: var(--bg-panel);
}
.nav-tab.active::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  background: var(--blue);
}

.menu-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Custom Segmented Language Switcher (NO browser select!) */
.lang-switch {
  display: inline-flex;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 2px;
}
.lang-btn {
  border: 0;
  background: transparent;
  color: var(--text-3);
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 3px;
  cursor: pointer;
  transition: 0.12s;
}
.lang-btn:hover { color: var(--text-1); }
.lang-btn.active {
  background: var(--bg-elev);
  color: var(--text-1);
  box-shadow: inset 0 0 0 1px var(--border-strong);
}

/* Mobile Bottom Navigation Dock */
.mobile-dock {
  display: none;
}
@media (max-width: 960px) {
  .nav-tabs { display: none; }
  .mobile-dock {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    position: fixed;
    left: 0; right: 0; bottom: 0;
    height: 56px;
    background: var(--bg-head);
    border-top: 1px solid var(--border);
    z-index: 45;
  }
  .dock-btn {
    border: 0;
    background: transparent;
    color: var(--text-2);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    font-family: inherit;
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    position: relative;
  }
  .dock-btn svg { width: 17px; height: 17px; }
  .dock-btn.active { color: var(--blue-text); }
  .dock-btn.active::before {
    content: '';
    position: absolute;
    top: 0; left: 20%; right: 20%;
    height: 2px;
    background: var(--blue);
  }
}

/* ==========================================================================
   BUTTONS & CUSTOM CONTROLS (Zero Ugly Browser Defaults)
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 30px;
  padding: 0 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-elev);
  color: var(--text-1);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.btn:hover { background: var(--bg-hover); border-color: #4f4f5a; text-decoration: none; }
.btn:disabled { opacity: 0.42; cursor: not-allowed; }
.btn svg { width: 13px; height: 13px; flex-shrink: 0; }

.btn-primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
  font-weight: 600;
}
.btn-primary:hover { background: var(--blue-hover); border-color: var(--blue-hover); }

.btn-success {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
  font-weight: 600;
}
.btn-success:hover { background: #268767; border-color: #268767; }

.btn-danger {
  background: var(--red-soft);
  border-color: rgba(215, 55, 63, 0.45);
  color: #f58b90;
}
.btn-danger:hover { background: rgba(215, 55, 63, 0.25); color: #fff; }

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-2);
}
.btn-ghost:hover { background: var(--bg-elev); border-color: var(--border); color: var(--text-1); }

.btn-icon { width: 30px; padding: 0; }
.btn-lg { height: 36px; padding: 0 16px; font-size: 13px; }
.btn-sm { height: 26px; padding: 0 9px; font-size: 11px; }

/* Custom Inputs & Selects */
.input, .select {
  width: 100%;
  min-width: 0;
  height: 32px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-input);
  color: var(--text-1);
  font-family: inherit;
  font-size: 12px;
  outline: none;
  transition: border-color 0.12s;
}
.input:focus, .select:focus { border-color: var(--blue); }
.input[readonly] { color: var(--text-2); background: #141417; }

.select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239b9ba5' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  cursor: pointer;
}
.select option { background: #18181b; color: #ececef; }

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}
.field-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-2);
}

/* Custom Upload Dropzone (replaces ugly native file input) */
.dropzone {
  border: 1px dashed var(--border-strong);
  background: var(--bg-input);
  border-radius: var(--radius-md);
  padding: 14px 12px;
  display: flex;
  align-items: center;
  gap: 11px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover {
  border-color: var(--blue);
  background: rgba(38, 128, 235, 0.05);
}
.dropzone-icon {
  width: 34px; height: 34px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  color: var(--blue-text);
}
.dropzone-text strong { display: block; font-size: 12px; color: var(--text-1); font-weight: 600; }
.dropzone-text span { display: block; font-size: 11px; color: var(--text-3); margin-top: 2px; }

/* ==========================================================================
   VIEWS CONTAINER
   ========================================================================== */
.views-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.view {
  display: none;
  flex: 1;
  min-height: 0;
}
.view.active {
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   VIEW 1: STUDIO (After Effects Docked NLE Workspace)
   ========================================================================== */
.studio-toolbar {
  min-height: 40px;
  flex-shrink: 0;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  padding: 5px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.studio-tb-left {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 240px;
  min-width: 0;
}
.comp-picker {
  max-width: 240px;
  min-width: 140px;
  flex: 1;
}
.studio-tb-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.spec-pill {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-2);
  background: var(--bg-input);
  border: 1px solid var(--border);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.studio-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(340px, 0.85fr);
  gap: 1px;
  background: var(--border);
}
@media (max-width: 960px) {
  .studio-grid {
    grid-template-columns: 1fr;
    gap: 1px;
  }
}

/* Left Dock: Monitor + Timeline */
.monitor-dock {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--bg-panel);
}

.panel-head {
  height: 32px;
  flex-shrink: 0;
  background: var(--bg-head);
  border-bottom: 1px solid var(--border);
  padding: 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.panel-head-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.panel-head-title .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--blue);
}

.monitor-viewport {
  flex: 1;
  min-height: 240px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  overflow: hidden;
  background: #0d0d0f;
}
.monitor-viewport.checker {
  background-color: #141417;
  background-image:
    linear-gradient(45deg, #1b1b20 25%, transparent 25%),
    linear-gradient(-45deg, #1b1b20 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #1b1b20 75%),
    linear-gradient(-45deg, transparent 75%, #1b1b20 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}
@media (max-width: 960px) {
  .monitor-viewport {
    height: 40vh;
    min-height: 230px;
    max-height: 380px;
    flex: none;
  }
}

.stage-box {
  position: relative;
  background: #000;
  border: 1px solid #35353e;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.72);
  overflow: hidden;
  flex-shrink: 0;
}
.stage-box iframe {
  display: block;
  border: 0;
  transform-origin: top left;
  pointer-events: none;
  background: #000;
}

.stage-error {
  position: absolute;
  inset: 12px;
  z-index: 10;
  background: rgba(20, 12, 13, 0.96);
  border: 1px solid var(--red);
  border-radius: var(--radius-md);
  padding: 12px;
  display: none;
  flex-direction: column;
  gap: 8px;
  overflow: auto;
}
.stage-error-head {
  font-size: 12px;
  font-weight: 700;
  color: #f87171;
  display: flex;
  align-items: center;
  gap: 6px;
}
.stage-error pre {
  font-family: var(--font-mono);
  font-size: 11px;
  color: #fca5a5;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ==========================================================================
   AFTER EFFECTS TIMELINE DOCK
   ========================================================================== */
.timeline-dock {
  flex-shrink: 0;
  background: var(--bg-panel);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}
.transport-bar {
  padding: 6px 10px;
  background: var(--bg-head);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.transport-group {
  display: flex;
  align-items: center;
  gap: 4px;
}
.timecode-display {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.tc-main {
  font-size: 15px;
  font-weight: 700;
  color: var(--blue-text);
  letter-spacing: 0.04em;
}
.tc-frames {
  font-size: 11px;
  color: var(--text-3);
}

/* Ruler + Track Lanes */
.timeline-body {
  display: grid;
  grid-template-columns: 124px minmax(0, 1fr);
  background: var(--bg-input);
  user-select: none;
}
@media (max-width: 600px) {
  .timeline-body {
    grid-template-columns: 82px minmax(0, 1fr);
  }
}

.track-headers {
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}
.th-ruler {
  height: 22px;
  border-bottom: 1px solid var(--border);
  padding: 0 8px;
  display: flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
}
.th-lane {
  height: 30px;
  border-bottom: 1px solid var(--border);
  padding: 0 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.th-lane:last-child { border-bottom: 0; }
.lane-tag {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 2px;
  background: var(--blue-soft);
  color: var(--blue-text);
  flex-shrink: 0;
}
.lane-tag.audio {
  background: var(--green-soft);
  color: #4cc39b;
}

.timeline-tracks {
  position: relative;
  cursor: ew-resize;
  touch-action: none;
  overflow: hidden;
}
#rulerCanvas {
  display: block;
  width: 100%;
  height: 22px;
  border-bottom: 1px solid var(--border);
  background: #141418;
}
.track-lane {
  height: 30px;
  border-bottom: 1px solid var(--border);
  position: relative;
  display: flex;
  align-items: center;
  padding: 4px 0;
}
.track-lane:last-child { border-bottom: 0; }

.video-bar {
  width: 100%;
  height: 20px;
  background: rgba(38, 128, 235, 0.24);
  border-top: 1px solid rgba(90, 169, 255, 0.55);
  border-bottom: 1px solid rgba(38, 128, 235, 0.4);
  padding: 0 8px;
  display: flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 10px;
  color: #cfe6ff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.audio-lane-inner {
  width: 100%;
  height: 22px;
  position: relative;
  display: flex;
  align-items: center;
}
#waveCanvas {
  width: 100%;
  height: 22px;
  display: block;
}
.audio-empty-hint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  padding: 0 8px;
  font-size: 10px;
  color: var(--text-3);
  pointer-events: none;
}

/* Red After Effects Playhead */
.playhead {
  position: absolute;
  top: 0; bottom: 0; left: 0;
  width: 1px;
  background: var(--playhead);
  pointer-events: none;
  z-index: 5;
}
.playhead::before {
  content: '';
  position: absolute;
  top: 0; left: -5px;
  width: 11px; height: 10px;
  background: var(--playhead);
  clip-path: polygon(0 0, 100% 0, 100% 55%, 50% 100%, 0 55%);
}

/* ==========================================================================
   RIGHT DOCK: INSPECTOR & CODE EDITOR
   ========================================================================== */
.inspector-dock {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--bg-panel);
}
.inspector-tabs {
  height: 32px;
  flex-shrink: 0;
  background: var(--bg-head);
  border-bottom: 1px solid var(--border);
  display: flex;
}
.insp-tab {
  flex: 1;
  border: 0;
  border-right: 1px solid var(--border);
  background: transparent;
  color: var(--text-2);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  position: relative;
}
.insp-tab:last-child { border-right: 0; }
.insp-tab:hover { color: var(--text-1); }
.insp-tab.active {
  background: var(--bg-panel);
  color: var(--text-1);
}
.insp-tab.active::after {
  content: '';
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 2px;
  background: var(--blue);
}

.insp-pane {
  display: none;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  flex-direction: column;
  padding: 12px;
  gap: 12px;
}
.insp-pane.active { display: flex; }

/* Code Editor with Line Number Gutter */
.code-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
}
.code-hint {
  font-size: 11px;
  color: var(--text-2);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-left: 2px solid var(--blue);
  padding: 7px 10px;
  border-radius: var(--radius-sm);
}
.code-editor-shell {
  flex: 1;
  min-height: 310px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  background: #0d0d10;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.code-editor-shell:focus-within { border-color: var(--blue); }
.code-gutter {
  background: #141418;
  border-right: 1px solid var(--border);
  padding: 10px 6px 10px 0;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-3);
  overflow: hidden;
  user-select: none;
}
.code-textarea {
  width: 100%;
  height: 100%;
  border: 0;
  resize: none;
  outline: none;
  background: transparent;
  color: #e4e4ea;
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.55;
  tab-size: 2;
  white-space: pre;
  overflow: auto;
}
.code-meta-bar {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
}

/* Cards inside Inspector & Subpages */
.section-card {
  background: var(--bg-head);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-2);
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}
@media (max-width: 520px) {
  .form-grid-2 { grid-template-columns: 1fr; }
}

/* Badges */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid var(--border-strong);
  background: var(--bg-elev);
  color: var(--text-2);
}
.tag-blue { background: var(--blue-soft); border-color: rgba(38,128,235,0.4); color: var(--blue-text); }
.tag-amber { background: var(--amber-soft); border-color: rgba(230,134,25,0.4); color: #f6b25b; }
.tag-green { background: var(--green-soft); border-color: rgba(45,157,120,0.4); color: #4cc39b; }
.tag-red { background: var(--red-soft); border-color: rgba(215,55,63,0.4); color: #f58b90; }

/* Render Queue Summary & Progress */
.kv-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.kv-box {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 9px;
  min-width: 0;
}
.kv-box span { display: block; font-size: 10px; color: var(--text-3); margin-bottom: 2px; }
.kv-box strong { display: block; font-size: 12px; color: var(--text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--blue);
  transition: width 0.2s;
}

.row-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.row-item {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.row-item.active-row { border-color: var(--blue); }
.row-info { min-width: 0; flex: 1 1 150px; }
.row-name { font-size: 12px; font-weight: 600; color: var(--text-1); word-break: break-all; }
.row-sub { font-size: 11px; color: var(--text-3); font-family: var(--font-mono); margin-top: 2px; }
.row-actions { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }

/* ==========================================================================
   SUB-PAGES LAYOUT (Files, Account, About)
   ========================================================================== */
.page-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 20px 18px 32px;
}
.page-container {
  max-width: 1060px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.page-header h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.page-header p {
  font-size: 12px;
  color: var(--text-2);
  margin-top: 3px;
}

.stats-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
@media (max-width: 720px) {
  .stats-strip { grid-template-columns: repeat(2, 1fr); }
}
.stat-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}
.stat-card span { display: block; font-size: 11px; color: var(--text-2); }
.stat-card strong { display: block; font-size: 20px; font-weight: 700; font-family: var(--font-mono); margin-top: 4px; color: var(--text-1); }

/* Files Filter Bar */
.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.segmented {
  display: inline-flex;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 2px;
  flex-wrap: wrap;
}
.seg-btn {
  border: 0;
  background: transparent;
  color: var(--text-2);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  padding: 5px 11px;
  border-radius: 3px;
  cursor: pointer;
}
.seg-btn:hover { color: var(--text-1); }
.seg-btn.active { background: var(--bg-elev); color: var(--text-1); font-weight: 600; }

/* Account Two-Column Grid */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 800px) {
  .two-col { grid-template-columns: 1fr; }
}

/* ==========================================================================
   PROMO BANNER (cloud.aldih.com) & ABOUT ECOSYSTEM CARDS
   ========================================================================== */
.promo-banner {
  background: linear-gradient(135deg, #161d29 0%, #17181d 65%);
  border: 1px solid #2b3f5c;
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}
.promo-copy { max-width: 620px; }
.promo-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--blue-text);
  margin-bottom: 6px;
}
.promo-copy h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: -0.01em;
}
.promo-copy p {
  font-size: 12px;
  color: var(--text-2);
  margin-top: 5px;
  line-height: 1.55;
}

.about-hero {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}
.about-hero-left {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  max-width: 640px;
}
.about-hero h2 { font-size: 22px; font-weight: 800; letter-spacing: -0.03em; }
.about-hero p { font-size: 13px; color: var(--text-2); margin-top: 6px; line-height: 1.55; }

.ecosystem-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
@media (max-width: 720px) {
  .ecosystem-grid { grid-template-columns: 1fr; }
}
.eco-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 15px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  transition: border-color 0.15s;
}
.eco-card:hover { border-color: var(--border-strong); text-decoration: none; }
.eco-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.eco-domain {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-1);
  font-family: var(--font-mono);
}
.eco-card p { font-size: 12px; color: var(--text-2); line-height: 1.5; }

.specs-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
@media (max-width: 860px) {
  .specs-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 500px) {
  .specs-grid { grid-template-columns: 1fr; }
}
.spec-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 13px;
}
.spec-card strong { display: block; font-size: 12px; color: var(--text-1); margin-bottom: 4px; }
.spec-card span { display: block; font-size: 11px; color: var(--text-2); line-height: 1.5; }

/* ==========================================================================
   MINIMAL PRO STATUS BAR (Replaces Cluttered Footer)
   ========================================================================== */
.statusbar {
  height: 28px;
  flex-shrink: 0;
  background: var(--bg-head);
  border-top: 1px solid var(--border);
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-3);
  gap: 10px;
}
@media (max-width: 960px) {
  .statusbar { display: none; }
}
.sb-left, .sb-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sb-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green);
}
.statusbar a { color: var(--text-2); font-weight: 500; }
.statusbar a:hover { color: var(--blue-text); }

/* ==========================================================================
   MODALS & TOAST
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  z-index: 70;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-backdrop.open { display: flex; }
.modal {
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-panel);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.7);
}
.modal-head {
  padding: 12px 16px;
  background: var(--bg-head);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-head h3 { font-size: 13px; font-weight: 700; }
.modal-body { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.modal-foot {
  padding: 11px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.modal video { width: 100%; max-height: 60vh; border-radius: var(--radius-sm); background: #000; }

.toast {
  position: fixed;
  bottom: 38px;
  right: 16px;
  max-width: calc(100vw - 32px);
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--blue);
  color: var(--text-1);
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  z-index: 90;
  display: none;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.65);
}
.toast.err { border-left-color: var(--red); }
@media (max-width: 960px) {
  .toast { bottom: 68px; right: 12px; left: 12px; text-align: center; }
}

.hide-sm { display: inline; }
@media (max-width: 680px) { .hide-sm { display: none; } }
