:root {
    --color-page: #f5f6f8;
    --color-surface: #fff;
    --color-surface-muted: #f7f8fa;
    --color-surface-hover: #f0f4ff;
    --color-text: #1f2329;
    --color-text-secondary: #646a73;
    --color-text-tertiary: #8f959e;
    --color-border: #dee0e3;
    --color-border-strong: #c9cdd4;
    --color-primary: #3370ff;
    --color-primary-hover: #245bdb;
    --color-primary-soft: #eff4ff;
    --color-success: #00a870;
    --color-success-soft: #e8f8f0;
    --color-warning: #d97706;
    --color-warning-soft: #fff7e8;
    --color-danger: #f54a45;
    --color-danger-soft: #fff1f0;
    --color-disabled: #a6a9ad;
    --color-nav: #3370ff;
    --color-nav-hover: #285fdb;
    --color-nav-text: #dce8ff;
    --color-nav-active: rgba(255, 255, 255, .16);
    --color-code-surface: #172033;
    --color-code-surface-raised: #0b1220;
    --color-code-text: #f1f5f9;
    --color-code-accent: #bfdbfe;
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;
    --radius-control: 6px;
    --radius-panel: 8px;
    --control-height: 36px;
    --page-max-width: 1440px;
    --shadow-modal: 0 18px 48px rgba(31, 35, 41, .18);
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    background: var(--color-page);
}

body {
    min-width: 0;
    margin: 0;
    background: var(--color-page);
    color: var(--color-text);
    font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
    margin: -1px;
    white-space: nowrap;
}

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

button {
    display: inline-flex;
    min-height: var(--control-height);
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid var(--color-primary);
    border-radius: var(--radius-control);
    padding: 7px 12px;
    background: var(--color-primary);
    color: #fff;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    line-height: 20px;
    white-space: nowrap;
}

.button-link {
    display: inline-flex;
    min-height: var(--control-height);
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid var(--color-primary);
    border-radius: var(--radius-control);
    padding: 7px 12px;
    background: var(--color-primary);
    color: #fff;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    line-height: 20px;
    text-decoration: none;
    white-space: nowrap;
}

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

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

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
    outline: 2px solid #7aa2ff;
    outline-offset: 2px;
}

button:disabled {
    border-color: var(--color-border);
    background: var(--color-neutral-soft, #f1f3f5);
    color: var(--color-disabled);
    cursor: not-allowed;
    opacity: 1;
}

button.is-loading:disabled {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-color: var(--color-primary);
    background: var(--color-primary);
    color: #fff;
}

button.is-loading::before {
    width: 12px;
    height: 12px;
    border: 2px solid rgba(255, 255, 255, .45);
    border-top-color: #fff;
    border-radius: 50%;
    animation: button-spin .7s linear infinite;
    content: "";
}

@keyframes button-spin {
    to { transform: rotate(360deg); }
}

input,
select,
textarea {
    width: 100%;
    min-height: var(--control-height);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-control);
    padding: 7px 10px;
    background: var(--color-surface);
    color: var(--color-text);
    line-height: 20px;
}

textarea {
    min-height: 84px;
    resize: vertical;
}

input::placeholder,
textarea::placeholder {
    color: var(--color-text-tertiary);
}

input:disabled {
    background: var(--color-surface-muted);
    color: var(--color-text-secondary);
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--color-primary);
    outline: 2px solid rgba(51, 112, 255, .18);
    outline-offset: 0;
}

code {
    padding: 2px 4px;
    border-radius: 4px;
    background: var(--color-neutral-soft, #f1f3f5);
    color: var(--color-text);
    font-size: 12px;
}

.topbar {
    display: flex;
    min-height: 60px;
    align-items: stretch;
    gap: var(--space-5);
    padding: 0 clamp(16px, 2.4vw, 32px);
    background: var(--color-nav);
    color: #fff;
}

.brand {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    color: #fff;
    text-decoration: none;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -.1px;
    white-space: nowrap;
}

.brand i,
.login-brand i {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: var(--space-2);
    border-radius: 50%;
    background: #fff;
}

.topbar nav {
    display: flex;
    min-width: 0;
    flex: 1 1 auto;
    align-items: stretch;
    gap: 2px;
    overflow-x: auto;
    scrollbar-width: thin;
}

.topbar nav a,
.account-link {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    border-bottom: 3px solid transparent;
    padding: 0 10px;
    color: var(--color-nav-text);
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.topbar nav a:hover,
.topbar nav a.active,
.account-link:hover,
.account-link.active {
    color: #fff;
    background: var(--color-nav-active);
}

.topbar nav a.active {
    border-bottom-color: #fff;
}

.header-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: var(--space-2);
}

.account-link {
    padding: 7px 8px;
}

.logout {
    margin: 0;
}

.logout button {
    min-height: 30px;
    border-color: rgba(255, 255, 255, .5);
    background: rgba(255, 255, 255, .08);
    color: #fff;
}

.logout button:hover {
    border-color: rgba(255, 255, 255, .75);
    background: rgba(255, 255, 255, .18);
}

main {
    width: min(100%, var(--page-max-width));
    min-width: 0;
    margin: 0 auto;
    padding: clamp(20px, 2.5vw, 32px) clamp(16px, 2.4vw, 32px) 48px;
}

.heading {
    display: flex;
    min-width: 0;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--space-4);
    padding-bottom: var(--space-5);
    border-bottom: 1px solid var(--color-border);
}

.heading>div {
    min-width: 0;
}

.heading h1 {
    margin: 2px 0 4px;
    color: var(--color-text);
    font-size: clamp(22px, 2vw, 26px);
    font-weight: 700;
    letter-spacing: -.35px;
    line-height: 1.25;
}

.heading p {
    margin: 0;
    color: var(--color-text-secondary);
}

.heading .eyebrow {
    color: var(--color-primary);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr));
    gap: var(--space-3);
    margin: var(--space-5) 0;
}

.cards article {
    min-width: 0;
    min-height: 100px;
    padding: var(--space-4);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-panel);
    background: var(--color-surface);
}

.cards article.danger {
    border-color: #ffd5d2;
    background: #fff8f7;
}

.cards span,
.cards small {
    display: block;
    color: var(--color-text-secondary);
}

.device-summary-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.device-summary-cards article:nth-child(2) {
    border-top: 3px solid var(--color-primary);
}

.device-summary-cards article:nth-child(3) {
    border-top: 3px solid var(--color-success);
}

.telemetry-offline {
    color: var(--color-danger);
    font-weight: 650;
}

.command-output {
    max-height: 260px;
    margin: 6px 0 0;
    overflow: auto;
    padding: 10px;
    border: 1px solid var(--color-border);
    border-radius: 5px;
    background: #171a1f;
    color: #e7edf5;
    font: 12px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace;
    white-space: pre-wrap;
    word-break: break-word;
}

.command-output.error-output {
    border-color: #78413e;
    color: #ffb8b3;
}

.agent-command-history {
    margin-top: var(--space-5);
}

.agent-command-text {
    max-width: 280px;
}

.agent-command-text code {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.command-history-detail {
    display: grid;
    gap: var(--space-3);
    padding: var(--space-4);
}

.command-history-detail p,
.command-history-detail label {
    margin: 0;
}

.cards b {
    display: block;
    margin-top: var(--space-1);
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -.4px;
    line-height: 1.2;
}

.cards small {
    margin-top: var(--space-1);
    color: var(--color-warning);
    font-size: 12px;
}

.dashboard-summary {
    display: grid;
    grid-template-columns: minmax(250px, 300px) minmax(235px, 270px) minmax(0, 1fr);
    gap: var(--space-4);
    margin: var(--space-5) 0;
}

.dashboard-filters {
    display: flex;
    min-width: 0;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: var(--space-3);
    margin: var(--space-4) 0 0;
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-panel);
    background: var(--color-surface);
}

.dashboard-filters label {
    display: grid;
    flex: 0 1 190px;
    gap: 6px;
    color: var(--color-text);
    font-size: 13px;
    font-weight: 500;
}

.dashboard-filters p {
    flex: 1 1 220px;
    margin: 0 0 8px auto;
    color: var(--color-text-secondary);
    font-size: 12px;
}

.health-card {
    display: flex;
    min-width: 0;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-5);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-panel);
    background: var(--color-primary-soft);
}

.metric-label {
    display: block;
    color: var(--color-text-secondary);
    font-size: 13px;
    font-weight: 600;
}

.health-card b {
    display: block;
    margin-top: var(--space-1);
    color: var(--color-primary);
    font-size: 32px;
    letter-spacing: -1px;
    line-height: 1.15;
}

.health-card p {
    margin: var(--space-2) 0 0;
    color: var(--color-text-secondary);
    font-size: 12px;
    line-height: 1.55;
}

.health-status {
    flex: 0 0 auto;
    padding: 3px 7px;
    border-radius: 4px;
    background: var(--color-success-soft);
    color: var(--color-success);
    font-size: 12px;
    font-weight: 650;
    white-space: nowrap;
}

.health-status.risk {
    background: var(--color-danger-soft);
    color: var(--color-danger);
}

.distribution-card {
    min-width: 0;
    padding: var(--space-4);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-panel);
    background: var(--color-surface);
}

.distribution-card > div:first-child {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
}

.distribution-card p {
    margin: var(--space-1) 0 0;
    color: var(--color-text-secondary);
    font-size: 12px;
}

.status-pie {
    position: relative;
    flex: 0 0 auto;
    width: 76px;
    height: 76px;
    border-radius: 50%;
    background: var(--color-neutral-soft, #f1f3f5);
}

.status-pie::after {
    position: absolute;
    inset: 17px;
    border-radius: 50%;
    background: var(--color-surface);
    content: "";
}

.status-legend {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px var(--space-3);
    margin-top: var(--space-3);
}

.status-legend span {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 5px;
    color: var(--color-text-secondary);
    font-size: 11px;
    white-space: nowrap;
}

.status-legend i {
    flex: 0 0 auto;
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

.status-legend b {
    margin-left: auto;
    color: var(--color-text);
    font-size: 11px;
}

.dashboard-cards {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin: 0;
}

.dashboard-cards article {
    min-height: 124px;
}

.dashboard-cards small {
    min-height: 18px;
}

.dashboard-table-section {
    min-width: 0;
}

.analytics-cards {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.analytics-note {
    margin: -10px 0 var(--space-5);
    color: var(--color-text-secondary);
    font-size: 12px;
}

.analytics-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(280px, .7fr);
    gap: var(--space-4);
    margin-bottom: var(--space-5);
}

.analytics-panel {
    min-width: 0;
    padding: var(--space-4);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-panel);
    background: var(--color-surface);
}

.analytics-panel h2 {
    margin: 0 0 var(--space-1);
    font-size: 16px;
}

.analytics-panel p {
    margin: 0;
    color: var(--color-text-secondary);
    font-size: 12px;
}

.heatmap {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(18px, 1fr));
    gap: 5px;
    margin-top: var(--space-4);
}

.heatmap span {
    aspect-ratio: 1;
    border-radius: 3px;
}

.risk-list {
    display: grid;
    gap: var(--space-2);
    margin: var(--space-3) 0 0;
    padding-left: 22px;
}

.risk-list li {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 1px var(--space-2);
    color: var(--color-text);
}

.risk-list b { color: var(--color-danger); }
.risk-list small { grid-column: 1 / -1; color: var(--color-text-secondary); }
.analytics-table { margin-top: var(--space-5); }

.dashboard-table-heading {
    display: flex;
    min-width: 0;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: var(--space-3);
}

.dashboard-table-heading h2 {
    margin: 0 0 var(--space-1);
    font-size: 18px;
    line-height: 1.35;
}

.dashboard-table-heading p,
.table-hint {
    margin: 0;
    color: var(--color-text-secondary);
    font-size: 12px;
}

.table-hint {
    padding-bottom: 2px;
    white-space: nowrap;
}

.compact-action {
    min-height: 28px;
    padding: 3px 8px;
    font-size: 12px;
    font-weight: 500;
}

.monitor-actions {
    display: inline-flex;
    max-width: 100%;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.status-group-row > td {
    padding: 0;
    border-top: 1px solid var(--color-border);
    background: var(--color-surface);
}

.status-group-toggle {
    display: flex;
    width: 100%;
    min-height: 48px;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: var(--color-text);
    text-align: left;
}

.status-group-toggle:hover {
    background: var(--color-surface-hover);
    box-shadow: none;
    transform: none;
}

.status-group-chevron {
    display: inline-block;
    width: 7px;
    height: 7px;
    flex: 0 0 7px;
    border-right: 1.5px solid #8a929d;
    border-bottom: 1.5px solid #8a929d;
    transform: rotate(45deg);
    transform-origin: center;
    transition: transform .15s ease;
}

.status-group-row.is-collapsed .status-group-chevron {
    transform: rotate(-45deg);
}

.status-group-dot {
    width: 7px;
    height: 7px;
    flex: 0 0 7px;
    border-radius: 50%;
    background: #9aa2ad;
}

.status-group-row[data-status="COMPLETED"] .status-group-dot {
    background: var(--color-success);
}

.status-group-row[data-status="TIMEOUT"] .status-group-dot,
.status-group-row[data-status="FAILED"] .status-group-dot {
    background: var(--color-danger);
}

.status-group-row[data-status="BLOCKED"] .status-group-dot {
    background: var(--color-warning);
}

.status-group-row[data-status="SKIPPED"] .status-group-dot {
    background: #8b78b8;
}

.status-group-toggle strong {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0;
}

.status-group-count {
    padding: 1px 7px;
    border: 1px solid #e4e7eb;
    border-radius: 10px;
    background: var(--color-surface-muted);
    color: var(--color-text-secondary);
    font-size: 11px;
    font-weight: 500;
    line-height: 18px;
}

.status-group-action {
    margin-left: auto;
    color: var(--color-text-secondary);
    font-size: 12px;
    font-weight: 500;
}

.schedule-status-row[hidden] {
    display: none;
}

.dashboard-table-section .table-wrap {
    background: var(--color-surface);
}

/* Hidden detail rows must never change the table's intrinsic column widths. */
.dashboard-status-table {
    width: 100%;
    min-width: 1120px;
    table-layout: fixed;
}

.dashboard-status-table .status-column { width: 11.5%; }
.dashboard-status-table .process-column { width: 16%; }
.dashboard-status-table .schedule-column { width: 10%; }
.dashboard-status-table .cycle-column { width: 8%; }
.dashboard-status-table .deadline-column { width: 8%; }
.dashboard-status-table .finished-column { width: 8%; }
.dashboard-status-table .difference-column { width: 13%; }
.dashboard-status-table .remark-column { width: 7%; }
.dashboard-status-table .action-column { width: 18.5%; }

.dashboard-status-table td,
.dashboard-status-table th {
    min-width: 0;
}

.dashboard-table-section thead th {
    background: var(--color-table-head, var(--color-surface-muted));
    color: var(--color-text-secondary);
}

/* Status sections are uniform table rows, not a collection of colored action buttons. */
.dashboard-table-section .status-group-row > td {
    padding: 0;
    background: var(--color-surface);
}

.dashboard-table-section .status-group-toggle {
    display: grid;
    width: 100%;
    min-height: 34px;
    grid-template-columns: 8px 6px 82px 56px minmax(40px, 1fr);
    justify-content: stretch;
    gap: 7px;
    padding: 6px 12px;
    border: 0;
    border-radius: 0;
    background: var(--color-surface-muted);
    box-shadow: none;
    color: var(--color-text-secondary);
    font-size: 11px;
    font-weight: 500;
    line-height: 18px;
    text-align: left;
    transform: none;
}

.dashboard-table-section .status-group-toggle:hover,
.dashboard-table-section .status-group-toggle:focus-visible {
    border: 0;
    outline: none;
    background: var(--color-primary-soft);
    box-shadow: none;
    color: #44546a;
    transform: none;
}

.dashboard-table-section .status-group-toggle strong {
    font-size: 11px;
    font-weight: 600;
    text-align: left;
}

.dashboard-table-section .status-group-count {
    margin-left: 1px;
    padding: 0 0 0 7px;
    border: 0;
    border-left: 1px solid #dfe3e8;
    background: transparent;
    color: #7d8793;
    font-size: 11px;
    line-height: 18px;
}

.dashboard-table-section .status-group-action {
    width: 32px;
    margin-left: 0;
    justify-self: end;
    color: #7d8793;
    font-size: 11px;
    text-align: right;
}

.dashboard-table-section .status-group-dot {
    width: 6px;
    height: 6px;
    flex-basis: 6px;
    justify-self: center;
    background: #99a2ad;
}

.dashboard-table-section .status-group-chevron {
    justify-self: center;
}

.dashboard-table-section .status-group-row[data-status="TIMEOUT"] .status-group-dot,
.dashboard-table-section .status-group-row[data-status="FAILED"] .status-group-dot {
    background: #c96862;
}

.dashboard-table-section .status-group-row[data-status="BLOCKED"] .status-group-dot {
    background: #b18a4c;
}

.dashboard-table-section .status-group-row[data-status="COMPLETED"] .status-group-dot,
.dashboard-table-section .status-group-row[data-status="SKIPPED"] .status-group-dot {
    background: #99a2ad;
}

.code-reveal {
    max-width: 180px;
    overflow: hidden;
    padding: 2px 4px;
    border: 0;
    background: transparent;
    color: var(--color-primary);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.table-wrap {
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-panel);
    background: var(--color-surface);
    overscroll-behavior-inline: contain;
    scrollbar-color: #b8c1cc #f2f4f6;
    scrollbar-width: thin;
}

.table-wrap::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.table-wrap::-webkit-scrollbar-track {
    border-radius: 999px;
    background: #f2f4f6;
}

.table-wrap::-webkit-scrollbar-thumb {
    min-width: 44px;
    border: 2px solid #f2f4f6;
    border-radius: 999px;
    background: #b8c1cc;
}

.table-wrap::-webkit-scrollbar-thumb:hover {
    background: #929eac;
}

.table-wrap::-webkit-scrollbar-button {
    display: none;
    width: 0;
    height: 0;
}

.table-wrap::-webkit-scrollbar-corner {
    background: transparent;
}

.table-wrap[hidden] {
    display: none;
}

table {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
}

th {
    padding: 10px var(--space-3);
    background: var(--color-surface-muted);
    color: var(--color-text-secondary);
    text-align: left;
    font-size: 12px;
    font-weight: 650;
    line-height: 20px;
}

td {
    padding: 11px var(--space-3);
    border-top: 1px solid var(--color-border);
    color: var(--color-text);
    line-height: 20px;
    vertical-align: middle;
}

tbody tr:hover {
    background: var(--color-surface-hover);
}

td:not(.actions) {
    white-space: nowrap;
}

.badge {
    display: inline-flex;
    min-height: 24px;
    align-items: center;
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 650;
    line-height: 18px;
    white-space: nowrap;
}

.COMPLETED {
    background: var(--color-success-soft);
    color: var(--color-success);
}

.WAITING {
    background: var(--color-neutral-soft, #f1f3f5);
    color: var(--color-text-secondary);
}

.TIMEOUT,
.FAILED {
    background: var(--color-danger-soft);
    color: var(--color-danger);
}

.BLOCKED {
    background: var(--color-warning-soft);
    color: var(--color-warning);
}

.SKIPPED {
    background: var(--color-primary-soft);
    color: var(--color-primary);
}

.late {
    color: var(--color-warning);
    font-size: 12px;
}

.empty {
    padding: 36px var(--space-5);
    border: 1px dashed var(--color-border-strong);
    border-radius: var(--radius-panel);
    background: var(--color-surface);
    color: var(--color-text-secondary);
    text-align: center;
}

.table-wrap .empty {
    border: 0;
    border-radius: 0;
}

.error,
.notice {
    margin: var(--space-4) 0;
    padding: 10px var(--space-3);
    border: 1px solid transparent;
    border-radius: var(--radius-control);
}

.error {
    border-color: #ffd5d2;
    background: var(--color-danger-soft);
    color: var(--color-danger);
}

.notice {
    border-color: #b9ecd7;
    background: var(--color-success-soft);
    color: var(--color-success);
}

.filters,
.form-stack {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: var(--space-3);
    margin: var(--space-4) 0;
    padding: var(--space-4);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-panel);
    background: var(--color-surface);
}

.filters label,
.form-stack label,
.modal label {
    display: grid;
    min-width: min(100%, 160px);
    flex: 1 1 160px;
    gap: 6px;
    color: var(--color-text);
    font-size: 13px;
    font-weight: 500;
}

/* A grid item can stretch to its row's tallest peer. Keep form controls pinned
   below their label instead of distributing that spare height between tracks. */
.modal form > label {
    align-content: start;
}

.filters button {
    flex: 0 0 auto;
    min-height: var(--control-height);
}

.history-heading {
    align-items: flex-end;
}

.history-total {
    flex: 0 0 auto;
    padding: 5px 9px;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    background: var(--color-surface);
    color: var(--color-text-secondary);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.history-filters {
    display: grid;
    grid-template-columns: repeat(5, minmax(130px, 1fr)) auto;
}

.history-filters label {
    min-width: 0;
}

.history-table-section {
    min-width: 0;
    margin-top: var(--space-5);
}

.history-table-heading {
    display: flex;
    min-width: 0;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: var(--space-3);
}

.history-table-heading h2 {
    margin: 0 0 var(--space-1);
    font-size: 18px;
    line-height: 1.35;
}

.history-table-heading p {
    margin: 0;
    color: var(--color-text-secondary);
    font-size: 12px;
}

.history-table {
    width: 100%;
    min-width: 980px;
    table-layout: fixed;
}

.history-table .history-date { width: 108px; }
.history-table .history-process { width: 150px; }
.history-table .history-schedule { width: 150px; }
.history-table .history-planned { width: 94px; }
.history-table .history-finished { width: 150px; }
.history-table .history-result { width: 104px; }
.history-table .history-late { width: 108px; }
.history-table .history-action { width: 76px; }

.history-table td {
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-table .history-remark-value {
    white-space: normal;
    overflow-wrap: anywhere;
}

.history-table .history-late-value.is-late {
    color: var(--color-warning);
    font-weight: 600;
}

.danger-text {
    min-height: 28px;
    border-color: transparent;
    background: transparent;
    color: var(--color-danger);
    font-size: 12px;
    font-weight: 600;
}

.danger-text:hover {
    border-color: #ffd5d2;
    background: var(--color-danger-soft);
    color: #d9363e;
}

.danger-button {
    border-color: var(--color-danger);
    background: var(--color-danger);
    color: #fff;
}

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

.danger-button:disabled,
.danger-button:disabled:hover {
    border-color: var(--color-border);
    background: var(--color-neutral-soft, #f1f3f5);
    color: var(--color-disabled);
}

.danger-modal {
    border-color: #ffd5d2;
}

.danger-modal .modal-title {
    border-bottom-color: var(--color-danger);
    background: var(--color-danger-soft);
}

.danger-modal .modal-title h2 {
    color: var(--color-danger);
}

.danger-notice {
    margin: 0;
    padding: 10px var(--space-3);
    border: 1px solid #ffd5d2;
    border-radius: var(--radius-control);
    background: var(--color-danger-soft);
    color: #d9363e;
    line-height: 1.6;
}

.danger-detail {
    margin: var(--space-3) 0 0;
    color: var(--color-text-secondary);
    font-size: 12px;
}

.settings-layout {
    display: grid;
    grid-template-columns: minmax(240px, 310px) minmax(0, 1fr);
    gap: var(--space-4);
    margin-top: var(--space-5);
}

.settings-layout>*,
.settings-grid>* {
    min-width: 0;
}

.settings-tabs {
    display: flex;
    gap: var(--space-1);
    margin: var(--space-5) 0 var(--space-4);
    overflow-x: auto;
    padding-bottom: 1px;
    border-bottom: 1px solid var(--color-border);
}

.settings-tab {
    flex: 0 0 auto;
    min-height: 34px;
    border: 0;
    border-radius: 6px 6px 0 0;
    background: transparent;
    color: var(--color-text-secondary);
}

.settings-tab:hover {
    background: var(--color-surface-muted);
    color: var(--color-text);
}

.settings-tab.active {
    background: var(--color-primary-soft);
    color: var(--color-primary);
    font-weight: 700;
}

.settings-section {
    display: none;
    min-width: 0;
}

.settings-section.active {
    display: block;
}

.section-heading {
    display: flex;
    min-width: 0;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
}

.section-heading>div {
    min-width: 0;
}

.section-heading h2 {
    margin: 0 0 var(--space-1);
    font-size: 18px;
    line-height: 1.35;
}

.section-heading p {
    margin: 0;
    color: var(--color-text-secondary);
}

.section-space {
    margin-top: var(--space-5);
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-4);
}

.panel-copy {
    margin: 0;
    padding: var(--space-4);
    color: var(--color-text-secondary);
}

.process-panel,
.schedule-panel,
.account-card,
.guide-grid article {
    min-width: 0;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-panel);
    background: var(--color-surface);
}

.panel-title {
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    min-height: 68px;
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--color-border);
}

.panel-title>div {
    min-width: 0;
}

.panel-title h2 {
    margin: 0;
    font-size: 16px;
    line-height: 1.35;
}

.panel-title p {
    margin: var(--space-1) 0 0;
    overflow: hidden;
    color: var(--color-text-secondary);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.panel-title>span {
    color: var(--color-text-secondary);
    font-size: 12px;
}

.process-list {
    max-height: min(62vh, 680px);
    overflow-y: auto;
    padding: var(--space-2);
}

/* Fixed-height supporting lists remain scrollable but do not show a visual rail. */
.embedded-scroll-list {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.embedded-scroll-list::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

.department-label {
    margin: 11px var(--space-2) 5px;
    color: var(--color-text-tertiary);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
}

.department-group {
    margin: 3px 0;
}

.department-group summary {
    padding: var(--space-2);
    color: var(--color-text-secondary);
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    list-style: none;
}

.department-group summary::-webkit-details-marker {
    display: none;
}

.department-group summary::before {
    content: "›";
    display: inline-block;
    margin-right: 6px;
    transition: transform .12s;
}

.department-group[open] summary::before {
    transform: rotate(90deg);
}

.department-group summary span {
    float: right;
    color: var(--color-text-tertiary);
    font-weight: 500;
}

.process-item {
    display: flex;
    width: 100%;
    min-width: 0;
    align-items: center;
    justify-content: flex-start;
    gap: 9px;
    padding: 9px 10px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--color-text);
    text-align: left;
    white-space: normal;
}

.process-item:hover,
.process-item.selected {
    background: var(--color-primary-soft);
    color: var(--color-text);
}

.process-item>span:nth-child(2) {
    min-width: 0;
}

.process-item strong,
.process-item small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.process-item small {
    margin-top: 2px;
    color: var(--color-text-secondary);
    font-size: 12px;
}

.process-item em {
    margin-left: auto;
    color: var(--color-text-secondary);
    font-size: 11px;
    font-style: normal;
}

.process-dot {
    width: 8px;
    height: 8px;
    flex: 0 0 8px;
    border-radius: 50%;
    background: var(--color-disabled);
}

.process-dot.enabled {
    background: var(--color-success);
}

.schedule-panel .empty {
    margin: var(--space-4);
}

.actions {
    display: flex;
    min-width: 0;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
}

.table-actions {
    gap: var(--space-3);
}

.actions button {
    min-width: 0;
}

.secondary {
    border-color: var(--color-border-strong);
    background: var(--color-surface);
    color: var(--color-text);
}

.secondary:hover {
    border-color: #9eb8ff;
    background: var(--color-surface-hover);
    color: var(--color-text);
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 5;
    display: grid;
    place-items: center;
    padding: var(--space-4);
    background: rgba(31, 35, 41, .52);
}

.modal {
    display: flex;
    width: min(600px, 100%);
    max-height: calc(100vh - 32px);
    min-width: 0;
    flex-direction: column;
    border-radius: var(--radius-panel);
    background: var(--color-surface);
    box-shadow: var(--shadow-modal);
}

.modal-title {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--color-border);
}

.modal h2 {
    margin: 0;
    font-size: 18px;
    line-height: 1.35;
}

.command-mode-stage {
    position: fixed;
    z-index: var(--z-global-dialog);
    inset: 0;
    display: grid;
    place-items: center;
    overflow: hidden;
    background: rgba(9, 24, 54, .82);
    color: #f5f8ff;
    isolation: isolate;
}

.command-mode-stage::before,
.command-mode-stage::after {
    position: absolute;
    content: "";
    pointer-events: none;
}

.command-mode-stage::before {
    inset: 0;
    background: repeating-linear-gradient(0deg, transparent 0 4px, rgba(164, 203, 255, .05) 4px 5px);
}

.command-mode-stage::after {
    top: 50%;
    left: 50%;
    width: min(86vw, 860px);
    aspect-ratio: 1;
    border: 1px solid rgba(126, 182, 255, .36);
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(.15);
    animation: command-radar-pulse 2.2s ease-out infinite;
}

.command-mode-radar {
    position: absolute;
    top: 50%;
    left: 50%;
    width: min(64vw, 620px);
    aspect-ratio: 1;
    border: 1px solid rgba(126, 182, 255, .18);
    border-radius: 50%;
    background: conic-gradient(from 210deg, transparent 0 62%, rgba(102, 205, 255, .22) 74%, transparent 84%);
    transform: translate(-50%, -50%);
    animation: command-radar-spin 5s linear infinite;
}

.command-mode-satellite {
    position: absolute;
    top: var(--signal-y, 24%);
    left: var(--signal-x, 72%);
    display: grid;
    width: 48px;
    height: 48px;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    animation: command-satellite 1.7s ease-in-out infinite alternate;
    cursor: crosshair;
    transition: top .36s cubic-bezier(.2, .8, .2, 1), left .36s cubic-bezier(.2, .8, .2, 1);
}

.command-mode-satellite::before {
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: #85ffc2;
    box-shadow: 0 0 0 7px rgba(133, 255, 194, .12), 0 0 30px #85ffc2;
    content: "";
}

.command-mode-satellite:hover::before,
.command-mode-satellite:focus-visible::before {
    box-shadow: 0 0 0 10px rgba(133, 255, 194, .2), 0 0 38px #85ffc2;
    transform: scale(1.22);
}

.command-mode-satellite:focus-visible {
    outline: 2px solid #d5ffe8;
    outline-offset: 3px;
}

.command-mode-message {
    position: relative;
    z-index: 1;
    display: grid;
    max-width: min(88vw, 560px);
    gap: var(--space-2);
    padding: var(--space-5);
    text-align: center;
    text-shadow: 0 2px 20px rgba(2, 10, 27, .65);
    animation: command-message-in .45s cubic-bezier(.2, .8, .2, 1) both;
}

.command-mode-message p,
.command-mode-message h2 {
    margin: 0;
}

.command-mode-message p:first-child {
    color: #8dbaff;
    font-family: var(--font-mono, monospace);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
}

.command-mode-message h2 {
    color: #fff;
    font-size: clamp(22px, 4vw, 40px);
    line-height: 1.15;
}

.command-mode-message p:last-child {
    color: #cbdcff;
    font-size: 16px;
}

.command-mode-message .command-mode-hint {
    margin-top: var(--space-3);
    color: rgba(203, 220, 255, .72);
    font-size: 12px;
    letter-spacing: .3px;
}

.command-mode-stage.is-signal-hit::before {
    animation: command-signal-flash .34s ease-out;
}

.command-mode-stage.is-calibrated {
    background: rgba(8, 39, 48, .86);
}

.command-mode-stage.is-calibrated .command-mode-message h2 {
    color: #b6ffda;
    font-size: clamp(16px, 3.2vw, 32px);
    line-height: 1.25;
    white-space: nowrap;
}

.command-mode-stage.is-calibrated .command-mode-message {
    padding: var(--space-4);
}

.command-mode-stage.is-calibrated .command-mode-radar {
    border-color: rgba(133, 255, 194, .42);
    background: conic-gradient(from 210deg, transparent 0 55%, rgba(133, 255, 194, .3) 70%, transparent 84%);
}

@keyframes command-radar-spin { to { transform: translate(-50%, -50%) rotate(360deg); } }
@keyframes command-radar-pulse { 0% { opacity: .9; transform: translate(-50%, -50%) scale(.15); } 100% { opacity: 0; transform: translate(-50%, -50%) scale(1); } }
@keyframes command-satellite { to { transform: translate(-10px, 14px); } }
@keyframes command-message-in { from { opacity: 0; transform: scale(.88); } to { opacity: 1; transform: scale(1); } }
@keyframes command-signal-flash { from { background-color: rgba(133, 255, 194, .18); } to { background-color: transparent; } }

@media (prefers-reduced-motion: reduce) {
    .command-mode-stage *,
    .command-mode-stage::after { animation: none; }
}

.icon-button {
    min-height: 28px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--color-text-secondary);
    font-size: 24px;
    font-weight: 400;
    line-height: 1;
}

.icon-button:hover {
    background: transparent;
    color: var(--color-text);
}

.modal form {
    display: grid;
    min-width: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-3);
    overflow-y: auto;
    overflow-x: hidden;
    padding: var(--space-4) var(--space-5) var(--space-5);
}

.guide-copy-dialog {
    display: grid;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5) var(--space-5);
}

.guide-copy-dialog p {
    margin: 0;
}

.guide-copy-dialog textarea {
    min-height: 260px;
    resize: vertical;
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.5;
}

.modal-actions {
    display: flex;
    grid-column: 1 / -1;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: var(--space-2);
    margin-top: var(--space-2);
}

.modal.notification-rule-modal {
    width: min(720px, 100%);
}

.modal.account-permission-modal {
    width: min(720px, 100%);
}

.permission-picker {
    min-width: 0;
    margin: 2px 0 0;
    padding: 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-control);
    background: var(--color-surface-muted);
}

.permission-picker legend {
    padding: 0 7px;
    color: var(--color-text);
    font-size: 14px;
    font-weight: 700;
}

.permission-picker > p {
    margin: -2px 0 14px;
    color: var(--color-text-secondary);
    font-size: 12px;
}

.permission-group + .permission-group {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--color-border);
}

.permission-group h3 {
    margin: 0 0 8px;
    color: var(--color-text-secondary);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .04em;
}

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

.modal .permission-card {
    display: flex;
    min-width: 0;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 11px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-control);
    background: var(--color-surface);
    cursor: pointer;
}

.modal .permission-card:hover {
    border-color: var(--color-primary);
    background: var(--color-primary-soft);
}

.modal .permission-card:has(input:checked) {
    border-color: #91afff;
    background: var(--color-primary-soft);
    box-shadow: inset 3px 0 0 var(--color-primary);
}

.modal .permission-card input {
    width: 16px;
    height: 16px;
    min-height: 16px;
    flex: 0 0 auto;
    margin: 2px 0 0;
    accent-color: var(--color-primary);
}

.permission-copy {
    display: grid;
    min-width: 0;
    gap: 2px;
}

.permission-copy strong {
    color: var(--color-text);
    font-size: 13px;
    font-weight: 600;
}

.permission-copy small,
.permission-note {
    color: var(--color-text-secondary);
    font-size: 11px;
    font-weight: 400;
    line-height: 1.45;
}

.permission-note {
    display: block;
    margin-top: 12px;
}

.notification-rule-modal form {
    gap: 10px;
    padding: 14px var(--space-5) 16px;
}

.notification-rule-modal textarea {
    min-height: 64px;
}

.modal-error {
    grid-column: 1 / -1;
    margin: 0;
}

.flash-message {
    position: fixed;
    z-index: 20;
    right: var(--space-5);
    bottom: var(--space-5);
    max-width: min(420px, calc(100vw - 32px));
    margin: 0;
    padding: 10px 14px;
    border: 1px solid #b9ecd7;
    border-radius: var(--radius-control);
    background: var(--color-success-soft);
    box-shadow: var(--shadow-modal);
    color: #067647;
    font-weight: 600;
}

.dependency-list {
    grid-column: 1 / -1;
    margin: 0;
    color: var(--color-text-secondary);
}

.dependency-picker-modal .dependency-picker-help {
    grid-column: 1 / -1;
    margin: 0;
    color: var(--color-text-secondary);
}

.dependency-picker-modal .dependency-current {
    grid-column: 1 / -1;
    padding: 0;
    border: 0;
    background: transparent;
}

.dependency-picker-modal .dependency-current-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.dependency-picker-modal .dependency-current-heading strong {
    color: var(--color-text);
    font-size: 12px;
    font-weight: 700;
}

.dependency-picker-modal .dependency-current-heading span {
    padding: 2px 7px;
    border-radius: 999px;
    background: var(--color-surface-muted);
    color: var(--color-text-secondary);
    font-size: 11px;
    font-weight: 600;
}

.dependency-picker-modal .dependency-current ul {
    max-height: 112px;
    margin: 0;
    padding: 0;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-control);
    background: var(--color-surface-muted);
    overflow: auto;
    color: var(--color-text-secondary);
    list-style: none;
}

.dependency-picker-modal .dependency-current li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    min-height: 38px;
    padding: 5px 7px 5px 10px;
}

.dependency-picker-modal .dependency-current li span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.dependency-picker-modal .dependency-current li + li {
    border-top: 1px solid var(--color-border);
}

.dependency-picker-modal .dependency-remove {
    flex: 0 0 auto;
    min-height: 26px;
    padding: 2px 7px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--color-danger);
    font-size: 12px;
    font-weight: 600;
}

.dependency-picker-modal .dependency-remove:hover { background: #fee2e2; }

.dependency-picker-modal .dependency-picker {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-3);
}

.dependency-picker-modal .dependency-picker label {
    min-width: 0;
    align-content: start;
}

@media (max-width: 800px) {
    .dependency-picker-modal .dependency-picker {
        grid-template-columns: 1fr;
    }
}

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

/* AI management: operational admin UI built from the shared form, table and dialog tokens. */
.ai-heading { align-items: flex-end; }
.ai-tabs { margin-bottom: var(--space-5); }
.pending-operation-count { display: inline-flex; min-width: 18px; height: 18px; align-items: center; justify-content: center; margin-left: 4px; padding: 0 5px; border-radius: 999px; background: var(--color-danger); color: #fff; font-size: 11px; font-weight: 700; line-height: 1; }
.ai-pending-alert { display: block; width: 100%; margin: 0 0 var(--space-4); padding: 10px var(--space-3); border: 1px solid #ffd591; border-radius: var(--radius-control); background: var(--color-warning-soft); color: #9a6700; text-align: left; font-weight: 600; }
.pending-operation-count[hidden], .ai-pending-alert[hidden] { display: none; }
.ai-pending-alert:hover { border-color: #e6a23c; background: #fff2d8; }
.ai-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0 0 var(--space-4); }
.ai-metrics article { min-height: 126px; }
.ai-metrics b { display: block; margin: var(--space-2) 0 2px; font-size: 30px; line-height: 1.1; }
.ai-metrics small { display: block; }
.ai-recent-panel { overflow: hidden; }
.ai-operation-list { display: grid; }
.ai-operation-row { display: flex; width: 100%; min-height: 62px; align-items: center; justify-content: space-between; gap: var(--space-3); padding: 13px var(--space-4); border: 0; border-top: 1px solid var(--color-border); border-radius: 0; background: var(--color-surface); color: var(--color-text); text-align: left; }
.ai-operation-row:first-child { border-top: 0; }
.ai-operation-row:hover { background: var(--color-surface-muted); }
.ai-operation-row strong, .ai-operation-row small { display: block; }
.ai-operation-row small { margin-top: 2px; color: var(--color-text-secondary); font-size: 12px; }
.ai-operation-row-status { display: inline-flex; align-items: center; gap: var(--space-2); }
.ai-operation-filters { justify-content: flex-start; margin-bottom: var(--space-3); }
.ai-operation-filters label { min-width: 180px; }
.ai-operation-table code { font-size: 11px; }
.ai-operation-table td { vertical-align: top; }
.ai-operation-error { display: block; max-width: 240px; margin-top: 5px; color: var(--color-danger); font-size: 11px; line-height: 1.45; }
.modal.ai-operation-detail-modal { width: min(760px, 100%); }
.operation-detail { display: grid; grid-column: 1 / -1; gap: var(--space-4); }
.operation-detail section { padding-top: var(--space-3); border-top: 1px solid var(--color-border); }
.operation-detail section h3 { margin: 0 0 var(--space-3); font-size: 14px; }
.ai-operation-detail-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2) var(--space-4); margin: 0; }
.ai-operation-detail-meta div { min-width: 0; }
.ai-operation-detail-meta dt { margin-bottom: 3px; color: var(--color-text-secondary); font-size: 11px; }
.ai-operation-detail-meta dd { margin: 0; overflow-wrap: anywhere; }
.operation-result { max-height: 260px; margin: 0; overflow: auto; padding: var(--space-3); border: 1px solid var(--color-border); border-radius: var(--radius-control); background: var(--color-surface-muted); font-size: 12px; }
.ai-empty { margin: var(--space-4); }
.ai-status { display: inline-flex; min-height: 24px; align-items: center; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 650; line-height: 18px; white-space: nowrap; }
.ai-status.success { background: var(--color-success-soft); color: var(--color-success); }
.ai-status.warning { background: var(--color-warning-soft); color: var(--color-warning); }
.ai-status.danger { background: var(--color-danger-soft); color: var(--color-danger); }
.ai-status.neutral { background: var(--color-surface-muted); color: var(--color-text-secondary); }
.ai-client-table td strong { display: block; }
.ai-client-table-wrap { overflow: visible; }
.ai-code { display: block; margin-top: 2px; color: var(--color-text-secondary); font-family: var(--font-mono, ui-monospace, monospace); font-size: 12px; }
.ai-row-actions { display: inline-flex; align-items: center; gap: var(--space-2); }
.ai-row-actions details { position: relative; }
.ai-row-actions summary { display: grid; width: 30px; height: 28px; place-items: center; border: 1px solid var(--color-border-strong); border-radius: var(--radius-control); color: var(--color-text-secondary); cursor: pointer; font-weight: 700; list-style: none; }
.ai-row-actions summary::-webkit-details-marker { display: none; }
.ai-row-actions details[open] summary, .ai-row-actions summary:hover { border-color: var(--color-primary); background: var(--color-primary-soft); color: var(--color-primary); }
.ai-row-actions details > div { position: absolute; z-index: 2; top: calc(100% + 4px); right: 0; min-width: 100px; padding: var(--space-1); border: 1px solid var(--color-border); border-radius: var(--radius-control); background: var(--color-surface); box-shadow: 0 8px 20px rgba(31, 35, 41, .12); }
.ai-row-actions details button { width: 100%; min-height: 30px; border: 0; background: transparent; color: var(--color-danger); font-size: 12px; font-weight: 600; }
.ai-row-actions details button:hover { background: var(--color-danger-soft); }
.ai-row-actions details button.danger { color: var(--color-danger); }
.ai-approval-list { display: grid; gap: var(--space-4); }
.ai-approval-card { min-width: 0; border: 1px solid var(--color-border); border-radius: var(--radius-panel); background: var(--color-surface); overflow: hidden; }
.ai-approval-card > header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4); padding: var(--space-4); border-bottom: 1px solid var(--color-border); }
.ai-approval-card h2 { margin: 2px 0; font-size: 17px; }
.ai-approval-card header p:not(.eyebrow) { margin: 0; color: var(--color-text-secondary); font-size: 12px; }
.ai-risk { margin: var(--space-3) var(--space-4) 0; padding: 9px var(--space-3); border: 1px solid #ffd591; border-radius: var(--radius-control); background: var(--color-warning-soft); color: #9a6700; }
.ai-diff-section { padding: var(--space-4); }
.ai-diff-section h3 { margin: 0 0 var(--space-3); font-size: 14px; }
.ai-diff { display: grid; gap: var(--space-2); margin: 0; }
.ai-diff > div { display: grid; grid-template-columns: minmax(120px, 180px) minmax(0, 1fr); gap: var(--space-3); }
.ai-diff dt { color: var(--color-text-secondary); font-size: 12px; }
.ai-diff dd { display: flex; min-width: 0; align-items: center; gap: var(--space-2); margin: 0; overflow-wrap: anywhere; }
.ai-diff-value { display: grid; min-width: 0; gap: 2px; padding: 5px 8px; border: 1px solid var(--color-border); border-radius: 4px; background: var(--color-surface-muted); }
.ai-diff-value small { color: var(--color-text-secondary); font-size: 11px; }
.ai-diff-value b { color: var(--color-text); font-weight: 600; overflow-wrap: anywhere; }
.ai-diff-value.after { border-color: #9fc3ff; background: var(--color-primary-soft); }
.ai-diff dd i { color: var(--color-text-tertiary); font-style: normal; }
.ai-no-change { margin: 0; color: var(--color-text-secondary); }
.ai-operation-meta { display: flex; flex-wrap: wrap; gap: 5px 18px; margin: var(--space-2) 0 0; }
.ai-operation-meta div { display: flex; gap: 5px; font-size: 12px; }
.ai-operation-meta dt { color: var(--color-text-secondary); }
.ai-operation-meta dd { margin: 0; color: var(--color-text); }
.ai-operation-meta code { font-size: 11px; }
.ai-risk-level { display: inline-flex; padding: 1px 7px; border-radius: 999px; background: var(--color-success-soft); color: var(--color-success); font-weight: 650; }
.ai-risk-level.medium { background: var(--color-warning-soft); color: var(--color-warning); }
.ai-risk-level.high { background: var(--color-danger-soft); color: var(--color-danger); }
.ai-risk strong { margin-right: 4px; }
.ai-risk.high { border-color: #ffb3ae; background: var(--color-danger-soft); color: var(--color-danger); }
.ai-approval-card footer { display: flex; justify-content: flex-end; gap: var(--space-2); padding: var(--space-3) var(--space-4); border-top: 1px solid var(--color-border); background: var(--color-surface-muted); }
.ai-audit-table code { font-size: 11px; }
.pagination { display: flex; align-items: center; justify-content: flex-end; gap: var(--space-2); margin-top: var(--space-3); color: var(--color-text-secondary); font-size: 12px; }
.pagination button { min-height: 32px; padding: 5px 10px; font-size: 12px; }
.ai-key-reveal { display: grid; grid-column: 1 / -1; gap: var(--space-3); }
.ai-key-reveal p { margin: 0; color: var(--color-text-secondary); }
.ai-key-reveal input { font-family: var(--font-mono, ui-monospace, monospace); }
.modal.ai-policy-modal { width: min(580px, 100%); }
.ai-policy-summary, .ai-policy-empty { display: grid; grid-column: 1 / -1; gap: var(--space-2); margin: 0; padding: var(--space-3); border: 1px solid var(--color-border); border-radius: var(--radius-control); background: var(--color-surface-muted); }
.ai-policy-summary p { margin: 0; color: var(--color-text-secondary); font-size: 12px; }
.ai-policy-summary span { display: inline-flex; width: fit-content; padding: 3px 7px; border-radius: 4px; background: var(--color-surface); color: var(--color-text-secondary); font-size: 12px; }
.ai-policy-summary b { color: var(--color-primary); }
.ai-policy-empty { color: var(--color-text-secondary); font-size: 12px; }
.ai-policy-modal form { gap: 10px; padding: var(--space-3) var(--space-4) var(--space-4); }
.ai-permission-help { margin: 0; color: var(--color-text-secondary); font-size: 12px; }
.ai-permission-groups { display: grid; gap: var(--space-3); padding: var(--space-3); border: 1px solid var(--color-border); border-radius: var(--radius-panel); background: var(--color-surface-muted); }
.ai-permission-groups section + section { padding-top: var(--space-3); border-top: 1px solid var(--color-border); }
.ai-permission-groups section > header { padding: 0 0 var(--space-2); }
.ai-permission-groups h3 { margin: 0; font-size: 13px; }
.ai-permission-card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); }
.ai-permission-row { display: grid; min-height: 62px; grid-template-columns: minmax(0, 1fr); align-content: space-between; gap: 5px; padding: 9px 10px; border: 1px solid var(--color-border); border-radius: var(--radius-control); background: var(--color-surface); }
.ai-permission-row.is-enabled { border-color: #7aa2ff; border-left: 3px solid var(--color-primary); padding-left: 8px; background: var(--color-primary-soft); }
.ai-permission-toggle { display: flex !important; min-width: 0 !important; align-items: center; gap: 10px !important; color: var(--color-text) !important; cursor: pointer; }
.ai-permission-toggle input { width: 18px; min-width: 18px; height: 18px; min-height: 18px; margin: 0; accent-color: var(--color-primary); }
.ai-permission-toggle b, .ai-permission-toggle small { display: block; }
.ai-permission-toggle small { margin-top: 1px; color: var(--color-text-secondary); font-size: 11px; font-weight: 400; }
.ai-permission-controls { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.ai-permission-row select { width: auto; min-width: 100px; min-height: 28px; padding: 3px 22px 3px 7px; font-size: 12px; }
.ai-permission-row .compact-action { min-height: 28px; padding: 3px 7px; }
.ai-policy-fixed { color: var(--color-warning); font-size: 12px; font-weight: 650; }
.ai-policy-fixed.direct { color: var(--color-success); }

@media (max-width: 700px) {
    .ai-heading { align-items: flex-start; }
    .ai-heading > button { width: 100%; }
    .ai-metrics { grid-template-columns: 1fr; }
    .ai-approval-card > header, .ai-operation-row { align-items: flex-start; flex-direction: column; }
    .ai-diff > div { grid-template-columns: 1fr; gap: 2px; }
    .ai-diff dd { flex-wrap: wrap; }
    .ai-client-table-wrap { overflow-x: auto; overflow-y: hidden; }
    .modal.ai-policy-modal { width: min(540px, 100%); }
    .ai-permission-card-grid { grid-template-columns: 1fr; }
}

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

.conflict-list {
    display: grid;
    gap: var(--space-3);
}

.conflict-item {
    padding: var(--space-3);
    border: 1px solid #ffd591;
    border-radius: var(--radius-md);
    background: var(--color-warning-soft);
}

.conflict-item p {
    margin: var(--space-1) 0 0;
}

.skip-modal p {
    margin: 0;
    color: var(--color-text-secondary);
    line-height: 1.6;
}

.history-list {
    grid-column: 1 / -1;
    max-height: 280px;
    overflow: auto;
}

.history-list p {
    margin: 0;
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border);
}

.history-list small {
    display: block;
    margin-top: var(--space-1);
    color: var(--color-text-secondary);
}

.notification-user-picker {
    grid-column: 1 / -1;
    margin: 0;
    padding: 0;
    border: 0;
}

.notification-user-picker legend {
    padding: 0;
    color: var(--color-text);
    font-size: 13px;
    font-weight: 500;
}

.notification-user-picker p {
    margin: 6px 0 9px;
    color: var(--color-text-secondary);
    font-size: 12px;
}

.notification-user-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-2);
}

.modal .notification-user-choice {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 9px;
    padding: 9px 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-control);
    background: var(--color-surface);
    cursor: pointer;
}

.notification-user-choice:hover {
    border-color: #adc6ff;
    background: var(--color-primary-soft);
}

.notification-user-choice input {
    position: absolute;
    width: 1px;
    min-height: 1px;
    opacity: 0;
}

.choice-check {
    display: grid;
    width: 19px;
    height: 19px;
    flex: 0 0 19px;
    place-items: center;
    border: 1px solid var(--color-border-strong);
    border-radius: 4px;
    color: transparent;
    font-size: 14px;
    font-weight: 700;
}

.notification-user-choice input:checked+.choice-check {
    border-color: var(--color-primary);
    background: var(--color-primary);
    color: #fff;
}

.notification-user-choice strong,
.notification-user-choice small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.notification-user-choice small {
    margin-top: 2px;
    color: var(--color-text-secondary);
    font-size: 11px;
}

.notification-user-choice.disabled {
    background: var(--color-surface-muted);
    cursor: not-allowed;
    opacity: .55;
}

.notification-channel-choice {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-control);
    background: var(--color-surface);
}

.notification-recipient-meta {
    min-width: 0;
}

.notification-recipient-meta strong,
.notification-recipient-meta small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.notification-recipient-meta strong {
    color: var(--color-text);
    font-size: 13px;
    font-weight: 650;
}

.notification-recipient-meta small {
    margin-top: 2px;
    color: var(--color-text-secondary);
    font-size: 11px;
}

.notification-channel-choice.disabled {
    background: var(--color-surface-muted);
    opacity: .55;
}

.notification-channel-options {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    margin-right: 14px;
    white-space: nowrap;
}

.notification-channel-options > span {
    margin-right: 1px;
    color: var(--color-text-secondary);
    font-size: 11px;
}

.notification-channel-options .channel-toggle {
    display: inline-flex;
    width: 56px;
    min-height: 56px;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin: 0;
    padding: 4px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    background: var(--color-surface-muted);
    color: var(--color-text);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
}

.modal .notification-channel-options .channel-toggle {
    min-width: 0;
    flex: 0 0 auto;
}

.notification-channel-options .channel-toggle:has(input:checked) {
    border-color: #9dbbff;
    background: var(--color-primary-soft);
    color: var(--color-primary);
}

.notification-channel-options .channel-toggle:has(input:disabled) {
    cursor: not-allowed;
    opacity: .55;
}

.notification-channel-options .channel-toggle input {
    width: 13px;
    height: 13px;
    margin: 0;
    accent-color: var(--color-primary);
}

@media (max-width: 620px) {
    .notification-channel-choice {
        grid-template-columns: 1fr;
        align-items: start;
    }

    .notification-channel-options {
        width: 100%;
    }

    .permission-grid {
        grid-template-columns: 1fr;
    }
}

.empty-choice {
    color: var(--color-text-secondary);
    font-size: 13px;
}

.account-card {
    width: min(100%, 560px);
    margin-top: var(--space-5);
    padding: var(--space-5);
}

.form-stack {
    display: grid;
    margin: 0;
    padding: 0;
    border: 0;
}

.form-stack label {
    min-width: 0;
}

.form-stack button {
    justify-self: start;
    margin-top: var(--space-1);
}

.guide-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
    gap: var(--space-4);
    margin-top: var(--space-5);
}

.guide-grid article {
    padding: var(--space-5);
}

.guide-grid h2 {
    margin: 0 0 10px;
    font-size: 17px;
}

.guide-grid p {
    margin: 0;
    color: var(--color-text-secondary);
    line-height: 1.7;
}

.guide-grid .code-card {
    grid-column: 1 / -1;
    border-color: var(--color-code-surface);
    background: var(--color-code-surface);
    color: #fff;
    padding: var(--space-4);
}

.code-card-title {
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: 10px;
}

.code-card h2,
.code-card>p {
    color: #fff;
}

.code-card>p {
    margin: 0 0 var(--space-4);
}

.guide-grid pre {
    max-width: 100%;
    overflow: auto;
    font-size: 13px;
    line-height: 1.65;
}

.guide-grid pre code {
    font-size: 13px;
}

.code-card pre {
    margin: 0;
    max-height: 420px;
    padding: var(--space-3);
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 6px;
    background: var(--color-code-surface-raised);
}

.code-card pre,
.code-card pre code {
    font-size: 12px;
    line-height: 1.6;
}

.code-card code {
    padding: 0;
    background: transparent;
    color: inherit;
}

.guide-code-card .code-card-note {
    margin-top: var(--space-3);
    color: var(--color-nav-text);
    font-size: 12px;
}

.code-card-note code {
    color: #fff;
}

.guide-steps {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-3);
    margin: var(--space-5) 0 var(--space-4);
}

.guide-steps article,
.guide-reference section,
.guide-notes article {
    min-width: 0;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-panel);
    background: var(--color-surface);
}

.guide-steps article {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-4);
}

.guide-step-number {
    display: grid;
    width: 26px;
    height: 26px;
    flex: 0 0 26px;
    place-items: center;
    border-radius: 50%;
    background: var(--color-primary-soft);
    color: var(--color-primary);
    font-size: 11px;
    font-weight: 700;
}

.guide-steps h2,
.guide-reference h2,
.guide-notes h2 {
    margin: 0 0 var(--space-1);
    color: var(--color-text);
    font-size: 15px;
    line-height: 1.4;
}

.guide-steps p,
.guide-reference p,
.guide-notes p {
    margin: 0;
    color: var(--color-text-secondary);
    font-size: 13px;
    line-height: 1.65;
}

.command-code {
    display: inline-block;
    margin-top: var(--space-2);
    white-space: nowrap;
}

.guide-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1.65fr) minmax(280px, .85fr);
    gap: var(--space-4);
    align-items: start;
}

.guide-workspace .guide-code-card {
    min-width: 0;
    margin: 0;
    padding: var(--space-4);
    border: 1px solid #344765;
    border-radius: var(--radius-panel);
    background: var(--color-code-surface);
    color: #fff;
}

.guide-code-card .code-card-title {
    flex-wrap: wrap;
    margin-bottom: var(--space-2);
}

.guide-code-card .code-card-title > div:first-child {
    flex: 1 1 180px;
}

.code-card-actions {
    display: flex;
    flex: 0 0 auto;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: var(--space-2);
}

.toggle-code {
    border-color: #60799e;
    background: transparent;
    color: #e5edf9;
}

.toggle-code:hover {
    border-color: #9bb9e8;
    background: rgba(191, 219, 254, .12);
}

.guide-code-card .eyebrow {
    margin: 0 0 2px;
    color: var(--color-code-accent);
}

.guide-code-card > p {
    font-size: 12px;
}

.guide-code-card pre {
    min-height: 0;
    max-height: none;
    overflow: visible;
    color: var(--color-code-text);
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.75;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    tab-size: 4;
}

.guide-code-card pre code {
    display: block;
    min-width: 0;
    color: var(--color-code-text);
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    white-space: inherit;
    overflow-wrap: inherit;
}

.guide-code-viewport {
    position: relative;
}

.guide-code-card.is-collapsed .guide-code-viewport {
    max-height: 388px;
    overflow: hidden;
}

.guide-code-card.is-collapsed .guide-code-viewport::after {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 72px;
    background: linear-gradient(transparent, var(--color-code-surface-raised));
    content: "";
    pointer-events: none;
}

.guide-reference {
    display: grid;
    gap: var(--space-3);
}

.guide-reference section {
    padding: var(--space-4);
}

.guide-reference pre {
    margin: var(--space-3) 0 0;
    overflow: auto;
    padding: var(--space-3);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-control);
    background: var(--color-surface-muted);
    color: var(--color-text);
    font-size: 12px;
    line-height: 1.6;
}

.guide-reference pre code {
    padding: 0;
    background: transparent;
    color: inherit;
}

.guide-reference-label {
    display: block;
    margin-bottom: var(--space-2);
    color: var(--color-primary);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.guide-notes {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-3);
    margin-top: var(--space-4);
}

.guide-notes article {
    padding: var(--space-4);
}

.guide-grid article:not(.code-card) pre {
    margin: var(--space-3) 0;
    padding: var(--space-3);
    border: 1px solid var(--color-code-surface);
    border-radius: 4px;
    background: var(--color-surface);
    color: var(--color-text);
}

.guide-grid article:not(.code-card) pre code {
    padding: 0;
    background: transparent;
    color: inherit;
}

.guide-entry-tabs {
    display: inline-flex;
    gap: var(--space-1);
    margin: var(--space-5) 0 var(--space-4);
    padding: 4px;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    background: var(--color-surface-muted);
}

.guide-entry-tab {
    min-height: 34px;
    padding: 6px 14px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--color-text-secondary);
    font-size: 13px;
    font-weight: 650;
}

.guide-entry-tab:hover {
    background: rgba(51, 112, 255, .08);
}

.guide-entry-tab.active {
    background: var(--color-surface);
    color: var(--color-primary);
    box-shadow: 0 1px 2px rgba(16, 24, 40, .1);
}

.guide-panel[hidden] {
    display: none;
}

.ai-skill-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-5);
    padding: clamp(20px, 3vw, 30px);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-panel);
    background: linear-gradient(120deg, var(--color-primary-soft), var(--color-surface));
}

.ai-skill-hero > div { min-width: 0; }
.ai-skill-hero .eyebrow { margin: 0 0 4px; }
.ai-skill-hero h2 { margin: 0 0 var(--space-2); font-size: 22px; }
.ai-skill-hero p { max-width: 700px; margin: 0; color: var(--color-text-secondary); line-height: 1.65; }
.ai-skill-download { flex: 0 0 auto; text-decoration: none; white-space: nowrap; }
.ai-skill-steps { margin-top: var(--space-4); }

.ai-skill-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(260px, .8fr);
    gap: var(--space-4);
}

.ai-skill-config-card,
.ai-skill-boundary {
    min-width: 0;
    padding: var(--space-4);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-panel);
    background: var(--color-surface);
}

.ai-skill-config-card h2 { margin: 0; font-size: 16px; }
.ai-skill-config-card .eyebrow { margin: 0 0 3px; }
.ai-skill-config-list { display: grid; gap: var(--space-3); margin: var(--space-3) 0 0; }
.ai-skill-config-list div { display: grid; grid-template-columns: 168px minmax(0, 1fr); gap: var(--space-3); }
.ai-skill-config-list dt { color: var(--color-text); font-weight: 700; }
.ai-skill-config-list dd { margin: 0; color: var(--color-text-secondary); font-size: 13px; line-height: 1.65; }

.ai-skill-boundary { border-color: #f0d8a0; background: #fffaf0; }
.ai-skill-boundary strong { display: block; margin-bottom: var(--space-2); color: #8a5a00; }
.ai-skill-boundary p { margin: 0; color: var(--color-text-secondary); font-size: 13px; line-height: 1.7; }

.workflow-intro {
    display: flex;
    min-width: 0;
    align-items: stretch;
    justify-content: space-between;
    gap: var(--space-5);
    padding: clamp(20px, 3vw, 32px);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-panel);
    background: linear-gradient(120deg, var(--color-primary-soft), var(--color-surface));
}

.workflow-intro > div {
    min-width: 0;
}

.workflow-intro .eyebrow,
.http-config-heading .eyebrow {
    margin: 0 0 var(--space-1);
    color: var(--color-primary);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
}

.workflow-intro h2 {
    margin: 0 0 var(--space-2);
    color: var(--color-text);
    font-size: 21px;
}

.workflow-intro p {
    max-width: 680px;
    margin: 0;
    color: var(--color-text-secondary);
    line-height: 1.7;
}

.workflow-callout {
    display: grid;
    min-width: min(100%, 230px);
    max-width: 280px;
    align-content: center;
    gap: var(--space-2);
    padding: var(--space-4);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-control);
    background: var(--color-surface);
    color: var(--color-text-secondary);
    font-size: 13px;
    line-height: 1.65;
}

.workflow-callout strong {
    color: var(--color-primary);
}

.workflow-steps {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-3);
    margin: var(--space-4) 0;
}

.workflow-steps article,
.http-config-card {
    min-width: 0;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-panel);
    background: var(--color-surface);
}

.workflow-steps article {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-4);
}

.workflow-steps h2 {
    margin: 0 0 var(--space-1);
    font-size: 15px;
}

.workflow-steps p,
.http-config-copy {
    margin: 0;
    color: var(--color-text-secondary);
    font-size: 13px;
    line-height: 1.65;
}

.workflow-layout {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-4);
}

.http-config-card {
    padding: var(--space-5);
}

.http-config-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
}

.http-config-heading h2 {
    margin: 0;
    color: var(--color-text);
    font-size: 17px;
    line-height: 1.4;
}

.http-method {
    flex: 0 0 auto;
    padding: 4px 7px;
    border-radius: 4px;
    font-family: "SFMono-Regular", Consolas, monospace;
    font-size: 11px;
    font-weight: 700;
}

.http-method.post {
    background: var(--color-success-soft);
    color: var(--color-success);
}

.http-method.get {
    background: var(--color-primary-soft);
    color: var(--color-primary);
}

.http-config-list {
    display: grid;
    gap: 0;
    margin: var(--space-4) 0 0;
    border-top: 1px solid var(--color-border);
}

.http-config-list > div {
    display: grid;
    grid-template-columns: 124px minmax(0, 1fr);
    gap: var(--space-3);
    padding: 12px 0;
    border-bottom: 1px solid var(--color-border);
}

.http-config-list dt {
    color: var(--color-text-secondary);
    font-size: 12px;
    font-weight: 700;
}

.http-config-list dd {
    min-width: 0;
    margin: 0;
    color: var(--color-text);
    font-size: 13px;
    line-height: 1.7;
    overflow-wrap: anywhere;
}

.http-config-tip {
    margin: var(--space-3) 0 0;
    padding: var(--space-3);
    border-radius: var(--radius-control);
    background: var(--color-surface-muted);
    color: var(--color-text-secondary);
    font-size: 12px;
    line-height: 1.65;
}

.workflow-response {
    margin-top: var(--space-4);
    padding: var(--space-3);
    border-left: 3px solid var(--color-primary);
    border-radius: 0 var(--radius-control) var(--radius-control) 0;
    background: var(--color-primary-soft);
}

.workflow-response strong {
    color: var(--color-primary);
    font-size: 13px;
}

.workflow-response p {
    margin: var(--space-1) 0 0;
    color: var(--color-text-secondary);
    font-size: 13px;
    line-height: 1.65;
}

.workflow-notes {
    margin-top: var(--space-4);
}

.copy-code {
    border-color: #5e8cff;
    background: #2f63e8;
    color: #fff;
}

.copy-code:hover {
    border-color: #8babff;
    background: #245bdb;
}

.notification-log-help {
    margin: -7px var(--space-4) var(--space-4);
    color: var(--color-text-secondary);
    font-size: 12px;
    line-height: 1.55;
}

body.login-page {
    display: grid;
    align-content: center;
    min-height: 100vh;
    padding: clamp(16px, 3vw, 40px);
    background: #f1f3f5;
}

.login-shell {
    display: grid;
    grid-template-columns: minmax(360px, .95fr) minmax(400px, 1.05fr);
    width: min(1040px, 100%);
    min-height: min(680px, calc(100vh - clamp(32px, 6vw, 80px)));
    margin: 0 auto;
    overflow: hidden;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    background: var(--color-surface);
    box-shadow: 0 12px 30px rgba(31, 41, 51, .08);
}

.login-intro {
    display: flex;
    min-width: 0;
    flex-direction: column;
    padding: clamp(32px, 5vw, 56px);
    background: var(--color-nav);
    color: #fff;
}

.login-intro .login-brand {
    color: #fff;
}

.login-intro-copy {
    margin-top: auto;
}

.login-eyebrow,
.login-kicker {
    margin: 0;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .11em;
}

.login-eyebrow {
    color: var(--color-nav-text);
}

.login-intro h1 {
    margin: var(--space-3) 0;
    font-size: clamp(26px, 2.6vw, 34px);
    font-weight: 700;
    letter-spacing: -.7px;
    line-height: 1.3;
}

.login-intro-copy > p:last-child {
    max-width: 310px;
    margin: 0;
    color: var(--color-nav-text);
    line-height: 1.7;
}

.login-capabilities {
    display: grid;
    gap: 10px;
    margin: var(--space-6) 0 0;
    padding: 0;
    color: #fff;
    font-size: 13px;
    list-style: none;
}

.login-capabilities li {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.login-capabilities span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #fff;
}

.login-footnote {
    margin: auto 0 0;
    color: var(--color-nav-text);
    font-size: 12px;
}

.login-form-panel {
    display: grid;
    place-items: center;
    min-width: 0;
    padding: clamp(32px, 5vw, 64px);
    background: var(--color-surface);
}

body.login-page .login-card {
    width: min(360px, 100%);
    margin: 0;
}

body.login-page .login-brand {
    font-size: 16px;
    font-weight: 700;
}

body.login-page .login-card h1 {
    margin: var(--space-2) 0 6px;
    font-size: 24px;
    letter-spacing: -.3px;
}

.login-kicker {
    color: var(--color-primary);
}

body.login-page .login-card>p {
    margin: 0;
    color: var(--color-text-secondary);
    line-height: 1.6;
}

body.login-page .login-card form {
    display: grid;
    gap: 15px;
    margin-top: var(--space-5);
}

body.login-page .login-card label {
    display: grid;
    gap: 6px;
    color: #3b3f45;
    font-weight: 500;
}

body.login-page .login-card input,
body.login-page .login-card button {
    min-height: 40px;
}

body.login-page .login-card button {
    margin-top: var(--space-1);
}

body.login-page .login-card .error {
    margin: 18px 0 0;
}

@media (max-width: 1180px) {
    .topbar {
        gap: var(--space-3);
    }

    .settings-layout {
        grid-template-columns: minmax(220px, 270px) minmax(0, 1fr);
    }

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

    .dashboard-cards {
        grid-column: 1 / -1;
    }
}

@media (max-width: 900px) {
    .topbar {
        gap: var(--space-2);
    }

    .topbar nav a {
        padding-inline: var(--space-2);
    }

    .settings-layout,
    .settings-grid {
        grid-template-columns: 1fr;
    }

    .guide-workspace {
        grid-template-columns: 1fr;
    }

    .ai-skill-workspace {
        grid-template-columns: 1fr;
    }

    .workflow-layout {
        grid-template-columns: 1fr;
    }

    .workflow-intro {
        align-items: flex-start;
        flex-direction: column;
    }

    .workflow-callout {
        max-width: none;
    }

    .process-list {
        max-height: 280px;
    }

    .panel-title {
        align-items: flex-start;
    }

    .panel-title .actions {
        justify-content: flex-start;
    }
}

@media (max-width: 820px) {
    .dashboard-summary {
        grid-template-columns: 1fr;
    }

    .dashboard-cards {
        grid-column: auto;
    }

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

@media (max-width: 760px) {
    body.login-page {
        padding: var(--space-3);
    }

    .login-shell {
        grid-template-columns: minmax(0, 1fr);
        min-height: auto;
    }

    .login-intro {
        padding: var(--space-4) var(--space-5);
    }

    .login-intro-copy,
    .login-capabilities,
    .login-footnote {
        display: none;
    }

    .login-form-panel {
        padding: var(--space-6) var(--space-5);
    }
}

@media (max-width: 680px) {
    .topbar {
        min-height: 52px;
        padding-inline: var(--space-3);
    }

    .brand {
        font-size: 14px;
    }

    .topbar nav {
        order: 3;
        flex-basis: 100%;
    }

    .topbar {
        flex-wrap: wrap;
        align-content: stretch;
    }

    .topbar nav a {
        min-height: 40px;
    }

    .header-actions {
        margin-left: auto;
    }

    .heading,
    .section-heading,
    .dashboard-table-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .heading>button,
    .section-heading>button {
        align-self: flex-start;
    }

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

    .modal-title,
    .modal form {
        padding-inline: var(--space-4);
    }

    .modal form,
    .notification-user-options {
        grid-template-columns: 1fr;
    }

    .guide-grid {
        grid-template-columns: 1fr;
    }

    .guide-steps,
    .guide-notes,
    .workflow-steps {
        grid-template-columns: 1fr;
    }

    .guide-grid .code-card {
        grid-column: auto;
    }

    .guide-entry-tabs {
        display: flex;
        width: 100%;
    }

    .guide-entry-tab {
        flex: 1 1 0;
        padding-inline: 8px;
    }

    .ai-skill-hero {
        align-items: flex-start;
        flex-direction: column;
    }

    .ai-skill-download { width: 100%; justify-content: center; }
    .ai-skill-config-list div { grid-template-columns: 1fr; gap: var(--space-1); }

    .http-config-card {
        padding: var(--space-4);
    }

    .http-config-list > div {
        grid-template-columns: 1fr;
        gap: var(--space-1);
    }
}

/* Enterprise console visual system. */
:root {
    --color-page: #f3f6f9;
    --color-surface: #ffffff;
    --color-surface-muted: #f8fafc;
    --color-surface-hover: #f1f6fb;
    --color-text: #1f2937;
    --color-text-secondary: #667085;
    --color-text-tertiary: #98a2b3;
    --color-border: #dde3ea;
    --color-border-strong: #cbd5e1;
    --color-primary: #0c66e4;
    --color-primary-hover: #0055cc;
    --color-primary-soft: #e9f2ff;
    --color-nav: #ffffff;
    --color-nav-hover: #f2f6fa;
    --color-nav-text: #475467;
    --color-nav-active: #eaf3fb;
    --radius-control: 4px;
    --radius-panel: 6px;
    --shadow-modal: 0 18px 40px rgba(16, 24, 40, .18);
}

body {
    background: var(--color-page);
    letter-spacing: .01em;
}

/* Long overview pages remain scrollable while their browser scrollbar stays unobtrusive. */
html.page-scrollbar-hidden,
body.page-scrollbar-hidden {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

html.page-scrollbar-hidden::-webkit-scrollbar,
body.page-scrollbar-hidden::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

button,
.button-link {
    min-height: 38px;
    padding: 8px 14px;
    box-shadow: none;
    transition: border-color .12s ease, background .12s ease;
}

button:hover,
.button-link:hover {
    box-shadow: none;
}

button.secondary,
.button-link.secondary {
    border-color: var(--color-border-strong);
    background: rgba(255, 255, 255, .88);
    box-shadow: none;
}

button.secondary:hover,
.button-link.secondary:hover {
    border-color: #9eb8d8;
    background: #f7faff;
}

.topbar {
    position: sticky;
    z-index: 10;
    top: 0;
    min-height: 68px;
    gap: 28px;
    padding-inline: clamp(20px, 3vw, 52px);
    border-bottom: 1px solid #0758c7;
    background: #0c66e4;
    box-shadow: 0 1px 3px rgba(9, 68, 153, .18);
}

.brand {
    gap: 10px;
    font-size: 16px;
    letter-spacing: .02em;
    color: #fff;
}

.brand i {
    width: 8px;
    height: 8px;
    margin: 0;
    border: 0;
    border-radius: 50%;
    background: #36c78b;
    box-shadow: 0 0 0 3px rgba(54, 199, 139, .14);
}

.topbar nav {
    align-items: center;
    gap: 5px;
    overflow: visible;
}

.topbar nav a {
    min-height: 36px;
    border: 0;
    border-radius: 4px;
    padding: 8px 11px;
    color: #dbeaff;
    font-size: 14px;
    font-weight: 550;
}

.topbar nav a:hover,
.topbar nav a.active {
    background: rgba(255, 255, 255, .15);
    color: #fff;
}

.topbar nav a.active {
    box-shadow: inset 0 -2px 0 #fff;
}

.utility-link {
    padding: 7px 8px;
    color: #dbeaff;
    font-size: 12px;
}

.logout button {
    min-height: 32px;
    border-color: rgba(255, 255, 255, .45);
    border-radius: 4px;
    padding: 5px 10px;
    background: transparent;
    color: #fff;
    box-shadow: none;
    font-size: 12px;
}

.logout button:hover {
    border-color: rgba(255, 255, 255, .75);
    background: rgba(255, 255, 255, .12);
    box-shadow: none;
    transform: none;
}

.account-link {
    color: #667085;
}

.account-link:hover,
.account-link.active {
    color: var(--color-primary);
    background: var(--color-primary-soft);
}

main {
    width: min(100%, 1480px);
    padding: 34px clamp(20px, 3vw, 48px) 64px;
}

.heading {
    padding: 2px 0 26px;
    border-bottom-color: var(--color-border);
}

.heading h1 {
    margin-top: 4px;
    font-size: clamp(25px, 2.2vw, 30px);
    font-weight: 700;
    letter-spacing: -.025em;
}

.heading .eyebrow {
    color: #4782eb;
    font-size: 10px;
    letter-spacing: .14em;
}

.heading p {
    max-width: 720px;
    color: var(--color-text-secondary);
}

.dashboard-filters,
.filters,
.form-stack {
    border-color: var(--color-border);
    border-radius: var(--radius-panel);
    background: rgba(255, 255, 255, .9);
    box-shadow: none;
}

.cards {
    gap: 14px;
}

.cards article,
.health-card,
.distribution-card,
.analytics-panel,
.process-panel,
.schedule-panel,
.account-card,
.guide-grid article {
    border-color: var(--color-border);
    border-radius: var(--radius-panel);
    box-shadow: none;
}

.cards article {
    padding: 18px;
}

.cards b {
    font-size: 30px;
    letter-spacing: -.05em;
}

.cards article.danger {
    border-color: #ffd9d7;
    background: #fffafa;
}

.table-wrap {
    border-color: var(--color-border);
    border-radius: var(--radius-panel);
    box-shadow: none;
}

th {
    padding-block: 12px;
    background: #f8faff;
    color: #718198;
    font-size: 11px;
    letter-spacing: .035em;
    text-transform: uppercase;
}

td {
    padding-block: 13px;
    border-top-color: #edf1f6;
}

tbody tr:hover {
    background: #f6f9ff;
}

.panel-title {
    min-height: 72px;
    padding-inline: 20px;
    border-bottom-color: var(--color-border);
}

.panel-title h2,
.dashboard-table-heading h2,
.history-table-heading h2,
.section-heading h2 {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -.02em;
}

.settings-tabs {
    width: max-content;
    max-width: 100%;
    gap: 2px;
    padding: 4px;
    border: 1px solid var(--color-border);
    border-radius: 5px;
    background: var(--color-surface);
    box-shadow: none;
}

.settings-tab {
    min-height: 34px;
    border: 0;
    border-radius: 3px;
    padding: 6px 13px;
    background: transparent;
    box-shadow: none;
    color: var(--color-text-secondary);
}

.settings-tab:hover,
.settings-tab.active {
    background: var(--color-primary-soft);
    box-shadow: none;
    color: var(--color-primary);
    transform: none;
}

.settings-feature-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 18px;
    margin-top: var(--space-5);
    padding: 22px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-panel);
    background: var(--color-surface-muted);
    box-shadow: none;
}

.feature-mark {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 4px;
    background: var(--color-primary-soft);
    color: var(--color-primary);
    font-size: 20px;
    font-weight: 750;
}

.feature-content h2,
.security-intro h2 {
    margin: 2px 0 5px;
    font-size: 18px;
    letter-spacing: -.025em;
}

.feature-content > p:not(.eyebrow):not(.service-status),
.security-intro > p {
    margin: 0;
    color: var(--color-text-secondary);
}

.service-status {
    display: inline-flex;
    margin: 10px 0 0;
    padding: 4px 8px;
    border-radius: 3px;
    background: var(--color-surface);
    color: var(--color-text-secondary);
    font-size: 12px;
    box-shadow: inset 0 0 0 1px var(--color-border);
}

.feature-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.security-layout {
    display: grid;
    grid-template-columns: minmax(240px, .8fr) minmax(360px, 1.2fr);
    gap: var(--space-5);
    margin-top: var(--space-5);
}

.security-intro {
    padding: 26px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-panel);
    background: var(--color-surface-muted);
}

.security-intro ul {
    display: grid;
    gap: 8px;
    margin: 18px 0 0;
    padding: 0;
    color: var(--color-text-secondary);
    font-size: 13px;
    list-style: none;
}

.security-intro li::before {
    margin-right: 8px;
    color: var(--color-success);
    content: "●";
}

.account-card {
    width: auto;
    margin-top: 0;
    padding: 26px;
}

.account-card-title {
    margin: 0 0 16px;
    color: var(--color-text);
    font-size: 16px;
    font-weight: 700;
}

.account-card .form-stack {
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.account-card .form-stack button {
    align-self: end;
}

.utility-link {
    color: #dbeaff;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.utility-link:hover {
    color: #fff;
}

/* The public entry point keeps a recognisable blue brand panel while the
   authenticated console stays light and utilitarian. */
.login-intro {
    background: #0c66e4;
}

.login-intro .login-brand,
.login-intro h1,
.login-capabilities {
    color: #fff;
}

.login-eyebrow,
.login-intro-copy > p:last-child,
.login-footnote {
    color: #dbeaff;
}

.monitor-toolbar {
    margin-top: var(--space-4);
    padding-block: var(--space-3);
}

.monitor-overview {
    display: grid;
    grid-template-columns: minmax(250px, .82fr) minmax(0, 2.18fr);
    gap: var(--space-4);
    margin: var(--space-5) 0;
}

.monitor-overview .health-card {
    min-height: 112px;
    padding: var(--space-4);
}

.monitor-overview .dashboard-cards article {
    min-height: 112px;
}

.dashboard-cards article {
    border-top: 3px solid transparent;
}

.dashboard-cards article:nth-child(2) {
    border-top-color: var(--color-success);
}

.dashboard-cards article:nth-child(3) {
    border-top-color: #a6a9ad;
}

.dashboard-cards article.danger {
    border-top-color: var(--color-danger);
}

.action-menu {
    position: relative;
}

.action-menu summary {
    display: inline-flex;
    align-items: center;
    min-height: var(--control-height);
    padding: 7px 12px;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-control);
    background: var(--color-surface);
    color: var(--color-text);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    line-height: 20px;
    list-style: none;
    white-space: nowrap;
}

.action-menu summary::-webkit-details-marker {
    display: none;
}

.action-menu summary::after {
    width: 12px;
    height: 12px;
    flex: 0 0 12px;
    margin-left: 8px;
    background: currentColor;
    clip-path: polygon(20% 35%, 80% 35%, 50% 65%);
    content: "";
}

.action-menu[open] summary::after {
    clip-path: polygon(20% 65%, 80% 65%, 50% 35%);
}

.action-menu[open] > div {
    position: absolute;
    z-index: 3;
    right: 0;
    display: grid;
    min-width: 132px;
    gap: 4px;
    margin-top: 5px;
    padding: 6px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-control);
    background: var(--color-surface);
    box-shadow: 0 8px 22px rgba(31, 35, 41, .14);
}

.action-menu[open] button {
    justify-content: flex-start;
}

.trigger-center-panel {
    margin-top: var(--space-5);
}

.trigger-filter {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.trigger-filter .secondary.active {
    border-color: var(--color-primary);
    background: var(--color-primary-soft);
    color: var(--color-primary);
}

.trigger-examples {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    padding: 18px 20px 20px;
    margin: 0;
}

.trigger-examples > div {
    display: grid;
    gap: 8px;
    padding: 14px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    background: var(--color-surface);
}

.trigger-examples code {
    width: max-content;
    max-width: 100%;
    padding: 5px 7px;
    overflow-wrap: anywhere;
    border-radius: 3px;
    background: #edf4fb;
    color: #28649a;
}

/* Keep controls intentionally squared-off: the interface is an operations console,
   not a consumer product. Status dots and compact tags stay rounded for scanability. */
input,
select,
textarea,
button,
.button-link,
.modal,
.action-menu[open] > div {
    border-radius: var(--radius-control);
}

.badge,
.status,
.status-badge {
    border-radius: 999px;
}

.status-badge {
    display: inline-flex;
    min-height: 24px;
    align-items: center;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 650;
    line-height: 18px;
    white-space: nowrap;
}

.status-badge.is-enabled {
    background: var(--color-success-soft);
    color: var(--color-success);
}

.status-badge.is-disabled {
    background: var(--color-neutral-soft, #f1f3f5);
    color: var(--color-text-secondary);
}

.account-session-revoke {
    margin-top: var(--space-4);
}

.trigger-examples span,
.trigger-center-panel small {
    color: var(--color-text-secondary);
    font-size: 12px;
}

.trigger-modal {
    width: min(720px, calc(100vw - 32px));
}

@media (max-width: 700px) {
    .monitor-overview {
        grid-template-columns: 1fr;
    }

    .header-actions .utility-link {
        display: none;
    }

    .trigger-filter {
        width: 100%;
    }

    .trigger-filter button {
        flex: 1 1 auto;
    }

    .trigger-examples {
        grid-template-columns: 1fr;
        gap: var(--space-1);
    }

    .trigger-examples span {
        margin-bottom: var(--space-3);
    }
}

@media (max-width: 800px) {
    .topbar {
        position: static;
        min-height: 0;
        flex-wrap: wrap;
        gap: 0;
        padding: 0 16px;
    }

    .brand,
    .header-actions {
        min-height: 56px;
    }

    .brand {
        font-size: 15px;
    }

    .utility-link {
        display: none;
    }

    .topbar nav {
        order: 3;
        width: calc(100% + 32px);
        flex: 1 0 100%;
        margin: 0 -16px;
        padding: 6px 16px 8px;
        overflow-x: auto;
        border-top: 1px solid rgba(255, 255, 255, .22);
        scrollbar-width: none;
    }

    .topbar nav::-webkit-scrollbar {
        display: none;
    }

    .topbar nav a {
        min-height: 34px;
        padding: 7px 10px;
        font-size: 13px;
    }

    main {
        padding: 24px 16px 44px;
    }

    .heading {
        gap: 16px;
        padding-bottom: 20px;
    }

    .heading h1 {
        font-size: 25px;
    }

    .heading .actions {
        width: 100%;
        justify-content: flex-start;
    }

    .dashboard-filters,
    .filters {
        align-items: stretch;
        padding: 14px;
    }

    .dashboard-filters label,
    .filters label {
        flex: 1 1 150px;
    }

    .monitor-overview,
    .security-layout,
    .settings-grid,
    .analytics-grid {
        grid-template-columns: 1fr;
    }

    .monitor-overview {
        gap: 14px;
        margin-block: 20px;
    }

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

    .cards article,
    .monitor-overview .dashboard-cards article {
        min-height: 100px;
        padding: 15px;
    }

    .cards b {
        font-size: 26px;
    }

    .settings-feature-card {
        grid-template-columns: auto minmax(0, 1fr);
        gap: 14px;
        padding: 18px;
    }

    .feature-actions {
        grid-column: 1 / -1;
        justify-content: stretch;
    }

    .feature-actions button {
        flex: 1 1 150px;
    }

    .account-card,
    .security-intro {
        padding: 20px;
    }

    .trigger-examples {
        grid-template-columns: 1fr;
        padding: 14px;
    }

    .trigger-examples > div {
        gap: 6px;
    }

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

    .history-filters button {
        grid-column: 1 / -1;
    }
}

@media (max-width: 420px) {
    .cards {
        grid-template-columns: 1fr;
    }

    body.login-page .login-card {
        padding: var(--space-5);
    }
}

/* Scheduling center: an operational view built from the existing SaaS tokens. */
.scheduling-heading { align-items: center; }
.scheduling-clock { display: grid; min-width: 220px; flex: 0 0 auto; grid-template-columns: 1fr; gap: 2px; text-align: right; }
.scheduling-clock > span:first-child { color: var(--color-text-secondary); font-size: 15px; font-weight: 700; letter-spacing: .02em; line-height: 1.35; }
.scheduling-clock strong { color: var(--color-text); font-size: 23px; letter-spacing: .035em; line-height: 1.2; }
.system-health { grid-column: 1 / -1; color: var(--color-success); font-size: 12px; font-weight: 650; }
.system-health.risk { color: var(--color-warning); }
.scheduling-metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--space-3); margin: var(--space-5) 0 var(--space-4); }
.scheduling-metric { display: flex; min-width: 0; align-items: flex-start; gap: 10px; padding: 14px; border: 1px solid var(--color-border); border-radius: var(--radius-panel); background: var(--color-surface); box-shadow: 0 1px 2px rgba(31, 35, 41, .03); }
.scheduling-metric .metric-icon { display: grid; width: 30px; height: 30px; flex: 0 0 30px; place-items: center; border-radius: 7px; background: var(--color-primary-soft); color: var(--color-primary); font-size: 16px; font-weight: 800; }
.running-loader { display: none; width: 22px; height: 22px; }
.scheduling-metric.running.has-active-runs .metric-icon { background: var(--color-success-soft); color: var(--color-success); }
.scheduling-metric.running.has-active-runs .running-symbol { display: none; }
.scheduling-metric.running.has-active-runs .running-loader { display: block; animation: scheduling-running-spin 1.1s linear infinite; }
@keyframes scheduling-running-spin { to { transform: rotate(360deg); } }
.scheduling-metric.exception.has-active-alerts .metric-icon, .scheduling-metric.conflict.has-active-alerts .metric-icon { animation: scheduling-alert-pulse 1.35s ease-in-out infinite; }
@keyframes scheduling-alert-pulse { 0%, 100% { transform: scale(1); } 35% { transform: scale(1.12) rotate(-5deg); } 65% { transform: scale(1.06) rotate(5deg); } }
@media (prefers-reduced-motion: reduce) { .scheduling-metric.running.has-active-runs .running-loader { animation: none; } }
@media (prefers-reduced-motion: reduce) { .scheduling-metric.exception.has-active-alerts .metric-icon, .scheduling-metric.conflict.has-active-alerts .metric-icon { animation: none; } }
.scheduling-metric > div { min-width: 0; }
.scheduling-metric span:not(.metric-icon), .scheduling-metric small { display: block; overflow: hidden; color: var(--color-text-secondary); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.scheduling-metric b { display: block; margin: 1px 0; color: var(--color-text); font-size: 24px; line-height: 1.2; }
.scheduling-metric.completed .metric-icon { background: var(--color-success-soft); color: var(--color-success); }
.scheduling-metric.exception .metric-icon { background: var(--color-danger-soft); color: var(--color-danger); }
.scheduling-metric.devices .metric-icon { background: #f3f0ff; color: #7455d9; }
.scheduling-metric.conflict .metric-icon { background: var(--color-warning-soft); color: var(--color-warning); }
.scheduling-toolbar { display: flex; min-width: 0; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-bottom: var(--space-4); padding: 10px 12px; border: 1px solid var(--color-border); border-radius: var(--radius-panel); background: var(--color-surface); }
.date-navigator, .range-switch, .custom-range { display: inline-flex; align-items: center; gap: 4px; }
.date-navigator button { min-width: 32px; padding-inline: 8px; }
.date-navigator input { width: 144px; min-height: 32px; }
.range-switch { padding-left: var(--space-2); border-left: 1px solid var(--color-border); }
.range-switch button, .custom-range button { min-height: 30px; padding: 4px 8px; font-size: 12px; }
.range-switch button.active { border-color: #a7c0ff; background: var(--color-primary-soft); color: var(--color-primary); }
.custom-range { padding-left: var(--space-2); border-left: 1px solid var(--color-border); }
.custom-range label { display: inline-flex; align-items: center; gap: 4px; color: var(--color-text-secondary); font-size: 12px; }
.custom-range input { width: 92px; min-height: 30px; padding: 4px 6px; }
.scheduling-toolbar > p { margin: 0 0 0 auto; color: var(--color-text-secondary); font-size: 12px; }
.scheduling-layout { display: grid; grid-template-columns: minmax(210px, .78fr) minmax(620px, 2.15fr) minmax(245px, .9fr); gap: var(--space-4); align-items: start; }
.scheduling-panel { min-width: 0; border: 1px solid var(--color-border); border-radius: var(--radius-panel); background: var(--color-surface); box-shadow: 0 1px 2px rgba(31, 35, 41, .025); }
.panel-heading { display: flex; min-width: 0; align-items: flex-start; justify-content: space-between; gap: var(--space-2); padding: 13px var(--space-4); border-bottom: 1px solid var(--color-border); }
.panel-heading > div { min-width: 0; }
.panel-heading h2 { margin: 0; color: var(--color-text); font-size: 15px; line-height: 1.4; }
.panel-heading p { margin: 2px 0 0; overflow: hidden; color: var(--color-text-secondary); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.count-pill { flex: 0 0 auto; padding: 2px 7px; border-radius: 10px; background: var(--color-primary-soft); color: var(--color-primary); font-size: 11px; font-weight: 700; }
.count-pill.risk { background: var(--color-warning-soft); color: var(--color-warning); }
.live-list { display: grid; max-height: min(56vh, 640px); gap: 1px; overflow-y: auto; padding: 6px; }
.live-task { display: grid; width: 100%; min-height: 0; grid-template-columns: 1fr; gap: 7px; padding: 10px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--color-text); text-align: left; white-space: normal; }
.live-task:hover { border-color: #c9d9ff; background: var(--color-primary-soft); }
.live-task-title, .live-task-meta, .live-task-timing { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 6px; }
.live-task-title strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.live-task-meta { justify-content: flex-start; color: var(--color-text-secondary); font-size: 11px; }
.live-task-timing { color: var(--color-text-secondary); font-size: 11px; }
.live-task-timing b { color: var(--color-primary); font-weight: 650; }
.live-task > small { color: var(--color-text-secondary); font-size: 11px; text-align: right; }
.type-tag, .schedule-status, .device-status { display: inline-flex; width: max-content; max-width: 100%; align-items: center; padding: 2px 6px; border-radius: 4px; font-size: 11px; font-weight: 650; line-height: 16px; white-space: nowrap; }
.type-tag { background: #f1f3f5; color: #59616c; }
.type-tag.python { background: #edf4ff; color: #3370ff; }.type-tag.rpa { background: #e9f8f1; color: #008d61; }.type-tag.workflow { background: #f4efff; color: #7654d9; }.type-tag.shell { background: #fff5e7; color: #b76200; }
.schedule-status.running { background: var(--color-primary-soft); color: var(--color-primary); }.schedule-status.completed { background: var(--color-success-soft); color: var(--color-success); }.schedule-status.failed, .schedule-status.timeout { background: var(--color-danger-soft); color: var(--color-danger); }.schedule-status.waiting, .schedule-status.planned, .schedule-status.scheduled { background: #f1f3f5; color: var(--color-text-secondary); }.schedule-status.skipped { background: #f4f0ff; color: #7455d9; }
.progress { height: 5px; overflow: hidden; border-radius: 4px; background: #e8ecf2; }.progress i { display: block; height: 100%; border-radius: inherit; background: var(--color-primary); transition: width .35s ease; }
.timeline-panel { min-width: 0; }.timeline-now-label { flex: 0 0 auto; padding: 3px 6px; border-radius: 4px; background: var(--color-primary-soft); color: var(--color-primary); font-size: 11px; font-weight: 650; white-space: nowrap; }
.timeline-scroll { min-width: 0; overflow-x: auto; overscroll-behavior-inline: contain; scrollbar-width: none; -ms-overflow-style: none; }.timeline-scroll::-webkit-scrollbar { display: none; width: 0; height: 0; }.timeline { min-width: 740px; padding-bottom: 4px; }
.timeline-header, .timeline-lane { display: grid; grid-template-columns: 118px minmax(0, 1fr); }
.timeline-header { position: sticky; z-index: 3; top: 0; border-bottom: 1px solid var(--color-border); background: var(--color-surface-muted); color: var(--color-text-secondary); font-size: 11px; font-weight: 650; }
.timeline-header > div:first-child { display: flex; align-items: center; padding-left: var(--space-3); border-right: 1px solid var(--color-border); }.timeline-ruler { position: relative; height: 32px; }.timeline-ruler span { position: absolute; top: 9px; transform: translateX(-50%); white-space: nowrap; }
.timeline-lane { min-height: 58px; border-bottom: 1px solid #edf0f2; }.timeline-lane:last-child { border-bottom: 0; }.timeline-device { display: grid; width: 100%; min-height: 0; align-content: center; justify-content: start; gap: 1px; padding: 7px var(--space-3); border: 0; border-right: 1px solid var(--color-border); border-radius: 0; background: #fcfcfd; color: var(--color-text); text-align: left; }.timeline-device:hover { background: var(--color-primary-soft); color: var(--color-text); }.timeline-device strong { font-size: 12px; }.timeline-device span { overflow: hidden; color: var(--color-text-secondary); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.timeline-track { position: relative; overflow: visible; min-width: 0; background-image: repeating-linear-gradient(to right, transparent 0, transparent calc(8.333% - 1px), #edf0f2 calc(8.333% - 1px), #edf0f2 8.333%); }.timeline-track > span { position: absolute; top: 0; bottom: 0; width: 1px; background: #edf0f2; }
.timeline-task { position: absolute; z-index: 1; top: 11px; display: block; min-height: 35px; overflow: visible; padding: 6px 8px; border: 1px solid transparent; border-radius: 5px; background: #eef1f5; color: #54606d; cursor: pointer; font-size: 11px; font-weight: 650; line-height: 20px; text-align: left; text-overflow: ellipsis; white-space: nowrap; }.timeline-task > span:first-child { display: block; overflow: hidden; text-overflow: ellipsis; }.timeline-task > b { position: absolute; top: -7px; right: -5px; display: grid; width: 16px; height: 16px; place-items: center; border-radius: 50%; background: #fff; color: var(--color-danger); font-size: 11px; }
.timeline-task.running { border-color: #8cb0ff; background: #dfe9ff; color: #235dcf; }.timeline-task.completed { border-color: #9cdbbc; background: var(--color-success-soft); color: #05734d; }.timeline-task.failed, .timeline-task.timeout { border-color: #ffb2ad; background: var(--color-danger-soft); color: #cc3e39; }.timeline-task.waiting, .timeline-task.planned, .timeline-task.scheduled { border-style: dashed; border-color: #c9cdd4; background: #f5f6f8; color: #68707a; }.timeline-task.skipped { border-color: #c8b9f1; background: #f3efff; color: #684cc3; }.timeline-task.is-conflict { z-index: 2; border-color: var(--color-danger); box-shadow: inset 0 0 0 1px rgba(245, 74, 69, .14); }
.timeline-task:hover { z-index: 4; filter: brightness(.98); }.timeline-tooltip { position: absolute; z-index: 8; bottom: calc(100% + 8px); left: 0; display: none; width: 220px; padding: 10px; border: 1px solid var(--color-border-strong); border-radius: 6px; background: #fff; box-shadow: 0 8px 18px rgba(31, 35, 41, .13); color: var(--color-text); font-size: 11px; font-weight: 400; line-height: 1.65; white-space: normal; }.timeline-tooltip strong, .timeline-tooltip span, .timeline-tooltip em { display: block; }.timeline-tooltip strong { margin-bottom: 3px; font-size: 12px; }.timeline-tooltip em { margin-top: 4px; color: var(--color-danger); font-style: normal; font-weight: 650; }.timeline-task:hover .timeline-tooltip, .timeline-task:focus .timeline-tooltip { display: block; }.timeline-now-line { position: absolute; z-index: 3; top: 0; bottom: 0; border-left: 2px dashed var(--color-primary); pointer-events: none; }.timeline-now-line::before { position: absolute; top: -4px; left: -5px; width: 8px; height: 8px; border-radius: 50%; background: var(--color-primary); content: ""; }
.scheduling-side { display: grid; gap: var(--space-4); }.alert-list-viewport { max-height: min(31vh, 350px); overflow: hidden; }.alert-list { display: grid; width: calc(100% + 18px); max-height: min(31vh, 350px); gap: 1px; overflow-y: auto; padding: 6px 24px 6px 6px; scrollbar-width: none; -ms-overflow-style: none; }.alert-list::-webkit-scrollbar { display: none; width: 0; height: 0; }.alert-item { display: grid; width: 100%; min-height: 0; grid-template-columns: auto 1fr; gap: 4px 7px; padding: 10px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--color-text); text-align: left; white-space: normal; }.alert-item:last-child { border-bottom: 1px solid transparent; }.alert-item:hover { border-color: #c9d9ff; background: var(--color-primary-soft); }.alert-level { align-self: start; padding: 1px 4px; border-radius: 3px; background: var(--color-primary-soft); color: var(--color-primary); font-size: 9px; font-weight: 800; }.alert-item.warning .alert-level { background: var(--color-warning-soft); color: var(--color-warning); }.alert-item.error .alert-level { background: var(--color-danger-soft); color: var(--color-danger); }.alert-item strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }.alert-item p, .alert-item time { grid-column: 1 / -1; margin: 0; color: var(--color-text-secondary); font-size: 11px; line-height: 1.45; }.alert-item time { color: var(--color-text-tertiary); }
.live-list .live-task, .alert-list .alert-item { transition: border-color .12s ease, background .12s ease; }
.live-list .live-task:hover, .live-list .live-task:focus-visible, .alert-list .alert-item:hover, .alert-list .alert-item:focus-visible { border-color: #c9d9ff; outline: none; background: var(--color-primary-soft); box-shadow: none; transform: none; }
.device-list { padding: 0 var(--space-3) var(--space-2); }.device-head, .device-row { display: grid; grid-template-columns: minmax(62px, 1fr) auto minmax(42px, .65fr) minmax(42px, .65fr); gap: 7px; align-items: center; }.device-head { padding: 9px 0 5px; color: var(--color-text-tertiary); font-size: 10px; }.device-row { min-height: 38px; border-top: 1px solid #edf0f2; font-size: 11px; }.device-row > strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }.device-status { padding: 1px 5px; background: #eef1f5; color: #66707c; font-size: 10px; }.device-status.online { background: var(--color-success-soft); color: var(--color-success); }.device-status.running, .device-status.planned { background: var(--color-primary-soft); color: var(--color-primary); }.device-status.busy { background: var(--color-warning-soft); color: var(--color-warning); }.device-status.offline { background: var(--color-danger-soft); color: var(--color-danger); }.resource-cell { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 3px; color: var(--color-text-secondary); font-size: 10px; }.resource-cell > i { height: 3px; border-radius: 2px; background: var(--color-primary); }.telemetry-empty { color: var(--color-text-tertiary); }
.scheduling-bottom-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(240px, .85fr) minmax(220px, .75fr); gap: var(--space-4); margin-top: var(--space-4); }.trend-chart { padding: 12px var(--space-4) 13px; }.trend-chart svg { display: block; width: 100%; height: 130px; overflow: visible; }.trend-chart line { stroke: #edf0f2; stroke-width: .8; }.trend-chart polyline { fill: none; stroke-width: 2.3; vector-effect: non-scaling-stroke; }.trend-chart .trend-total { stroke: var(--color-primary); }.trend-chart .trend-success { stroke: var(--color-success); }.trend-legend { display: flex; gap: 12px; margin-top: 4px; color: var(--color-text-secondary); font-size: 11px; }.trend-legend span { display: inline-flex; align-items: center; gap: 4px; }.trend-legend i { width: 12px; height: 2px; }.trend-labels { display: flex; justify-content: space-between; margin-top: 5px; color: var(--color-text-tertiary); font-size: 10px; }.type-chart { display: flex; min-height: 166px; align-items: center; gap: var(--space-4); padding: 12px var(--space-4); }.type-donut, .success-ring { position: relative; display: grid; width: 106px; height: 106px; flex: 0 0 106px; place-items: center; border-radius: 50%; }.type-donut::after, .success-ring::after { position: absolute; inset: 20px; border-radius: 50%; background: var(--color-surface); content: ""; }.type-donut span { z-index: 1; font-size: 22px; font-weight: 700; }.type-legend { display: grid; min-width: 0; gap: 5px; }.type-legend span { display: grid; grid-template-columns: 8px 1fr auto; gap: 5px; align-items: center; color: var(--color-text-secondary); font-size: 11px; }.type-legend i { width: 7px; height: 7px; border-radius: 50%; }.type-legend b { color: var(--color-text); }.success-chart { display: flex; min-height: 166px; align-items: center; gap: var(--space-4); padding: 12px var(--space-4); }.success-ring { width: 112px; height: 112px; flex-basis: 112px; }.success-ring span { z-index: 1; display: grid; text-align: center; }.success-ring b { font-size: 21px; }.success-ring small { color: var(--color-text-secondary); font-size: 10px; }.success-values { display: grid; gap: 8px; min-width: 70px; }.success-values span { display: flex; justify-content: space-between; gap: 10px; color: var(--color-text-secondary); font-size: 11px; }.success-values b { color: var(--color-text); font-size: 13px; }
.device-timeline-backdrop { position: fixed; z-index: 30; inset: 0; display: grid; place-items: center; padding: clamp(12px, 2vw, 28px); background: rgba(31, 35, 41, .42); }.device-timeline-modal { display: flex; width: min(1660px, 100%); height: min(900px, 94vh); min-width: 0; flex-direction: column; overflow: hidden; border: 1px solid var(--color-border-strong); border-radius: 10px; background: var(--color-surface); box-shadow: 0 22px 56px rgba(31, 35, 41, .24); }.device-timeline-title { display: flex; flex: 0 0 auto; align-items: flex-start; justify-content: space-between; gap: var(--space-4); padding: 18px var(--space-5); border-bottom: 1px solid var(--color-border); }.device-timeline-title p { margin: 0 0 3px; color: var(--color-text-secondary); font-size: 12px; }.device-timeline-title h2 { margin: 0; font-size: 22px; line-height: 1.3; }.device-timeline-title h2 span { color: var(--color-text-secondary); font-size: 14px; font-weight: 500; }.device-timeline-title > div:last-child { display: flex; align-items: center; gap: var(--space-3); }.device-timeline-guide, .device-timeline-footer { display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: var(--space-3); padding: 10px var(--space-5); background: var(--color-surface-muted); color: var(--color-text-secondary); font-size: 12px; }.device-timeline-guide { border-bottom: 1px solid var(--color-border); }.device-timeline-footer { border-top: 1px solid var(--color-border); }.device-timeline-footer button { min-height: 30px; padding-block: 4px; }.focus-row-switch { display: inline-flex; align-items: center; gap: 4px; }.focus-row-switch > span { margin-right: 2px; color: var(--color-text-secondary); }.focus-row-switch button { min-height: 28px; padding: 3px 8px; font-size: 11px; }.focus-row-switch button.active { border-color: #a7c0ff; background: var(--color-primary-soft); color: var(--color-primary); }.device-focus-scroll { min-height: 0; flex: 1 1 auto; overflow: auto; background: #fcfcfd; }.device-focus-timeline { min-width: 1440px; min-height: 100%; padding: 0 var(--space-5) var(--space-5); }.device-focus-ruler { position: sticky; z-index: 4; top: 0; height: 44px; border-bottom: 1px solid var(--color-border); background: var(--color-surface); }.device-focus-ruler span { position: absolute; top: 14px; transform: translateX(-50%); color: var(--color-text-secondary); font-size: 11px; white-space: nowrap; }.device-focus-track { --device-row-height: 92px; position: relative; min-height: max(100%, calc(24px + var(--focus-rows) * var(--device-row-height))); background-color: #fff; background-image: repeating-linear-gradient(to right, transparent 0, transparent calc(1.0416667% - 1px), #e7ebf0 calc(1.0416667% - 1px), #e7ebf0 1.0416667%), repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--device-row-height) - 1px), #edf0f2 calc(var(--device-row-height) - 1px), #edf0f2 var(--device-row-height)); }.device-focus-task { position: absolute; z-index: 1; top: calc(20px + var(--focus-row) * var(--device-row-height)); display: block; min-height: 48px; overflow: visible; padding: 8px 10px; border: 1px solid transparent; border-radius: 5px; background: #eef1f5; color: #54606d; cursor: pointer; font-size: 12px; font-weight: 650; line-height: 22px; text-align: left; text-overflow: ellipsis; white-space: nowrap; }.device-focus-task > span:first-child { display: block; overflow: hidden; text-overflow: ellipsis; }.device-focus-task > b { position: absolute; top: -8px; right: -6px; display: grid; width: 17px; height: 17px; place-items: center; border-radius: 50%; background: #fff; color: var(--color-danger); font-size: 11px; }.device-focus-task.running { border-color: #8cb0ff; background: #dfe9ff; color: #235dcf; }.device-focus-task.completed { border-color: #9cdbbc; background: var(--color-success-soft); color: #05734d; }.device-focus-task.failed, .device-focus-task.timeout { border-color: #ffb2ad; background: var(--color-danger-soft); color: #cc3e39; }.device-focus-task.waiting, .device-focus-task.planned, .device-focus-task.scheduled { border-style: dashed; border-color: #c9cdd4; background: #f5f6f8; color: #68707a; }.device-focus-task.skipped { border-color: #c8b9f1; background: #f3efff; color: #684cc3; }.device-focus-task.is-conflict { z-index: 2; border-color: var(--color-danger); box-shadow: inset 0 0 0 1px rgba(245, 74, 69, .14); }.device-focus-task:hover { z-index: 5; filter: brightness(.98); }.device-focus-task:hover .timeline-tooltip, .device-focus-task:focus .timeline-tooltip { display: block; }.device-focus-now-line { position: absolute; z-index: 3; top: 0; bottom: 0; border-left: 2px dashed var(--color-primary); pointer-events: none; }.device-focus-now-line::before { position: absolute; top: -4px; left: -5px; width: 8px; height: 8px; border-radius: 50%; background: var(--color-primary); content: ""; }
.drawer-backdrop { position: fixed; z-index: 31; inset: 0; display: flex; justify-content: flex-end; background: rgba(31, 35, 41, .26); }.task-drawer { width: min(420px, 100%); height: 100%; overflow-y: auto; background: var(--color-surface); box-shadow: -12px 0 30px rgba(31, 35, 41, .13); }.drawer-title { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); padding: var(--space-5); border-bottom: 1px solid var(--color-border); }.drawer-title p { margin: 0 0 3px; color: var(--color-text-secondary); font-size: 12px; }.drawer-title h2 { margin: 0; font-size: 19px; }.drawer-body { padding: var(--space-5); }.drawer-body > .type-tag, .drawer-body > .schedule-status { margin-right: 5px; }.drawer-body dl { display: grid; gap: 0; margin: var(--space-4) 0 0; }.drawer-body dl > div { display: grid; grid-template-columns: 100px 1fr; gap: var(--space-3); padding: 11px 0; border-bottom: 1px solid var(--color-border); }.drawer-body dt { color: var(--color-text-secondary); font-size: 12px; }.drawer-body dd { margin: 0; color: var(--color-text); font-size: 13px; overflow-wrap: anywhere; }.drawer-body .drawer-conflict dd { color: var(--color-danger); font-weight: 650; }.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 1500px) { .scheduling-layout { grid-template-columns: minmax(200px, .7fr) minmax(600px, 2fr) minmax(225px, .8fr); }.scheduling-metric { padding: 12px; }.scheduling-metric .metric-icon { display: none; }.scheduling-bottom-grid { grid-template-columns: minmax(0, 1.2fr) minmax(220px, .9fr) minmax(210px, .8fr); } }
@media (max-width: 1180px) { .scheduling-layout { grid-template-columns: minmax(215px, .72fr) minmax(600px, 1.9fr); }.scheduling-side { grid-column: 1 / -1; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }.scheduling-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }.scheduling-bottom-grid { grid-template-columns: minmax(0, 1fr) minmax(260px, 1fr); }.success-panel { grid-column: 1 / -1; }.success-chart { justify-content: center; } }
@media (max-width: 800px) { .scheduling-heading { align-items: flex-start; }.scheduling-clock { text-align: left; }.scheduling-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }.scheduling-toolbar > p { width: 100%; margin: 2px 0 0; }.range-switch { border-left: 0; padding-left: 0; }.scheduling-layout { grid-template-columns: minmax(0, 1fr); }.live-panel { display: none; }.scheduling-side { grid-column: auto; grid-template-columns: 1fr; }.scheduling-bottom-grid { grid-template-columns: 1fr; }.success-panel { grid-column: auto; }.timeline { min-width: 700px; }.type-chart, .success-chart { justify-content: center; } }
@media (max-width: 520px) { .scheduling-heading { display: grid; }.scheduling-metrics { grid-template-columns: 1fr; }.scheduling-toolbar { align-items: flex-start; }.custom-range { width: 100%; padding-left: 0; border-left: 0; }.scheduling-metric b { font-size: 22px; }.scheduling-clock { grid-template-columns: 1fr; }.scheduling-clock strong { font-size: 18px; }.timeline { min-width: 660px; }.type-chart { align-items: flex-start; flex-direction: column; }.type-donut { align-self: center; } }
@media (max-width: 700px) { .device-timeline-backdrop { padding: 0; }.device-timeline-modal { width: 100%; height: 100%; border: 0; border-radius: 0; }.device-timeline-title, .device-timeline-guide, .device-timeline-footer { padding-inline: var(--space-4); }.device-timeline-guide span:last-child { display: none; }.device-focus-timeline { min-width: 1200px; padding-inline: var(--space-3); }.device-focus-track { min-height: 320px; }.device-timeline-title h2 { font-size: 19px; } }

/*
 * App-wide layer order. Values are only meaningful inside their documented
 * layer; global blocking dialogs additionally use the browser top layer.
 */
:root { --z-content: 0; --z-sticky: 100; --z-dropdown: 200; --z-floating: 300; --z-drawer: 600; --z-modal: 700; --z-toast: 800; --z-global-dialog: 900; }
.topbar { z-index: var(--z-sticky); }
.modal-backdrop, .device-timeline-backdrop { z-index: var(--z-modal); }
.drawer-backdrop { z-index: var(--z-drawer); }
.flash-message { z-index: var(--z-toast); }
.app-modal-root { position: relative; z-index: var(--z-modal); }
.app-modal-root:empty { display: none; }

/* The device focus view folds the day into consecutive time segments, not task lanes. */
.device-focus-timeline { display: grid; gap: 18px; min-height: auto; padding-top: var(--space-4); }
.device-focus-segment { min-width: 0; border: 1px solid var(--color-border); border-radius: 7px; overflow: hidden; background: var(--color-surface); }
.device-focus-segment-label { padding: 7px 10px; border-bottom: 1px solid var(--color-border); background: var(--color-surface-muted); color: var(--color-text-secondary); font-size: 11px; font-weight: 700; }
.device-focus-ruler { position: relative; z-index: 1; top: auto; height: 38px; border-bottom: 1px solid var(--color-border); }
.device-focus-ruler span { top: 10px; }
.device-focus-track { --segment-ticks: 48; min-height: 150px; background-image: repeating-linear-gradient(to right, transparent 0, transparent calc(100% / var(--segment-ticks) - 1px), #e7ebf0 calc(100% / var(--segment-ticks) - 1px), #e7ebf0 calc(100% / var(--segment-ticks))); }
.device-focus-task { top: 48px; }

/* Keep every 2–5 line layout fully contained in the focus modal. */
.focus-row-switch { flex-wrap: wrap; justify-content: center; }
.device-focus-scroll { display: flex; overflow-x: auto; overflow-y: hidden; }
.device-focus-timeline { width: 100%; height: 100%; min-height: 0; flex: 1 0 auto; grid-template-rows: repeat(var(--focus-segments), minmax(0, 1fr)); gap: 8px; }
.device-focus-segment { display: grid; min-height: 0; grid-template-rows: 38px minmax(0, 1fr); }
.device-focus-track { min-height: 0; height: 100%; }
.device-focus-task { top: 50%; min-height: 0; height: min(48px, calc(100% - 14px)); transform: translateY(-50%); }

/* A short time block keeps its exact duration while its name is given a readable overflow label. */
.device-focus-task.is-compact { z-index: 2; }
.device-focus-task.is-compact > span:first-child { position: absolute; top: 50%; left: 0; display: block; width: max-content; min-width: 92px; max-width: min(240px, calc(100vw - 120px)); overflow: hidden; padding: 3px 8px; border: 1px solid transparent; border-radius: 4px; background: #f1f3f5; box-shadow: 2px 0 4px rgba(31, 35, 41, .08); text-overflow: ellipsis; transform: translateY(-50%); white-space: nowrap; }
.device-focus-task.is-compact.title-left > span:first-child { right: 0; left: auto; box-shadow: -2px 0 4px rgba(31, 35, 41, .08); }
.device-focus-task.completed.is-compact > span:first-child { border-color: #b7e6cb; background: #f1fbf6; }.device-focus-task.running.is-compact > span:first-child { border-color: #c2d5ff; background: #f0f5ff; }.device-focus-task.failed.is-compact > span:first-child, .device-focus-task.timeout.is-compact > span:first-child { border-color: #ffd0cc; background: #fff5f4; }.device-focus-task.waiting.is-compact > span:first-child, .device-focus-task.planned.is-compact > span:first-child, .device-focus-task.scheduled.is-compact > span:first-child { border-color: #d8dce1; background: #fafbfc; }.device-focus-task.skipped.is-compact > span:first-child { border-color: #d9cff7; background: #f7f4ff; }

/* Apply the same readable overflow treatment to the compact main scheduling timeline. */
.timeline-task.is-compact { z-index: 3; }
.timeline-task.is-compact > span:first-child { position: absolute; top: 50%; left: 0; display: block; width: max-content; min-width: 88px; max-width: min(210px, calc(100vw - 80px)); overflow: hidden; padding: 2px 7px; border: 1px solid transparent; border-radius: 4px; background: #f1f3f5; box-shadow: 2px 0 4px rgba(31, 35, 41, .08); text-overflow: ellipsis; transform: translateY(-50%); white-space: nowrap; }.timeline-task.is-compact.title-left > span:first-child { right: 0; left: auto; box-shadow: -2px 0 4px rgba(31, 35, 41, .08); }.timeline-task.completed.is-compact > span:first-child { border-color: #b7e6cb; background: #f1fbf6; }.timeline-task.running.is-compact > span:first-child { border-color: #c2d5ff; background: #f0f5ff; }.timeline-task.failed.is-compact > span:first-child, .timeline-task.timeout.is-compact > span:first-child { border-color: #ffd0cc; background: #fff5f4; }.timeline-task.waiting.is-compact > span:first-child, .timeline-task.planned.is-compact > span:first-child, .timeline-task.scheduled.is-compact > span:first-child { border-color: #d8dce1; background: #fafbfc; }.timeline-task.skipped.is-compact > span:first-child { border-color: #d9cff7; background: #f7f4ff; }

/* Portaled tooltip: above every overlay and never clipped by a scrolling timeline. */
.floating-task-tooltip { position: fixed; z-index: var(--z-floating); display: grid; width: 220px; gap: 1px; padding: 10px; border: 1px solid var(--color-border-strong); border-radius: 6px; background: var(--color-surface); box-shadow: 0 8px 18px rgba(31, 35, 41, .16); color: var(--color-text); font-size: 11px; font-weight: 400; line-height: 1.65; pointer-events: none; }.floating-task-tooltip strong, .floating-task-tooltip span, .floating-task-tooltip em { display: block; }.floating-task-tooltip strong { margin-bottom: 3px; font-size: 12px; }.floating-task-tooltip em { margin-top: 4px; color: var(--color-danger); font-style: normal; font-weight: 650; }

/* Compact primary navigation: related pages are grouped without changing their routes. */
.topbar nav { overflow: visible; }
.top-nav-menu { position: relative; flex: 0 0 auto; }
.top-nav-menu summary { display: flex; min-height: 36px; align-items: center; gap: 5px; padding: 8px 11px; border-radius: 4px; color: #dbeaff; cursor: pointer; font-size: 14px; font-weight: 550; list-style: none; white-space: nowrap; }
.top-nav-menu summary::-webkit-details-marker { display: none; }
.top-nav-menu summary::after { width: 5px; height: 5px; margin-top: -3px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; content: ""; transform: rotate(45deg); transition: transform .12s ease; }
.top-nav-menu:hover summary, .top-nav-menu[open] summary, .top-nav-menu.active summary { background: rgba(255, 255, 255, .15); color: #fff; }
.top-nav-menu.active summary { box-shadow: inset 0 -2px 0 #fff; }
.top-nav-menu[open] summary::after { margin-top: 3px; transform: rotate(225deg); }
.top-nav-submenu { position: absolute; z-index: var(--z-dropdown); top: calc(100% + 7px); left: 0; display: grid; min-width: 148px; padding: 5px; border: 1px solid #d8e0ea; border-radius: 7px; background: var(--color-surface); box-shadow: 0 10px 24px rgba(31, 35, 41, .16); }
.topbar nav .top-nav-submenu a { min-height: 34px; padding: 7px 9px; border-radius: 4px; color: var(--color-text-secondary); font-size: 13px; font-weight: 550; }
.topbar nav .top-nav-submenu a:hover, .topbar nav .top-nav-submenu a.active { background: var(--color-primary-soft); box-shadow: none; color: var(--color-primary); }

@media (max-width: 800px) {
    .topbar nav { overflow: visible; flex-wrap: wrap; gap: 3px; }
    .top-nav-menu summary { min-height: 34px; padding: 7px 10px; font-size: 13px; }
    .top-nav-submenu { top: calc(100% + 4px); min-width: 142px; }
}

/* Theme system: shared tokens keep layout and component hierarchy consistent. */
:root {
    --color-nav-bg: #0c66e4;
    --color-nav-border: #0758c7;
    --color-nav-label: #dbeaff;
    --color-nav-label-active: #fff;
    --color-nav-item-hover: rgba(255, 255, 255, .15);
    --color-nav-active-line: #fff;
    --color-nav-control-border: rgba(255, 255, 255, .45);
    --color-nav-control-hover: rgba(255, 255, 255, .12);
    --color-nav-menu-bg: #fff;
    --color-nav-menu-border: #d8e0ea;
    --color-nav-menu-text: #526174;
    --color-nav-menu-hover: #eff4ff;
    --color-nav-menu-active: #245bdb;
    --color-control-surface: #fff;
    --color-table-head: #f8faff;
    --color-gridline: #edf0f2;
    --color-neutral-soft: #f1f3f5;
    --color-scroll-track: #f2f4f6;
    --color-scroll-thumb: #b8c1cc;
    --color-scroll-thumb-hover: #929eac;
    --color-overlay: rgba(31, 35, 41, .42);
    --shadow-header: 0 1px 3px rgba(9, 68, 153, .18);
}

html[data-theme="light"] {
    --color-page: #f7f9fc;
    --color-surface: #fff;
    --color-surface-muted: #f6f8fb;
    --color-surface-hover: #edf4fc;
    --color-text: #172033;
    --color-text-secondary: #58677a;
    --color-text-tertiary: #8793a3;
    --color-border: #dce3eb;
    --color-border-strong: #c6d0dc;
    --color-primary: #2563d9;
    --color-primary-hover: #1d4fc0;
    --color-primary-soft: #eaf2ff;
    --color-success: #118963;
    --color-success-soft: #e7f6ef;
    --color-warning: #b96c12;
    --color-warning-soft: #fff5e4;
    --color-danger: #d84f4a;
    --color-danger-soft: #fff0ef;
    --color-nav-bg: #fff;
    --color-nav-border: #dce3eb;
    --color-nav-label: #526174;
    --color-nav-label-active: #1d4fc0;
    --color-nav-item-hover: #edf4fc;
    --color-nav-active-line: #2563d9;
    --color-nav-control-border: #c6d0dc;
    --color-nav-control-hover: #edf4fc;
    --color-nav-menu-bg: #fff;
    --color-nav-menu-border: #dce3eb;
    --color-nav-menu-text: #526174;
    --color-nav-menu-hover: #edf4fc;
    --color-nav-menu-active: #1d4fc0;
    --color-control-surface: #fff;
    --color-table-head: #f6f8fb;
    --color-gridline: #e6ebf1;
    --color-neutral-soft: #eef1f5;
    --color-scroll-track: #eef2f6;
    --color-scroll-thumb: #b6c0cc;
    --color-scroll-thumb-hover: #8f9baa;
    --shadow-header: 0 1px 3px rgba(31, 41, 55, .08);
}

html[data-theme="dark"] {
    color-scheme: dark;
    --color-page: #0e151d;
    --color-surface: #17212c;
    --color-surface-muted: #1d2936;
    --color-surface-hover: #22354a;
    --color-text: #e7edf5;
    --color-text-secondary: #adbac8;
    --color-text-tertiary: #7f8d9e;
    --color-border: #2c3a49;
    --color-border-strong: #435367;
    --color-primary: #6b9fff;
    --color-primary-hover: #89b3ff;
    --color-primary-soft: #203755;
    --color-success: #48c99a;
    --color-success-soft: #183a31;
    --color-warning: #efad4e;
    --color-warning-soft: #3b301d;
    --color-danger: #ff7772;
    --color-danger-soft: #402628;
    --color-disabled: #667587;
    --color-nav-bg: #111b26;
    --color-nav-border: #2a3949;
    --color-nav-label: #b9c7d7;
    --color-nav-label-active: #fff;
    --color-nav-item-hover: #22354a;
    --color-nav-active-line: #6b9fff;
    --color-nav-control-border: #435367;
    --color-nav-control-hover: #22354a;
    --color-nav-menu-bg: #17212c;
    --color-nav-menu-border: #435367;
    --color-nav-menu-text: #c2cedc;
    --color-nav-menu-hover: #203755;
    --color-nav-menu-active: #89b3ff;
    --color-control-surface: #1a2633;
    --color-table-head: #1c2835;
    --color-gridline: #2a3948;
    --color-neutral-soft: #263443;
    --color-scroll-track: #131d27;
    --color-scroll-thumb: #46576a;
    --color-scroll-thumb-hover: #607287;
    --color-code-surface: #0b1118;
    --color-code-surface-raised: #080d12;
    --color-code-text: #e7edf5;
    --color-code-accent: #9dc1ff;
    --color-overlay: rgba(2, 7, 13, .68);
    --shadow-header: 0 1px 3px rgba(0, 0, 0, .35);
    --shadow-modal: 0 18px 48px rgba(0, 0, 0, .42);
}

html[data-theme="custom"] {
    --color-primary: var(--custom-primary, #0c66e4);
    --color-primary-hover: color-mix(in srgb, var(--custom-primary, #0c66e4) 84%, #000);
    --color-primary-soft: color-mix(in srgb, var(--custom-primary, #0c66e4) 10%, #fff);
    --color-nav-bg: var(--custom-primary, #0c66e4);
    --color-nav-border: color-mix(in srgb, var(--custom-primary, #0c66e4) 82%, #000);
    --color-nav-item-hover: rgba(255, 255, 255, .15);
    --color-nav-active-line: #fff;
    --color-nav-label: color-mix(in srgb, var(--custom-primary, #0c66e4) 12%, #fff);
    --color-nav-label-active: #fff;
    --color-nav-control-border: rgba(255, 255, 255, .45);
    --color-nav-control-hover: rgba(255, 255, 255, .12);
    --color-nav-menu-hover: var(--color-primary-soft);
    --color-nav-menu-active: var(--color-primary-hover);
    --shadow-header: 0 1px 3px color-mix(in srgb, var(--custom-primary, #0c66e4) 35%, transparent);
}

html[data-theme] body {
    background: var(--color-page);
    color: var(--color-text);
}

html[data-theme] .topbar {
    border-bottom-color: var(--color-nav-border);
    background: var(--color-nav-bg);
    box-shadow: var(--shadow-header);
}

html[data-theme] .brand,
html[data-theme] .topbar nav a,
html[data-theme] .top-nav-menu summary,
html[data-theme] .utility-link {
    color: var(--color-nav-label);
}

html[data-theme] .topbar nav a:hover,
html[data-theme] .topbar nav a.active,
html[data-theme] .top-nav-menu:hover summary,
html[data-theme] .top-nav-menu[open] summary,
html[data-theme] .top-nav-menu.active summary {
    background: var(--color-nav-item-hover);
    color: var(--color-nav-label-active);
}

html[data-theme] .topbar nav a.active,
html[data-theme] .top-nav-menu.active summary {
    box-shadow: inset 0 -2px 0 var(--color-nav-active-line);
}

/* Dropdowns are surfaces, so they must not inherit the header's label colors. */
html[data-theme] .topbar nav .top-nav-submenu {
    border-color: var(--color-nav-menu-border);
    background: var(--color-nav-menu-bg);
}

html[data-theme] .topbar nav .top-nav-submenu a,
html[data-theme] .topbar nav .top-nav-submenu a:visited {
    background: transparent;
    box-shadow: none;
    color: var(--color-nav-menu-text);
}

html[data-theme] .topbar nav .top-nav-submenu a:hover,
html[data-theme] .topbar nav .top-nav-submenu a.active {
    background: var(--color-nav-menu-hover);
    box-shadow: none;
    color: var(--color-nav-menu-active);
}

html[data-theme] .logout button {
    border-color: var(--color-nav-control-border);
    background: transparent;
    color: var(--color-nav-label-active);
}

html[data-theme="light"] .logout button {
    color: var(--color-text-secondary);
}

html[data-theme] .logout button:hover {
    border-color: var(--color-nav-control-border);
    background: var(--color-nav-control-hover);
}

html[data-theme] button.secondary,
html[data-theme] .button-link.secondary {
    border-color: var(--color-border-strong);
    background: var(--color-control-surface);
    color: var(--color-text);
}

html[data-theme] button.secondary:hover,
html[data-theme] .button-link.secondary:hover {
    border-color: var(--color-primary);
    background: var(--color-primary-soft);
    color: var(--color-primary);
}

html[data-theme] button:disabled,
html[data-theme] button:disabled:hover,
html[data-theme] .danger-button:disabled,
html[data-theme] .danger-button:disabled:hover {
    border-color: var(--color-border);
    background: var(--color-neutral-soft);
    color: var(--color-disabled);
    transform: none;
}

html[data-theme] input,
html[data-theme] select,
html[data-theme] textarea {
    border-color: var(--color-border-strong);
    background: var(--color-control-surface);
    color: var(--color-text);
}

html[data-theme] th,
html[data-theme] .dashboard-table-section thead th {
    background: var(--color-table-head);
    color: var(--color-text-secondary);
}

html[data-theme] td {
    border-top-color: var(--color-gridline);
}

html[data-theme] tbody tr:hover {
    background: var(--color-surface-hover);
}

html[data-theme] .table-wrap {
    scrollbar-color: var(--color-scroll-thumb) var(--color-scroll-track);
}

html[data-theme] .table-wrap::-webkit-scrollbar-track {
    background: var(--color-scroll-track);
}

html[data-theme] .table-wrap::-webkit-scrollbar-thumb {
    border-color: var(--color-scroll-track);
    background: var(--color-scroll-thumb);
}

html[data-theme] .table-wrap::-webkit-scrollbar-thumb:hover {
    background: var(--color-scroll-thumb-hover);
}

.theme-dialog-trigger,
.theme-dialog-trigger:hover {
    display: inline-flex;
    width: auto;
    min-height: 32px;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    border: 1px solid transparent;
    border-radius: var(--radius-control);
    background: transparent;
    color: var(--color-nav-label);
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transform: none;
    white-space: nowrap;
}

.theme-dialog-trigger:hover,
.theme-dialog-trigger[aria-expanded="true"] {
    border-color: var(--color-nav-control-border);
    background: var(--color-nav-item-hover);
    color: var(--color-nav-label-active);
}

html[data-theme="light"] .theme-dialog-trigger:hover,
html[data-theme="light"] .theme-dialog-trigger[aria-expanded="true"] {
    color: var(--color-primary);
}

.theme-dialog-trigger svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.modal-open {
    overflow: hidden;
}

.theme-modal {
    width: min(520px, 100%);
}

.theme-modal .modal-title > div {
    display: grid;
    gap: 3px;
}

.theme-modal .modal-title p {
    margin: 0;
    color: var(--color-text-secondary);
    font-size: 12px;
}

.theme-options {
    display: grid;
    gap: 8px;
    padding: var(--space-4) var(--space-5);
}

html[data-theme] .theme-option,
html[data-theme] .theme-option:hover {
    display: grid;
    width: 100%;
    min-height: 64px;
    grid-template-columns: 58px minmax(0, 1fr) 18px;
    align-items: center;
    gap: 9px;
    padding: 8px 10px;
    border: 1px solid transparent;
    border-radius: 5px;
    background: transparent;
    color: var(--color-text);
    text-align: left;
    transform: none;
}

html[data-theme] .theme-option:hover {
    background: var(--color-surface-hover);
}

html[data-theme] .theme-option.active {
    border-color: color-mix(in srgb, var(--color-primary) 35%, var(--color-border));
    background: var(--color-primary-soft);
}

.theme-option > span:nth-child(2) {
    display: grid;
    min-width: 0;
    gap: 1px;
}

.theme-option strong {
    font-size: 13px;
    font-weight: 650;
}

.theme-option small {
    overflow: hidden;
    color: var(--color-text-tertiary);
    font-size: 11px;
    font-weight: 500;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.theme-preview {
    display: grid;
    width: 56px;
    height: 40px;
    grid-template-rows: 10px 1fr;
    overflow: hidden;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    background: #f4f6f8;
}

.theme-preview i {
    display: block;
}

.theme-preview i:last-child {
    margin: 4px;
    border-radius: 2px;
    background: #fff;
}

.theme-preview-default i:first-child { background: #0c66e4; }
.theme-preview-light { background: #f7f9fc; }
.theme-preview-light i:first-child { border-bottom: 1px solid #dce3eb; background: #fff; }
.theme-preview-dark { border-color: #435367; background: #0e151d; }
.theme-preview-dark i:first-child { background: #111b26; }
.theme-preview-dark i:last-child { background: #1d2936; }
.theme-preview-custom { background: color-mix(in srgb, var(--theme-preview-color, #0c66e4) 10%, #fff); }
.theme-preview-custom i:first-child { background: var(--theme-preview-color, #0c66e4); }

.theme-custom-color {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 42px minmax(130px, 170px);
    align-items: center;
    gap: var(--space-3);
    padding: 0 var(--space-5) var(--space-4);
}

.theme-custom-color > div,
.theme-hex-input {
    display: grid;
    min-width: 0;
    gap: 2px;
}

.theme-custom-color strong { font-size: 13px; }
.theme-custom-color small { color: var(--color-text-tertiary); font-size: 11px; }
.theme-color-picker { position: relative; display: grid; width: 42px; height: 36px; overflow: hidden; border: 1px solid var(--color-border-strong); border-radius: var(--radius-control); background: var(--color-surface); cursor: pointer; }
.theme-color-picker input { position: absolute; inset: -8px; width: calc(100% + 16px); min-height: calc(100% + 16px); padding: 0; border: 0; opacity: 0; cursor: pointer; }
.theme-color-picker i { margin: 7px; border: 1px solid rgba(0, 0, 0, .12); border-radius: 3px; background: var(--theme-preview-color, #0c66e4); }
.theme-color-picker:focus-within { border-color: var(--color-primary); outline: 2px solid color-mix(in srgb, var(--color-primary) 20%, transparent); outline-offset: 0; }
.theme-hex-input input { min-width: 0; min-height: 32px; padding-block: 5px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; text-transform: uppercase; }
.theme-hex-input small { line-height: 1.2; }

.theme-option-check {
    width: 7px;
    height: 12px;
    justify-self: center;
    border-right: 2px solid var(--color-primary);
    border-bottom: 2px solid var(--color-primary);
    opacity: 0;
    transform: rotate(45deg) translate(-1px, -1px);
}

.theme-option.active .theme-option-check {
    opacity: 1;
}

.theme-modal-actions {
    margin: 0;
    padding: 10px var(--space-5) var(--space-4);
    border-top: 1px solid var(--color-border);
}

html[data-theme="dark"] .settings-tabs,
html[data-theme="dark"] .service-status,
html[data-theme="dark"] .trigger-examples > div,
html[data-theme="dark"] .guide-grid article:not(.code-card) pre,
html[data-theme="dark"] .workflow-callout,
html[data-theme="dark"] .status-group-row > td,
html[data-theme="dark"] .dashboard-table-section .table-wrap,
html[data-theme="dark"] .dashboard-table-section .status-group-row > td,
html[data-theme="dark"] .timeline-tooltip,
html[data-theme="dark"] .timeline-task > b,
html[data-theme="dark"] .device-focus-task > b {
    background: var(--color-surface);
    color: var(--color-text);
}

html[data-theme="dark"] .dashboard-table-section .status-group-toggle,
html[data-theme="dark"] .timeline-device,
html[data-theme="dark"] .device-focus-scroll,
html[data-theme="dark"] .device-focus-track,
html[data-theme="dark"] .timeline-task,
html[data-theme="dark"] .device-focus-task,
html[data-theme="dark"] .timeline-task.is-compact > span:first-child,
html[data-theme="dark"] .device-focus-task.is-compact > span:first-child,
html[data-theme="dark"] .type-tag,
html[data-theme="dark"] .device-status,
html[data-theme="dark"] .schedule-status.skipped,
html[data-theme="dark"] .schedule-status.waiting,
html[data-theme="dark"] .schedule-status.planned,
html[data-theme="dark"] .schedule-status.scheduled {
    border-color: var(--color-border-strong);
    background: var(--color-neutral-soft);
    color: var(--color-text-secondary);
}

html[data-theme="dark"] .progress {
    background: var(--color-neutral-soft);
}

html[data-theme="dark"] .dashboard-table-section .status-group-toggle:hover,
html[data-theme="dark"] .dashboard-table-section .status-group-toggle:focus-visible,
html[data-theme="dark"] .live-list .live-task:hover,
html[data-theme="dark"] .live-list .live-task:focus-visible,
html[data-theme="dark"] .alert-list .alert-item:hover,
html[data-theme="dark"] .alert-list .alert-item:focus-visible {
    border-color: var(--color-primary);
    background: var(--color-primary-soft);
    color: var(--color-text);
}

html[data-theme="dark"] .cards article.danger {
    border-color: #5a3335;
    background: #261c20;
}

html[data-theme="dark"] .dashboard-filters,
html[data-theme="dark"] .filters,
html[data-theme="dark"] .form-stack {
    background: var(--color-surface);
}

html[data-theme="dark"] .top-nav-submenu {
    border-color: var(--color-border);
    background: var(--color-surface);
    box-shadow: 0 12px 28px rgba(0, 0, 0, .34);
}

html[data-theme="dark"] .modal-backdrop,
html[data-theme="dark"] .device-timeline-backdrop {
    background: var(--color-overlay);
}

html[data-theme="dark"] .ai-pending-alert:hover,
html[data-theme="dark"] .ai-risk,
html[data-theme="dark"] .ai-skill-boundary {
    background: var(--color-warning-soft);
    color: var(--color-warning);
}

html[data-theme="dark"] .ai-permission-groups,
html[data-theme="dark"] .device-focus-track {
    background-color: var(--color-surface);
    background-image: repeating-linear-gradient(to right, transparent 0, transparent calc(1.0416667% - 1px), var(--color-gridline) calc(1.0416667% - 1px), var(--color-gridline) 1.0416667%), repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--device-row-height) - 1px), var(--color-gridline) calc(var(--device-row-height) - 1px), var(--color-gridline) var(--device-row-height));
}

html[data-theme="dark"] .timeline-track {
    background-image: repeating-linear-gradient(to right, transparent 0, transparent calc(8.333% - 1px), var(--color-gridline) calc(8.333% - 1px), var(--color-gridline) 8.333%);
}

html[data-theme="dark"] .timeline-track > span,
html[data-theme="dark"] .trend-chart line {
    background: var(--color-gridline);
    stroke: var(--color-gridline);
}

@media (max-width: 800px) {
    .theme-dialog-trigger span { display: none; }
    .theme-dialog-trigger { padding-inline: 7px; }
    .theme-custom-color { grid-template-columns: minmax(0, 1fr) 42px; }
    .theme-hex-input { grid-column: 1 / -1; }
}
