/* Owner dashboard - the game's colours, calm enough to read numbers all day. */
:root {
  --bg: #f1eff9;
  --card: #ffffff;
  --line: #e2ddf3;
  --text: #1f1a3d;
  --muted: #6d6890;
  --accent: #6a4cff;
  --accent-soft: rgba(106, 76, 255, 0.14);
  --pink: #ff4fa3;
  --green: #18b67a;
  --cyan: #1fb8e6;
  --yellow: #f2b630;
  --red: #e0435f;
  --grid: #ece9f6;
  --shadow: 0 1px 2px rgba(31, 26, 61, 0.06), 0 6px 20px rgba(31, 26, 61, 0.06);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #110d24;
    --card: #1b1636;
    --line: #2e2758;
    --text: #ece9fb;
    --muted: #a39ec6;
    --accent: #8f78ff;
    --accent-soft: rgba(143, 120, 255, 0.18);
    --grid: #2a2450;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 20px rgba(0, 0, 0, 0.25);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 600 14px/1.45 Nunito, system-ui, sans-serif; }
button, input, select { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.center { text-align: center; padding: 60px 16px; }

/* header */
.top {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 12px 24px; background: var(--card); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand b { display: block; font-weight: 900; font-size: 16px; }
.site-logo { width: min(210px, 100%); height: auto; display: block; min-width: 0; }
.brand small { display: block; color: var(--muted); font-size: 12px; margin-top: -2px; }
.tabs { display: flex; gap: 4px; background: var(--bg); padding: 4px; border-radius: 999px; max-width: 100%; overflow-x: auto; }
.tabs button { white-space: nowrap; border: 0; background: none; padding: 7px 16px; border-radius: 999px; cursor: pointer; color: var(--muted); font-weight: 800; }
.tabs a { white-space: nowrap; padding: 7px 16px; border-radius: 999px; color: var(--muted); font-weight: 800; text-decoration: none; }
.tabs a:hover { color: var(--accent); }
.tabs button.on { background: var(--accent); color: #fff; }
.me { margin-left: auto; display: flex; align-items: center; gap: 10px; color: var(--muted); }

main { max-width: 1280px; margin: 0 auto; padding: 22px 24px 60px; }
h2 { margin: 0 0 4px; font-size: 18px; font-weight: 900; }
.sub { color: var(--muted); font-size: 13px; margin-bottom: 14px; }

/* KPI cards */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(190px, 100%), 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: var(--card); border-radius: 16px; padding: 16px 18px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.kpi::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--c, var(--accent)); }
.kpi .label { color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.kpi .value { font-size: 30px; font-weight: 900; line-height: 1.15; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .note { font-size: 12px; color: var(--muted); margin-top: 2px; }
.up { color: var(--green); }
.down { color: var(--red); }

/* panels */
.grid2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; margin-bottom: 16px; }
.grid2.even { grid-template-columns: 1fr 1fr; }
@media (max-width: 900px) { .grid2, .grid2.even { grid-template-columns: 1fr; } }
.panel { background: var(--card); border-radius: 16px; padding: 18px 18px 14px; box-shadow: var(--shadow); min-width: 0; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.panel-head h3 { margin: 0; font-size: 15px; font-weight: 900; }
.legend { display: flex; gap: 12px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.chart { width: 100%; height: 240px; display: block; }
.chart text { fill: var(--muted); font: 700 11px Nunito, sans-serif; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover { fill: var(--accent-soft); }

/* tables */
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; }
th.sort { cursor: pointer; user-select: none; }
th.sort:hover { color: var(--text); }
th.on { color: var(--accent); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:hover { background: var(--bg); }
.pill { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.pill.signup { background: rgba(24, 182, 122, .15); color: var(--green); }
.pill.delete { background: rgba(224, 67, 95, .15); color: var(--red); }
.pill.owner { background: var(--accent-soft); color: var(--accent); }

/* ---- feedback inbox */
.tabs .count { display: inline-block; min-width: 18px; padding: 0 6px; margin-left: 4px; border-radius: 999px; background: var(--pink); color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--bg); border-radius: 999px; padding: 6px 13px; cursor: pointer; font-weight: 800; color: var(--muted); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.pad { padding: 14px 4px; }
.small { font-size: 12px; }
.inbox { display: grid; grid-template-columns: minmax(260px, 360px) 1fr; gap: 14px; min-height: 420px; }
.inbox-list { min-width: 0; display: flex; flex-direction: column; }
.inbox-list ul { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 12px; overflow: auto; max-height: 62vh; flex: 1; }
.fb-item { padding: 10px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.fb-item:last-child { border-bottom: 0; }
.fb-item:hover { background: var(--bg); }
.fb-item.on { background: var(--accent-soft); }
.fb-item.unread { box-shadow: inset 3px 0 0 var(--pink); }
.fb-item.unread .fb-snip { color: var(--text); font-weight: 800; }
.fb-top { display: flex; align-items: center; gap: 6px; }
.fb-when { margin-left: auto; font-size: 12px; white-space: nowrap; }
.fb-snip { color: var(--muted); margin-top: 3px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.fb-meta:empty { display: none; }
.fb-meta { margin-top: 4px; }
.pill.kind-bug { background: rgba(224, 67, 95, .15); color: var(--red); }
.pill.kind-idea { background: rgba(242, 182, 48, .2); color: #a87400; }
.pill.kind-other { background: var(--accent-soft); color: var(--accent); }
.pill.kind-purchase { background: rgba(46, 158, 91, .15); color: var(--green); }
.pill.replied { background: rgba(24, 182, 122, .15); color: var(--green); }
.pill.waiting { background: rgba(255, 79, 163, .15); color: var(--pink); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pill.kind-idea { color: var(--yellow); } }
.inbox-view { min-width: 0; border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.fb-head { display: flex; flex-direction: column; gap: 2px; padding-bottom: 8px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.thread { display: flex; flex-direction: column; gap: 10px; overflow: auto; max-height: 46vh; padding: 4px 2px; }
.bubble { max-width: 85%; padding: 10px 13px; border-radius: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble .who { font-size: 11px; font-weight: 800; color: var(--muted); margin-bottom: 3px; white-space: normal; }
.bubble.them { background: var(--bg); align-self: flex-start; border-bottom-left-radius: 4px; }
.bubble.me { background: var(--accent); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.bubble.me .who { color: rgba(255, 255, 255, .8); }
.reply textarea { width: 100%; resize: vertical; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; }
.reply-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.reply-row .error { flex: 1; min-height: 0; }
.flash { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); max-width: calc(100vw - 32px); width: max-content; text-align: center; font-size: 13px; background: #1f1a3d; color: #fff; padding: 9px 16px; border-radius: 14px; box-shadow: 0 6px 18px rgba(0,0,0,.25); z-index: 30; }
@media (max-width: 760px) {
  .inbox { grid-template-columns: 1fr; }
  .inbox-list ul { max-height: 40vh; }
}

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar input { flex: 1; min-width: min(200px, 100%); padding: 9px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); }
.btn { border: 0; border-radius: 999px; padding: 8px 16px; cursor: pointer; font-weight: 800; background: var(--bg); border: 1px solid var(--line); }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { color: var(--red); }
.btn.small { padding: 4px 11px; font-size: 12px; }
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; color: var(--muted); }

.sheet { border: 0; border-radius: 18px; padding: 24px; width: min(380px, 92vw); background: var(--card); color: var(--text); box-shadow: var(--shadow); }
.sheet::backdrop { background: rgba(10, 6, 30, .55); }
.sheet label { display: block; margin: 12px 0; font-size: 13px; color: var(--muted); }
.sheet input { display: block; width: 100%; margin-top: 4px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); }
.sheet .btn { width: 100%; padding: 11px; }
.error { color: var(--red); min-height: 18px; font-size: 13px; }

.tip {
  position: fixed; z-index: 20; pointer-events: none; background: #1f1a3d; color: #fff; padding: 8px 11px; border-radius: 10px;
  font-size: 12px; line-height: 1.5; box-shadow: 0 6px 18px rgba(0, 0, 0, .25); white-space: nowrap;
}
.tip b { font-weight: 900; }

@media (max-width: 600px) {
  .top { padding: 10px 16px; }
  main { padding: 16px 16px 40px; }
  .me { margin-left: 0; }
  .top { gap: 10px; }
  .kpi .value { font-size: 26px; }
  .panel { padding: 14px 12px 10px; }
}

/* owner dashboard: the contest form */
.cform label { display: flex; flex-direction: column; gap: 5px; font-weight: 800; }
.cform input:not([type="checkbox"]), .cform textarea { width: 100%; box-sizing: border-box; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: inherit; font: inherit; font-weight: 600; }
.cform textarea { resize: vertical; }
