:root {
    --bg-top: #f2f5f8;
    --bg-mid: #edf1f5;
    --bg-bottom: #e8edf2;
    --surface: #ffffff;
    --surface-strong: #ffffff;
    --surface-deep: #f7f9fb;
    --line: #e1e8ed;
    --line-soft: rgba(255, 255, 255, 0.1);
    --text: #17191c;
    --muted: #6c757d;
    --blue: #17c2d7;
    --blue-deep: #11a9bb;
    --cyan: #dff7fb;
    --mint: #e6f8ee;
    --gold: #fff3d8;
    --salmon: #fce1df;
    --shadow-lg: 0 18px 40px rgba(16, 24, 40, 0.08);
    --shadow-md: 0 10px 24px rgba(16, 24, 40, 0.06);
    --shadow-sm: 0 4px 12px rgba(16, 24, 40, 0.05);
    --gloss: none;
    --radius-xl: 18px;
    --radius-lg: 12px;
    --radius-md: 10px;
    --radius-pill: 999px;
    --sidebar-width: clamp(280px, 18vw, 320px);
    --content-max: 1520px;
    --font-display: "Montserrat", "Segoe UI", Arial, sans-serif;
    --font-body: "Montserrat", "Segoe UI", Arial, sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    font-family: var(--font-body);
    background: linear-gradient(180deg, var(--bg-top) 0%, var(--bg-mid) 52%, var(--bg-bottom) 100%);
    background-attachment: fixed;
}

a {
    color: inherit;
    text-decoration: none;
}

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

.ambient-grid,
.ambient-grid::before,
.ambient-grid::after {
    position: fixed;
    inset: 0;
    pointer-events: none;
    content: "";
}

.ambient-grid {
    background:
        linear-gradient(rgba(23, 194, 215, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(23, 194, 215, 0.02) 1px, transparent 1px);
    background-size: 84px 84px;
    mask-image: radial-gradient(circle at center, black 58%, transparent 100%);
    opacity: 0.55;
}

.ambient-grid::before {
    inset: 3% auto auto 6%;
    width: 420px;
    height: 420px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(23, 194, 215, 0.08), transparent 72%);
    filter: blur(30px);
}

.ambient-grid::after {
    inset: auto 8% 10% auto;
    width: 320px;
    height: 320px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(23, 194, 215, 0.1), transparent 74%);
    filter: blur(20px);
}

.app-shell {
    position: relative;
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 24px 18px;
    background:
        linear-gradient(180deg, rgba(31, 43, 56, 0.98) 0%, rgba(23, 33, 45, 0.98) 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.04);
    box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.03);
    overflow: auto;
    z-index: 2;
}

.brand,
.sidebar-note,
.sidebar-footer,
.workspace-intro,
.utility-card,
.layout-toolbar,
.panel,
.toolbar-card,
.history-link,
.card-mini,
.feature-card,
.metric,
.timeline-item,
.list-item,
.status-row,
.chat-entry,
.info-item,
.asset-card,
.form-card,
.meta-card,
.kpi {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-md);
}

.brand::before,
.sidebar-note::before,
.sidebar-footer::before,
.workspace-intro::before,
.utility-card::before,
.layout-toolbar::before,
.panel::before,
.toolbar-card::before,
.history-link::before,
.card-mini::before,
.feature-card::before,
.metric::before,
.timeline-item::before,
.list-item::before,
.status-row::before,
.chat-entry::before,
.info-item::before,
.asset-card::before,
.form-card::before,
.meta-card::before,
.kpi::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 4px;
    background: linear-gradient(90deg, rgba(23, 194, 215, 0.9), rgba(23, 194, 215, 0));
    pointer-events: none;
}

.brand {
    display: grid;
    gap: 8px;
    padding: 18px;
    margin-bottom: 18px;
    border-color: rgba(255, 255, 255, 0.06);
    background: linear-gradient(180deg, rgba(36, 49, 64, 0.96), rgba(26, 36, 47, 0.98));
    box-shadow: none;
}

.brand-mark-row {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(23, 194, 215, 0.28), rgba(23, 194, 215, 0.12));
    border: 1px solid rgba(23, 194, 215, 0.24);
}

.brand-mark img {
    width: 28px;
    height: 28px;
    display: block;
}

.brand-kicker,
.nav-group-label,
.meta,
.chat-meta,
.eyebrow,
.utility-label,
.sidebar-note-label {
    position: relative;
    z-index: 1;
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.brand-kicker,
.eyebrow,
.utility-label,
.sidebar-note-label {
    color: rgba(23, 194, 215, 0.88);
}

.brand-title,
.workspace-intro h1,
.topbar h1,
.hero-card h2,
.panel-title h2,
.panel-title h3,
.section-heading h2,
.auth-title {
    position: relative;
    z-index: 1;
    margin: 0;
    font-family: var(--font-display);
    font-weight: 800;
    letter-spacing: -0.03em;
}

.brand-title {
    margin-top: 8px;
    font-size: 1.32rem;
    line-height: 1.08;
}

.brand-copy,
.subtle,
.panel-subtitle,
.feature-card p,
.list-item p,
.card-mini p,
.timeline-item p,
.chat-entry p,
.history-preview,
.workspace-intro p,
.utility-card p,
.sidebar-note p {
    position: relative;
    z-index: 1;
    color: var(--muted);
    line-height: 1.58;
}

.brand-title,
.brand-copy,
.sidebar-note,
.sidebar-note strong,
.sidebar-note p,
.sidebar-footer,
.sidebar-footer .subtle,
.sidebar .nav-link,
.sidebar .nav-link strong,
.sidebar .nav-group-label {
    color: #f7fbff;
}

.sidebar-note,
.sidebar-footer {
    border-color: rgba(255, 255, 255, 0.07);
    background: rgba(255, 255, 255, 0.03);
    box-shadow: none;
}

.sidebar-note p,
.sidebar-footer .subtle,
.sidebar .nav-link span {
    color: rgba(223, 232, 239, 0.72);
}

.sidebar-note,
.sidebar-footer {
    padding: 16px 18px;
    margin-bottom: 18px;
}

.sidebar-note strong,
.utility-card strong,
.layout-toolbar strong {
    position: relative;
    z-index: 1;
    display: block;
    margin-top: 8px;
    font-size: 1rem;
    line-height: 1.35;
}

.nav-group {
    margin-top: 22px;
}

.nav-list,
.stack,
.composer,
.chart-lines,
.stack-tight,
.field-stack,
.field-list,
.info-list,
.metric-grid,
.asset-grid,
.feature-list,
.history-list,
.chat-log,
.chat-meta-grid {
    display: grid;
    gap: 14px;
}

.history-item-shell {
    position: relative;
}

.history-item-delete,
.history-bulk-actions {
    display: flex;
}

.history-item-delete {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 3;
}

.history-bulk-actions {
    margin-bottom: 14px;
}

.history-delete-button {
    min-height: 32px;
    padding: 0 10px;
    font-size: 0.76rem;
    background: rgba(255, 255, 255, 0.82);
    box-shadow: var(--shadow-sm);
}

.history-item-shell .history-link {
    padding-right: 92px;
}

.nav-link {
    display: grid;
    gap: 4px;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid transparent;
    color: #f7fbff;
    background: transparent;
    transition: 160ms ease;
}

.nav-link strong {
    font-size: 0.97rem;
}

.nav-link:hover,
.nav-link.is-active {
    transform: translateX(2px);
    color: #ffffff;
    border-color: rgba(23, 194, 215, 0.25);
    box-shadow: none;
    background: linear-gradient(90deg, rgba(23, 194, 215, 0.18), rgba(23, 194, 215, 0.04));
}

.pill,
.tag,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.pill {
    min-height: 34px;
    padding: 0 14px;
    border-radius: var(--radius-pill);
    border: 1px solid rgba(23, 194, 215, 0.16);
    background: rgba(23, 194, 215, 0.14);
    box-shadow: none;
    color: #eaffff;
    font-size: 0.78rem;
    font-weight: 800;
}

.pill-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #1ee3b4;
    box-shadow: 0 0 0 3px rgba(30, 227, 180, 0.16);
}

.main {
    padding: 24px 28px;
}

.main-inner {
    width: min(100%, var(--content-max));
    margin: 0 auto;
}

.workspace-header {
    display: grid;
    grid-template-columns: minmax(0, 1.28fr) minmax(360px, 0.82fr);
    gap: 18px;
    margin-bottom: 24px;
}

.workspace-intro,
.utility-card,
.layout-toolbar {
    padding: 22px 24px;
}

.workspace-intro {
    min-height: 220px;
    background:
        radial-gradient(circle at right 18% bottom 24%, rgba(23, 194, 215, 0.08), transparent 24%),
        linear-gradient(180deg, #ffffff, #fafcfd);
    box-shadow: var(--shadow-lg);
}

.workspace-intro::after {
    content: "";
    position: absolute;
    right: 18px;
    bottom: 18px;
    width: 118px;
    height: 118px;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(23, 194, 215, 0.14), rgba(23, 194, 215, 0.03));
    border: 1px solid rgba(23, 194, 215, 0.16);
    transform: rotate(-7deg);
}

.workspace-intro h1 {
    margin-top: 12px;
    max-width: 9ch;
    font-size: clamp(1.8rem, 3vw, 3rem);
    line-height: 0.88;
}

.workspace-tools {
    display: grid;
    gap: 18px;
}

.layout-toolbar,
.topbar,
.panel-title,
.status-row,
.control-row,
.history-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.layout-toolbar {
    background: linear-gradient(180deg, #ffffff, #f9fbfc);
}

.layout-toolbar-actions,
.topbar-actions,
.control-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.flash-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
    padding: 14px 18px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: #ffffff;
    box-shadow: var(--shadow-sm);
}

.flash-banner strong {
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.flash-success {
    color: #0f5c45;
}

.flash-error {
    color: #8d2f2b;
}

.layout-canvas > :first-child {
    margin-top: 0;
}

.layout-canvas[data-layout-editing="true"] > [data-layout-item="true"] {
    position: relative;
    cursor: move;
    outline: 2px solid rgba(23, 194, 215, 0.9);
    outline-offset: 10px;
}

.layout-canvas[data-layout-editing="true"] > [data-layout-item="true"]::before {
    content: "Block " attr(data-layout-index);
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 4;
    padding: 7px 12px;
    border-radius: var(--radius-pill);
    border: 1px solid rgba(23, 194, 215, 0.24);
    background: #ffffff;
    box-shadow: var(--shadow-sm);
    color: var(--blue-deep);
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
}

.layout-canvas[data-layout-editing="true"] > [data-layout-item="true"].is-dragging {
    opacity: 0.48;
}

.layout-canvas[data-layout-editing="true"] > [data-layout-item="true"].is-drop-target {
    outline-color: rgba(127, 210, 255, 1);
}

.topbar {
    margin-bottom: 22px;
}

.page-kicker {
    margin-bottom: 8px;
}

.topbar h1 {
    max-width: 11ch;
    font-size: clamp(1.25rem, 1.8vw, 1.85rem);
    line-height: 0.94;
}

.topbar p,
.panel-subtitle {
    margin: 10px 0 0;
    max-width: 64ch;
    font-size: 0.95rem;
}

.toolbar-card {
    min-width: 260px;
    padding: 16px 18px;
}

.button {
    min-height: 46px;
    padding: 0 18px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: linear-gradient(180deg, #ffffff, #f7f9fb);
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
    color: #20242a;
    cursor: pointer;
    font-size: 0.92rem;
    font-weight: 700;
    transition: 140ms ease;
}

.button:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.button-primary {
    border-color: #11a9bb;
    background: linear-gradient(180deg, #1ecbe0 0%, #17c2d7 100%);
    color: #ffffff;
    text-shadow: none;
}

.button-accent {
    background: linear-gradient(180deg, #f3feff 0%, #dff8fb 100%);
    color: #0f8594;
}

.dashboard-grid,
.split-grid,
.triple-grid,
.chat-shell,
.form-layout,
.detail-layout,
.chat-workspace,
.chat-admin-layout,
.field-row,
.hero-metrics,
.metric-grid,
.asset-grid,
.feature-list,
.kpi-row {
    display: grid;
    gap: 18px;
}

.dashboard-grid {
    grid-template-columns: minmax(0, 1.28fr) minmax(320px, 0.92fr);
}

.split-grid,
.chat-shell {
    grid-template-columns: minmax(0, 1.14fr) minmax(340px, 0.86fr);
}

.form-layout {
    grid-template-columns: minmax(0, 1.14fr) minmax(320px, 0.86fr);
    align-items: start;
}

.detail-layout {
    grid-template-columns: minmax(280px, 0.92fr) minmax(0, 1.08fr);
}

.chat-workspace {
    grid-template-columns: minmax(260px, 0.78fr) minmax(0, 1.32fr) minmax(300px, 0.84fr);
    align-items: start;
}

.chat-admin-layout {
    grid-template-columns: minmax(320px, 0.9fr) minmax(0, 1.1fr);
    align-items: start;
}

.triple-grid,
.hero-metrics,
.metric-grid,
.asset-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.feature-list,
.kpi-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.system-action-grid {
    align-items: stretch;
}

.system-action-card {
    display: grid;
    gap: 12px;
}

.system-action-card .button {
    justify-self: start;
}

.panel {
    padding: 22px;
}

.hero-card {
    background:
        radial-gradient(circle at right top, rgba(23, 194, 215, 0.1), transparent 22%),
        linear-gradient(180deg, #ffffff, #f6fbfc);
}

.hero-card h2 {
    max-width: 10ch;
    font-size: clamp(1.25rem, 1.9vw, 1.9rem);
    line-height: 0.9;
}

.metric,
.timeline-item,
.list-item,
.card-mini,
.status-row,
.feature-card,
.chat-entry,
.info-item,
.asset-card,
.form-card,
.meta-card,
.kpi,
.history-link {
    padding: 16px;
}

.metric strong,
.kpi-value {
    position: relative;
    z-index: 1;
    display: block;
    margin-bottom: 8px;
    font-family: var(--font-display);
    font-size: clamp(1.45rem, 2vw, 2rem);
    font-weight: 800;
    line-height: 0.94;
}

.history-link:hover,
.history-link.is-active {
    transform: translateY(-1px);
    box-shadow: 0 12px 22px rgba(16, 24, 40, 0.08);
    background: linear-gradient(180deg, #ffffff, #f2fbfd);
}

.settings-selection.is-selected {
    background: linear-gradient(180deg, #ffffff, #e9fbfe);
    box-shadow: 0 12px 22px rgba(16, 24, 40, 0.08);
}

.settings-mode-switch {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.settings-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 18px;
}

.settings-tab-button {
    min-width: 160px;
}

.model-filter-row {
    align-items: stretch;
}

.model-filter-chip {
    min-height: 72px;
    text-transform: capitalize;
}

.model-pull-progress {
    margin-bottom: 18px;
}

.model-search-results {
    max-height: min(70vh, 1280px);
    overflow: auto;
    padding-right: 6px;
}

.model-result-tags,
.model-pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.model-pagination {
    justify-content: space-between;
}

.confirm-dialog {
    width: min(520px, calc(100vw - 32px));
    padding: 0;
    border: 0;
    background: transparent;
}

.confirm-dialog::backdrop {
    background: rgba(15, 23, 42, 0.46);
    backdrop-filter: blur(3px);
}

.confirm-dialog-card {
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: #ffffff;
    box-shadow: 0 24px 54px rgba(15, 23, 42, 0.18);
}

.model-progress-bar {
    margin-top: 12px;
}

.button:disabled {
    opacity: 0.6;
    cursor: wait;
    transform: none;
}

.settings-tab-button.is-active {
    border-color: #11a9bb;
    background:
        linear-gradient(180deg, #1ecbe0 0%, #17c2d7 100%);
    color: #f8fdff;
}

.settings-tab-panel[hidden],
.settings-panel[hidden] {
    display: none !important;
}

.settings-mode-option {
    position: relative;
    display: grid;
    gap: 8px;
    padding: 16px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: linear-gradient(180deg, #ffffff, #f8fbfc);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    color: var(--text);
}

.settings-mode-option input {
    position: absolute;
    inset: 0;
    opacity: 0;
    pointer-events: none;
}

.settings-mode-option.is-selected {
    border-color: rgba(23, 194, 215, 0.26);
    background: linear-gradient(180deg, #ffffff, #eafcff);
    box-shadow: 0 12px 22px rgba(16, 24, 40, 0.08);
}

.raw-config-editor {
    min-height: 320px;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.9rem;
    line-height: 1.55;
}

.mono-block {
    margin: 0;
    padding: 14px 16px;
    border-radius: 10px;
    background: #f7f9fb;
    border: 1px solid var(--line);
    color: #24313b;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.84rem;
    line-height: 1.55;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.history-meta {
    position: relative;
    z-index: 1;
    color: var(--muted);
    font-size: 0.78rem;
}

.tag {
    min-height: 28px;
    padding: 0 11px;
    border-radius: 999px;
    border: 1px solid rgba(23, 194, 215, 0.12);
    font-size: 0.72rem;
    font-weight: 700;
    text-shadow: none;
}

.tag-cyan {
    background: rgba(23, 194, 215, 0.12);
    color: #0f8594;
}

.tag-lime {
    background: rgba(34, 197, 94, 0.11);
    color: #1a6e3b;
}

.tag-salmon {
    background: rgba(239, 68, 68, 0.11);
    color: #8c3a34;
}

.tag-gold {
    background: rgba(245, 158, 11, 0.13);
    color: #75520b;
}

.chart-line {
    height: 11px;
    border-radius: var(--radius-pill);
    background: #edf2f7;
    box-shadow: inset 0 1px 2px rgba(16, 24, 40, 0.05);
    overflow: hidden;
}

.chart-line span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #45d6e7, #17c2d7 62%, #11a9bb 100%);
}

.field,
.select,
.textarea {
    width: 100%;
    padding: 14px 16px;
    border-radius: 10px;
    border: 1px solid #d8e2e8;
    background: #fbfcfd;
    box-shadow: inset 0 1px 1px rgba(16, 24, 40, 0.03);
    color: #1f2329;
}

.field::placeholder,
.textarea::placeholder {
    color: #6a7280;
}

.field:focus,
.select:focus,
.textarea:focus {
    outline: none;
    border-color: rgba(23, 194, 215, 0.52);
    box-shadow: 0 0 0 4px rgba(23, 194, 215, 0.12);
}

.field-label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.82rem;
    font-weight: 800;
    color: #334450;
}

.field-hint {
    margin-top: 8px;
    color: var(--muted);
    font-size: 0.84rem;
    line-height: 1.5;
}

.form-card-header {
    margin-bottom: 18px;
}

.form-card-header h3,
.form-card-header h4 {
    position: relative;
    z-index: 1;
    margin: 0;
    font-family: var(--font-display);
}

.form-card-header p,
.meta-card p,
.info-item p,
.status-row p,
.chat-entry p,
.list-item p,
.timeline-item p,
.card-mini p,
.feature-card p {
    margin: 6px 0 0;
}

.asset-card h3,
.info-item strong,
.meta-card strong {
    position: relative;
    z-index: 1;
    display: block;
    margin-bottom: 6px;
}

.textarea {
    min-height: 150px;
    resize: vertical;
}

.upload-zone {
    display: grid;
    gap: 12px;
    place-items: center;
    min-height: 220px;
    padding: 26px;
    text-align: center;
    border: 2px dashed rgba(23, 194, 215, 0.28);
    border-radius: 18px;
    background:
        radial-gradient(circle at top, rgba(23, 194, 215, 0.08), transparent 48%),
        linear-gradient(180deg, #fbfdfe, #f3fbfc);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.98);
}

.chat-column,
.chat-thread-body,
.chat-composer {
    display: grid;
    gap: 16px;
}

.chat-thread {
    min-height: 72vh;
}

.chat-composer {
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.chat-submit-row {
    align-items: center;
}

.chat-enter-settings {
    position: relative;
}

.chat-enter-settings-toggle {
    min-width: 46px;
    width: 46px;
    padding: 0;
    font-size: 1rem;
    line-height: 1;
}

.chat-enter-settings-panel {
    position: absolute;
    top: 0;
    left: calc(100% + 12px);
    z-index: 5;
    width: min(320px, 60vw);
    padding: 14px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: #ffffff;
    box-shadow: var(--shadow-md);
}

.chat-log {
    max-height: min(68vh, 920px);
    padding-right: 6px;
    overflow: auto;
}

.chat-log.is-tall {
    max-height: min(74vh, 1040px);
}

.chat-entry.user {
    background:
        linear-gradient(180deg, #ffffff, #eefbfd);
}

.chat-entry {
    overflow: visible;
}

.chat-message-content {
    position: relative;
    z-index: 1;
    margin-top: 8px;
    color: var(--text);
    line-height: 1.62;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.chat-message-content br {
    content: "";
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 14px 12px;
    text-align: left;
    border-bottom: 1px solid var(--line);
}

.table th {
    color: #5a6772;
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.table td {
    color: #24313b;
}

.section-spacer {
    margin-top: 18px;
}

.section-heading {
    margin-bottom: 16px;
}

.section-heading p {
    margin: 8px 0 0;
    color: var(--muted);
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-card {
    width: min(100%, 720px);
}

.auth-title {
    margin-top: 10px;
    font-size: clamp(2.4rem, 4vw, 4rem);
    line-height: 0.9;
}

.auth-copy {
    margin-bottom: 24px;
    max-width: 54ch;
    font-size: 0.96rem;
}

.reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: 540ms ease;
}

.reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 1280px) {
    .workspace-header,
    .chat-workspace {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1120px) {
    .app-shell,
    .dashboard-grid,
    .split-grid,
    .triple-grid,
    .chat-shell,
    .form-layout,
    .detail-layout,
    .chat-admin-layout,
    .field-row,
    .hero-metrics,
    .metric-grid,
    .asset-grid,
    .feature-list,
    .kpi-row {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: relative;
        height: auto;
    }
}

@media (max-width: 760px) {
    .main,
    .sidebar {
        padding: 18px;
    }

    .topbar,
    .layout-toolbar,
    .history-title-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .topbar-actions,
    .control-row,
    .layout-toolbar-actions,
    .button {
        width: 100%;
    }

    .toolbar-card,
    .utility-card {
        width: 100%;
    }

    .settings-mode-switch {
        grid-template-columns: 1fr;
    }
}

body[data-studio-theme="radmin"] {
    --bg-top: #eef1f7;
    --bg-mid: #f4f6fb;
    --bg-bottom: #f6f7fb;
    --surface: #ffffff;
    --surface-strong: #ffffff;
    --surface-deep: #f8f9fb;
    --line: #e7ebf0;
    --text: #212121;
    --muted: #7a828a;
    --blue: #009688;
    --blue-deep: #086f65;
    --shadow-lg: 0 12px 36px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.07);
    --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.05);
    background: linear-gradient(180deg, #f4f6fb 0%, #f6f7fb 100%);
}

body[data-studio-theme="radmin"] .ambient-grid {
    background:
        linear-gradient(rgba(0, 150, 136, 0.018) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 150, 136, 0.018) 1px, transparent 1px);
    opacity: 0.42;
}

body[data-studio-theme="radmin"] .app-shell {
    grid-template-columns: 240px minmax(0, 1fr);
}

body[data-studio-theme="radmin"] .sidebar {
    padding: 0;
    background: #ffffff;
    border-right: 0;
    box-shadow: 0 3px 30px rgba(0, 0, 0, 0.1), 0 3px 20px rgba(0, 0, 0, 0.08);
}

body[data-studio-theme="radmin"] .brand,
body[data-studio-theme="radmin"] .sidebar-note,
body[data-studio-theme="radmin"] .sidebar-footer {
    margin: 0 15px 18px;
    border: none;
    background: transparent;
    box-shadow: none;
}

body[data-studio-theme="radmin"] .brand {
    padding: 13px 0 18px;
    border-bottom: 1px solid #eef1f4;
    border-radius: 0;
}

body[data-studio-theme="radmin"] .brand::before,
body[data-studio-theme="radmin"] .sidebar-note::before,
body[data-studio-theme="radmin"] .sidebar-footer::before {
    display: none;
}

body[data-studio-theme="radmin"] .brand-title,
body[data-studio-theme="radmin"] .brand-copy,
body[data-studio-theme="radmin"] .sidebar-note,
body[data-studio-theme="radmin"] .sidebar-note strong,
body[data-studio-theme="radmin"] .sidebar-note p,
body[data-studio-theme="radmin"] .sidebar-footer,
body[data-studio-theme="radmin"] .sidebar-footer .subtle,
body[data-studio-theme="radmin"] .sidebar .nav-link,
body[data-studio-theme="radmin"] .sidebar .nav-link strong,
body[data-studio-theme="radmin"] .sidebar .nav-group-label {
    color: #212529;
}

body[data-studio-theme="radmin"] .brand-mark {
    border-radius: 10px;
    background: linear-gradient(180deg, #00b3a4, #009688);
    border: none;
    box-shadow: 0 8px 18px rgba(0, 150, 136, 0.22);
}

body[data-studio-theme="radmin"] .brand-kicker,
body[data-studio-theme="radmin"] .eyebrow,
body[data-studio-theme="radmin"] .utility-label,
body[data-studio-theme="radmin"] .sidebar-note-label {
    color: #009688;
}

body[data-studio-theme="radmin"] .sidebar-note p,
body[data-studio-theme="radmin"] .sidebar-footer .subtle,
body[data-studio-theme="radmin"] .sidebar .nav-link span {
    color: #6c757d;
}

body[data-studio-theme="radmin"] .nav-group {
    margin-top: 12px;
    padding: 0 15px;
}

body[data-studio-theme="radmin"] .nav-link {
    padding: 10px 16px;
    border-radius: 8px;
}

body[data-studio-theme="radmin"] .nav-link:hover,
body[data-studio-theme="radmin"] .nav-link.is-active {
    transform: none;
    color: #212121;
    background: #f1f4f6;
    border-color: transparent;
    box-shadow: none;
}

body[data-studio-theme="radmin"] .sidebar-footer {
    padding: 4px 15px 24px;
}

body[data-studio-theme="radmin"] .pill {
    background: rgba(0, 150, 136, 0.12);
    border-color: rgba(0, 150, 136, 0.1);
    color: #0a6f67;
}

body[data-studio-theme="radmin"] .main {
    padding: 60px 15px 30px 255px;
}

body[data-studio-theme="radmin"] .workspace-intro,
body[data-studio-theme="radmin"] .utility-card,
body[data-studio-theme="radmin"] .layout-toolbar,
body[data-studio-theme="radmin"] .panel,
body[data-studio-theme="radmin"] .toolbar-card,
body[data-studio-theme="radmin"] .history-link,
body[data-studio-theme="radmin"] .card-mini,
body[data-studio-theme="radmin"] .feature-card,
body[data-studio-theme="radmin"] .metric,
body[data-studio-theme="radmin"] .timeline-item,
body[data-studio-theme="radmin"] .list-item,
body[data-studio-theme="radmin"] .status-row,
body[data-studio-theme="radmin"] .chat-entry,
body[data-studio-theme="radmin"] .info-item,
body[data-studio-theme="radmin"] .asset-card,
body[data-studio-theme="radmin"] .form-card,
body[data-studio-theme="radmin"] .meta-card,
body[data-studio-theme="radmin"] .kpi {
    border: none;
    border-radius: 4px;
    background: #ffffff;
    box-shadow: 0 6px 0 0 rgba(0, 0, 0, 0.01), 0 15px 32px 0 rgba(0, 0, 0, 0.06);
}

body[data-studio-theme="radmin"] .workspace-intro::before,
body[data-studio-theme="radmin"] .utility-card::before,
body[data-studio-theme="radmin"] .layout-toolbar::before,
body[data-studio-theme="radmin"] .panel::before,
body[data-studio-theme="radmin"] .toolbar-card::before,
body[data-studio-theme="radmin"] .history-link::before,
body[data-studio-theme="radmin"] .card-mini::before,
body[data-studio-theme="radmin"] .feature-card::before,
body[data-studio-theme="radmin"] .metric::before,
body[data-studio-theme="radmin"] .timeline-item::before,
body[data-studio-theme="radmin"] .list-item::before,
body[data-studio-theme="radmin"] .status-row::before,
body[data-studio-theme="radmin"] .chat-entry::before,
body[data-studio-theme="radmin"] .info-item::before,
body[data-studio-theme="radmin"] .asset-card::before,
body[data-studio-theme="radmin"] .form-card::before,
body[data-studio-theme="radmin"] .meta-card::before,
body[data-studio-theme="radmin"] .kpi::before {
    height: 0;
}

body[data-studio-theme="radmin"] .workspace-header {
    margin-bottom: 30px;
}

body[data-studio-theme="radmin"] .workspace-intro {
    min-height: 0;
    background: #ffffff;
}

body[data-studio-theme="radmin"] .workspace-intro::after {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(0, 150, 136, 0.14), rgba(0, 150, 136, 0.03));
    border: none;
}

body[data-studio-theme="radmin"] .workspace-intro h1 {
    max-width: none;
    line-height: 1.08;
}

body[data-studio-theme="radmin"] .button {
    border: none;
    border-radius: 6px;
    background: #eceff1;
    box-shadow: none;
    font-weight: 700;
}

body[data-studio-theme="radmin"] .button:hover {
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.06);
}

body[data-studio-theme="radmin"] .button-primary {
    background: linear-gradient(180deg, #00b3a4 0%, #009688 100%);
}

body[data-studio-theme="radmin"] .button-accent {
    background: #e7f7f5;
    color: #086f65;
}

body[data-studio-theme="radmin"] .field,
body[data-studio-theme="radmin"] .select,
body[data-studio-theme="radmin"] .textarea {
    border: 1px solid #e3e7ed;
    border-radius: 6px;
    background: #ffffff;
}

body[data-studio-theme="radmin"] .field:focus,
body[data-studio-theme="radmin"] .select:focus,
body[data-studio-theme="radmin"] .textarea:focus {
    border-color: rgba(0, 150, 136, 0.45);
    box-shadow: 0 0 0 4px rgba(0, 150, 136, 0.1);
}

body[data-studio-theme="radmin"] .tag-cyan {
    background: rgba(0, 150, 136, 0.12);
    color: #086f65;
}

body[data-studio-theme="radmin"] .chart-line span {
    background: linear-gradient(90deg, #20c6b8, #009688 70%, #086f65 100%);
}

body[data-studio-theme="radmin"] .history-link:hover,
body[data-studio-theme="radmin"] .history-link.is-active,
body[data-studio-theme="radmin"] .settings-selection.is-selected,
body[data-studio-theme="radmin"] .settings-mode-option.is-selected {
    background: #ffffff;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.08);
}

body[data-studio-theme="radmin"] .settings-tab-button.is-active {
    border: none;
    background: linear-gradient(180deg, #00b3a4 0%, #009688 100%);
}

body[data-studio-theme="radmin"] .settings-theme-switch {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

body[data-studio-theme="radmin"] .settings-theme-option p {
    color: var(--muted);
}

body[data-studio-theme="radmin"] .table th,
body[data-studio-theme="radmin"] .table td {
    border-bottom: 1px solid #edf1f5;
}

body[data-studio-theme="radmin"] .mono-block {
    background: #fbfcfd;
    border-color: #e7ebf0;
}

body[data-studio-theme="radmin"] .confirm-dialog-card {
    border: none;
    border-radius: 6px;
}

body[data-studio-theme="radmin"] .auth-shell {
    background-image: linear-gradient(to top left, #2fd3c5, #08671e);
}

body[data-studio-theme="radmin"] .auth-card {
    background: #ffffff;
    border-radius: 5px;
    box-shadow: 0 20px 44px rgba(0, 0, 0, 0.14);
}

@media (max-width: 1120px) {
    body[data-studio-theme="radmin"] .main {
        padding: 24px 18px;
    }

    body[data-studio-theme="radmin"] .app-shell {
        grid-template-columns: 1fr;
    }

    body[data-studio-theme="radmin"] .sidebar {
        box-shadow: none;
    }
}
