/* =========================================================================
   PAVLOVA — admin panel styles (matches the storefront theme)
   ========================================================================= */
:root {
    /* Variable names kept from the original so every rule re-themes at once. */
    --pink:      #2E463A;   /* primary accent (buttons, active nav) */
    --pink-dark: #22352B;   /* accent hover */
    --green:     #2E463A;   /* brand */
    --gold:      #A8895C;
    --ink:       #221E1A;
    --muted:     #8A8272;
    --bg:        #F1EBDF;   /* app background */
    --card:      #FCFAF4;   /* cards / panels */
    --line:      #E6E0D5;
    --sidebar:   #221E1A;   /* dark ink sidebar */
    --radius:    12px;
    --shadow:    0 10px 34px -18px rgba(42,38,33,.28);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: 'Jost', system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--ink); }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ---- Buttons ----
   Flex-centered with fixed heights so buttons line up with the form
   controls beside them: .btn = 44px (same as inputs/selects),
   .btn-sm = 36px (same as table .inline-input). */
.btn { display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--line); background: #fff; color: var(--ink);
    height: 44px; padding: 0 1rem; border-radius: 8px; font: inherit; font-weight: 700; cursor: pointer;
    transition: background .15s, transform .1s; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--pink); border-color: var(--pink); color: #fff; }
.btn-primary:hover { background: var(--pink-dark); border-color: var(--pink-dark); }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--bg); }
.btn-danger { background: #fff; border-color: #f0c2ce; color: var(--pink-dark); }
.btn-danger:hover { background: #fdeef2; }
.btn-sm { height: 36px; padding: 0 .7rem; font-size: .85rem; }
.btn-block { display: flex; width: 100%; text-align: center; }

/* ---- Login (Pavlova theme) ---- */
.login-body {
    display: grid; place-items: center; min-height: 100vh;
    background:
        radial-gradient(60% 55% at 18% 12%, #E7C1B5 0%, rgba(0,0,0,0) 55%),
        radial-gradient(55% 55% at 88% 90%, #C6D2BB 0%, rgba(0,0,0,0) 55%),
        #F7F2E9;
    font-family: 'Jost', system-ui, sans-serif;
}
.login-wrap { width: min(400px, 92%); }
.login-card {
    background: var(--card); padding: 2.4rem 2.2rem;
    border: 1px solid rgba(42,38,33,0.12); border-radius: 6px; box-shadow: var(--shadow);
}
.login-brand {
    font-family: 'Cormorant Garamond', serif; font-weight: 500; font-size: 1.6rem;
    letter-spacing: 0.22em; color: var(--ink); padding-left: 0.22em;
}
.login-kicker {
    font-size: 9.5px; letter-spacing: 0.3em; text-transform: uppercase; color: var(--gold);
    margin-top: 4px; padding-left: 0.3em;
}
.login-card h1 { font-family: 'Cormorant Garamond', serif; font-weight: 500; font-size: 2rem; margin: 1.4rem 0 .4rem; color: var(--ink); }
.login-sub { color: var(--muted); font-size: .9rem; font-weight: 300; margin: 0 0 1.5rem; }
.login-card label {
    display: block; font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase;
    color: var(--muted); font-weight: 500; margin-bottom: 1rem;
}
.login-card input {
    display: block; width: 100%; margin-top: .5rem; padding: .7rem .85rem;
    border: 1px solid rgba(42,38,33,0.15); border-radius: 3px; font: inherit; font-weight: 400;
    background: #F7F2E9; color: var(--ink); outline: none;
}
.login-card input:focus { border-color: var(--pink); }
.login-card .btn-primary { padding: .8rem; border-radius: 2px; font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; margin-top: .4rem; }
.login-hint { color: var(--muted); font-size: .82rem; text-align: center; margin: 1.1rem 0 0; font-weight: 300; }
.login-card .google-btn {
    display: flex; align-items: center; justify-content: center; gap: 11px;
    width: 100%; padding: .7rem 1rem; background: #fff;
    border: 1px solid rgba(42,38,33,0.18); border-radius: 3px;
    font-size: 13.5px; font-weight: 500; color: var(--ink); letter-spacing: 0.02em;
    transition: border-color .2s ease, box-shadow .2s ease; margin-bottom: 0;
}
.login-card .google-btn:hover { border-color: rgba(42,38,33,0.35); box-shadow: 0 4px 14px -8px rgba(42,38,33,0.4); }
.login-card .google-g { flex: none; }
.login-card .auth-divider {
    display: flex; align-items: center; gap: 14px; margin: 18px 0;
    color: var(--muted); font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase;
}
.login-card .auth-divider::before, .login-card .auth-divider::after {
    content: ""; flex: 1; height: 1px; background: var(--line);
}
.login-foot {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: 1.2rem; padding: 0 .3rem; font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase;
}
.login-lang { display: flex; gap: 7px; align-items: center; }
.login-lang a { color: #9A9284; }
.login-lang a.on { color: var(--pink); font-weight: 500; }
.login-lang a:hover { color: var(--pink); }
.login-lang .sep { color: rgba(42,38,33,0.28); }
.login-back { color: var(--muted); }
.login-back:hover { color: var(--pink); }

/* ---- Shell layout ----
   The shell is locked to the viewport; the sidebar and the content pane
   each scroll independently. */
.admin-shell { display: grid; grid-template-columns: 240px 1fr; height: 100vh; }
.sidebar { background: var(--sidebar); color: #cfd2dc; display: flex; flex-direction: column; padding: 1.4rem 1rem; overflow-y: auto; }
.sidebar-brand { font-family: 'Cormorant Garamond', serif; font-size: 1.4rem; font-weight: 700; color: #fff; padding: .3rem .6rem 1.4rem; }
.sidebar-brand span { color: var(--pink); }
.sidebar-nav { display: flex; flex-direction: column; gap: .25rem; }
.sidebar-nav a { padding: .65rem .8rem; border-radius: 8px; font-weight: 600; color: #b9bdca; }
.sidebar-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar-nav a.active { background: var(--pink); color: #fff; }
.sidebar-sep { border: 0; border-top: 1px solid rgba(255,255,255,.12); margin: .55rem .4rem; }
.sidebar-foot { margin-top: auto; padding: .6rem .8rem; }
.sidebar-foot a { color: #9aa0b0; font-size: .9rem; }
.sidebar-foot a:hover { color: #fff; }

.admin-main { display: flex; flex-direction: column; min-width: 0; overflow-y: auto; }
.admin-topbar { display: flex; align-items: center; justify-content: space-between; padding: 1.1rem 1.8rem; background: #fff; border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 20; }
.admin-topbar h1 { font-family: 'Cormorant Garamond', serif; font-size: 1.7rem; margin: 0; }
.admin-user { display: flex; align-items: center; gap: 1rem; color: var(--muted); font-weight: 600; }
.admin-lang { display: flex; gap: 6px; align-items: center; font-size: 10.5px; letter-spacing: 0.1em; }
.admin-lang a { color: #9A9284; }
.admin-lang a.on { color: var(--pink); font-weight: 700; }
.admin-lang a:hover { color: var(--pink); }
.admin-lang .sep { color: rgba(42,38,33,0.3); }
.admin-content { padding: 1.8rem; }

/* ---- Flash ---- */
.flash { padding: .8rem 1.1rem; border-radius: var(--radius); margin-bottom: 1.2rem; font-weight: 600; }
.flash-success { background: #e6f4ec; color: var(--green); }
.flash-error { background: #fdeaef; color: var(--pink-dark); }

/* ---- Stat cards ---- */
.stat-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 1.2rem; margin-bottom: 1.6rem; }
.stat-card { display: block; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.3rem; box-shadow: var(--shadow); }
a.stat-card { transition: transform .15s ease, border-color .15s ease; }
a.stat-card:hover { transform: translateY(-2px); border-color: var(--pink); }
.stat-label { color: var(--muted); font-weight: 700; font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; }
.stat-value { font-size: 2rem; font-weight: 800; margin-top: .3rem; }

/* ---- Panels ---- */
.dash-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 1.4rem; align-items: start; }
.dash-grid-sm { grid-template-columns: 1.4fr .8fr; }
.dash-grid-even { grid-template-columns: 1fr 1fr; }

/* ---- Dashboard charts ---- */
.dash-chart { width: 100%; height: auto; display: block; }
.dash-chart .chart-base { stroke: var(--line); stroke-width: 1; }
.dash-chart .chart-x { fill: var(--muted); font-size: 11px; font-family: 'Jost', sans-serif; }
.dash-chart .chart-hit { cursor: pointer; }
.dash-chart .chart-hit:hover { fill: rgba(42,38,33,.05); }
.chart-tip { position: fixed; z-index: 2000; display: none; pointer-events: none;
    background: var(--ink); color: #F5F0E5; font-family: 'Jost', sans-serif; font-size: 12px; font-weight: 500;
    padding: 6px 10px; border-radius: 6px; white-space: nowrap; box-shadow: 0 8px 20px -8px rgba(0,0,0,.5); }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.3rem; box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.panel-head h2 { font-family: 'Cormorant Garamond', serif; font-size: 1.4rem; margin: 0; }
.panel-head a { color: var(--pink); font-weight: 700; font-size: .9rem; }

/* ---- Tables ---- */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: .5rem .6rem; border-bottom: 2px solid var(--line); }
.table td { padding: .7rem .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td, .table tbody tr:last-child td { border-bottom: none; }
.table tfoot td { padding: .7rem .6rem; }
.tright { text-align: right; }
.thumb { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; }

/* ---- User avatars (Users page) ---- */
.user-cell { display: inline-flex; align-items: center; gap: .6rem; }
.avatar-sm { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; flex: none;
    border: 1px solid var(--line); }
.avatar-initial { display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: .9rem; color: #fff; background: var(--pink); }
.avatar-initial[data-hue="1"] { background: #A8895C; }
.avatar-initial[data-hue="2"] { background: #5F7A66; }
.avatar-initial[data-hue="3"] { background: #B06A56; }
.avatar-initial[data-hue="4"] { background: #7A6A8A; }
.avatar-initial[data-hue="5"] { background: #4A6B8A; }
.muted { color: var(--muted); }
/* Action cells stay real table-cells (flex would stop the td stretching to
   the row height) — inline-block children + vertical-align keep the buttons
   centered on the row's midline in every row. */
.row-actions { text-align: right; white-space: nowrap; }
.row-actions > * { vertical-align: middle; }
.row-actions > * + * { margin-left: .4rem; }
.inline { display: inline-block; margin: 0; }

/* ---- Modal (native <dialog>) ---- */
.modal { width: min(560px, 92vw); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 0; background: var(--card); color: var(--ink); box-shadow: 0 30px 80px -30px rgba(42,38,33,.5); }
.modal::backdrop { background: rgba(34,30,26,.45); backdrop-filter: blur(2px); }
.modal[open] { animation: modal-in .18s ease; }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.modal-body { padding: 1.4rem; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.modal-head h2 { font-family: 'Cormorant Garamond', serif; font-size: 1.5rem; margin: 0; }
.modal-x { border: none; background: none; font-size: 1.7rem; line-height: 1; cursor: pointer; color: var(--muted); padding: 0 .2rem; }
.modal-x:hover { color: var(--ink); }
.modal-foot { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1.2rem; }

/* ---- Pills / statuses ---- */
.pill { display: inline-block; padding: .18rem .6rem; border-radius: 999px; font-size: .74rem; font-weight: 700; text-transform: capitalize; }
.st-pending { background: #fff3d6; color: #a9791a; }
.st-paid { background: #dff0e6; color: var(--green); }
.st-shipped { background: #dce8fb; color: #2c5aa0; }
.st-completed { background: #e2f5e9; color: #2e7d4f; }
.st-cancelled { background: #fde0e0; color: #b03636; }

/* ---- Content head ---- */
.content-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.2rem; }
.back-link { color: var(--pink); font-weight: 700; }
.filter-bar { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-bottom: 1.2rem; }
.filter-bar select, .filter-bar .filter-search {
    height: 40px; padding: 0 .7rem; border: 1px solid var(--line); border-radius: 8px;
    font: inherit; background: #fff; color: var(--ink); }
.filter-bar .filter-search { min-width: 220px; flex: 1 1 220px; max-width: 340px; }
.filter-bar .check { margin: 0; white-space: nowrap; }
.filter-bar .btn { flex: none; }
.filter-tabs { display: flex; gap: .4rem; flex-wrap: wrap; }
.filter-tabs a { padding: .4rem .9rem; border-radius: 999px; font-weight: 700; color: var(--muted); background: #fff; border: 1px solid var(--line); }
.filter-tabs a.active { background: var(--pink); color: #fff; border-color: var(--pink); }

/* ---- Forms ---- */
.form-panel { margin-top: .5rem; }
.form-grid { display: grid; grid-template-columns: 1fr 300px; gap: 1.6rem; }
.form-main label, .stack-form label { display: block; font-weight: 700; margin-bottom: 1rem; }
.form-main input, .form-main textarea, .form-main select,
.stack-form input, .stack-form select, .stack-form textarea,
.status-form select {
    display: block; width: 100%; margin-top: .35rem; padding: .6rem .8rem;
    border: 1px solid var(--line); border-radius: 8px; font: inherit; font-weight: 400;
    background: #fff; color: var(--ink);
}
/* One height for every single-line control (textareas keep natural height). */
.form-main input, .form-main select,
.stack-form input, .stack-form select, .status-form select { height: 44px; }
.form-main input:focus, .form-main textarea:focus, .form-main select:focus,
.stack-form input:focus, .stack-form select:focus, .stack-form textarea:focus,
.status-form select:focus { outline: 2px solid var(--pink); border-color: var(--pink); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.field-error { color: #b03636; font-weight: 600; font-size: .82rem; }
.form-side { display: flex; flex-direction: column; gap: 1.2rem; }
.side-box { background: #fbfbfd; border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
.side-box h3 { margin: 0 0 .7rem; font-size: 1rem; }
.img-preview { aspect-ratio: 4/3; background: #f1eef0; border-radius: 8px; overflow: hidden; margin-bottom: .7rem; }
.img-preview img { width: 100%; height: 100%; object-fit: cover; }
.check { display: flex; align-items: center; gap: .5rem; font-weight: 600; margin-bottom: .5rem; }
.check input { width: auto; height: auto; margin: 0; padding: 0; }
.inline-input { border: 1px solid transparent; background: transparent; padding: .35rem .5rem; border-radius: 6px; font: inherit; font-weight: 600; width: 100%; height: 36px; }
.inline-input:hover { border-color: var(--line); background: #fff; }
.inline-input:focus { outline: none; border-color: var(--pink); background: #fff; }
.stack-form { display: flex; flex-direction: column; }
.hint { font-size: .82rem; margin-top: .8rem; }

/* Add-schedule-entry: pickers/date/qty/button on one line, note on its own row. */
.sched-add-form { display: grid; grid-template-columns: 1.3fr 1.3fr 140px 90px auto; gap: .8rem; align-items: end; }
.sched-add-form label { margin-bottom: 0; }
.sched-add-form .sched-note { grid-column: 1 / -1; }
@media (max-width: 1200px) {
    .sched-add-form { grid-template-columns: 1fr 1fr; }
    .sched-add-form .btn { justify-self: start; }
}

/* ---- Lists / detail ---- */
.lowstock-list { list-style: none; margin: 0; padding: 0; }
.lowstock-list li { display: flex; justify-content: space-between; align-items: center; padding: .6rem 0; border-bottom: 1px solid var(--line); }
.lowstock-list li:last-child { border-bottom: none; }
.stock-badge { background: #fff3d6; color: #a9791a; font-weight: 700; font-size: .78rem; padding: .15rem .6rem; border-radius: 999px; }
.stock-badge.critical { background: #fde0e0; color: #b03636; }
.detail-list { display: grid; grid-template-columns: 90px 1fr; gap: .5rem 1rem; margin: 0 0 1.4rem; }
.detail-list dt { color: var(--muted); font-weight: 700; }
.detail-list dd { margin: 0; }
.status-form { border-top: 1px solid var(--line); padding-top: 1rem; display: flex; align-items: flex-end; gap: 1rem; }
.status-form label { flex: 1; font-weight: 700; margin: 0; }

/* ---- Responsive ---- */
@media (max-width: 1000px) {
    .stat-grid { grid-template-columns: repeat(2,1fr); }
    .dash-grid, .dash-grid-sm, .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
    /* Single column: back to one page scroll, horizontal nav strip. */
    .admin-shell { grid-template-columns: 1fr; height: auto; }
    .admin-main { overflow-y: visible; }
    .sidebar { flex-direction: row; align-items: center; overflow-x: auto; overflow-y: hidden; padding: .6rem; }
    .sidebar-brand { padding: .3rem .6rem; }
    .sidebar-nav { flex-direction: row; align-items: center; }
    .sidebar-sep { width: 1px; height: 22px; border-top: 0; border-left: 1px solid rgba(255,255,255,.16); margin: 0 .35rem; flex: none; }
    .sidebar-foot { margin: 0; }
}

/* ---- Language tabs (Pages & legal) ---- */
.lang-tabs { display: flex; gap: 8px; margin-bottom: .9rem; }
.lang-tab {
    display: inline-flex; align-items: center; gap: 7px;
    font: inherit; font-weight: 600; font-size: .82rem; letter-spacing: .06em;
    padding: .45rem 1rem; border-radius: 999px; cursor: pointer;
    background: transparent; border: 1px solid var(--line); color: var(--muted);
    transition: all .15s ease;
}
.lang-tab:hover { border-color: var(--gold); color: var(--gold); }
.lang-tab.on { background: var(--pink); border-color: var(--pink); color: #F4EFE4; }
.lang-dot { width: 7px; height: 7px; border-radius: 50%; background: #D9A441; display: inline-block; }
.lang-tab.on .lang-dot { background: #F4D48B; }
.lang-pane { display: none; }
.lang-pane.on { display: block; }
.area-lg {
    width: 100%; padding: .8rem .9rem; border: 1px solid rgba(42,38,33,0.15);
    border-radius: 6px; background: #FBF8F1; font: inherit; font-weight: 400;
    font-size: .92rem; line-height: 1.6; color: var(--ink); resize: vertical; outline: none;
}
.area-lg:focus { border-color: var(--pink); }

.nav-badge { display:inline-block; min-width:18px; text-align:center; background:#C0603E; color:#fff; font-size:10px; font-weight:700; line-height:18px; border-radius:9px; padding:0 5px; margin-left:6px; vertical-align:middle; }

/* ---- Dropdown calendar (datepicker.js) ---- */
.dp-pop { position: absolute; z-index: 1000; width: 254px; padding: .7rem;
    background: #fff; border: 1px solid var(--line); border-radius: 10px;
    box-shadow: 0 14px 34px -14px rgba(42,38,33,.35); }
.dp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .45rem; }
.dp-title { font-weight: 700; font-size: .9rem; text-transform: capitalize; }
.dp-nav { border: none; background: none; cursor: pointer; font: inherit; font-size: 1.1rem;
    line-height: 1; padding: .25rem .55rem; border-radius: 6px; color: var(--ink); }
.dp-nav:hover { background: var(--bg); }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.dp-dow { text-align: center; font-size: .66rem; font-weight: 700; color: var(--muted);
    text-transform: uppercase; padding: .2rem 0; }
.dp-day { border: none; background: none; cursor: pointer; font: inherit; font-size: .85rem;
    text-align: center; padding: .32rem 0; border-radius: 6px; color: var(--ink); }
.dp-day:hover { background: var(--bg); }
.dp-day.other { color: #c2bcae; }
.dp-day.today { box-shadow: inset 0 0 0 1px var(--gold); }
.dp-day.sel { background: var(--pink); color: #fff; }
.dp-day.off { color: #d5cfc2; cursor: default; }
.dp-day.off:hover { background: none; }
