:root {
    --bg: #f4f6f8;
    --panel: #ffffff;
    --text: #1f2933;
    --muted: #6b7785;
    --border: #d9e1e8;
    --accent: #0052cc;
    --danger: #c9372c;
    --success: #1f845a;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
    line-height: 1.35;
}

.container {
    width: min(1100px, 100%);
    margin: 0 auto;
    padding: 24px;
}

.header h1 {
    margin: 0 0 6px;
    font-size: 1.7rem;
}

.header p {
    margin: 0 0 18px;
    color: var(--muted);
    font-size: 0.95rem;
}

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

.header-side {
    display: grid;
    gap: 6px;
    justify-items: end;
}

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

.status-strip {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    justify-content: flex-end;
}

.status-card {
    min-width: 0;
    padding: 5px 8px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: #fff;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.status-card strong {
    font-size: 0.78rem;
    line-height: 1;
}

.status-card small {
    color: var(--muted);
    font-size: 0.76rem;
    line-height: 1.2;
}

.status-badge-inline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 46px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 700;
    line-height: 1;
}

.status-online {
    border-color: #cfe3d8;
    background: #f8fbf9;
}

.status-offline {
    border-color: #f1c7c4;
    background: #fff5f5;
}

.status-unknown {
    border-color: #f1c7c4;
    background: #fff5f5;
}

.status-badge-inline.status-online {
    border: 1px solid #bfe3d2;
    background: #eef9f3;
    color: #0f6b43;
}

.status-badge-inline.status-offline,
.status-badge-inline.status-unknown {
    border: 1px solid #efb7b3;
    background: #fdeceb;
    color: #9c2f2a;
}

.top-nav {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.top-nav a {
    display: inline-block;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    text-decoration: none;
    color: var(--text);
    background: #fff;
    font-weight: 600;
}

.top-nav a.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

.panel h2 {
    margin-top: 0;
    font-size: 1.25rem;
}

.message {
    font-weight: 600;
}

.message.error {
    border-left: 4px solid var(--danger);
}

.message.success {
    border-left: 4px solid var(--success);
}

.row {
    display: grid;
    gap: 8px;
    max-width: 680px;
}

.action-row {
    max-width: none;
    grid-template-columns: repeat(auto-fit, minmax(180px, max-content));
    align-items: center;
}

select,
input[type="text"],
input[type="number"],
input[type="password"],
button {
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid var(--border);
    font-size: 0.95rem;
}

button {
    cursor: pointer;
    background: var(--accent);
    color: #fff;
    border: 1px solid var(--accent);
    width: fit-content;
}

.btn-sm {
    padding: 4px 9px;
    font-size: 0.84rem;
    border-radius: 5px;
}

.btn-secondary {
    background: #eef2f7;
    color: #22303c;
    border-color: #c8d4e0;
}

.btn-danger {
    background: var(--danger);
    border-color: var(--danger);
}

.action-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

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

.scheduler-dialog {
    width: min(640px, 92vw);
    max-height: 88vh;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px;
    overflow: auto;
}

.scheduler-dialog::backdrop {
    background: rgba(31, 41, 51, 0.38);
}

.scheduler-dialog-wide {
    width: min(980px, 96vw);
}

.dialog-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 10px;
}

.dialog-header-row h3,
.dialog-section h4 {
    margin: 0 0 4px;
}

.dialog-section {
    border-top: 1px solid var(--border);
    padding-top: 12px;
    margin-top: 12px;
}

.dialog-section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.table-wrap {
    overflow-x: auto;
}

.scheduler-performance-result h4 {
    margin-top: 14px;
}

.result-separator {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px dashed var(--border);
}

.plan-cell {
    display: grid;
    gap: 6px;
}

.plan-item {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 5px 6px;
    background: #f8fafc;
    line-height: 1.25;
}

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

.summary-card {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    background: #f8fafc;
}

.summary-card small {
    display: block;
    color: var(--muted);
    margin-bottom: 4px;
}

.summary-card strong {
    font-size: 1rem;
}

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

.plan-list-item {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    background: #fbfcfd;
}

.plan-list-item-action {
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.plan-list-item-action:hover,
.plan-list-item-action:focus {
    border-color: #b7c8db;
    background: #f6f9fc;
    box-shadow: 0 0 0 2px rgba(0, 82, 204, 0.08);
    outline: none;
}

.plan-list-main {
    min-width: 0;
}

.plan-list-time {
    font-weight: 700;
    margin-bottom: 2px;
}

.plan-list-account {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.plan-list-side {
    display: grid;
    justify-items: end;
    gap: 6px;
    text-align: right;
}

.plan-list-note {
    max-width: 360px;
}

.detail-toggle-body {
    margin-top: 12px;
}

details summary {
    cursor: pointer;
    font-weight: 600;
}

@media (max-width: 720px) {
    .plan-list-item {
        flex-direction: column;
    }

    .plan-list-side {
        justify-items: start;
        text-align: left;
    }
}

.status-badge {
    display: inline-block;
    margin-top: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-planned {
    background: #e8efff;
    color: #1b4cc9;
}

.status-running {
    background: #fff4db;
    color: #8a5a00;
}

.status-success {
    background: #e6f7ef;
    color: #0f6b43;
}

.status-partial-success {
    background: #fff4db;
    color: #8a5a00;
}

.status-failed {
    background: #fdeceb;
    color: #9c2f2a;
}

.status-skipped {
    background: #eef2f7;
    color: #4c5a68;
}

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

th,
td {
    text-align: left;
    border-bottom: 1px solid var(--border);
    padding: 6px 5px;
    vertical-align: top;
    font-size: 0.93rem;
}

.script-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
}

.script-card {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
}

.script-card h3 {
    margin-top: 0;
    font-size: 1.02rem;
}

.performance-import-form {
    max-width: 860px;
}

.checkbox {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.error {
    color: var(--danger);
}

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

.trend-bars {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 34px;
    min-width: 140px;
}

.trend-bar-wrap {
    display: flex;
    align-items: flex-end;
    height: 100%;
    width: 8px;
}

.trend-bar {
    display: block;
    width: 100%;
    border-radius: 2px 2px 0 0;
    background: #2f6fde;
}

.product-trend-group {
    margin: 8px 0 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px;
    background: #fcfdff;
}

.product-trend-group summary {
    cursor: pointer;
    font-weight: 600;
    margin-bottom: 8px;
}

.login-body {
    min-height: 100vh;
    background: linear-gradient(135deg, #edf2ff 0%, #f6f9fc 42%, #ffffff 100%);
}

.login-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
}

.login-card {
    width: min(420px, 100%);
    padding: 26px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #ffffff;
    box-shadow: 0 12px 32px rgba(0, 38, 77, 0.1);
}

.login-card h1 {
    margin: 0 0 8px;
    font-size: 1.4rem;
}

.login-form {
    display: grid;
    gap: 8px;
    margin-top: 10px;
}

.login-form label {
    font-weight: 600;
    font-size: 0.9rem;
}

@media (max-width: 680px) {
    .container {
        padding: 14px;
    }

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

    .header-shell {
        flex-direction: column;
        align-items: stretch;
    }

    .header-side {
        justify-items: stretch;
    }

    .status-strip {
        justify-content: stretch;
        flex-wrap: wrap;
    }

    .logout-form {
        justify-content: space-between;
    }

    .dialog-header-row,
    .dialog-section-head {
        flex-direction: column;
        align-items: stretch;
    }
}
