/* ── app-base.css — vars, resets, typography, base layout, sections, buttons, data-stack ── */
/* Auto-split from app.css 2026-05-27 (Phase J.6). Cascade order preserved by
   the <link> sequence in index.html. Edit the file whose concern matches your
   change; do NOT recreate app.css. See _docs/canonical/coding-conventions.md §0. */

:root {
  --app-bg: #f4f7f8;
  --panel-bg: #ffffff;
  --panel-alt: #f0f4f6;
  --sidebar-bg: #060e14;
  --sidebar-border: rgba(108, 215, 255, 0.12);
  --sidebar-text: #f4f8fb;
  --sidebar-muted: #7f92a3;
  --sidebar-hover: #0d1e2d;
  --sidebar-active: #112233;
  --text: #12202d;
  --muted: #667685;
  --border: rgba(18, 32, 45, 0.1);
  --border-soft: rgba(18, 32, 45, 0.06);
  --border-strong: rgba(18, 32, 45, 0.18);
  --accent: #6cd7ff;
  --accent-hover: #9ee5ff;
  --accent-warm: #ffb068;
  --accent-soft: rgba(108, 215, 255, 0.12);
  --success: #3abf7a;
  --warning: #ffb068;
  --danger: #ff6b6b;
  --radius-sm: 12px;
  --radius: 16px;
  --radius-lg: 20px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 28px;
  --space-8: 32px;
  --shadow-sm: 0 1px 2px rgba(18, 32, 45, 0.06), 0 10px 24px rgba(18, 32, 45, 0.06);
  --shadow-xs: 0 1px 2px rgba(18, 32, 45, 0.05);
  --font-body: "IBM Plex Sans", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", "Cascadia Code", Consolas, monospace;
}

body[data-color-scheme="light"] {
  --accent-soft: rgba(196, 93, 39, 0.12);
  --border: rgba(18, 32, 45, 0.1);
  --border-soft: rgba(18, 32, 45, 0.06);
}

body[data-color-scheme="dark"],
body[data-color-scheme="event"] {
  --app-bg: #071017;
  --panel-bg: #0d1821;
  --panel-alt: #101d29;
  --sidebar-bg: #060e14;
  --sidebar-border: rgba(108, 215, 255, 0.1);
  --sidebar-text: #f4f8fb;
  --sidebar-muted: #7f92a3;
  --sidebar-hover: #0d1e2d;
  --sidebar-active: #112233;
  --text: #f4f8fb;
  --muted: #7f92a3;
  --border: rgba(108, 215, 255, 0.1);
  --border-soft: rgba(108, 215, 255, 0.06);
  --border-strong: rgba(108, 215, 255, 0.2);
  --accent-soft: rgba(108, 215, 255, 0.12);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 24px rgba(0, 0, 0, 0.3);
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
}

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(108, 215, 255, 0.18); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(108, 215, 255, 0.32); }

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  min-height: 100vh;
  width: 100%;
  margin: 0;
}

body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--app-bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body,
button,
input,
select,
textarea {
  font-size: 15px;
}

button,
input,
select,
textarea {
  font: inherit;
}

h1,
h2,
h3,
p,
dl,
dt,
dd {
  margin: 0;
}

a {
  color: inherit;
}

.app-root {
  min-height: 100vh;
  width: 100%;
}

body[data-shell="authenticated"] .app-root {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
}

.app-sidebar {
  display: none;
}

body[data-shell="authenticated"] .app-sidebar {
  display: flex;
  flex-direction: column;
  gap: var(--space-7);
  height: 100vh;
  padding: var(--space-7) var(--space-5) var(--space-6);
  position: sticky;
  top: 0;
  overflow-y: auto;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  border-right: 1px solid var(--sidebar-border);
}

.sidebar-brand {
  display: grid;
  gap: var(--space-2);
  padding-bottom: var(--space-5);
  border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-brand h1 {
  font-size: 1.45rem;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.sidebar-copy {
  color: var(--sidebar-muted);
  font-size: 0.95rem;
  line-height: 1.5;
  max-width: 24ch;
}

.overline {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.app-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

body[data-shell="authenticated"] .app-main {
  min-height: 100vh;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: 12px var(--space-7);
  background: var(--panel-bg);
  border-bottom: 1px solid var(--border-soft);
  box-shadow: var(--shadow-xs);
}

body[data-shell="guest"] .app-header {
  display: none;
}

.app-header-text {
  display: grid;
  gap: 2px;
}

.app-header-text h2 {
  font-size: 1.35rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.page-description,
.muted,
.status-note,
.session-summary {
  color: var(--muted);
  line-height: 1.5;
}

.page-description {
  max-width: 72ch;
}

.status-note {
  min-height: 0;
}

.app-header-side {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  flex-shrink: 0;
  /* Keeps the right-side header tidy and consistent across all pages —
     page-specific action buttons (e.g. "Save settings") sit inline with
     the auth row instead of stacking awkwardly above it. */
}

/* Collapse empty header slots so they don't add gap space */
.app-header-side > *:empty { display: none; }
#view-description:empty { display: none; }

body[data-shell="guest"] .app-header-side {
  flex-wrap: wrap;
}

.session-summary {
  font-size: 0.82rem;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  background: var(--panel-alt);
}

.btn-sm {
  padding: 6px 12px !important;
  font-size: 0.85rem !important;
}

.header-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.header-meta,
.header-actions,
.page-header-actions,
.cluster,
.inline-actions,
.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}

.page-header-actions {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

body[data-shell="guest"] .page-header-actions,
body[data-shell="guest"] .header-meta,
body[data-shell="guest"] .header-actions {
  justify-content: flex-start;
}

.header-meta span,
.pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  background: var(--panel-alt);
  color: var(--text);
  font-size: 0.875rem;
}

.app-page {
  width: 100%;
  min-width: 0;
  /* Moderate cap: wide enough for big data grids to breathe (was 1400px,
     now 1700px) but not so wide that stat tiles and the database table list
     get absurdly stretched on 1920+ monitors. Specific containers (like
     .erd-wrapper below) override to 100% when they genuinely need every pixel. */
  max-width: 1700px;
  padding: var(--space-6) var(--space-7) var(--space-8);
}
/* ERD/UML diagrams want every pixel — no cap on the diagram page. */
.app-page:has(.erd-wrapper) { max-width: none; }
.erd-wrapper { width: 100%; }
.erd-canvas-wrap { width: 100%; }

body[data-shell="guest"] .app-main {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(108, 215, 255, 0.07) 0%, transparent 50%),
    radial-gradient(ellipse at 70% 80%, rgba(255, 176, 104, 0.05) 0%, transparent 40%),
    linear-gradient(160deg, #040c14 0%, #071017 50%, #060e14 100%);
}

body[data-shell="guest"] .app-page {
  width: 100%;
  max-width: 420px;
  padding: 0 20px 40px;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-2);
  padding: 11px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}

.nav-icon {
  font-size: 1.05rem;
  flex-shrink: 0;
  width: 22px;
  text-align: center;
  line-height: 1;
}

.nav-button span.nav-label {
  font-weight: 600;
  font-size: 0.93rem;
}

.nav-button:hover {
  background: var(--sidebar-hover);
  border-color: rgba(255, 255, 255, 0.08);
}

.nav-button.is-active {
  background: var(--sidebar-active);
  border-left: 3px solid var(--accent);
  color: var(--sidebar-text);
}

.nav-button.is-active .nav-icon {
  color: var(--accent);
}

.sidebar-section {
  display: grid;
  gap: 12px;
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid var(--sidebar-border);
}

.sidebar-section .overline {
  color: var(--sidebar-muted);
}

.runtime-grid {
  display: grid;
  gap: 10px;
}

.runtime-grid > div {
  display: grid;
  gap: 4px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.runtime-grid dt,
.details-grid dt {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

body[data-shell="authenticated"] .runtime-grid dt {
  color: var(--sidebar-muted);
}

.page-layout {
  display: grid;
  gap: 16px;
}

.data-stack,
.stack-form {
  display: grid;
  gap: 28px;
}

.section,
.note-card,
.workflow-card,
.summary-pill,
.stack-form,
.filter-panel,
details.section,
.team-card {
  background: var(--panel-bg);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

