/* Admin shell styling. Brand palette is injected as --brand-* custom
   properties (see Brand::cssVariables); we fall back to a neutral default so
   the chrome is legible before any reseller palette is set. */
:root {
    --brand-primary: #1f3a5f;
    --ink: #1a1a1a;
    --muted: #5a6470;
    --line: #e3e6ea;
    --bg: #f5f6f8;
    --card: #fff;
    --ok: #166534;
    --warn: #92400e;
    --err: #b91c1c;
    --max: 64rem;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font: 16px/1.55 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    color: var(--ink);
    background: var(--bg);
}

a { color: var(--brand-primary); }

.skip-link { position: absolute; left: -999px; }
.skip-link:focus { left: 1rem; top: 1rem; background: #fff; padding: .5rem 1rem; z-index: 1000; }

/* Header */
.admin-header { background: var(--brand-primary); color: #fff; }
.admin-header .bar {
    max-width: var(--max); margin: 0 auto; padding: .75rem 1rem;
    display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap;
}
.brand { display: inline-flex; align-items: baseline; gap: .5rem; color: #fff; text-decoration: none; font-weight: 700; }
.brand-logo { height: 28px; vertical-align: middle; }
.brand-tag { font-weight: 400; opacity: .8; font-size: .85rem; }
.admin-nav { display: flex; gap: 1.1rem; margin-left: auto; flex-wrap: wrap; }
.admin-nav a { color: #fff; text-decoration: none; opacity: .9; }
.admin-nav a:hover { opacity: 1; text-decoration: underline; }
.logout { display: flex; align-items: center; gap: .6rem; }
.logout .who { color: #fff; opacity: .85; font-size: .9rem; }
.logout button { background: rgba(255,255,255,.15); color: #fff; border: 1px solid rgba(255,255,255,.4); border-radius: 6px; padding: .35rem .7rem; cursor: pointer; }

/* Layout */
.admin-main { max-width: var(--max); margin: 1.5rem auto; padding: 0 1rem; }
.admin-footer { max-width: var(--max); margin: 2rem auto; padding: 1rem; color: var(--muted); font-size: .85rem; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 1.5rem; }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); gap: 1rem; }

/* Cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 1.25rem; margin-bottom: 1rem; }
.card-narrow { max-width: 26rem; margin: 3rem auto; }
.card h2 { margin-top: 0; font-size: 1.1rem; }
.stat { font-size: 2rem; font-weight: 700; margin: .25rem 0; }

/* Forms */
.stack > * + * { margin-top: 1rem; }
label { display: block; }
label > span { display: block; font-weight: 600; margin-bottom: .3rem; }
label em { font-weight: 400; color: var(--muted); font-style: normal; font-size: .85rem; }
input[type=text], input[type=email], input[type=password], input[type=date], select, textarea {
    width: 100%; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 6px; font: inherit; background: #fff;
}
textarea { resize: vertical; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 1rem; }
.checkbox { display: flex; align-items: center; gap: .5rem; }
.checkbox input { width: auto; }
.actions { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.inline-form { margin-top: 1rem; }
small.muted { font-weight: 400; }

/* Buttons */
.btn, .btn-primary { display: inline-block; padding: .55rem .9rem; border-radius: 6px; text-decoration: none; cursor: pointer; border: 1px solid var(--line); background: #fff; color: var(--ink); font: inherit; }
.btn-primary { background: var(--brand-primary); border-color: var(--brand-primary); color: #fff; }
button.link { background: none; border: none; color: var(--brand-primary); cursor: pointer; padding: 0; font: inherit; text-decoration: underline; }

/* Tables */
table.data { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
table.data th, table.data td { text-align: left; padding: .6rem .75rem; border-bottom: 1px solid var(--line); }
table.data th { background: #fafbfc; font-size: .85rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
table.data tr:last-child td { border-bottom: none; }
.row-actions form { display: inline; }

/* Definition lists */
dl.kv { display: grid; grid-template-columns: auto 1fr; gap: .35rem 1rem; margin: 0 0 1rem; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; }

/* Badges */
.badge { display: inline-block; padding: .15rem .5rem; border-radius: 999px; font-size: .78rem; font-weight: 600; background: #eef1f4; color: var(--muted); }
.badge-live, .badge-published, .badge-active, .badge-issued { background: #dcfce7; color: var(--ok); }
.badge-building, .badge-pending, .badge-draft, .badge-invited { background: #fef3c7; color: var(--warn); }
.badge-suspended, .badge-disabled, .badge-closed, .badge-error { background: #fee2e2; color: var(--err); }

/* Flash */
.flash { padding: .7rem 1rem; border-radius: 8px; margin-bottom: 1rem; }
.flash ul { margin: 0; padding-left: 1.1rem; }
.flash-success { background: #dcfce7; color: var(--ok); }
.flash-error { background: #fee2e2; color: var(--err); }
.flash-info { background: #e0f2fe; color: #075985; }

.muted { color: var(--muted); }
.small { font-size: .85rem; }
/* --- Media library (MODULES.md §1a) --- */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 1rem; margin-top: 1rem; }
.media-item { padding: .5rem; text-align: center; }
.media-item img { max-width: 100%; height: 110px; object-fit: cover; border-radius: 4px; background: #f1f5f9; }
.media-item figcaption { display: block; margin: .4rem 0; }
.media-name { display: block; font-size: .8rem; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.btn-small { font-size: .8rem; padding: .25rem .5rem; }
