:root {
    --saffron: #e87722;
    --saffron-deep: #c45c12;
    --saffron-soft: #fff6eb;
    --green: #1f7a4d;
    --navy: #1e2a44;
    --ink: #1b2430;
    --muted: #5c6773;
    --line: #eadfd0;
    --paper: #fff8f0;
    --white: #fff;
    --shadow: 0 10px 28px rgba(27, 36, 48, .07);
    --side: 272px;
    --font: "Source Sans 3", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body.admin-body {
    font-family: var(--font);
    background:
        radial-gradient(circle at top right, rgba(232, 119, 34, .08), transparent 28%),
        var(--paper);
    color: var(--ink);
    min-height: 100vh;
}

a { color: var(--saffron-deep); }

.admin-shell {
    display: grid;
    grid-template-columns: var(--side) 1fr;
    min-height: 100vh;
}

.admin-side {
    background: linear-gradient(180deg, #162033, var(--navy));
    color: #fff;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: auto;
}

.side-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 20px 18px 16px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    text-decoration: none;
    color: inherit;
    text-align: center;
}

.side-brand img {
    width: auto;
    height: 52px;
    max-width: 100%;
    background: #fff;
    border-radius: 10px;
    object-fit: contain;
    padding: 6px 10px;
}

.side-brand span {
    display: block;
    color: #f3d4b0;
    font-size: .72rem;
    letter-spacing: .12em;
    text-transform: uppercase;
    font-weight: 700;
}

.nav-group {
    padding: 14px 12px 4px;
}

.nav-group p {
    margin: 0 10px 8px;
    color: #9aa6b5;
    font-size: .7rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    font-weight: 700;
}

.admin-side a.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #d7dee8;
    text-decoration: none;
    padding: 9px 12px;
    margin-bottom: 2px;
    border-radius: 10px;
    font-size: .92rem;
}

.admin-side a.nav-link i {
    width: 18px;
    text-align: center;
    color: #f3d4b0;
}

.admin-side a.nav-link:hover,
.admin-side a.nav-link.active {
    background: var(--saffron);
    color: #fff;
}

.admin-side a.nav-link:hover i,
.admin-side a.nav-link.active i { color: #fff; }

.nav-count {
    margin-left: auto;
    background: rgba(255,255,255,.16);
    color: #fff;
    border-radius: 999px;
    padding: 1px 7px;
    font-size: .72rem;
    font-weight: 700;
}

.admin-side a.nav-link.active .nav-count {
    background: rgba(0,0,0,.18);
}

.side-foot {
    margin-top: auto;
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,.08);
}

.admin-main {
    min-width: 0;
    padding: 0 28px 48px;
}

.admin-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 22px 0 18px;
    position: sticky;
    top: 0;
    background: color-mix(in srgb, var(--paper) 88%, white);
    z-index: 5;
}

.admin-topbar h2 {
    margin: 0;
    font-size: 1.45rem;
}

.admin-topbar p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: .9rem;
}

.menu-toggle {
    display: none;
    border: 0;
    background: var(--navy);
    color: #fff;
    border-radius: 10px;
    padding: 8px 12px;
    cursor: pointer;
}

.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 18px;
}

.stat {
    display: block;
    background: var(--white);
    padding: 18px;
    border-radius: 16px;
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    text-decoration: none;
    color: inherit;
}

.stat b {
    display: block;
    font-size: 1.8rem;
    color: var(--saffron-deep);
    line-height: 1.1;
}

.stat span { color: var(--muted); font-size: .9rem; }

.card {
    background: var(--white);
    padding: 20px;
    border-radius: 16px;
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}

.card h3 {
    margin: 0 0 14px;
    font-size: 1.05rem;
}

.card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.card-head h3 { margin: 0; }

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.row .full { grid-column: 1 / -1; }

table.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
}

.table-card {
    padding: 0;
    overflow: auto;
}

.table-card .admin-table { margin: 0; }

.admin-table th,
.admin-table td {
    border-bottom: 1px solid var(--line);
    padding: 12px 14px;
    text-align: left;
    font-size: .92rem;
    vertical-align: top;
}

.admin-table th {
    background: var(--saffron-soft);
    color: var(--saffron-deep);
    font-weight: 700;
}

.admin-table tr:last-child td { border-bottom: 0; }
.admin-table tr:hover td { background: #fffaf3; }

.thumb {
    height: 52px;
    width: 78px;
    object-fit: cover;
    border-radius: 8px;
    background: #f4eee6;
}

.row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.row-actions form { display: inline; }

label { display: block; font-weight: 700; margin: 10px 0 6px; font-size: .88rem; }

input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
select,
textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    font: inherit;
    background: #fff;
}

input[type="file"] { width: 100%; }

input:focus, select:focus, textarea:focus {
    outline: 2px solid rgba(232, 119, 34, .28);
    border-color: var(--saffron);
}

textarea { min-height: 140px; }

.check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.check input { width: auto; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: var(--saffron);
    color: #fff;
    border: 0;
    padding: 9px 14px;
    text-decoration: none;
    cursor: pointer;
    border-radius: 999px;
    font: inherit;
    font-size: .88rem;
    font-weight: 700;
}

.btn:hover { background: var(--saffron-deep); }
.btn.gray { background: #607389; }
.btn.gray:hover { background: #4d5e70; }
.btn.red { background: #b42318; }
.btn.ghost {
    background: transparent;
    color: var(--saffron-deep);
    border: 1px solid var(--line);
}

.form-actions,
form.card > p:last-child {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 18px 0 0;
}

.flash {
    background: #e9f7ef;
    color: #146c2e;
    padding: 12px 14px;
    margin-bottom: 14px;
    border-radius: 12px;
    border: 1px solid #b7e0c5;
}

.flash.error {
    background: #fdecea;
    color: #8a1f11;
    border-color: #f3c0b8;
}

.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 700;
    text-transform: capitalize;
}

.badge-yes, .badge-published, .badge-confirmed { background: #e9f7ef; color: #146c2e; }
.badge-no, .badge-rejected, .badge-cancelled { background: #fdecea; color: #8a1f11; }
.badge-pending { background: #fff6e5; color: #7a3e00; }

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 14px;
}

.tabs a {
    text-decoration: none;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 7px 12px;
    font-size: .86rem;
    font-weight: 700;
}

.tabs a.active,
.tabs a:hover {
    background: var(--saffron);
    border-color: var(--saffron);
    color: #fff;
}

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

.status-form {
    display: flex;
    gap: 8px;
    align-items: center;
}

.status-form select { width: auto; min-width: 120px; }

.login-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        linear-gradient(160deg, rgba(196, 92, 18, .9), rgba(30, 42, 68, .92)),
        url("../images/bg.jpg") center/cover;
}

.login-card {
    width: min(420px, 92vw);
    background: #fffdf9;
    padding: 28px;
    border-radius: 18px;
    box-shadow: 0 20px 50px rgba(0,0,0,.18);
    border-top: 6px solid var(--saffron);
}

.login-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
    margin-bottom: 20px;
}

.login-brand img {
    width: auto;
    height: 72px;
    max-width: 100%;
    object-fit: contain;
    background: #fff;
    padding: 8px 12px;
    border-radius: 8px;
}

.login-card h1 {
    margin: 0;
    color: var(--navy);
    font-size: 1.25rem;
}

.login-card .lede { margin: 0 0 16px; color: var(--muted); }

.login-card .btn { width: 100%; margin-top: 8px; }
.login-card .btn.gray { width: 100%; }

.tox-tinymce {
    border-radius: 10px !important;
    border-color: var(--line) !important;
}

.tox .tox-toolbar,
.tox .tox-menubar,
.tox .tox-statusbar {
    background: #fffaf3 !important;
}

@media (max-width: 980px) {
    .admin-shell { grid-template-columns: 1fr; }
    .admin-side {
        position: fixed;
        inset: 0 auto 0 0;
        width: min(var(--side), 86vw);
        z-index: 30;
        transform: translateX(-105%);
        transition: transform .2s ease;
    }
    body.nav-open .admin-side { transform: none; }
    .menu-toggle { display: inline-flex; }
    .stats, .row { grid-template-columns: 1fr; }
    .admin-main { padding: 0 16px 40px; }
}
