:root {
    color-scheme: dark;
    --bg: #0f1216;
    --panel: #171b20;
    --panel-2: #1d2329;
    --line: #2a3139;
    --line-strong: #38424c;
    --text: #eef2f5;
    --muted: #8d99a6;
    --soft: #c9d1d9;
    --green: #58c46b;
    --amber: #d8a23a;
    --red: #ee6b61;
    --blue: #67a7ff;
    --cyan: #5bc8c3;
    --focus: #9cc8ff;
    --shadow: 0 18px 50px rgba(0, 0, 0, .28);
    font-family: Inter, "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
}

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

button {
    cursor: pointer;
}

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

.sidebar {
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--line);
    background: #12161b;
}

.brand {
    display: flex;
    gap: 12px;
    align-items: center;
    height: 72px;
    padding: 0 20px;
    border-bottom: 1px solid var(--line);
}

.brand-mark {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border: 1px solid rgba(91, 200, 195, .45);
    border-radius: 8px;
    background: #0d2327;
    color: var(--cyan);
    font-weight: 800;
}

.brand strong,
.brand span {
    display: block;
}

.brand strong {
    font-size: 15px;
}

.brand span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
}

.nav-list {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 4px;
    padding: 14px 12px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    height: 42px;
    border: 1px solid transparent;
    border-radius: 7px;
    background: transparent;
    color: var(--soft);
    padding: 0 12px;
    text-align: left;
}

.nav-item svg,
.icon-btn svg,
.btn svg,
.status-chip svg {
    width: 16px;
    height: 16px;
}

.nav-item:hover {
    background: var(--panel);
}

.nav-item.active {
    border-color: #315167;
    background: #172634;
    color: var(--text);
}

.sidebar-footer {
    padding: 14px 20px 18px;
    border-top: 1px solid var(--line);
}

.sidebar-footer span,
.sidebar-footer strong {
    display: block;
}

.sidebar-footer span {
    color: var(--muted);
    font-size: 12px;
}

.sidebar-footer strong {
    margin-top: 4px;
    color: var(--green);
    font-size: 13px;
}

.main {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 72px;
    padding: 0 28px;
    border-bottom: 1px solid var(--line);
    background: #11151a;
}

.eyebrow {
    margin: 0 0 5px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0;
}

h1,
h2,
p {
    margin: 0;
}

h1 {
    font-size: 22px;
}

h2 {
    font-size: 15px;
}

.top-actions,
.panel-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 34px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--panel);
    color: var(--muted);
    padding: 0 10px;
    font-size: 12px;
}

.status-chip.good {
    border-color: rgba(88, 196, 107, .35);
    color: var(--green);
}

.status-chip.bad {
    border-color: rgba(238, 107, 97, .35);
    color: var(--red);
}

.status-chip.warn {
    border-color: rgba(216, 162, 58, .35);
    color: var(--amber);
}

.icon-btn,
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 34px;
    border: 1px solid var(--line-strong);
    border-radius: 7px;
    background: var(--panel-2);
    color: var(--text);
    padding: 0 12px;
    text-decoration: none;
}

.icon-btn {
    width: 36px;
    padding: 0;
}

.icon-btn.secondary {
    color: var(--muted);
}

.icon-btn.good {
    border-color: rgba(88, 196, 107, .45);
    color: var(--green);
}

.btn.primary {
    border-color: rgba(88, 196, 107, .45);
    background: #1c3824;
    color: #dff7e4;
}

.btn.danger {
    border-color: rgba(238, 107, 97, .45);
    background: #3a2020;
    color: #ffe5e2;
}

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

.notice {
    margin: 18px 28px 0;
    border: 1px solid #446581;
    border-radius: 7px;
    background: #142331;
    color: #d7ecff;
    padding: 10px 12px;
    font-size: 13px;
}

.notice.hidden {
    display: none;
}

.inline-alert {
    margin-bottom: 12px;
    border: 1px solid var(--line-strong);
    border-radius: 7px;
    padding: 10px 12px;
    line-height: 1.5;
    font-size: 12px;
}

.inline-alert.bad {
    border-color: rgba(238, 107, 97, .45);
    background: rgba(238, 107, 97, .12);
    color: #ffbbb5;
}

.inline-alert.good {
    border-color: rgba(88, 196, 107, .35);
    background: rgba(88, 196, 107, .1);
    color: #bcf1c5;
}

.inline-alert.warn {
    border-color: rgba(216, 162, 58, .4);
    background: rgba(216, 162, 58, .1);
    color: #f4d38b;
}

.btn.disabled,
.btn[aria-disabled="true"] {
    cursor: not-allowed;
    opacity: .52;
    pointer-events: none;
}

.worker-action-row {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

.view {
    display: none;
    padding: 22px 28px 36px;
}

.view.active {
    display: block;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(130px, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

.kpi {
    min-height: 86px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    padding: 13px 14px;
}

.kpi span {
    display: block;
    color: var(--muted);
    font-size: 12px;
}

.kpi strong {
    display: block;
    margin-top: 8px;
    font-size: 27px;
}

.kpi.good strong {
    color: var(--green);
}

.kpi.warn strong {
    color: var(--amber);
}

.kpi.bad strong {
    color: var(--red);
}

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

.span-2 {
    grid-column: span 2;
}

.span-3 {
    grid-column: span 3;
}

.panel {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding: 16px 16px 14px;
    border-bottom: 1px solid var(--line);
}

.panel-head.compact {
    align-items: center;
}

.panel-head p {
    margin-top: 5px;
    color: var(--muted);
    font-size: 12px;
}

.status-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    padding: 14px 16px 16px;
}

.status-card {
    min-height: 86px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #12171d;
    padding: 12px;
}

.status-card span,
.status-card small {
    display: block;
    overflow: hidden;
    color: var(--muted);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.status-card strong {
    display: block;
    overflow: hidden;
    margin-top: 7px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stack-list,
.step-list,
.task-tree,
.data-table,
.settings-card,
.command-help,
.import-box,
.form-grid {
    padding: 14px 16px 16px;
}

.stack-item,
.step,
.row,
.tree-item {
    border-bottom: 1px solid var(--line);
    padding: 10px 0;
}

.stack-item:last-child,
.step:last-child,
.row:last-child,
.tree-item:last-child {
    border-bottom: 0;
}

.stack-item strong,
.row strong,
.tree-item strong {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stack-item small,
.row small,
.tree-item small {
    display: block;
    overflow: hidden;
    margin-top: 4px;
    color: var(--muted);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.row {
    display: grid;
    grid-template-columns: minmax(150px, 1fr) minmax(160px, 1.15fr) minmax(120px, .9fr) auto;
    gap: 12px;
    align-items: center;
}

.row.editing {
    border-bottom-color: transparent;
}

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

.employee-editor {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 0 0 12px;
    border: 1px solid rgba(73, 138, 245, .45);
    border-radius: 8px;
    background: #12171d;
    padding: 14px;
}

.employee-editor label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: var(--muted);
    font-size: 12px;
}

.editor-note {
    border: 1px solid rgba(216, 162, 58, .35);
    border-radius: 7px;
    background: rgba(216, 162, 58, .10);
    color: var(--amber);
    padding: 10px 12px;
    font-size: 12px;
    line-height: 1.5;
}

.editor-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.tag,
.light {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 24px;
    border-radius: 999px;
    padding: 0 9px;
    font-size: 12px;
    font-weight: 700;
}

.tag.good,
.light.green {
    background: rgba(88, 196, 107, .15);
    color: var(--green);
}

.tag.warn,
.light.yellow {
    background: rgba(216, 162, 58, .15);
    color: var(--amber);
}

.tag.bad,
.light.red {
    background: rgba(238, 107, 97, .15);
    color: var(--red);
}

.tag.neutral {
    background: rgba(141, 153, 166, .15);
    color: var(--muted);
}

.step {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 10px;
}

.step-num {
    display: grid;
    width: 26px;
    height: 26px;
    place-items: center;
    border-radius: 50%;
    background: #222932;
    color: var(--muted);
    font-weight: 800;
}

.step.done .step-num {
    background: var(--green);
    color: #08120a;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.form-grid label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: var(--muted);
    font-size: 12px;
}

.form-grid .check-line {
    flex-direction: row;
    align-items: center;
    color: var(--soft);
    line-height: 1.45;
}

.form-grid .check-line input {
    width: 16px;
    min-width: 16px;
    height: 16px;
    padding: 0;
}

input,
select,
textarea {
    width: 100%;
    min-width: 0;
    border: 1px solid var(--line-strong);
    border-radius: 7px;
    outline: none;
    background: #12171d;
    color: var(--text);
    padding: 9px 10px;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--focus);
}

textarea {
    resize: vertical;
    line-height: 1.5;
}

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

.file-search {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) 150px auto;
    gap: 10px;
    padding: 14px 16px 16px;
}

.file-row {
    grid-template-columns: minmax(240px, 1.4fr) minmax(120px, .65fr) minmax(130px, .7fr) minmax(180px, .9fr);
}

.report-text {
    min-height: 236px;
    margin: 0;
    border: 0;
    background: transparent;
    color: var(--soft);
    padding: 16px;
    white-space: pre-wrap;
    font-family: inherit;
    font-size: 13px;
    line-height: 1.7;
}

.rules-form {
    grid-template-columns: 1fr;
}

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

.scheduler-log {
    margin-top: 10px;
    border-top: 1px solid var(--line);
    padding-top: 8px;
}

.scheduler-log .stack-item span {
    display: block;
    margin-top: 4px;
    color: var(--soft);
    font-size: 12px;
}

.deploy-box {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px 16px 16px;
}

.deploy-box label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: var(--muted);
    font-size: 12px;
}

.deploy-box pre {
    overflow-x: auto;
    min-height: 118px;
    margin: 0;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #0d1116;
    color: var(--soft);
    padding: 12px;
    white-space: pre-wrap;
    word-break: break-all;
    font-family: "JetBrains Mono", Consolas, monospace;
    font-size: 12px;
    line-height: 1.55;
}

.cleanup-box {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) minmax(140px, 0.8fr) minmax(220px, 1.4fr) minmax(120px, 0.6fr) auto;
    gap: 12px;
    align-items: end;
    padding: 14px 16px 16px;
}

.cleanup-box label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 12px;
}

.deploy-plan-summary {
    display: grid;
    gap: 8px;
}

.deploy-plan-row {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    min-height: 34px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #12171d;
    padding: 8px 10px;
}

.deploy-plan-row span {
    color: var(--muted);
    font-size: 12px;
}

.deploy-plan-row strong {
    overflow-wrap: anywhere;
    color: var(--soft);
    font-size: 13px;
}

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

.deploy-steps {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    padding: 14px 16px 16px;
}

.deploy-steps div {
    min-height: 96px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #12171d;
    padding: 12px;
}

.deploy-steps strong {
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    border-radius: 50%;
    background: #1e3340;
    color: var(--cyan);
}

.deploy-steps span {
    display: block;
    margin-top: 10px;
    color: var(--soft);
    font-size: 12px;
    line-height: 1.5;
}

.command-help {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.command-pill {
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #12171d;
    color: var(--soft);
    padding: 7px 10px;
    font-size: 12px;
}

.empty {
    padding: 16px;
    color: var(--muted);
    font-size: 13px;
}

.tree-item {
    display: grid;
    grid-template-columns: 24px minmax(160px, 1fr) 110px 110px 160px;
    gap: 10px;
    align-items: center;
    border-radius: 7px;
    padding-right: 10px;
}

.tree-item:hover,
.tree-item.active {
    background: #121f2a;
}

.tree-item.active {
    outline: 1px solid #315167;
}

.task-detail {
    padding: 16px;
}

.task-detail-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid var(--line);
    padding-bottom: 14px;
}

.task-detail-head h3 {
    margin: 5px 0 7px;
    font-size: 18px;
}

.task-detail-head p,
.feedback-item p,
.timeline-item p {
    margin: 0;
    color: var(--soft);
    line-height: 1.55;
}

.task-id {
    color: var(--muted);
    font-size: 12px;
    font-family: "JetBrains Mono", Consolas, monospace;
}

.task-meta-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    padding: 14px 0;
}

.detail-meta {
    min-height: 68px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #12171d;
    padding: 10px 12px;
}

.detail-meta span {
    display: block;
    color: var(--muted);
    font-size: 12px;
}

.detail-meta strong {
    display: block;
    overflow: hidden;
    margin-top: 6px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.detail-meta.good strong {
    color: var(--green);
}

.detail-meta.warn strong {
    color: var(--amber);
}

.detail-meta.bad strong {
    color: var(--red);
}

.detail-columns {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
    gap: 14px;
}

.detail-block {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #12171d;
}

.detail-title {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    border-bottom: 1px solid var(--line);
    padding: 0 12px;
    color: var(--soft);
    font-weight: 700;
}

.detail-title svg {
    width: 16px;
    height: 16px;
    color: var(--cyan);
}

.feedback-item {
    border-bottom: 1px solid var(--line);
    padding: 12px;
}

.feedback-item:last-child {
    border-bottom: 0;
}

.feedback-item div {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.feedback-item small,
.timeline-item small {
    color: var(--muted);
    font-size: 12px;
}

.timeline-item {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    gap: 8px;
    border-bottom: 1px solid var(--line);
    padding: 12px;
}

.timeline-item:last-child {
    border-bottom: 0;
}

.timeline-dot {
    width: 9px;
    height: 9px;
    margin-top: 5px;
    border-radius: 50%;
    background: var(--cyan);
}

.empty.compact {
    padding: 12px;
}

.policy-card {
    padding: 16px;
}

.task-detail-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.policy-summary {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.policy-columns {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
    gap: 14px;
}

.policy-rule,
.policy-block {
    border-bottom: 1px solid var(--line);
    padding: 12px;
}

.policy-rule:last-child,
.policy-block:last-child {
    border-bottom: 0;
}

.policy-rule {
    color: var(--soft);
    line-height: 1.5;
}

.policy-block div {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.policy-block p {
    margin: 0 0 6px;
    color: var(--soft);
    line-height: 1.5;
}

.policy-block small {
    color: var(--muted);
    font-size: 12px;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.dot.red {
    background: var(--red);
}

.dot.yellow {
    background: var(--amber);
}

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

@media (max-width: 1300px) {
    .kpi-grid {
        grid-template-columns: repeat(4, minmax(130px, 1fr));
    }

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

    .span-3 {
        grid-column: span 2;
    }
}

@media (max-width: 900px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .brand {
        height: 62px;
    }

    .nav-list {
        display: grid;
        grid-template-columns: repeat(8, minmax(0, 1fr));
        padding: 8px;
    }

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

    .nav-item span {
        display: none;
    }

    .sidebar-footer {
        display: none;
    }

    .topbar {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
        padding: 16px;
    }

    .top-actions {
        flex-wrap: wrap;
    }

    .view {
        padding: 16px;
    }

    .kpi-grid,
    .content-grid,
    .status-grid,
    .form-grid,
    .employee-editor,
    .row,
    .file-search,
    .tree-item,
    .deploy-actions,
    .deploy-plan-row,
    .deploy-steps,
    .cleanup-box,
    .task-meta-grid,
    .detail-columns,
    .policy-summary,
    .policy-columns {
        grid-template-columns: 1fr;
    }

    .span-2,
    .span-3 {
        grid-column: span 1;
    }
}
