:root {
  color-scheme: dark;
  --ink: #eef3ef;
  --muted: #94a69e;
  --surface: #121b18;
  --surface-strong: #18231f;
  --line: rgba(218, 238, 227, 0.12);
  --accent: #b8ff63;
  --accent-strong: #8fe339;
  --danger: #ff8a83;
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.32);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 12%, rgba(110, 180, 82, 0.15), transparent 30rem),
    #0b1210;
  color: var(--ink);
}

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

.login-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(440px, 0.85fr);
  min-height: 100vh;
}

.brand-panel, .login-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(3rem, 8vw, 8rem);
}

.brand-panel {
  position: relative;
  overflow: hidden;
  border-right: 1px solid var(--line);
}

.brand-panel::after {
  position: absolute;
  right: -10rem;
  bottom: -12rem;
  width: 32rem;
  height: 32rem;
  border: 1px solid var(--line);
  border-radius: 4rem;
  content: "";
  transform: rotate(24deg);
}

.brand-mark {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  width: 62px;
  height: 62px;
  margin-bottom: 3.5rem;
  transform: skewY(-12deg);
}

.brand-mark span {
  border-radius: 5px;
  background: var(--accent);
}

.brand-mark span:nth-child(2) { opacity: 0.68; }
.brand-mark span:nth-child(3) { opacity: 0.36; }

.eyebrow {
  margin: 0 0 0.85rem;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1, h2, p { margin-top: 0; }
h1 { max-width: 780px; margin-bottom: 1.25rem; font-size: clamp(3rem, 7vw, 7rem); line-height: 0.92; letter-spacing: -0.065em; }
h2 { margin-bottom: 0.8rem; font-size: clamp(1.9rem, 3vw, 2.8rem); letter-spacing: -0.04em; }

.brand-copy {
  max-width: 560px;
  color: var(--muted);
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  line-height: 1.65;
}

.coordinate, .dimension-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.coordinate { margin-top: 3rem; }
.coordinate span, .dimension-list span, .user-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.48rem 0.78rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.login-panel {
  background: rgba(18, 27, 24, 0.52);
  backdrop-filter: blur(16px);
}

.login-card { width: min(100%, 430px); margin: auto; }
.muted, .security-note { color: var(--muted); }
.login-card > .muted { margin-bottom: 2.25rem; }

form { display: grid; }
label { margin: 0 0 0.55rem; font-size: 0.82rem; font-weight: 650; }
label:not(:first-child) { margin-top: 1.15rem; }

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  background: var(--surface);
  padding: 0.9rem 1rem;
  color: var(--ink);
  transition: border-color 160ms, box-shadow 160ms;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(184, 255, 99, 0.12);
}

select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
textarea { resize: vertical; line-height: 1.5; font-family: "Cascadia Code", Consolas, monospace; font-size: 0.78rem; }

form button, .button-secondary {
  border: 0;
  border-radius: 10px;
  padding: 0.9rem 1rem;
  font-weight: 750;
}

form button {
  margin-top: 0.5rem;
  background: var(--accent);
  color: #15200f;
}

form button:hover { background: var(--accent-strong); }
form button:disabled { cursor: wait; opacity: 0.6; }
.form-error { min-height: 1.25rem; margin: 0.75rem 0 0; color: var(--danger); font-size: 0.82rem; }
.security-note { margin-top: 1.75rem; font-size: 0.72rem; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
  border-bottom: 1px solid var(--line);
  padding: 0 clamp(1.25rem, 5vw, 5rem);
}

.wordmark { display: flex; align-items: center; gap: 0.7rem; color: var(--ink); font-weight: 780; text-decoration: none; }
.mini-mark { width: 17px; height: 17px; border-radius: 4px; background: var(--accent); transform: skewY(-12deg); }
.topbar-actions { display: flex; align-items: center; gap: 0.75rem; }
.user-chip { display: flex; align-items: center; gap: 0.5rem; padding: 0.48rem 0.75rem; }
.user-chip span { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.button-secondary { border: 1px solid var(--line); background: transparent; color: var(--ink); font-size: 0.8rem; }
.button-secondary:hover { background: var(--surface); }
.button-primary { border: 0; border-radius: 9px; padding: 0.75rem 1rem; background: var(--accent); color: #15200f; font-weight: 780; }
.button-primary:hover { background: var(--accent-strong); }
.icon-button { border: 0; background: transparent; color: var(--muted); font-size: 1.6rem; }

.workspace { width: min(1180px, calc(100% - 2.5rem)); margin: 0 auto; padding: clamp(4rem, 8vw, 7rem) 0; }
.hero { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(310px, 0.7fr); gap: 4rem; align-items: end; }
.hero h1 { font-size: clamp(3rem, 6vw, 6rem); }
.hero > div > p:last-child { max-width: 720px; color: var(--muted); font-size: 1.1rem; line-height: 1.65; }

.status-card, .metric-grid article, .next-section {
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(24, 35, 31, 0.94), rgba(14, 22, 19, 0.94));
  box-shadow: var(--shadow);
}

.status-card { display: flex; gap: 1rem; border-radius: 16px; padding: 1.25rem; }
.status-card p { margin: 0.35rem 0 0; color: var(--muted); font-size: 0.82rem; line-height: 1.45; }
.status-light { flex: 0 0 auto; width: 10px; height: 10px; margin-top: 0.35rem; border-radius: 50%; background: #e6bd4b; box-shadow: 0 0 16px rgba(230, 189, 75, 0.55); }
.status-light.ready { background: var(--accent); box-shadow: 0 0 16px rgba(184, 255, 99, 0.55); }
.status-light.offline { background: var(--danger); box-shadow: 0 0 16px rgba(255, 138, 131, 0.45); }

.metric-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-top: 4rem; }
.metric-grid article { min-height: 190px; border-radius: 16px; padding: 1.5rem; }
.metric-grid strong { display: block; margin-top: 2.7rem; font-size: 1.3rem; }
.metric-grid p { margin: 0.55rem 0 0; color: var(--muted); font-size: 0.82rem; }
.metric-label { color: var(--accent); font-size: 0.7rem; font-weight: 750; letter-spacing: 0.12em; text-transform: uppercase; }

.next-section { display: grid; grid-template-columns: 1fr 1fr; gap: 3rem; align-items: center; margin-top: 1rem; border-radius: 16px; padding: 2rem; }
.next-section h2 { margin-bottom: 0.65rem; }
.next-section p { margin-bottom: 0; line-height: 1.6; }
.dimension-list { justify-content: flex-end; }

.studio-page { background: #0b1210; }
.studio-shell { display: grid; grid-template-columns: 230px minmax(0, 1fr); min-height: calc(100vh - 72px); }
.studio-nav { position: sticky; top: 0; display: flex; flex-direction: column; height: calc(100vh - 72px); overflow-y: auto; border-right: 1px solid var(--line); padding: 1rem; background: #0d1512; }
.nav-intro { padding: 0 0.75rem 1.8rem; }
.nav-intro strong, .nav-intro small { display: block; }
.nav-intro strong { font-size: 1.15rem; }
.nav-intro small { margin-top: 0.35rem; color: var(--muted); }
.studio-nav nav { display: grid; gap: 0.25rem; }
.nav-item { display: flex; align-items: center; gap: 0.8rem; border: 0; border-radius: 8px; padding: 0.78rem; background: transparent; color: var(--muted); text-align: left; }
.nav-item span { color: #617269; font-size: 0.66rem; }
.nav-item:hover, .nav-item.active { background: var(--surface-strong); color: var(--ink); }
.nav-item.active span { color: var(--accent); }
.phase-card { margin-top: auto; border: 1px solid var(--line); border-radius: 12px; padding: 1rem; background: rgba(184, 255, 99, 0.04); }
.phase-card span { color: var(--accent); font-size: 0.65rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; }
.phase-card strong { display: block; margin: 0.55rem 0; font-size: 0.85rem; }
.phase-card p { margin: 0; color: var(--muted); font-size: 0.7rem; line-height: 1.45; }
.studio-main { min-width: 0; padding: 2.5rem clamp(1.5rem, 4vw, 4rem) 5rem; }
.studio-view { display: none; }
.studio-view.active { display: block; }
.view-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 2rem; margin-bottom: 2rem; }
.view-heading h1 { margin-bottom: 0.55rem; font-size: clamp(2.4rem, 4vw, 4rem); }
.view-heading p:last-child { margin: 0; color: var(--muted); }
.query-stat { min-width: 120px; border-left: 1px solid var(--line); padding-left: 1.2rem; }
.query-stat strong, .query-stat span { display: block; }
.query-stat strong { color: var(--accent); font-size: 1.4rem; }
.query-stat span { color: var(--muted); font-size: 0.72rem; }
.panel { border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(145deg, rgba(24, 35, 31, 0.92), rgba(14, 22, 19, 0.94)); box-shadow: 0 18px 50px rgba(0,0,0,.18); }
.query-panel { padding: 1rem; }
.control-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); gap: 0.75rem; align-items: end; }
.control-grid.compact { grid-template-columns: repeat(4, minmax(130px, 1fr)); border-bottom: 1px solid var(--line); padding: 1rem; }
.control-grid label, .form-grid label, .upload-panel > label, .upload-actions label { margin: 0; color: var(--muted); font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.control-grid select, .control-grid input, .form-grid input, .upload-panel select { margin-top: 0.4rem; padding: 0.68rem 0.75rem; font-size: 0.8rem; }
.result-panel { margin-top: 1rem; overflow: hidden; }
.aggregate-panel { margin-top: 1rem; overflow: hidden; }
.aggregate-list { display: grid; gap: .5rem; padding: 1rem; }
.aggregate-list > div { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .65rem; border: 1px solid var(--line); border-radius: 8px; padding: .7rem; }
.aggregate-list > div > span:last-child { color: var(--muted); font-size: .68rem; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #e6bd4b; }
.status-dot.ready { background: var(--accent); }
.status-dot.stale { background: var(--danger); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 62px; border-bottom: 1px solid var(--line); padding: 0.85rem 1.1rem; }
.panel-heading strong, .panel-heading span { display: block; }
.panel-heading span { margin-top: 0.25rem; color: var(--muted); font-size: 0.7rem; }
.table-scroll { overflow: auto; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; font-size: 0.8rem; }
th, td { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 0.75rem 1rem; text-align: right; }
th:first-child, td:first-child { position: sticky; left: 0; z-index: 1; background: #17211e; text-align: left; }
thead th, tfoot th, tfoot td { background: #111a17; color: var(--muted); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em; }
td.total, tfoot td { color: var(--accent); font-weight: 750; }
.empty-state { height: 240px; color: var(--muted); text-align: center !important; }
.cube-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(310px, 1fr)); gap: 1rem; }
.cube-card { min-height: 280px; padding: 1.4rem; }
.cube-icon { display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 1.5rem; border-radius: 10px; background: var(--accent); color: #15200f; font-weight: 850; }
.cube-card h2 { margin: 0.7rem 0 0.45rem; font-size: 1.65rem; }
.cube-card p { min-height: 2.5rem; color: var(--muted); font-size: 0.82rem; line-height: 1.5; }
.tag { display: inline-block; border-radius: 999px; padding: 0.28rem 0.5rem; background: rgba(184,255,99,.1); color: var(--accent); font-size: 0.62rem; text-transform: uppercase; }
.cube-meta, .dimension-tags { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.cube-meta { margin: 1.2rem 0; color: var(--muted); font-size: 0.7rem; }
.cube-meta span + span::before { margin-right: 0.5rem; content: "·"; }
.dimension-tags span { border: 1px solid var(--line); border-radius: 6px; padding: 0.35rem 0.5rem; color: var(--muted); font-size: 0.66rem; }
.modal-panel, .upload-panel { margin-top: 1rem; padding: 0 1.2rem 1.2rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; padding: 1.2rem 0; }
.hint { color: var(--muted); font-size: 0.72rem; line-height: 1.5; }
.split-layout { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(260px, .7fr); gap: 1rem; }
.hierarchy-tree { min-height: 500px; padding: 1rem; }
.tree-summary { display: flex; gap: 0.6rem; margin-bottom: 1rem; }
.tree-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; border-bottom: 1px solid var(--line); padding: 0.75rem 1rem; color: var(--muted); font-size: 0.72rem; }
.tree-summary span { border-radius: 999px; padding: 0.35rem 0.6rem; background: rgba(184,255,99,.08); color: var(--muted); font-size: 0.66rem; }
.tree-node { padding-left: calc(var(--depth) * 1.5rem); }
.tree-node button { display: flex; width: 100%; gap: 0.55rem; border: 0; border-radius: 7px; padding: 0.52rem; background: transparent; color: var(--ink); text-align: left; }
.tree-node button:hover { background: rgba(184,255,99,.06); }
.tree-node.inactive { opacity: 0.48; }
.tree-node strong, .tree-node small { display: block; }
.tree-node strong { font-size: 0.8rem; }
.tree-node small { margin-top: 0.12rem; color: var(--muted); font-size: 0.64rem; }
.tree-toggle { display: grid; place-items: center; width: 19px; height: 19px; border: 1px solid var(--line); border-radius: 5px; color: var(--accent); }
.detail-panel { padding: 1.3rem; }
.detail-panel h2 { margin: 0 0 0.5rem; font-size: 1.6rem; }
.detail-panel code { color: var(--accent); }
dl { display: grid; grid-template-columns: 1fr 1fr; margin-top: 2rem; font-size: 0.75rem; }
dt, dd { margin: 0; border-bottom: 1px solid var(--line); padding: 0.65rem 0; }
dt { color: var(--muted); text-transform: capitalize; }
dd { text-align: right; }
.member-form { display: block; }
.member-form > label, .attribute-fields label, .date-grid label { display: block; margin: 0 0 0.8rem; color: var(--muted); font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.member-form input, .member-form select { margin-top: 0.35rem; padding: 0.65rem 0.7rem; font-size: 0.78rem; }
.member-form input[readonly] { color: var(--muted); }
.member-form hr { height: 1px; margin: 1.3rem 0; border: 0; background: var(--line); }
.member-form .check-label { display: flex; align-items: center; gap: 0.55rem; text-transform: none; }
.member-form .check-label input { width: auto; margin: 0; accent-color: var(--accent); }
.attribute-fields { margin-top: 1.2rem; border-top: 1px solid var(--line); padding-top: 1.2rem; }
.date-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.form-section-title { margin-bottom: 0.8rem; font-size: 0.75rem; font-weight: 750; }
.upload-panel textarea { width: 100%; margin-top: 1rem; }
.upload-panel.always { margin-top: 0; }
.upload-actions { display: flex; justify-content: flex-end; align-items: end; gap: 0.75rem; margin-top: 1rem; }
.loads-layout { grid-template-columns: minmax(0, 1.2fr) minmax(330px, .8fr); }
.source-detail { min-height: 280px; max-height: 560px; overflow: auto; padding: 16px; border-radius: 10px; background: #101b22; color: #d7e7e8; white-space: pre-wrap; overflow-wrap: anywhere; }
.load-studio { overflow: hidden; }
.stage-badge { border-radius: 999px; padding: .35rem .6rem; background: rgba(184,255,99,.1); color: var(--accent) !important; font-size: .65rem !important; text-transform: uppercase; }
.load-settings { display: grid; grid-template-columns: repeat(auto-fit, minmax(125px, 1fr)); gap: .7rem; padding: 1rem; }
.load-settings label { margin: 0; color: var(--muted); font-size: .66rem; font-weight: 750; text-transform: uppercase; }
.load-settings select { margin-top: .35rem; padding: .65rem; font-size: .76rem; }
.pipeline-stages { display: grid; gap: .8rem; margin: .8rem 0 1rem; }
.pipeline-stage { border: 1px solid var(--line); border-radius: 10px; padding: .8rem; background: var(--surface-strong); }
.pipeline-stage-head, .pipeline-job { display: grid; grid-template-columns: 1.2fr .9fr auto; gap: .6rem; align-items: center; }
.pipeline-job { grid-template-columns: 1fr 1fr 2fr .5fr auto; border-top: 1px solid var(--line); padding-top: .7rem; margin-top: .7rem; }
.pipeline-dependency { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; grid-column: 1 / -1; }
.pipeline-database-config { display: grid; grid-template-columns: repeat(4, 1fr); gap: .6rem; grid-column: 1 / -1; padding: .7rem; border-radius: 8px; background: var(--surface); }
.pipeline-database-config .pipeline-sql { grid-column: 1 / -1; }
.compact-toggle { padding: .45rem 0; border: 0; }
.pipeline-job textarea { min-height: 4.5rem; margin: 0; font-family: ui-monospace, monospace; font-size: .7rem; }
.pipeline-variables { display: grid; grid-template-columns: 1fr .7fr 1fr auto auto; gap: .5rem; margin: .5rem 0; align-items: center; }
.pipeline-runs { margin-top: 1rem; }
.audit-chat-panel { margin-bottom: 1rem; }
.audit-chat-answer { margin-top: 1rem; padding: 1rem; border-radius: 10px; background: var(--surface-strong); white-space: pre-wrap; line-height: 1.55; }
.form-folder { margin: .35rem 0; padding-left: .7rem; border-left: 2px solid var(--line); }
.form-library-item { width: 100%; display: flex; justify-content: space-between; padding: .65rem; border: 0; background: transparent; color: var(--ink); text-align: left; }
.form-library-item:hover { background: var(--surface-strong); }
.data-entry-input { min-width: 110px; text-align: right; }
.data-entry-input.changed { outline: 2px solid var(--accent); }
.pipeline-run { border-bottom: 1px solid var(--line); padding: .8rem 0; }
.pipeline-run summary { cursor: pointer; display: flex; justify-content: space-between; gap: .5rem; }
.pipeline-step { display: grid; grid-template-columns: .8fr 1fr 2fr; gap: .5rem; padding: .45rem; font-size: .72rem; }
.pipeline-step.failed { color: var(--danger); }
@media (max-width: 900px) {
  .pipeline-stage-head, .pipeline-job, .pipeline-variables { grid-template-columns: 1fr; }
}
.file-drop { display: grid; place-items: center; min-height: 230px; margin: 0 1rem 1rem; border: 1px dashed rgba(184,255,99,.35); border-radius: 12px; background: rgba(184,255,99,.025); text-align: center; cursor: pointer; }
.file-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-drop strong { margin-top: 4rem; color: var(--ink); font-size: 1rem; }
.file-drop strong::before { display: block; margin-bottom: .8rem; color: var(--accent); font-size: 2rem; content: "↑"; }
.file-drop span { align-self: start; color: var(--muted); font-size: .7rem; }
.subheading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: .75rem 1rem; }
.subheading strong, .subheading span { display: block; }
.subheading span { margin-top: .2rem; color: var(--muted); font-size: .68rem; }
#mapping-table th, #mapping-table td, #preview-table th, #preview-table td { position: static; text-align: left; }
#mapping-table select { min-width: 160px; padding: .45rem; font-size: .72rem; }
.preview-scroll { max-height: 280px; }
.load-actions { display: flex; justify-content: flex-end; gap: .6rem; padding: 1rem; }
.validation-result { margin: 0 1rem 1rem; border: 1px solid var(--line); border-radius: 10px; padding: 1rem; font-size: .78rem; }
.validation-result strong, .validation-result > span { display: block; }
.validation-result > span { margin-top: .3rem; color: var(--muted); }
.validation-result.valid { border-color: rgba(184,255,99,.35); }
.validation-result.invalid { border-color: rgba(255,138,131,.45); }
.validation-result.invalid strong { color: var(--danger); }
.validation-result ul { max-height: 160px; overflow: auto; margin: .8rem 0; padding-left: 1.2rem; color: var(--danger); }
.notice { position: fixed; z-index: 20; top: 88px; right: 24px; max-width: 430px; border: 1px solid rgba(184,255,99,.35); border-radius: 10px; padding: 0.85rem 1rem; background: #18231f; box-shadow: var(--shadow); font-size: 0.8rem; }
.notice.error { border-color: rgba(255,138,131,.5); color: var(--danger); }
.user-chip.offline span { background: #e6bd4b; }
.heading-actions { display: flex; gap: 0.6rem; }
.admin-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.settings-panel { max-width: 920px; padding: 0 1.25rem 1.25rem; }
.settings-panel .panel-heading { margin-top: .5rem; }
.toggle-row { display: flex; gap: .8rem; align-items: flex-start; margin: 1rem 0 1.5rem; padding: 1rem; border: 1px solid var(--line); border-radius: .7rem; background: rgba(255,255,255,.02); }
.toggle-row input { width: 18px; height: 18px; margin-top: .15rem; }
.toggle-row span { display: grid; gap: .3rem; }
.toggle-row small { color: var(--muted); line-height: 1.5; }
.column-picker { position: relative; margin-left: auto; }
.column-picker summary { cursor: pointer; list-style: none; border: 1px solid var(--line); border-radius: .45rem; padding: .55rem .75rem; }
.column-picker>div { position: absolute; z-index: 20; right: 0; top: calc(100% + .35rem); min-width: 190px; padding: .65rem; border: 1px solid var(--line); border-radius: .6rem; background: var(--panel); box-shadow: 0 12px 35px #0007; }
.column-picker label { display: flex; gap: .5rem; padding: .35rem; font-size: .75rem; }
.tree-table-scroll { overflow: auto; max-height: 64vh; }
.hierarchy-table { width: 100%; border-collapse: collapse; }
.hierarchy-table th { position: sticky; top: 0; z-index: 2; text-align: left; background: var(--panel); }
.hierarchy-table th,.hierarchy-table td { border-bottom: 1px solid var(--line); padding: .6rem .7rem; white-space: nowrap; }
.tree-table-member { border: 0; background: transparent; color: inherit; padding-left: calc(var(--depth) * 1.25rem); cursor: pointer; font-weight: 700; }
.tree-table-member span { display: inline-block; width: 1.2rem; color: var(--muted); }
.hierarchy-table tr.inactive { opacity: .5; }
.upload-panel:not([hidden]) { position: fixed; z-index: 100; inset: 8vh max(8vw,40px); overflow: auto; box-shadow: 0 24px 80px #000b; }
.artifact-row { display: grid; width: 100%; gap: .25rem; padding: .85rem; border: 0; border-bottom: 1px solid var(--line); text-align: left; background: transparent; color: inherit; cursor: pointer; }
.artifact-row:hover { background: rgba(184,255,99,.06); }
.artifact-row span { color: var(--muted); font-size: .72rem; }
#rapidcalc-script { width: 100%; margin-top: .5rem; font-family: ui-monospace,SFMono-Regular,Consolas,monospace; line-height: 1.5; }
.ai-author-row { display: flex; gap: .6rem; margin: .8rem 0 1rem; }
.ai-author-row input { flex: 1; }
.inline-admin-form { margin: 1rem 0; padding: 0 1.2rem 1.2rem; }
.inline-admin-form .form-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }

@media (max-width: 800px) {
  .login-shell { grid-template-columns: 1fr; }
  .brand-panel { min-height: 45vh; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand-panel, .login-panel { padding: 3rem 1.5rem; }
  .brand-mark { margin-bottom: 2rem; }
  .coordinate { display: none; }
  .hero, .next-section { grid-template-columns: 1fr; gap: 2rem; }
  .metric-grid { grid-template-columns: 1fr; }
  .dimension-list { justify-content: flex-start; }
  .user-chip { display: none; }
  .studio-shell { grid-template-columns: 1fr; }
  .studio-nav { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .studio-nav nav { grid-template-columns: 1fr 1fr; }
  .phase-card { display: none; }
  .control-grid, .control-grid.compact, .form-grid, .split-layout, .loads-layout { grid-template-columns: 1fr; }
  .view-heading { align-items: flex-start; flex-direction: column; }
  .heading-actions, .admin-form-row { width: 100%; grid-template-columns: 1fr; flex-wrap: wrap; }
}
.form-page-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-muted);
}

.form-page-bar label {
  min-width: 190px;
}

.calculated-field {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.72rem;
  white-space: nowrap;
}

.secured-cell {
  background: color-mix(in srgb, var(--surface-muted) 88%, #ef4444 12%);
}

.security-explanation {
  display: block;
  max-width: 220px;
  margin-top: 4px;
  color: #b42318;
  font-size: 0.7rem;
}

.pipeline-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.pipeline-metrics span {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
}

.pipeline-metrics strong {
  display: block;
}

.dashboard-studio { display:grid; grid-template-columns:220px minmax(0,1fr) 280px; gap:16px; align-items:start; }
.dashboard-toolbox,.dashboard-inspector { position:sticky; top:16px; max-height:calc(100vh - 100px); overflow:auto; }
.widget-palette { display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-bottom:20px; }
.widget-palette-item { min-height:68px; padding:8px; border:1px solid var(--line); border-radius:10px; background:var(--surface-muted); color:inherit; cursor:grab; font-size:.72rem; }
.widget-palette-item span { display:block; color:var(--accent); font-size:1.15rem; font-weight:800; margin-bottom:4px; }
.dashboard-settings { margin-bottom:12px; }
.dashboard-ai { margin-bottom:12px; }
.dashboard-ai-row { display:grid; grid-template-columns:minmax(240px,1fr) auto auto; gap:8px; align-items:stretch; }
.dashboard-ai-row textarea { resize:vertical; min-height:54px; }
.dashboard-ai > small { display:block; margin-top:8px; color:var(--muted); }
.dashboard-canvas { --dashboard-columns:12; --dashboard-row-height:72px; display:grid; grid-template-columns:repeat(var(--dashboard-columns),minmax(0,1fr)); grid-auto-rows:var(--dashboard-row-height); gap:8px; min-height:620px; padding:12px; border:1px dashed color-mix(in srgb,var(--line) 65%,var(--accent)); border-radius:14px; background-color:var(--surface-muted); background-image:linear-gradient(to right,rgba(128,128,128,.06) 1px,transparent 1px),linear-gradient(to bottom,rgba(128,128,128,.06) 1px,transparent 1px); background-size:calc(100% / var(--dashboard-columns)) var(--dashboard-row-height); }
.dashboard-empty { grid-column:1/-1; align-self:center; text-align:center; color:var(--muted); }
.dashboard-widget { position:relative; min-width:0; overflow:hidden; border:1px solid var(--line); border-radius:12px; background:var(--surface); box-shadow:0 5px 18px rgba(0,0,0,.08); }
.dashboard-widget.selected { outline:2px solid var(--accent); outline-offset:1px; }
.dashboard-widget-handle { display:flex; justify-content:space-between; align-items:center; height:38px; padding:0 10px; border-bottom:1px solid var(--line); cursor:move; touch-action:none; }
.dashboard-widget-remove { border:0; background:transparent; color:var(--muted); font-size:1.2rem; cursor:pointer; }
.dashboard-widget-body { height:calc(100% - 38px); padding:10px; display:flex; flex-direction:column; align-items:stretch; justify-content:center; overflow:auto; }
.dashboard-widget-body svg { width:100%; height:100%; min-height:90px; }
.dashboard-widget-body table { width:100%; border-collapse:collapse; }
.dashboard-widget-body td,.dashboard-widget-body th { padding:5px; border-bottom:1px solid var(--line); text-align:right; }
.dashboard-widget-body th { text-align:left; }
.dashboard-resize-handle { position:absolute; right:2px; bottom:2px; width:16px; height:16px; cursor:nwse-resize; touch-action:none; border-right:3px solid var(--accent); border-bottom:3px solid var(--accent); }
.kpi-value { font-size:clamp(1.8rem,4vw,4rem); font-weight:800; line-height:1; }
.kpi-value.good { color:#2ca36c; }.kpi-value.warning { color:#d79b17; }.kpi-value.bad { color:#dc5a5a; }
.embedded-form { display:grid; place-items:center; gap:6px; min-height:90px; border:1px dashed var(--line); border-radius:8px; }
.dashboard-inspector label { display:block; margin-bottom:10px; }
.dashboard-preview-mode .dashboard-toolbox,.dashboard-preview-mode .dashboard-inspector,.dashboard-preview-mode .dashboard-settings { display:none; }
.dashboard-preview-mode .dashboard-studio { grid-template-columns:1fr; }
.dashboard-preview-mode .dashboard-widget-remove,.dashboard-preview-mode .dashboard-resize-handle { display:none; }
.dashboard-preview-mode .dashboard-widget-handle { cursor:default; }
@media(max-width:1100px){.dashboard-studio{grid-template-columns:180px minmax(0,1fr)}.dashboard-inspector{position:static;grid-column:1/-1}.dashboard-toolbox{position:static}}
@media(max-width:760px){.dashboard-ai-row{grid-template-columns:1fr}.dashboard-ai-row textarea{min-height:90px}}
.report-studio{display:grid;grid-template-columns:210px minmax(0,1fr) 290px;gap:16px;align-items:start}
.report-ai{margin-bottom:16px}.report-section{display:grid;width:100%;gap:5px;margin-bottom:8px;text-align:left;color:inherit;cursor:pointer}
.report-section.selected{outline:2px solid var(--accent)}.report-section span,.report-section small{color:var(--muted)}
.report-output{min-height:500px;margin-top:16px;background:#fff;color:#17202a;padding:36px}
.report-document-header{display:flex;justify-content:space-between;align-items:end;border-bottom:3px solid #17202a;margin-bottom:28px}
.financial-statement{margin-bottom:32px}.financial-statement table{width:100%;border-collapse:collapse}
.financial-statement th,.financial-statement td{padding:7px 10px;border-bottom:1px solid #d9dee3;text-align:right}
.financial-statement th:first-child{text-align:left}.financial-statement thead th{border-bottom:2px solid #17202a}
.hierarchy-indent{padding-left:22px!important}.report-narrative{font-size:1rem;line-height:1.65;margin:20px 0}
.report-custom-header,.report-output footer{color:#59636e;font-size:.78rem;letter-spacing:.04em}.report-output footer{margin-top:30px;border-top:1px solid #aab2ba;padding-top:8px}
@media(max-width:1100px){.report-studio{grid-template-columns:1fr}.report-studio>aside{position:static}}
@media print{body *{visibility:hidden}.report-output,.report-output *{visibility:visible}.report-output{position:absolute;inset:0;margin:0;border:0;box-shadow:none}.topbar,.studio-nav{display:none}.financial-statement{break-inside:avoid}.report-narrative{break-inside:avoid}}
.composite-lookup {
  background: color-mix(in srgb, var(--surface) 82%, var(--accent) 18%);
  font-variant-numeric: tabular-nums;
}

.tie-ok {
  color: #237a3b;
  background: #e7f6eb;
  font-weight: 700;
}

.tie-fail {
  color: #a52b2b;
  background: #fdeaea;
  font-weight: 700;
}

.dashboard-tie {
  margin-top: 0.65rem;
  padding: 0.45rem 0.6rem;
  border-radius: 0.4rem;
  font-size: 0.78rem;
}

.model-layout{display:grid;grid-template-columns:220px minmax(0,1fr) 290px;gap:16px;align-items:start}
.formula-bar{display:grid;grid-template-columns:auto minmax(180px,1fr) auto auto;gap:8px;align-items:center;margin-bottom:12px}
.model-grid{min-height:520px;overflow:auto}.model-grid table{width:100%;border-collapse:collapse}.model-grid th,.model-grid td{padding:8px;border:1px solid var(--line);text-align:right;vertical-align:top}.model-grid th{text-align:left;background:var(--surface-muted)}
.model-cell{cursor:pointer;min-width:110px}.model-cell.selected{outline:2px solid var(--accent);outline-offset:-2px}.model-cell.driver{background:color-mix(in srgb,var(--surface) 80%,#d79b17 20%)}.model-cell .tag{margin-left:5px}.model-cell-overlay{display:block;margin-top:5px;color:var(--muted);font-size:.65rem;white-space:normal}
.whatif-panes{display:grid;grid-template-columns:repeat(auto-fit,minmax(420px,1fr));gap:16px;margin-top:16px}.whatif-pane>input{font-size:1.05rem;font-weight:700;margin-bottom:12px}.whatif-controls{display:grid;gap:8px;margin-bottom:12px}.whatif-driver{display:grid;grid-template-columns:minmax(0,1fr) 110px;gap:8px;align-items:end}.whatif-driver label{display:grid;grid-template-columns:minmax(100px,1fr) minmax(130px,2fr) auto;gap:8px;align-items:center}.dashboard-grid-scroll{overflow:auto;max-width:100%}
@media(max-width:1100px){.model-layout{grid-template-columns:1fr}.whatif-panes{grid-template-columns:1fr}}
@media print{body.printing-dashboard *{visibility:hidden!important}body.printing-dashboard #dashboard-canvas,body.printing-dashboard #dashboard-canvas *{visibility:visible!important}body.printing-dashboard #dashboard-canvas{position:absolute;inset:0;width:100%;min-height:0;border:0;background:#fff;display:grid}body.printing-dashboard .dashboard-widget-remove,body.printing-dashboard .dashboard-resize-handle{display:none!important}}
.cell-action-menu {
  position: fixed;
  z-index: 10000;
  min-width: 230px;
  max-width: 340px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 16px 40px rgba(15, 23, 42, .24);
}
.cell-action-menu[hidden] { display: none; }
.cell-action-menu button {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.cell-action-menu button:hover { background: var(--surface-muted); }
.cell-action-menu .cell-action-heading {
  padding: 6px 10px;
  color: var(--muted);
  font-size: .75rem;
  border-bottom: 1px solid var(--border);
}
dialog {
  width: min(680px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 0;
  border: 0;
  border-radius: 14px;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.3);
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
}

dialog .panel {
  margin: 0;
  overflow: auto;
}

fieldset {
  min-width: 0;
  margin: 16px 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
}

legend {
  padding: 0 7px;
  font-weight: 700;
}

.guided-prompt,
.form-context-row,
.form-rule-binding,
.rapidcalc-context-row {
  margin-bottom: 10px;
}
.commentary-entry-input{min-width:180px;min-height:72px;resize:vertical;background:#fffdf2;border:1px solid #d9b949;border-radius:6px;padding:8px}
.commentary-entry-input.changed{outline:2px solid #b7791f}
.commentary-badge{display:inline-flex;gap:3px;margin-left:6px;padding:1px 5px;border-radius:999px;background:#fff4c2;color:#7a5400;font-size:11px;vertical-align:middle}
.operations-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:14px;margin:16px 0}
.operations-card{display:flex;flex-direction:column;gap:7px;padding:16px;border:1px solid var(--border);border-radius:12px;background:var(--panel)}
.operations-card>span,.operations-summary span{font-size:.75rem;text-transform:uppercase;letter-spacing:.08em;color:var(--muted)}
.operations-card>strong{font-size:1.08rem;text-transform:capitalize}
.operations-card>small{line-height:1.45;color:var(--muted)}
.operations-card.healthy{border-left:4px solid #25845b}.operations-card.warning{border-left:4px solid #c58a18}.operations-card.failed{border-left:4px solid #c34a4a}
.operations-summary{display:flex;flex-wrap:wrap;gap:12px;margin:14px 0}
.operations-summary>div{display:flex;flex-direction:column;gap:4px;min-width:130px;padding:11px 14px;border:1px solid var(--border);border-radius:10px;background:var(--panel)}
