@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Playfair+Display:wght@600;700&display=swap');

:root {
    --bg: #f4f1ec;
    --paper: #fff;
    --ink: #2b2723;
    --muted: #7b736b;
    --line: #ded8d0;
    --accent: #9d4d34;
    --accent-dark: #743522;
    --dark: #28241f;
    --green: #dfead9;
    --red: #f2d9d3;
    --blue: #e2ebf0;
    --shadow: 0 16px 38px rgba(50, 40, 30, .09);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: "DM Sans", Arial, sans-serif;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

.muted {
    color: var(--muted);
}

.eyebrow {
    color: var(--accent);
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .16em;
}

.block {
    display: block;
}

.admin-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 250px 1fr;
}

.admin-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 25px 18px;
    background: var(--dark);
    color: #e6ddd4;
}

.admin-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 0 10px 28px;
}

.admin-brand > span {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-family: "Playfair Display", Georgia, serif;
    font-size: 1.4rem;
}

.admin-brand strong {
    display: grid;
    font-family: "Playfair Display", Georgia, serif;
    line-height: 1;
}

.admin-brand small {
    margin-top: 5px;
    color: #9f968d;
    font-family: "DM Sans", Arial, sans-serif;
    font-size: .65rem;
}

.admin-sidebar nav {
    display: grid;
    gap: 5px;
}

.admin-sidebar nav a {
    border-radius: 9px;
    padding: 11px 12px;
    color: #cfc6bc;
    font-size: .86rem;
}

.admin-sidebar nav a:hover,
.admin-sidebar nav a.active {
    background: #3b352f;
    color: #fff;
}

.admin-sidebar-bottom {
    display: grid;
    margin-top: auto;
    border-top: 1px solid #49423b;
    padding-top: 15px;
}

.admin-sidebar-bottom a {
    padding: 8px 10px;
    color: #aea59b;
    font-size: .78rem;
}

.admin-main {
    min-width: 0;
}

.admin-topbar {
    height: 68px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    border-bottom: 1px solid var(--line);
    padding: 0 30px;
    background: #fff;
    font-size: .8rem;
}

.admin-menu-toggle {
    display: none;
}

.admin-content {
    max-width: 1500px;
    padding: 32px;
}

.admin-page-head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    margin-bottom: 24px;
}

.admin-page-head h1 {
    margin: 5px 0 0;
    font-family: "Playfair Display", Georgia, serif;
    font-size: 2.3rem;
}

.admin-alert {
    margin-bottom: 18px;
    border-radius: 10px;
    padding: 13px 15px;
    font-size: .85rem;
}

.admin-alert-success {
    background: var(--green);
    color: #40593a;
}

.admin-alert-error {
    background: var(--red);
    color: #873a2b;
}

.admin-alert-info {
    background: var(--blue);
    color: #425d69;
}

.admin-panel {
    margin-bottom: 22px;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 22px;
    background: #fff;
    box-shadow: 0 4px 14px rgba(35, 29, 23, .025);
}

.admin-panel h2 {
    margin: 0;
    font-family: "Playfair Display", Georgia, serif;
    font-size: 1.35rem;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 20px;
}

.panel-head > div {
    display: flex;
    align-items: center;
    gap: 10px;
}

.panel-head a {
    color: var(--accent);
    font-size: .78rem;
    font-weight: 700;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 22px;
}

.stat-card {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 3px 13px;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 20px;
    background: #fff;
}

.stat-card > span {
    grid-row: span 3;
    font-size: 1.7rem;
}

.stat-card small {
    color: var(--muted);
}

.stat-card strong {
    font-family: "Playfair Display", Georgia, serif;
    font-size: 2rem;
}

.stat-card em {
    color: var(--muted);
    font-size: .72rem;
    font-style: normal;
}

.admin-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 22px;
}

.quick-actions {
    display: grid;
    gap: 10px;
}

.quick-actions a {
    display: grid;
    grid-template-columns: 40px 1fr;
    gap: 1px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 13px;
}

.quick-actions a > span {
    grid-row: span 2;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #f1e4dc;
    color: var(--accent);
}

.quick-actions small {
    color: var(--muted);
}

.admin-list > a {
    display: grid;
    grid-template-columns: 48px 1fr auto;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--line);
    padding: 10px 0;
}

.admin-list img {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    object-fit: cover;
}

.admin-list small {
    display: block;
    color: var(--muted);
}

.status {
    display: inline-flex;
    border-radius: 999px;
    padding: 5px 9px;
    font-size: .67rem;
    font-weight: 700;
}

.status-published {
    background: var(--green);
    color: #47603f;
}

.status-draft {
    background: #eee9e3;
    color: #746b63;
}

.admin-tip {
    display: flex;
    gap: 15px;
}

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 16px;
}

.toolbar-search {
    width: min(360px, 100%);
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 11px;
    outline: none;
    background: #fff;
    color: var(--ink);
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(157, 77, 52, .1);
}

textarea {
    resize: vertical;
}

.admin-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: .78rem;
    font-weight: 700;
}

.admin-btn-primary {
    background: var(--accent);
    color: #fff;
}

.admin-btn-primary:hover {
    background: var(--accent-dark);
}

.admin-btn-light {
    border-color: var(--line);
    background: #fff;
    color: var(--ink);
}

.admin-btn-danger {
    background: #9a3f2c;
    color: #fff;
}

.admin-btn-block {
    width: 100%;
    margin-top: 9px;
}

.admin-table-wrap {
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .8rem;
}

.admin-table th {
    border-bottom: 1px solid var(--line);
    padding: 13px;
    background: #faf8f5;
    color: var(--muted);
    text-align: left;
    white-space: nowrap;
}

.admin-table td {
    border-bottom: 1px solid var(--line);
    padding: 13px;
    vertical-align: middle;
}

.table-title {
    min-width: 260px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.table-title img {
    width: 58px;
    height: 50px;
    border-radius: 8px;
    object-fit: cover;
}

.table-title small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
}

.actions {
    white-space: nowrap;
}

.actions > a,
.actions button {
    margin-right: 8px;
    border: 0;
    padding: 0;
    background: none;
    color: var(--accent);
    font-size: .72rem;
    font-weight: 700;
}

.actions form {
    display: inline;
}

.editor-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 310px;
    align-items: start;
    gap: 22px;
}

.editor-side {
    position: sticky;
    top: 20px;
}

.form-section label,
.publish-box label,
.login-card label {
    display: block;
    margin-bottom: 15px;
}

.form-section label > span,
.publish-box label > span,
.login-card label > span {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: .72rem;
    font-weight: 700;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.form-grid-3,
.rating-input-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

.section-number {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #f1e4dc;
    color: var(--accent);
    font-size: .7rem;
    font-weight: 700;
}

.form-help {
    border-radius: 8px;
    padding: 10px;
    background: #faf7f2;
    color: var(--muted);
    font-size: .78rem;
}

.form-help code {
    color: var(--accent);
}

.repeat-card {
    margin-bottom: 13px;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 15px;
    background: #fcfbf9;
}

.repeat-head {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 12px;
}

.repeat-head button {
    border: 0;
    background: none;
    color: #9b4937;
    font-size: .72rem;
}

.compact-repeat {
    padding-bottom: 3px;
}

.checkbox-line {
    display: flex !important;
    align-items: center;
    gap: 8px;
}

.checkbox-line input {
    width: auto;
}

.image-preview {
    width: 100%;
    aspect-ratio: 4 / 3;
    margin: 14px 0;
    border-radius: 9px;
    background: #eee;
    object-fit: cover;
}

.file-label {
    display: block;
    border: 1px dashed #baa99a;
    border-radius: 8px;
    padding: 12px;
    text-align: center;
    cursor: pointer;
}

.file-label input {
    margin-top: 8px;
    font-size: .7rem;
}

.publish-box {
    border-top: 4px solid var(--accent);
}

.narrow-panel {
    max-width: 650px;
}

.tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 18px;
}

.tabs a {
    border-radius: 8px;
    padding: 10px 16px;
    background: #e9e4de;
    font-size: .8rem;
    font-weight: 700;
}

.tabs a.active {
    background: var(--dark);
    color: #fff;
}

.taxonomy-layout {
    align-items: start;
}

.taxonomy-list > div {
    display: grid;
    grid-template-columns: 40px 1fr auto auto;
    align-items: center;
    gap: 9px;
    border-bottom: 1px solid var(--line);
    padding: 11px 0;
}

.taxonomy-icon {
    font-size: 1.5rem;
}

.taxonomy-list small {
    display: block;
    color: var(--muted);
}

.taxonomy-list button {
    border: 0;
    background: none;
    color: var(--accent);
    font-size: .72rem;
}

.message-list {
    display: grid;
    gap: 15px;
}

.message-card {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 22px;
    background: #fff;
}

.message-card.unread {
    border-left: 5px solid var(--accent);
}

.message-card header {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    font-size: .8rem;
}

.message-card header a {
    display: block;
    color: var(--accent);
}

.message-card h2 {
    font-family: "Playfair Display", Georgia, serif;
    font-size: 1.4rem;
}

.message-card p {
    color: var(--muted);
}

.message-card footer {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    border-top: 1px solid var(--line);
    padding-top: 14px;
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.media-grid article {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
}

.media-grid img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

.media-grid article > div {
    padding: 12px;
}

.media-grid strong,
.media-grid small {
    display: block;
    word-break: break-all;
}

.media-grid small {
    color: var(--muted);
}

.media-grid button {
    border: 0;
    padding: 8px 0;
    background: none;
    color: #9a3f2c;
    font-size: .72rem;
}

.empty-admin {
    padding: 50px;
    color: var(--muted);
    text-align: center;
}

.login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
    background:
        radial-gradient(
            circle at 15% 15%,
            rgba(255, 255, 255, .9),
            transparent 27%
        ),
        linear-gradient(
            135deg,
            #efe3d6,
            #f8f6f2
        );
}

.login-card {
    width: min(430px, 100%);
    border-radius: 18px;
    padding: 36px;
    background: #fff;
    box-shadow: var(--shadow);
}

.login-brand {
    padding: 0 0 30px;
}

.login-card h1 {
    margin: 7px 0;
    font-family: "Playfair Display", Georgia, serif;
    font-size: 2.5rem;
}

.login-card > p {
    margin-bottom: 25px;
    color: var(--muted);
    font-size: .85rem;
}

.back-link {
    display: block;
    margin-top: 20px;
    color: var(--muted);
    font-size: .75rem;
    text-align: center;
}

@media (max-width: 1100px) {
    .stat-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .editor-layout {
        grid-template-columns: 1fr;
    }

    .editor-side {
        position: static;
    }

    .media-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 800px) {
    .admin-shell {
        grid-template-columns: 1fr;
    }

    .admin-sidebar {
        position: fixed;
        z-index: 100;
        left: -270px;
        width: 250px;
        transition: left .2s;
    }

    .admin-sidebar.open {
        left: 0;
    }

    .admin-topbar {
        justify-content: space-between;
    }

    .admin-menu-toggle {
        display: block;
        border: 0;
        background: none;
        font-size: 1.3rem;
    }

    .admin-content {
        padding: 20px;
    }

    .admin-grid-2 {
        grid-template-columns: 1fr;
    }

    .form-grid,
    .form-grid-3,
    .rating-input-grid {
        grid-template-columns: 1fr;
    }

    .media-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 520px) {
    .stat-grid {
        grid-template-columns: 1fr;
    }

    .toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .media-grid {
        grid-template-columns: 1fr;
    }

    .message-card footer {
        flex-direction: column;
    }

    .taxonomy-list > div {
        grid-template-columns: 35px 1fr;
    }

    .taxonomy-list > div > button,
    .taxonomy-list > div > form {
        grid-column: 2;
    }
}