:root {
  --bg: #0f1115;
  --surface: #181b22;
  --border: #2a2f3a;
  --text: #e8eaf0;
  --muted: #8a91a0;
  --accent: #e50914;
  --danger-bg: #3a1417;
  --danger-text: #ffb4b8;
  color-scheme: dark;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}
h1 { font-size: 1.5rem; margin: 0 0 1rem; }
h2 { font-size: 1rem; margin: 0 0 .5rem; }
.muted { color: var(--muted); }
.spacer { flex: 1; }

/* login */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.login-card {
  width: 100%; max-width: 380px; padding: 2rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
}
.brand { text-align: center; margin-bottom: 1.5rem; }
.brand h1 { margin: .5rem 0 0; }
.brand p { margin: .25rem 0 0; }
.brand-logo { max-height: 56px; }
form label { display: block; margin: 1rem 0 .35rem; font-size: .9rem; color: var(--muted); }
input[type=text], input[type=password] {
  width: 100%; padding: .7rem .8rem; font: inherit; color: var(--text);
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
}
input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
button[type=submit]:not(.link-button) {
  width: 100%; margin-top: 1.5rem; padding: .75rem; font: inherit; font-weight: 600;
  color: #fff; background: var(--accent); border: 0; border-radius: 8px; cursor: pointer;
}
.alert {
  padding: .7rem .9rem; border-radius: 8px; font-size: .9rem;
  background: var(--danger-bg); color: var(--danger-text);
}

/* panel shell */
.topbar {
  display: flex; align-items: center; gap: 1rem; padding: .75rem 1.25rem;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.topbar form { margin: 0; }
.topbar-brand { font-weight: 700; }
.role-badge {
  font-size: .75rem; text-transform: uppercase; letter-spacing: .05em;
  padding: .15rem .5rem; border-radius: 999px; border: 1px solid var(--border);
}
.role-master { color: #ffd479; border-color: #6b5520; }
.link-button { background: none; border: 0; color: var(--muted); font: inherit; cursor: pointer; }
.link-button:hover { color: var(--text); }
.shell { display: flex; min-height: calc(100vh - 50px); }
.sidebar {
  width: 220px; flex-shrink: 0; padding: 1rem .75rem;
  background: var(--surface); border-right: 1px solid var(--border);
}
.sidebar a {
  display: block; padding: .5rem .75rem; border-radius: 6px;
  color: var(--text); text-decoration: none;
}
.sidebar a:hover { background: var(--border); }
.nav-heading {
  margin: 1rem .75rem .25rem; font-size: .75rem; text-transform: uppercase;
  letter-spacing: .05em; color: var(--muted);
}
.content { flex: 1; padding: 1.5rem; min-width: 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }
.card { padding: 1rem 1.25rem; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.card p { margin: .25rem 0; }

@media (max-width: 700px) {
  .shell { flex-direction: column; }
  .sidebar { width: auto; border-right: 0; border-bottom: 1px solid var(--border); }
}

/* v2 additions */
.row { display: flex; align-items: center; gap: .75rem; }
.button { padding: .5rem .9rem; background: var(--accent); color: #fff; border-radius: 8px; text-decoration: none; font-weight: 600; }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.card + .card, .two-col > div > .card + .card { margin-top: 1rem; }
.card form.inline, form.inline { display: flex; gap: .5rem; margin: .5rem 0; }
form.inline input { flex: 1; }
form.inline button, .profile-row button, .card .row form button { width: auto; margin: 0; padding: .5rem .8rem; }
input, select { width: 100%; padding: .6rem .8rem; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 8px; }
label.check { display: flex; align-items: center; gap: .5rem; margin-top: 1rem; }
label.check input { width: auto; }
table { width: 100%; border-collapse: collapse; margin: .5rem 0 1rem; }
th, td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; }
table.compact td, table.compact th { padding: .3rem .5rem; font-size: .85rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.small { font-size: .8rem; word-break: break-all; }
.big { font-size: 2rem; font-weight: 700; margin: 0; }
h2.section { margin-top: 2rem; }
.status { font-size: .75rem; padding: .15rem .5rem; border-radius: 999px; border: 1px solid var(--border); text-transform: uppercase; }
.status-success { color: #7ee2a8; border-color: #23573a; }
.status-failed { color: #ffb4b8; border-color: #6b2a2e; }
.status-running { color: #ffd479; border-color: #6b5520; }
.notice { padding: .7rem .9rem; margin-bottom: 1rem; border-radius: 8px; background: #16321f; color: #b6f0cc; word-break: break-all; }
pre.log { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 1rem; overflow: auto; max-height: 60vh; font-size: .8rem; white-space: pre-wrap; }
.profile-row { display: grid; grid-template-columns: 2rem minmax(0, 1fr) auto minmax(0, 1fr) auto auto auto; gap: .5rem; align-items: center; margin: .5rem 0; }
.profile-row .pos { color: var(--muted); text-align: center; }
.profile-row label.check { margin: 0; }
.danger { color: #ffb4b8; }
.danger-button { width: 100%; margin-top: 1rem; padding: .7rem; font: inherit; font-weight: 600; color: #fff; background: #8a1c22; border: 0; border-radius: 8px; cursor: pointer; }
.card a { color: var(--accent); }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } .profile-row { grid-template-columns: 2rem 1fr auto; } }
textarea { width: 100%; padding: .6rem .8rem; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 8px; }

.pill{display:inline-block;padding:2px 10px;border-radius:999px;background:#2a2f3a;color:#dfe6f5;font-size:12px;margin:2px}
.pill.warn{background:#7a2a1e;color:#fff}

/* colour fields: the typed value, a native picker and a palette of swatches */
.colour-field { display: flex; align-items: center; gap: .5rem; }
.colour-field input[type=text] { flex: 1; }
.colour-field input[type=color] { width: 2.4rem; height: 2.2rem; padding: 0; border: 1px solid #333; border-radius: 6px; background: none; cursor: pointer; }
.swatches { display: flex; flex-wrap: wrap; gap: .35rem; margin: .35rem 0 .75rem; }
.swatch { width: 1.6rem; height: 1.6rem; border-radius: 50%; border: 2px solid rgba(255,255,255,.25); cursor: pointer; padding: 0; }
.swatch:hover, .swatch:focus { border-color: #fff; outline: none; transform: scale(1.12); }
.swatch.on { border-color: #fff; box-shadow: 0 0 0 2px #000, 0 0 0 4px #fff; }
.thumb-icon { width: 64px; height: 64px; border-radius: 12px; display: block; margin-bottom: 6px; }
.thumb-logo { max-width: 120px; max-height: 64px; display: block; margin-bottom: 6px; }
.thumb-art { width: 112px; height: 63px; object-fit: cover; border-radius: 6px; }
.col-thumb { width: 120px; }

/* font previews (the same files the app ships) */
@font-face { font-family: "pv-inter"; src: url("/static/fonts/inter.ttf"); }
@font-face { font-family: "pv-roboto"; src: url("/static/fonts/roboto.ttf"); }
@font-face { font-family: "pv-poppins"; src: url("/static/fonts/poppins.ttf"); }
@font-face { font-family: "pv-montserrat"; src: url("/static/fonts/montserrat.ttf"); }
@font-face { font-family: "pv-nunito"; src: url("/static/fonts/nunito.ttf"); }
@font-face { font-family: "pv-oswald"; src: url("/static/fonts/oswald.ttf"); }
.font-list { display: grid; gap: .4rem; margin: .4rem 0 1rem; }
.font-opt { display: flex; align-items: center; gap: .8rem; padding: .55rem .8rem; border: 1px solid #333; border-radius: 10px; cursor: pointer; }
.font-opt:has(input:checked) { border-color: #3FB8F0; background: rgba(63,184,240,.08); }
.font-opt .sample { font-size: 1.35rem; line-height: 1.2; }
.font-opt .meta { color: #999; font-size: .85rem; }
.pv-inter { font-family: "pv-inter", sans-serif; } .pv-roboto { font-family: "pv-roboto", sans-serif; } .pv-poppins { font-family: "pv-poppins", sans-serif; }
.pv-montserrat { font-family: "pv-montserrat", sans-serif; } .pv-nunito { font-family: "pv-nunito", sans-serif; } .pv-oswald { font-family: "pv-oswald", sans-serif; }
/* "what does this change?" popovers */
details.help { display: inline-block; margin-left: .4rem; }
details.help summary { list-style: none; cursor: pointer; display: inline-block; width: 1.25rem; height: 1.25rem; line-height: 1.25rem; text-align: center; border-radius: 50%; background: #2a2f3a; color: #cfd6ff; font-size: .8rem; font-weight: bold; }
details.help summary::-webkit-details-marker { display: none; }
details.help[open] summary { background: #3FB8F0; color: #000; }
details.help .pop { margin-top: .5rem; padding: .6rem; background: #0b0d12; border: 1px solid #333; border-radius: 10px; max-width: 460px; }
details.help .pop img { width: 100%; border-radius: 8px; display: block; }
details.help .pop p { margin: .5rem 0 0; color: #ccc; font-size: .9rem; }
/* the app page: numbered sections inside one form, a clear download box, a tidy Discover grid */
.brand-form fieldset { border: 1px solid var(--border); border-radius: 10px; padding: .25rem 1rem .9rem; margin: 0 0 1rem; }
.brand-form legend { padding: 0 .4rem; font-weight: 600; color: var(--text, #eee); }
.brand-form fieldset > p.muted { margin: .4rem 0 .2rem; font-size: .85rem; }
.brand-form label { margin-top: .7rem; }
.brand-form button.primary { margin-top: .5rem; }
.img-field { display: flex; flex-direction: column; }
.thumb-empty { display: flex; align-items: center; justify-content: center; background: #1b1f28; color: #666; font-size: .75rem; border: 1px dashed #333; width: 64px; height: 64px; }
.colour-field { flex-direction: row; }
.colour-field input[type=color] { order: 0; }
.colour-field input[type=text] { order: 1; }
.help-dot { display: inline-block; width: 1.1rem; height: 1.1rem; line-height: 1.1rem; text-align: center; border-radius: 50%; background: #2a2f3a; color: #cfd6ff; font-size: .7rem; font-weight: bold; }
.font-list { gap: .3rem; }
.font-opt { padding: .4rem .7rem; }
.font-opt .sample { font-size: 1.15rem; }
.font-opt .meta { font-size: .78rem; }
.dl { padding: .8rem .9rem; margin: .4rem 0 .8rem; background: #0b0d12; border: 1px solid var(--border); border-radius: 10px; word-break: break-all; }
.dl .mono { margin: .25rem 0 .4rem; font-size: .85rem; }
.dl .button { display: inline-block; margin-top: .2rem; }
.disc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .8rem; margin-top: .6rem; }
.disc-item { background: #0b0d12; border: 1px solid var(--border); border-radius: 10px; padding: .5rem; }
.disc-item .thumb-art { width: 100%; height: auto; aspect-ratio: 16 / 9; }
.disc-name { margin: .4rem 0 .3rem; font-size: .85rem; font-weight: 600; }
.disc-form { display: flex; flex-direction: column; gap: .3rem; margin: 0; }
.disc-form input[type=file] { font-size: .75rem; }
.disc-form button { width: auto; padding: .35rem .7rem; font-size: .8rem; }
p.small, .small { font-size: .82rem; }
@media (max-width: 700px) { .grid2 { grid-template-columns: 1fr; } }
/* font options: a small radio, the sample and its caption stacked beside it */
.font-opt { display: grid !important; grid-template-columns: 1.4rem 1fr; column-gap: .6rem; align-items: center; }
.font-opt input[type=radio] { width: 1.1rem !important; height: 1.1rem; margin: 0; padding: 0; grid-row: 1 / span 2; }
.font-opt .sample { display: block; grid-column: 2; line-height: 1.25; }
.font-opt .meta { display: block; grid-column: 2; }
/* compact controls inside the Discover grid and image fields */
.disc-form input[type=file], .img-field input[type=file] { width: 100%; padding: .35rem; }
.disc-form button, .disc-item button { width: auto !important; margin: 0 !important; padding: .35rem .8rem !important; font-size: .8rem; align-self: flex-start; }
.disc-item form.inline { margin: .3rem 0 0; }
.colour-field input[type=color] { width: 2.6rem !important; height: 2.4rem !important; }
.font-opt input[type=radio] { appearance: auto; -webkit-appearance: radio; border: none; background: none; padding: 0; height: 1.1rem; }
