:root {
    --bg: #f6f4ef;
    --white: #ffffff;

    --text: #263326;
    --muted: #6c7769;

    --primary: #7bb661;
    --primary-dark: #4f8f3a;

    --secondary: #eee8dd;
    --danger: #b94a48;

    --border: #ddd4c5;

    --radius: 18px;

    --shadow:
        0 12px 35px rgba(0,0,0,.08);
}

* {
    box-sizing: border-box;
}

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);

    font-family:
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

a {
    color: inherit;
}

img {
    max-width: 100%;
    height: auto;
}

/* =========================
   ADMIN HEADER
========================= */

.admin-header {
    background: var(--text);
    color: white;

    padding: 16px 24px;

    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
}

.admin-brand {
    font-size: 18px;
    font-weight: 800;
}

.admin-nav {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}

.admin-nav a {
    text-decoration: none;
    font-weight: 700;
    opacity: .92;
    transition: opacity .2s ease;
}

.admin-nav a:hover {
    opacity: 1;
}

.admin-user {
    opacity: .72;
}

/* =========================
   LAYOUT
========================= */

.admin-main {
    width: min(1180px, calc(100% - 32px));
    margin: 32px auto;
}

.box {
    background: var(--white);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow);
}

.box + .box {
    margin-top: 24px;
}

/* =========================
   TYPOGRAPHY
========================= */

h1,
h2,
h3 {
    margin-top: 0;
    line-height: 1.15;
}

h1 {
    font-size: clamp(32px, 5vw, 46px);
    margin-bottom: 10px;
}

h2 {
    font-size: 28px;
    margin-bottom: 12px;
}

h3 {
    font-size: 22px;
    margin-bottom: 10px;
}

p {
    line-height: 1.6;
}

.muted {
    color: var(--muted);
}

/* =========================
   BUTTONS
========================= */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 42px;
    padding: 0 16px;

    border: 0;
    border-radius: 999px;

    text-decoration: none;
    font-weight: 700;

    cursor: pointer;

    transition:
        background .2s ease,
        transform .15s ease,
        opacity .2s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary,
.btn {
    background: var(--primary);
    color: white;
}

.btn-primary:hover,
.btn:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--secondary);
    color: var(--text);
}

.btn-secondary:hover {
    background: #e3dacd;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    opacity: .92;
}

/* =========================
   TABLES
========================= */

.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

th,
td {
    padding: 14px 12px;
    text-align: left;
    vertical-align: top;

    border-bottom: 1px solid #eee8dd;
}

table td {
    vertical-align: middle;
}

th {
    color: var(--muted);

    font-size: 13px;
    font-weight: 800;

    text-transform: uppercase;
    letter-spacing: .06em;
}

td strong {
    display: inline-block;
    margin-bottom: 4px;
}

.actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
}

/* =========================
   FORMS
========================= */

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.form-group {
    margin-bottom: 18px;
}

label {
    display: block;

    margin-bottom: 8px;

    font-weight: 700;
}

input,
textarea,
select {
    width: 100%;

    padding: 12px 14px;

    border: 1px solid var(--border);
    border-radius: 12px;

    background: white;
    color: var(--text);

    font: inherit;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
}

textarea {
    min-height: 180px;
    resize: vertical;
}

/* =========================
   LOGIN
========================= */

.login-page {
    min-height: 100vh;

    display: grid;
    place-items: center;

    padding: 24px;
}

.login-box {
    width: min(420px, 100%);

    background: white;

    border-radius: 24px;

    padding: 32px;

    box-shadow:
        0 18px 45px rgba(54, 72, 45, 0.12);
}

.login-box h1 {
    margin-bottom: 6px;
}

.login-box .btn {
    margin-top: 24px;
}

/* =========================
   NOTICES
========================= */

.notice {
    padding: 12px 14px;
    border-radius: 12px;
    margin-bottom: 18px;
}

.notice-success {
    background: #e8f3e3;
    color: #2f5d22;
}

.notice-error {
    background: #f8dddd;
    color: #8b2e2e;
}

/* =========================
   UTILITIES
========================= */

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
}

.mb-0 {
    margin-bottom: 0;
}

.mt-24 {
    margin-top: 24px;
}

/* =========================
   RESPONSIVE
========================= */

@media (max-width: 900px) {

    .form-grid {
        grid-template-columns: 1fr;
    }

    .flex-between {
        display: block;
    }

    .flex-between > * + * {
        margin-top: 16px;
    }
}

@media (max-width: 760px) {

    .admin-header {
        display: block;
    }

    .admin-nav {
        margin-top: 14px;
    }

    .admin-main {
        width: min(100% - 20px);
        margin: 20px auto;
    }

    .box {
        padding: 20px;
    }

    th,
    td {
        padding: 12px 8px;
    }
}

.actions .btn {
    min-height: 34px;
    padding: 0 14px;

    font-size: 14px;
    font-weight: 600;

    border-radius: 10px;
}

.current-image-preview {
    margin-top: 16px;
}

.current-image-preview img {
    width: 220px;
    border-radius: 16px;
    display: block;
}

.existing-attachments {
    margin-top: 18px;
    padding: 18px;
    border-radius: 18px;
    background: #f8faf7;
    border: 1px solid rgba(38, 51, 38, 0.08);
}

.existing-attachments-title {
    font-weight: 700;
    margin-bottom: 12px;
}

.existing-attachment-list {
    display: grid;
    gap: 10px;
}

.existing-attachment-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;

    padding: 12px 14px;
    border-radius: 14px;
    background: white;
}

.existing-attachment-file {
    display: flex;
    align-items: center;
    gap: 10px;
}

.attachment-remove-btn {
    border: 0;
    border-radius: 999px;
    padding: 7px 12px;
    cursor: pointer;

    background: #fee2e2;
    color: #991b1b;

    font-weight: 700;
}

.existing-attachment-item.is-marked-for-delete {
    opacity: .55;
}

.existing-attachment-item.is-marked-for-delete .text-link {
    text-decoration: line-through;
}

.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;

    padding: 10px;
    border: 1px solid rgba(38, 51, 38, 0.12);
    border-radius: 16px 16px 0 0;
    background: #f8faf7;
}

.editor-toolbar-group {
    display: flex;
    gap: 6px;
    align-items: center;
}

.editor-btn,
.editor-color {
    width: 36px;
    height: 36px;

    border: 1px solid rgba(38, 51, 38, 0.12);
    border-radius: 10px;

    background: white;
    color: #263326;

    cursor: pointer;
    font-weight: 800;
}

.editor-btn:hover,
.editor-color:hover {
    background: #eef6e8;
}

.editor-btn-text {
    width: auto;
    padding: 0 12px;
    font-size: 13px;
    font-weight: 600;
}

.editor-color {
    border-radius: 999px;
    position: relative;
}

.editor-color::before {
    content: "";
    width: 18px;
    height: 18px;
    border-radius: 999px;
    background: var(--editor-color);
    display: block;
    margin: auto;
}

.editor-area {
    min-height: 260px;
    padding: 18px;
    border: 1px solid rgba(38, 51, 38, 0.12);
    border-top: 0;
    border-radius: 0 0 16px 16px;
    background: white;
    line-height: 1.7;
}

.publish-card {
    margin-top: 24px;
    padding: 18px;
    border-radius: 18px;
    background: #f8faf7;
    border: 1px solid rgba(38, 51, 38, 0.08);
}

.publish-toggle {
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
}

.publish-toggle input {
    display: none;
}

.publish-toggle-switch {
    width: 52px;
    height: 30px;
    border-radius: 999px;
    background: #d1d5db;
    position: relative;
    flex-shrink: 0;
}

.publish-toggle-switch::before {
    content: "";
    width: 24px;
    height: 24px;
    border-radius: 999px;
    background: white;

    position: absolute;
    top: 3px;
    left: 3px;

    transition: transform .2s ease;
}

.publish-toggle input:checked + .publish-toggle-switch {
    background: #7bb661;
}

.publish-toggle input:checked + .publish-toggle-switch::before {
    transform: translateX(22px);
}

.publish-toggle small {
    display: block;
    color: #6c7769;
    margin-top: 4px;
}

form .actions {
    margin-top: 28px;
}

table .actions {
    margin-top: 0;
    align-items: center;
}

.editor-btn {
    font-weight: 600;
}

table .btn {
    min-height: 32px;
    padding: 0 11px;

    font-size: 13px;
    font-weight: 600;
}

.newsletter-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;

    min-height: 34px;

    padding: 8px 12px;

    border-radius: 999px;

    font-size: 13px;
    font-weight: 700;

    white-space: nowrap;
}

.newsletter-status-sent {
    background: #ecfdf3;
    color: #166534;
}

.newsletter-status-pending {
    background: #fff7ed;
    color: #b45309;
}

.newsletter-status-date {
    margin-top: 6px;

    font-size: 12px;

    color: #6b7280;

    text-align: center;
}

.contact-admin-card {
    margin: 22px 0;
    padding: 24px;
    border-radius: 22px;
    background: #fbfaf6;
    border: 1px solid rgba(38, 51, 38, 0.08);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.55);
}

.contact-admin-subcard {
    margin: 18px 0;
    padding: 22px;
    border-radius: 18px;
    background: #ffffff;
    border: 1px solid rgba(38, 51, 38, 0.08);
}

.contact-location-admin {
    background: #f8faf7;
}

.classes-list {
    display: grid;
    gap: 16px;
    margin: 16px 0;
}

.people-group {
    margin: 18px 0;
    padding: 16px;
    border-radius: 16px;
    background: #f8faf7;
    border: 1px solid rgba(38, 51, 38, 0.08);
}

.people-group strong {
    display: block;
    margin-bottom: 12px;
    font-size: 15px;
}

.people-list {
    display: grid;
    gap: 10px;
    margin-bottom: 12px;
}

.person-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: center;
}

.person-row input {
    min-height: 40px;
}

.person-row .btn {
    min-height: 40px;
    white-space: nowrap;
}

.contact-admin-card > .btn-danger,
.contact-admin-subcard > .btn-danger {
    margin-top: 12px;
}

.contact-admin-card h3,
.contact-admin-subcard h3 {
    margin-top: 10px;
}

@media (max-width: 760px) {
    .person-row {
        grid-template-columns: 1fr;
    }

    .person-row .btn {
        width: 100%;
    }
}