/* ============================================================================
   Platinur — base (portal redesign)
   Base + shell + sidebar + controls + status + panels + forms + auth.
   Uses the EXISTING class names so this drops into the running app.
   Visual language: warm paper plane, white frame, hairline borders, near-black
   ink, dark pill primary buttons, SF system type.
   ============================================================================ */

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

html { height: 100%; overflow: hidden; }

body {
  height: 100%;
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  line-height: var(--leading);
  color: var(--text);
  background: var(--plane);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.55; }
input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
code, pre { font-family: var(--font-code); }
code { font-size: 12px; }
h1, h2, h3, h4 { font-family: var(--font-display); }
[hidden] { display: none !important; }

::selection { background: var(--accent-tint); }

/* ---- Scrollbars (calm) ------------------------------------------------- */
* { scrollbar-width: thin; scrollbar-color: var(--grid) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb {
  background: var(--grid);
  border: 3px solid transparent;
  border-radius: 999px;
  background-clip: padding-box;
}

/* =========================================================================
   SHELL — paper plane, white main frame, quiet rail
   ========================================================================= */
.shell { display: flex; height: 100vh; width: 100%; overflow: hidden; }

html[data-sidebar="collapsed"] .shell { --sidebar-width: var(--sidebar-collapsed-width); }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  flex: 0 0 var(--sidebar-width);
  width: var(--sidebar-width);
  height: 100vh;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 10px 10px;
  background: var(--sidebar);
  color: var(--ink);
  border-right: 1px solid var(--hairline-2);
  overflow-y: auto;
  transition: width var(--transition);
}

/* brand */
.brand-block { padding: 0; }
.brand-lockup {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  width: 100%;
  min-height: 34px;
  padding: 6px 8px;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-radius: var(--r-sm);
  font-family: var(--font-display);
  font-weight: 650;
}
/* No hover highlight on the brand/collapse lockup — it still toggles the sidebar,
   but it reads as chrome, not a button (cursor communicates the affordance). */
.brand-lockup:hover { background: transparent; }
.brand-lockup:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-ring); }
.brand-title {
  display: inline-flex;
  align-items: center;
  font-size: 15px;
  letter-spacing: -0.01em;
}
.brand-menu-icon { display: inline-flex; color: var(--ink-3); padding: 2px; border-radius: 6px; }
.brand-menu-icon:hover { color: var(--ink-2); }
.brand-menu-icon svg, .nav-icon svg {
  display: block; width: 16px; height: 16px;
  fill: none; stroke: currentColor;
  stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
}

/* nav */
.sidebar-nav { display: flex; flex-direction: column; gap: 1px; flex: 1 1 auto; min-height: 0; padding-top: 6px; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 34px;
  padding: 7px 10px;
  color: var(--ink);
  text-decoration: none;
  border-radius: var(--r-sm);
  border: 0;
  font-size: 13.5px;
  font-weight: var(--weight-regular);
  overflow: hidden;
  transition: background var(--transition);
}
.sidebar-nav a .nav-icon { color: var(--ink-2); }
.sidebar-nav a:hover { background: var(--hover); color: var(--ink); }
.sidebar-nav a.is-active {
  color: var(--ink);
  background: var(--active);
  font-weight: 600;
}
.sidebar-nav a.is-active .nav-icon { color: var(--ink-2); }
.nav-icon { flex: 0 0 18px; display: inline-flex; align-items: center; justify-content: center; color: currentColor; }
.nav-label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sidebar-divider { display: block; height: 1px; margin: 10px 8px; background: var(--hairline-2); }
.sidebar-spacer { flex: 1 1 auto; min-height: 8px; }
.sidebar-version { flex: 0 0 auto; padding: 2px 10px 4px; font-size: 11px; color: var(--ink-3); }
html[data-sidebar="collapsed"] .sidebar-version { display: none; }

/* footer — user row */
.side-foot { border-top: 1px solid var(--hairline-2); padding-top: 9px; margin-top: 6px; }
.user-row { display: flex; align-items: center; gap: 9px; padding: 7px 8px; border-radius: var(--r-sm); }
.user-row:hover { background: var(--hover); }
.avatar {
  width: 22px; height: 22px; border-radius: 99px; flex: none;
  background: linear-gradient(135deg, #2a78d6, #4a3aa7);
  color: #fff; font-size: 10px; font-weight: 600;
  display: grid; place-items: center;
}
.user-row > span:last-child { font-size: 12.5px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html[data-sidebar="collapsed"] .user-row { justify-content: center; padding: 7px 0; }
html[data-sidebar="collapsed"] .user-row > span:last-child { display: none; }

.monitoring-utility-strip { padding: 8px 14px; display: grid; gap: 4px; }
.monitoring-utility-row { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--ink-3); min-height: 26px; }
.monitoring-utility-row .monitoring-utility-text { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.monitoring-utility-row strong { color: inherit; font-weight: 600; }
.monitoring-utility-row .status-dot { flex: 0 0 auto; }
.monitoring-utility-details { font-size: 12.5px; padding-left: 22px; }
.monitoring-utility-details summary { cursor: pointer; color: var(--ink-3); }
.monitoring-drift-events { margin: 8px 0 0; padding-left: 18px; display: grid; gap: 4px; font-size: 13px; }
.monitoring-drift-events code { margin-right: 6px; }

.initial-build-resume-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; margin: 6px 0; border: 1px solid var(--hairline); border-radius: 9px; background: var(--surface); font-size: 13px; }
.initial-build-resume-row button { flex: 0 0 auto; }

.config-field-status { font-style: normal; font-size: 11px; color: var(--ink-3); margin-left: 6px; }

.operations-source-delete { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; padding: 0; border: none; background: transparent; color: var(--ink-3); cursor: pointer; border-radius: 6px; }
.operations-source-delete:hover { color: var(--bad); background: var(--hover); }
.operations-source-delete svg { width: 15px; height: 15px; }

.operations-add-source-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.operations-add-schema-form { display: inline-flex; align-items: center; gap: 6px; }
.operations-add-schema-form input { width: 190px; padding: 6px 10px; border: 1px solid var(--hairline); border-radius: 8px; font-size: 13px; background: var(--surface); color: inherit; }

.erd-card-summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.erd-card-summary::-webkit-details-marker { display: none; }
.erd-summary-meta { font-size: 12px; font-weight: 400; color: var(--ink-3); }
.operations-erd-card[open] .details-chevron { transform: rotate(180deg); }
.erd-canvas { position: relative; overflow-x: auto; padding: 22px 10px; }
.erd-edges { position: absolute; inset: 0; pointer-events: none; }
.erd-columns { position: relative; display: flex; gap: 56px; align-items: flex-start; min-width: max-content; }
.erd-column { display: flex; flex-direction: column; gap: 12px; min-width: 150px; }
.erd-column-head { font-size: 11.5px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-3); padding-bottom: 4px; text-align: center; }
.erd-node { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border: 1px solid var(--hairline); border-radius: 10px; background: var(--surface); font-size: 12.5px; font-family: inherit; color: inherit; cursor: default; text-align: left; box-shadow: 0 1px 2px rgba(11,11,11,.03); transition: opacity 120ms ease; }
.erd-node-badge { font-size: 10px; font-weight: 600; text-transform: uppercase; padding: 1px 5px; border-radius: 5px; background: rgba(11,11,11,.05); color: var(--ink-3); }
.erd-node.is-dimmed { opacity: 0.25; }
.erd-edge { fill: none; stroke: var(--axis); stroke-width: 1.2; opacity: .75; transition: opacity 120ms ease; }
.erd-edge.is-active { stroke: var(--series-1); stroke-width: 1.8; opacity: 1; }
.erd-edge.is-dimmed { opacity: 0.12; }

/* environment switch — a two-segment control; the active environment gets a
   raised white segment. Clicking a non-active segment navigates to the same
   view scoped to that environment (handled in app.js). Env-independent views
   lock the switch (muted, non-interactive). */
.env-scope {
  position: relative;
  margin: 8px 2px 4px;
  padding: 0;
}
.env-switch {
  position: relative;
  display: flex; gap: 0;
  padding: 3px;
  margin: 0;
  background: rgba(11, 11, 11, 0.05);
  border: 0;
  border-radius: 10px;
}
.env-seg {
  display: flex; align-items: center; justify-content: center;
  min-height: 30px; padding: 6px 4px; gap: 6px; flex: 1 1 0;
  border: 0; border-radius: 8px;
  background: transparent; color: var(--ink-2); overflow: hidden; box-shadow: none;
  font-family: inherit; font-size: 12.5px; font-weight: var(--weight-regular);
  white-space: nowrap; cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}
.env-seg-icon {
  display: inline-flex; flex: 0 0 14px;
}
.env-seg-icon svg {
  width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
.env-seg-label { opacity: 1; }
.env-seg.is-active {
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(11, 11, 11, 0.08);
}
.env-seg:not(.is-active):hover { color: var(--ink); }

/* underline indicator from the previous design — retired */
.env-track, .env-ind { display: none !important; }

/* locked — env-independent views apply to both environments: both segments use the
   selected white surface while remaining non-interactive. */
.env-seg:disabled { cursor: default; }
.env-scope.is-locked .env-seg:disabled { opacity: 1; color: var(--ink); -webkit-text-fill-color: var(--ink); }
.env-scope.is-locked .env-switch { cursor: default; opacity: 1; }
.env-scope.is-locked .env-switch::before { content: ""; position: absolute; inset: 3px; border-radius: 8px; background: #fff; box-shadow: 0 1px 2px rgba(11, 11, 11, 0.08); }
.env-scope.is-locked .env-seg { position: relative; z-index: 1; background: transparent; color: var(--ink); font-weight: 600; cursor: default; }
.env-scope.is-locked .env-seg.is-active { background: transparent; color: var(--ink); font-weight: 600; box-shadow: none; }
.env-scope.is-locked .env-seg:first-child { border-radius: 8px 0 0 8px; }
.env-scope.is-locked .env-seg:last-of-type { border-radius: 0 8px 8px 0; }
.env-scope.is-locked .env-seg:hover { color: var(--ink); }
.env-scope.is-locked .env-seg.is-active:hover { color: var(--ink); }

/* env tooltip — fixed-position, rendered on <body> (by app.js) to escape the rail's
   overflow; explains the active env, or the locked "applies to both" state. */
.env-tip {
  position: fixed; z-index: 60; pointer-events: none; max-width: 236px;
  background: var(--surface); border: 1px solid var(--hairline); border-radius: 11px;
  padding: 9px 12px; font-size: 12px; line-height: 1.46; color: var(--ink-2);
  box-shadow: 0 12px 34px rgba(11, 11, 11, 0.14);
  opacity: 0; transform: translateY(-50%) translateX(-6px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.env-tip b { color: var(--ink); font-weight: var(--weight-semibold); }
.env-tip.is-visible { opacity: 1; transform: translateY(-50%) translateX(0); }
.env-tip::after {
  content: ""; position: absolute; right: 100%; top: 50%;
  transform: translateY(-50%) rotate(45deg); width: 9px; height: 9px; margin-right: -5px;
  background: var(--surface); border-left: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline);
}

/* collapsed */
html[data-sidebar="collapsed"] .brand-lockup,
html[data-sidebar="collapsed"] .sidebar-nav a {
  justify-content: center; padding-left: 6px; padding-right: 6px;
}
html[data-sidebar="collapsed"] .brand-title,
html[data-sidebar="collapsed"] .brand-title span,
html[data-sidebar="collapsed"] .nav-label,
html[data-sidebar="collapsed"] .env-seg-label { display: none; }
html[data-sidebar="collapsed"] .env-scope { margin: 8px 0 4px; }
html[data-sidebar="collapsed"] .env-switch { flex-direction: column; gap: 2px; }
html[data-sidebar="collapsed"] .env-seg { padding: 7px 0; flex: 0 0 auto; }

/* =========================================================================
   WORKSPACE / PAGE HEAD
   ========================================================================= */
.workspace {
  flex: 0 0 calc(100vw - var(--sidebar-width));
  min-width: 0;
  width: calc(100vw - var(--sidebar-width));
  height: 100vh;
  margin-left: var(--sidebar-width);
  padding: 28px 34px 56px;
  background: var(--surface);
  overflow-y: auto;
  overflow-x: hidden;
  transition: margin var(--transition), width var(--transition);
}
/* targeted min-width:0 only where text must ellipsis (not globally — a
   global rule collapses grid/flex action areas and wraps controls) */
.nav-label, .integration-source-main, .promotion-change-title-row,
.scheduling-source-main, .dashboard-tile-main, .model-file-name,
.initial-build-log-head { min-width: 0; }
.action-button, .inline-action, .action-button-muted,
.integration-tabs a, .operations-tabs a, .status-pill,
.integration-status-pill, .promotion-staging-status, .role-badge,
.change-pr-link, .eyebrow { white-space: nowrap; }

.topbar {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px;
  width: min(100%, var(--view-max, var(--content-max)));
  margin: 0 auto 20px;
}
.topbar h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: var(--leading-tight);
  color: var(--ink);
}
.topbar .eyebrow { margin-bottom: 7px; }
.topbar-sub { margin: 5px 0 0; color: var(--ink-3); font-size: 13.5px; max-width: 68ch; }
.topbar-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding-top: 2px; }

.eyebrow, .foot-label {
  margin: 0 0 6px;
  color: var(--ink-3);
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
}

/* width — views share the design page column; wide views may override */
[data-view] { --view-max: var(--content-max); }

.content-grid, .agent-workbench, .page-title, .tools-page,
.operations-page, .promotions-page, .promotion-board, .scheduling-page,
.monitoring-page, .dashboard-page, .integrations-page, .settings-page,
.configuration-layout {
  width: min(100%, var(--view-max, var(--content-max)));
  margin-left: auto; margin-right: auto;
}
.content-grid { display: grid; gap: var(--space-4); }
.content-grid + .content-grid { margin-top: var(--space-4); }

/* =========================================================================
   PANELS / CARDS
   ========================================================================= */
.panel, .service-card, .health-card, .tool-card, .entity-card,
.operation-section, .scheduling-dbt-card, .scheduling-source-card,
.settings-card {
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  box-shadow: none;
}
.panel { padding: 18px 20px; margin-bottom: 14px; }

.panel-head, .agent-head, .health-top, .service-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  margin-bottom: var(--space-3);
}
.panel-head.compact-head { margin-bottom: var(--space-3); }
.panel h3, .changes-empty h3, .chat-empty-state h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--ink);
}
.panel-head p, .compact-head p { margin: 4px 0 0; color: var(--ink-3); font-size: 12.5px; }
.empty-copy, .feedback, .service-card p, .health-card p { color: var(--ink-3); }

.page-title { margin-bottom: var(--space-5); }
.page-title h1 { margin: 0; font-family: var(--font-display); font-size: 21px; font-weight: 600; letter-spacing: -0.01em; color: var(--ink); }
.page-title p { max-width: 72ch; margin: 5px 0 0; color: var(--ink-3); font-size: 13.5px; }

/* =========================================================================
   BUTTONS / ACTIONS
   ========================================================================= */
.action-button {
  appearance: none; -webkit-appearance: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 34px; padding: 8px 15px;
  color: #fff;
  background: var(--pill-dark);
  border: 1px solid var(--pill-dark);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  box-shadow: none;
  transition: filter var(--transition), background var(--transition);
}
.action-button:hover { filter: brightness(1.15); }
.action-button:active { filter: brightness(1.05); }
.action-button:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-ring); }
.action-button-muted {
  color: var(--ink-2); background: var(--surface); border-color: var(--hairline);
  box-shadow: none;
}
.action-button-muted:hover { filter: none; background: var(--hover); border-color: var(--hairline); color: var(--ink); }

.inline-action {
  display: inline-flex; align-items: center; gap: 7px;
  min-height: 32px; padding: 7px 14px;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  font-size: 13px;
  font-weight: var(--weight-regular);
  text-decoration: none;
  transition: background var(--transition), color var(--transition);
}
.inline-action:hover { background: var(--hover); border-color: var(--hairline); color: var(--ink); }
.inline-action svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.danger-link { color: var(--bad); border-color: transparent; background: transparent; }
.danger-link:hover { background: rgba(208, 59, 59, 0.06); border-color: transparent; color: var(--bad); }

.ghost-action {
  display: inline-grid; place-items: center;
  width: 30px; height: 30px; padding: 0;
  color: var(--ink-3); background: transparent; border: 1px solid transparent; border-radius: var(--radius-xs);
}
.ghost-action:hover { background: var(--hover); color: var(--ink); }
.ghost-action svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.icon-only-button, .icon-run-button {
  display: inline-grid; place-items: center;
  width: 32px; height: 32px; padding: 0;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-xs);
  transition: background var(--transition), color var(--transition);
}
.icon-run-button { color: var(--series-1); }
.icon-run-button:hover { background: var(--accent-soft); }
.icon-only-button:hover { background: var(--hover); }
.icon-run-button svg, .icon-only-button svg { width: 15px; height: 15px; fill: currentColor; }
.icon-only-button svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }

.button-row, .form-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* =========================================================================
   STATUS — dots + pills
   ========================================================================= */
.status-dot {
  flex: 0 0 auto;
  width: 8px; height: 8px; border-radius: 999px;
  background: var(--axis);
  position: relative;
}
.status-dot.status-succeeded, .status-dot.status-ready, .status-dot.status-healthy, .status-dot.status-applied, .status-dot.status-passed { background: var(--ok); }
.status-dot.status-failed, .status-dot.status-error { background: var(--bad); }
.status-dot.status-pending, .status-dot.status-idle, .status-dot.status-queued, .status-dot.status-not-tested { background: var(--axis); }
.status-dot.status-running, .status-dot.status-syncing { background: var(--series-1); }
.status-dot.status-running::after, .status-dot.status-syncing::after {
  content: ""; position: absolute; inset: -4px; border-radius: 999px;
  border: 2px solid var(--series-1); opacity: 0.4;
  animation: pulse-ring 1.4s ease-out infinite;
}
.status-dot.status-action { background: var(--warn); }
@keyframes pulse-ring { 0% { transform: scale(0.6); opacity: 0.5; } 100% { transform: scale(1.6); opacity: 0; } }

/* status pill (reusable) */
.status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 22px; padding: 2px 10px;
  border-radius: var(--radius-pill);
  font-size: var(--text-xs); font-weight: var(--weight-regular); line-height: 1.4;
  letter-spacing: 0;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--hairline);
}
.status-pill .status-dot { width: 7px; height: 7px; }
.status-pill.is-healthy, .status-pill.is-succeeded { color: var(--ok-text); background: var(--green-soft); border-color: var(--green-border); }
.status-pill.is-failed { color: var(--bad); background: var(--red-soft); border-color: var(--red-border); }
.status-pill.is-syncing, .status-pill.is-running { color: var(--accent-strong); background: var(--accent-soft); border-color: var(--accent-tint); }
.status-pill.is-pending { color: var(--ink-3); background: var(--surface); }

/* =========================================================================
   FORMS / INPUTS
   ========================================================================= */
.operation-field, .auth-form label, .compact-form label {
  display: grid; gap: 5px;
  color: var(--ink-2); font-size: var(--text-xs); font-weight: 500;
}
input, select, textarea { font-family: var(--font-sans); }
.operation-field input, .operation-field select,
.auth-form input, .compact-form input,
.form-grid input, .form-grid select, .table-filter, .model-search-field input {
  width: 100%; min-height: 34px;
  padding: 7px 11px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 9px;
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition);
}
.operation-field input::placeholder, .form-grid input::placeholder { color: var(--ink-3); }
.operation-field input:focus, .operation-field select:focus,
.auth-form input:focus, .form-grid input:focus, .form-grid select:focus,
.table-filter:focus, .model-search-field input:focus {
  border-color: var(--series-1); box-shadow: none;
}
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.form-grid label { display: grid; gap: 5px; color: var(--ink-2); font-size: var(--text-xs); font-weight: 500; }
.form-grid label span { color: var(--ink-2); }
.form-grid .wide { grid-column: 1 / -1; }

/* Server-rendered flash. In the portal app.js immediately lifts it into the
   toast stack and removes it; on no-JS pages (login) it renders inline. */
.flash-banner {
  width: min(100%, var(--view-max, var(--content-max)));
  margin: 0 auto 16px;
  padding: 11px 14px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border: 1px solid var(--accent-tint);
  border-radius: 10px;
  font-size: var(--text-sm);
}
.flash-banner.flash-error { color: var(--bad); background: rgba(208, 59, 59, 0.06); border-color: var(--red-border); }

/* =========================================================================
   AUTH / LOGIN — full-bleed paper plane, white card, aurora fade
   ========================================================================= */
.auth-page { min-height: 100vh; background: var(--plane); overflow: auto; }
.auth-shell { position: fixed; inset: 0; display: grid; place-items: stretch; padding: 26px; }
.login-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 18px;
  display: flex; flex-direction: column; align-items: center;
  overflow: hidden;
  width: 100%;
}
.login-brand { position: absolute; top: 22px; left: 26px; font-size: 15px; font-weight: 650; letter-spacing: -0.01em; color: var(--ink); z-index: 1; }
.login-form { width: 340px; margin-top: 14vh; position: relative; z-index: 1; }
.login-form h1 { margin: 0; font-size: 20px; font-weight: 650; letter-spacing: -0.01em; color: var(--ink); }
.login-form .sub { font-size: 13.5px; color: var(--ink-3); margin: 4px 0 26px; }
.login-form label { display: flex; flex-direction: column; gap: 5px; margin-bottom: 16px; font-size: 12px; color: var(--ink-2); font-weight: 500; }
.login-form input {
  border: 1px solid var(--hairline); border-radius: 9px; padding: 7px 11px;
  font-size: 13px; background: var(--card); outline: none; width: 100%; min-height: 36px;
}
.login-form input:focus { border-color: var(--series-1); }
.login-form .flash-banner { width: 100%; margin: 0 0 16px; }
.login-continue {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  width: 100%; padding: 10px; font-size: 14px; font-weight: 500;
  color: #fff; background: var(--pill-dark); border: 0; border-radius: 11px; margin-top: 6px;
}
.login-continue:hover { filter: brightness(1.15); }
.login-alt { text-align: center; font-size: 12.5px; color: var(--ink-3); margin-top: 22px; }
.login-alt a { color: var(--series-1); cursor: pointer; text-decoration: none; }
.login-fade {
  position: absolute; left: 0; right: 0; bottom: 0; height: 44%; pointer-events: none;
  background:
    linear-gradient(to bottom, var(--surface) 0%, rgba(255, 255, 255, 0) 60%),
    radial-gradient(90% 95% at 8% 115%, rgba(42, 120, 214, 0.6), transparent 58%),
    radial-gradient(80% 85% at 34% 125%, rgba(27, 175, 122, 0.35), transparent 60%),
    radial-gradient(85% 95% at 56% 118%, rgba(237, 161, 0, 0.5), transparent 58%),
    radial-gradient(90% 95% at 82% 120%, rgba(144, 133, 233, 0.55), transparent 58%),
    radial-gradient(70% 80% at 100% 110%, rgba(42, 120, 214, 0.4), transparent 60%);
}

/* =========================================================================
   TEXT VIEWER DIALOG
   ========================================================================= */
.text-viewer { border: 0; border-radius: 16px; box-shadow: var(--shadow-lg); padding: 0; max-width: 720px; width: 90vw; }
.text-viewer::backdrop { background: rgba(11, 11, 11, 0.38); }
.text-viewer-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--hairline-2); }
.text-viewer pre { margin: 0; padding: 18px; max-height: 60vh; overflow: auto; font-size: var(--text-sm); color: var(--ink-2); }
