:root {
    --bg: #f4f6fb;
    --panel: #ffffff;
    --panel-border: #e3e7ef;
    --text: #1f2937;
    --muted: #667085;
    --primary: #2563eb;
    --primary-soft: #e8efff;
    --sidebar: #111827;
    --sidebar-muted: #9ca3af;
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    margin: 0;
    display: grid;
    grid-template-columns: 260px 1fr;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, "Segoe UI", Arial, sans-serif;
}

.login-body {
    display: block;
}

.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-panel {
    width: 100%;
    max-width: 460px;
}

.sidebar {
    min-height: 100vh;
    padding: 28px 18px;
    background: var(--sidebar);
    color: #ffffff;
}

.brand {
    margin-bottom: 32px;
    padding: 0 10px;
}

.brand__title {
    display: block;
    font-size: 20px;
    font-weight: 700;
}

.brand__subtitle {
    display: block;
    margin-top: 6px;
    color: var(--sidebar-muted);
    font-size: 13px;
}

.nav {
    display: grid;
    gap: 8px;
}

.sidebar-controls {
    margin-top: 22px;
    padding: 12px 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
}

.sidebar-controls h3 {
    margin: 12px 0 8px;
    font-size: 13px;
    color: #e5e7eb;
}

.sidebar-controls h3:first-child {
    margin-top: 0;
}

.sidebar-status {
    margin: 0;
}

.sidebar-last-run {
    margin: 6px 0 0;
    font-size: 11px;
    color: #9ca3af;
}

.sidebar-toggle {
    width: 100%;
    padding: 8px 10px;
    border-radius: 8px;
    font-weight: 700;
}

.sidebar-toggle--dry {
    background: #2563eb;
}

.sidebar-toggle--real {
    background: #dc2626;
}

.sidebar-icon-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.icon-button {
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 8px;
    text-align: center;
    line-height: 34px;
    font-size: 15px;
}

.icon-button--danger {
    background: #dc2626;
}

.icon-button--muted {
    background: #6b7280;
}

.nav__link {
    display: block;
    padding: 12px 14px;
    border-radius: 10px;
    color: var(--sidebar-muted);
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
}

.nav__link:hover,
.nav__link--active {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.content {
    width: min(1120px, 100%);
    padding: 40px;
    overflow-x: hidden;
}

.alerts {
    display: grid;
    gap: 10px;
    margin-bottom: 20px;
}

.alert {
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid var(--panel-border);
    background: #ffffff;
}

.alert--success {
    border-color: #95d5b2;
    background: #edfdf3;
}

.alert--error {
    border-color: #f6b0b0;
    background: #fff1f1;
}

.page-header {
    margin-bottom: 28px;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--primary);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 10px;
    font-size: 34px;
}

h2 {
    margin-bottom: 14px;
    font-size: 20px;
}

p {
    color: var(--muted);
    line-height: 1.6;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.stat-card,
.panel {
    border: 1px solid var(--panel-border);
    border-radius: 18px;
    background: var(--panel);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.06);
}

.stat-card {
    padding: 20px;
}

.stat-card--wide {
    grid-column: span 2;
}

.stat-card__label,
.stat-card__hint {
    display: block;
    color: var(--muted);
    font-size: 14px;
}

.stat-card__value {
    display: block;
    margin: 10px 0;
    font-size: 36px;
}

.panel {
    padding: 24px;
    margin-bottom: 20px;
}

.check-list {
    margin: 0;
    padding-left: 20px;
    color: var(--muted);
    line-height: 1.8;
}

code {
    padding: 2px 6px;
    border-radius: 6px;
    background: var(--primary-soft);
    color: var(--primary);
}

form {
    margin: 0;
}

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

.label-wide {
    grid-column: 1 / -1;
}

label {
    display: grid;
    gap: 6px;
    font-weight: 600;
    font-size: 14px;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    font-weight: 500;
    line-height: 1.4;
}

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

fieldset {
    border: 1px solid #d7dce7;
    border-radius: 12px;
    padding: 14px;
    background: #fbfcff;
}

legend {
    padding: 0 6px;
    color: var(--muted);
    font-weight: 600;
}

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

.weekday-grid .checkbox-row {
    min-height: auto;
    padding: 8px 10px;
    border: 1px solid #e3e7ef;
    border-radius: 10px;
    background: #ffffff;
}

input,
select,
textarea,
button {
    width: 100%;
    border-radius: 10px;
    border: 1px solid #d7dce7;
    font: inherit;
    padding: 10px 12px;
    background: #fff;
}

input[type="checkbox"] {
    width: auto;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    outline: 3px solid rgba(37, 99, 235, 0.12);
}

textarea {
    resize: vertical;
}

button {
    width: auto;
    border: none;
    background: var(--primary);
    color: #fff;
    padding: 10px 16px;
    cursor: pointer;
    transition: transform 0.12s ease, opacity 0.12s ease;
}

.button-link {
    display: inline-block;
    width: auto;
    border-radius: 10px;
    background: var(--primary);
    color: #fff;
    padding: 10px 16px;
    text-decoration: none;
    transition: transform 0.12s ease, opacity 0.12s ease;
}

button:hover,
.button-link:hover {
    opacity: 0.92;
    transform: translateY(-1px);
}

.button-muted {
    background: #6b7280;
}

.button-danger {
    background: #dc2626;
}

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

.export-actions {
    margin-bottom: 14px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

th,
td {
    padding: 10px 8px;
    border-bottom: 1px solid #edf0f6;
    text-align: left;
    vertical-align: top;
}

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

.token-cell,
.template-cell {
    max-width: 360px;
    word-break: break-word;
}

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

.inline-form form {
    display: inline-flex;
}

.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 999px;
    background: #eef1f8;
    color: #4b5563;
    font-size: 12px;
    font-weight: 600;
}

.badge--ok {
    background: #e6f8ee;
    color: #0f7a40;
}

.preview-box {
    margin-top: 18px;
    padding: 14px;
    border: 1px dashed #c8d3ea;
    border-radius: 12px;
    background: #f8fbff;
}

.help-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 20px;
}

.help-card {
    margin-bottom: 0;
}

.help-list {
    margin: 0;
    padding-left: 22px;
    color: var(--muted);
    line-height: 1.8;
}

pre {
    margin: 8px 0 0;
    padding: 10px;
    border-radius: 10px;
    background: #eef4ff;
    color: #1d3557;
    white-space: pre-wrap;
    word-break: break-word;
}

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

    .sidebar {
        min-height: auto;
    }

    .sidebar-controls {
        margin-top: 14px;
    }

    .content {
        padding: 24px;
    }

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

    .stat-card--wide {
        grid-column: auto;
    }

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

    .inline-form {
        flex-direction: column;
        align-items: stretch;
    }

    .inline-form form,
    .inline-form button,
    .button-link {
        width: 100%;
    }

    .weekday-grid,
    .help-grid {
        grid-template-columns: 1fr;
    }
}
