/* srvctl panel. No inline styles anywhere (the CSP allows only this file). */
:root {
  --bg: #f6f7f5;
  --surface: #ffffff;
  --surface-2: #f0f2ef;
  --border: #dfe3dd;
  --text: #1d2420;
  --muted: #66706a;
  --accent: #2f6f5e;
  --accent-text: #ffffff;
  --good: #1f7a4d;
  --good-bg: #e3f3e9;
  --warn: #8a5a00;
  --warn-bg: #fbf0d9;
  --bad: #b3261e;
  --bad-bg: #fbe5e3;
  --neutral-bg: #eceeea;
  --code-bg: #f3f4f1;
  --shadow: 0 1px 2px rgba(20, 30, 25, 0.06);
  --radius: 8px;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121614;
    --surface: #1a1f1c;
    --surface-2: #212724;
    --border: #2d3531;
    --text: #e3e8e4;
    --muted: #93a099;
    --accent: #5fb39a;
    --accent-text: #0c1411;
    --good: #6fcf97;
    --good-bg: #173426;
    --warn: #f2c26b;
    --warn-bg: #3a2e14;
    --bad: #f28b82;
    --bad-bg: #3d1d1b;
    --neutral-bg: #262d29;
    --code-bg: #151a17;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0.1rem 0 0.4rem; }
h2 { font-size: 1.1rem; margin: 1.4rem 0 0.6rem; }
.card > h2:first-child, .row > h2 { margin-top: 0; }
h3 { font-size: 0.95rem; margin: 1rem 0 0.4rem; }
code, pre, .mono { font-family: var(--mono); font-size: 0.86em; }
code { background: var(--code-bg); padding: 0.1em 0.35em; border-radius: 4px; }
pre { background: var(--code-bg); padding: 0.75rem; border-radius: 6px; overflow: auto; margin: 0.5rem 0; white-space: pre-wrap; word-break: break-word; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.nowrap { white-space: nowrap; }
.bad-text { color: var(--bad); }

/* Layout */
.shell { display: grid; grid-template-columns: 210px 1fr; min-height: 100vh; }
.sidebar {
  display: flex; flex-direction: column; gap: 2px;
  padding: 1rem 0.75rem; background: var(--surface); border-right: 1px solid var(--border);
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; font-size: 1.1rem; color: var(--text); padding: 0.2rem 0.6rem 1rem; }
.brand:hover { text-decoration: none; }
.nav { display: block; padding: 0.45rem 0.6rem; border-radius: 6px; color: var(--text); }
.nav:hover { background: var(--surface-2); text-decoration: none; }
.nav.active { background: var(--surface-2); color: var(--accent); font-weight: 600; }
.nav-spacer { flex: 1; }
.host { font-size: 0.8rem; color: var(--muted); padding: 0.6rem 0.6rem 0; word-break: break-all; }
.content { padding: 1.5rem 2rem 3rem; max-width: 1200px; width: 100%; }
.bare { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.row { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.row.spread { justify-content: space-between; }
.grow { flex: 1; min-width: 12rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.columns { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.columns > .card { margin-bottom: 0; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .new-btn { margin: 0 0.5rem 0 0; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; border-right: 0; border-bottom: 1px solid var(--border); padding: 0.5rem 1rem; }
  .brand { padding: 0.2rem 0.6rem; }
  .nav-spacer, .host { display: none; }
  .content { padding: 1rem; }
  .grid2, .columns { grid-template-columns: 1fr; }
  .hide-sm { display: none; }
}

/* Surfaces */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1rem 1.25rem; margin-bottom: 1rem; box-shadow: var(--shadow);
}
.card.flush { padding: 0; overflow-x: auto; }
.card.signin { width: min(420px, 100%); text-align: center; padding: 2rem; }
.card.signin .field { text-align: left; }
.danger-zone { border-color: var(--bad-bg); }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.9rem 1.1rem; box-shadow: var(--shadow); }
.tile-label { color: var(--muted); font-size: 0.85rem; }
.tile-value { font-size: 1.35rem; font-weight: 600; margin: 0.15rem 0; font-variant-numeric: tabular-nums; }
.tile-sub { color: var(--muted); font-size: 0.8rem; }

.meter { height: 6px; background: var(--neutral-bg); border-radius: 3px; overflow: hidden; margin: 0.35rem 0; }
.meter-fill { height: 100%; background: var(--good); }
.meter.warn .meter-fill { background: var(--warn); }
.meter.bad .meter-fill { background: var(--bad); }
.w-0 { width: 0 } .w-5 { width: 5% } .w-10 { width: 10% } .w-15 { width: 15% } .w-20 { width: 20% } .w-25 { width: 25% }
.w-30 { width: 30% } .w-35 { width: 35% } .w-40 { width: 40% } .w-45 { width: 45% } .w-50 { width: 50% } .w-55 { width: 55% }
.w-60 { width: 60% } .w-65 { width: 65% } .w-70 { width: 70% } .w-75 { width: 75% } .w-80 { width: 80% } .w-85 { width: 85% }
.w-90 { width: 90% } .w-95 { width: 95% } .w-100 { width: 100% }

/* Tables */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 0.55rem 0.9rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { font-size: 0.8rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; background: var(--surface-2); }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { text-align: right; white-space: nowrap; }
.table .empty { text-align: center; color: var(--muted); padding: 1.5rem; }
.card:not(.flush) .table th, .card:not(.flush) .table td { padding-left: 0.5rem; padding-right: 0.5rem; }
.app-link { font-weight: 600; }
.type { font-family: var(--mono); font-size: 0.82rem; color: var(--muted); }
.cmd { white-space: pre-wrap; word-break: break-word; }

/* Badges */
.badge { display: inline-block; padding: 0.05rem 0.5rem; border-radius: 999px; font-size: 0.8rem; font-weight: 600; white-space: nowrap; background: var(--neutral-bg); color: var(--muted); }
.badge.good { background: var(--good-bg); color: var(--good); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }

/* Controls */
.btn {
  font: inherit; font-size: 0.9rem; font-weight: 500; cursor: pointer;
  padding: 0.4rem 0.85rem; border-radius: 6px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); display: inline-block;
}
.btn:hover:not(:disabled) { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover:not(:disabled) { background: var(--accent); filter: brightness(1.08); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.small { font-size: 0.82rem; padding: 0.25rem 0.6rem; }
.btn.wide { width: 100%; padding: 0.7rem; font-size: 1rem; margin-top: 1rem; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 6px; padding: 0.4rem 0.6rem;
}
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea.code { width: 100%; font-family: var(--mono); font-size: 0.85rem; background: var(--code-bg); resize: vertical; tab-size: 2; }
.field { display: flex; flex-direction: column; gap: 0.25rem; margin: 0.5rem 0 0.75rem; }
.field > span { font-size: 0.85rem; font-weight: 600; }
.field.inline { flex-direction: row; align-items: center; margin: 0; gap: 0.4rem; }
.field.inline > span { font-weight: 500; color: var(--muted); }
.check { display: flex; gap: 0.4rem; align-items: center; margin: 0.25rem 0 0.75rem; }
.confirm { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.75rem 1rem; text-align: left; }
.confirm p { margin: 0 0 0.5rem; }

/* Tabs */
.tabs { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; overflow-x: auto; }
.tab { padding: 0.5rem 0.9rem; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

/* Facts */
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.4rem 1.25rem; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.facts.compact { gap: 0.15rem 0.9rem; font-size: 0.9rem; margin-top: 0.6rem; }

/* Alerts and outcomes */
.alert { padding: 0.7rem 1rem; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); margin-bottom: 1rem; }
.alert.error { background: var(--bad-bg); border-color: var(--bad-bg); color: var(--bad); }
.outcome { border: 1px solid var(--border); border-left: 4px solid var(--good); border-radius: var(--radius); background: var(--surface); padding: 0.75rem 1rem; margin-bottom: 1rem; }
.outcome.failed { border-left-color: var(--bad); }
.outcome pre.text { margin: 0.4rem 0 0; }
.outcome .errors { color: var(--bad); margin: 0.4rem 0; }
.steps { list-style: none; padding: 0; margin: 0.5rem 0 0; }
.step { padding: 0.3rem 0; border-top: 1px solid var(--border); }
.step:first-child { border-top: 0; }
.step-status { display: inline-block; min-width: 5.5rem; font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; color: var(--good); }
.step.warn .step-status { color: var(--warn); }
.step.bad .step-status { color: var(--bad); }
.step.neutral .step-status { color: var(--muted); }
.step details { margin: 0.2rem 0 0 5.5rem; }
.step summary { cursor: pointer; color: var(--muted); font-size: 0.85rem; }
pre.diff { max-height: 360px; }
.warning { color: var(--warn); margin: 0.4rem 0 0; }
.status { min-height: 1.5em; margin: 0.75rem 0 0; }
.status.error { color: var(--bad); }

/* Logs */
.log-controls { margin-bottom: 0.6rem; }
.log {
  background: var(--code-bg); border: 1px solid var(--border); border-radius: var(--radius);
  font-family: var(--mono); font-size: 0.8rem; line-height: 1.45;
  height: 60vh; overflow: auto; padding: 0.5rem 0.75rem; white-space: pre-wrap; word-break: break-word;
}
.log-time { color: var(--muted); margin-right: 0.75rem; }
.log-line.p0, .log-line.p1, .log-line.p2, .log-line.p3 { color: var(--bad); }
.log-line.p4 { color: var(--warn); }
.live { font-size: 0.8rem; font-weight: 700; color: var(--good); }
.live::before { content: "● "; }

/* Minecraft */
.worlds { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.card.world { color: var(--text); display: block; }
.card.world:hover { border-color: var(--accent); text-decoration: none; }
.chips { list-style: none; padding: 0; margin: 0.25rem 0 0.6rem; display: flex; flex-wrap: wrap; gap: 0.35rem; }
.chips li { background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 0.1rem 0.25rem 0.1rem 0.7rem; font-size: 0.88rem; display: flex; align-items: center; gap: 0.2rem; }
.chips li.muted { padding-right: 0.7rem; }
.chip-x { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 1rem; line-height: 1; padding: 0 0.35rem; border-radius: 999px; }
.chip-x:hover { color: var(--bad); background: var(--bad-bg); }

/* Blazor's reconnect UI (the classes are set by blazor.web.js). */
.reconnect { display: none; }
.reconnect.components-reconnect-show, .reconnect.components-reconnect-failed, .reconnect.components-reconnect-rejected {
  display: grid; place-items: center; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.35); z-index: 1000;
}
.reconnect-box { background: var(--surface); border-radius: var(--radius); padding: 1.25rem 1.5rem; box-shadow: 0 6px 30px rgba(0, 0, 0, 0.25); }
.reconnect-box p { display: none; margin: 0; }
.components-reconnect-show .reconnect-show, .components-reconnect-failed .reconnect-failed, .components-reconnect-rejected .reconnect-rejected { display: block; }

/* New: pick what you're setting up */
.kinds { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.card.kind { display: flex; flex-direction: column; gap: 0.35rem; color: var(--text); margin: 0; }
.card.kind strong { font-size: 1.05rem; }
.card.kind:hover { border-color: var(--accent); text-decoration: none; }
.new-btn { margin: 0 0.25rem 0.75rem; text-align: center; }
.empty-state { text-align: center; padding: 2rem; }

/* Forms */
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 1rem; }
.grid2 > .check, .grid3 > .check { margin-top: 1.9rem; }
fieldset.plain { border: 0; padding: 0; margin: 0; min-width: 0; }
input.narrow { width: 5rem; }
.chip-input .chips { margin-bottom: 0.4rem; }
.chip-input .row input { flex: 1; min-width: 12rem; }
table.env input { width: 100%; }
table.env td { padding: 0.3rem 0.4rem; }
.sticky-actions { position: sticky; bottom: 0; z-index: 5; box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.06); }
.choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; margin: 0.5rem 0 1rem; }
.choice { display: flex; flex-direction: column; gap: 0.2rem; border: 1px solid var(--border); border-radius: var(--radius); padding: 0.75rem 0.9rem; cursor: pointer; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice.selected { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.choice:hover { border-color: var(--accent); }
details.card > summary { cursor: pointer; color: var(--muted); }

/* Minecraft console */
.console-input { margin-top: 0.6rem; }
.console-input input { font-family: var(--mono); }

@media (max-width: 860px) {
  .grid3, .choices { grid-template-columns: 1fr; }
  .grid2 > .check, .grid3 > .check { margin-top: 0.25rem; }
}
