/* YinSuo design system — derived from Ardot file 742333039707637 */

@font-face {
    font-family: "Geist Mono";
    src: url("/assets/fonts/GeistMono-Regular.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Geist Mono";
    src: url("/assets/fonts/GeistMono-Medium.woff2") format("woff2");
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Geist Mono";
    src: url("/assets/fonts/GeistMono-SemiBold.woff2") format("woff2");
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

:root {
    --primary: #165DFF;
    --primary-hover: #0E42D2;
    --primary-soft: #EEF4FF;
    --primary-tint: #F8FAFF;
    --ink: #101828;
    --ink-2: #344054;
    --ink-3: #475467;
    --muted: #667085;
    --muted-2: #98A2B3;
    --border: #E3E8ED;
    --border-strong: #D0D5DD;
    --divider: #EAECF0;
    --bg-soft: #FAFAFB;
    --table-head: #F9FAFB;
    --green: #12B76A;
    --green-soft: #ECFDF3;
    --green-ink: #027A48;
    --red: #F04438;
    --red-soft: #FEF3F2;
    --red-ink: #B42318;
    --amber: #F79009;
    --amber-soft: #FFFAEB;
    --amber-ink: #B54708;
    --amber-border: #FEDF89;
    --cyan: #06AED4;
    --cyan-soft: #ECFDFF;
    --cyan-ink: #0E7490;
    --teal-ink: #0E9384;
    --purple: #5925DC;
    --purple-soft: #F4F3FF;
    --pink: #C01048;
    --pink-soft: #FFF1F5;
    --orange-soft: #FFF4E5;
    --radius-sm: 4px;
    --radius: 6px;
    --radius-lg: 8px;
    --radius-xl: 12px;
    --sidebar-width: 220px;
    --topbar-height: 56px;
    --font: "Noto Sans SC", "Source Han Sans SC", "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --mono: "Geist Mono", "SFMono-Regular", "Cascadia Mono", Consolas, "Liberation Mono", monospace;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04);
    --shadow-lg: 0 18px 48px rgba(16, 24, 40, 0.16);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    background: #FFFFFF;
    color: var(--ink);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
p,
dl,
dd,
dt,
figure {
    margin: 0;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: none;
}

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

button {
    cursor: pointer;
}

button:disabled,
.button.is-disabled,
.button[disabled] {
    cursor: not-allowed;
    opacity: 0.55;
}

img,
svg {
    display: block;
    max-width: 100%;
}

[hidden] {
    display: none !important;
}

.mono {
    font-family: var(--mono);
    font-size: 0.95em;
    letter-spacing: -0.01em;
}

.muted {
    color: var(--muted-2);
}

.small {
    font-size: 12px;
}

.link {
    color: var(--primary);
    font-size: 13px;
    font-weight: 500;
    background: none;
    border: 0;
    padding: 0;
}

.link:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}


/* ---------- icon masks ---------- */

.icon,
.nav-icon {
    display: inline-block;
    flex: none;
    background-color: currentColor;
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
    -webkit-mask-size: contain;
    mask-repeat: no-repeat;
    mask-position: center;
    mask-size: contain;
}

.icon {
    width: 16px;
    height: 16px;
}

.nav-icon {
    width: 18px;
    height: 18px;
}

.icon-search { -webkit-mask-image: url("/assets/img/icons/search.svg"); mask-image: url("/assets/img/icons/search.svg"); }
.icon-bell { -webkit-mask-image: url("/assets/img/icons/bell.svg"); mask-image: url("/assets/img/icons/bell.svg"); }
.icon-doc { -webkit-mask-image: url("/assets/img/icons/doc.svg"); mask-image: url("/assets/img/icons/doc.svg"); }
.icon-doc-vector { -webkit-mask-image: url("/assets/img/icons/doc-vector.svg"); mask-image: url("/assets/img/icons/doc-vector.svg"); }
.icon-export { -webkit-mask-image: url("/assets/img/icons/export.svg"); mask-image: url("/assets/img/icons/export.svg"); }
.icon-plus { -webkit-mask-image: url("/assets/img/icons/plus.svg"); mask-image: url("/assets/img/icons/plus.svg"); }
.icon-filter { -webkit-mask-image: url("/assets/img/icons/filter.svg"); mask-image: url("/assets/img/icons/filter.svg"); }
.icon-refresh { -webkit-mask-image: url("/assets/img/icons/action-refresh.svg"); mask-image: url("/assets/img/icons/action-refresh.svg"); }
.icon-download { -webkit-mask-image: url("/assets/img/icons/action-download.svg"); mask-image: url("/assets/img/icons/action-download.svg"); }
.icon-info { -webkit-mask-image: url("/assets/img/icons/info.svg"); mask-image: url("/assets/img/icons/info.svg"); }
.icon-check-circle { -webkit-mask-image: url("/assets/img/icons/check-circle.svg"); mask-image: url("/assets/img/icons/check-circle.svg"); }
.icon-chevron { -webkit-mask-image: url("/assets/img/icons/chevron.svg"); mask-image: url("/assets/img/icons/chevron.svg"); }

.icon-overview { -webkit-mask-image: url("/assets/img/icons/nav-overview.svg"); mask-image: url("/assets/img/icons/nav-overview.svg"); }
.icon-tasks { -webkit-mask-image: url("/assets/img/icons/nav-tasks.svg"); mask-image: url("/assets/img/icons/nav-tasks.svg"); }
.icon-logs { -webkit-mask-image: url("/assets/img/icons/nav-logs.svg"); mask-image: url("/assets/img/icons/nav-logs.svg"); }
.icon-algorithms { -webkit-mask-image: url("/assets/img/icons/nav-algorithms.svg"); mask-image: url("/assets/img/icons/nav-algorithms.svg"); }
.icon-arch { -webkit-mask-image: url("/assets/img/icons/nav-arch.svg"); mask-image: url("/assets/img/icons/nav-arch.svg"); }
.icon-keys { -webkit-mask-image: url("/assets/img/icons/nav-keys.svg"); mask-image: url("/assets/img/icons/nav-keys.svg"); }
.icon-team { -webkit-mask-image: url("/assets/img/icons/nav-team.svg"); mask-image: url("/assets/img/icons/nav-team.svg"); }
.icon-storage { -webkit-mask-image: url("/assets/img/icons/file-ledger.svg"); mask-image: url("/assets/img/icons/file-ledger.svg"); }
.icon-settings { -webkit-mask-image: url("/assets/img/icons/nav-settings.svg"); mask-image: url("/assets/img/icons/nav-settings.svg"); }
.icon-help { -webkit-mask-image: url("/assets/img/icons/nav-help.svg"); mask-image: url("/assets/img/icons/nav-help.svg"); }
.icon-feedback { -webkit-mask-image: url("/assets/img/icons/nav-feedback.svg"); mask-image: url("/assets/img/icons/nav-feedback.svg"); }

.icon-auth-user { -webkit-mask-image: url("/assets/img/icons/auth-user.svg"); mask-image: url("/assets/img/icons/auth-user.svg"); }
.icon-auth-mail { -webkit-mask-image: url("/assets/img/icons/auth-mail.svg"); mask-image: url("/assets/img/icons/auth-mail.svg"); }
.icon-auth-lock { -webkit-mask-image: url("/assets/img/icons/auth-lock.svg"); mask-image: url("/assets/img/icons/auth-lock.svg"); }
.icon-auth-eye { -webkit-mask-image: url("/assets/img/icons/auth-eye.svg"); mask-image: url("/assets/img/icons/auth-eye.svg"); }
.icon-auth-eye-off { -webkit-mask-image: url("/assets/img/icons/auth-eye-off.svg"); mask-image: url("/assets/img/icons/auth-eye-off.svg"); }
.icon-auth-team { -webkit-mask-image: url("/assets/img/icons/auth-team.svg"); mask-image: url("/assets/img/icons/auth-team.svg"); }

/* ---------- shell ---------- */

.app-shell {
    display: flex;
    min-height: 100vh;
    background: #FFFFFF;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 30;
    display: flex;
    flex-direction: column;
    width: var(--sidebar-width);
    background: #FFFFFF;
    border-right: 1px solid var(--border);
}

.brand-row {
    display: flex;
    align-items: center;
    gap: 8px;
    height: var(--topbar-height);
    padding: 0 16px;
    flex: none;
}

.brand-logo {
    width: 24px;
    height: 24px;
    flex: none;
    object-fit: contain;
}

.brand-name {
    color: var(--ink);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.version-badge {
    display: inline-flex;
    align-items: center;
    height: 20px;
    margin-left: 2px;
    padding: 0 6px;
    border-radius: var(--radius-sm);
    background: var(--primary-soft);
    color: var(--primary);
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    flex: none;
}

.nav {
    flex: 1;
    min-height: 0;
    padding: 8px 12px 16px;
    overflow-y: auto;
    scrollbar-width: thin;
}

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

.nav-group:first-child {
    margin-top: 0;
}

.nav-group-label {
    padding: 8px 8px 6px;
    color: var(--muted-2);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.04em;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 36px;
    padding: 0 10px;
    border-radius: var(--radius);
    color: var(--ink-2);
    font-size: 13px;
    font-weight: 500;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.nav-item + .nav-item {
    margin-top: 4px;
}

.nav-item .nav-icon {
    color: var(--muted);
}

.nav-item:hover {
    background: var(--bg-soft);
    color: var(--ink);
}

.nav-item.is-active {
    background: var(--primary-soft);
    color: var(--primary);
}

.nav-item.is-active .nav-icon {
    color: var(--primary);
}

.nav-item.is-locked {
    color: var(--muted-2);
    cursor: not-allowed;
}

.nav-item.is-locked .nav-icon {
    color: var(--muted-2);
    opacity: 0.7;
}

.nav-label {
    white-space: nowrap;
}

.sidebar-footer {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    flex: none;
}

.side-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-soft);
}

.side-link {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-soft);
    color: var(--ink-2);
    font-size: 13px;
    font-weight: 500;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.side-link .nav-icon {
    color: var(--muted);
}

.side-link:hover {
    border-color: var(--border-strong);
    background: #FFFFFF;
    color: var(--ink);
}

.side-link-label {
    white-space: nowrap;
}

.plan-row {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.plan-label {
    color: var(--ink-2);
    font-size: 12px;
    font-weight: 500;
}

.plan-value {
    min-width: 0;
    color: var(--muted);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.plan-bar {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    border: 0;
    border-radius: 3px;
    background: var(--divider);
    overflow: hidden;
}

.plan-bar::-webkit-progress-bar {
    border-radius: 3px;
    background: var(--divider);
}

.plan-bar::-webkit-progress-value {
    border-radius: 3px;
    background: var(--primary);
}

.plan-bar::-moz-progress-bar {
    border-radius: 3px;
    background: var(--primary);
}

.user-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 6px;
    border-radius: var(--radius);
    color: inherit;
}

.user-row:hover,
.user-row.is-active {
    background: var(--bg-soft);
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex: none;
    background: var(--primary-soft);
}

.user-meta {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 2px;
}

.user-meta strong {
    color: var(--ink);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-meta small {
    color: var(--muted-2);
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.main-shell {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
    min-height: 100vh;
    margin-left: var(--sidebar-width);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    height: calc(var(--topbar-height) + 1px);
    padding: 0 24px;
    background: #FFFFFF;
    border-bottom: 1px solid var(--border);
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    font-size: 13px;
}

.crumb-brand {
    color: var(--muted-2);
}

.crumb-sep {
    width: 12px;
    height: 12px;
    background-color: var(--muted-2);
    -webkit-mask: url("/assets/img/icons/chevron.svg") center / contain no-repeat;
    mask: url("/assets/img/icons/chevron.svg") center / contain no-repeat;
}

.crumb-current {
    color: var(--ink);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: none;
}

.topbar-search {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 230px;
    height: 32px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-soft);
    color: var(--muted);
    cursor: not-allowed;
}

.topbar-search .icon {
    width: 16px;
    height: 16px;
    color: var(--muted);
}

.topbar-search input {
    width: 100%;
    min-width: 0;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 13px;
    outline: none;
    cursor: not-allowed;
}

.topbar-search input::placeholder {
    color: var(--muted-2);
}

.env-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 32px;
    padding: 0 12px 0 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #FFFFFF;
    color: var(--ink-2);
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}

.env-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green);
}

.env-local .env-dot { background: var(--amber); }
.env-staging .env-dot { background: var(--primary); }
.env-production .env-dot { background: var(--green); }

.icon-button {
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #FFFFFF;
    color: var(--ink-3);
}

.icon-button:hover,
.doc-button:hover,
.button-secondary:hover {
    background: var(--bg-soft);
}

.doc-button {
    height: 32px;
    padding: 0 12px 0 11px;
    font-size: 13px;
}

.content {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    padding: 24px;
}

/* ---------- buttons ---------- */

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 36px;
    padding: 0 16px 0 14px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    background: transparent;
    color: var(--ink-2);
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.button .icon {
    width: 16px;
    height: 16px;
}

.button-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #FFFFFF;
}

.button-primary .icon {
    color: #FFFFFF;
}

.button-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
}

.button-secondary {
    background: #FFFFFF;
    border-color: var(--border);
    color: var(--ink-2);
}

.button-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--ink-2);
}

.button-ghost:hover {
    background: var(--bg-soft);
}

.button-danger-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--red-ink);
}

.button-danger-ghost:hover {
    background: var(--red-soft);
}

.button-danger {
    background: #D92D20;
    border-color: #D92D20;
    color: #FFFFFF;
}

.button-danger:hover {
    background: #B42318;
    border-color: #B42318;
}

.button-sm,
.button-small {
    height: 32px;
    padding: 0 12px 0 11px;
    font-size: 13px;
}

.button-small {
    height: 28px;
    padding: 0 10px;
    font-size: 12px;
}

.button-block {
    width: 100%;
}

/* ---------- page header ---------- */

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    min-height: 67px;
}

.page-head h1 {
    color: var(--ink);
    font-size: 28px;
    font-weight: 700;
    line-height: 1.45;
    letter-spacing: -0.01em;
}

.page-sub {
    margin-top: 6px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.45;
}

.eyebrow {
    margin-bottom: 4px;
    color: var(--muted-2);
    font-size: 12px;
    font-weight: 500;
}

.page-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: none;
    padding-bottom: 2px;
}

/* ---------- cards ---------- */

.card {
    padding: 20px;
    border: 0;
    border-radius: var(--radius-lg);
    background: #FFFFFF;
    box-shadow: inset 0 0 0 1px var(--border), 0 1px 4px rgba(16, 24, 40, 0.05);
}

.content > [data-build-error]:empty {
    display: none;
}

.card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.card-head h2 {
    color: var(--ink);
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
}

.card-title {
    color: var(--ink);
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
}

.card-head p {
    margin-top: 4px;
    color: var(--muted-2);
    font-size: 13px;
    line-height: 1.5;
}

.card-head > .link {
    margin-top: 4px;
    flex: none;
}

.static-card h2 {
    color: var(--ink);
    font-size: 16px;
    font-weight: 600;
}

.static-card p {
    margin-top: 8px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.7;
}

.static-card code {
    padding: 1px 5px;
    border-radius: var(--radius-sm);
    background: var(--bg-soft);
    color: var(--ink-3);
    font-family: var(--mono);
    font-size: 12px;
}

.grid-two {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    align-items: start;
}

/* ---------- kpi ---------- */

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.kpi-card {
    display: flex;
    min-height: 144px;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: #FFFFFF;
}

.kpi-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.kpi-label {
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
}

.kpi-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius);
    flex: none;
}

.kpi-value-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    min-height: 39px;
}

.kpi-value {
    color: var(--ink);
    font-size: 30px;
    font-weight: 600;
    line-height: 1.3;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

.kpi-value small {
    margin-left: 2px;
    color: var(--ink-2);
    font-size: 18px;
    font-weight: 600;
}

.kpi-spark {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 36px;
    flex: none;
}

.kpi-spark span {
    display: block;
    width: 6px;
    min-height: 3px;
    border-radius: 3px;
    background: var(--primary);
    opacity: 0.95;
}

.kpi-spark span.lv-0 { height: 5px; }
.kpi-spark span.lv-1 { height: 8px; }
.kpi-spark span.lv-2 { height: 11px; }
.kpi-spark span.lv-3 { height: 14px; }
.kpi-spark span.lv-4 { height: 17px; }
.kpi-spark span.lv-5 { height: 20px; }
.kpi-spark span.lv-6 { height: 23px; }
.kpi-spark span.lv-7 { height: 26px; }
.kpi-spark span.lv-8 { height: 30px; }

.kpi-spark.spark-green span { background: var(--green); }
.kpi-spark.spark-cyan span { background: var(--cyan); }
.kpi-spark.spark-amber span { background: var(--amber); }

.kpi-foot {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: auto;
    font-size: 12px;
    line-height: 1.4;
}

.kpi-foot .delta {
    color: var(--green-ink);
    font-weight: 500;
}

.kpi-foot .delta.is-warn {
    color: var(--amber-ink);
}

.kpi-foot .delta.is-danger {
    color: var(--red-ink);
}

.kpi-foot .note {
    color: var(--muted-2);
}

/* ---------- tables ---------- */

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.data-table thead th {
    padding: 9px 16px;
    background: var(--table-head);
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
    text-align: left;
    white-space: nowrap;
}

.data-table thead th:first-child {
    border-radius: var(--radius) 0 0 var(--radius);
}

.data-table thead th:last-child {
    border-radius: 0 var(--radius) var(--radius) 0;
}

.data-table tbody td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--divider);
    color: var(--ink-2);
    font-size: 13px;
    vertical-align: middle;
}

.data-table tbody tr:last-child td {
    border-bottom: 0;
}

.data-table tbody tr:hover {
    background: var(--bg-soft);
}

.data-table .cell-right {
    text-align: right;
    white-space: nowrap;
}

.data-table a {
    color: var(--ink);
}

.data-table a:hover strong {
    color: var(--primary);
}

.cell-task {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    min-width: 0;
}

.cell-task strong {
    color: var(--ink);
    font-size: 13px;
    font-weight: 600;
    transition: color 0.15s ease;
}

.cell-task small {
    color: var(--muted-2);
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: -0.01em;
}

.data-table .tag {
    white-space: nowrap;
}

/* ---------- task list ---------- */

.task-list {
    display: flex;
    flex-direction: column;
}

.task-row {
    display: grid;
    grid-template-columns: 15px minmax(0, 1fr) 280px;
    column-gap: 12px;
    align-items: center;
    padding: 15px 4px;
    border-bottom: 1px solid var(--divider);
}

.task-row:first-child {
    padding-top: 4px;
}

.task-row:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.task-row.is-selected {
    background: var(--primary-tint);
}

.task-bar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-left: auto;
    align-self: center;
}

.task-select-all,
.task-select {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
    white-space: nowrap;
    cursor: pointer;
}

.task-select {
    gap: 0;
    align-self: start;
    justify-self: center;
    margin-top: 2px;
}

.task-select-all input,
.task-select input {
    width: 15px;
    height: 15px;
    margin: 0;
    accent-color: var(--primary);
    cursor: pointer;
}

.task-bulk {
    display: flex;
    align-items: center;
    gap: 8px;
}

.task-bulk-count {
    color: var(--ink-2);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.task-row-main {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.task-row-head {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    min-width: 0;
}

.task-name {
    color: var(--ink);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    overflow-wrap: anywhere;
    transition: color 0.15s ease;
}

a.task-name:hover {
    color: var(--primary);
}

.task-row-sub {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    color: var(--muted-2);
    font-size: 12px;
    line-height: 1.5;
    font-variant-numeric: tabular-nums;
}

.task-row-sub .mono {
    color: var(--muted);
    font-size: 11px;
}

.task-sep {
    color: var(--border-strong);
}

.task-params {
    display: flex;
    align-items: stretch;
    min-height: 24px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-soft);
    overflow: hidden;
}

.task-params-item {
    display: flex;
    align-items: center;
    gap: 5px;
    flex: 1 1 auto;
    min-width: 0;
    padding: 2px 10px;
}

.task-params-item + .task-params-item {
    border-left: 1px solid var(--border);
}

.task-params-label {
    flex: none;
    color: var(--muted-2);
    font-size: 10px;
    line-height: 1.3;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.task-params-value {
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
    overflow: hidden;
    color: var(--ink-2);
    font-size: 11px;
    font-weight: 500;
    line-height: 1.3;
    white-space: nowrap;
}

.task-params-text {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.task-params-value .tag {
    flex: none;
    min-height: 16px;
    padding: 0 5px;
    font-size: 10px;
    line-height: 16px;
}

.task-params-value .density-bars {
    flex: none;
    height: 12px;
}

.task-params-pending {
    color: var(--muted-2);
    font-weight: 400;
}

.task-params-empty {
    color: var(--muted-2);
    font-size: 12px;
}

.task-row-side {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}

.task-side-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.task-side-label {
    color: var(--muted-2);
    font-size: 11px;
    letter-spacing: 0.02em;
}

.task-latest-line {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.task-latest-id {
    color: var(--muted-2);
    font-size: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.task-latest-empty {
    color: var(--muted-2);
    font-size: 13px;
}

.task-latest-meta {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
    font-variant-numeric: tabular-nums;
}

@media (max-width: 1180px) {
    .task-row {
        grid-template-columns: 15px minmax(0, 1fr) 276px;
        column-gap: 10px;
    }

    .task-params-item {
        gap: 3px;
        padding: 2px 4px;
    }

    .task-params .task-params-tag-extra {
        display: none;
    }
}

@media (max-width: 820px) {
    .task-row {
        grid-template-columns: 15px minmax(0, 1fr);
        column-gap: 10px;
        row-gap: 12px;
        padding: 14px 2px;
    }

    .task-select {
        align-self: start;
        margin-top: 3px;
    }

    .task-row-side {
        grid-column: 2;
        padding-top: 10px;
        border-top: 1px dashed var(--divider);
    }
}

@media (max-width: 520px) {
    .task-bar-actions {
        width: 100%;
        margin-left: 0;
        justify-content: space-between;
    }

    .task-params {
        display: grid;
        grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
    }

    .task-params-item {
        gap: 4px;
        padding: 3px 6px;
    }

    .task-params-item:first-child {
        grid-column: 1 / -1;
        border-bottom: 1px solid var(--border);
    }

    .task-params-item:nth-child(2) {
        border-left: 0;
    }

    .task-params-item:nth-child(3) {
        border-left: 1px solid var(--border);
    }

    .task-params .task-params-extra {
        display: none;
    }
}

.card-table .card-head {
    margin-bottom: 16px;
}

/* ---------- tags / chips ---------- */

.tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 20px;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    background: #F2F4F7;
    color: var(--ink-3);
    font-size: 11px;
    font-weight: 500;
    line-height: 1.35;
    white-space: nowrap;
}

.tag-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex: none;
}

.tag-success { background: var(--green-soft); color: var(--green-ink); }
.tag-green { background: var(--green-soft); color: var(--green-ink); }
.tag-danger { background: var(--red-soft); color: var(--red-ink); }
.tag-warning { background: var(--amber-soft); color: var(--amber-ink); }
.tag-info { background: var(--primary-soft); color: var(--primary); }
.tag-cyan { background: var(--cyan-soft); color: var(--cyan-ink); }
.tag-purple { background: var(--purple-soft); color: var(--purple); }
.tag-muted { background: #F2F4F7; color: var(--ink-3); }
.tag-xs { padding: 1px 7px; font-size: 11px; }

/* ---------- matrix ---------- */

.matrix-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.matrix-legend {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: none;
}

.matrix-table {
    width: 100%;
    margin-top: 14px;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
}

.matrix-table thead th {
    padding: 9px 16px;
    background: var(--table-head);
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
    text-align: left;
    white-space: nowrap;
}

.matrix-table thead th:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.matrix-table thead th:last-child { border-radius: 0 var(--radius) var(--radius) 0; }

.matrix-table tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--ink-3);
    line-height: 1.45;
}

.matrix-table tbody tr:first-child td { border-top: 1px solid var(--border); }
.matrix-table tbody tr:last-child td { border-bottom: 1px solid var(--border); }

.matrix-table tbody tr.row-p1 { background: var(--primary-tint); }
.matrix-table tbody tr.row-p3 { background: #F0FDF9; }

.matrix-level {
    display: flex;
    align-items: center;
    gap: 8px;
}

.level-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 31px;
    height: 20px;
    padding: 0 8px;
    border-radius: var(--radius-sm);
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 600;
}

.level-p0 { background: #F2F4F7; color: var(--ink-3); }
.level-p1 { background: var(--primary-soft); color: var(--primary); }
.level-p2 { background: var(--red-soft); color: var(--red-ink); }
.level-p3 { background: var(--green-soft); color: var(--green-ink); }

.matrix-level strong {
    color: var(--ink-2);
    font-size: 13px;
    font-weight: 400;
}

.row-p1 .matrix-level strong,
.row-p3 .matrix-level strong {
    color: var(--ink);
    font-weight: 500;
}

.row-p2 td {
    color: var(--muted-2);
}

.matrix-table .is-strong {
    color: var(--ink);
    font-weight: 500;
}

.matrix-table .is-green {
    color: var(--green-ink);
    font-weight: 500;
}

.matrix-warning {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: 12px;
    padding: 12px 16px;
    border-radius: var(--radius);
    background: var(--amber-soft);
    color: var(--amber-ink);
    font-size: 12px;
    line-height: 1.6;
}

.matrix-warning .icon {
    width: 14px;
    height: 14px;
    margin-top: 2px;
    flex: none;
}

/* ---------- overview bottom ---------- */

.overview-bottom {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 400px;
    gap: 20px;
    align-items: start;
}

.threat-model .card-head {
    display: block;
}

.threat-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 14px;
}

.threat {
    padding: 12px 14px;
    border-radius: var(--radius);
    background: var(--bg-soft);
}

.threat-a { background: var(--red-soft); }
.threat-b { background: var(--green-soft); }
.threat-c { background: #F2F4F7; }

.threat-head {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.threat-head strong {
    color: var(--ink);
    font-size: 13px;
    font-weight: 600;
}

.threat p {
    margin-top: 6px;
    color: var(--ink-3);
    font-size: 12px;
    line-height: 1.65;
}

.threat-a p { color: #912018; }
.threat-b p { color: #05603A; }
.threat-c p { color: var(--ink-3); }

/* ---------- algorithms ---------- */

.algo-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.tabs {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    padding: 0 14px 0 13px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #FFFFFF;
    color: var(--ink-2);
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.tab:hover {
    background: var(--bg-soft);
}

.tab.is-active {
    background: var(--ink);
    border-color: var(--ink);
    color: #FFFFFF;
}

.algo-filter-panel {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 12px;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-soft);
}

.algo-filter-panel .checkbox-row {
    min-height: 24px;
    color: var(--ink-2);
    font-size: 13px;
}

.algo-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-top: 16px;
}

.algo-card {
    display: flex;
    min-height: 167px;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: #FFFFFF;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.algo-card:hover {
    border-color: #C9D3E0;
    box-shadow: var(--shadow-sm);
}

.algo-card.is-unavailable {
    background: var(--bg-soft);
}

.algo-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 20px;
}

.badge {
    display: inline-flex;
    align-items: center;
    height: 20px;
    padding: 0 8px 0 7px;
    border-radius: var(--radius-sm);
    background: var(--primary-soft);
    color: var(--primary);
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.badge.badge-optimizer {
    background: var(--cyan-soft);
    color: var(--cyan-ink);
}

.badge.badge-arch {
    background: var(--purple-soft);
    color: var(--purple);
}

.algo-head .tag {
    min-height: 20px;
    padding: 2px 8px;
    font-size: 11px;
}

.algo-card h3 {
    color: var(--ink);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.45;
}

.algo-desc {
    display: -webkit-box;
    overflow: hidden;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.55;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.algo-params {
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-soft);
}

.algo-params summary {
    color: var(--muted);
    font-size: 12px;
    cursor: pointer;
}

.algo-params .tech-list {
    grid-template-columns: 1fr;
    margin-top: 8px;
}

.algo-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: auto;
    min-height: 20px;
}

.algo-overhead {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--green-ink);
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.algo-overhead .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.algo-overhead.tone-low { color: var(--green-ink); }
.algo-overhead.tone-medium { color: var(--amber-ink); }
.algo-overhead.tone-high { color: var(--red-ink); }
.algo-overhead.tone-muted { color: var(--muted-2); }

.algo-usage {
    color: var(--muted-2);
    font-size: 12px;
    white-space: nowrap;
}

.algo-hint {
    margin-top: 12px;
    color: var(--muted-2);
    font-size: 12px;
}

.arch-section {
    margin-top: 0;
}

.arch-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-top: 16px;
}

.arch-card {
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: #FFFFFF;
}

.arch-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.arch-head strong {
    color: var(--ink);
    font-size: 13px;
    font-weight: 600;
}

.arch-count {
    color: var(--green-ink);
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.arch-card p {
    margin-top: 8px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.55;
}

.arch-usage {
    display: block;
    margin-top: 8px;
    color: var(--muted-2);
    font-size: 11px;
}

/* ---------- build detail ---------- */

.build-hero {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 18px;
}

.build-hero-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.build-title-block {
    min-width: 0;
    flex: 1;
}

.build-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.build-title-row .tag {
    min-height: 22px;
    padding: 3px 9px 3px 8px;
    line-height: 16px;
}

.build-title {
    color: var(--ink);
    font-size: 20px;
    font-weight: 600;
    line-height: 29px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.build-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    color: var(--muted);
    font-size: 12px;
    line-height: 17px;
    word-break: break-word;
}

.build-buildid {
    flex: none;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 12px;
    line-height: 16px;
    letter-spacing: -0.01em;
}

.build-meta-text {
    min-width: 0;
}

.build-head-side {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    flex: none;
}

.build-stats {
    display: flex;
    align-items: flex-start;
    gap: 28px;
    flex: none;
}

.build-stat {
    display: flex;
    flex-direction: column;
    gap: 3px;
    align-items: flex-end;
    text-align: right;
}

.build-stat-label {
    color: var(--muted-2);
    font-size: 11px;
    line-height: 16px;
}

.build-stat-value {
    color: var(--ink);
    font-family: var(--mono);
    font-size: 14px;
    font-weight: 500;
    line-height: 18px;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.divider {
    height: 1px;
    background: var(--divider);
}

.build-attrs-row {
    display: flex;
    align-items: flex-start;
    gap: 28px;
}

.build-attrs {
    display: flex;
    align-items: flex-start;
    gap: 28px;
    flex: 1;
    flex-wrap: wrap;
    min-width: 0;
}

.build-attr {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.build-attr-label {
    color: var(--muted-2);
    font-size: 11px;
    line-height: 16px;
}

.build-attr-value {
    color: var(--ink-2);
    font-size: 13px;
    font-weight: 600;
    line-height: 19px;
    word-break: break-word;
}

.build-attr-value.is-green { color: var(--green-ink); }
.build-attr-value.is-primary { color: var(--primary); }

.build-inline-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding-top: 3px;
}

.build-inline-actions:empty {
    display: none;
}

.build-extra-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex: none;
    height: 16px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--muted-2);
    font-size: 11px;
    line-height: 16px;
    white-space: nowrap;
}

.build-extra-toggle:hover {
    color: var(--ink-3);
}

.build-extra-toggle .icon {
    width: 12px;
    height: 12px;
    transition: transform 0.15s ease;
}

.build-extra-toggle.is-open .icon {
    transform: rotate(90deg);
}

.build-extra-panel {
    padding-top: 12px;
    border-top: 1px dashed var(--divider);
}

.build-extra-panel .meta-list {
    margin-top: 0;
}

.build-extra {
    border-top: 1px dashed var(--divider);
    padding-top: 10px;
}

.build-extra > summary {
    color: var(--muted-2);
    font-size: 12px;
    cursor: pointer;
    list-style: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    user-select: none;
}

.build-extra > summary::-webkit-details-marker {
    display: none;
}

.build-extra > summary::before {
    content: "";
    width: 10px;
    height: 10px;
    background-color: currentColor;
    -webkit-mask: url("/assets/img/icons/chevron.svg") center / contain no-repeat;
    mask: url("/assets/img/icons/chevron.svg") center / contain no-repeat;
    transition: transform 0.15s ease;
}

.build-extra[open] > summary::before {
    transform: rotate(90deg);
}

.build-extra .meta-list {
    margin-top: 12px;
}

/* pipeline */

.pipeline-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px;
}

.pipeline-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.pipeline-head .tag {
    min-height: 22px;
    padding: 3px 9px 3px 8px;
    line-height: 16px;
}

.pipeline-head h2 {
    color: var(--ink);
    font-size: 15px;
    font-weight: 600;
    line-height: 22px;
}

.pipeline-head .pipeline-sub {
    margin-top: 3px;
    color: var(--muted-2);
    font-size: 11px;
    line-height: 14px;
    font-family: var(--mono);
    letter-spacing: -0.01em;
}

.pipeline-scroll {
    overflow-x: auto;
}

.pipeline-stages {
    display: flex;
    align-items: stretch;
    width: 100%;
}

.pipeline-stage {
    display: flex;
    flex: 0 1 173px;
    width: 173px;
    min-width: 165px;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 14px;
    border: 0;
    border-radius: var(--radius-lg);
    background: #FFFFFF;
    box-shadow: inset 0 0 0 1px var(--border), 0 1px 4px rgba(16, 24, 40, 0.05);
    text-align: center;
}

.stage-arrow {
    display: grid;
    place-items: center;
    width: 18px;
    flex: none;
    color: var(--muted-2);
}

.stage-arrow .icon {
    width: 12px;
    height: 12px;
}

.stage-badge {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-lg);
    font-family: var(--mono);
    font-size: 13px;
    font-weight: 600;
}

.stage-badge.s1 { background: var(--primary-soft); color: var(--primary); }
.stage-badge.s2 { background: var(--cyan-soft); color: var(--cyan-ink); }
.stage-badge.s3 { background: var(--green-soft); color: var(--green-ink); }
.stage-badge.s4 { background: var(--amber-soft); color: var(--amber-ink); }
.stage-badge.s5 { background: var(--purple-soft); color: var(--purple); }
.stage-badge.s6 { background: var(--pink-soft); color: var(--pink); }

.pipeline-stage .stage-name {
    color: var(--ink);
    font-size: 13px;
    font-weight: 600;
    line-height: 19px;
}

.pipeline-stage .stage-desc {
    color: var(--muted);
    font-size: 11px;
    line-height: 16px;
}

.pipeline-stage .stage-duration {
    color: var(--muted-2);
    font-family: var(--mono);
    font-size: 11px;
    line-height: 14px;
    letter-spacing: -0.01em;
}

.pipeline-stage .stage-chip {
    height: 20px;
    padding: 2px 8px 2px 7px;
    line-height: 16px;
}

.pipeline-note {
    color: var(--muted-2);
    font-size: 11px;
    line-height: 1.6;
}

/* build bottom */

.build-bottom {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 400px;
    gap: 20px;
    align-items: start;
}

.build-left,
.build-right {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

.build-right {
    gap: 20px;
}

.ledger-card,
.artifact-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
}

.ledger-card {
    min-height: 316px;
}

.artifact-card {
    min-height: 194px;
}

.log-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 20px;
}

.build-right .log-card {
    flex: 1;
    min-height: 388px;
}

.ledger-head,
.artifact-head,
.log-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.ledger-head .tag,
.artifact-head .tag,
.log-head .tag {
    min-height: 22px;
    padding: 3px 9px 3px 8px;
    line-height: 16px;
}

.ledger-head h2,
.artifact-head h2,
.log-head h2 {
    color: var(--ink);
    font-size: 15px;
    font-weight: 600;
    line-height: 22px;
}

.ledger-head p,
.artifact-head p,
.log-head p {
    margin-top: 3px;
    color: var(--muted-2);
    font-size: 11px;
    line-height: 16px;
}

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

.ledger-col-head,
.ledger-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 90px 130px;
    gap: 12px;
    align-items: center;
}

.ledger-col-head {
    height: 16px;
    color: var(--muted-2);
    font-size: 11px;
    line-height: 16px;
}

.ledger-col-head span:nth-child(2) {
    text-align: center;
}

.ledger-col-head span:nth-child(3) {
    text-align: right;
}

.ledger-row {
    height: 20px;
    color: var(--ink-2);
    font-size: 13px;
    line-height: 19px;
}

.ledger-row .skeleton-line {
    height: 12px;
    margin: 0;
}

.ledger-row .ledger-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ledger-chip {
    width: 90px;
    height: 20px;
    padding: 2px 8px 2px 7px;
    justify-content: center;
    font-size: 11px;
    line-height: 16px;
}

.ledger-row .ledger-value {
    color: var(--ink);
    font-family: var(--mono);
    font-size: 13px;
    line-height: 17px;
    font-variant-numeric: tabular-nums;
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ledger-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 30px;
    padding-top: 8px;
    color: var(--muted-2);
    font-size: 11px;
    line-height: 16px;
}

.ledger-foot > span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.link-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 22px;
    padding: 3px 9px 3px 8px;
    border: 0;
    border-radius: var(--radius-sm);
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 11px;
    font-weight: 500;
    line-height: 16px;
    white-space: nowrap;
}

.link-chip:hover {
    background: #E0EAFF;
}

.link-chip:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.artifact-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.file-row {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 36px;
    padding: 0;
}

.file-row + .file-row {
    border-top: 0;
}

.file-icon {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: var(--radius);
    flex: none;
}

.file-icon.is-primary { background: var(--primary-soft); }
.file-icon.is-green { background: var(--green-soft); }
.file-icon.is-amber { background: var(--amber-soft); }
.file-icon img { width: 14px; height: 14px; }

.file-meta {
    display: flex;
    min-width: 0;
    flex: 1;
    flex-direction: column;
    gap: 3px;
}

.file-meta strong {
    color: var(--ink);
    font-family: var(--mono);
    font-size: 13px;
    font-weight: 500;
    line-height: 17px;
    letter-spacing: -0.01em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-meta small {
    color: var(--muted-2);
    font-size: 11px;
    line-height: 16px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-meta .hash {
    font-family: var(--mono);
    letter-spacing: -0.01em;
}

.file-size {
    color: var(--ink-3);
    font-family: var(--mono);
    font-size: 13px;
    line-height: 17px;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.file-row .button {
    flex: none;
    height: 29px;
    padding: 6px 12px 6px 10px;
    border-radius: var(--radius);
    font-size: 12px;
    font-weight: 500;
    line-height: 1;
    gap: 5px;
}

.hash-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--divider);
    color: var(--muted-2);
    font-size: 11px;
}

.hash-row .hash {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: var(--mono);
    color: var(--muted);
}

.plan-details {
    margin-top: 8px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-soft);
}

.plan-details .plan-summary {
    margin: 0;
}

.log-box {
    max-height: 340px;
    min-height: 276px;
    overflow: auto;
    margin: 0;
    padding: 14px;
    border-radius: var(--radius);
    background: #0C111D;
    color: #D0D5DD;
    font-family: var(--mono);
    font-size: 11px;
    line-height: 1.85;
    letter-spacing: -0.01em;
    white-space: pre-wrap;
    word-break: break-word;
    scrollbar-width: thin;
}

.log-box:empty {
    display: none;
}

.build-right .log-box {
    display: flex;
    flex-direction: column;
    gap: 5px;
    height: 276px;
    min-height: 276px;
    max-height: 276px;
    white-space: normal;
}

.log-line {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    min-width: 0;
}

.log-time {
    min-width: 53px;
    flex: none;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 11px;
    line-height: 16px;
    letter-spacing: -0.01em;
}

.log-msg {
    min-width: 0;
    flex: 1;
    color: #D0D5DD;
    font-family: var(--font);
    font-size: 11px;
    line-height: 16px;
    white-space: pre-wrap;
    word-break: break-word;
}

.log-line.is-warn .log-msg {
    color: #FDB022;
}

.log-line.is-success .log-msg {
    color: #32D583;
}

.build-right .log-actions {
    min-height: 22px;
}

.log-actions {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    flex-wrap: wrap;
}

.log-actions .log-meta {
    color: var(--muted-2);
    font-size: 11px;
    line-height: 16px;
}

.log-actions .log-actions-right {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.log-live {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--muted-2);
    font-size: 11px;
    line-height: 16px;
}

.log-live .tag-dot {
    background: var(--green);
}

.notice {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 118px;
    padding: 14px;
    border: 0;
    border-radius: var(--radius-lg);
    background: var(--amber-soft);
    box-shadow: inset 0 0 0 1px #FCD99E;
}

.notice h2 {
    color: var(--amber-ink);
    font-size: 12px;
    font-weight: 600;
    line-height: 17px;
}

.notice p {
    color: var(--amber-ink);
    font-size: 11px;
    line-height: 16px;
}

.notice-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.notice .button-secondary {
    height: 29px;
    padding: 6px 12px 6px 10px;
    border-color: #FCD99E;
    background: #FFFFFF;
    color: var(--amber-ink);
    font-size: 12px;
    line-height: 1;
}

.notice .button-secondary:hover {
    background: #FFFCF5;
}

/* ---------- banners ---------- */

.banner {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    flex-wrap: wrap;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-soft);
    color: var(--ink-3);
    font-size: 13px;
    line-height: 1.55;
}

.banner strong {
    font-weight: 600;
}

.banner-info {
    border-color: #B2CCFF;
    background: var(--primary-soft);
    color: #0B3A9E;
}

.banner-warning {
    border-color: var(--amber-border);
    background: var(--amber-soft);
    color: var(--amber-ink);
}

.banner-danger {
    border-color: #FECDCA;
    background: var(--red-soft);
    color: var(--red-ink);
}

/* ---------- state / empty ---------- */

.state-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 20px;
    border: 1px dashed var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-soft);
}

.state-card h2 {
    color: var(--ink);
    font-size: 15px;
    font-weight: 600;
}

.state-card p {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.65;
}

.state-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.state-disabled {
    background: var(--bg-soft);
}

.state-error {
    border-color: #FECDCA;
    background: var(--red-soft);
}

.state-error h2 {
    color: var(--red-ink);
}

.state-error p {
    color: #912018;
}

.state-warning {
    border-color: var(--amber-border);
    background: var(--amber-soft);
}

.state-warning h2 {
    color: var(--amber-ink);
}

.state-danger {
    border-color: #FECDCA;
    background: var(--red-soft);
}

.state-danger h2 {
    color: var(--red-ink);
}

.state-neutral {
    background: #FFFFFF;
}

.state-note {
    color: var(--ink-3) !important;
    font-size: 12px !important;
}

.request-id {
    display: inline-block;
    margin-top: 2px;
    color: var(--muted-2);
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: -0.01em;
}

/* ---------- forms ---------- */

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.field > label {
    color: var(--ink-2);
    font-size: 13px;
    font-weight: 500;
}

.field input[type="text"],
.field input[type="password"],
.field input[type="number"],
.field input[type="file"],
.field select,
.field textarea {
    width: 100%;
    height: 38px;
    padding: 0 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: #FFFFFF;
    color: var(--ink);
    font-size: 13px;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input[type="file"] {
    height: auto;
    padding: 8px 10px;
    color: var(--ink-3);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(22, 93, 255, 0.12);
}

.field input::placeholder {
    color: var(--muted-2);
}

.field-hint,
.form-help {
    color: var(--muted-2);
    font-size: 12px;
    line-height: 1.6;
}

.field-full {
    grid-column: 1 / -1;
}

.params-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.versions {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    min-height: 38px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-soft);
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--ink-2);
    font-size: 13px;
    line-height: 1.5;
    cursor: pointer;
}

.checkbox-row input[type="checkbox"] {
    width: 15px;
    height: 15px;
    margin: 0;
    accent-color: var(--primary);
}

.form-error {
    margin-top: 12px;
    padding: 10px 12px;
    border: 1px solid #FECDCA;
    border-radius: var(--radius);
    background: var(--red-soft);
    color: var(--red-ink);
    font-size: 12px;
    line-height: 1.6;
}

.form-error .request-id {
    color: #B42318;
    opacity: 0.8;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 16px;
}

.form-card {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.form-section {
    padding-top: 16px;
    border-top: 1px solid var(--divider);
}

.form-section-head h2 {
    color: var(--ink);
    font-size: 15px;
    font-weight: 600;
}

.form-section-head p {
    margin-top: 4px;
    color: var(--muted-2);
    font-size: 12px;
}

.filter-bar {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--divider);
}

.filter {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter > span {
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
}

.filter select {
    height: 32px;
    padding: 0 28px 0 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #FFFFFF;
    color: var(--ink-2);
    font-size: 12px;
    outline: none;
}

.filter select:focus {
    border-color: var(--primary);
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--divider);
}

.pagination-info {
    color: var(--muted-2);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.meta-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 24px;
    margin-top: 16px;
}

.meta-list > div {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.meta-list dt {
    color: var(--muted-2);
    font-size: 11px;
}

.meta-list dd {
    color: var(--ink-2);
    font-size: 13px;
    line-height: 1.5;
    word-break: break-word;
}

.meta-list-compact {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 0;
}

.plan-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 20px;
}

.plan-summary > div {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.plan-summary dt {
    color: var(--muted-2);
    font-size: 11px;
}

.plan-summary dd {
    color: var(--ink-2);
    font-size: 12px;
}

.artifact-file {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-soft);
}

.file-glyph {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: var(--radius);
    background: var(--primary-soft);
    color: var(--primary);
    font-family: var(--mono);
    font-size: 10px;
    font-weight: 600;
}

.artifact-file-meta {
    display: flex;
    min-width: 0;
    flex: 1;
    flex-direction: column;
    gap: 2px;
}

.artifact-file-meta strong {
    color: var(--ink);
    font-size: 12px;
    font-weight: 500;
}

.artifact-file-meta small {
    color: var(--muted-2);
    font-size: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---------- skeleton ---------- */

.skeleton {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius);
    background: #F2F4F7;
}

.skeleton::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.75), transparent);
    animation: shimmer 1.4s infinite;
}

@keyframes shimmer {
    100% { transform: translateX(100%); }
}

.skeleton-line {
    display: block;
    height: 12px;
    margin: 8px 0;
}

.skeleton-line.w30 { width: 30%; }
.skeleton-line.w40 { width: 40%; }
.skeleton-line.w50 { width: 50%; }
.skeleton-line.w60 { width: 60%; }
.skeleton-line.w70 { width: 70%; }
.skeleton-line.w80 { width: 80%; }
.skeleton-line.w85 { width: 85%; }
.skeleton-line.w90 { width: 90%; }

.skeleton-value {
    width: 45%;
    height: 28px;
    margin: 14px 0 10px;
}

.skeleton-heading {
    display: inline-block;
    width: 220px;
    height: 30px;
    vertical-align: middle;
}

/* ---------- toast / dialog ---------- */

.toast-region {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: min(360px, calc(100vw - 32px));
    pointer-events: none;
}

.toast {
    padding: 11px 14px;
    border-radius: var(--radius-lg);
    background: var(--ink);
    color: #FFFFFF;
    font-size: 13px;
    line-height: 1.5;
    box-shadow: var(--shadow-lg);
    animation: toast-in 0.18s ease;
    pointer-events: auto;
}

.toast-warn {
    background: #B54708;
}

.toast-error {
    background: #B42318;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

.confirm-dialog {
    width: min(420px, calc(100vw - 32px));
    padding: 0;
    border: 0;
    border-radius: var(--radius-xl);
    background: #FFFFFF;
    color: var(--ink);
    box-shadow: var(--shadow-lg);
}

.confirm-dialog::backdrop {
    background: rgba(16, 24, 40, 0.45);
}

.confirm-body {
    padding: 22px;
}

.confirm-body h2 {
    color: var(--ink);
    font-size: 16px;
    font-weight: 600;
}

.confirm-body p {
    margin-top: 8px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.65;
}

.confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

/* ---------- auth ---------- */

.auth-body {
    background: #FFFFFF;
}

.auth-shell {
    display: grid;
    grid-template-columns: 600px minmax(0, 1fr);
    min-height: 100vh;
}

.auth-aside {
    background: #0C121D;
    color: #FFFFFF;
}

.auth-aside-inner {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 40px;
    min-height: 100vh;
    padding: 56px 64px;
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 11px;
}

.auth-brand-mark {
    width: 30px;
    height: 30px;
    flex: none;
    object-fit: contain;
}

.auth-brand-name {
    color: #FFFFFF;
    font-size: 19px;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.auth-brand-version {
    display: inline-flex;
    align-items: center;
    height: 20px;
    padding: 0 6px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.08);
    color: #94A3B8;
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}

.auth-pitch {
    max-width: 472px;
}

.auth-pitch .auth-kicker {
    margin-bottom: 12px;
    color: #64748B;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.12em;
}

.auth-pitch h2 {
    color: #FFFFFF;
    font-size: 32px;
    font-weight: 600;
    line-height: 1.45;
    letter-spacing: -0.01em;
}

.auth-pitch-sub {
    margin-top: 20px;
    color: #94A3B8;
    font-size: 14px;
    line-height: 1.6;
}

.auth-features {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 472px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.auth-feature {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.auth-feature-icon {
    width: 18px;
    height: 18px;
    flex: none;
    margin-top: 1px;
}

.auth-feature-text {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 4px;
}

.auth-feature-text strong {
    color: #E2E8F0;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.45;
}

.auth-feature-text small {
    color: #64748B;
    font-size: 12px;
    line-height: 1.45;
}

.auth-quote {
    max-width: 472px;
    margin: 0;
}

.auth-quote p {
    color: #94A3B8;
    font-size: 13px;
    line-height: 1.5;
}

.auth-quote cite {
    display: block;
    margin-top: 8px;
    color: #475569;
    font-size: 12px;
    font-style: normal;
}

.auth-main {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    min-height: 100vh;
    padding: 48px 40px;
    background: #FFFFFF;
}

.auth-panel {
    display: flex;
    width: min(400px, 100%);
    margin: auto 0;
    flex-direction: column;
}

body[data-page="register"] .auth-panel {
    width: min(420px, 100%);
}

.auth-mobile-brand {
    display: none;
    align-items: center;
    gap: 9px;
    margin-bottom: 32px;
    color: var(--ink);
    font-size: 16px;
    font-weight: 600;
}

.auth-head .auth-kicker {
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.04em;
}

.auth-head h1 {
    color: #101828;
    font-size: 28px;
    font-weight: 600;
    line-height: 1.45;
    letter-spacing: -0.01em;
}

.auth-head-sub {
    margin-top: 8px;
    color: #667085;
    font-size: 14px;
    line-height: 1.5;
}

.auth-form {
    display: flex;
    margin-top: 28px;
    flex-direction: column;
    gap: 18px;
}

.auth-field {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 6px;
}

.auth-label {
    color: #344054;
    font-size: 13px;
    font-weight: 500;
}

.auth-label-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.auth-inline-link {
    color: var(--primary);
    font-size: 12px;
    font-weight: 500;
}

.auth-inline-link:hover {
    text-decoration: underline;
}

.auth-optional {
    margin-left: 4px;
    color: var(--muted-2);
    font-size: 12px;
    font-weight: 400;
}

.auth-control {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 12px;
    border: 1px solid #E3E8ED;
    border-radius: var(--radius);
    background: #FFFFFF;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.auth-control:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(22, 93, 255, 0.12);
}

.auth-control input {
    width: 100%;
    min-width: 0;
    height: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    color: #101828;
    font-size: 14px;
    outline: none;
}

.auth-control input::placeholder {
    color: #98A2B3;
}

.auth-control-icon {
    width: 16px;
    height: 16px;
    flex: none;
    color: #98A2B3;
}

.auth-control:focus-within .auth-control-icon {
    color: var(--primary);
}

.auth-eye {
    display: inline-grid;
    place-items: center;
    width: 24px;
    height: 24px;
    padding: 0;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: #98A2B3;
    flex: none;
}

.auth-eye:hover {
    background: var(--bg-soft);
    color: var(--muted);
}

.auth-eye .icon {
    width: 16px;
    height: 16px;
}

.auth-code-button {
    flex: none;
    height: 28px;
    padding: 0 10px;
    border: 1px solid var(--primary);
    border-radius: var(--radius-sm);
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.auth-code-button:hover:not(:disabled) {
    background: #E8F0FF;
}

.auth-code-button:disabled {
    border-color: var(--border);
    background: var(--bg-soft);
    color: var(--muted-2);
    cursor: not-allowed;
}

.auth-submit {
    height: 44px;
    margin-top: 2px;
    font-size: 15px;
    font-weight: 500;
}

.auth-switch {
    margin: 0;
    color: #667085;
    font-size: 13px;
    text-align: center;
}

.auth-switch a {
    color: var(--primary);
    font-weight: 500;
}

.auth-agreement-block {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.auth-agreement {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: -2px;
    color: #475467;
    font-size: 12.5px;
    line-height: 1.65;
}

.auth-agreement input[type="checkbox"] {
    width: 15px;
    height: 15px;
    margin: 2px 0 0;
    flex: none;
    accent-color: var(--primary);
}

.auth-agreement-text {
    min-width: 0;
}

.auth-agreement-text label {
    cursor: pointer;
}

.auth-agreement-text a {
    color: var(--primary);
    font-weight: 500;
}

.auth-agreement-text a:hover {
    text-decoration: underline;
}

.auth-agreement-sep {
    color: #98A2B3;
}

/*
 * 格式条款提示（民法典 496 条）。
 * 紧贴勾选框下方、与勾选框同字号，但用弱背景分隔，让它像一个提示而不是正文。
 */
.auth-agreement-notice {
    /* 与勾选行同属一个 .auth-agreement-block，所以不再需要左缩进去对齐
       勾选框之后的文字：缩进会把提示推离“我已阅读并同意”这个视线锚点。 */
    margin: 0;
    padding: 0;
    color: #667085;
    font-size: 12px;
    line-height: 1.65;
}

.auth-agreement-notice strong {
    color: #B54708;
    font-weight: 600;
}

@media (max-width: 640px) {
    .auth-agreement-block {
        gap: 4px;
    }
}

.auth-meta {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--divider);
    color: var(--muted-2);
    font-size: 12px;
    text-align: center;
}

.auth-meta p {
    margin: 0;
}

.auth-meta-links {
    margin-top: 8px !important;
    color: var(--muted);
    font-size: 13px;
}

.auth-meta-links a {
    color: var(--primary);
    font-weight: 500;
}

.auth-meta-links span {
    margin: 0 6px;
    color: var(--border-strong);
}

.auth-foot {
    margin-top: 32px;
    color: var(--muted-2);
    font-size: 12px;
    text-align: center;
}

.auth-state {
    margin-top: 24px;
}

.auth-panel .state-card {
    width: 100%;
    margin-top: 24px;
}

.auth-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 16px;
}

.auth-strength {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

.auth-strength span {
    flex: 1;
    height: 3px;
    border-radius: 1.5px;
    background: #E3E8ED;
    transition: background-color 0.2s ease;
}

.auth-strength[data-score="1"] span:nth-child(1) {
    background: var(--red);
}

.auth-strength[data-score="2"] span:nth-child(-n+2) {
    background: var(--amber);
}

.auth-strength[data-score="3"] span {
    background: #12B86B;
}

.auth-strength-label {
    color: #98A2B3;
    font-size: 12px;
    line-height: 1.45;
}

.auth-strength-label[data-tone="weak"] { color: var(--red-ink); }
.auth-strength-label[data-tone="fair"] { color: var(--amber-ink); }
.auth-strength-label[data-tone="strong"] { color: var(--green-ink); }

/* ---------- account settings ---------- */

.account-head {
    align-items: center;
}

.account-head .page-sub {
    font-size: 13px;
}

.page-head h1.page-title-sm {
    font-size: 22px;
    font-weight: 600;
    line-height: 1.45;
}

.account-status-tag {
    flex: none;
}

.account-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    align-items: start;
    gap: 20px;
}

.account-main,
.account-side {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 14px;
}

.account-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 20px;
    border-radius: var(--radius-lg);
}

.account-card-head h2 {
    color: var(--ink);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.45;
}

.account-card-head p {
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
}

.account-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.account-avatar {
    display: grid;
    width: 48px;
    height: 48px;
    flex: none;
    place-items: center;
    border-radius: 50%;
    background: var(--primary);
    color: #FFFFFF;
    font-size: 20px;
    font-weight: 600;
}

.account-profile-meta {
    display: flex;
    min-width: 0;
    flex: 1;
    flex-direction: column;
    gap: 3px;
}

.account-profile-meta strong {
    color: var(--ink);
    font-size: 15px;
    font-weight: 600;
}

.account-profile-meta small {
    color: var(--muted);
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-fields {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 0;
}

.account-field {
    display: flex;
    align-items: center;
    gap: 16px;
}

.account-field dt {
    width: 80px;
    flex: none;
    color: var(--ink-2);
    font-size: 13px;
}

.account-field dd {
    display: flex;
    min-height: 36px;
    flex: 1;
    align-items: center;
    margin: 0;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #FFFFFF;
    color: var(--ink);
    font-size: 13px;
    overflow-wrap: anywhere;
}

.account-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.account-form .field input {
    height: 36px;
}

.account-session {
    display: flex;
    align-items: center;
    gap: 10px;
}

.account-session-dot {
    width: 8px;
    height: 8px;
    flex: none;
    border-radius: 50%;
    background: #12B86B;
}

.account-session-meta {
    display: flex;
    min-width: 0;
    flex: 1;
    flex-direction: column;
    gap: 3px;
}

.account-session-meta strong {
    color: var(--ink);
    font-size: 13px;
    font-weight: 500;
}

.account-session-meta small {
    color: var(--muted);
    font-size: 12px;
}

.account-meta {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 0;
}

.account-meta div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 12px;
}

.account-meta dt {
    color: var(--muted);
}

.account-meta dd {
    margin: 0;
    color: var(--ink);
}

.account-notice {
    background: #FFF5E5;
    box-shadow: inset 0 0 0 1px #FFD99E;
}

.account-notice h2 {
    color: var(--amber-ink);
    font-size: 13px;
    font-weight: 500;
}

.account-notice p {
    color: var(--amber-ink);
    font-size: 12px;
    line-height: 1.65;
}

.account-notice code {
    font-family: var(--mono);
    font-size: 0.95em;
}

/* ---------- responsive ---------- */

@media (max-width: 1280px) {
    .algo-grid,
    .arch-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 1180px) {
    .kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .overview-bottom,
    .build-bottom {
        grid-template-columns: minmax(0, 1fr);
    }

    .build-stats {
        gap: 20px;
    }

    .build-right {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 340px);
        align-items: start;
    }

    .auth-shell {
        grid-template-columns: 460px minmax(0, 1fr);
    }

    .auth-aside-inner {
        padding: 48px 40px;
    }

    .auth-pitch h2 {
        font-size: 28px;
    }

    .account-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .account-side {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .auth-shell {
        display: block;
        background: #FFFFFF;
    }

    .auth-aside {
        display: none;
    }

    .auth-main {
        min-height: 100vh;
        align-items: flex-start;
        padding: 48px 24px;
    }

    .auth-panel,
    body[data-page="register"] .auth-panel {
        width: 100%;
        max-width: 420px;
        margin: 0 auto;
    }

    .auth-mobile-brand {
        display: flex;
    }

    .auth-foot {
        margin-top: 28px;
    }

    .account-side {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 520px) {
    .auth-main {
        padding: 28px 20px;
    }

    .auth-head h1 {
        font-size: 24px;
    }

    .auth-form {
        margin-top: 24px;
        gap: 16px;
    }

    .auth-meta {
        margin-top: 20px;
    }

    .account-field {
        align-items: stretch;
        flex-direction: column;
        gap: 6px;
    }

    .account-field dt {
        width: auto;
    }
}

@media (max-width: 1024px) {
    :root {
        --sidebar-width: 64px;
    }

    .brand-row {
        justify-content: center;
        padding: 0;
    }

    .brand-name,
    .version-badge,
    .nav-group-label,
    .nav-label,
    .side-card,
    .side-link-label,
    .user-meta {
        display: none;
    }

    .nav {
        padding: 8px;
    }

    .nav-item {
        justify-content: center;
        padding: 0;
    }

    .sidebar-footer {
        padding: 8px;
    }

    .side-link {
        justify-content: center;
        padding: 0;
    }

    .user-row {
        justify-content: center;
        padding: 8px 0;
    }

    .topbar-search {
        width: 180px;
    }

    .grid-two {
        grid-template-columns: minmax(0, 1fr);
    }

    .arch-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 820px) {
    .content {
        padding: 18px 16px;
    }

    .topbar {
        padding: 0 16px;
    }

    .topbar-search {
        display: none;
    }

    .page-head {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
    }

    .page-actions {
        width: 100%;
    }

    .algo-grid,
    .arch-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .build-hero-head {
        flex-direction: column;
    }

    .build-head-side {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .build-inline-actions {
        padding-top: 0;
    }

    .build-stats {
        width: 100%;
        justify-content: space-between;
    }

    .build-stat {
        align-items: flex-start;
        text-align: left;
    }

    .build-attrs-row {
        flex-direction: column;
        gap: 12px;
    }

    .build-extra-toggle {
        align-self: flex-end;
    }

    .build-meta {
        flex-wrap: wrap;
    }

    .build-right {
        display: flex;
    }

    .meta-list,
    .plan-summary {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 640px) {
    .kpi-grid,
    .algo-grid,
    .arch-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .crumb-brand,
    .crumb-sep {
        display: none;
    }

    .topbar-actions .env-chip,
    .topbar-actions .doc-button {
        display: none;
    }

    .page-actions .button {
        flex: 1;
    }

    .page-head h1 {
        font-size: 24px;
    }

    .matrix-table {
        min-width: 760px;
    }

    .matrix-scroll {
        overflow-x: auto;
    }

    .data-table {
        min-width: 720px;
    }

    .ledger-col-head,
    .ledger-row {
        grid-template-columns: minmax(0, 1fr) 60px 72px;
        gap: 8px;
    }

    .ledger-chip {
        width: 60px;
        padding: 2px 4px;
    }

    .ledger-foot {
        align-items: flex-start;
        flex-direction: column;
        gap: 6px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ---------- admin ---------- */

.row-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    flex-wrap: wrap;
}

.admin-danger-text {
    color: #B42318;
}

.admin-danger-text:hover {
    background: #FEF3F2;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.filter input[type="text"],
.filter input[type="number"],
.filter input[type="date"] {
    height: 32px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #FFFFFF;
    color: var(--ink-2);
    font-size: 12px;
    outline: none;
}

.filter input:focus {
    border-color: var(--primary);
}

.filter-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-create-card {
    padding: 0;
    overflow: hidden;
}

.admin-create-card > summary {
    padding: 16px 18px;
    color: var(--ink);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
}

.admin-create-card > summary::-webkit-details-marker {
    display: none;
}

.admin-create-card > summary::after {
    content: "＋";
    float: right;
    color: var(--muted);
    font-weight: 400;
}

.admin-create-card[open] > summary::after {
    content: "－";
}

.admin-create-card form {
    padding: 16px 18px 18px;
    border-top: 1px solid var(--divider);
}

.admin-secret-value {
    max-height: 260px;
    margin: 14px 0 0;
    padding: 14px;
    overflow: auto;
    border-radius: var(--radius);
    background: var(--bg-soft);
    color: var(--ink);
    font-family: var(--mono);
    font-size: 13px;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-all;
}

.admin-metric {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px dashed var(--divider);
    font-size: 13px;
}

.admin-metric:last-child {
    border-bottom: 0;
}

.admin-metric-label {
    color: var(--muted);
    font-family: var(--mono);
}

.admin-metric-value {
    color: var(--ink);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.admin-bar-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px 0;
}

.admin-bar-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    color: var(--ink-2);
    font-size: 12px;
}

.admin-bar-value {
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.admin-bar-progress {
    height: 6px;
}

.admin-bar-warning::-webkit-progress-value {
    background: #B54708;
}

.admin-bar-warning::-moz-progress-bar {
    background: #B54708;
}

.admin-bar-danger::-webkit-progress-value {
    background: #D92D20;
}

.admin-bar-danger::-moz-progress-bar {
    background: #D92D20;
}

.admin-trend {
    display: flex;
    align-items: flex-end;
    gap: 14px;
    margin-bottom: 8px;
}

.admin-audit-detail {
    display: inline-block;
    max-width: 420px;
    overflow: hidden;
    color: var(--ink-3);
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.branding-editor {
    display: flex;
    align-items: flex-start;
    gap: 24px;
    flex-wrap: wrap;
}

.branding-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: none;
}

.branding-logo {
    width: 72px;
    height: 72px;
    padding: 8px;
    object-fit: contain;
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    background: var(--bg-soft);
}

.branding-caption {
    color: var(--muted);
    font-size: 12px;
}

.branding-form {
    display: flex;
    flex: 1;
    min-width: 260px;
    flex-direction: column;
    gap: 12px;
}

.branding-file-field input[type="file"] {
    padding: 8px 10px;
}

.admin-settings-limit {
    margin-top: 14px;
}

.mail-test-row {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px dashed var(--divider);
}

.mail-test-row .field {
    flex: 1;
    min-width: 0;
    margin: 0;
}

@media (max-width: 1080px) {
    .form-grid,
    .settings-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .form-grid,
    .settings-grid {
        grid-template-columns: 1fr;
    }

    .mail-test-row {
        align-items: stretch;
        flex-direction: column;
    }

    .filter-actions {
        width: 100%;
    }

    .admin-audit-detail {
        max-width: 220px;
    }
}

/* ---------- upload & build parameters ---------- */

.icon-file-primary {
    -webkit-mask-image: url("/assets/img/icons/file-primary.svg");
    mask-image: url("/assets/img/icons/file-primary.svg");
}

.upload-area {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 168px;
    padding: 26px 20px;
    border: 1.5px dashed var(--border-strong);
    border-radius: var(--radius-xl);
    background: var(--bg-soft);
    color: var(--ink-2);
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.dropzone:hover,
.dropzone:focus-visible {
    border-color: var(--primary);
    background: var(--primary-tint);
    outline: none;
    box-shadow: 0 0 0 3px rgba(22, 93, 255, 0.08);
}

.dropzone.is-dragover {
    border-style: solid;
    border-color: var(--primary);
    background: var(--primary-soft);
    box-shadow: 0 0 0 3px rgba(22, 93, 255, 0.12);
}

.dropzone-icon {
    width: 36px;
    height: 36px;
    flex: none;
}

.dropzone-title {
    color: var(--ink);
    font-size: 14px;
    font-weight: 600;
}

.dropzone-hint {
    max-width: 520px;
    color: var(--muted-2);
    font-size: 12px;
    line-height: 1.6;
}

.file-card {
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: #FFFFFF;
    box-shadow: var(--shadow-sm);
}

.file-card-main {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.file-card-icon {
    width: 28px;
    height: 28px;
    flex: none;
}

.file-card-meta {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.file-card-name {
    color: var(--ink);
    font-size: 13px;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.file-card-size {
    color: var(--muted);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.file-card-actions {
    display: flex;
    gap: 6px;
    margin-left: auto;
}

.upload-progress {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-top: 10px;
}

.upload-progress-bar {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    border: 0;
    border-radius: 3px;
    background: var(--divider);
    overflow: hidden;
}

.upload-progress-bar::-webkit-progress-bar {
    border-radius: 3px;
    background: var(--divider);
}

.upload-progress-bar::-webkit-progress-value {
    border-radius: 3px;
    background: var(--primary);
}

.upload-progress-bar::-moz-progress-bar {
    border-radius: 3px;
    background: var(--primary);
}

.upload-progress-text {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
}

.build-submit-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding-top: 16px;
    border-top: 1px solid var(--divider);
}

.build-submit-bar .form-actions {
    margin-top: 0;
}

.params-shell {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 16px;
}

.mode-tabs {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    width: fit-content;
    padding: 4px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-soft);
}

.mode-tab {
    height: 30px;
    padding: 0 14px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--ink-3);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}

.mode-tab:hover {
    color: var(--ink);
}

.mode-tab.is-active {
    background: #FFFFFF;
    color: var(--ink);
    box-shadow: var(--shadow-sm);
}

.mode-tab:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.params-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.params-group-head,
.params-advanced-head {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}

.params-group-head strong,
.params-advanced-head strong {
    color: var(--ink);
    font-size: 13px;
    font-weight: 600;
}

.params-group-head span,
.params-advanced-head span {
    color: var(--muted-2);
    font-size: 12px;
}

.params-advanced-head {
    padding-top: 14px;
    border-top: 1px dashed var(--divider);
}

.protection-base {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px 12px;
    border: 1px solid var(--primary-soft);
    border-radius: var(--radius);
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 12px;
    line-height: 1.55;
}

.protection-base strong {
    color: var(--ink);
    font-size: 13px;
}

.protection-base .field-hint {
    flex: 1 1 240px;
    margin: 0;
    color: var(--ink-2);
}

.integrity-field {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--divider);
}

.preset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
}

.preset-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: #FFFFFF;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.preset-card input,
.choice-card input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.preset-card:hover {
    border-color: var(--border-strong);
    background: var(--bg-soft);
}

.preset-card.is-selected {
    border-color: var(--primary);
    background: var(--primary-tint);
    box-shadow: 0 0 0 3px rgba(22, 93, 255, 0.08);
}

.preset-card.is-disabled {
    opacity: 0.56;
    background: var(--bg-soft);
    cursor: not-allowed;
}

.preset-card.is-disabled:hover {
    border-color: var(--border);
    background: var(--bg-soft);
}

.preset-card-head,
.choice-card-head {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.preset-card-head strong,
.choice-card-head strong {
    color: var(--ink);
    font-size: 13px;
}

.preset-card-meta {
    color: var(--primary);
    font-size: 12px;
    font-weight: 500;
}

.preset-card-summary,
.choice-card-desc {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.55;
}

.preset-card-note {
    color: var(--amber-ink);
    font-size: 11px;
    line-height: 1.5;
}

.version-chips {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    min-height: 38px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-soft);
}

.version-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 9px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #FFFFFF;
    color: var(--ink-2);
    font-size: 12px;
    cursor: pointer;
}

.version-chip input {
    width: 14px;
    height: 14px;
    margin: 0;
    accent-color: var(--primary);
}

.choice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}

.choice-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: #FFFFFF;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.choice-card:hover {
    border-color: var(--border-strong);
    background: var(--bg-soft);
}

.choice-card.is-selected {
    border-color: var(--primary);
    background: var(--primary-tint);
    box-shadow: 0 0 0 3px rgba(22, 93, 255, 0.08);
}

.choice-card.is-disabled {
    opacity: 0.56;
    background: var(--bg-soft);
    cursor: not-allowed;
}

.choice-card.is-disabled:hover {
    border-color: var(--border);
    background: var(--bg-soft);
}

.params-inline-note {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 9px 12px;
    border: 1px solid var(--amber-border);
    border-radius: var(--radius);
    background: var(--amber-soft);
    color: var(--amber-ink);
    font-size: 12px;
    line-height: 1.5;
}

.params-inline-note .button {
    margin-left: auto;
}

.params-summary {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-soft);
}

.params-summary-label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.params-summary-text {
    color: var(--ink-2);
    font-size: 12px;
    line-height: 1.6;
}

.params-summary .tag {
    margin-left: auto;
}

.field-hint-warn {
    color: var(--amber-ink);
}

.verify-note {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-soft);
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
}

.params-tech {
    padding-top: 10px;
    border-top: 1px dashed var(--divider);
}

.params-tech summary {
    color: var(--muted);
    font-size: 12px;
    cursor: pointer;
}

.density-profile {
    margin-top: 12px;
}

/* ── 自动密度（按用途） ────────────────────────────────────────────────
 * 两块：普通模式的摘要（density-auto-summary）与高级模式的规则表（auto-rules）。
 * 摘要必须"一眼能看到三件事"（上限 / 零运行时 / S13 不受限），所以给它一个
 * 轻量的底色而不是纯文字 —— 纯文字在这张表单里会和其它 hint 混成一片。
 */
.density-auto-summary {
    display: grid;
    gap: 4px;
    margin-top: 8px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-soft);
    font-size: 12px;
}

.density-auto-summary .density-auto-cap {
    color: var(--text);
    font-weight: 600;
}

/* ── 保护密度选择器 ────────────────────────────────────────────────────
 * 原生 select 隐藏后，可见部分沿用预设卡片的选中语言：
 * 上层选策略（预设 / 自动 / 手动），下层只在手动时展开 1–5 档。
 */
.density-field {
    gap: 8px;
}

.density-field-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.density-field-head > label {
    color: var(--ink-2);
    font-size: 13px;
    font-weight: 500;
}

.density-picker {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-soft);
}

.density-strategies {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 8px;
}

.density-strategy {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #FFFFFF;
    text-align: left;
    transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.density-strategy:hover:not(:disabled) {
    border-color: var(--border-strong);
}

.density-strategy:focus-visible,
.density-level:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.density-strategy.is-active {
    border-color: var(--primary);
    background: var(--primary-tint);
    box-shadow: 0 0 0 3px rgba(22, 93, 255, 0.08);
}

.density-strategy:disabled {
    opacity: 0.56;
    cursor: not-allowed;
}

.density-strategy-name {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--ink);
    font-size: 13px;
    font-weight: 600;
}

.density-strategy.is-active .density-strategy-name {
    color: var(--primary);
}

.density-strategy-desc {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}

.density-manual {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 10px;
    border-top: 1px dashed var(--divider);
}

.density-manual-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

.density-manual-head > span:first-child {
    color: var(--ink-2);
    font-size: 12px;
    font-weight: 600;
}

.density-manual-head .field-hint {
    margin: 0;
}

.density-levels {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
}

.density-level {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 9px 4px 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #FFFFFF;
    transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.density-level:hover:not(:disabled) {
    border-color: var(--border-strong);
}

.density-level.is-active {
    border-color: var(--primary);
    background: var(--primary-soft);
    box-shadow: 0 0 0 3px rgba(22, 93, 255, 0.08);
}

.density-level:disabled {
    opacity: 0.56;
    cursor: not-allowed;
}

.density-level-top {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 22px;
}

.density-level-top strong {
    color: var(--ink);
    font-size: 15px;
    font-weight: 600;
    line-height: 1;
}

.density-level.is-active .density-level-top strong {
    color: var(--primary);
}

.density-bars {
    display: inline-flex;
    align-items: flex-end;
    gap: 2px;
    height: 16px;
}

.density-bars i {
    width: 3px;
    border-radius: 1px;
    background: var(--border-strong);
}

.density-bars i:nth-child(1) { height: 4px; }
.density-bars i:nth-child(2) { height: 7px; }
.density-bars i:nth-child(3) { height: 10px; }
.density-bars i:nth-child(4) { height: 13px; }
.density-bars i:nth-child(5) { height: 16px; }

.density-bars i.is-on {
    background: var(--primary);
}

.density-level-label {
    color: var(--muted);
    font-size: 11px;
    line-height: 1.2;
}

.density-level.is-active .density-level-label {
    color: var(--primary);
}

.auto-rules {
    margin-top: 12px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-soft);
}

.auto-rules h4 {
    margin: 0 0 6px;
    font-size: 13px;
}

.auto-purpose-rows {
    display: grid;
    gap: 6px;
    margin-top: 6px;
}

.auto-purpose-row {
    display: grid;
    grid-template-columns: minmax(80px, 120px) minmax(150px, 1fr) minmax(150px, 1fr);
    gap: 8px;
    align-items: center;
}

.auto-purpose-name {
    font-family: var(--mono, monospace);
    font-size: 12px;
    color: var(--muted);
}

.density-profile-body {
    display: grid;
    gap: 14px;
    margin-top: 12px;
}

.density-profile-body h4 {
    margin: 4px 0 0;
    font-size: 13px;
}

.density-param-group {
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-soft);
}

.density-param-group + .density-param-group {
    margin-top: 8px;
}

.density-param-group summary {
    cursor: pointer;
    font-size: 13px;
}

.density-param-list {
    display: grid;
    gap: 10px;
    margin-top: 10px;
}

.density-overrides {
    display: grid;
    gap: 8px;
}

.density-override-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 150px auto;
    gap: 8px;
    align-items: center;
}

.density-override-row input,
.density-override-row select {
    width: 100%;
}

@media (max-width: 640px) {
    .density-override-row {
        grid-template-columns: 1fr;
    }
}

.tech-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px 18px;
    margin-top: 10px;
}

.tech-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    padding: 4px 0;
    border-bottom: 1px dashed var(--divider);
}

.tech-row dt {
    color: var(--muted);
    font-size: 12px;
}

.tech-row dd {
    margin: 0;
}

.tech-row code {
    color: var(--ink-3);
    font-family: var(--mono);
    font-size: 11px;
}

.params-shell[data-mode="basic"] .is-advanced-only {
    display: none;
}

@media (max-width: 1080px) {
    .preset-grid,
    .choice-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .params-grid,
    .tech-list {
        grid-template-columns: 1fr;
    }

    .preset-grid,
    .choice-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .build-submit-bar {
        align-items: flex-start;
        flex-direction: column;
    }

    .file-card-actions,
    .params-summary .tag {
        margin-left: 0;
    }

    /* 自动规则表在窄屏上堆成单列：三列并排会把两个 select 压到看不清。 */
    .auto-purpose-row {
        grid-template-columns: 1fr;
    }

    .params-inline-note .button {
        margin-left: 0;
    }
}

@media (max-width: 480px) {
    .preset-grid,
    .choice-grid {
        grid-template-columns: 1fr;
    }
}

/* ---------- admin home content editor ---------- */

.home-token-note {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 8px;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-soft);
    color: var(--muted);
    font-size: 12px;
    line-height: 1.7;
}

.home-token-label {
    color: var(--ink-2);
    font-weight: 600;
}

.home-token-note code {
    padding: 1px 7px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #FFFFFF;
    color: var(--ink-3);
    font-family: var(--mono);
    font-size: 11px;
}

.home-token-tip {
    color: var(--muted-2);
}

.card-head p code {
    padding: 1px 4px;
    border-radius: 4px;
    background: var(--bg-soft);
    font-family: var(--mono);
    font-size: 11px;
}

[data-home-form] {
    display: grid;
    grid-template-columns: 176px minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.home-toc {
    position: sticky;
    top: 80px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: #FFFFFF;
    box-shadow: var(--shadow-sm);
}

.home-toc-title {
    padding: 6px 10px 8px;
    color: var(--muted-2);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
}

.home-toc a {
    padding: 7px 10px;
    border-radius: var(--radius);
    color: var(--ink-3);
    font-size: 13px;
    line-height: 1.4;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.home-toc a:hover {
    background: var(--primary-soft);
    color: var(--primary);
}

.home-form-main {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0;
}

.home-form-main .card {
    display: flex;
    flex-direction: column;
    gap: 18px;
    scroll-margin-top: 80px;
}

.home-field > span {
    color: var(--ink-2);
    font-size: 13px;
    font-weight: 500;
}

.home-field textarea {
    height: auto;
    min-height: 72px;
    padding: 8px 12px;
    line-height: 1.55;
    resize: vertical;
}

.home-field-wide {
    grid-column: 1 / -1;
}

.home-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.home-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--divider);
    border-radius: var(--radius-lg);
    background: var(--bg-soft);
}

.home-row-fields {
    display: grid;
    flex: 1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    min-width: 0;
}

.home-row-fields-card {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.home-row-fields-step,
.home-row-fields-footer {
    grid-template-columns: minmax(0, 1fr);
}

.home-row-span {
    grid-column: 1 / -1;
}

.home-row-tag {
    grid-column: 1 / -1;
    color: var(--muted-2);
    font-size: 12px;
    font-weight: 500;
}

.home-row-remove {
    flex: none;
    margin-top: 22px;
}

.home-row-remove:hover {
    color: var(--red-ink);
    background: var(--red-soft);
}

.home-list-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.home-code-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.home-code-grid .home-field textarea {
    font-family: var(--mono);
    font-size: 12px;
}

.home-form-main .form-actions {
    position: sticky;
    bottom: 16px;
    z-index: 4;
    margin: 0;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 12px 32px rgba(16, 24, 40, 0.12);
    backdrop-filter: blur(8px);
}

.home-save-hint {
    margin-left: auto;
    color: var(--muted-2);
    font-size: 12px;
}

.legal-admin-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 20px;
}

.legal-admin-card {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.legal-admin-card .card-head {
    align-items: flex-start;
}

.legal-admin-card textarea {
    min-height: 360px;
    line-height: 1.7;
    resize: vertical;
}

@media (max-width: 1180px) {
    [data-home-form] {
        grid-template-columns: minmax(0, 1fr);
    }

    .home-toc {
        position: static;
        flex-direction: row;
        overflow-x: auto;
        padding: 6px;
    }

    .home-toc-title {
        display: none;
    }

    .home-toc a {
        white-space: nowrap;
    }
}

@media (max-width: 720px) {
    .home-row {
        flex-direction: column;
    }

    .home-row-fields,
    .home-row-fields-card {
        grid-template-columns: minmax(0, 1fr);
    }

    .home-row-remove {
        align-self: flex-end;
        margin-top: 0;
    }

    .home-code-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .home-form-main .form-actions {
        flex-wrap: wrap;
        padding: 10px;
    }

    .home-save-hint {
        display: none;
    }

    .home-form-main .form-actions .button {
        flex: 1;
    }
}
