.denied { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px; text-align: center; }
.denied h1 { margin: 6px 0 0; font-size: 24px; }
.denied a { text-decoration: none; }

.admin { min-height: 100dvh; display: flex; flex-direction: column; }
.admin-top {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; display: flex; align-items: center; gap: 16px;
  padding: 10px 20px; background: var(--bg); border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.admin-top .btn { text-decoration: none; margin-left: auto; }
.admin-tabs { display: flex; gap: 2px; overflow-x: auto; }
.admin-tabs button { height: 34px; padding: 0 12px; border: 0; border-radius: 9px; background: transparent; color: var(--fg-2); font-weight: 500; white-space: nowrap; }
.admin-tabs button:hover { background: var(--bg-hover); }
.admin-tabs button[aria-selected="true"] { background: var(--bg-hover); color: var(--fg); }
.admin-main { width: 100%; max-width: 1240px; margin: 0 auto; padding: 18px 20px 48px; }
.admin-main h2 { font-size: 17px; margin: 26px 0 8px; }
.admin-main h3 { font-size: 15px; margin: 20px 0 8px; }
.admin-main section > h2:first-child { margin-top: 4px; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.gap-top { margin-top: 12px; }
.card { padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; }
.card b { display: block; font-size: 22px; font-weight: 650; letter-spacing: -.01em; }
.card span { font-size: 13px; color: var(--fg-2); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; color: var(--fg-2); background: var(--bg-side); position: sticky; top: 0; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.clickable tbody tr { cursor: pointer; }
table.clickable tbody tr:hover, table.clickable tbody tr.active { background: var(--bg-hover); }
.pos { color: #2e7d32; }
.neg { color: var(--danger); }
.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--bg-soft); font-size: 12px; color: var(--fg-2); white-space: nowrap; }
.tag.ok { background: color-mix(in srgb, #2e7d32 16%, transparent); color: #2e7d32; }
.tag.bad { background: var(--danger-soft); color: var(--danger); }
:root[data-theme="dark"] .pos, :root[data-theme="dark"] .tag.ok { color: #7bd389; }

.split { display: grid; grid-template-columns: minmax(280px, 400px) 1fr; gap: 18px; align-items: start; }
.col-list { display: flex; flex-direction: column; gap: 10px; }
.col-detail { min-width: 0; }
.detail-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.detail-head h2 { margin: 0; }
.forms { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; margin-top: 14px; }
.box { display: flex; flex-direction: column; gap: 8px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; }
.box b { font-size: 14px; }
.box input, .box select { height: 38px; }
.box select { padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.box .row2 { display: flex; gap: 8px; }
.box .row2 > * { flex: 1; min-width: 0; }
.box .btn { height: 36px; }

.plan-forms { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
#matrix input[type="number"] { width: 88px; height: 32px; padding: 0 8px; }
#matrix select { height: 32px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); padding: 0 6px; }
#matrix td { white-space: nowrap; }
#matrix .cellbox { display: flex; flex-direction: column; gap: 4px; }
#matrix label { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--fg-2); }
#matrix .btn { height: 30px; padding: 0 10px; font-size: 12.5px; }

.inline-form { display: flex; gap: 8px; max-width: 560px; align-items: center; flex-wrap: wrap; }
.inline-form.wide { max-width: 980px; }
.inline-form.wide input { flex: 1 1 200px; }
.box textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--fg); font: 14px/1.5 var(--font); resize: vertical; }
.small-btn { height: 30px; padding: 0 10px; font-size: 12.5px; }
#source-table select { height: 32px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); padding: 0 6px; }
.field-inline { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--fg-2); }
.field-inline input { width: auto; flex: 1; }
.field-inline input[type="number"] { width: 80px; flex: none; }
#post-form, #ad-form { position: sticky; top: 70px; }
.inline-form input { flex: 1; }
.pull { padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; margin-top: 8px; font-size: 14px; }
.bar { height: 6px; border-radius: 3px; background: var(--bg-soft); overflow: hidden; margin-top: 6px; }
.bar i { display: block; height: 100%; background: var(--accent); }
pre.details { margin: 0; white-space: pre-wrap; font: 12px/1.45 var(--mono); color: var(--fg-2); max-width: 520px; }

@media (max-width: 860px) {
  .split { grid-template-columns: 1fr; }
  .admin-top .btn { margin-left: 0; }
}
