/* web/admin/styles.css — internal superadmin panel. Same tokens as the product
   (bg #ffffff, fg #000000, accent #dc0812, system fonts, 8px radius); dense and
   utilitarian on purpose. No external fonts or assets. */

:root {
  --bg: #ffffff;
  --fg: #000000;
  --accent: #dc0812;
  --accent-hover: #b00f0d;
  --muted: #666666;
  --line: #e2e2e2;
  --surface: #f7f7f7;
  --radius: 8px;
  --width: 1100px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

h1 {
  font-size: 22px;
  margin: 0;
}
h2 {
  font-size: 16px;
  margin: 0;
}
h3 {
  font-size: 14px;
  margin: 0;
}
p {
  margin: 0;
}

a {
  color: var(--accent);
}

code,
pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

/* ── Layout ────────────────────────────────────────────────────────────────── */

.app {
  max-width: var(--width);
  margin: 0 auto;
  padding: 24px 16px 64px;
}

.topbar {
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.topbar-inner {
  max-width: var(--width);
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  font-weight: 700;
  letter-spacing: -0.01em;
}
.brand .brand-mark {
  color: var(--accent);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.row-end {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.grow {
  flex: 1 1 auto;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.muted {
  color: var(--muted);
}
.small {
  font-size: 12px;
}
.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}
.nowrap {
  white-space: nowrap;
}
.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.center {
  text-align: center;
}

/* ── Panels ────────────────────────────────────────────────────────────────── */

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.panel-body {
  padding: 16px;
}

/* ── Stat tiles ────────────────────────────────────────────────────────────── */

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.tile {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 16px;
}

.tile-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.tile-value {
  font-size: 28px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.tile-split {
  display: flex;
  gap: 16px;
  margin-top: 4px;
}
.tile-split-value {
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ── Tables ────────────────────────────────────────────────────────────────── */

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}

tbody tr:last-child td {
  border-bottom: none;
}

tr.clickable {
  cursor: pointer;
}
tr.clickable:hover {
  background: var(--surface);
}
tr.clickable:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* ── Definition list ───────────────────────────────────────────────────────── */

.facts {
  display: grid;
  grid-template-columns: minmax(160px, 220px) 1fr;
  gap: 0;
  margin: 0;
}

.facts dt {
  padding: 6px 12px 6px 0;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.facts dd {
  margin: 0;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}

/* ── Chips ─────────────────────────────────────────────────────────────────── */

.chip {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.chip-plus {
  border-color: #000000;
}
.chip-pro {
  border-color: var(--accent);
  color: var(--accent);
}
.chip-comp {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
  margin-left: 4px;
}
.chip-suspended {
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Forms & buttons ───────────────────────────────────────────────────────── */

label {
  font-weight: 600;
  font-size: 13px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="date"],
select {
  font: inherit;
  padding: 8px 10px;
  border: 1px solid #cccccc;
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--fg);
  min-width: 0;
}

input:focus,
select:focus {
  outline: 2px solid var(--accent);
  border-color: var(--accent);
}

.search {
  min-width: 220px;
}

.btn {
  font: inherit;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--fg);
  cursor: pointer;
  white-space: nowrap;
}

.btn:hover {
  background: var(--surface);
}
.btn:disabled {
  color: var(--muted);
  cursor: default;
  background: var(--bg);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
.btn-primary:disabled {
  background: #bbbbbb;
  border-color: #bbbbbb;
  color: #ffffff;
}

.btn-danger {
  border-color: var(--accent);
  color: var(--accent);
}
.btn-danger:hover {
  background: var(--accent);
  color: #ffffff;
}

.btn-link {
  border: none;
  background: none;
  padding: 0;
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
}

.btn-link:hover {
  background: none;
  text-decoration: underline;
}

/* ── Login ─────────────────────────────────────────────────────────────────── */

.login {
  max-width: 360px;
  margin: 10vh auto 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login .btn {
  width: 100%;
}

/* ── Messages ──────────────────────────────────────────────────────────────── */

.notice {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.notice-error {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--bg);
}

.empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--muted);
}

/* ── Dialogs ───────────────────────────────────────────────────────────────── */

dialog {
  width: min(420px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
  color: var(--fg);
  background: var(--bg);
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.4);
}

.dialog-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ── Toasts ────────────────────────────────────────────────────────────────── */

.toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 10;
}

.toast {
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--fg);
  color: #ffffff;
  max-width: 360px;
}

.toast-error {
  background: var(--accent);
  border-color: var(--accent);
}

/* ── Audit meta ────────────────────────────────────────────────────────────── */

details summary {
  cursor: pointer;
  color: var(--accent);
  font-size: 12px;
}

details pre {
  margin: 4px 0 0;
  padding: 8px;
  background: var(--surface);
  border-radius: var(--radius);
  max-width: 420px;
  overflow-x: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
