:root {
  --bg: #f4f6fa; --card: #fff; --ink: #0b1f3a; --muted: #6b7486; --line: #e3e7ef;
  --navy: #0b1f3a; --gold: #c9a227; --green: #137a4b; --red: #b42318; --amber: #b54708; --blue: #1d4ed8;
  --green-bg: #e7f6ee; --red-bg: #fdecea; --amber-bg: #fff4e5; --blue-bg: #e8efff; --gray-bg: #eef0f4;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.6 system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif; }
a { color: var(--blue); text-decoration: none; }
h1 { font-size: 22px; margin: 0 0 14px; }
h2 { font-size: 16px; margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.red { color: var(--red); }
.center { text-align: center; }
.mono { font-family: ui-monospace, Menlo, monospace; word-break: break-all; }

.top { display: flex; align-items: center; gap: 12px; padding: 10px 18px; background: var(--navy); color: #fff; }
.top .brand { color: #fff; font-weight: 700; font-size: 17px; }
.top .brand::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 2px; background: var(--gold); margin-left: 8px; }
.top .who { margin-inline-start: auto; opacity: .85; }
.top form { margin: 0; }
.shell { display: flex; min-height: calc(100vh - 48px); }
.side { width: 220px; flex: none; background: #fff; border-left: 1px solid var(--line); padding: 12px 8px; }
.side a, .side .soon { display: block; padding: 7px 12px; border-radius: 8px; color: var(--ink); }
.side a.on, .side a:hover { background: var(--blue-bg); }
.side .soon { color: var(--muted); font-size: 13px; padding: 4px 12px; }
.side .sep { font-size: 12px; color: var(--muted); margin: 14px 12px 4px; }
.main { flex: 1; padding: 20px; min-width: 0; }
.main.solo { min-height: 100vh; display: grid; place-items: center; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 14px; }
.card.flush { padding: 0; overflow-x: auto; }
.card.flush h2 { padding: 14px 16px 0; }
.card.center { text-align: center; max-width: 440px; }
.login .logo { font-size: 26px; font-weight: 800; margin-bottom: 4px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { display: block; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px; color: var(--ink); }
.tile b { display: block; font-size: 28px; }
.tile span { font-size: 13px; color: var(--muted); }
.tile.bad { border-color: var(--red); background: var(--red-bg); }
.tile.warn { border-color: var(--amber); background: var(--amber-bg); }
.tile.good b { color: var(--green); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: right; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 13px; color: var(--muted); font-weight: 600; background: #fafbfd; }
tr.row-red td { background: var(--red-bg); }

.pill { display: inline-block; padding: 1px 9px; border-radius: 99px; font-size: 12px; background: var(--gray-bg); color: var(--muted); white-space: nowrap; }
.pill.green { background: var(--green-bg); color: var(--green); }
.pill.red { background: var(--red-bg); color: var(--red); }
.pill.amber { background: var(--amber-bg); color: var(--amber); }
.pill.blue { background: var(--blue-bg); color: var(--blue); }

.btn { display: inline-block; border: 0; border-radius: 8px; background: var(--navy); color: #fff; padding: 8px 14px; font: inherit; cursor: pointer; }
.btn.sm { padding: 4px 10px; font-size: 13px; }
.btn.big { padding: 12px 26px; font-size: 16px; margin: 14px 0; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.top .btn.ghost { color: #fff; border-color: rgba(255,255,255,.3); }
.btn.red { background: var(--red); }
.btn[disabled] { opacity: .4; cursor: not-allowed; }

input, select { font: inherit; padding: 6px 9px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.filters input[name="q"], .filters input[name="reason"] { min-width: 220px; }
form.inline { display: inline; }
.settings { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; align-items: end; }
.settings .head-row, .settings .wide { grid-column: 1 / -1; }
.settings label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.chips a { padding: 4px 12px; border-radius: 99px; background: #fff; border: 1px solid var(--line); color: var(--ink); font-size: 13px; }
.chips a.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.head-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 10px; }
.head-row h1 { margin: 0; }

.flash { padding: 10px 14px; border-radius: 10px; margin-bottom: 12px; background: var(--blue-bg); }
.flash.success { background: var(--green-bg); }
.flash.danger { background: var(--red-bg); }
.flash pre { background: #fff; padding: 10px; border-radius: 8px; overflow-x: auto; }

.subs td.actions { white-space: nowrap; }
.subs td.actions form { display: inline; }
details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }
.actions details { display: inline-block; position: relative; }
.actions .pop { position: absolute; left: 0; z-index: 5; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px; width: 340px; display: grid; gap: 10px; box-shadow: 0 8px 24px rgba(11,31,58,.12); }
.actions .pop form { display: flex !important; flex-wrap: wrap; gap: 6px; }
.actions .pop input { flex: 1; min-width: 150px; }
.danger-zone { border-top: 1px dashed var(--red); padding-top: 8px; }
.member summary { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.member[open] summary { margin-bottom: 12px; }
.perms td { padding: 6px 10px; }

@media (max-width: 760px) {
  .shell { display: block; }
  .side { width: auto; display: flex; overflow-x: auto; gap: 4px; border: 0; border-bottom: 1px solid var(--line); }
  .side a, .side .soon { white-space: nowrap; }
  .side .sep, .side .soon { display: none; }
  .main { padding: 14px; }
  .actions .pop { position: static; width: auto; }
}
