/* ============================================================
   Cafe Codex — Admin Stylesheet
   ============================================================ */
:root {
    --a-bg: #f4f1ec;
    --a-panel: #ffffff;
    --a-ink: #241b15;
    --a-muted: #8a7a6c;
    --a-line: #e7e1d8;
    --a-espresso: #1a1410;
    --a-caramel: #b07d4a;
    --a-gold: #c9a16b;
    --a-sidebar: #1a1410;
    --radius: 10px;
    --a-ease: cubic-bezier(.22, 1, .36, 1);
    --font: "Jost", "Segoe UI", system-ui, sans-serif;
    --display: "Cormorant Garamond", Georgia, serif;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: var(--font); background: var(--a-bg); color: var(--a-ink); font-weight: 300; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
h1,h2,h3,h4 { font-family: var(--display); font-weight: 500; margin: 0; }

.admin-shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.sidebar { background: var(--a-sidebar); color: #f6f1e9; padding: 1.8rem 1.3rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar__brand { font-family: var(--display); font-size: 1.5rem; margin-bottom: .3rem; }
.sidebar__role { font-size: .68rem; letter-spacing: .2em; text-transform: uppercase; color: var(--a-gold); margin-bottom: 2rem; }
.sidebar__nav { display: flex; flex-direction: column; gap: .15rem; }
.sidebar__nav a { display: flex; align-items: center; gap: .7rem; padding: .72rem .9rem; border-radius: 8px; font-size: .92rem; color: rgba(246,241,233,.72); transition: all .3s; }
.sidebar__nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar__nav a.is-active { background: var(--a-caramel); color: #fff; }
.sidebar__nav a i { width: 18px; text-align: center; font-style: normal; }
.sidebar__foot { margin-top: 2rem; padding-top: 1.2rem; border-top: 1px solid rgba(255,255,255,.12); font-size: .82rem; }
.sidebar__foot a { color: rgba(246,241,233,.6); }
.sidebar__foot a:hover { color: #fff; }

.sidebar__close { display: none; position: absolute; top: .9rem; right: 1rem; width: 34px; height: 34px; border-radius: 8px; background: rgba(255,255,255,.08); color: #f6f1e9; font-size: 1.3rem; line-height: 1; }
.sidebar__close:hover { background: var(--a-caramel); color: #fff; }
.sidebar-backdrop { position: fixed; inset: 0; background: rgba(20,15,12,.55); opacity: 0; visibility: hidden; transition: opacity .4s; z-index: 55; }
.sidebar-backdrop.is-open { opacity: 1; visibility: visible; }
body.no-scroll { overflow: hidden; }

.main { min-width: 0; }
.topbar { background: var(--a-panel); border-bottom: 1px solid var(--a-line); padding: 1rem 1.8rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; position: sticky; top: 0; z-index: 20; }
.topbar h1 { font-size: 1.5rem; }
.topbar__right { display: flex; align-items: center; gap: 1rem; font-size: .9rem; }
.content { padding: 1.8rem; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.4rem; flex-wrap: wrap; }
.page-head p { margin: .2rem 0 0; color: var(--a-muted); }

.cards-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.1rem; }
.stat-card { background: var(--a-panel); border: 1px solid var(--a-line); border-radius: var(--radius); padding: 1.4rem; }
.stat-card span { font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--a-muted); }
.stat-card b { font-family: var(--display); font-size: 2.6rem; display: block; line-height: 1.1; margin-top: .4rem; }
.stat-card em { font-style: normal; color: var(--a-caramel); font-size: .82rem; }

.panel { background: var(--a-panel); border: 1px solid var(--a-line); border-radius: var(--radius); padding: 1.5rem; margin-top: 1.4rem; }
.panel--flush { padding: 0; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.panel__head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.1rem; flex-wrap: wrap; }
.panel__head h2 { font-size: 1.35rem; }

.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { padding: .85rem 1rem; text-align: left; border-bottom: 1px solid var(--a-line); vertical-align: middle; }
.table th { font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--a-muted); }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: #faf7f2; }
.table img.thumb { width: 46px; height: 46px; border-radius: 8px; object-fit: cover; }

.btn { display: inline-flex; align-items: center; gap: .45rem; padding: .6rem 1.1rem; border-radius: 8px; border: 1px solid transparent; font-size: .82rem; font-weight: 400; cursor: pointer; transition: all .25s; }
.btn--primary { background: var(--a-espresso); color: #fff; }
.btn--primary:hover { background: var(--a-caramel); }
.btn--ghost { border-color: var(--a-line); background: #fff; }
.btn--ghost:hover { border-color: var(--a-caramel); color: var(--a-caramel); }
.btn--danger { background: #fbeae7; color: #a8422f; }
.btn--danger:hover { background: #a8422f; color: #fff; }
.btn--sm { padding: .38rem .7rem; font-size: .76rem; }

.badge { display: inline-block; padding: .25rem .65rem; border-radius: 999px; font-size: .66rem; letter-spacing: .08em; text-transform: uppercase; font-weight: 500; }
.badge--pending { background: #f3e2c7; color: #8a5a1b; }
.badge--confirmed { background: #d6ecdd; color: #2c6b43; }
.badge--cancelled { background: #f3d6d1; color: #8f3222; }
.badge--completed { background: #d7e3f3; color: #2b4f80; }
.badge--new { background: #f3d6d1; color: #8f3222; }
.badge--read { background: #e6e1d8; color: #6b6259; }
.badge--archived { background: #ececec; color: #777; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot--on { background: #3f7d54; } .dot--off { background: #c0b8ae; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; }
.form-grid .full { grid-column: 1 / -1; }
label { display: block; font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--a-muted); margin-bottom: .4rem; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time], input[type=search], input[type=url], select, textarea {
    width: 100%; padding: .72rem .9rem; border: 1px solid var(--a-line); border-radius: 8px; background: #fff; font-family: var(--font); font-size: .92rem; color: var(--a-ink);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--a-caramel); box-shadow: 0 0 0 3px rgba(176,125,74,.12); }
textarea { min-height: 110px; resize: vertical; }
.check { display: flex; align-items: center; gap: .5rem; }
.check input { width: auto; }
.check label { margin: 0; text-transform: none; letter-spacing: 0; font-size: .9rem; color: var(--a-ink); }

.flash { padding: .8rem 1.1rem; border-radius: 8px; margin-bottom: 1rem; font-size: .9rem; }
.flash--success { background: #d6ecdd; color: #245c39; }
.flash--error { background: #f3d6d1; color: #8f3222; }
.flash--info { background: #e6e1d8; color: #6b6259; }

.filters { display: flex; gap: .7rem; flex-wrap: wrap; align-items: flex-end; }
.filters .fld { min-width: 150px; }

.login-wrap { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(circle at 30% 20%, #2a1f18, #14100d); padding: 1.5rem; }
.login { width: min(430px, 100%); background: #fff; border-radius: 16px; padding: 2.4rem; box-shadow: 0 40px 80px -30px rgba(0,0,0,.6); }
.login h1 { font-size: 2rem; margin-bottom: .3rem; }
.login p.sub { color: var(--a-muted); margin: 0 0 1.6rem; font-size: .92rem; }
.login .field { margin-bottom: 1rem; }
.login .btn { width: 100%; justify-content: center; padding: .85rem; }
.login .hint { margin-top: 1.2rem; font-size: .8rem; color: var(--a-muted); text-align: center; }

.chart { display: flex; align-items: flex-end; gap: .8rem; height: 190px; padding-top: 1rem; }
.chart .bar { flex: 1; background: linear-gradient(180deg, var(--a-caramel), #d9b586); border-radius: 6px 6px 0 0; position: relative; min-height: 4px; }
.chart .bar span { position: absolute; bottom: -1.5rem; left: 0; right: 0; text-align: center; font-size: .68rem; color: var(--a-muted); }
.chart .bar b { position: absolute; top: -.1rem; left: 0; right: 0; text-align: center; font-size: .72rem; transform: translateY(-100%); }

.modal { position: fixed; inset: 0; background: rgba(20,15,12,.6); display: none; place-items: center; padding: 1.5rem; z-index: 100; }
.modal.is-open { display: grid; }
.modal__box { background: #fff; border-radius: 12px; width: min(720px, 100%); max-height: 90vh; overflow-y: auto; padding: 1.8rem; }

.actions { display: flex; gap: .35rem; }
.muted { color: var(--a-muted); }
.text-right { text-align: right; }

/* ============================================================
   Dashboard enhancements
   ============================================================ */
.dash-welcome {
    display: flex; align-items: center; justify-content: space-between;
    gap: 1.2rem; flex-wrap: wrap;
    background: linear-gradient(120deg, #1a1410 0%, #2c211a 100%);
    color: #f6f1e9; border-radius: var(--radius); padding: 1.6rem 1.8rem; margin-bottom: 1.4rem;
}
.dash-welcome h2 { font-size: 1.9rem; }
.dash-welcome p { margin: .35rem 0 0; color: rgba(246,241,233,.65); font-size: .9rem; }
.dash-welcome .quick-actions { display: flex; gap: .6rem; flex-wrap: wrap; }
.dash-welcome .btn--primary { background: var(--a-caramel); }
.dash-welcome .btn--primary:hover { background: var(--a-gold); }
.dash-welcome .btn--ghost { background: transparent; border-color: rgba(246,241,233,.3); color: #f6f1e9; }
.dash-welcome .btn--ghost:hover { border-color: var(--a-gold); color: var(--a-gold); }

.stat-card__top { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.stat-card .ic, .mini-card .ic {
    font-style: normal; width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
    display: grid; place-items: center; background: #f3ede4; color: var(--a-caramel); font-size: 1rem;
}

.mini-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.1rem; margin-top: 1.4rem; }
.mini-card { display: flex; align-items: center; gap: .9rem; background: var(--a-panel); border: 1px solid var(--a-line); border-radius: var(--radius); padding: 1rem 1.15rem; }
.mini-card b { font-family: var(--display); font-size: 1.7rem; display: block; line-height: 1; }
.mini-card span { font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--a-muted); }

.dash-cols { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1.4rem; align-items: start; }
.dash-cols--rev { grid-template-columns: 1fr 1.4fr; }

.list { display: flex; flex-direction: column; }
.list__item { display: flex; align-items: center; gap: .9rem; padding: .85rem 0; border-bottom: 1px dashed var(--a-line); }
.list__item:last-child { border-bottom: none; }
.list__item .who { flex: 1; min-width: 0; }
.list__item .who strong { display: block; font-weight: 500; font-size: .95rem; }
.list__item .who span { font-size: .8rem; color: var(--a-muted); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.date-badge { width: 48px; flex-shrink: 0; text-align: center; background: #f3ede4; color: #8a5a1b; border-radius: 10px; padding: .35rem 0; line-height: 1.15; }
.date-badge b { font-family: var(--display); font-size: 1.15rem; display: block; }
.date-badge span { font-size: .58rem; letter-spacing: .1em; text-transform: uppercase; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--a-espresso); color: #fff; display: grid; place-items: center; font-size: .9rem; flex-shrink: 0; }
.empty-hint { color: var(--a-muted); font-size: .88rem; padding: .4rem 0 0; }

.featured-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; padding: 0 1.5rem 1.5rem; }
.featured-card { display: block; border: 1px solid var(--a-line); border-radius: 10px; overflow: hidden; background: #fff; transition: transform .25s, box-shadow .25s; }
.featured-card:hover { transform: translateY(-3px); box-shadow: 0 16px 30px -18px rgba(0,0,0,.4); }
.featured-card img { width: 100%; height: 118px; object-fit: cover; }
.featured-card .fc-body { padding: .75rem .85rem; }
.featured-card .fc-body strong { display: block; font-weight: 500; font-size: .95rem; }
.featured-card .fc-body span { font-size: .78rem; color: var(--a-muted); }

@media (max-width: 1100px) {
    .mini-grid { grid-template-columns: repeat(2, 1fr); }
    .featured-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
    .admin-shell { grid-template-columns: 1fr; }
    .cards-grid { grid-template-columns: 1fr 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .menu-toggle { display: inline-flex!important; }
    .dash-cols, .dash-cols--rev { grid-template-columns: 1fr; }

    /* ---------- Modern left drawer ---------- */
    .sidebar {
        position: fixed; left: 0; top: 0; z-index: 60;
        width: min(300px, 82vw);
        padding: 1.7rem 1.15rem 2rem;
        background: linear-gradient(180deg, #241b15 0%, #17110d 100%);
        border-radius: 0 22px 22px 0;
        box-shadow: 26px 0 70px -20px rgba(0,0,0,.85);
        transform: translateX(-105%);
        transition: transform .45s cubic-bezier(.22,1,.36,1);
    }
    .sidebar.is-open { transform: none; }
    .sidebar::before {
        content: ""; position: absolute; inset: 0 0 auto 0; height: 170px; pointer-events: none;
        background: radial-gradient(circle at 22% 0%, rgba(201,161,107,.25), transparent 70%);
        border-radius: 0 22px 0 0;
    }
    .sidebar__brand { font-size: 1.7rem; position: relative; }
    .sidebar__role {
        display: inline-block; position: relative; font-size: .62rem; padding: .32rem .7rem;
        border: 1px solid rgba(201,161,107,.45); border-radius: 999px; margin-bottom: 1.4rem;
    }
    .sidebar__close {
        display: grid; place-items: center; position: absolute; top: 1rem; right: 1rem;
        width: 38px; height: 38px; border-radius: 12px; font-size: 1.5rem;
        background: rgba(255,255,255,.08); transition: background .3s, transform .3s;
    }
    .sidebar__close:active { transform: scale(.92); }

    .sidebar__nav { gap: .4rem; position: relative; }
    .sidebar__nav a {
        position: relative; gap: .85rem; padding: .7rem .8rem; border-radius: 14px;
        font-size: .98rem; color: rgba(246,241,233,.82); overflow: hidden;
        opacity: 0; transform: translateX(-18px);
        transition: opacity .5s var(--a-ease), transform .5s var(--a-ease),
                    background .3s var(--a-ease), color .3s var(--a-ease);
    }
    .sidebar.is-open .sidebar__nav a { opacity: 1; transform: none; }
    .sidebar.is-open .sidebar__nav a:nth-child(1) { transition-delay: .10s; }
    .sidebar.is-open .sidebar__nav a:nth-child(2) { transition-delay: .16s; }
    .sidebar.is-open .sidebar__nav a:nth-child(3) { transition-delay: .22s; }
    .sidebar.is-open .sidebar__nav a:nth-child(4) { transition-delay: .28s; }
    .sidebar.is-open .sidebar__nav a:nth-child(5) { transition-delay: .34s; }
    .sidebar.is-open .sidebar__nav a:nth-child(6) { transition-delay: .40s; }
    .sidebar__nav a i {
        width: 36px; height: 36px; border-radius: 11px; flex-shrink: 0;
        display: grid; place-items: center; background: rgba(255,255,255,.06);
        font-size: 1rem; font-style: normal; transition: background .3s;
    }
    .sidebar__nav a:hover { background: rgba(255,255,255,.05); color: #fff; }
    .sidebar__nav a:hover i { background: rgba(255,255,255,.12); }
    .sidebar__nav a.is-active {
        color: #fff; background: linear-gradient(120deg, var(--a-caramel), #c98f4f);
        box-shadow: 0 12px 26px -14px rgba(176,125,74,.95);
    }
    .sidebar__nav a.is-active i { background: rgba(255,255,255,.2); }

    .sidebar__foot { position: relative; margin-top: 1.6rem; }
}
@media (max-width: 560px) {
    .cards-grid, .mini-grid, .featured-grid { grid-template-columns: 1fr; }
    .dash-welcome { padding: 1.3rem; }
    .dash-welcome h2 { font-size: 1.5rem; }
    .dash-welcome .quick-actions { width: 100%; }
    .dash-welcome .quick-actions .btn { flex: 1; justify-content: center; }
}
@media (min-width: 901px) { .menu-toggle { display: none!important; } }
