/* ==========================================================================
   INTEL admin — the operate surface: a sidebar shell around instrument panels.
   Loads after style.css and uses only its tokens. Density and action
   affordances first; the cartographic marks stay in the margins.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Shell — sidebar, stage, top bar (narrow screens)
   -------------------------------------------------------------------------- */

.admin-body { background: var(--paper); min-height: 100vh; }
.shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }

.side {
    position: sticky; top: 0; height: 100vh; overflow-y: auto; overscroll-behavior: contain;
    display: flex; flex-direction: column; gap: 6px;
    background: color-mix(in srgb, var(--surface) 72%, var(--paper));
    border-right: 1px solid var(--rule);
    padding: 18px 14px 14px;
    scrollbar-width: thin;
}
.side-top { display: flex; align-items: center; justify-content: space-between; padding: 2px 6px 14px; }
.side-brand { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; }
.side-brand:hover { text-decoration: none; color: var(--ink); }
.side-glyph { width: 24px; height: 24px; flex: none; }
.side-wordmark { height: 17px; width: auto; color: var(--ink); }
.side-tag {
    font-family: var(--meta); font-size: var(--fs-micro); letter-spacing: var(--track-micro); text-transform: uppercase;
    color: var(--text-mute); border-left: 1px solid var(--rule-2); padding-left: 9px; margin-left: 2px; line-height: 1;
}
.side-close { display: none; background: none; border: 0; font-size: 24px; line-height: 1; color: var(--text-mute); cursor: pointer; padding: 4px 8px; }

.side-nav { display: flex; flex-direction: column; gap: 1px; }
.side-group {
    margin: 14px 10px 6px; font-family: var(--meta); font-size: var(--fs-micro); letter-spacing: var(--track-micro);
    text-transform: uppercase; color: var(--text-mute);
}
.side-group:first-child { margin-top: 0; }
.side-link {
    position: relative; display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 0 10px; border-radius: 9px;
    color: var(--text-dim); text-decoration: none; font-size: var(--fs-base); font-weight: var(--fw-medium);
    transition: background var(--ease), color var(--ease);
}
.side-link .ico { flex: none; opacity: .8; }
.side-link span:not(.side-badge) { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-link:hover { background: color-mix(in srgb, var(--ink) 5%, transparent); color: var(--ink); text-decoration: none; }
.side-link.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--rule); }
.side-link.is-active::before {
    content: ""; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0;
    background: var(--ip-mark);
}
.side-link.is-active .ico { opacity: 1; color: var(--ip-mark); }
.side-badge {
    flex: none; min-width: 22px; padding: 1px 7px; border-radius: 999px; text-align: center;
    font-family: var(--meta); font-size: var(--fs-micro); font-variant-numeric: tabular-nums; line-height: 1.6;
    color: var(--text-mute); background: color-mix(in srgb, var(--ink) 6%, transparent);
}
.side-badge.warn { color: var(--amber); background: var(--amber-bg); }
.side-badge.accent { color: var(--accent); background: var(--accent-bg); }
.side-link-quiet { color: var(--text-mute); font-weight: 400; }

.side-status { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding-top: 18px; }
.side-run {
    display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; text-decoration: none; color: inherit;
    background: var(--surface); border: 1px solid var(--rule); box-shadow: var(--shadow-sm);
}
.side-run:hover { text-decoration: none; border-color: var(--rule-2); }
.side-run-text { display: flex; flex-direction: column; min-width: 0; }
.side-run-k { font-family: var(--meta); font-size: var(--fs-micro); letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.side-run-v { font-size: var(--fs-xs); color: var(--text); line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.side-worker { display: flex; align-items: center; gap: 10px; padding: 4px 10px; }
.side-pulse { width: 56px; height: 18px; flex: none; overflow: visible; }
.side-pulse path { fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.side-pulse-base { stroke: var(--rule-2); }
.side-pulse-trace { stroke: var(--text-mute); stroke-dasharray: 34 200; stroke-dashoffset: 0; }
.side-worker.is-live .side-pulse-trace { stroke: var(--ok); animation: side-trace 2.4s linear infinite; }
.side-worker.is-idle .side-pulse-trace { stroke-dasharray: none; opacity: .35; }
@keyframes side-trace { from { stroke-dashoffset: 120; } to { stroke-dashoffset: -114; } }
.side-worker-label { font-family: var(--meta); font-size: var(--fs-micro); letter-spacing: .08em; text-transform: uppercase; color: var(--text-mute); }

.side-foot { border-top: 1px solid var(--rule); margin-top: 8px; padding-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.side-user { display: flex; align-items: center; gap: 9px; padding: 2px 4px 2px 10px; }
.side-user img, .side-avatar { width: 28px; height: 28px; border-radius: 50%; flex: none; }
.side-avatar { display: grid; place-items: center; background: var(--surface-2); color: var(--text-dim); font-weight: 600; font-size: var(--fs-xs); }
.side-email { flex: 1 1 auto; min-width: 0; font-size: var(--fs-xs); color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side .theme-picker { position: relative; flex: none; }
.side .theme-menu { top: auto; bottom: calc(100% + 8px); right: -4px; left: auto; }
.side-signout { margin: 0; padding: 0 10px; }
.side-signout button { background: none; border: 0; padding: 4px 0; font: inherit; font-size: var(--fs-xs); color: var(--text-mute); cursor: pointer; }
.side-signout button:hover { color: var(--danger); }

.stage { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; }
.side-scrim { display: none; }

.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ip-mark); box-shadow: 0 0 0 0 color-mix(in srgb, var(--ip-mark) 60%, transparent); animation: live-ping 1.6s ease-out infinite; flex: none; }
@keyframes live-ping { 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

/* --------------------------------------------------------------------------
   2. Page frame — heads, notices
   -------------------------------------------------------------------------- */

.admin-main { position: relative; width: 100%; max-width: 1280px; margin: 0 auto; padding: 34px clamp(18px, 3.4vw, 44px) 90px; }
.admin-main:focus { outline: none; }

.admin-head { margin-bottom: 26px; max-width: none; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 24px; align-items: end; }
.admin-head > * { grid-column: 1; }
.admin-head .admin-head-actions { grid-column: 2; grid-row: 1 / span 3; align-self: end; margin: 0; }
.admin-head.tight { margin-bottom: 18px; }
.admin-head .eyebrow {
    margin: 0 0 4px; font-family: var(--meta); font-size: var(--fs-label); letter-spacing: var(--track-micro); text-transform: uppercase; color: var(--text-mute);
}
.admin-head .eyebrow a { color: var(--text-mute); }
.admin-head .eyebrow a:hover { color: var(--accent); }
.admin-head h1 {
    margin: 0; font-family: var(--sans); font-size: clamp(1.6rem, 2.6vw, 2.15rem); color: var(--ink);
    letter-spacing: -0.03em; font-weight: 650; line-height: 1.1;
}
.admin-head h1.sm, .admin-head h1.sm-gap { font-size: clamp(1.4rem, 2.2vw, 1.8rem); }
.admin-head h1.lg { font-size: clamp(1.8rem, 3vw, 2.4rem); }
.admin-head .sub { margin: 6px 0 0; color: var(--text-dim); font-size: var(--fs-md); line-height: var(--leading-ui); max-width: 72ch; }
.admin-head .sub.wide { max-width: 86ch; }
.admin-head .sub.narrow { max-width: 72ch; }
.admin-head .sub code { font-family: var(--mono); font-size: .9em; background: var(--surface-2); border: 1px solid var(--rule); border-radius: var(--radius-xs); padding: 1px 5px; }
.admin-head-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; }

.admin-main .notice, .login-shell .notice { border-left-width: 1px; border-left-color: var(--rule); border-radius: 12px; }
.admin-main .notice.ok, .login-shell .notice.ok { background: color-mix(in srgb, var(--ok) 9%, var(--surface)); border-color: color-mix(in srgb, var(--ok) 28%, var(--rule)); color: var(--ink); }
.admin-main .notice.error, .login-shell .notice.error { background: color-mix(in srgb, var(--danger) 8%, var(--surface)); border-color: color-mix(in srgb, var(--danger) 28%, var(--rule)); color: var(--danger); }
.notice-lead { margin: 6px 0 12px; }

/* --------------------------------------------------------------------------
   3. Cards and panels
   -------------------------------------------------------------------------- */

/* Stat cards read as one key-figure strip, like the public site's figures. */
.cards {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; margin: 0 0 24px;
    background: var(--rule); border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm);
}
.cards.tight { margin-bottom: 18px; }
.card { background: var(--surface); padding: 16px 18px; min-width: 0; text-decoration: none; color: inherit; display: block; position: relative; transition: background var(--ease); }
.card:hover { background: var(--wash); text-decoration: none; color: inherit; }
.card .k { font-family: var(--meta); font-size: var(--fs-label); letter-spacing: var(--track-label); text-transform: uppercase; color: var(--text-mute); }
a.card:hover .k { color: var(--accent); }
.card .v { font-family: var(--sans); font-size: var(--fs-5xl); color: var(--ink); margin-top: 4px; font-weight: var(--fw-semibold); letter-spacing: var(--track-tight); font-variant-numeric: tabular-nums; line-height: 1.1; }
.card .v.sm { font-size: var(--fs-3xl); }
.card .card-sub { font-family: var(--meta); font-size: var(--fs-label); color: var(--text-mute); margin-top: 4px; }

.panel {
    background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius);
    padding: clamp(18px, 2.4vw, 26px); margin-bottom: 18px; box-shadow: var(--shadow-sm); min-width: 0; position: relative;
}
.panel > h2, .panel-head h2, .log-head h2 {
    margin: 0 0 4px; font-family: var(--sans); font-size: var(--fs-lg); color: var(--ink); font-weight: var(--fw-semibold); letter-spacing: var(--track-tight);
    display: flex; align-items: center; gap: 10px;
}
.panel > h2::before, .panel-head h2::before, .log-head h2::before { content: ""; width: 6px; height: 6px; border-radius: 50%; border: 1.5px solid var(--accent); flex: none; }
.panel .hint { margin: 0 0 16px; color: var(--text-mute); font-size: var(--fs-sm); line-height: 1.5; }
.panel > .hint:last-child { margin-bottom: 0; }
.panel-head, .log-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 4px; }
.panel-head .hint, .log-head .hint { margin: 0 0 12px; }

.hint, .form-help { color: var(--text-mute); font-size: var(--fs-sm); line-height: 1.5; }
.form-help { margin: 6px 0 0; font-size: var(--fs-xs); }
.form-help.err { color: var(--danger); }

/* --------------------------------------------------------------------------
   4. Tables and pills
   -------------------------------------------------------------------------- */

.table-wrap { overflow-x: auto; min-width: 0; -webkit-overflow-scrolling: touch; margin: 0 -6px; padding: 0 6px;
    /* style.css boxes article tables as cards; admin tables sit straight on their panel */
    border: 0; border-radius: 0; background: none; box-shadow: none; }
/* Text inputs in a row keep a readable width: on a phone the table scrolls instead of crushing them to a letter. */
table.grid td input.w-full { min-width: 160px; }
table.grid { width: 100%; border-collapse: collapse; font-size: var(--fs-base); }
table.grid th {
    text-align: left; font-family: var(--meta); font-size: var(--fs-label); letter-spacing: var(--track-label); text-transform: uppercase;
    color: var(--text-mute); font-weight: var(--fw-medium); border-bottom: 1px solid var(--rule-2); padding: 0 12px 10px 0; white-space: nowrap;
}
table.grid td { padding: 12px 12px 12px 0; border-bottom: 1px solid var(--hair); vertical-align: top; }
table.grid tr:last-child td { border-bottom: 0; }
table.grid tbody tr { transition: background var(--ease); }
table.grid tbody tr:hover td { background: var(--wash); }
table.grid td.nowrap, table.grid td.mono { white-space: nowrap; overflow-wrap: normal; }
table.grid td.max-w-400, table.grid td.max-w-380, table.grid td.max-w-420, table.grid td.max-w-340 { overflow-wrap: anywhere; }
table.grid td.mono, table.grid td .mono, .mono { font-family: var(--mono); font-size: var(--fs-xs); color: var(--text-mute); }
table.grid td a { color: var(--ink); font-weight: var(--fw-medium); }
table.grid td a:hover { color: var(--accent); }
table.grid td.mono a { color: var(--accent); font-weight: var(--fw-semibold); }
tr.is-selected td { background: var(--wash-2); }
.row-disabled { opacity: .55; }

.pill {
    display: inline-flex; align-items: center; gap: 5px; font-family: var(--meta); font-size: var(--fs-micro); letter-spacing: .08em; text-transform: uppercase;
    border-radius: 999px; padding: 2px 8px; border: 1px solid var(--rule); color: var(--text-dim); line-height: 1.5; font-weight: var(--fw-medium); white-space: nowrap;
}
.pill.published, .pill.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, var(--surface)); border-color: color-mix(in srgb, var(--ok) 28%, var(--rule)); }
.pill.draft { color: var(--text-mute); border-style: dashed; }
.pill.run { color: var(--accent); background: var(--accent-bg); border-color: transparent; }
.pill.queued { color: var(--amber); background: var(--amber-bg); border-color: transparent; }
.pill.err, .pill.error { color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, var(--surface)); border-color: color-mix(in srgb, var(--danger) 26%, var(--rule)); }
.err-snip { color: var(--danger); font-size: var(--fs-sm); }

.row-action {
    background: none; border: 0; padding: 5px 8px; font: inherit; font-size: var(--fs-xs); font-family: var(--meta); color: var(--text-mute);
    cursor: pointer; text-decoration: none; border-radius: 999px; line-height: 1.2;
}
.row-action:hover { color: var(--accent); background: var(--wash); text-decoration: none; }
.row-action.danger:hover { color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, var(--surface)); }
.inline-form, .form-post-inline, .inline { display: inline; margin: 0; }

.seg { display: inline-flex; align-items: center; gap: 2px; padding: 3px; background: var(--surface-2); border-radius: 999px; flex: none; }
.seg a { font-size: var(--fs-sm); color: var(--text-dim); text-decoration: none; padding: 5px 12px; border-radius: 999px; line-height: 1.3; }
.seg a:hover { color: var(--ink); text-decoration: none; }
.seg a.is-active { background: var(--surface); color: var(--accent); font-weight: var(--fw-medium); box-shadow: var(--shadow-sm); }

.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar input[type="search"] { flex: 1 1 240px; max-width: 380px; border-radius: 999px; }
.picker-search { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.picker-search input[type="search"] { flex: 1 1 280px; max-width: 420px; border-radius: 999px; }
.picker-count { margin-left: auto; font-family: var(--meta); font-size: var(--fs-xs); color: var(--text-mute); }

.bulk-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-height: 34px; margin: 0 0 10px; }
.bulk-selection { min-width: 76px; margin-right: 2px; font-family: var(--meta); font-size: var(--fs-xs); color: var(--text-mute); }
.bulk-actions .btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.bulk-actions .bulk-delete:not(:disabled) { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--rule)); }
.select-cell { width: 34px; padding-right: 10px !important; text-align: center !important; }
.select-cell input[type="checkbox"] { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); cursor: pointer; }
@media (hover: none), (pointer: coarse) { .select-cell input[type="checkbox"], .check-label input[type="checkbox"] { width: 22px; height: 22px; } }

.tag-more { color: var(--text-mute); background: transparent; font-variant-numeric: tabular-nums; }
.tag-row.spaced { margin-top: 6px; }

/* --------------------------------------------------------------------------
   5. Forms
   -------------------------------------------------------------------------- */

.field-label {
    display: block; font-family: var(--meta); font-size: var(--fs-label); letter-spacing: var(--track-label); text-transform: uppercase;
    color: var(--text-mute); margin-bottom: 6px;
}
.field-label .hint { display: inline; font-size: inherit; text-transform: none; letter-spacing: 0; margin: 0; }
.stack { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.stack .field-label { margin-bottom: 0; }
.stack input[type="text"], .stack textarea, .stack select { width: 100%; }
.stack-field { margin-bottom: 20px; max-width: 520px; }
.block-label { display: block; margin-bottom: 16px; }
.form-row { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.form-row.end { align-items: flex-end; }
.form-row.center { align-items: center; gap: 20px; margin-bottom: 0; }
.form-row.gap-sm { gap: 12px; }
.form-row.gap-md { gap: 14px; margin-top: 16px; }
.form-row.actions { gap: 12px; align-items: center; margin-bottom: 40px; }
.form-grow { flex: 1 1 260px; min-width: 0; }
.form-grow-sm { flex: 1 1 200px; min-width: 0; }
.form-grow-md { flex: 1 1 170px; min-width: 0; }
.form-grow-lg { flex: 1 1 180px; min-width: 0; }
.form-grow-xl { flex: 1 1 220px; min-width: 0; }
.form-grow-2xl { flex: 1 1 240px; min-width: 0; }
.form-span-2 { flex: 2 1 320px; min-width: 0; }
.form-span-topic { flex: 2 1 340px; min-width: 0; }
.form-fixed { flex: 0 1 130px; }
.form-fixed-sm { flex: 0 1 110px; }
.form-fixed-md { flex: 0 1 150px; }
.form-fixed-date { flex: 0 0 160px; }
.form-hidden { flex: 1 1 200px; display: none; min-width: 0; }
.form-chips { display: flex; gap: 10px; flex-wrap: wrap; }
.form-actions { display: flex; gap: 20px; flex-wrap: wrap; align-items: center; }
.check-label { display: flex; align-items: center; gap: 10px; font-size: var(--fs-base); color: var(--text); }
.check-label.dim { gap: 8px; color: var(--text-dim); padding-top: 18px; }
.check-label.pad-top { padding-top: 22px; gap: 8px; color: var(--text-dim); }
.check-label.pad-bot { padding-bottom: 9px; gap: 8px; color: var(--text-dim); }
.check-label input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); }
.textarea-prose { font-size: var(--fs-md); line-height: 1.6; padding: 12px; }
.textarea-body { width: 100%; font-family: var(--mono); font-size: var(--fs-sm); line-height: 1.7; padding: 14px; }
.textarea-prompt { width: 100%; resize: vertical; font-size: var(--fs-md); line-height: 1.6; padding: 14px; min-height: 6.5rem; }
.input-order { width: 64px; }
.col-order, .col-docs { width: 70px; }

/* The research form's control bar */
.run-bar { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: end; margin-top: 16px; }
.run-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 14px; flex: 1 1 520px; min-width: 0; }
.run-fields > * { min-width: 0; }
.run-model { grid-column: 1 / -1; }
.run-actions { display: flex; align-items: center; gap: 14px; flex: 0 1 auto; padding-bottom: 1px; min-width: 0; flex-wrap: wrap; }

/* Model picker */
.model-select { position: relative; }
.model-toggle {
    display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; text-align: left; cursor: pointer;
    background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-s); padding: 9px 12px; color: var(--text); font: inherit;
    transition: border-color var(--ease), box-shadow var(--ease);
}
.model-toggle:hover { border-color: var(--rule-2); }
.model-toggle[aria-expanded="true"] { border-color: color-mix(in srgb, var(--accent) 55%, var(--rule)); box-shadow: var(--focus); }
.model-toggle .mt-id { font-family: var(--mono); font-size: var(--fs-sm); color: var(--ink); }
.model-toggle .mt-price { font-family: var(--meta); font-size: var(--fs-label); color: var(--text-mute); }
.model-panel {
    position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; right: 0; display: flex; flex-direction: column; max-height: 340px;
    background: var(--surface); border: 1px solid var(--rule-2); border-radius: var(--radius); box-shadow: var(--shadow-lg); overflow: hidden;
}
.model-panel[hidden] { display: none; }
.model-search { flex: 0 0 auto; padding: 8px; border-bottom: 1px solid var(--rule); }
.model-search input { width: 100%; }
.model-list { flex: 1 1 auto; overflow-y: auto; }
.model-option { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; text-align: left; cursor: pointer; padding: 8px 12px; background: none; border: 0; border-bottom: 1px solid var(--hair); font: inherit; }
.model-option:last-child { border-bottom: 0; }
.model-option:hover { background: var(--wash); }
.model-option.is-active .mo-id { color: var(--accent); font-weight: var(--fw-semibold); }
.model-option .mo-id { font-family: var(--mono); font-size: 12.5px; color: var(--ink); }
.model-option .mo-price { font-family: var(--meta); font-size: var(--fs-label); color: var(--text-mute); }

/* Settings */
.settings-subhead {
    margin: 28px 0 14px; padding-top: 20px; border-top: 1px solid var(--hair);
    font-family: var(--meta); font-size: var(--fs-label); letter-spacing: var(--track-label); text-transform: uppercase; color: var(--accent); font-weight: var(--fw-medium);
}
.settings-subhead:first-of-type { margin-top: 4px; padding-top: 0; border-top: 0; }

/* Schedules */
.scratch-details { padding-top: 16px; padding-bottom: 16px; }
.scratch-details > summary { list-style: none; cursor: pointer; display: flex; flex-direction: column; gap: 4px; }
.scratch-details > summary::-webkit-details-marker { display: none; }
.scratch-details > summary::after {
    content: "Show"; font-family: var(--meta); font-size: var(--fs-label); letter-spacing: var(--track-label); text-transform: uppercase; color: var(--accent); margin-top: 8px;
}
.scratch-details[open] > summary::after { content: "Hide"; }
.scratch-details[open] { padding-bottom: 22px; }
.scratch-details[open] > summary { margin-bottom: 18px; }
.scratch-title { font-size: var(--fs-lg); color: var(--ink); font-weight: var(--fw-semibold); letter-spacing: var(--track-tight); }
.scratch-hint { color: var(--text-mute); font-size: var(--fs-sm); }

/* Import dropzone */
.dropzone {
    position: relative; border: 1.5px dashed var(--rule-2); border-radius: var(--radius);
    background: linear-gradient(160deg, var(--wash), transparent 70%), var(--atlas-plate);
    transition: border-color var(--ease), background var(--ease);
}
.dropzone.is-dragover { border-color: var(--accent); background: var(--wash-2); }
.dropzone-input { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; }
.dropzone-body { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: clamp(24px, 4vw, 40px) 20px; cursor: pointer; }
.dropzone-input:focus-visible + .dropzone-body .dropzone-cta { box-shadow: var(--focus); }
.dropzone-glyph { width: 56px; height: 56px; }
.dropzone-title { font-size: var(--fs-lg); font-weight: var(--fw-semibold); color: var(--ink); margin: 0; }
.dropzone-sub { margin: 0; font-size: var(--fs-sm); color: var(--text-dim); max-width: 46ch; }
.dropzone-cta {
    display: inline-flex; align-items: center; gap: 8px; margin-top: 4px; padding: 9px 18px; min-height: 40px; border-radius: 999px;
    background: var(--accent); color: var(--on-accent); font-size: var(--fs-sm); font-weight: var(--fw-semibold); transition: transform var(--ease), box-shadow var(--ease);
}
.dropzone-cta:hover { transform: translateY(-1px); }
.dropzone-cta svg { width: 15px; height: 15px; }
.dropzone-accept { margin: 6px 0 0; font-family: var(--meta); font-size: var(--fs-micro); letter-spacing: .04em; color: var(--text-mute); }
.dropzone-list { list-style: none; margin: 0; padding: 0 18px 18px; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.dropzone-list li { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 6px 12px; background: var(--surface); border: 1px solid var(--hair); border-radius: 999px; font-size: var(--fs-xs); color: var(--text-dim); }
.dropzone-list .dz-name { max-width: 30ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropzone-list .dz-size { font-family: var(--meta); color: var(--text-mute); }

/* Editor preview renders with the public article styles. */
.doc-preview { margin-top: 14px; padding: 18px 22px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--paper); min-height: 60px; }
.doc-preview .article-body { font-size: var(--fs-lg); }
.source-list { margin: 0; padding-left: 20px; font-size: var(--fs-base); line-height: 1.9; }
.source-list .source-site { color: var(--text-mute); font-size: var(--fs-xs); white-space: normal; }
.prompt-echo { margin: 0; color: var(--text-dim); font-size: var(--fs-base); font-family: var(--serif); }

/* --------------------------------------------------------------------------
   6. Job log console
   -------------------------------------------------------------------------- */

.log-meta { display: flex; align-items: center; gap: 10px; font-family: var(--meta); font-size: var(--fs-label); color: var(--text-mute); padding-top: 4px; flex: none; }
.log-pin {
    color: var(--amber); border: 1px solid color-mix(in srgb, var(--amber) 35%, var(--rule)); background: color-mix(in srgb, var(--amber) 10%, var(--surface));
    border-radius: 999px; padding: 1px 8px; letter-spacing: .04em; text-transform: uppercase; font-size: var(--fs-micro); font-weight: var(--fw-bold);
}
.hint-offset { margin: -8px 0 22px; }
.console {
    background: var(--atlas-plate); color: var(--text); border: 1px solid var(--rule); border-radius: var(--radius-s); padding: 6px 0;
    font-family: var(--mono); font-size: 12.5px; line-height: 1.5; max-height: min(70vh, 640px); overflow-y: auto; overflow-x: hidden;
}
.console .row { display: grid; grid-template-columns: 62px 18px minmax(0, 1fr); gap: 4px 8px; padding: 6px 14px; align-items: start; }
.console .row + .row { border-top: 1px solid var(--hair); }
.console .t { color: var(--text-mute); font-size: var(--fs-label); padding-top: 3px; font-variant-numeric: tabular-nums; user-select: none; }
.console .dir { color: var(--text-mute); font-size: var(--fs-xs); padding-top: 2px; text-align: center; user-select: none; line-height: 1.4; }
.console .row.tool_call .dir { color: var(--accent); }
.console .row.tool_result .dir { color: var(--ok); }
.console .row.error .dir { color: var(--danger); }
.console .row.done .dir { color: var(--ok); }
.console .row.model .dir { color: var(--c3); }
.console .main { min-width: 0; }
.console .head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 5px 6px; }
.console .tag {
    display: inline-flex; align-items: center; gap: 4px; height: 18px; padding: 0 6px; border-radius: var(--radius-xs);
    font-size: var(--fs-micro); font-weight: var(--fw-bold); letter-spacing: .04em; line-height: 1; border: 1px solid transparent; flex: none; max-width: 100%; background: none;
}
.console .tag-kind { text-transform: uppercase; letter-spacing: .08em; }
.console .tag-tool { font-size: var(--fs-label); font-weight: var(--fw-semibold); letter-spacing: 0; text-transform: none; max-width: min(100%, 28ch); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.console .glyph { display: inline-block; width: 1em; text-align: center; opacity: .92; font-weight: var(--fw-medium); vertical-align: baseline; }
.tag-kind-tool_call { color: var(--accent-2); background: var(--accent-bg); border-color: color-mix(in srgb, var(--accent) 32%, var(--rule)); }
.tag-kind-tool_result, .tag-kind-done { color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, var(--surface)); border-color: color-mix(in srgb, var(--ok) 32%, var(--rule)); }
.tag-kind-info { color: var(--text-dim); background: color-mix(in srgb, var(--text-mute) 12%, var(--surface)); border-color: var(--rule); }
.tag-kind-model { color: var(--c3); background: color-mix(in srgb, var(--c3) 14%, var(--surface)); border-color: color-mix(in srgb, var(--c3) 32%, var(--rule)); }
.tag-kind-error { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, var(--surface)); border-color: color-mix(in srgb, var(--danger) 32%, var(--rule)); }
.tag-fam-search { color: var(--accent-2); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); border-color: color-mix(in srgb, var(--accent) 28%, var(--rule)); }
.tag-fam-fetch { color: var(--c6); background: color-mix(in srgb, var(--c6) 12%, var(--surface)); border-color: color-mix(in srgb, var(--c6) 30%, var(--rule)); }
.tag-fam-doc { color: var(--c2); background: color-mix(in srgb, var(--c2) 12%, var(--surface)); border-color: color-mix(in srgb, var(--c2) 30%, var(--rule)); }
.tag-fam-crawl { color: var(--c5); background: color-mix(in srgb, var(--c5) 12%, var(--surface)); border-color: color-mix(in srgb, var(--c5) 30%, var(--rule)); }
.tag-fam-write { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, var(--surface)); border-color: color-mix(in srgb, var(--ok) 30%, var(--rule)); }
.tag-fam-meta { color: var(--amber); background: color-mix(in srgb, var(--amber) 12%, var(--surface)); border-color: color-mix(in srgb, var(--amber) 30%, var(--rule)); }
.tag-fam-library { color: var(--text-dim); background: color-mix(in srgb, var(--text-mute) 12%, var(--surface)); border-color: var(--rule); }
.tag-fam-default { color: var(--ink); background: var(--surface); border-color: var(--rule); }
.console .row.error .tag-tool { color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, var(--surface)); border-color: color-mix(in srgb, var(--danger) 28%, var(--rule)); }
.console .msg { color: var(--ink); word-break: break-word; min-width: 0; }
.console .row.model .msg { color: var(--text-dim); font-style: italic; }
.console .row.error .msg { color: var(--danger); }
.console .fields { display: flex; flex-wrap: wrap; gap: 2px 12px; margin: 3px 0 0; padding: 0 0 0 10px; border-left: 2px solid color-mix(in srgb, var(--rule) 85%, var(--text-mute)); color: var(--text-dim); font-size: 11.5px; line-height: 1.55; word-break: break-word; }
.console .kv { white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.console .kv .k { color: var(--text-mute); }
.console .kv .eq { color: var(--text-mute); margin: 0 1px; }
.console .kv .v { color: var(--text); }
.console .kv.is-warn .v { color: var(--amber); font-weight: var(--fw-semibold); }
.console .kv.is-ok .v { color: var(--ok); font-weight: var(--fw-semibold); }
.console .kv.is-err .v { color: var(--danger); font-weight: var(--fw-semibold); }
.console .kv.is-url .v { color: var(--accent-2); }
.console-empty { padding: 28px 18px; text-align: center; color: var(--text-mute); font-size: var(--fs-xs); }

/* --------------------------------------------------------------------------
   7. Login
   -------------------------------------------------------------------------- */

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; position: relative; overflow: hidden; }
/* The library's reading behind the card, faded in a ring around it rather than off one side. */
.login-shell.ip-atmos .ip-atmos-bg { inset: 0;
    -webkit-mask-image: radial-gradient(70% 70% at 50% 50%, rgba(0,0,0,.35), #000 55%, transparent 100%);
            mask-image: radial-gradient(70% 70% at 50% 50%, rgba(0,0,0,.35), #000 55%, transparent 100%); }
.login-shell .ip-backdrop { inset: 12% -4%; }
.login-card {
    position: relative; z-index: 1; width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--rule);
    border-radius: 8px; padding: 34px 32px;
    /* a pane of glass lit from above: the 1 px highlight lip and one soft shadow, never a hard offset */
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07), 0 24px 64px -16px rgba(0, 0, 0, .55), 0 2px 8px rgba(0, 0, 0, .25);
}
:root[data-theme="ip-light"] .login-card, :root[data-theme="canvas"] .login-card, :root[data-theme="paper"] .login-card,
:root[data-theme="solar"] .login-card, :root[data-theme="dawn"] .login-card {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7), 0 24px 64px -16px rgba(20, 16, 10, .22), 0 2px 8px rgba(20, 16, 10, .08);
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.login-brand .brand-emblem-svg { width: 28px; height: 28px; }
.login-wordmark { height: 22px; width: auto; color: var(--ink); }
.login-card .sub { color: var(--text-mute); font-size: var(--fs-sm); margin-bottom: 26px; }
.login-card h1 { font-family: var(--serif); font-size: var(--fs-4xl); margin: 0 0 8px; color: var(--ink); font-weight: var(--fw-semibold); letter-spacing: var(--track-tight); }
.login-card p.lead { color: var(--text-dim); font-size: var(--fs-base); margin: 0 0 24px; line-height: var(--leading-ui); }
.g-btn { width: 100%; justify-content: center; }
.login-foot { margin-top: 24px; font-size: var(--fs-xs); color: var(--text-mute); }
.login-foot a { color: var(--text-mute); }
.login-foot a:hover { color: var(--accent); }

/* --------------------------------------------------------------------------
   8. Utilities used by the admin templates
   -------------------------------------------------------------------------- */

.ta-right { text-align: right; }
.ta-left { text-align: left; }
.nowrap { white-space: nowrap; }
.w-full { width: 100%; }
.w-full-max { width: 100%; max-width: 640px; }
.max-w-520 { max-width: 520px; }
.max-w-420 { max-width: 420px; }
.max-w-400 { max-width: 400px; }
.max-w-380 { max-width: 380px; }
.max-w-340 { max-width: 340px; }
.mt-xs { margin-top: 4px; }
.mt-sm { margin-top: 6px; }
.mt-md { margin-top: 18px; }
.mt-lg { margin-top: 20px; }
.mt-hint { margin: 12px 0 0; }
.mt-hint-md { margin: 16px 0 0; }
.mt-hint-lg { margin: 18px 0 0; font-size: var(--fs-xs); }
.mb-sm { margin-bottom: 16px; }
.mb-md { margin-bottom: 20px; }
.mb-lg { margin-bottom: 24px; }
.mb-xl { margin-bottom: 40px; display: flex; gap: 10px; flex-wrap: wrap; }
.pad-empty { padding: 36px 24px; }
.pad-empty-sm { padding: 32px 24px; }
.pad-empty-lg { padding: 40px 24px; }
.fs-xs { font-size: var(--fs-xs); }
.fs-sm { font-size: 12.5px; }
.color-ink { color: var(--ink); }
.color-mute { color: var(--text-mute); }
.color-dim { color: var(--text-dim); }
.color-ok { color: var(--ok); }
.color-danger { color: var(--danger); }
.gap-inline { margin-left: 6px; }
.gap-inline-r { margin-right: 6px; }
.btn-sm-pad { font-size: var(--fs-sm); padding: 6px 12px; }
.btn-tall { padding-top: 10px; padding-bottom: 10px; }
.admin-main .empty { padding: 28px 24px; }
.admin-main .empty a { font-weight: var(--fw-medium); }

/* --------------------------------------------------------------------------
   9. Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1080px) {
    .shell { grid-template-columns: minmax(0, 1fr); }
    .side {
        position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); z-index: 60; height: 100dvh;
        transform: translateX(-102%); transition: transform 260ms cubic-bezier(.16, 1, .3, 1); box-shadow: var(--shadow-lg);
        background: var(--surface);
    }
    .shell.is-drawer-open .side { transform: none; }
    .side-close { display: block; }
    .side-scrim { display: block; position: fixed; inset: 0; z-index: 55; background: color-mix(in srgb, var(--ink) 30%, transparent); }
    .side-scrim[hidden] { display: none; }
    .side-link.is-active::before { left: -14px; }
    .topbar {
        display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 40; min-height: 54px; padding: 0 16px;
        background: color-mix(in srgb, var(--paper) 86%, transparent); backdrop-filter: saturate(160%) blur(14px);
        -webkit-backdrop-filter: saturate(160%) blur(14px); border-bottom: 1px solid var(--rule);
    }
    .topbar-menu { display: grid; place-items: center; width: 40px; height: 40px; margin-left: -8px; border: 0; background: none; color: var(--ink); border-radius: 10px; cursor: pointer; }
    .topbar-menu:hover { background: var(--surface-2); }
    .topbar-brand { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); }
    .topbar-run { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; font-family: var(--meta); font-size: var(--fs-xs); color: var(--text-dim); text-decoration: none; }
    .admin-main { padding-top: 24px; }
}
@media (max-width: 720px) {
    .admin-head { grid-template-columns: minmax(0, 1fr); }
    .admin-head .admin-head-actions { grid-column: 1; grid-row: auto; margin-top: 10px; }
    .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .form-fixed, .form-fixed-sm, .form-fixed-md, .form-fixed-date { flex: 1 1 140px; }
    .run-actions { width: 100%; }
    .seg a { min-height: 40px; display: inline-flex; align-items: center; }
}

/* Recent runs: the brief needs room to read, the result column even more. */
table.grid td.max-w-380 { min-width: 260px; }
table.grid td.max-w-400, table.grid td.max-w-420 { min-width: 280px; }

/* --------------------------------------------------------------------------
   10. Instruments — KPI tiles, sparklines, rings, the library pulse
   -------------------------------------------------------------------------- */

.panel { border-radius: 16px; }
.panel-head { align-items: center; }
.panel-head > div { min-width: 0; flex: 1 1 320px; }
.panel > h2::before, .panel-head h2::before, .log-head h2::before { border-color: var(--ip-mark); }

.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin: 0 0 18px; }
.kpi {
    position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto 1fr; gap: 2px 10px;
    padding: 16px 16px 14px; min-height: 128px; border-radius: 16px; overflow: hidden;
    background: var(--surface); border: 1px solid var(--rule); box-shadow: var(--shadow-sm);
    color: inherit; text-decoration: none; transition: border-color var(--ease), transform var(--ease-out), box-shadow var(--ease-out);
}
a.kpi:hover { text-decoration: none; color: inherit; border-color: var(--rule-2); transform: translateY(-2px); box-shadow: var(--shadow); }
.kpi-k { grid-column: 1 / -1; font-family: var(--meta); font-size: var(--fs-label); letter-spacing: var(--track-label); text-transform: uppercase; color: var(--text-mute); }
.kpi-v { font-size: clamp(1.6rem, 2.4vw, 2.1rem); font-weight: 650; letter-spacing: -0.03em; color: var(--ink); font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi-sub { grid-column: 1; font-size: var(--fs-xs); color: var(--text-mute); align-self: start; }
.kpi .spark { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 42px; }
.kpi .ring { grid-column: 2; grid-row: 2 / span 2; align-self: center; }
.kpi.is-warn .kpi-v { color: var(--amber); }
.kpi-sub.is-warn { color: var(--amber); }
/* The sparkline rides the card's bottom edge; leave it room so a wrapped caption never runs into it. */
.kpi:has(.spark) { padding-bottom: 50px; }
.sched-when { white-space: nowrap; }
.sched-when .is-overdue { color: var(--amber); font-weight: var(--fw-semibold); }

.spark-area { fill: color-mix(in srgb, var(--accent) 10%, transparent); stroke: none; }
.spark-line { fill: none; stroke: var(--accent); stroke-width: 1.6; vector-effect: non-scaling-stroke; stroke-linecap: round;
    stroke-dasharray: 1; stroke-dashoffset: 1; animation: spark-draw 1.4s cubic-bezier(.16, 1, .3, 1) .15s forwards; }
.spark-dot { fill: var(--accent); opacity: 0; animation: fade-in .3s ease 1.3s forwards; }
@keyframes spark-draw { to { stroke-dashoffset: 0; } }
@keyframes fade-in { to { opacity: 1; } }

.ring { overflow: visible; }
.ring-track { fill: none; stroke: color-mix(in srgb, var(--ink) 9%, transparent); stroke-width: 4; }
.ring-value { fill: none; stroke: var(--accent); stroke-width: 4; stroke-linecap: round; transform: rotate(-90deg); transform-origin: 22px 22px;
    animation: ring-in 1.1s cubic-bezier(.16, 1, .3, 1) both; }
.ring text { font-family: var(--meta); font-size: 11px; fill: var(--ink); font-weight: 600; }
@keyframes ring-in { from { stroke-dashoffset: var(--ring-c); } }

.pulse-panel { padding-bottom: 14px; }
.pulse-legend { display: flex; gap: 22px; margin: 0; }
.pulse-legend div { display: flex; flex-direction: column; gap: 2px; }
.pulse-legend dt { font-family: var(--meta); font-size: var(--fs-micro); letter-spacing: var(--track-micro); text-transform: uppercase; color: var(--text-mute); display: flex; align-items: center; gap: 6px; }
.pulse-legend dd { margin: 0; font-size: var(--fs-xl); font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
/* The front page's reading sits on paper; here it sits on a panel, so the empty days need a touch more ink to show. */
.pulse-panel .signal { margin-top: 4px; }
.pulse-panel .sig-empty { fill: color-mix(in srgb, var(--ink) 8%, var(--surface)); }
.pulse-panel .sig-before { fill: color-mix(in srgb, var(--ink) 4.5%, var(--surface)); }

/* --------------------------------------------------------------------------
   11. Dashboard
   -------------------------------------------------------------------------- */

.dash-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.dash-grid-b { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
.dash-grid > .panel { margin-bottom: 18px; }

.model-chip {
    display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; flex: none;
    font-family: var(--mono); font-size: var(--fs-xs); color: var(--text-dim); background: var(--surface-2); border: 1px solid var(--rule);
}
.model-chip .ico { width: 14px; height: 14px; color: var(--accent); }
.prompt-well { position: relative; margin: 6px 0 14px; }
.prompt-well .textarea-prompt {
    width: 100%; min-height: 118px; font-size: var(--fs-lg); line-height: 1.55; padding: 14px 16px 30px; border-radius: 12px;
    background: var(--paper); border: 1px solid var(--rule); resize: vertical;
}
.prompt-well .textarea-prompt:focus { border-color: color-mix(in srgb, var(--ip-mark) 50%, var(--rule)); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ip-mark) 12%, transparent); outline: none; }
.prompt-count { position: absolute; right: 12px; bottom: 10px; font-family: var(--meta); font-size: var(--fs-micro); color: var(--text-mute); letter-spacing: .06em; pointer-events: none; }

.att-list { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.att-group ul { list-style: none; margin: 8px 0 0; padding: 0 0 0 26px; display: flex; flex-direction: column; gap: 6px; }
.att-group li { display: flex; justify-content: space-between; gap: 12px; font-size: var(--fs-sm); }
.att-group li a { color: var(--text); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-group li a:hover { color: var(--accent); }
.att-k { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--ink); font-size: var(--fs-base); text-decoration: none; }
.att-k .ico { color: var(--amber); flex: none; }
.att-k.is-err .ico, .att-k.is-err { color: var(--danger); }
.att-k:hover { color: var(--accent); text-decoration: none; }
.att-when { flex: none; font-family: var(--meta); font-size: var(--fs-micro); color: var(--text-mute); }
.att-note { margin: 4px 0 0 26px; font-size: var(--fs-xs); color: var(--text-mute); line-height: 1.45; }
.att-clear { display: flex; align-items: center; gap: 8px; color: var(--ok); font-size: var(--fs-sm); }

.run-list { list-style: none; margin: 4px 0 0; padding: 0; }
.run-item { position: relative; display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 4px 12px; padding: 12px 0 14px; border-top: 1px solid var(--hair, var(--rule)); }
.run-item:first-child { border-top: 0; }
.run-id { font-family: var(--mono); font-size: var(--fs-xs); color: var(--text-mute); padding-top: 2px; text-decoration: none; }
.run-id:hover { color: var(--accent); }
.run-brief { color: var(--ink); font-weight: 500; font-size: var(--fs-base); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-decoration: none; }
.run-brief:hover { color: var(--accent); text-decoration: none; }
.run-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 5px; font-family: var(--meta); font-size: var(--fs-micro); color: var(--text-mute); }
.run-result { margin-top: 6px; font-size: var(--fs-sm); color: var(--text-dim); }
.run-result a { color: var(--text); }
.run-bar-meter { position: absolute; left: 64px; right: 0; bottom: 0; height: 2px; background: linear-gradient(90deg, var(--accent) var(--p), transparent var(--p)); opacity: .0; }
.run-item.is-run .run-bar-meter { opacity: .9; }
.run-item.is-run .run-id { color: var(--accent); }

.feed { list-style: none; margin: 0; padding: 0; position: relative; }
.feed::before { content: ""; position: absolute; left: 5px; top: 10px; bottom: 10px; width: 1px; background: var(--rule); }
.feed-item { position: relative; display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; gap: 12px; padding: 7px 0; align-items: baseline; }
.feed-item[hidden] { display: none; }
.feed-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--surface); border: 2px solid var(--text-mute); position: relative; top: 1px; }
.feed-item.is-ok .feed-dot { border-color: var(--ok); }
.feed-item.is-danger .feed-dot { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 20%, var(--surface)); }
.feed-item.is-warn .feed-dot { border-color: var(--amber); }
.feed-item.is-accent .feed-dot { border-color: var(--ip-mark); }
.feed-title { color: var(--ink); font-weight: 500; font-size: var(--fs-sm); margin-right: 6px; }
.feed-title.is-gone { color: var(--text-mute); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--danger) 60%, transparent); }
.feed-what { color: var(--text-dim); font-size: var(--fs-sm); }
.feed-item time { font-family: var(--meta); font-size: var(--fs-micro); color: var(--text-mute); white-space: nowrap; }
.changes-day { font-family: var(--meta); font-size: var(--fs-label); letter-spacing: var(--track-label); text-transform: uppercase; color: var(--text-mute); margin: 22px 0 6px; font-weight: 500; }
.changes-day:first-child { margin-top: 6px; }
.feed-filter { flex: 0 1 260px; border-radius: 999px; }

/* --------------------------------------------------------------------------
   12. Documents manager
   -------------------------------------------------------------------------- */

.view-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 16px; }
.view-tab {
    display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px 7px 14px; border-radius: 999px;
    color: var(--text-dim); text-decoration: none; font-size: var(--fs-sm); font-weight: 500;
    background: var(--surface); border: 1px solid var(--rule); transition: border-color var(--ease), color var(--ease);
}
.view-tab:hover { color: var(--ink); border-color: var(--rule-2); text-decoration: none; }
.view-tab.is-active { color: var(--ink); border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.view-n { font-family: var(--meta); font-size: var(--fs-micro); color: var(--text-mute); background: var(--surface-2); padding: 1px 7px; border-radius: 999px; font-variant-numeric: tabular-nums; }
.view-tab.is-drafts .view-n, .view-tab.is-attention .view-n { color: var(--amber); background: var(--amber-bg); }
.view-tab.is-trash .view-n { color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, var(--surface)); }

.doc-panel { padding-top: 16px; }
.doc-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.doc-search { position: relative; flex: 1 1 280px; max-width: 460px; display: flex; align-items: center; }
.doc-search .ico { position: absolute; left: 12px; color: var(--text-mute); pointer-events: none; }
.doc-search input { width: 100%; padding-left: 38px; padding-right: 36px; border-radius: 999px; }
.doc-search kbd { position: absolute; right: 10px; font-family: var(--mono); font-size: var(--fs-micro); color: var(--text-mute); border: 1px solid var(--rule); border-radius: 5px; padding: 0 5px; }
.doc-tools select { width: auto; min-width: 0; border-radius: 999px; padding-right: 30px; }

.bulk-bar {
    position: sticky; top: 10px; z-index: 5; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 0 0 12px;
    padding: 8px 10px 8px 16px; border-radius: 14px; background: var(--ink); color: var(--paper); box-shadow: var(--shadow-lg);
    animation: bulk-in .22s cubic-bezier(.16, 1, .3, 1);
}
.bulk-bar[hidden] { display: none; }
.bulk-bar .bulk-selection { color: inherit; opacity: .85; margin-right: 6px; }
.bulk-bar .btn { background: color-mix(in srgb, var(--paper) 14%, transparent); color: var(--paper); border-color: transparent; }
.bulk-bar .btn:hover { background: color-mix(in srgb, var(--paper) 24%, transparent); }
.bulk-bar .btn.danger-text { color: #ff8a7a; }
.bulk-bar .row-action { color: color-mix(in srgb, var(--paper) 70%, transparent); margin-left: auto; }
@keyframes bulk-in { from { opacity: 0; transform: translateY(-6px); } }

.doc-table td { vertical-align: middle; padding-top: 12px; padding-bottom: 12px; }
.doc-table tbody tr[hidden] { display: none; }
.doc-cell { min-width: 300px; }
.doc-name { font-size: var(--fs-md); font-weight: 600 !important; color: var(--ink) !important; line-height: 1.35; }
.doc-name:hover { color: var(--accent) !important; }
.doc-sub { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; margin-top: 4px; }
.doc-sub .tag { font-size: var(--fs-micro); padding: 0 7px; }
.pin-pill { margin-left: 6px; color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, var(--rule)); vertical-align: 2px; }
.ico-xs { width: 12px; height: 12px; }
.flag { display: inline-flex; align-items: center; gap: 5px; margin: 6px 6px 0 0; font-size: var(--fs-xs); color: var(--text-dim); }
.flag.is-warn { color: var(--amber); }
.topic-cell { font-size: var(--fs-sm); color: var(--text-dim); white-space: nowrap; }
.state-cell { white-space: nowrap; }
.state { display: flex; align-items: center; gap: 7px; font-size: var(--fs-sm); color: var(--text); }
.state + .state { margin-top: 4px; }
.state-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.state.is-live .state-dot { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 18%, transparent); }
.state.is-draft { color: var(--amber); }
.state.is-draft .state-dot { background: transparent; border: 2px dashed var(--amber); width: 9px; height: 9px; }
.state.is-locked { color: var(--text-dim); font-size: var(--fs-xs); }
.change-cell { min-width: 170px; }
.change-what { display: block; font-size: var(--fs-sm); color: var(--text); line-height: 1.35; }
.change-what.is-danger { color: var(--danger); }
.change-what.is-ok { color: var(--ok); }
.change-what.is-warn { color: var(--amber); }
.change-what.is-mute { color: var(--text-mute); }
.change-cell time { font-family: var(--meta); font-size: var(--fs-micro); color: var(--text-mute); }
.act-cell { display: flex; align-items: center; justify-content: flex-end; gap: 2px; }
.act-cell .inline-form { margin-left: 6px; }
.icon-btn {
    display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; color: var(--text-mute);
    background: none; border: 0; cursor: pointer; text-decoration: none; font-size: 18px; line-height: 1; list-style: none;
}
.icon-btn::-webkit-details-marker { display: none; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.row-menu { position: relative; }
.row-menu[open] > .icon-btn { background: var(--surface-2); color: var(--ink); }
.row-menu-panel {
    position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 220px; padding: 6px; margin: 0;
    background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; box-shadow: var(--shadow-lg);
    display: flex; flex-direction: column; text-align: left;
}
.row-menu-panel button {
    display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: none;
    font: inherit; font-size: var(--fs-sm); color: var(--text); cursor: pointer; text-align: left;
}
.row-menu-panel button:hover { background: var(--surface-2); color: var(--ink); }
.row-menu-panel button.is-danger { color: var(--danger); }
.row-menu-panel .ico { width: 16px; height: 16px; opacity: .8; }
.danger-text { color: var(--danger) !important; }

.trash-list { list-style: none; margin: 4px 0 0; padding: 0; }
.trash-item { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--rule); }
.trash-item:first-child { border-top: 0; }
.trash-glyph { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--surface-2); color: var(--text-mute); }
.trash-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.trash-main strong { color: var(--ink); font-weight: 600; }
.trash-left { font-family: var(--meta); font-size: var(--fs-micro); color: var(--text-mute); white-space: nowrap; }
.trash-item .inline-form { display: inline-flex; align-items: center; gap: 4px; }
.trash-item .btn .ico { width: 15px; height: 15px; }

@media (max-width: 1280px) {
    .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1080px) {
    .dash-grid, .dash-grid-b { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
    .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .kpi { min-height: 116px; }
    .doc-table thead { display: none; }
    .doc-table, .doc-table tbody, .doc-table tr, .doc-table td { display: block; }
    .doc-table tr { position: relative; padding: 12px 0 12px 34px; border-bottom: 1px solid var(--rule); }
    .doc-table td { border: 0; padding: 2px 0; }
    .doc-table .select-cell { position: absolute; left: 0; top: 14px; }
    .doc-cell { min-width: 0; }
    .act-cell { justify-content: flex-start; margin-top: 6px; }
    .trash-item { grid-template-columns: 36px minmax(0, 1fr); }
    .trash-item .inline-form, .trash-left { grid-column: 2; }
    .pulse-legend { gap: 14px; }
}
@media (prefers-reduced-motion: reduce) {
    .spark-line, .spark-dot, .ring-value, .bulk-bar { animation: none !important; stroke-dashoffset: 0; opacity: 1; }
    .side-pulse-trace, .live-dot { animation: none !important; }
}

.doc-cell { width: 46%; }
.doc-sub { flex-wrap: nowrap; gap: 8px; min-width: 0; }
.doc-slug { min-width: 0; max-width: 46ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-sub .mono { flex: none; }
.doc-sub .doc-slug { flex: 0 1 auto; }
.doc-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.doc-tags:empty { display: none; }
.doc-tags .tag { font-size: var(--fs-micro); padding: 1px 7px; line-height: 1.4; }
.doc-table td.ta-right { width: 1%; }
@media (max-width: 720px) { .doc-cell { width: auto; } .doc-slug { max-width: 60vw; } }
.doc-cell { width: auto; min-width: 260px; }
.doc-name { font-size: var(--fs-base); }
.topic-cell { white-space: normal; max-width: 150px; }
.change-cell { min-width: 130px; max-width: 200px; }
.doc-table td, .doc-table th { padding-right: 14px; }
.act-cell .btn-sm { padding: 4px 10px; font-size: var(--fs-xs); }
.icon-btn { width: 30px; height: 30px; }
.doc-slug { max-width: 38ch; }

/* --------------------------------------------------------------------------
   13. Run page — status strip and the transcript terminal
   The terminal stays ink in every theme: it depicts a screen.
   -------------------------------------------------------------------------- */

.run-title { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; max-width: 60ch; }
.mono-sub { font-family: var(--mono); font-size: var(--fs-xs) !important; color: var(--text-mute) !important; }

.run-strip {
    display: grid; grid-template-columns: auto minmax(160px, 1.4fr) repeat(4, minmax(0, 1fr)); gap: 1px; margin: 0 0 18px;
    background: var(--rule); border: 1px solid var(--rule); border-radius: 14px; overflow: hidden;
}
.rs-cell { background: var(--surface); padding: 12px 16px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.rs-k { font-family: var(--meta); font-size: var(--fs-micro); letter-spacing: var(--track-micro); text-transform: uppercase; color: var(--text-mute); }
.rs-v { font-size: var(--fs-xl); font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rs-of { color: var(--text-mute); font-weight: 400; }
.rs-meter { display: block; height: 3px; border-radius: 2px; background: var(--surface-2); overflow: hidden; }
.rs-meter span { display: block; height: 100%; background: var(--accent); transition: width .6s cubic-bezier(.16, 1, .3, 1); }

.term {
    color-scheme: dark;
    /* A terminal depicts a screen, so it stays on the brand's carbon ink whatever the theme (themes.md). */
    --t-bg: #0b0d10; --t-bg2: #111317; --t-line: #1f2329; --t-fg: #e3e6e9; --t-fg2: #b9bdc3; --t-fg3: #8f949b;
    --t-ember: #f43a2a; --t-cyan: #52e3ff; --t-ok: #7dffb0; --t-warn: #ffb347; --t-err: #ff6b5e; --t-violet: #b38cff;
    background: var(--t-bg); color: var(--t-fg); border-radius: 16px; overflow: hidden;
    border: 1px solid #1f2329; box-shadow: 0 1px 0 rgba(255,255,255,.04) inset, var(--shadow-lg);
    font-family: var(--mono); font-size: 12.5px; line-height: 1.6;
}
.term-bar {
    display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--t-bg2); border-bottom: 1px solid var(--t-line);
    color: var(--t-fg3); font-size: 11.5px;
}
.term-dots { display: inline-flex; gap: 6px; }
.term-dots i { width: 10px; height: 10px; border-radius: 50%; background: #253044; display: block; }
.term-dots i:first-child { background: var(--t-ember); opacity: .8; }
.term-title { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--t-fg2); }
.term-tools { display: inline-flex; align-items: center; gap: 14px; flex: none; }
.term-toggle { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; color: var(--t-fg3); }
.term-toggle input { accent-color: var(--t-ember); margin: 0; }
.term-body { height: min(68vh, 760px); overflow-y: auto; padding: 14px 18px 18px; scrollbar-width: thin; scrollbar-color: #253044 transparent; }
.term-empty { color: var(--t-fg3); padding: 8px 0; }

.blk { margin: 0 0 10px; animation: blk-in .25s ease both; }
@keyframes blk-in { from { opacity: 0; transform: translateY(3px); } }
.blk .bul { display: inline-block; width: 18px; flex: none; }
.ln { display: flex; align-items: baseline; gap: 0; min-width: 0; }
.call .bul { color: var(--t-ember); }
.call.is-ok .bul { color: var(--t-ok); }
.call.is-err .bul { color: var(--t-err); }
.tname { color: var(--t-fg); font-weight: 600; flex: none; }
.targ { color: var(--t-fg2); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 0 1 auto; }
.ts { margin-left: auto; padding-left: 14px; color: #4f5d75; font-size: 11px; flex: none; }
.res { display: flex; flex-wrap: wrap; align-items: baseline; padding-left: 18px; color: var(--t-fg2); }
.res .gut { width: 26px; flex: none; color: #4f5d75; padding-left: 2px; }
.res .rtext { min-width: 0; flex: 1 1 0; overflow-wrap: anywhere; }
.res.is-pending .rtext { color: var(--t-fg3); font-style: italic; }
.res.is-err .rtext { color: var(--t-err); }
.kvs { display: none; flex-wrap: wrap; gap: 2px 14px; flex-basis: 100%; padding: 2px 0 0 26px; color: var(--t-fg3); font-size: 11.5px; }
.kvs.args { padding-left: 18px; }
.is-verbose .kvs { display: flex; }
.kv .k { color: #5c6b85; }
.kv .k::after { content: "="; color: #3b4659; margin: 0 2px; }
.kv .v { color: var(--t-fg2); }
.kv.is-err .v { color: var(--t-err); }
.kv.is-warn .v { color: var(--t-warn); }
.kv.is-ok .v { color: var(--t-ok); }

.think { color: var(--t-fg3); }
.think summary { list-style: none; cursor: pointer; display: flex; align-items: baseline; gap: 0; min-width: 0; }
.think summary::-webkit-details-marker { display: none; }
.think .bul { color: var(--t-violet); }
.think .tlabel { color: var(--t-violet); font-style: italic; margin-right: 10px; flex: none; }
.think .tfirst { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-style: italic; }
.think[open] .tfirst { display: none; }
.think .tbody { white-space: pre-wrap; padding: 4px 0 2px 18px; border-left: 1px solid #253044; margin: 4px 0 0 6px; font-style: italic; color: var(--t-fg2); }
.say { display: flex; color: var(--t-fg); }
.say .bul { color: var(--t-fg); }
.say .stext { white-space: pre-wrap; min-width: 0; }
.note { display: flex; color: var(--t-fg3); }
.note .bul { color: #4f5d75; }
.note.is-warn, .note.is-warn .bul { color: var(--t-warn); }
.done { display: flex; color: var(--t-ok); font-weight: 600; }
.step { display: flex; align-items: center; gap: 10px; color: #4f5d75; font-size: 11px; margin: 12px 0; }
.step .srule { flex: 1 1 0; height: 1px; background: var(--t-line); }
.step .stxt { flex: none; }

.term-live {
    display: flex; align-items: baseline; gap: 8px; padding: 10px 18px; border-top: 1px solid var(--t-line);
    background: linear-gradient(90deg, rgba(242,61,38,.08), transparent 60%); color: var(--t-fg);
}
.term-live[hidden] { display: none; }

@media (max-width: 900px) {
    .run-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .rs-status { grid-column: span 1; }
    .term-body { height: 64vh; padding: 12px; }
    .term { font-size: 12px; }
    .ts { display: none; }
}
@media (prefers-reduced-motion: reduce) { .blk { animation: none; } }
.run-title { font-size: clamp(1.2rem, 1.9vw, 1.55rem) !important; letter-spacing: -0.02em; line-height: 1.25; }

/* --------------------------------------------------------------------------
   14. Settings
   -------------------------------------------------------------------------- */

.settings-layout { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 28px; align-items: start; }
.settings-nav { position: sticky; top: 24px; display: flex; flex-direction: column; gap: 2px; border-left: 1px solid var(--rule); }
.settings-nav a { padding: 6px 14px; margin-left: -1px; border-left: 2px solid transparent; color: var(--text-dim); font-size: var(--fs-sm); text-decoration: none; }
.settings-nav a:hover { color: var(--ink); border-left-color: var(--ip-mark); text-decoration: none; }
.settings-main { min-width: 0; }
.settings-main .panel { scroll-margin-top: 20px; }
.settings-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 24px; margin-top: 8px; }
.settings-fields .stack-field { margin: 0; }
.settings-fields .span-2 { grid-column: 1 / -1; }
.settings-save { position: sticky; bottom: 14px; display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-radius: 14px;
    background: color-mix(in srgb, var(--surface) 90%, transparent); backdrop-filter: blur(10px); border: 1px solid var(--rule); box-shadow: var(--shadow-lg); }
.settings-save .hint { margin: 0; }

.key-state { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 12px; background: var(--paper); border: 1px solid var(--rule); margin: 8px 0 14px; }
.key-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; flex: none; background: var(--surface-2); color: var(--text-mute); }
.key-state.is-ok .key-icon { background: color-mix(in srgb, var(--ok) 14%, var(--surface)); color: var(--ok); }
.key-state.is-bad .key-icon, .key-state.is-missing .key-icon { background: var(--amber-bg); color: var(--amber); }
.key-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 auto; }
.key-text strong { color: var(--ink); }
.key-text span { font-size: var(--fs-xs); color: var(--text-mute); overflow-wrap: anywhere; }
.mono-key { font-family: var(--mono); font-size: var(--fs-sm); letter-spacing: .02em; }
.key-form { display: flex; align-items: flex-end; gap: 10px; }
.key-input { flex: 1 1 auto; }
.key-input input { font-family: var(--mono); }

.svc-list { list-style: none; margin: 6px 0 0; padding: 0; }
.svc { display: grid; grid-template-columns: 14px 150px minmax(0, 220px) minmax(0, 1fr); gap: 12px; align-items: start; padding: 10px 0; border-top: 1px solid var(--rule); font-size: var(--fs-sm); }
.svc:first-child { border-top: 0; }
.svc-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--danger); margin-top: 6px; }
.svc.is-ok .svc-dot { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 18%, transparent); }
.svc-name { font-weight: 600; color: var(--ink); }
.svc-ep { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.svc-detail { color: var(--text-dim); overflow-wrap: anywhere; }
.svc.is-bad .svc-detail { color: var(--danger); }

@media (max-width: 1080px) {
    .settings-layout { grid-template-columns: minmax(0, 1fr); }
    .settings-nav { display: none; }
}
@media (max-width: 720px) {
    .settings-fields { grid-template-columns: minmax(0, 1fr); }
    .svc { grid-template-columns: 14px minmax(0, 1fr); }
    .svc-ep, .svc-detail { grid-column: 2; }
    .key-form { flex-direction: column; align-items: stretch; }
}
@media (max-width: 720px) {
    .view-tabs { flex-wrap: nowrap; overflow-x: auto; margin-left: -18px; margin-right: -18px; padding: 0 18px 4px; scrollbar-width: none; }
    .view-tab { flex: none; }
    .doc-tools select { flex: 1 1 40%; }
    .doc-table td { border-bottom: 0 !important; background: none !important; }
    .doc-table .topic-cell, .doc-table .state-cell, .doc-table .change-cell { display: inline-block; max-width: none; min-width: 0; margin-right: 12px; font-size: var(--fs-xs); }
    .doc-table .state { display: inline-flex; }
    .doc-table .state + .state { margin: 0 0 0 10px; }
    .doc-table .change-what { display: inline; }
    .doc-table td.ta-right { width: auto; }
    .table-wrap { margin: 0; padding: 0; }
}
.mt-0 { margin-top: 0; }

/* ==========================================================================
   Confirm dialog (innerpulse-brand components.md, "dialog", 2026-11-18): surface and a hairline; opened as a modal
   it floats, so it takes a 1 px highlight lip along its top edge and one soft shadow over the ink backdrop at 60 %.
   The question is the title, in the headline face at 20 px; the one filled button answers it, at the right end.
   ========================================================================== */
.ip-dialog { padding: 0; border: 0; background: transparent; max-width: min(460px, calc(100vw - 32px)); color: var(--text); }
.ip-dialog::backdrop { background: rgba(5, 7, 11, .6); }
.ip-dialog[open] { animation: ip-dialog-in 160ms cubic-bezier(.16, 1, .3, 1); }
@keyframes ip-dialog-in { from { opacity: 0; transform: translateY(6px) scale(.985); } }
.ip-dialog-panel {
    display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 22px 22px 18px;
    background: var(--surface); border: 1px solid var(--rule-2); border-radius: 8px;
    --ip-lip: rgba(255, 255, 255, .07); --ip-shade: rgba(0, 0, 0, .55); --ip-shade-2: rgba(0, 0, 0, .25);
    box-shadow: inset 0 1px 0 var(--ip-lip), 0 24px 64px -16px var(--ip-shade), 0 2px 8px var(--ip-shade-2);
}
:root[data-theme="ip-light"] .ip-dialog-panel, :root[data-theme="canvas"] .ip-dialog-panel, :root[data-theme="paper"] .ip-dialog-panel,
:root[data-theme="solar"] .ip-dialog-panel, :root[data-theme="dawn"] .ip-dialog-panel {
    --ip-lip: rgba(255, 255, 255, .7); --ip-shade: rgba(20, 16, 10, .22); --ip-shade-2: rgba(20, 16, 10, .08);
}
.ip-dialog-panel > .cap { font: 500 11px/1.2 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--text-mute); }
.ip-dialog-panel h2 { margin: 0; font: 700 20px/1.3 var(--sans); letter-spacing: -.02em; color: var(--ink); text-wrap: pretty; }
.ip-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
@media (prefers-reduced-motion: reduce) { .ip-dialog[open] { animation: none; } }

/* ==========================================================================
   Phones and keyboards (polish, 2026-11-18)
   ========================================================================== */
@media (max-width: 1080px) {
    /* The closed drawer is off screen and out of the tab order; it stays visible until it has slid away. */
    .side { visibility: hidden; transition: transform 260ms cubic-bezier(.16, 1, .3, 1), visibility 0s 260ms; }
    .shell.is-drawer-open .side { visibility: visible; transition-delay: 0s; }
}
@media (max-width: 720px) {
    .hide-sm { display: none; }
    table.grid td.max-w-400, table.grid td.max-w-420 { min-width: 0; }
    .input-order { width: 56px; }
    /* Row actions sit beside destructive ones: give each a finger-sized target. */
    .row-action { min-height: 36px; padding: 8px 12px; display: inline-flex; align-items: center; }
}
@media (prefers-reduced-motion: reduce) { .side { transition: none; } }
