/* Admin panel */
body { font-size: 1rem; }
.muted { color: var(--lichen); }
.small { font-size: .88rem; }
.right { text-align: right; }

.wordmark { display: flex; align-items: center; gap: .55rem; text-decoration: none; font: 800 1.35rem/1 var(--display); }

label { display: block; margin: .9rem 0 .35rem; font-weight: 600; font-size: .93rem; }
input, select, textarea {
  width: 100%; min-height: 42px; padding: .55rem .75rem;
  background: var(--basalt); border: 1px solid var(--fern-line); border-radius: var(--r-sm);
}
textarea { resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--amber); box-shadow: 0 0 0 3px rgba(217, 164, 65, .2); }
input[type=range] { padding: 0; border: 0; background: none; box-shadow: none; accent-color: var(--blood-hi); }
.btn-sm { min-height: 34px; padding: .4rem .8rem; font-size: .9rem; }
.btn-danger { background: transparent; color: #ffb4a8; border-color: #6b2a23; }
.btn-danger:hover { background: #3a1915; border-color: #8c362d; }
form .btn { margin-top: 1rem; }
.button-row { display: flex; flex-wrap: wrap; gap: .6rem; }
.button-row .btn { margin-top: .9rem; }

/* ---- login */
.login { min-height: 100svh; display: grid; place-items: center; padding: 1.25rem;
  background: radial-gradient(900px 500px at 80% 10%, rgba(179, 38, 30, .14), transparent 60%), var(--basalt); }
.login-card { width: min(380px, 100%); padding: 2rem; background: var(--basalt-2); border: 1px solid var(--fern-line); border-radius: var(--r-md); }
.login-card h1 { margin: 1.5rem 0 .25rem; font: 800 2.2rem/1 var(--display); text-transform: uppercase; }
.login-card .btn { width: 100%; margin-top: 1.25rem; }
.form-error { margin: 1rem 0 0; padding: .6rem .8rem; background: #3a1915; color: #ffcfc7; border-radius: var(--r-sm); font-size: .93rem; }

/* ---- layout */
.app { display: grid; grid-template-columns: 236px 1fr; min-height: 100svh; }
.sidebar {
  position: sticky; top: 0; height: 100svh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 1.1rem;
  padding: 1.4rem 1rem; background: var(--basalt-2); border-right: 1px solid var(--fern-line);
}
.server-state { display: flex; align-items: center; gap: .5rem; margin: 0; padding: .55rem .7rem; background: var(--basalt); border-radius: var(--r-sm); font-size: .9rem; font-weight: 600; }
.dot { width: .6rem; height: .6rem; border-radius: 50%; background: var(--lichen); flex: none; }
.is-online .dot { background: var(--blood-hi); }
.is-offline .dot { background: var(--amber); }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a { padding: .55rem .7rem; border-radius: var(--r-sm); text-decoration: none; color: var(--lichen); font-weight: 600; }
.sidebar nav a:hover { color: var(--bone); background: var(--fern); }
.sidebar nav a[aria-current=page] { color: var(--bone); background: var(--fern); box-shadow: inset 3px 0 0 var(--blood); }
.whoami { margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--fern-line); }
.whoami p { margin: 0 0 .6rem; display: flex; flex-direction: column; }
.whoami span { color: var(--lichen); font-size: .88rem; text-transform: capitalize; }

.content { padding: 1.75rem clamp(1.25rem, 3vw, 2.75rem) 4rem; min-width: 0; max-width: 1180px; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.page-head h1 { margin: 0; font: 800 clamp(2rem, 4vw, 2.75rem)/1 var(--display); text-transform: uppercase; }
.head-tools { display: flex; gap: .6rem; }
.head-tools input { width: min(320px, 60vw); }
.page-note { max-width: 70ch; margin: -.25rem 0 1.25rem; }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: .9rem 1rem; }
  .sidebar nav { flex-direction: row; overflow-x: auto; width: 100%; order: 3; padding-bottom: .25rem; }
  .sidebar nav a { white-space: nowrap; }
  .sidebar nav a[aria-current=page] { box-shadow: inset 0 -3px 0 var(--blood); }
  .whoami { margin: 0 0 0 auto; padding: 0; border: 0; display: flex; align-items: center; gap: .75rem; }
  .whoami p { margin: 0; }
  .server-state { order: 2; }
}

/* ---- panels */
.panel { padding: 1.3rem 1.4rem 1.4rem; background: var(--basalt-2); border: 1px solid var(--fern-line); border-radius: var(--r-md); margin-bottom: 1.25rem; min-width: 0; }
.panel h2 { margin: 0 0 .4rem; font-size: 1.12rem; font-weight: 700; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 0 1.25rem; }
.narrow { max-width: 460px; }

.status-line { margin: 0 0 1.25rem; font-size: 1.15rem; font-weight: 600; }

/* chart */
.chart { height: 190px; margin-top: .75rem; }
.chart svg { width: 100%; height: 100%; }
.chart .grid line { stroke: var(--fern-line); stroke-dasharray: 2 4; }
.chart .axis text { fill: var(--lichen); font: 500 11px var(--body); }
.chart .area { fill: rgba(179, 38, 30, .18); }
.chart .line { fill: none; stroke: var(--blood-hi); stroke-width: 2; stroke-linejoin: round; }
.chart .empty { fill: var(--lichen); font: 500 14px var(--body); }

.feed { list-style: none; margin: .5rem 0 0; padding: 0; }
.feed li { display: grid; grid-template-columns: 1fr auto; gap: .1rem 1rem; padding: .6rem 0; border-top: 1px solid var(--fern-line); font-size: .93rem; }
.feed li:first-child { border-top: 0; }
.feed .when { color: var(--lichen); font-size: .85rem; white-space: nowrap; }
.feed .what { overflow-wrap: anywhere; }
.feed-empty { color: var(--lichen); }

/* tables */
.table-wrap { overflow-x: auto; background: var(--basalt-2); border: 1px solid var(--fern-line); border-radius: var(--r-md); }
.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th { text-align: left; padding: .75rem 1rem; color: var(--lichen); font-weight: 600; font-size: .86rem; border-bottom: 1px solid var(--fern-line); white-space: nowrap; }
.table td { padding: .7rem 1rem; border-top: 1px solid var(--fern-line); vertical-align: middle; }
.table tbody tr:first-child td { border-top: 0; }
.table tbody tr:hover td { background: rgba(44, 54, 39, .45); }
.table .right { text-align: right; }
.table .actions { display: flex; gap: .4rem; justify-content: flex-end; flex-wrap: wrap; }
.table .empty-row td { padding: 2rem 1rem; color: var(--lichen); text-align: center; }
.steamid { font-variant-numeric: tabular-nums; color: var(--lichen); background: none; border: 0; padding: 0; cursor: copy; }
.steamid:hover { color: var(--bone); text-decoration: underline; }
.player-name { font-weight: 600; }
.result-ok { color: var(--moss); font-weight: 600; }
.result-fail { color: #ff9b8e; font-weight: 600; }
.nowrap { white-space: nowrap; }
.wrap-any { overflow-wrap: anywhere; max-width: 42ch; }
.role-pill { display: inline-block; padding: .15rem .55rem; border-radius: 999px; background: var(--fern); font-size: .82rem; font-weight: 600; text-transform: capitalize; }
.role-owner { background: #3a1915; color: #ffcfc7; }

@media (max-width: 640px) {
  .stack-mobile thead { display: none; }
  .stack-mobile tr { display: grid; gap: .2rem; padding: .85rem 1rem; border-top: 1px solid var(--fern-line); }
  .stack-mobile tbody tr:first-child { border-top: 0; }
  .stack-mobile td { padding: 0; border: 0; }
  .stack-mobile .actions { justify-content: flex-start; margin-top: .5rem; }
  .stack-mobile .empty-row { display: block; }
  .stack-mobile .empty-row td { display: block; padding: 1.5rem 0; }
}

/* messages */
.counter { margin: .35rem 0 0; text-align: right; font-size: .85rem; color: var(--lichen); }
.presets { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .75rem; }
.chip { padding: .4rem .7rem; background: var(--basalt); border: 1px solid var(--fern-line); border-radius: 999px; font-size: .86rem; cursor: pointer; text-align: left; }
.chip:hover { border-color: var(--lichen); }

/* world */
.settings { list-style: none; margin: .25rem 0 0; padding: 0; }
.settings li { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .75rem 0; border-top: 1px solid var(--fern-line); flex-wrap: wrap; }
.settings li:first-child { border-top: 0; }
.settings .desc { color: var(--lichen); font-size: .9rem; display: block; }
.settings .button-row .btn { margin-top: 0; }
.range-row { display: flex; align-items: center; gap: 1rem; margin-top: .75rem; }
.range-row output { font-weight: 700; min-width: 3.2rem; text-align: right; font-variant-numeric: tabular-nums; }

/* console */
.console-row { display: flex; gap: 1rem; align-items: flex-end; flex-wrap: wrap; }
.console-row .grow { flex: 1 1 260px; }
.console-row label { margin-top: 0; }
.console-row .btn { margin-top: 0; }
.console-form { margin-bottom: 1rem; }
.console-out { min-height: 220px; max-height: 60vh; overflow-y: auto; padding: 1rem 1.2rem; background: #12150f; border: 1px solid var(--fern-line); border-radius: var(--r-md); font: 500 .92rem/1.55 ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; }
.console-out .entry { margin-bottom: .9rem; }
.console-out .cmd { color: var(--amber); }
.console-out pre { margin: .2rem 0 0; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--bone); font: inherit; }
.console-out .err { color: #ff9b8e; }
.console-out:empty::before { content: "Results show up here."; color: var(--lichen); }

/* admins */
.roles-help { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .75rem; margin-bottom: 1.25rem; }
.roles-help p { margin: 0; padding: .8rem 1rem; background: var(--basalt-2); border-left: 3px solid var(--fern-line); font-size: .93rem; color: var(--lichen); }
.roles-help strong { color: var(--bone); }
.table select { width: auto; min-height: 34px; padding: .3rem .5rem; }

/* dialog */
.dialog { width: min(480px, calc(100% - 2rem)); padding: 0; background: var(--basalt-2); color: var(--bone); border: 1px solid var(--fern-line); border-radius: var(--r-md); }
.dialog::backdrop { background: rgba(10, 12, 9, .7); }
.dialog form { padding: 1.5rem; }
.dialog h2 { margin: 0 0 .5rem; font: 800 1.7rem/1.05 var(--display); text-transform: uppercase; }
.dialog p { margin: .5rem 0; }
.dialog-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1.25rem; }
.dialog-actions .btn { margin-top: 0; }
.secret { display: flex; gap: .5rem; align-items: center; margin-top: .75rem; padding: .6rem .8rem; background: var(--basalt); border: 1px dashed var(--amber); border-radius: var(--r-sm); font: 600 1.05rem/1.3 ui-monospace, Menlo, Consolas, monospace; overflow-wrap: anywhere; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: .75rem 0 0; }
.kv dt { color: var(--lichen); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

/* toasts */
.toasts { position: fixed; right: 1rem; bottom: 1rem; display: flex; flex-direction: column; gap: .5rem; z-index: 50; max-width: min(420px, calc(100% - 2rem)); }
.toast { padding: .8rem 1rem; background: var(--fern); border-left: 4px solid var(--moss); border-radius: var(--r-sm); box-shadow: 0 8px 24px rgba(0, 0, 0, .35); font-size: .95rem; animation: toast-in .18s ease-out; }
.toast.error { border-left-color: var(--blood-hi); background: #3a1915; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
