:root {
    --bg: #f3f0eb;
    --surface: #ffffff;
    --surface-soft: #fff8ef;
    --text: #21262f;
    --muted: #646f7f;
    --line: #d9e0e7;
    --brand: #0e5b73;
    --brand-deep: #113c52;
    --accent: #f3a44d;
    --danger: #b43f2e;
    --success: #1f7a5a;
    --shadow: 0 20px 48px rgba(17, 60, 82, 0.1);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(243, 164, 77, 0.18), transparent 28%),
        linear-gradient(180deg, #f8f5ef 0%, #f1ede6 100%);
    font-family: "Avenir Next", "Trebuchet MS", "Segoe UI", sans-serif;
}

.admin-shell {
    max-width: 1320px;
    margin: 0 auto;
    padding: 28px;
}

.admin-header,
.panel,
.flash {
    border: 1px solid var(--line);
    border-radius: 28px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(18px);
    box-shadow: var(--shadow);
}

.admin-header {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 24px;
    padding: 28px;
    margin-bottom: 20px;
}

.eyebrow,
.label {
    margin: 0 0 8px;
    color: var(--brand);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 800;
}

.admin-header h1,
.panel h2,
.login-panel h2 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
}

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

.header-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.button,
.text-button {
    cursor: pointer;
    font: inherit;
}

.button {
    min-height: 46px;
    padding: 0 18px;
    border-radius: 999px;
    border: 1px solid transparent;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.button-primary {
    background: linear-gradient(135deg, var(--brand), var(--brand-deep));
    color: #fff;
}

.button-secondary {
    background: var(--surface-soft);
    color: var(--brand-deep);
    border-color: rgba(17, 60, 82, 0.12);
}

.button-ghost {
    background: #fff;
    color: var(--text);
    border-color: var(--line);
}

.flash {
    padding: 16px 20px;
    margin-bottom: 18px;
    font-weight: 700;
}

.flash-success {
    border-color: rgba(31, 122, 90, 0.22);
    color: var(--success);
}

.flash-error {
    border-color: rgba(180, 63, 46, 0.2);
    color: var(--danger);
}

.login-panel {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 28px;
    padding: 28px;
}

.login-form,
.stack-form,
.collection-card {
    display: grid;
    gap: 14px;
}

.admin-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 20px;
}

.panel {
    padding: 24px;
}

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

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

.collection {
    display: grid;
    gap: 10px;
}

.collection-card {
    padding: 16px;
    border-radius: 22px;
    border: 1px solid var(--line);
    background: #fff;
}

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

.field-grid.compact {
    align-items: end;
}

label {
    display: grid;
    gap: 8px;
    font-weight: 700;
}

input,
textarea {
    width: 100%;
    padding: 13px 14px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text);
    font: inherit;
}

textarea {
    resize: vertical;
}

.toggle {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toggle input {
    width: auto;
}

.card-actions,
.inline-delete,
.add-form {
    margin-top: 12px;
}

.text-button {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--danger);
    font-weight: 700;
}

.recent-list {
    display: grid;
    gap: 10px;
}

.recent-item {
    display: grid;
    gap: 4px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fff;
}

.recent-item span {
    color: var(--muted);
    font-size: 0.88rem;
    word-break: break-word;
}

@media (max-width: 1000px) {
    .admin-grid,
    .login-panel,
    .field-grid {
        grid-template-columns: 1fr;
    }

    .admin-header {
        flex-direction: column;
    }
}

@media (max-width: 680px) {
    .admin-shell {
        padding: 16px;
    }

    .panel,
    .admin-header,
    .login-panel {
        padding: 20px;
    }
}
