:root {
    color-scheme: dark;
    --bg: #111318;
    --surface: #181b21;
    --surface-2: #1f232b;
    --surface-3: #272c35;
    --border: #343a45;
    --border-soft: #292e37;
    --text: #f4f4f5;
    --muted: #9ca3af;
    --muted-2: #6b7280;
    --blue: #3b82f6;
    --cyan: #22b8cf;
    --green: #22c55e;
    --amber: #f59e0b;
    --red: #ef4444;
    --violet: #8b5cf6;
    --task-accent: var(--blue);
    --task-rgb: 59, 130, 246;
    --shadow: 0 18px 50px rgba(0, 0, 0, .24);
    --header-height: 64px;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
    font-size: 14px;
    letter-spacing: 0;
    overflow-x: hidden;
}
body[data-task="render"][data-space="interior"] { --task-accent: var(--cyan); --task-rgb: 34, 184, 207; }
body[data-task="restoration"] { --task-accent: var(--amber); --task-rgb: 245, 158, 11; }
body[data-task="blackframe"] { --task-accent: var(--violet); --task-rgb: 139, 92, 246; }
button, input, textarea, select { font: inherit; letter-spacing: 0; }
button, a, select, summary { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible {
    outline: 2px solid var(--task-accent);
    outline-offset: 2px;
}
button:disabled { cursor: wait; opacity: .55; }
[hidden] { display: none !important; }
svg { width: 18px; height: 18px; stroke-width: 1.8; flex: 0 0 auto; }

.app-header {
    position: sticky;
    top: 0;
    z-index: 50;
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 0 max(18px, calc((100vw - 1780px) / 2));
    background: rgba(17, 19, 24, .94);
    border-bottom: 1px solid var(--border-soft);
    backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; color: var(--text); text-decoration: none; }
.brand-mark {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 7px;
    background: var(--task-accent);
    color: #fff;
    font-weight: 900;
    box-shadow: 0 0 0 4px rgba(var(--task-rgb), .12);
}
.brand strong, .brand small { display: block; }
.brand strong { font-size: 14px; }
.brand small { margin-top: 1px; color: var(--muted); font-size: 11px; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.header-actions form { margin: 0; display: flex; }
.user-pill {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--muted);
    font-size: 12px;
    padding-right: 5px;
}

.workspace {
    width: min(1780px, calc(100% - 36px));
    margin: 0 auto;
    padding: 18px 0 28px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(460px, 520px);
    align-items: start;
    gap: 18px;
}
.builder-panel { min-width: 0; }
.panel {
    margin: 0 0 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
}
article.panel { padding: 16px 18px; }
.task-panel, .task-context {
    border-color: rgba(var(--task-rgb), .5);
    box-shadow: inset 3px 0 0 var(--task-accent);
}
.task-panel { background: linear-gradient(90deg, rgba(var(--task-rgb), .08), var(--surface) 34%); }
.context-panel { border-color: var(--border); }
.panel-heading, .panel-heading > div, .output-section-head, .dialog-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.panel-heading > div { justify-content: flex-start; }
.panel-heading { margin-bottom: 14px; }
.panel-heading h1, .panel-heading h2, .dialog-head h2 {
    margin: 0;
    font-size: 16px;
    line-height: 1.3;
}
.step-label {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 24px;
    border-radius: 5px;
    background: rgba(var(--task-rgb), .13);
    color: var(--task-accent);
    font-size: 10px;
    font-weight: 800;
}
.selection-summary {
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.option-panel { overflow: clip; }
.option-panel > summary {
    min-height: 48px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
    list-style: none;
    user-select: none;
}
.option-panel > summary::-webkit-details-marker { display: none; }
.option-panel > summary > span:first-child { display: flex; align-items: center; gap: 9px; font-weight: 760; }
.option-panel > summary > span:first-child svg { color: var(--task-accent); }
.option-panel > summary:after {
    content: "";
    width: 7px;
    height: 7px;
    margin-left: 3px;
    border-right: 1.5px solid var(--muted);
    border-bottom: 1.5px solid var(--muted);
    transform: rotate(45deg);
    transition: transform .16s ease;
}
.option-panel[open] > summary:after { transform: rotate(225deg); }
.option-panel[open] > summary { border-bottom: 1px solid var(--border-soft); }
.option-body { padding: 14px 16px 16px; }
.advanced-panel { border-style: dashed; }

.segmented, .chip-grid { display: flex; flex-wrap: wrap; gap: 7px; }
.task-segmented { margin-bottom: 10px; }
.segmented button, .chip {
    min-height: 34px;
    padding: 7px 11px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface-2);
    color: #d4d4d8;
    cursor: pointer;
    font-size: 12px;
    font-weight: 650;
    transition: border-color .14s ease, background .14s ease, color .14s ease, transform .14s ease;
}
.segmented button:hover, .chip:hover { border-color: #596170; background: var(--surface-3); transform: translateY(-1px); }
.segmented button.active, .chip.active {
    border-color: var(--task-accent);
    background: rgba(var(--task-rgb), .16);
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(var(--task-rgb), .18);
}
.task-segmented button { min-height: 40px; padding-inline: 15px; }
.compact button { min-height: 31px; }
.control-group + .control-group { margin-top: 14px; }
.control-group > label, .select-field, .output-section-head label, .app-dialog label {
    display: block;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
}
.control-group > label { margin-bottom: 7px; }
.field-grid { display: grid; gap: 12px; }
.field-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.material-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.select-field select, .select-field input, .preset-tools select {
    width: 100%;
    min-height: 38px;
    margin-top: 6px;
    padding: 7px 30px 7px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface-2);
    color: var(--text);
}
.helper-text { margin: 0 0 12px; color: var(--muted); font-size: 12px; }

.output-panel {
    position: sticky;
    top: calc(var(--header-height) + 18px);
    height: calc(100vh - var(--header-height) - 36px);
    min-height: 650px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    border: 1px solid #3b424e;
    border-radius: 8px;
    background: #171a20;
    box-shadow: var(--shadow);
    overflow: hidden;
}
.output-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 13px; }
.output-toolbar strong { display: block; margin-top: 2px; font-size: 13px; }
.eyebrow { color: var(--task-accent); font-size: 10px; font-weight: 850; text-transform: uppercase; }
.preset-tools { display: flex; align-items: center; gap: 6px; min-width: 0; }
.preset-tools select { width: 150px; margin: 0; min-height: 34px; }
.output-close { display: none; }
.icon-button {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--surface-2);
    color: var(--text);
    text-decoration: none;
    cursor: pointer;
}
.icon-button:hover { border-color: #596170; background: var(--surface-3); }
.icon-button.with-label { width: auto; padding: 0 11px; gap: 7px; font-size: 12px; font-weight: 700; }
.icon-button.danger { color: #f87171; border-color: rgba(239, 68, 68, .35); }
.custom-instruction {
    padding: 12px;
    border: 1px solid var(--border-soft);
    border-radius: 7px;
    background: var(--surface);
}
.output-section-head { margin-bottom: 7px; }
.output-section-head span { color: var(--muted-2); font-size: 10px; }
textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: #0e1014;
    color: #e4e4e7;
    padding: 11px 12px;
    resize: vertical;
    line-height: 1.5;
}
.custom-instruction textarea { min-height: 72px; max-height: 130px; resize: vertical; }
.inline-actions { display: flex; gap: 7px; margin-top: 8px; }
.output-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3px;
    margin-top: 12px;
    padding: 3px;
    border-radius: 7px;
    background: var(--surface);
}
.output-tab {
    min-height: 32px;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 11px;
    font-weight: 750;
}
.output-tab.active { background: var(--surface-3); color: var(--text); }
.output-tab span { display: inline-grid; min-width: 17px; height: 17px; place-items: center; border-radius: 9px; background: rgba(245, 158, 11, .16); color: #fbbf24; font-size: 9px; }
.output-view { display: none; min-height: 0; flex: 1; padding-top: 9px; }
.output-view.active { display: flex; }
.output-view textarea { min-height: 100%; resize: none; font-family: "Cascadia Code", Consolas, monospace; font-size: 12px; }
.output-view[data-output-view="prompt"] textarea { border-color: rgba(34, 197, 94, .48); }
.output-view[data-output-view="negative"] textarea { border-color: rgba(239, 68, 68, .45); color: #fca5a5; }
.warnings-view { flex-direction: column; overflow: auto; }
.warning-item { padding: 10px 11px; margin-bottom: 7px; border-left: 3px solid var(--amber); border-radius: 5px; background: rgba(245, 158, 11, .08); color: #fde68a; font-size: 12px; line-height: 1.45; }
.empty-state { display: grid; place-items: center; min-height: 120px; color: var(--muted); font-size: 12px; text-align: center; }
.prompt-metrics { display: flex; align-items: center; gap: 10px; padding: 9px 2px; color: var(--muted); font-size: 10px; }
.quality-pill { margin-left: auto; padding: 3px 7px; border-radius: 10px; font-weight: 750; }
.quality-pill.optimal { background: rgba(34, 197, 94, .12); color: #86efac; }
.quality-pill.short { background: rgba(59, 130, 246, .12); color: #93c5fd; }
.quality-pill.long { background: rgba(245, 158, 11, .12); color: #fbbf24; }
.primary-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.primary-actions .btn-secondary { grid-column: 1 / -1; }
.utility-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-top: 7px; }

.btn {
    min-height: 36px;
    padding: 8px 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 1px solid transparent;
    border-radius: 7px;
    color: #fff;
    cursor: pointer;
    font-weight: 750;
    text-decoration: none;
}
.btn-primary { background: var(--blue); }
.btn-success { background: #16a34a; }
.btn-danger { background: #dc2626; }
.btn-secondary { background: var(--surface-3); border-color: var(--border); }
.btn-ghost { background: transparent; border-color: var(--border); color: #d4d4d8; }
.btn-ai { background: rgba(139, 92, 246, .16); border-color: rgba(139, 92, 246, .45); color: #ddd6fe; }
.btn-block { width: 100%; }
.btn:hover { filter: brightness(1.08); }
.danger-text { color: #fca5a5; }
.file-button { position: relative; overflow: hidden; }
.file-button input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.mobile-preview-button { display: none; }
.toast-region { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: grid; gap: 8px; width: min(360px, calc(100vw - 36px)); }
.toast {
    min-height: 46px;
    padding: 11px 13px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: #232730;
    box-shadow: var(--shadow);
    color: var(--text);
    animation: toast-in .18s ease both;
}
.toast.success { border-color: rgba(34, 197, 94, .5); }
.toast.error { border-color: rgba(239, 68, 68, .55); }
.toast button { border: 0; background: transparent; color: #93c5fd; cursor: pointer; font-weight: 800; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

.app-tooltip {
    position: fixed;
    z-index: 400;
    width: max-content;
    max-width: min(330px, calc(100vw - 20px));
    padding: 9px 11px;
    border: 1px solid #46505e;
    border-radius: 6px;
    background: #252a33;
    color: #e5e7eb;
    box-shadow: 0 12px 32px rgba(0,0,0,.38);
    font-size: 11px;
    font-weight: 500;
    line-height: 1.48;
    pointer-events: none;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity .12s ease, transform .12s ease;
}
.app-tooltip.visible { opacity: 1; transform: translateY(0); }

.app-dialog {
    width: min(520px, calc(100vw - 30px));
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow);
}
.app-dialog.wide { width: min(760px, calc(100vw - 30px)); }
.app-dialog::backdrop { background: rgba(0, 0, 0, .66); backdrop-filter: blur(3px); }
.dialog-card { padding: 18px; }
.dialog-head { margin-bottom: 16px; }
.dialog-head h2 { margin-top: 3px; }
.dialog-card > label { margin-top: 11px; }
.dialog-card textarea { min-height: 100px; margin-top: 6px; }
.dialog-actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 16px; }
.dialog-actions.horizontal { display: flex; justify-content: flex-end; }
.dialog-warnings { margin-top: 12px; }

.notice { margin-top: 14px; padding: 10px 12px; border-radius: 6px; font-size: 12px; }
.notice.error { background: rgba(239, 68, 68, .1); color: #fca5a5; border: 1px solid rgba(239, 68, 68, .3); }
.notice.success { background: rgba(34, 197, 94, .1); color: #86efac; border: 1px solid rgba(34, 197, 94, .3); }

.auth-page { display: grid; place-items: center; padding: 24px; background: #111318; }
.auth-shell { width: min(920px, 100%); min-width: 0; display: grid; grid-template-columns: minmax(0,1fr) minmax(0,420px); align-items: center; gap: 70px; }
.auth-brand { min-width: 0; display: flex; align-items: center; gap: 18px; }
.auth-brand > div { min-width: 0; }
.auth-brand .brand-mark { width: 54px; height: 54px; font-size: 24px; }
.auth-brand h1 { margin: 0; font-size: 28px; }
.auth-brand p { margin: 6px 0 0; color: var(--muted); }
.auth-card { width: 100%; min-width: 0; max-width: 100%; padding: 24px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.auth-heading { margin-bottom: 18px; }
.auth-heading h2 { margin: 6px 0; font-size: 20px; }
.auth-heading p { margin: 0; color: var(--muted); font-size: 12px; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-bottom: 18px; padding: 4px; background: var(--surface-2); border-radius: 7px; }
.auth-tab { min-height: 36px; border: 0; border-radius: 5px; background: transparent; color: var(--muted); cursor: pointer; font-weight: 750; }
.auth-tab.active { background: var(--surface-3); color: var(--text); }
.auth-form { display: none; }
.auth-form.active, .auth-heading + .auth-form { display: block; }
.auth-form label { display: block; margin-bottom: 13px; color: var(--muted); font-size: 11px; font-weight: 700; }
.auth-form input { width: 100%; min-height: 42px; margin-top: 6px; padding: 9px 11px; border: 1px solid var(--border); border-radius: 6px; background: #0f1116; color: var(--text); }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: #111318; }
::-webkit-scrollbar-thumb { background: #3a404b; border: 2px solid #111318; border-radius: 8px; }

@media (max-width: 1280px) {
    .workspace { grid-template-columns: minmax(0, 1fr) 450px; }
    .material-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1099px) {
    .workspace { grid-template-columns: 1fr; width: min(940px, calc(100% - 28px)); padding-bottom: 90px; }
    .output-panel {
        position: fixed;
        z-index: 120;
        inset: auto 10px 10px;
        top: auto;
        height: min(86dvh, 780px);
        min-height: 0;
        transform: translateY(calc(100% + 24px));
        transition: transform .22s ease;
    }
    .output-drawer-open .output-panel { transform: translateY(0); }
    .output-close { display: inline-flex; }
    .output-drawer-open:before { content: ""; position: fixed; inset: 0; z-index: 110; background: rgba(0, 0, 0, .62); }
    .mobile-preview-button {
        position: fixed;
        z-index: 100;
        right: 14px;
        bottom: 14px;
        min-height: 48px;
        padding: 0 16px;
        display: inline-flex;
        align-items: center;
        gap: 8px;
        border: 1px solid rgba(var(--task-rgb), .6);
        border-radius: 24px;
        background: var(--task-accent);
        color: #fff;
        box-shadow: var(--shadow);
        font-weight: 800;
    }
    .mobile-preview-button b { min-width: 19px; height: 19px; display: grid; place-items: center; border-radius: 10px; background: #fff; color: #111318; font-size: 10px; }
}
@media (max-width: 720px) {
    :root { --header-height: 58px; }
    .app-header { padding: 0 12px; }
    .brand small, .user-pill, .icon-button.with-label span { display: none; }
    .workspace { width: calc(100% - 20px); padding-top: 10px; }
    article.panel { padding: 14px; }
    .panel-heading { align-items: flex-start; }
    .selection-summary { max-width: 130px; overflow: hidden; text-overflow: ellipsis; }
    .field-grid.two, .field-grid.three, .material-grid { grid-template-columns: 1fr; }
    .stacked-mobile { display: grid; grid-template-columns: 1fr; }
    .task-segmented { display: grid; grid-template-columns: 1fr; }
    .task-segmented button { width: 100%; }
    .chip-grid { gap: 6px; }
    .chip { min-height: 36px; flex: 1 1 auto; }
    .output-panel { inset: auto 6px 6px; height: 90dvh; padding: 13px; }
    .preset-tools select { width: 120px; }
    .primary-actions, .utility-actions { grid-template-columns: 1fr; }
    .primary-actions .btn-secondary { grid-column: auto; }
    .auth-page { padding: 16px; }
    .auth-shell { width: min(420px,100%); grid-template-columns: minmax(0,1fr); gap: 24px; }
    .auth-brand { justify-content: flex-start; }
    .auth-brand .brand-mark { width: 46px; height: 46px; flex-basis: 46px; }
    .auth-brand h1 { max-width: 100%; font-size: 18px; overflow-wrap: anywhere; }
    .auth-brand p { font-size: 11px; }
    .auth-card { padding: 20px; }
    .auth-tabs { min-width: 0; }
    .auth-tab { min-width: 0; padding-inline: 6px; }
    .dialog-actions { grid-template-columns: 1fr; }
}

/* Dashboard */
.dashboard-page { background: var(--bg); }
.dashboard-layout { min-height: 100vh; }
.dash-sidebar { position: fixed; inset: 0 auto 0 0; z-index: 60; width: 238px; display: flex; flex-direction: column; border-right: 1px solid var(--border-soft); background: #15181e; }
.dash-brand { min-height: 72px; padding: 0 16px; border-bottom: 1px solid var(--border-soft); }
.dash-brand .brand-mark { background: var(--blue); box-shadow: 0 0 0 4px rgba(59,130,246,.12); }
.dash-user { padding: 13px 16px; border-bottom: 1px solid var(--border-soft); }
.dash-user strong,.dash-user span { display: block; }
.dash-user strong { font-size: 12px; }
.dash-user span { margin-top: 3px; color: var(--muted); font-size: 10px; text-transform: uppercase; }
.dash-nav { flex: 1; padding: 10px 8px; overflow-y: auto; }
.dash-nav a,.dash-sidebar-footer a,.dash-sidebar-footer button { min-height: 39px; padding: 0 10px; display: flex; align-items: center; gap: 10px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); text-decoration: none; cursor: pointer; font-size: 12px; font-weight: 650; }
.dash-nav a:hover,.dash-nav a.active,.dash-sidebar-footer a:hover,.dash-sidebar-footer button:hover { background: var(--surface-2); color: var(--text); }
.dash-nav a.active { box-shadow: inset 3px 0 0 var(--blue); }
.dash-nav a svg,.dash-sidebar-footer svg { color: #7d8796; }
.dash-nav a.active svg { color: #60a5fa; }
.dash-nav a b { margin-left: auto; min-width: 20px; height: 20px; display: grid; place-items: center; border-radius: 10px; background: var(--surface-3); font-size: 9px; }
.nav-label { display: block; padding: 18px 10px 6px; color: var(--muted-2); font-size: 9px; font-weight: 850; text-transform: uppercase; }
.dash-sidebar-footer { padding: 9px 8px; border-top: 1px solid var(--border-soft); }
.dash-sidebar-footer form { margin: 0; }
.dash-sidebar-footer button { width: 100%; color: #fca5a5; }
.dash-main { width: calc(100% - 238px); margin-left: 238px; padding: 28px clamp(18px,3vw,44px); }
.dash-header { min-height: 52px; margin-bottom: 20px; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.dash-header h1 { margin: 5px 0 0; font-size: 24px; }
.filter-bar { margin-bottom: 16px; padding: 12px; display: flex; flex-wrap: wrap; gap: 8px; border: 1px solid var(--border-soft); border-radius: 7px; background: var(--surface); }
.filter-bar input,.filter-bar select { min-height: 36px; min-width: 130px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-2); color: var(--text); }
.filter-bar input[name="search"],.filter-bar input[name="log_search"] { flex: 1 1 230px; }
.prompt-list { display: grid; gap: 8px; }
.prompt-row { border: 1px solid var(--border-soft); border-radius: 7px; background: var(--surface); overflow: hidden; }
.prompt-row > summary { min-height: 52px; padding: 9px 13px; display: grid; grid-template-columns: 135px minmax(100px,auto) minmax(180px,1fr) auto; align-items: center; gap: 12px; cursor: pointer; list-style: none; }
.prompt-row > summary::-webkit-details-marker { display: none; }
.prompt-row[open] > summary { border-bottom: 1px solid var(--border-soft); background: var(--surface-2); }
.prompt-date { color: var(--muted); font-size: 10px; white-space: nowrap; }
.prompt-user { color: #93c5fd; font-size: 11px; }
.prompt-snippet { overflow: hidden; color: #d4d4d8; font-family: "Cascadia Code",Consolas,monospace; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.target-badge,.status { padding: 4px 7px; border-radius: 10px; background: rgba(59,130,246,.1); color: #93c5fd; font-size: 9px; font-weight: 800; white-space: nowrap; }
.prompt-expanded { padding: 14px; }
.prompt-expanded label { display: block; margin-top: 10px; color: var(--muted); font-size: 10px; font-weight: 750; }
.prompt-expanded textarea { min-height: 110px; margin-top: 6px; resize: vertical; font-family: "Cascadia Code",Consolas,monospace; font-size: 11px; }
.prompt-meta { display: flex; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: 10px; }
.prompt-meta span { padding: 3px 7px; border: 1px solid var(--border); border-radius: 9px; }
.row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 11px; }
.row-actions form { margin: 0; }
.btn-sm { min-height: 30px; padding: 5px 9px; font-size: 10px; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 18px; color: var(--muted); font-size: 11px; }
.disabled { opacity: .35; pointer-events: none; }
.dash-empty { padding: 44px 20px; border: 1px dashed var(--border); border-radius: 7px; color: var(--muted); text-align: center; }
.data-table-wrap { overflow-x: auto; border: 1px solid var(--border-soft); border-radius: 7px; background: var(--surface); }
.data-table { width: 100%; border-collapse: collapse; min-width: 680px; }
.data-table th,.data-table td { padding: 11px 13px; border-bottom: 1px solid var(--border-soft); text-align: left; vertical-align: top; }
.data-table th { color: var(--muted); font-size: 9px; text-transform: uppercase; }
.data-table td { color: #d4d4d8; font-size: 11px; }
.data-table td strong,.data-table td small { display: block; }
.data-table td small { margin-top: 3px; color: var(--muted); }
.data-table tr:last-child td { border-bottom: 0; }
.data-table form { margin: 0; }
.status.active { background: rgba(34,197,94,.1); color: #86efac; }
.status.pending { background: rgba(245,158,11,.1); color: #fbbf24; }
.status.blocked,.status.deleted { background: rgba(239,68,68,.1); color: #fca5a5; }
.inline-details { position: relative; }
.inline-details > summary { list-style: none; cursor: pointer; }
.inline-details > summary::-webkit-details-marker { display: none; }
.inline-details form { position: absolute; z-index: 10; top: 36px; right: 0; width: 230px; padding: 10px; display: grid; gap: 7px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface-2); box-shadow: var(--shadow); }
.inline-details input { width: 100%; min-height: 34px; padding: 7px 9px; border: 1px solid var(--border); border-radius: 6px; background: #101218; color: var(--text); }
.dash-form-panel { width: min(520px,100%); padding: 18px; border: 1px solid var(--border-soft); border-radius: 7px; background: var(--surface); }
.dash-form-panel form { display: grid; gap: 13px; }
.dash-form-panel label { color: var(--muted); font-size: 11px; font-weight: 700; }
.dash-form-panel input { width: 100%; min-height: 40px; margin-top: 6px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; background: #101218; color: var(--text); }
.dash-form-panel.inline { width: 100%; margin-bottom: 16px; }
.dash-form-panel.inline form { grid-template-columns: 1fr 2fr auto; align-items: end; }
.stats-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; margin-bottom: 16px; }
.stats-grid article { padding: 16px; border: 1px solid var(--border-soft); border-radius: 7px; background: var(--surface); box-shadow: inset 3px 0 0 var(--blue); }
.stats-grid strong,.stats-grid span { display: block; }
.stats-grid strong { font-size: 26px; }
.stats-grid span { margin-top: 5px; color: var(--muted); font-size: 10px; }
.stats-columns { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
.dash-section { padding: 16px; border: 1px solid var(--border-soft); border-radius: 7px; background: var(--surface); }
.dash-section h2 { margin: 0 0 12px; font-size: 13px; }
.stat-row { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border-soft); color: var(--muted); font-size: 11px; }
.stat-row:last-child { border-bottom: 0; }
.stat-row b { color: var(--text); }

@media (max-width:1099px) {
    .dash-sidebar { width: 72px; }
    .dash-brand { justify-content: center; padding: 0; }
    .dash-brand > span:last-child,.dash-user,.dash-nav a span,.dash-sidebar-footer span,.nav-label { display: none; }
    .dash-nav a,.dash-sidebar-footer a,.dash-sidebar-footer button { justify-content: center; padding: 0; }
    .dash-nav a b { display: none; }
    .dash-main { width: calc(100% - 72px); margin-left: 72px; }
    .stats-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .stats-columns { grid-template-columns: 1fr; }
}
@media (max-width:720px) {
    .dash-sidebar { position: sticky; top: 0; width: 100%; height: 58px; flex-direction: row; border-right: 0; border-bottom: 1px solid var(--border-soft); overflow-x: auto; }
    .dash-brand { min-width: 58px; min-height: 58px; border-bottom: 0; border-right: 1px solid var(--border-soft); }
    .dash-brand .brand-mark { width: 32px; height: 32px; }
    .dash-nav { display: flex; flex: 1; padding: 7px; overflow-x: auto; }
    .dash-nav a { min-width: 42px; }
    .dash-nav a.active { box-shadow: inset 0 -3px 0 var(--blue); }
    .dash-sidebar-footer { display: flex; padding: 7px; border-top: 0; border-left: 1px solid var(--border-soft); }
    .dash-sidebar-footer a { display: none; }
    .dash-main { width: 100%; margin: 0; padding: 18px 10px; }
    .dash-header h1 { font-size: 20px; }
    .filter-bar { display: grid; grid-template-columns: 1fr 1fr; }
    .filter-bar input,.filter-bar select { min-width: 0; width: 100%; }
    .filter-bar input[name="search"],.filter-bar input[name="log_search"] { grid-column: 1/-1; }
    .prompt-row > summary { grid-template-columns: 1fr auto; }
    .prompt-date,.prompt-user { display: none; }
    .prompt-snippet { min-width: 0; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .dash-form-panel.inline form { grid-template-columns: 1fr; }
}
