:root {
    color-scheme: light;
    --bg: #f5f7fb;
    --panel: #ffffff;
    --ink: #1c2430;
    --muted: #687385;
    --line: #dfe5ef;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --dark: #111827;
    --success-bg: #dcfce7;
    --success-text: #166534;
    --fail-bg: #fee2e2;
    --fail-text: #991b1b;
    --idle-bg: #eef2ff;
    --idle-text: #3730a3;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

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

a {
    color: inherit;
    text-decoration: none;
}

input,
textarea,
button {
    font: inherit;
}

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(circle at 15% 15%, rgba(37, 99, 235, 0.14), transparent 34%),
        linear-gradient(145deg, #eef4ff 0%, #f8fafc 48%, #edfdf5 100%);
}

.login-panel,
.panel,
.table-wrap {
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 18px 45px rgba(28, 36, 48, 0.08);
}

.login-panel {
    width: min(440px, 100%);
    padding: 34px;
}

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

h1 {
    margin: 0;
    font-size: clamp(28px, 4vw, 42px);
    line-height: 1.08;
}

.login-title {
    font-size: clamp(24px, 5vw, 30px);
    text-align: center;
}

.page-title {
    font-size: clamp(24px, 3vw, 32px);
}

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

.form-stack,
.form-grid,
.add-form {
    display: grid;
    gap: 18px;
}

label {
    display: grid;
    gap: 8px;
    color: #334155;
    font-size: 14px;
    font-weight: 700;
}

input,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    padding: 12px 13px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

textarea {
    resize: vertical;
}

input:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.button,
.icon-button {
    border: 0;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s, box-shadow 0.2s;
}

.button {
    min-height: 44px;
    border-radius: 8px;
    padding: 0 18px;
    color: #fff;
    font-weight: 800;
}

.button:hover,
.icon-button:hover {
    transform: translateY(-1px);
}

.button-primary {
    background: var(--primary);
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.26);
}

.button-primary:hover {
    background: var(--primary-dark);
}

.button-dark {
    background: var(--dark);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 16px clamp(18px, 5vw, 56px);
    background: rgba(255, 255, 255, 0.88);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(14px);
}

.brand {
    font-size: 18px;
    font-weight: 900;
}

nav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

nav a {
    border-radius: 8px;
    color: var(--muted);
    font-weight: 800;
    padding: 9px 12px;
}

nav a.active,
nav a:hover {
    background: #edf4ff;
    color: var(--primary);
}

.container {
    width: min(1180px, calc(100% - 32px));
    margin: 34px auto 70px;
}

.section-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}

.panel {
    padding: 22px;
}

.add-panel {
    margin-bottom: 20px;
}

.add-form {
    grid-template-columns: minmax(220px, 1fr) 160px auto auto;
    align-items: end;
}

.checkbox-row {
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
}

.checkbox-row input {
    width: 18px;
    height: 18px;
}

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

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

.form-actions {
    display: flex;
    justify-content: flex-end;
}

.alert {
    border-radius: 8px;
    margin-bottom: 18px;
    padding: 13px 15px;
    font-weight: 800;
}

.alert-success {
    background: var(--success-bg);
    color: var(--success-text);
}

.alert-error {
    background: var(--fail-bg);
    color: var(--fail-text);
}

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

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 820px;
}

th,
td {
    border-bottom: 1px solid var(--line);
    padding: 16px;
    text-align: left;
    vertical-align: middle;
}

th {
    background: #f8fafc;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

tr:last-child td {
    border-bottom: 0;
}

.subline {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
}

.status {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    border-radius: 999px;
    padding: 0 10px;
    font-size: 12px;
    font-weight: 900;
}

.status-success {
    background: var(--success-bg);
    color: var(--success-text);
}

.status-fail {
    background: var(--fail-bg);
    color: var(--fail-text);
}

.status-never {
    background: var(--idle-bg);
    color: var(--idle-text);
}

.row-actions {
    display: flex;
    gap: 8px;
}

.icon-button {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #eef2f7;
    color: #0f172a;
    font-size: 18px;
    font-weight: 900;
}

.icon-button.danger {
    background: #fff1f2;
    color: #be123c;
}

.empty {
    color: var(--muted);
    padding: 34px;
    text-align: center;
}

@media (max-width: 760px) {
    .topbar,
    .section-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .container {
        width: min(100% - 24px, 1180px);
        margin-top: 24px;
    }

    .login-panel {
        padding: 24px;
    }

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

    .form-actions {
        justify-content: stretch;
    }

    .form-actions .button,
    .section-heading .button,
    .add-form .button {
        width: 100%;
    }
}
