/* TMA Auditor Network - admin panel. Colours are variables so light/dark mode is one place. */
:root {
  --brand: #5b3f8c; --brand-soft: #efeaf7; --brand-text: #3f2a66;
  --bg: #f6f5f9; --card: #ffffff; --line: #e3e0ea; --text: #1f1b2a; --muted: #6b6578;
  --ok: #1f7a4d; --ok-soft: #e3f4ea; --warn: #8a5a00; --warn-soft: #fbf0d9; --bad: #a32d2d; --bad-soft: #fbe7e7;
  --radius: 8px; font-family: "Segoe UI", system-ui, -apple-system, sans-serif; font-size: 14px; color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand: #a58ad6; --brand-soft: #2c2340; --brand-text: #d9ccf2;
    --bg: #15131b; --card: #1e1b26; --line: #34303f; --text: #ece9f3; --muted: #a09aae;
    --ok: #6fd3a0; --ok-soft: #173326; --warn: #f0c46a; --warn-soft: #3a2e14; --bad: #f19a9a; --bad-soft: #3d1b1b; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --brand: #a58ad6; --brand-soft: #2c2340; --brand-text: #d9ccf2;
  --bg: #15131b; --card: #1e1b26; --line: #34303f; --text: #ece9f3; --muted: #a09aae;
  --ok: #6fd3a0; --ok-soft: #173326; --warn: #f0c46a; --warn-soft: #3a2e14; --bad: #f19a9a; --bad-soft: #3d1b1b; color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
a { color: var(--brand); text-decoration: none; }
h1 { font-size: 20px; font-weight: 600; margin: 0 0 16px; }
h2 { font-size: 16px; font-weight: 600; margin: 0 0 12px; }

.layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--card); border-right: 1px solid var(--line); padding: 16px 10px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; }
.side .logo { font-weight: 700; color: var(--brand); padding: 4px 10px 16px; font-size: 15px; }
.side a { display: block; padding: 8px 10px; border-radius: var(--radius); color: var(--text); margin-bottom: 2px; }
.side a.active, .side a:hover { background: var(--brand-soft); color: var(--brand-text); }
.side .who { margin-top: auto; padding: 10px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); }
.side .who a { display: inline; padding: 0; color: var(--brand); background: none; }
.nowrap { white-space: nowrap; }
main { padding: 24px 28px; max-width: 1300px; width: 100%; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; margin-bottom: 16px; }
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.metric { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.metric .label { color: var(--muted); font-size: 12px; }
.metric .value { font-size: 24px; font-weight: 600; margin-top: 4px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.toolbar .grow { flex: 1; min-width: 200px; }
.spacer { flex: 1; }

input, select, textarea { font: inherit; color: var(--text); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 7px 10px; min-height: 34px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; }
textarea { width: 100%; min-height: 70px; }
button, .btn { font: inherit; cursor: pointer; border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: var(--radius); padding: 7px 14px; min-height: 34px; display: inline-flex; align-items: center; gap: 6px; }
button:hover, .btn:hover { border-color: var(--brand); }
button.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
button.danger { color: var(--bad); }
button.small { padding: 3px 9px; min-height: 26px; font-size: 12px; }
button:disabled { opacity: .55; cursor: wait; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--brand-soft); }
.table-wrap { overflow-x: auto; }
.num { text-align: right; white-space: nowrap; }
.muted { color: var(--muted); }
.small-text { font-size: 12px; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 12px; background: var(--brand-soft); color: var(--brand-text); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.grey { background: var(--bg); color: var(--muted); }

.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 16px; }
.form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.form label.wide { grid-column: 1 / -1; }
.form input, .form select { width: 100%; }
.actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }

.modal-bg { position: fixed; inset: 0; background: rgba(15, 10, 25, .5); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; z-index: 50; overflow-y: auto; }
.modal { background: var(--card); border-radius: 12px; padding: 20px 22px; width: 100%; max-width: 640px; border: 1px solid var(--line); }
.toast { position: fixed; bottom: 20px; right: 20px; padding: 10px 16px; border-radius: var(--radius); background: var(--text); color: var(--bg); z-index: 60; max-width: 420px; }
.toast.bad { background: var(--bad); color: #fff; }
.banner { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 16px; background: var(--warn-soft); color: var(--warn); }
.stars { color: #d39a1c; letter-spacing: 1px; }
.star-input button { border: none; background: none; font-size: 22px; padding: 0 2px; min-height: auto; color: var(--line); }
.star-input button.on { color: #d39a1c; }
.login { max-width: 360px; margin: 12vh auto; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; font-size: 13px; }
.kv div:nth-child(odd) { color: var(--muted); }

@media (max-width: 800px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; }
  .side .who { display: none; }
  main { padding: 16px; }
  .grid2 { grid-template-columns: 1fr; }
}
