/* PlayMateX panel — styled to match the app (dark, rounded, spacious).
   Palette mirrors the app: Bg #0A0A0D, card #161619, chip #1B1B1F, text #F5F5F7 / #A8A8B0.
   The brand accent (buttons/links) is injected per-deployment by brand_style() (--accent). */
:root { --accent: #E11414; --bg: #0A0A0D; --card: #161619; --chip: #1B1B1F; --line: #23232a; --text: #F5F5F7; --muted: #A8A8B0; --dim: #6F7078; }
* { box-sizing: border-box; }
html, body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.wrap { min-height: 100vh; max-width: 1200px; margin: 0 auto; padding: 0 24px 72px; }

/* ---------- header / nav ---------- */
header {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 20px 2px 18px; margin-bottom: 24px; border-bottom: 1px solid #1e1e24;
}
header b { font-size: 19px; font-weight: 800; letter-spacing: .2px; display: flex; align-items: center; white-space: nowrap; }
nav { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
nav a { color: var(--muted); text-decoration: none; padding: 8px 12px; border-radius: 9px; font-size: 14px; font-weight: 600; white-space: nowrap; }
nav a:hover { color: var(--text); background: #16161b; }
nav a.on { color: var(--text); background: var(--chip); }
.who { color: var(--dim); font-size: 13px; margin-left: 8px; }
.pill { display: inline-block; background: var(--accent); color: #fff; border-radius: 10px; padding: 0 7px; font-size: 11px; line-height: 18px; margin-left: 4px; vertical-align: 1px; }

h1 { font-size: 19px; font-weight: 800; margin: 0 0 16px; letter-spacing: .2px; }
h1 .muted { font-weight: 600; }

/* ---------- cards ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 24px; margin-bottom: 20px; overflow-x: auto; }
.card.narrow { max-width: 400px; margin: 12vh auto 40px; }
.card.narrow label { text-align: left; }
.card.narrow button { width: 100%; margin-top: 4px; }
.narrow0 { max-width: 560px; }
.sub { border: 1px solid #222833; border-radius: 12px; padding: 16px 16px 2px; margin-bottom: 14px; }
.rowhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.rowhead h1 { margin: 0; display: flex; align-items: center; gap: 10px; }

/* ---------- forms ---------- */
label { display: block; margin: 0 0 16px; font-size: 13px; color: var(--muted); font-weight: 600; }
input, select, textarea {
  display: block; width: 100%; margin-top: 7px; padding: 11px 14px;
  background: #0E0E11; border: 1px solid #2a2a32; border-radius: 12px;
  color: var(--text); font-size: 14.5px; font-family: inherit; line-height: 1.4;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
input::placeholder, textarea::placeholder { color: #55565d; }
input[type="color"] { height: 46px; width: 120px; padding: 4px 6px; cursor: pointer; }
input[type="checkbox"] { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
textarea { resize: vertical; min-height: 64px; }
select { appearance: none; -webkit-appearance: none; padding-right: 36px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' fill='none' stroke='%23A8A8B0' stroke-width='2'/></svg>");
  background-repeat: no-repeat; background-position: right 14px center; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; }
.grid .wide { grid-column: 1 / -1; }
label.check { display: flex; gap: 12px; align-items: flex-start; font-weight: 500; color: var(--text); font-size: 14px; line-height: 1.45; margin-bottom: 14px; }
label.check input { margin-top: 2px; flex: 0 0 auto; }
label.check b { color: var(--text); }

/* ---------- buttons ---------- */
button, a.btn {
  display: inline-block; background: var(--accent); color: #fff; border: 0; border-radius: 24px;
  padding: 11px 20px; font-size: 14px; font-weight: 800; cursor: pointer; text-decoration: none;
  letter-spacing: .2px; line-height: 1.3; white-space: nowrap; transition: filter .12s, transform .06s;
}
button:hover, a.btn:hover { filter: brightness(1.08); }
button:active { transform: translateY(1px); }
button.ok { background: #16a34a; }
button.danger { background: #b91c1c; }
button.ghost, a.btn.ghost { background: #26262c; color: var(--text); }
button.small, a.btn.small { padding: 6px 12px; font-size: 12.5px; border-radius: 16px; font-weight: 700; }
.btnrow { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.acts { display: flex; gap: 6px; align-items: center; flex-wrap: nowrap; }
.acts form { display: inline; margin: 0; }
form.inline { display: flex; gap: 6px; align-items: center; margin: 0; }
form.inline select { margin: 0; padding: 6px 30px 6px 10px; font-size: 13px; min-width: 200px; max-width: 260px; background-position: right 10px center; }

/* ---------- search bar ---------- */
.search { display: flex; gap: 8px; align-items: center; margin-bottom: 18px; }
.search input, .search select { margin: 0; }
.search input { flex: 1; }
.search select { width: auto; min-width: 170px; }

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid #1e1e24; vertical-align: middle; }
th { color: var(--dim); font-weight: 700; font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px; white-space: nowrap; }
tbody tr:hover { background: #101014; }
td.nowrap, .nowrap { white-space: nowrap; }
td .tiny { display: block; margin-top: 2px; }
.ellip { display: block; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

code {
  background: #0E0E11; padding: 3px 8px; border-radius: 7px; font-size: 12.5px;
  color: var(--text); font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace; white-space: nowrap;
}
code.brk { white-space: normal; word-break: break-all; }
.muted { color: var(--dim); }
.tiny { color: var(--dim); font-size: 11.5px; font-weight: 600; letter-spacing: .3px; }
a { color: var(--accent); }
td a { font-weight: 700; text-decoration: none; }
td a:hover { text-decoration: underline; }

/* ---------- status ---------- */
.flash { background: #10240f; border: 1px solid #1f6b2e; color: #86efac; padding: 13px 16px; border-radius: 12px; margin-bottom: 20px; }
.err   { background: #2a1010; border: 1px solid #7f1d1d; color: #fca5a5; padding: 13px 16px; border-radius: 12px; margin-bottom: 16px; }
.maint { background: #2e2410; border: 1px solid #a16207; color: #fcd34d; padding: 13px 16px; border-radius: 12px; margin-bottom: 20px; font-weight: 600; }
.maint a { color: #fde68a; }
.badge { display: inline-block; padding: 3px 11px; border-radius: 20px; font-size: 12px; font-weight: 700; white-space: nowrap; line-height: 1.4; }
.badge.active { background: #10240f; color: #86efac; }
.badge.suspended { background: #2e2410; color: #fcd34d; }
.badge.revoked { background: #2a1010; color: #fca5a5; }
.badge.muted { background: var(--chip); color: var(--muted); }

/* ---------- dashboard ---------- */
.stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-bottom: 20px; }
.stat { display: block; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; text-decoration: none; color: inherit; }
.stat:hover { border-color: #33333c; }
.stat .n { font-size: 28px; font-weight: 800; line-height: 1.1; }
.stat .l { color: var(--dim); font-size: 12.5px; font-weight: 600; margin-top: 4px; white-space: nowrap; }

/* ---------- line page ---------- */
.pinbox { background: #0E0E11; border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; margin: 0 0 20px; }
.pin { display: inline-block; font: 800 34px/1.1 "SF Mono", ui-monospace, Menlo, Consolas, monospace; letter-spacing: 3px; border: 2px solid var(--accent); border-radius: 12px; padding: 10px 18px; margin: 8px 0; color: #fff; background: var(--card); }
.kv { gap: 0 28px; margin-top: 4px; }
.kv > div { padding: 10px 0; border-bottom: 1px solid #1e1e24; }
.kv > div > div:last-child { margin-top: 2px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) { .stats { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 720px) {
  .wrap { padding: 0 14px 48px; }
  .card { padding: 18px; border-radius: 14px; }
  .grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .search { flex-wrap: wrap; }
  .search input { flex: 1 1 100%; }
  header { flex-direction: column; align-items: flex-start; gap: 8px; }
  form.inline select { min-width: 150px; }
}
.acts { flex-wrap: wrap; row-gap: 6px; }
.grid > button { width: auto; }

/* ---- polish pass (tables + forms) ---- */
th, td { padding: 10px 10px; }
code { font-size: 12px; padding: 3px 7px; }
.grid > button, .grid > .btnrow { justify-self: start; width: auto; grid-column: 1 / -1; }
form.inline { flex-wrap: wrap; row-gap: 6px; }
form.inline select { min-width: 150px; max-width: 190px; }
.acts { flex-wrap: wrap; row-gap: 6px; }
.acts button.small { padding: 6px 11px; }
td .badge { vertical-align: middle; }
td.assign { min-width: 260px; }
td.assign > div { margin-top: 6px; }
.card { overflow: visible; }
.tscroll { overflow-x: auto; }
td.nowrap .tiny { white-space: normal; }
code.brk { display: block; padding: 10px 12px; line-height: 1.5; margin-top: 6px; }
