/* ─────────────────────────────────────────────────────────────
   Generator Studio — "drafting room" theme.
   The design leans into the box-drawing wireframe the tool was
   sketched with: dashed panel borders, monospace labels, one
   copper accent for actions, ink-blue ground.
   ───────────────────────────────────────────────────────────── */

:root {
    --ink:        #12161f;   /* app background        */
    --panel:      #1a2029;   /* panel surface         */
    --panel-2:    #202834;   /* raised surface        */
    --line:       #39434f;   /* dashed drafting lines */
    --text:       #d6dae1;
    --text-dim:   #8b94a1;
    --copper:     #d99a4e;   /* single action accent  */
    --copper-ink: #221a10;
    --ok:         #7fbf7f;
    --err:        #d97f7f;
    --mono: "Cascadia Code", "JetBrains Mono", Consolas, monospace;
    --sans: "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    height: 100%;
    background: var(--ink);
    color: var(--text);
    font-family: var(--sans);
    font-size: 14px;
}

.studio {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) 200px;   /* topbar / workspace / pinned output */
    height: 100vh;
}

/* ── Top bar ─────────────────────────────────────────────── */
.topbar {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 10px 16px;
    border-bottom: 1px dashed var(--line);
    background: var(--panel);
}

.logo {
    font-family: var(--mono);
    font-size: 15px;
    color: var(--copper);
    letter-spacing: 0.5px;
}
.logo b { color: var(--text); font-weight: 600; }

.project-name { color: var(--text-dim); font-family: var(--mono); font-size: 13px; }
.project-name b { color: var(--text); }

.topbar-actions { margin-left: auto; display: flex; gap: 8px; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
    font-family: var(--mono);
    font-size: 13px;
    padding: 6px 14px;
    background: var(--panel-2);
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 3px;
    cursor: pointer;
}
.btn:hover:not(:disabled) { border-color: var(--copper); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn:focus-visible { outline: 2px solid var(--copper); outline-offset: 1px; }

.btn-accent {
    background: var(--copper);
    color: var(--copper-ink);
    border-color: var(--copper);
    font-weight: 600;
}
.btn-block { width: 100%; margin-top: 10px; }

.link {
    background: none; border: none;
    color: var(--text-dim); cursor: pointer;
    font-size: 12px; text-decoration: underline;
}

/* ── Workspace: explorer | main | properties ─────────────── */
.workspace {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr) 260px;
    min-height: 0;
    overflow: hidden;
}

.explorer, .properties {
    background: var(--panel);
    padding: 12px;
    overflow-y: auto;
}
.explorer   { border-right: 1px dashed var(--line); }
.properties { border-left:  1px dashed var(--line); }

.panel-title {
    font-family: var(--mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-dim);
    margin-bottom: 10px;
}

.explorer-nav { display: flex; flex-direction: column; gap: 2px; margin-bottom: 14px; }

.nav-item {
    text-align: left;
    padding: 6px 8px;
    font-family: var(--mono);
    font-size: 13px;
    background: none;
    border: none;
    border-left: 2px solid transparent;
    color: var(--text-dim);
    cursor: pointer;
}
.nav-item:hover { color: var(--text); }
.nav-item.active { color: var(--copper); border-left-color: var(--copper); background: var(--panel-2); }

.project-item {
    padding: 8px;
    border: 1px dashed var(--line);
    border-radius: 3px;
    margin-bottom: 6px;
    cursor: pointer;
}
.project-item:hover { border-color: var(--text-dim); }
.project-item.selected { border-style: solid; border-color: var(--copper); }
.project-item-name { display: block; font-family: var(--mono); }
.project-item-client { display: block; font-size: 12px; color: var(--text-dim); }

.history-item {
    display: flex; gap: 8px;
    font-family: var(--mono); font-size: 12px;
    padding: 4px 0; color: var(--text-dim);
}

/* ── Main tabs ───────────────────────────────────────────── */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }

.tabs {
    display: flex;
    gap: 2px;
    padding: 0 12px;
    border-bottom: 1px dashed var(--line);
    background: var(--panel);
}

.tab {
    font-family: var(--mono);
    font-size: 13px;
    padding: 10px 14px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-dim);
    cursor: pointer;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--copper); border-bottom-color: var(--copper); }

.tab-body { padding: 20px; overflow-y: auto; flex: 1; min-height: 0; }

/* ── Forms ───────────────────────────────────────────────── */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px 20px;
    max-width: 720px;
    margin-bottom: 16px;
}

label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    color: var(--text-dim);
    font-family: var(--mono);
}

input, select {
    font-family: var(--mono);
    font-size: 13px;
    padding: 7px 9px;
    background: var(--panel-2);
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 3px;
}
input:focus, select:focus { outline: none; border-color: var(--copper); }

.checkbox-label { flex-direction: row; align-items:flex-start; gap: 8px; }
.checkbox-label input { accent-color: var(--copper); }

.inline-add { display: flex; gap: 6px; }

.props { display: flex; flex-direction: column; gap: 12px; }

.muted { color: var(--text-dim); font-size: 12px; }
.pad { padding: 4px; }
.ok  { color: var(--ok);  font-family: var(--mono); font-size: 13px; }
.err { color: var(--err); font-family: var(--mono); font-size: 13px; }

/* ── Output console — the signature panel ────────────────── */
.output {
    border-top: 1px dashed var(--line);
    background: #0d1117;
    display: flex;
    flex-direction: column;
    min-height: 0;   /* pinned by the studio grid's fixed 200px row */
}

.output-header {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 8px 16px;
    border-bottom: 1px dashed var(--line);
}
.output-header .panel-title { margin: 0; }

.steps { display: flex; gap: 16px; font-family: var(--mono); font-size: 12px; }
.step          { color: var(--text-dim); }
.step.running  { color: var(--copper); }
.step.done     { color: var(--ok); }
.step.failed   { color: var(--err); }

.output-log {
    flex: 1;
    margin: 0;
    padding: 10px 16px;
    overflow-y: auto;
    font-family: var(--mono);
    font-size: 12.5px;
    line-height: 1.6;
    color: var(--text);
    white-space: pre-wrap;
}

/* ── Small screens ───────────────────────────────────────── */
@media (max-width: 980px) {
    .workspace { grid-template-columns: 180px 1fr; }
    .properties { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}

/* ── Entity designer ─────────────────────────────────────── */
.designer {
    display: grid;
    grid-template-columns: 230px minmax(0, 1fr);
    gap: 20px;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.designer-entities { border-right: 1px dashed var(--line); padding-right: 14px; overflow-y: auto; min-height: 0; }

.entity-item {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 7px 9px;
    border: 1px dashed var(--line);
    border-radius: 3px;
    margin-bottom: 6px;
    font-family: var(--mono);
    font-size: 13px;
    cursor: pointer;
}
.entity-item:hover { border-color: var(--text-dim); }
.entity-item.selected { border-style: solid; border-color: var(--copper); }

.designer-detail { min-width: 0; overflow: auto; min-height: 0; }

.design-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 8px;
    font-size: 13px;
}
.design-table th {
    font-family: var(--mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-dim);
    text-align: left;
    padding: 6px 6px;
    border-bottom: 1px dashed var(--line);
}
.design-table td { padding: 4px 6px; border-bottom: 1px dashed var(--line); }
.design-table td.center { text-align: center; }
.design-table input:not([type=checkbox]), .design-table select { width: 100%; min-width: 70px; }
.design-table input.narrow { min-width: 55px; width: 70px; }

/* The field name is the column people actually read; at 70px it truncated to
   "Weighin" and the table was unusable for anything but short names. */
.design-table input.field-name { min-width: 170px; font-family: var(--mono); }

/* Section heading that carries a control on the right. */
.panel-title-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.inline-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    cursor: pointer;
}

.inline-toggle input { margin: 0; }

/* Restore is destructive, so it reads as a stop rather than another button. */
.restore-confirm {
    margin-top: 10px;
    padding: 12px 14px;
    border: 1px solid #c0392b;
    border-left-width: 3px;
    border-radius: 4px;
    background: rgba(192, 57, 43, .05);
}

.restore-confirm p { margin: 0 0 10px; font-size: 13px; }
.restore-confirm label { display: block; font-size: 12px; }
.restore-confirm input { width: 220px; margin-top: 4px; }
.restore-actions { display: flex; gap: 8px; margin-top: 10px; }
.backup-actions { display: flex; align-items: center; gap: 6px; white-space: nowrap; }

.btn-danger { border-color: #c0392b; color: #c0392b; }
.btn-danger:disabled { opacity: .45; }
.btn-sm { padding: 2px 10px; font-size: 12px; }
.mono { font-family: var(--mono); font-size: 12px; }
.inline-toggle .muted { margin-left: 4px; }

/* Fourteen columns will always exceed a narrow viewport, so let the table
   scroll rather than squeezing every input. */
.designer-detail { overflow-x: auto; }
.designer-detail .design-table { min-width: 1120px; }

.repair-report {
    margin-top: 10px;
    padding: 10px;
    font-size: 12px;
    border: 1px dashed var(--line);
    border-radius: 4px;
    max-height: 320px;
    overflow: auto;
}

.repair-report p { margin: 0 0 6px; }
.repair-report ul { margin: 0 0 6px; padding-left: 16px; }
.repair-report li { margin-bottom: 2px; }
.repair-report strong { font-family: var(--mono); }

.spaced { margin-top: 22px; }
.designer-footer { margin-top: 24px; border-top: 1px dashed var(--line); padding-top: 12px; }
.btn-danger { border-color: var(--err); color: var(--err); }

.design-table select.combo-linked { border-color: var(--copper); color: var(--copper); }

.combo-toolbar { align-items: center; margin-bottom: 12px; }
.combo-toolbar input { max-width: 240px; }

.sys-badge {
    font-size: 10px; padding: 1px 5px; margin-left: 6px;
    border: 1px dashed var(--line); border-radius: 3px; color: var(--text-dim);
}
.sys-toggle { margin: 10px 0; font-size: 12px; }

.design-table input.combo-linked { border-color: var(--copper); color: var(--copper); }

/* ── chips (index field picker) ─────────────────────────── */
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip {
    font-family: var(--mono); font-size: 12px;
    padding: 3px 8px; border: 1px solid var(--line); border-radius: 3px;
    background: var(--panel-2); display: inline-flex; gap: 6px; align-items: center;
}
.chip-row select { width: auto; min-width: 90px; }

/* ── file explorer (Templates viewer / Source editor) ───── */
.file-explorer {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 16px;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}
.file-tree {
    overflow-y: auto; min-height: 0;
    border-right: 1px dashed var(--line);
    padding-right: 10px;
    font-family: var(--mono); font-size: 13px;
}
.tree-node { padding: 3px 6px; cursor: pointer; border-radius: 3px; white-space: nowrap; }
.tree-node:hover { background: var(--panel-2); }
.tree-node.dir { color: var(--text); }
.tree-node.file { color: var(--text-dim); }
.tree-node.file.selected { color: var(--copper); background: var(--panel-2); }
.tree-caret { color: var(--text-dim); display: inline-block; width: 14px; }
.tree-children { margin-left: 16px; border-left: 1px dashed var(--line); padding-left: 4px; }

.file-editor { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.file-editor-header {
    display: flex; align-items: center; gap: 12px;
    padding-bottom: 8px; margin-bottom: 8px;
    border-bottom: 1px dashed var(--line);
}
.file-path { font-family: var(--mono); font-size: 12px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; }
.code-area {
    flex: 1; min-height: 0; width: 100%;
    resize: none;
    font-family: var(--mono); font-size: 12.5px; line-height: 1.55;
    background: #0d1117; color: var(--text);
    border: 1px solid var(--line); border-radius: 3px;
    padding: 12px; white-space: pre; overflow: auto; tab-size: 4;
}
.code-area:focus { outline: none; border-color: var(--copper); }

/* ═══════════════════════════════════════════════════════════
   LAYOUT OVERRIDES — authoritative; keep at end of file.
   Root cause of past scroll bugs: .tab-body was a block, so
   height:100% children collapsed and the page grew past 100vh.
   ═══════════════════════════════════════════════════════════ */
html, body { height: 100%; overflow: hidden; }

.studio {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) 200px;  /* topbar / workspace / pinned output */
    height: 100vh;
    overflow: hidden;
}

.workspace { min-height: 0; overflow: hidden; }
.main { min-height: 0; }

/* flex column so full-height children (designer, file explorer) actually fill */
.tab-body {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    min-height: 0;
    flex: 1;
}
.tab-body > * { flex-shrink: 0; }               /* normal content flows + scrolls */
.tab-body > .designer,
.tab-body > .file-explorer {
    flex: 1 1 auto;                              /* full-height panes */
    min-height: 0;
    height: auto;
}

.designer { overflow: hidden; }
.designer-entities { overflow-y: auto; min-height: 0; }
.designer-detail   { overflow: auto;   min-height: 0; }

.file-explorer { overflow: hidden; }
.file-tree     { overflow-y: auto; min-height: 0; }
.file-editor   { min-height: 0; }
.code-area     { flex: 1; min-height: 0; }

.output { min-height: 0; overflow: hidden; }
.output-log { min-height: 0; }

/* ── CodeMirror host sizing ─────────────────────────────── */
.cm-host { flex: 1; min-height: 0; display: flex; }
.cm-host .CodeMirror {
    flex: 1; height: auto; min-height: 0;
    font-family: var(--mono); font-size: 12.5px;
    border: 1px solid var(--line); border-radius: 3px;
}

/* drag-and-drop field reordering */
.drag-cell { width: 26px; text-align: center; }
.drag-handle {
    cursor: grab;
    color: var(--text-dim);
    user-select: none;
    padding: 2px 6px;
    display: inline-block;
}
.drag-handle:hover { color: var(--copper); }
.drag-handle:active { cursor: grabbing; }
.design-table tr.sortable-ghost td {
    background: var(--panel-2);
    border-top: 2px solid var(--copper);
    opacity: 0.6;
}

/* ── accounts & dashboards ─────────────────────────────── */
.account-shell { min-height: 100vh; display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 18px; background: var(--bg); }
.account-brand { font-size: 20px; color: var(--text); }
.account-card { background: var(--panel); border: 1px solid var(--line); border-radius: 6px;
    padding: 28px 32px; width: 360px; display: flex; flex-direction: column; gap: 10px; }
.account-card h1 { font-size: 18px; margin: 0 0 6px; }
.account-card label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-dim); }
.account-card input { background: var(--panel-2); border: 1px solid var(--line); border-radius: 3px;
    padding: 7px 9px; color: var(--text); }
.account-alt { border-top: 1px solid var(--line); padding-top: 12px; text-align: center; }
.dash { padding: 22px 28px; max-width: 1000px; }
.dash h1 { font-size: 20px; }
.dash-cards { display: flex; gap: 14px; margin: 16px 0 8px; flex-wrap: wrap; }
.dash-card { background: var(--panel); border: 1px solid var(--line); border-radius: 6px;
    padding: 16px 22px; min-width: 150px; color: var(--text-dim); }
.dash-number { display: block; font-size: 26px; color: var(--copper); }
.dash-action { color: var(--copper); display: flex; align-items: center; text-decoration: none; }
.topbar-nav { display: flex; align-items: center; gap: 12px; margin-left: auto; margin-right: 14px; }
.topbar-nav a { color: var(--text-dim); text-decoration: none; }
.topbar-nav a:hover { color: var(--copper); }

/* ── Dashboard ─────────────────────────────────────────── */
.dashboard-hero { display:flex; justify-content:space-between; gap:24px; align-items:flex-end; margin:10px 0 26px; }
.dashboard-eyebrow { margin:0 0 7px; color:var(--bs-primary, var(--copper)); font-size:.72rem; font-weight:700; letter-spacing:.12em; }
.dashboard-hero h1 { margin:0; font-size:clamp(1.65rem, 2.5vw, 2.25rem); font-weight:700; letter-spacing:-.03em; }
.dashboard-hero p:not(.dashboard-eyebrow) { margin:8px 0 0; color:var(--bs-secondary-color, var(--text-dim)); }
.dashboard-hero-actions { display:flex; flex-wrap:wrap; gap:9px; }
.dashboard-hero-actions .btn { font-family:inherit; }
.dashboard-metrics { display:grid; grid-template-columns:repeat(3, minmax(0, 1fr)); gap:16px; margin-bottom:24px; }
.dashboard-metric, .dashboard-panel { border:1px solid var(--bs-border-color, var(--line)); border-radius:12px; background:var(--bs-body-bg, var(--panel)); box-shadow:0 1px 2px rgba(0,0,0,.04); }
.dashboard-metric { display:flex; align-items:center; gap:14px; padding:18px; }
.metric-icon { display:grid; place-items:center; flex:0 0 43px; height:43px; border-radius:11px; font-size:1.22rem; }
.metric-blue { background:rgba(13,110,253,.13); color:#2574dc; }.metric-green { background:rgba(25,135,84,.13); color:#16865a; }.metric-orange { background:rgba(255,145,0,.16); color:#c97800; }
.metric-label, .dashboard-metric small { display:block; color:var(--bs-secondary-color, var(--text-dim)); font-size:.79rem; }.dashboard-metric strong { display:block; margin:2px 0; font-size:1.5rem; line-height:1.1; }
.dashboard-panel { overflow:hidden; }.dashboard-panel-header { display:flex; justify-content:space-between; gap:16px; align-items:flex-start; padding:19px 20px 14px; border-bottom:1px solid var(--bs-border-color, var(--line)); }
.dashboard-panel-header h2 { font-size:1rem; margin:0; font-weight:700; }.dashboard-panel-header p { margin:3px 0 0; color:var(--bs-secondary-color, var(--text-dim)); font-size:.82rem; }.dashboard-panel-header a { color:var(--bs-primary, var(--copper)); font-size:.84rem; text-decoration:none; white-space:nowrap; }
.dashboard-project { display:grid; grid-template-columns:38px minmax(0, 1fr) auto 12px; align-items:center; gap:12px; padding:13px 20px; color:inherit; text-decoration:none; border-bottom:1px solid var(--bs-border-color, var(--line)); transition:background .15s ease; }.dashboard-project:last-child { border-bottom:0; }.dashboard-project:hover { background:var(--bs-tertiary-bg, var(--panel-2)); }
.project-avatar { display:grid; place-items:center; width:38px; height:38px; background:var(--bs-primary-bg-subtle, var(--panel-2)); color:var(--bs-primary, var(--copper)); border-radius:9px; font-weight:700; }.project-summary { min-width:0; }.project-summary strong, .project-summary small { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }.project-summary small, .project-updated { margin-top:2px; font-size:.78rem; color:var(--bs-secondary-color, var(--text-dim)); }.project-updated { margin:0; white-space:nowrap; }.dashboard-project > i { font-size:.75rem; color:var(--bs-secondary-color, var(--text-dim)); }
.dashboard-activity { display:flex; gap:12px; align-items:center; padding:14px 20px; border-bottom:1px solid var(--bs-border-color, var(--line)); }.dashboard-activity:last-child { border-bottom:0; }.activity-status { display:grid; place-items:center; flex:0 0 29px; height:29px; border-radius:50%; font-size:.8rem; }.activity-status.success { background:rgba(25,135,84,.14); color:#16865a; }.activity-status.failed { background:rgba(220,53,69,.14); color:#c02f3f; }.dashboard-activity strong, .dashboard-activity small { display:block; }.dashboard-activity small { margin-top:2px; color:var(--bs-secondary-color, var(--text-dim)); font-size:.78rem; }
.dashboard-empty { min-height:225px; display:flex; flex-direction:column; justify-content:center; align-items:center; padding:28px; text-align:center; color:var(--bs-secondary-color, var(--text-dim)); }.dashboard-empty > i { margin-bottom:10px; font-size:1.7rem; color:var(--bs-primary, var(--copper)); }.dashboard-empty h3 { color:var(--bs-body-color, var(--text)); margin:0; font-size:1rem; }.dashboard-empty p { max-width:310px; margin:6px 0 14px; font-size:.84rem; }.dashboard-empty.compact { min-height:225px; }
@media (max-width: 900px) { .dashboard-metrics { grid-template-columns:1fr; }.dashboard-hero { align-items:flex-start; flex-direction:column; }.project-updated { display:none; } }

/* ── Account menu (navbar) ─────────────────────────────── */
/* Scoped under .account-menu: the theme's .nav-link loads after this file and would otherwise win,
   and the explorer's monospace .nav-item and form controls above would reach in. */
.nav-item.account-menu, .account-menu-panel .form-select { font-family:var(--bs-body-font-family, var(--sans)); }
.account-menu .account-menu-toggle { display:flex; align-items:center; gap:9px; background:none; border:0; font-family:inherit; }
.account-menu-toggle > .bi-chevron-down { font-size:.7rem; color:var(--bs-secondary-color, var(--text-dim)); }
.account-avatar { display:grid; place-items:center; flex:0 0 32px; width:32px; height:32px; border-radius:50%; background:var(--bs-primary-bg-subtle, var(--panel-2)); color:var(--bs-primary, var(--copper)); font-size:.78rem; font-weight:700; }
.account-menu-label { flex-direction:column; align-items:flex-start; max-width:14rem; line-height:1.15; text-align:left; }
.account-menu-label > * { max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }.account-menu-label small { color:var(--bs-secondary-color, var(--text-dim)); font-size:.72rem; }
.account-menu-panel { width:min(19rem, calc(100vw - 16px)); padding:0; overflow:hidden; }.account-menu-panel .btn { font-family:inherit; }
.account-menu-section { display:grid; gap:6px; margin:0; padding:12px 16px; border-bottom:1px solid var(--bs-border-color, var(--line)); }.account-menu-panel > :last-child { border-bottom:0; }
.account-menu-section small { font-size:.78rem; }.account-menu-section .form-label { margin:4px 0 0; font-size:.78rem; }
.account-identity { grid-template-columns:auto minmax(0, 1fr); align-items:center; gap:10px; }.account-identity strong, .account-identity small { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }.account-identity small { color:var(--bs-secondary-color, var(--text-dim)); }.account-identity .badge { margin-top:4px; }
.account-menu-heading { color:var(--bs-secondary-color, var(--text-dim)); font-size:.68rem; font-weight:700; letter-spacing:.08em; text-transform:uppercase; }
.account-workspace { display:flex; align-items:center; gap:8px; min-width:0; }.account-workspace strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }.account-workspace .badge { margin-left:auto; }
.account-meter > div:first-child { display:flex; justify-content:space-between; font-size:.8rem; }.account-meter .progress { height:4px; margin-top:3px; }
.account-menu-panel > .dropdown-item { display:flex; gap:8px; padding:10px 16px; border-bottom:1px solid var(--bs-border-color, var(--line)); }

/* ── Plan limits where the Studio meets them ───────────── */
.plan-lock { display:inline-flex; align-items:center; gap:4px; padding:2px 8px; border:1px solid color-mix(in srgb, #d97706 50%, var(--line)); border-radius:999px; color:#b45309; font-size:11px; font-weight:600; white-space:nowrap; cursor:help; }
[data-bs-theme=dark] .plan-lock { color:#f59e0b; }
.plan-count { color:var(--text-dim); font-size:11px; white-space:nowrap; cursor:help; }.plan-count.full { color:#b45309; }.plan-count.over { color:var(--err); }
[data-bs-theme=dark] .plan-count.full { color:#f59e0b; }

/* Secrets & VM Access */
.env-columns { display: flex; gap: 24px; flex-wrap: wrap; margin-bottom: 14px; }
.env-column { flex: 1; min-width: 260px; background: var(--panel); border: 1px solid var(--line);
    border-radius: 6px; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.env-heading { font-weight: 600; color: var(--copper); margin-bottom: 2px; }
.env-column label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--text-dim); }
.env-column input, .env-column select, .env-column textarea {
    background: var(--panel-2); border: 1px solid var(--line); border-radius: 3px;
    padding: 6px 8px; color: var(--text); font-family: inherit; }
.env-column textarea { font-family: var(--mono); font-size: 11.5px; resize: vertical; }
.env-column .btn { align-self: flex-start; margin-top: 4px; }

/* A pinned host key: long enough to need wrapping in a narrow column. */
.env-column .host-key { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--text-dim); }
.env-column .host-key .mono { color: var(--text); overflow-wrap: anywhere; }
.env-column .host-key .link { align-self: flex-start; }
.host-key-check { padding: 10px 12px; border: 1px solid var(--line); border-radius: 4px; background: var(--panel-2); font-size: 12px; }
.host-key-check p { margin: 0 0 6px; }
.host-key-check .mono { overflow-wrap: anywhere; }

/* ═══════════════════════════════════════════════════════════════════
   MODERN DESIGN LAYER — appended after the base rules so it wins by
   cascade. Same selectors, same markup, refreshed design language to
   match the AdminLTE/Bootstrap chrome: sans-serif UI (mono reserved
   for code/output), solid hairlines instead of dashed drafting lines,
   soft radii, subtle elevation, and primary-tinted active states.
   ═══════════════════════════════════════════════════════════════════ */

:root {
    --radius: 8px;
    --radius-sm: 6px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.12);
    --shadow-md: 0 4px 14px rgba(0,0,0,.16);
    --focus-ring: 0 0 0 3px color-mix(in srgb, var(--copper) 28%, transparent);
}

/* ── typography: UI is sans; mono only where it means something ── */
.studio, .btn, .tab, .panel-title, .project-item-name, .project-name,
.explorer, .properties, .design-table, label, input, select, textarea {
    font-family: var(--sans);
}
.output-log, .cm-host, .code-area, .file-editor, .file-editor textarea {
    font-family: var(--mono);
}

/* ── topbar: app-bar with hairline + soft shadow ── */
.topbar {
    height: 52px;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
    padding: 0 16px;
    gap: 14px;
}
.logo { font-weight: 600; letter-spacing: .2px; }
.topbar-nav a { padding: 6px 10px; border-radius: var(--radius-sm); text-decoration: none; }
.topbar-nav a:hover { background: var(--panel-2); color: var(--text); }

/* ── buttons ── */
.btn {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 6px 14px;
    background: var(--panel);
    transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.btn:hover:not(:disabled) { border-color: var(--copper); background: var(--panel-2); }
.btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.btn-accent {
    background: var(--copper);
    border-color: var(--copper);
    color: var(--copper-ink);
    font-weight: 500;
}
.btn-accent:hover:not(:disabled) { filter: brightness(1.08); background: var(--copper); }
.link { color: var(--copper); text-decoration: none; }
.link:hover { text-decoration: underline; }

/* ── sidebars: solid surfaces, refined nav ── */
.explorer, .properties { background: var(--ink); }
.explorer   { border-right: 1px solid var(--line); }
.properties { border-left:  1px solid var(--line); }
.explorer > :first-child,
.properties > :first-child {
    font-size: 11px; letter-spacing: .12em; font-weight: 600;
    color: var(--text-dim);
}
.nav-item {
    border-radius: var(--radius-sm);
    padding: 7px 10px;
    transition: background .15s ease, color .15s ease;
}
.nav-item:hover { background: var(--panel-2); }
.nav-item.active, .nav-item.selected {
    background: color-mix(in srgb, var(--copper) 16%, transparent);
    color: var(--copper);
    font-weight: 500;
    border-left: 3px solid var(--copper);
    padding-left: 7px;
}

/* ── project cards ── */
.project-item {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 10px 12px;
    background: var(--panel);
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.project-item:hover { border-color: var(--text-dim); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.project-item.selected {
    border: 1px solid var(--copper);
    background: color-mix(in srgb, var(--copper) 8%, var(--panel));
}
.project-item-name { font-weight: 600; font-size: 13.5px; }

/* ── tabs: modern underline with hover surface ── */
.tabs {
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    gap: 2px;
    padding: 0 10px;
}
.tab {
    padding: 11px 16px;
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    color: var(--text-dim);
    transition: color .15s ease, background .15s ease, border-color .15s ease;
}
.tab:hover { color: var(--text); background: var(--panel-2); }
.tab.active {
    color: var(--copper);
    border-bottom-color: var(--copper);
    background: color-mix(in srgb, var(--copper) 7%, transparent);
    font-weight: 500;
}

/* ── content surfaces ── */
.tab-body { padding: 20px 24px; }
.panel-title {
    font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase;
    font-weight: 600; color: var(--text-dim);
    margin-bottom: 10px;
}
.panel-title.spaced { margin-top: 26px; }

/* ── inputs ── */
input, select, textarea {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 7px 10px;
    background: var(--panel);
    color: var(--text);
    transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--copper);
    box-shadow: var(--focus-ring);
}

/* ── tables as cards ── */
.design-table {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border-spacing: 0;
}
.design-table thead th {
    background: var(--panel-2);
    font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
    color: var(--text-dim); font-weight: 600;
    padding: 9px 12px;
    border-bottom: 1px solid var(--line);
}
.design-table td { padding: 9px 12px; border-bottom: 1px solid color-mix(in srgb, var(--line) 55%, transparent); }
.design-table tbody tr:last-child td { border-bottom: none; }
.design-table tbody tr { transition: background .12s ease; }
.design-table tbody tr:hover { background: color-mix(in srgb, var(--copper) 5%, transparent); }

/* ── env columns / grouped panels ── */
.env-column {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    box-shadow: var(--shadow-sm);
}

/* ── output console ── */
.output {
    border-top: 1px solid var(--line);
    background: var(--ink);
}
.output-header {
    padding: 8px 14px;
    font-size: 11px; letter-spacing: .12em; font-weight: 600;
    color: var(--text-dim);
    border-bottom: 1px solid var(--line);
}
.output-log { font-size: 12.5px; line-height: 1.55; padding: 10px 14px; }

/* ── pipeline step chips ── */
.step {
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 3px 12px;
    font-size: 12px;
    font-family: var(--sans);
    background: var(--panel);
    transition: all .2s ease;
}
.step.running {
    border-color: var(--copper);
    color: var(--copper);
    background: color-mix(in srgb, var(--copper) 12%, transparent);
    animation: step-pulse 1.2s ease-in-out infinite;
}
.step.done   { border-color: var(--ok);  color: var(--ok);  background: color-mix(in srgb, var(--ok) 10%, transparent); }
.step.failed { border-color: var(--err); color: var(--err); background: color-mix(in srgb, var(--err) 10%, transparent); }
@keyframes step-pulse { 50% { opacity: .55; } }

/* ── scrollbars ── */
.studio ::-webkit-scrollbar { width: 10px; height: 10px; }
.studio ::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
.studio ::-webkit-scrollbar-thumb:hover { background: var(--text-dim); background-clip: padding-box; }
.studio ::-webkit-scrollbar-track { background: transparent; }

/* ═══════════════════════════════════════════════════════════════════
   ADMIN-SHELL ADAPTATION — the designer now renders inside the
   AdminLTE app shell (cards in normal page flow) instead of its own
   full-viewport grid. The old architecture pinned html/body overflow
   and sized panes off a 100vh grid; in page flow that freezes
   scrolling entirely. These overrides restore normal document flow
   while preserving the flex column inside the tab card so full-height
   panes (.designer, .file-explorer) still fill and scroll internally.
   ═══════════════════════════════════════════════════════════════════ */
html, body { height: auto; overflow: auto; }

/* tab card: viewport-tied height keeps the designer/file-explorer flex
   architecture working exactly as before, just inside a card */
.card-body.tab-body {
    height: calc(100vh - 330px);
    min-height: 420px;
    overflow-y: auto;
}

/* output console: capped log height so the page stays tidy in flow */
.output-log { max-height: 170px; overflow-y: auto; }
.output-log.expanded { max-height: 520px; }
/* Large-screen overlay — Fluent dialog */
.output-fullscreen-backdrop{
  position:fixed; inset:0; z-index:2050; display:grid; place-items:center; padding:24px;
  background: color-mix(in srgb, #111827 72%, transparent); backdrop-filter:blur(4px);
}
.output-fullscreen{
  width:min(1180px, 96vw); height:min(84vh, 860px); display:flex; flex-direction:column; overflow:hidden;
  background: var(--bs-body-bg, var(--panel)); border:1px solid var(--bs-border-color, var(--line));
  border-radius:12px; box-shadow:0 28px 80px rgba(0,0,0,.32);
}
.output-fullscreen .output-log{ background:#0d1117; color:#d4d4d4; font-size:13px; line-height:1.55; padding:16px; }
/* Fluent compact output pills */
.steps { gap:6px }
.step { border-radius: 999px; font-size:11px; padding:2px 8px }

/* scrollbar styling retargeted (the .studio wrapper is gone) */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ── pre-generation review ─────────────────────────────────────── */
.generation-review-backdrop {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: grid;
    place-items: center;
    padding: 24px;
    background: color-mix(in srgb, #111827 72%, transparent);
    backdrop-filter: blur(4px);
}
.generation-review {
    width: min(1180px, 100%);
    max-height: calc(100vh - 48px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: calc(var(--radius) + 4px);
    background: var(--panel-2);
    box-shadow: 0 28px 80px rgba(0, 0, 0, .32);
}
.generation-review-header,
.generation-review-actions {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 22px;
    background: var(--panel);
}
.generation-review-header { border-bottom: 1px solid var(--line); }
.generation-review-header > div:first-child { flex: 1; }
.generation-review-header h2 { margin: 2px 0 3px; font-size: 22px; }
.generation-review-header p { margin: 0; color: var(--text-dim); }
.review-eyebrow {
    color: var(--copper);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
}
.review-close {
    border: 0;
    background: transparent;
    color: var(--text-dim);
    font-size: 28px;
    line-height: 1;
}
.review-grid,
.review-issues {
    overflow: auto;
    padding: 18px 22px 0;
}
.review-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    padding-bottom: 20px;
}
.review-issues { display: grid; gap: 8px; padding-bottom: 0; }
.review-card {
    min-width: 0;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    box-shadow: var(--shadow-sm);
}
.review-card-heading { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 15px; }
.review-card-heading > span {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--copper) 13%, transparent);
    color: var(--copper);
    font-size: 11px;
    font-weight: 700;
}
.review-card h3 { margin: 0; font-size: 17px; }
.review-card-heading p { margin: 2px 0 0; color: var(--text-dim); font-size: 12px; }
.review-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.review-metric {
    display: grid;
    grid-template-columns: auto auto 1fr;
    align-items: baseline;
    gap: 6px;
    padding: 9px 10px;
    border-radius: var(--radius-sm);
    background: var(--panel-2);
    font-size: 12px;
}
.review-metric strong { font-size: 18px; }
.review-metric-symbol { font-weight: 800; }
.review-metric.positive .review-metric-symbol { color: var(--ok); }
.review-metric.warning .review-metric-symbol { color: #d97706; }
.review-metric.danger .review-metric-symbol { color: var(--err); }
.review-detail-list {
    max-height: 138px;
    overflow: auto;
    margin: 14px 0 0;
    padding: 10px 10px 10px 28px;
    border-top: 1px solid var(--line);
    color: var(--text-dim);
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 11px;
}
.review-deployment { display: grid; gap: 10px; margin: 0; }
.review-deployment div { display: grid; grid-template-columns: 90px 1fr; gap: 12px; }
.review-deployment dt { color: var(--text-dim); font-weight: 500; }
.review-deployment dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.review-callout {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--panel);
    font-size: 12px;
}
.review-callout.error { border-color: color-mix(in srgb, var(--err) 55%, var(--line)); }
.review-callout.warning { border-color: color-mix(in srgb, #d97706 55%, var(--line)); }
.review-callout.info { border-color: color-mix(in srgb, var(--copper) 55%, var(--line)); }
.generation-review-loading {
    display: grid;
    justify-items: center;
    gap: 8px;
    padding: 70px 20px;
    color: var(--text-dim);
}
.studio-busy-backdrop {
    position: fixed;
    inset: 0;
    z-index: 2200;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(17, 24, 39, .76);
    background: color-mix(in srgb, #111827 76%, transparent);
    backdrop-filter: blur(5px);
    cursor: wait;
    user-select: none;
}
.studio-busy-dialog {
    width: min(540px, 100%);
    display: grid;
    justify-items: center;
    gap: 16px;
    padding: 30px;
    border: 1px solid var(--line);
    border-radius: calc(var(--radius) + 4px);
    background: var(--panel);
    box-shadow: 0 28px 80px rgba(0, 0, 0, .34);
    text-align: center;
    outline: none;
}
.studio-busy-dialog h2 { margin: 4px 0; font-size: 22px; }
.studio-busy-dialog p { margin: 0; color: var(--text-dim); }
.studio-busy-dialog small { color: var(--text-dim); }
.studio-progress { width: min(440px, 100%); display: grid; gap: 8px; }
.review-progress { margin-top: 14px; }
.studio-progress-track {
    position: relative;
    height: 9px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--line);
    background: color-mix(in srgb, var(--line) 72%, transparent);
}
.studio-progress-fill {
    position: absolute;
    inset: 0 auto 0 0;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--copper), color-mix(in srgb, var(--copper) 55%, #60a5fa));
}
.studio-progress-fill.determinate {
    min-width: 3px;
    transition: width .28s ease;
    overflow: hidden;
}
.studio-progress-fill.determinate::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(100deg, transparent 20%, rgba(255,255,255,.42) 50%, transparent 80%);
    transform: translateX(-100%);
    animation: studio-progress-shine 1.5s ease-in-out infinite;
}
.studio-progress-fill.indeterminate {
    width: 38%;
    animation: studio-progress-indeterminate 1.25s ease-in-out infinite;
}
.studio-progress-status {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    color: var(--text-dim);
    font-size: 12px;
    text-align: left;
}
.studio-progress-status strong { color: var(--text); font-weight: 600; }
@keyframes studio-progress-indeterminate {
    0% { transform: translateX(-105%); }
    100% { transform: translateX(365%); }
}
@keyframes studio-progress-shine {
    0%, 25% { transform: translateX(-100%); }
    75%, 100% { transform: translateX(100%); }
}
.review-spinner {
    width: 34px;
    height: 34px;
    border: 3px solid var(--line);
    border-top-color: var(--copper);
    border-radius: 50%;
    animation: review-spin .8s linear infinite;
}
@keyframes review-spin { to { transform: rotate(360deg); } }
.generation-review-actions { justify-content: flex-end; border-top: 1px solid var(--line); }

@media (prefers-reduced-motion: reduce) {
    .review-spinner,
    .studio-progress-fill.indeterminate,
    .studio-progress-fill.determinate::after { animation-duration: 3s; }
}

/* ── reorganized Studio navigation ────────────────────────────── */
.studio-group-tabs .btn { border-radius: 20px; font-weight:600; font-size:.82rem; padding:.35rem .85rem }
.studio-group-tabs .btn-primary { box-shadow: 0 1px 2px rgba(0,0,0,.12) }
.studio-section-tabs { gap: 2px; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: thin; }
.studio-section-tabs .nav-link { white-space: nowrap; border-radius: 999px; }
.studio-section-tabs .nav-link.active { background: var(--bs-primary); color:#fff }
.studio-subnav {
    display: flex;
    gap: 6px;
    margin-bottom: 18px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
}
.studio-subnav button {
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 6px 13px;
    background: var(--panel);
    color: var(--text-dim);
}
.studio-subnav button.active {
    border-color: var(--copper);
    color: var(--copper);
    background: color-mix(in srgb, var(--copper) 10%, transparent);
}
.settings-intro {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 20px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel-2);
}
.settings-intro h4 { margin: 0 0 4px; font-size: 16px; }
.settings-intro p { margin: 0; color: var(--text-dim); }

/* ── step-by-step setup instructions with copyable commands ── */
.setup-guide { margin: 0 0 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-2); }
.setup-guide > summary { padding: 10px 14px; cursor: pointer; font-weight: 600; }
.setup-guide > p { margin: 0 14px 10px; }
.setup-guide ol { margin: 0; padding: 0 14px 14px 34px; display: grid; gap: 12px; }
.setup-command { display: flex; align-items: flex-start; gap: 8px; margin-top: 6px; }
.setup-command pre {
    flex: 1; min-width: 0; margin: 0; padding: 8px 10px; overflow-x: auto; white-space: pre;
    background: var(--panel); border: 1px solid var(--line); border-radius: 4px;
    font-family: var(--mono); font-size: 12px; color: var(--text);
}

/* ── controlled AI entity proposal workflow ─────────────────── */
.ai-entity-workflow { display: grid; gap: 16px; }
.ai-workflow-steps {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel-2);
}
.ai-workflow-steps > div {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    color: var(--text-dim);
    font-size: 12px;
}
.ai-workflow-steps b {
    display: grid;
    place-items: center;
    flex: 0 0 25px;
    width: 25px;
    height: 25px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--panel);
}
.ai-workflow-steps .active { color: var(--text); }
.ai-workflow-steps .active b { border-color: var(--copper); background: var(--copper); color: white; }
.ai-config-grid { display: grid; grid-template-columns: minmax(330px, .8fr) minmax(420px, 1.2fr); gap: 16px; }
.settings-card {
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    box-shadow: var(--shadow-sm);
}
.settings-card h5 { margin: 0 0 6px; font-size: 15px; }
.offline-provider-fields { margin-top: 16px; max-width: 900px; }
.entity-offline-card { margin: 14px 0 18px; max-width: 940px; }
.entity-offline-fields { margin: 14px 0 0; max-width: 940px; }
.entity-offline-card input:disabled,
.entity-offline-card select:disabled,
.offline-provider-fields input:disabled,
.offline-provider-fields select:disabled { opacity: .58; cursor: not-allowed; }
.section-title-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.section-title-row p { margin: 0; }
.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--text-dim);
    font-size: 11px;
    white-space: nowrap;
}
.status-pill.ok { border-color: color-mix(in srgb, var(--ok) 55%, var(--line)); color: var(--ok); }
.status-pill.danger { border-color: color-mix(in srgb, var(--err) 55%, var(--line)); color: var(--err); }
.ai-provider-fields { margin-top: 14px; }
.ai-provider-fields .span-2 { grid-column: 1 / -1; }
.ai-provider-fields .inline-add { margin-top: 5px; }
.ai-provider-fields .inline-add input { min-width: 0; flex: 1; }
.ai-global-config-summary { display: grid; gap: 8px; margin: 15px 0; }
.ai-global-config-summary span { display: grid; grid-template-columns: 90px 1fr; gap: 10px; color: var(--text-dim); font-size: 12px; }
.ai-global-config-summary strong { color: var(--text); overflow-wrap: anywhere; }
.ai-prompt-card textarea { width: 100%; resize: vertical; margin-top: 10px; }
.ai-prompt-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 10px; }
.ai-proposal-card { display: grid; gap: 14px; }
.ai-proposal-card h5 { margin-top: 3px; font-size: 18px; }
.eyebrow { color: var(--copper); font-size: 10px; font-weight: 800; letter-spacing: .1em; }
.ai-proposal-totals { display: flex; gap: 8px; }
.ai-proposal-totals span { padding: 7px 10px; border-radius: var(--radius-sm); background: var(--panel-2); font-size: 11px; }
.ai-proposal-totals strong { font-size: 15px; }
.ai-proposal-totals .danger { color: var(--err); }
.ai-warning-list { display: grid; gap: 6px; }
.ai-change-list { display: grid; gap: 10px; }
.ai-quick-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 10px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.ai-quick-actions strong { margin-right: 4px; font-size: 13px; }
.ai-change-card { padding: 13px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-2); }
.ai-change-card.invalid { border-color: color-mix(in srgb, var(--err) 55%, var(--line)); }
.ai-change-card > header { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.ai-change-card > p { margin: 8px 0; color: var(--text-dim); }
.ai-accept-change { display: flex; align-items: center; gap: 9px; }
.change-badge { padding: 3px 7px; border-radius: 999px; font-size: 10px; font-weight: 800; text-transform: uppercase; }
.change-badge.add { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.change-badge.update { color: #d97706; background: color-mix(in srgb, #d97706 12%, transparent); }
.change-badge.remove { color: var(--err); background: color-mix(in srgb, var(--err) 12%, transparent); }
.ai-change-metadata { display: flex; flex-wrap: wrap; gap: 7px; margin: 8px 0; }
.ai-change-metadata span { padding: 5px 8px; border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--text-dim); font-size: 11px; }
.ai-change-card details { margin-top: 9px; }
.ai-change-card summary { color: var(--copper); cursor: pointer; font-size: 12px; }
.ai-field-chips { display: flex; flex-wrap: wrap; gap: 5px; padding-top: 9px; }
.ai-field-chips > span { padding: 5px 7px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 11px; }
.ai-field-chips small { color: var(--text-dim); }
.ai-apply-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.ai-apply-bar > div { display: grid; gap: 2px; }

/* ── AI code assistant (Generated source) ───────────────────── */
.source-ai-panel { margin-bottom: 12px; }
.source-ai-steps { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.source-ai-prompt textarea { width: 100%; resize: vertical; }
.source-ai-prompt p { margin: 0 0 8px; }
.source-ai-focus { display: flex; align-items: center; gap: 7px; min-width: 0; margin: 0; }
.source-ai-focus code, .source-ai-path { overflow-wrap: anywhere; }
.source-ai-counts { display: inline-flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 12px; white-space: nowrap; }
.source-ai-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.source-ai-context ul, .source-ai-file-list { margin: 6px 0 0; padding-left: 18px; font-size: 12px; }
.source-ai-context summary { color: var(--copper); cursor: pointer; font-size: 12px; }
.source-ai-confirm { display: grid; gap: 8px; }
.source-ai-confirm p { margin: 0; }
.source-diff-added { color: var(--ok); }
.source-diff-removed { color: var(--err); }
.source-diff {
    margin-top: 8px; max-height: 480px; overflow: auto;
    border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel);
    font-family: var(--mono); font-size: 12px; line-height: 1.45;
}
.source-diff-hunk { padding: 3px 10px; color: var(--text-dim); background: var(--panel-2); border-block: 1px solid var(--line); }
.source-diff-hunk:first-child { border-top: 0; }
.source-diff-line { display: grid; grid-template-columns: 44px 44px 16px minmax(0, 1fr); min-width: max-content; }
.source-diff-line code { padding-right: 12px; color: var(--text); background: transparent; white-space: pre; }
.source-diff-number { padding: 0 6px; color: var(--text-dim); text-align: right; user-select: none; }
.source-diff-sign { color: var(--text-dim); user-select: none; }
.source-diff-line.added { background: color-mix(in srgb, var(--ok) 13%, transparent); }
.source-diff-line.added .source-diff-sign { color: var(--ok); }
.source-diff-line.removed { background: color-mix(in srgb, var(--err) 13%, transparent); }
.source-diff-line.removed .source-diff-sign { color: var(--err); }
@media (max-width: 900px) {
    .source-ai-steps { grid-template-columns: 1fr 1fr; }
    .source-ai-panel .ai-apply-bar, .source-ai-panel .ai-prompt-actions { flex-direction: column; align-items: stretch; }
}


/* ── Branding tab ───────────────────────────────────────────── */
.branding-layout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; max-width: 940px; }
.branding-logo-frame {
    display: grid; place-items: center; height: 180px; margin: 10px 0 8px;
    border: 1px solid var(--line); border-radius: var(--radius-sm);
    /* a checkerboard, so a transparent background reads as transparent */
    background: repeating-conic-gradient(color-mix(in srgb, var(--text-dim) 22%, transparent) 0 25%, transparent 0 50%) 0 0 / 16px 16px;
}
.branding-logo-frame img { max-width: 90%; max-height: 160px; object-fit: contain; }
.branding-upload { display: flex; flex-direction: column; gap: 4px; margin: 14px 0 4px; font-size: 12px; color: var(--text-dim); }
.branding-actions { display: flex; gap: 8px; margin-top: 12px; }
.brand-preview { display: grid; gap: 16px; margin-top: 12px; }
.brand-preview figure { display: grid; gap: 6px; margin: 0; justify-items: start; }
.brand-preview figcaption { font-size: 11px; color: var(--text-dim); }
.brand-preview-header {
    display: flex; align-items: center; gap: 10px; width: 100%; height: 52px; padding: 0 14px;
    border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.brand-preview-header img { max-width: 160px; max-height: 34px; object-fit: contain; }
.brand-preview-header span { overflow: hidden; font-size: 15px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.brand-preview-tab {
    display: inline-flex; align-items: center; gap: 8px; max-width: 240px; padding: 7px 12px;
    border: 1px solid var(--line); border-bottom: 0; border-radius: 8px 8px 0 0;
    background: var(--panel-2); color: var(--text); font-size: 12px;
}
.brand-preview-tab img { flex: 0 0 16px; width: 16px; height: 16px; object-fit: contain; }
.brand-preview-tab span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* A maskable icon is cropped to the launcher's shape; a circle is the tightest. */
.brand-preview-icon {
    display: grid; place-items: center; width: 72px; height: 72px;
    border: 1px solid var(--line); border-radius: 50%; overflow: hidden; box-shadow: var(--shadow-sm);
}
.brand-preview-icon img { width: 70%; height: 70%; object-fit: contain; }
/* iOS rounds the corners at about 22% and the art sits at 80% (BrandingAssetsStep.AppleArtFraction). */
.brand-preview-icon.apple { border-radius: 22%; }
.brand-preview-icon.apple img { width: 80%; height: 80%; }
.brand-preview-icons { display: flex; flex-wrap: wrap; gap: 24px; }

@media (max-width: 760px) {
    .branding-layout { grid-template-columns: 1fr; }
}

@media (max-width: 1000px) {
    .ai-config-grid { grid-template-columns: 1fr; }
    .ai-workflow-steps { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
    .review-grid { grid-template-columns: 1fr; }
    .review-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .generation-review-backdrop { padding: 8px; }
    .generation-review { max-height: calc(100vh - 16px); }
}
