/* Class rules like .bulk { display: flex } would otherwise override the hidden attribute. */
[hidden] { display: none !important; }

:root {
  --burgundy: #5c1f1f;
  --burgundy-dark: #431515;
  --rose: #d4a574;
  --ivory: #fdfbf7;
  --ink: #2a1a1a;
  --muted: #6f6060;
  --line: #eadfd6;
  --card: #fff;
  --ok: #1f6b3a;
  --warn: #9a6200;
  --bad: #a31d1d;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(60, 20, 20, .06), 0 4px 16px rgba(60, 20, 20, .06);
  font-family: Poppins, system-ui, sans-serif;
  font-size: 15px;
  color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--ivory); }
h1, h2, h3 { font-family: "Cormorant Garamond", Georgia, serif; color: var(--burgundy); margin: 0 0 .6rem; }
h1 { font-size: 2rem; }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.15rem; }
a { color: var(--burgundy); }
.boot { padding: 3rem; text-align: center; color: var(--muted); }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
.side { background: var(--burgundy); color: #f6ebe3; padding: 1.25rem .75rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side__brand { font-family: "Cormorant Garamond", serif; font-size: 1.5rem; color: #fff; padding: 0 .6rem 1rem; display: block; text-decoration: none; }
.side__brand small { display: block; font-family: Poppins, sans-serif; font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; color: var(--rose); }
.side nav a { display: block; padding: .55rem .75rem; border-radius: 8px; color: inherit; text-decoration: none; margin-bottom: 2px; }
.side nav a:hover { background: rgba(255, 255, 255, .08); }
.side nav a[aria-current="page"] { background: rgba(255, 255, 255, .16); color: #fff; font-weight: 500; }
.side__group { font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; color: var(--rose); padding: 1rem .75rem .3rem; }
.main { padding: 1.5rem 2rem 4rem; min-width: 0; }
.top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.top__user { color: var(--muted); font-size: .9rem; }
.role { display: inline-block; font-size: .7rem; padding: .1rem .5rem; border-radius: 99px; background: var(--rose); color: var(--burgundy-dark); font-weight: 600; margin-left: .4rem; }

@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; padding: .75rem; }
  .side nav { display: flex; gap: .25rem; overflow-x: auto; }
  .side nav a { white-space: nowrap; }
  .side__group { display: none; }
  .main { padding: 1rem 1rem 3rem; }
}

/* ---------- auth screens ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.auth__card { width: min(420px, 100%); background: var(--card); border-radius: 18px; box-shadow: var(--shadow); padding: 2rem; }
.auth__card img.logo { height: 56px; display: block; margin: 0 auto 1rem; }
.auth__card h1 { text-align: center; }
.auth__links { margin-top: 1rem; text-align: center; font-size: .9rem; }
.qr { display: block; margin: .5rem auto; border: 1px solid var(--line); border-radius: 8px; }
.secret { font-family: ui-monospace, Consolas, monospace; word-break: break-all; background: #f6efe9; padding: .4rem .6rem; border-radius: 6px; font-size: .85rem; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: .4rem; font-family: ui-monospace, Consolas, monospace; background: #f6efe9; padding: .8rem; border-radius: 8px; margin: .6rem 0; }

/* ---------- components ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem; margin-bottom: 1.25rem; }
.grid { display: grid; gap: 1rem; }
.grid--stats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 1.25rem; }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.stat { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.2rem; }
.stat b { display: block; font-size: 1.8rem; color: var(--burgundy); font-family: "Cormorant Garamond", serif; }
.stat span { color: var(--muted); font-size: .85rem; }
.stat--alert b { color: var(--bad); }

label { display: block; font-size: .85rem; font-weight: 500; margin-bottom: .25rem; }
.field { margin-bottom: .9rem; }
.field small { display: block; color: var(--muted); font-size: .78rem; margin-top: .2rem; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="search"], input[type="date"], select, textarea {
  width: 100%; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: #fff; color: inherit;
}
textarea { min-height: 110px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--rose); outline-offset: 2px; }
.check { display: flex; align-items: center; gap: .5rem; font-weight: 400; margin-bottom: .5rem; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 1rem; }

.btn { display: inline-flex; align-items: center; gap: .35rem; border: 1px solid var(--burgundy); background: var(--burgundy); color: #fff; padding: .5rem 1rem; border-radius: 99px; font: inherit; font-size: .9rem; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--burgundy-dark); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn--ghost { background: transparent; color: var(--burgundy); }
.btn--ghost:hover { background: #f6efe9; }
.btn--danger { background: var(--bad); border-color: var(--bad); }
.btn--sm { padding: .25rem .7rem; font-size: .8rem; }
.btn--block { width: 100%; justify-content: center; }
.btn-row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

.msg { padding: .6rem .8rem; border-radius: 8px; margin-bottom: 1rem; font-size: .9rem; }
.msg--error { background: #fbeaea; color: var(--bad); }
.msg--ok { background: #e8f4ec; color: var(--ok); }
.msg--info { background: #f6efe9; color: var(--burgundy-dark); }
.flash { position: fixed; right: 1rem; bottom: 1rem; z-index: 10; max-width: 360px; box-shadow: var(--shadow); }

.toolbar { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; align-items: end; }
.toolbar > * { flex: 1 1 140px; }
.toolbar > .grow { flex: 3 1 220px; }
.bulk { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; background: #f6efe9; padding: .5rem .75rem; border-radius: 8px; margin-bottom: .75rem; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-weight: 600; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
tr:hover td { background: #fffaf6; }
td img.thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; display: block; background: #f6efe9; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: .82rem; }
pre { white-space: pre-wrap; word-break: break-word; background: #f6efe9; padding: .6rem; border-radius: 6px; font-size: .78rem; margin: .3rem 0 0; }

.pill { display: inline-block; padding: .1rem .55rem; border-radius: 99px; font-size: .75rem; font-weight: 500; background: #eee; color: #444; }
.pill--ok { background: #e8f4ec; color: var(--ok); }
.pill--warn { background: #fdf1dc; color: var(--warn); }
.pill--bad { background: #fbeaea; color: var(--bad); }
.pill--rose { background: #f8ece0; color: var(--burgundy); }

.pager { display: flex; gap: .5rem; align-items: center; justify-content: flex-end; margin-top: .75rem; font-size: .85rem; }

.images { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .9rem; }
.img-card { border: 1px solid var(--line); border-radius: 10px; padding: .5rem; background: #fff; }
.img-card img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; display: block; }
.img-card .btn-row { margin-top: .4rem; }
.img-card input { margin-top: .4rem; font-size: .8rem; }
.attr-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: .5rem; margin-bottom: .4rem; }

.preview { max-width: 260px; border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); background: #fff; }
.preview img, .preview .ph { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: #f6efe9; }
.preview div.body { padding: .8rem; }
.preview .cat { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0; }
.preview .name { font-family: "Cormorant Garamond", serif; font-size: 1.2rem; color: var(--burgundy); margin: .2rem 0; }
.preview s { color: var(--muted); margin-left: .3rem; }

details summary { cursor: pointer; color: var(--burgundy); font-size: .8rem; }
.copy-box { display: flex; gap: .5rem; }
.copy-box input { font-family: ui-monospace, Consolas, monospace; font-size: .8rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
