/* Ichabod's Owner Portal — plain, calm admin UI. Not meant to look like
   the public storefront; meant to be easy for a non-technical owner to
   use without fear of breaking anything. */

:root {
    --ink: #241b17;
    --muted: #6b5d56;
    --line: #e4dcd6;
    --bg: #faf7f4;
    --panel: #ffffff;
    --accent: #8a3324;
    --accent-dark: #6b2519;
    --accent-soft: #f4e4de;
    --ok: #2e7d4f;
    --ok-soft: #e4f3ea;
    --warn: #9a6b12;
    --warn-soft: #fbf0d9;
    --danger: #b13a3a;
    --danger-soft: #fbe6e6;
    --radius: 10px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
}

a { color: var(--accent); }

h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }

p { margin: 0 0 1em; color: var(--ink); }
.muted { color: var(--muted); }

/* ---------- App shell layout ---------- */

.app-shell {
    display: grid;
    grid-template-columns: 230px 1fr;
    grid-template-rows: auto 1fr;
    min-height: 100vh;
}

.topbar {
    grid-column: 1 / -1;
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: var(--accent);
    color: #fff;
}

.brand { font-weight: 700; }

.sidebar {
    grid-row: 1 / -1;
    background: #201713;
    color: #f1e8e2;
    padding: 22px 14px;
}

.sidebar nav { display: flex; flex-direction: column; gap: 2px; }

.nav-group-label {
    margin: 16px 8px 4px;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #b6a89f;
}

.nav-link {
    display: block;
    padding: 9px 12px;
    border-radius: 8px;
    color: #ece2db;
    text-decoration: none;
    font-size: .95rem;
}

.nav-link:hover { background: #34261f; }
.nav-link.active { background: var(--accent); color: #fff; }

.content, .content-plain {
    padding: 28px 32px 60px;
    max-width: 1080px;
}

.content-plain {
    min-height: 100vh;
    max-width: none;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

@media (max-width: 860px) {
    .app-shell { grid-template-columns: 1fr; }
    .topbar { display: flex; }
    .sidebar { display: none; position: fixed; inset: 56px 0 0 0; z-index: 20; overflow-y: auto; }
    .sidebar.open { display: block; }
    .content { padding: 20px; }
}

/* ---------- Basic elements ---------- */

.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 22px 24px;
    margin-bottom: 20px;
}

.centered-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.btn {
    display: inline-block;
    padding: 9px 16px;
    border-radius: 8px;
    border: 1px solid var(--accent);
    background: var(--accent);
    color: #fff;
    font-size: .92rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}
.btn:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-secondary { background: #fff; color: var(--accent); }
.btn-secondary:hover { background: var(--accent-soft); }
.btn-danger { background: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: #8f2e2e; border-color: #8f2e2e; }
.btn-small { padding: 5px 10px; font-size: .82rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

label { display: block; font-weight: 600; margin-bottom: 5px; font-size: .9rem; }
.field { margin-bottom: 16px; }
.field .hint { font-weight: 400; color: var(--muted); font-size: .82rem; margin-top: 4px; }

input[type=text], input[type=password], input[type=email], input[type=number],
input[type=search], input[type=date], select, textarea {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: .95rem;
    font-family: inherit;
    background: #fff;
    color: var(--ink);
}

textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }

.checkbox-row { display: flex; align-items: center; gap: 8px; }
.checkbox-row input { width: auto; }
.checkbox-row label { margin: 0; font-weight: 500; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: .92rem; vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
tr:hover td { background: #fbf6f2; }

.table-wrap { overflow-x: auto; }

.badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: .76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .02em;
}
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-muted { background: #eee; color: var(--muted); }

.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: .92rem; }
.flash-success { background: var(--ok-soft); color: var(--ok); }
.flash-error { background: var(--danger-soft); color: var(--danger); }
.flash-info { background: var(--accent-soft); color: var(--accent-dark); }

.empty-state { text-align: center; padding: 40px 20px; color: var(--muted); }

.pagination { display: flex; gap: 8px; margin-top: 18px; }

.thumb {
    width: 56px; height: 56px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line);
    background: #f2ece7;
}

.image-grid { display: flex; flex-wrap: wrap; gap: 12px; margin: 10px 0 4px; }
.image-tile { position: relative; width: 110px; }
.image-tile img { width: 110px; height: 110px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.image-tile .remove-image {
    position: absolute; top: -8px; right: -8px; width: 24px; height: 24px; border-radius: 50%;
    background: var(--danger); color: #fff; border: 2px solid #fff; font-size: .85rem; line-height: 1; cursor: pointer;
}
.image-tile.is-featured::after {
    content: 'Main photo';
    position: absolute; bottom: 4px; left: 4px; right: 4px; background: rgba(0,0,0,.65); color: #fff;
    font-size: .68rem; text-align: center; border-radius: 4px; padding: 2px 0;
}

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.stat-card .value { font-size: 1.6rem; font-weight: 700; }
.stat-card .label { color: var(--muted); font-size: .82rem; }

.login-wrap { width: 100%; max-width: 380px; }
.login-wrap .card { margin: 0; }

.quick-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.quick-link { display: block; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; text-decoration: none; color: var(--ink); }
.quick-link:hover { border-color: var(--accent); }
.quick-link .qtitle { font-weight: 700; margin-bottom: 4px; }
.quick-link .qdesc { font-size: .85rem; color: var(--muted); }

code { background: #f2ece7; padding: 2px 6px; border-radius: 4px; font-size: .85em; }

.tabs { display: flex; gap: 6px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.tab { padding: 9px 14px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; font-size: .9rem; font-weight: 600; }
.tab.active { color: var(--accent); border-color: var(--accent); }
