.task-table {
    min-width: 780px;
    table-layout: fixed;
}
.task-table td,
.task-table th {
    overflow-wrap: anywhere;
    white-space: normal;
}
.task-table th:nth-child(3) {
    width: 28%;
}
.task-table small,
.task-action strong {
    display: block;
    margin-top: 4px;
    font-size: 12px;
}
.task-account {
    min-width: 0;
}
.account-timing {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px 10px;
    margin: 12px 0;
    font-size: 13px;
    line-height: 1.6;
    color: var(--muted);
}
.account-timing strong {
    color: var(--ink);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}
.log-message {
    min-width: 0;
    overflow-wrap: anywhere;
}
.filter-row input[type='search'] {
    max-width: 100%;
}

:root {
    --bg: #f4f5f3;
    --surface: #ffffff;
    --ink: #1f2421;
    --muted: #687069;
    --line: #d9ded9;
    --nav: #222925;
    --nav-muted: #aeb8b1;
    --green: #237a4b;
    --green-soft: #e6f2eb;
    --orange: #a95715;
    --orange-soft: #fff0e2;
    --red: #b33a36;
    --red-soft: #fbe9e8;
    --blue: #2f638f;
    --shadow: 0 10px 28px rgba(24, 34, 28, 0.08);
    font-family: Inter, 'Segoe UI', 'Microsoft YaHei', sans-serif;
    color: var(--ink);
    background: var(--bg);
}

* {
    box-sizing: border-box;
}
[hidden] {
    display: none !important;
}
body {
    margin: 0;
    min-width: 320px;
    min-height: 100vh;
    background: var(--bg);
}
button,
input,
select,
textarea {
    font: inherit;
    letter-spacing: 0;
}
button {
    cursor: pointer;
}
button:disabled {
    cursor: not-allowed;
    opacity: 0.48;
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: #e9ede9;
}
.auth-panel {
    width: min(420px, 100%);
    padding: 36px;
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    border-radius: 8px;
}
.auth-panel h1 {
    margin: 22px 0 26px;
    font-size: 24px;
}
.auth-panel label {
    display: grid;
    gap: 8px;
    margin: 15px 0;
    color: var(--muted);
    font-size: 14px;
}
.auth-panel input {
    width: 100%;
    height: 44px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 0 12px;
    color: var(--ink);
    background: #fff;
}
.auth-panel button {
    width: 100%;
    margin-top: 12px;
}
.brand-mark {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 7px;
    color: white;
    background: var(--green);
    font-weight: 800;
}
.brand-mark.small {
    width: 34px;
    height: 34px;
    font-size: 12px;
}
.form-error {
    min-height: 20px;
    color: var(--red);
    font-size: 13px;
}

.app {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 230px minmax(0, 1fr);
}
.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 20px 14px;
    background: var(--nav);
    color: white;
}
.brand {
    display: flex;
    gap: 11px;
    align-items: center;
    padding: 0 8px 22px;
}
.brand strong {
    font-size: 15px;
}
.sidebar nav {
    display: grid;
    gap: 4px;
}
.sidebar nav button {
    height: 42px;
    padding: 0 13px;
    border: 0;
    border-radius: 5px;
    text-align: left;
    color: var(--nav-muted);
    background: transparent;
}
.sidebar nav button:hover,
.sidebar nav button.active {
    color: #fff;
    background: #344039;
}
.sidebar-footer {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 10px 2px;
    color: var(--nav-muted);
    font-size: 12px;
}
.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #d08a43;
}
.dot.online {
    background: #5bc486;
}
.dot.offline {
    background: #df6962;
}

.workspace {
    min-width: 0;
}
.topbar {
    min-height: 92px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 20px 32px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.86);
}
.topbar h1 {
    margin: 0;
    font-size: 22px;
}
.topbar p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 13px;
}
.top-actions,
.toolbar,
.run-actions {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
}
.content {
    padding: 26px 32px 42px;
}
.notice {
    margin: 18px 32px 0;
    padding: 12px 14px;
    border: 1px solid #e6c39f;
    border-radius: 6px;
    color: #77400e;
    background: var(--orange-soft);
}

.primary,
.ghost,
.danger,
.small-button {
    min-height: 38px;
    border-radius: 5px;
    padding: 0 14px;
    border: 1px solid transparent;
}
.danger-outline {
    color: var(--red);
    border-color: #e5b8b5;
    background: #fff;
}
.primary {
    color: white;
    background: var(--green);
}
.ghost {
    color: var(--ink);
    border-color: var(--line);
    background: var(--surface);
}
.danger {
    color: white;
    background: var(--red);
}
.small-button {
    min-height: 32px;
    padding: 0 10px;
    color: var(--ink);
    border-color: var(--line);
    background: #fff;
}

.metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    background: var(--surface);
}
.metric {
    min-height: 112px;
    padding: 20px;
    border-right: 1px solid var(--line);
}
.metric:last-child {
    border-right: 0;
}
.metric span {
    display: block;
    color: var(--muted);
    font-size: 13px;
}
.metric strong {
    display: block;
    margin: 10px 0 4px;
    font-size: 25px;
    font-weight: 700;
}
.metric small {
    color: var(--muted);
}

.section {
    margin-top: 20px;
    border-top: 1px solid var(--line);
    padding-top: 20px;
}
.section:first-child {
    margin-top: 0;
    border-top: 0;
    padding-top: 0;
}
.section-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 13px;
}
.section-head h2 {
    margin: 0;
    font-size: 17px;
}
.section-head p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 13px;
}
.panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    overflow: hidden;
}
.panel-body {
    padding: 18px;
}
.run-bar {
    display: grid;
    grid-template-columns: minmax(210px, 1fr) auto;
    align-items: center;
    gap: 16px;
    padding: 18px;
}
.run-bar select {
    height: 38px;
    max-width: 380px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 5px;
    background: white;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
}
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
th,
td {
    padding: 13px 14px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}
th {
    color: var(--muted);
    background: #f8f9f7;
    font-weight: 600;
    white-space: nowrap;
}
tr:last-child td {
    border-bottom: 0;
}
.status {
    display: inline-flex;
    min-height: 26px;
    align-items: center;
    padding: 0 9px;
    border-radius: 13px;
    font-size: 12px;
    background: #edf0ed;
    color: #525a54;
    white-space: nowrap;
}
.status.running,
.status.completed {
    color: #17663d;
    background: var(--green-soft);
}
.status.waiting,
.status.partial {
    color: var(--orange);
    background: var(--orange-soft);
}
.status.failed,
.status.offline {
    color: var(--red);
    background: var(--red-soft);
}
.subtle {
    color: var(--muted);
}
.mono {
    font-family: Consolas, 'SFMono-Regular', monospace;
}
.empty {
    padding: 44px 18px;
    color: var(--muted);
    text-align: center;
}

.task-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}
.task-account {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 17px;
    background: var(--surface);
}
.task-account h3 {
    margin: 0 0 4px;
    font-size: 15px;
}
.task-account > p {
    margin: 0 0 15px;
    color: var(--muted);
    font-size: 12px;
}
.task-account .table-wrap {
    margin: 0 -17px -17px;
    width: calc(100% + 34px);
    border-top: 1px solid var(--line);
}
.task-summary {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    margin-bottom: 15px;
    color: var(--muted);
    font-size: 13px;
}
.task-summary strong {
    color: var(--ink);
}
.progress-line {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    padding: 8px 0;
    border-top: 1px solid #edf0ed;
    font-size: 13px;
}
.progress-line:first-of-type {
    border-top: 0;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(90px, 1fr));
    gap: 8px;
}
.calendar-heading {
    flex-wrap: wrap;
}
.calendar-heading h2 {
    flex-shrink: 0;
}
.calendar-cell {
    min-height: 148px;
    min-width: 0;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f7fbfa;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-wrap: anywhere;
}
.calendar-cell time {
    font-size: 13px;
    font-weight: 700;
}
.calendar-accounts {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 8px;
}
.calendar-account {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 2px 4px;
    font-size: 13px;
    line-height: 1.5;
    min-width: 0;
}
.calendar-account-name {
    color: var(--ink);
}
.calendar-account-points {
    font-size: 14px;
    font-variant-numeric: tabular-nums;
}
.calendar-live {
    font-size: 11px;
}
.calendar-empty {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}
.calendar-cell-footer {
    margin-top: auto;
    color: #465d56;
    font-size: 12px;
    line-height: 1.5;
}
.calendar-cell-footer span {
    display: block;
}
.calendar-cell.heat-1 {
    background: #e2f1ed;
}
.calendar-cell.heat-2 {
    background: #c5e4dc;
}
.calendar-cell.heat-3 {
    background: #a6d7cb;
}
.calendar-cell.heat-4 {
    background: #87cabb;
}
.calendar-records small {
    display: block;
    color: var(--muted);
}
.calendar-runs {
    background: #f7fbfa;
}
.calendar-runs summary {
    cursor: pointer;
}
.calendar-runs .table-wrap {
    margin-top: 12px;
}
.calendar-category {
    display: inline-block;
    margin: 3px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 3px 8px;
    font-size: 12px;
    color: var(--green);
}
.filter-row {
    display: flex;
    align-items: end;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.filter-row label {
    display: grid;
    gap: 5px;
    color: var(--muted);
    font-size: 12px;
}
.filter-row input,
.filter-row select {
    height: 36px;
    padding: 0 9px;
    border: 1px solid var(--line);
    border-radius: 5px;
    background: #fff;
}

.log-view {
    height: min(620px, 65vh);
    overflow: auto;
    padding: 14px;
    color: #dce5df;
    background: #202622;
    font:
        12px/1.65 Consolas,
        monospace;
}
.log-line {
    display: grid;
    grid-template-columns: 155px 58px 85px minmax(0, 1fr);
    gap: 10px;
    border-bottom: 1px solid #303a33;
    padding: 4px 0;
}
.log-line .error {
    color: #ff8e87;
}
.log-line .warn {
    color: #ffc079;
}
.log-line .info {
    color: #8ed5aa;
}
.log-message {
    min-width: 0;
    white-space: normal;
}
.raw-log,
.structured-log {
    margin-top: 6px;
    padding: 7px 9px;
    color: #17211b;
    background: #f7faf8;
    border: 1px solid #b8c8bd;
    border-radius: 6px;
}
.raw-log summary,
.structured-log summary {
    cursor: pointer;
    color: #234232;
    font-weight: 600;
    font:
        11px/1.5 system-ui,
        sans-serif;
}
.raw-log code {
    display: block;
    margin-top: 5px;
    color: #17211b;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.timeline {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    overflow: hidden;
}
.step {
    display: grid;
    grid-template-columns: 155px 110px minmax(0, 1fr);
    gap: 12px;
    padding: 11px 14px;
    border-bottom: 1px solid var(--line);
    font-size: 13px;
}
.step:last-child {
    border-bottom: 0;
}
.step time {
    color: var(--muted);
}
.step.warn strong {
    color: var(--orange);
}
.step.error strong {
    color: var(--red);
}
.diagnostic {
    margin-top: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    overflow: hidden;
}
.diagnostic summary {
    cursor: pointer;
    padding: 12px 14px;
    color: var(--muted);
    font-size: 13px;
}
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}
.form-grid label:not(.check) {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 13px;
}
.form-grid input,
.form-grid select {
    width: 100%;
    min-height: 40px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 5px;
    color: var(--ink);
    background: #fff;
}
.form-grid fieldset {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 12px;
}
.form-grid legend {
    padding: 0 6px;
    color: var(--muted);
    font-size: 12px;
}
.form-grid .check {
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--ink);
    font-size: 13px;
}
.form-grid .check input {
    width: 16px;
    min-height: 16px;
}
.full {
    grid-column: 1 / -1;
}
.task-details {
    margin-top: 8px;
    padding: 7px 9px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fafbf9;
    font-size: 12px;
}
.task-details summary {
    cursor: pointer;
    color: var(--muted);
}
.task-details dl {
    display: grid;
    grid-template-columns: 120px 1fr;
    margin: 8px 0 0;
}
.task-details dt,
.task-details dd {
    margin: 0;
    padding: 4px 6px;
    border-bottom: 1px solid var(--line);
    overflow-wrap: anywhere;
}
.task-details dt { color: var(--muted); }
.task-details pre {
    margin: 8px 0 0;
    padding: 8px;
    max-height: 320px;
    overflow: auto;
    color: #eef7f0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    background: #202622;
    border: 1px solid #38463e;
    border-radius: 5px;
}
.structured-log pre {
    margin: 7px 0 0;
    padding: 8px;
    max-height: 320px;
    overflow: auto;
    color: #17211b;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    background: #f7faf8;
    border: 1px solid #d0ddd4;
    border-radius: 5px;
}

.danger-zone {
    border-color: #e5b8b5 !important;
    background: var(--red-soft);
}
.form-actions,
.row-actions {
    display: flex;
    gap: 9px;
    flex-wrap: wrap;
}
.details-list {
    display: grid;
    grid-template-columns: 180px 1fr;
    margin: 0;
}
.details-list dt,
.details-list dd {
    margin: 0;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
}
.details-list dt {
    color: var(--muted);
    background: #f8f9f7;
}

@media (max-width: 1050px) {
    .metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .metric:nth-child(2) {
        border-right: 0;
    }
    .metric:nth-child(-n + 2) {
        border-bottom: 1px solid var(--line);
    }
    .calendar-grid {
        grid-template-columns: repeat(4, minmax(90px, 1fr));
    }
}

@media (max-width: 760px) {
    .app {
        grid-template-columns: 1fr;
    }
    .sidebar {
        position: static;
        height: auto;
        padding: 14px;
    }
    .sidebar nav {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .sidebar-footer {
        margin-top: 10px;
    }
    .topbar {
        min-height: auto;
        padding: 18px;
        align-items: flex-start;
    }
    .content {
        padding: 18px;
    }
    .notice {
        margin: 14px 18px 0;
    }
    .metrics,
    .task-grid {
        grid-template-columns: 1fr;
    }
    .metric {
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }
    .metric:last-child {
        border-bottom: 0;
    }
    .run-bar {
        grid-template-columns: 1fr;
    }
    .calendar-grid {
        grid-template-columns: repeat(2, minmax(90px, 1fr));
    }
    .log-line {
        grid-template-columns: 1fr;
        gap: 1px;
        padding: 8px 0;
    }
    .step,
    .form-grid {
        grid-template-columns: 1fr;
    }
    .details-list {
        grid-template-columns: 1fr;
    }
    .details-list dt {
        border-bottom: 0;
    }
}
