:root {
    color-scheme: light;
    --bg: #f4f6f8;
    --card: #ffffff;
    --text: #17202a;
    --muted: #64748b;
    --border: #d9e0e7;
    --primary: #1769e0;
    --primary-hover: #0f57bd;
    --danger: #c62828;
    --success-bg: #e8f7ee;
    --success-text: #176b3a;
    --error-bg: #fdecec;
    --error-text: #9b1c1c;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background: var(--bg);
}

a {
    color: var(--primary);
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 22px max(24px, calc((100% - 1200px) / 2));
    background: #111827;
    color: #fff;
}

.topbar h1,
.topbar p {
    margin: 0;
}

.topbar p {
    margin-top: 5px;
    color: #b9c2cf;
}

.topbar nav {
    display: flex;
    gap: 10px;
}

.container {
    width: min(1200px, calc(100% - 32px));
    margin: 30px auto;
}

.narrow {
    max-width: 760px;
}

.button,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 8px;
    padding: 11px 16px;
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    background: var(--primary);
    color: #fff;
}

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

.button-secondary {
    background: #334155;
}

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

.archive-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 18px;
}

.archive-card,
.form-card,
.empty-state,
.login-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(15, 23, 42, 0.06);
}

.archive-card {
    padding: 20px;
}

.archive-card-header {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 16px;
}

.archive-card h2 {
    margin: 0 0 12px;
    font-size: 1.2rem;
}

.archive-card p {
    color: #445164;
    line-height: 1.55;
}

.archive-card small {
    display: block;
    margin-top: 18px;
    color: var(--muted);
}

.links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.archive-link {
    border-radius: 7px;
    padding: 10px 13px;
    background: #e8f1ff;
    font-weight: 700;
    text-decoration: none;
}

.archive-link.database {
    background: #edf7ee;
    color: #256b30;
}

.form-card {
    padding: 24px;
}

label {
    display: block;
    margin: 0 0 7px;
    font-weight: 700;
}

input,
textarea {
    width: 100%;
    margin: 0 0 20px;
    padding: 12px 13px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    font: inherit;
}

input:focus,
textarea:focus {
    outline: 3px solid rgba(23, 105, 224, 0.13);
    border-color: var(--primary);
}

.form-actions {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

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

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

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

.empty-state {
    padding: 50px 24px;
    text-align: center;
}

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

.login-card {
    width: min(430px, 100%);
    padding: 30px;
}

.login-card h1 {
    margin-top: 0;
}

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

.login-card button {
    width: 100%;
}

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

    .topbar nav,
    .form-actions {
        flex-direction: column;
    }

    .topbar nav .button,
    .form-actions button {
        width: 100%;
    }
}
