/* Rocky console. One stylesheet, system fonts, light and dark from the OS, dense tables, no framework. */

:root {
  color-scheme: light dark;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --fg: #16181d;
  --muted: #6b7280;
  --border: #d9dce3;
  --border-strong: #b9bec9;
  --accent: #2456d6;
  --accent-fg: #ffffff;
  --ok: #157347;
  --ok-bg: #e3f5ea;
  --warn: #9a5b00;
  --warn-bg: #fff3d6;
  --bad: #b42318;
  --bad-bg: #fde8e6;
  --info: #1d4ed8;
  --info-bg: #e4ecff;
  --muted-bg: #eceef2;
  --code-bg: #f0f2f5;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
  --radius: 6px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121418;
    --panel: #1a1d23;
    --fg: #e6e8ec;
    --muted: #9aa1ad;
    --border: #2b3039;
    --border-strong: #3d434e;
    --accent: #7aa2ff;
    --accent-fg: #0b1020;
    --ok: #4ade80;
    --ok-bg: #11301f;
    --warn: #fbbf24;
    --warn-bg: #3a2a08;
    --bad: #f87171;
    --bad-bg: #3b1513;
    --info: #93b4ff;
    --info-bg: #1a2440;
    --muted-bg: #262a33;
    --code-bg: #0f1115;
    --shadow: none;
  }
}

* {
  box-sizing: border-box;
}

html {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  background: var(--bg);
  color: var(--fg);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  min-height: 100vh;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

code,
pre,
.mono {
  font-family: var(--mono);
  font-size: 12.5px;
}

code {
  background: var(--code-bg);
  padding: 1px 4px;
  border-radius: 3px;
}

pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  overflow: auto;
  max-height: 480px;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 8px 0;
}

h1 {
  font-size: 20px;
  margin: 0 0 12px;
}
h2 {
  font-size: 15px;
  margin: 0;
}
h3 {
  font-size: 13.5px;
  margin: 16px 0 6px;
}

.muted {
  color: var(--muted);
}
.small {
  font-size: 12.5px;
}
.right {
  text-align: right;
}
.nowrap {
  white-space: nowrap;
}
.inline {
  display: inline-block;
  margin: 0;
}

/* Header */

.top {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 5;
}

.top-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.brand {
  font-weight: 600;
  color: var(--fg);
  white-space: nowrap;
}
.brand:hover {
  text-decoration: none;
}

nav {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
  flex: 1;
}

nav a {
  color: var(--muted);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 13px;
}
nav a:hover {
  color: var(--fg);
  background: var(--muted-bg);
  text-decoration: none;
}
nav a.active {
  color: var(--fg);
  background: var(--muted-bg);
  font-weight: 600;
}

.who {
  margin-left: auto;
  font-size: 12.5px;
  color: var(--fg);
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Main */

main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  margin-bottom: 16px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.card-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
  align-items: start;
}
.grid > .card {
  margin-bottom: 0;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}
.stat {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.stat .n {
  font-size: 22px;
  font-weight: 600;
  display: block;
  line-height: 1.2;
}
.stat .l {
  color: var(--muted);
  font-size: 12px;
}

/* Flash */

.flash {
  padding: 8px 12px;
  border-radius: var(--radius);
  margin-bottom: 14px;
  border: 1px solid;
}
.flash.ok {
  background: var(--ok-bg);
  color: var(--ok);
  border-color: var(--ok);
}
.flash.err {
  background: var(--bad-bg);
  color: var(--bad);
  border-color: var(--bad);
}

/* Tables */

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table th,
.table td {
  text-align: left;
  padding: 5px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.table th {
  color: var(--muted);
  font-weight: 500;
  font-size: 12px;
  white-space: nowrap;
}
.table tr:last-child td {
  border-bottom: 0;
}
.table tbody tr:hover {
  background: var(--muted-bg);
}
.table td.num {
  text-align: right;
  font-family: var(--mono);
  font-size: 12.5px;
}
.table-wrap {
  overflow-x: auto;
}

/* Pills and badges */

.pill {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
  border: 1px solid transparent;
}
.pill.ok {
  background: var(--ok-bg);
  color: var(--ok);
}
.pill.warn {
  background: var(--warn-bg);
  color: var(--warn);
}
.pill.bad {
  background: var(--bad-bg);
  color: var(--bad);
}
.pill.info {
  background: var(--info-bg);
  color: var(--info);
}
.pill.muted {
  background: var(--muted-bg);
  color: var(--muted);
}

.level {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11.5px;
  padding: 0 5px;
  border: 1px solid var(--border-strong);
  border-radius: 3px;
}

/* Empty states */

.empty {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  color: var(--muted);
}
.empty-title {
  color: var(--fg);
  font-weight: 500;
  margin: 0 0 4px;
}
.empty p {
  margin: 0;
}

/* Forms */

form {
  margin: 0;
}

.field {
  margin-bottom: 12px;
}
.field label {
  display: block;
  font-weight: 500;
  margin-bottom: 3px;
  font-size: 13px;
}
.field.inline {
  display: flex;
  align-items: center;
  gap: 8px;
}
.field.inline label {
  margin: 0;
  font-weight: 400;
}
.help {
  color: var(--muted);
  font-size: 12px;
  margin: 3px 0 0;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="url"],
input[type="email"],
select,
textarea {
  width: 100%;
  font: inherit;
  font-size: 13.5px;
  color: var(--fg);
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  padding: 6px 8px;
}
input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="url"]:focus,
input[type="email"]:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}
textarea {
  min-height: 72px;
  resize: vertical;
}
textarea.code {
  font-family: var(--mono);
  font-size: 12.5px;
  min-height: 140px;
  white-space: pre;
  overflow-wrap: normal;
  overflow-x: auto;
}
textarea.tall {
  min-height: 420px;
}
input[type="checkbox"],
input[type="radio"] {
  width: auto;
  margin: 0;
}
select.narrow,
input.narrow {
  width: auto;
  min-width: 90px;
}

.row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0 12px;
}

.btn {
  display: inline-block;
  font: inherit;
  font-size: 13px;
  padding: 5px 11px;
  border-radius: 4px;
  border: 1px solid var(--border-strong);
  background: var(--panel);
  color: var(--fg);
  cursor: pointer;
  text-decoration: none;
  line-height: 1.4;
}
.btn:hover {
  background: var(--muted-bg);
  text-decoration: none;
}
.btn.primary {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: var(--accent);
}
.btn.primary:hover {
  filter: brightness(1.08);
}
.btn.danger {
  color: var(--bad);
  border-color: var(--bad);
}
.btn.danger:hover {
  background: var(--bad-bg);
}
.btn.small {
  font-size: 12px;
  padding: 2px 8px;
}
.btn[disabled] {
  opacity: 0.5;
  cursor: default;
}
button.link {
  font: inherit;
  font-size: 12.5px;
  background: none;
  border: 0;
  padding: 0;
  color: var(--accent);
  cursor: pointer;
}
button.link:hover {
  text-decoration: underline;
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 10px;
}

.choice {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 6px 0;
}
.choice input {
  margin-top: 4px;
}
.choice .help {
  margin: 0;
}

/* Definition lists */

.kv {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 14px;
  margin: 0;
  font-size: 13px;
}
.kv dt {
  color: var(--muted);
  white-space: nowrap;
}
.kv dd {
  margin: 0;
  overflow-wrap: anywhere;
}

/* Details */

details {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 10px;
  margin: 6px 0;
}
details > summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--fg);
}
details[open] > summary {
  margin-bottom: 6px;
}
details.plain {
  border: 0;
  padding: 0;
}

pre.json {
  max-height: 520px;
}

/* Wizard */

.wizard {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 16px;
  align-items: start;
}
.wizard-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  position: sticky;
  top: 56px;
}
.wizard-steps li a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 12px;
  color: var(--fg);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.wizard-steps li:last-child a {
  border-bottom: 0;
}
.wizard-steps li a.active {
  background: var(--muted-bg);
  font-weight: 600;
}
.wizard-steps li a:hover {
  text-decoration: none;
  background: var(--muted-bg);
}
.wizard-steps .tick {
  color: var(--ok);
  font-size: 12px;
}
.wizard-steps .todo {
  color: var(--muted);
  font-size: 12px;
}

/* Timeline */

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 13px;
}
.timeline li {
  display: grid;
  grid-template-columns: 110px 110px 1fr;
  gap: 10px;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}
.timeline li:last-child {
  border-bottom: 0;
}
.timeline .ts {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  white-space: nowrap;
}
.timeline .body {
  overflow-wrap: anywhere;
}

.msg {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  margin-bottom: 8px;
}
.msg.internal {
  border-left: 3px solid var(--info);
}
.msg.external {
  border-left: 3px solid var(--warn);
}
.msg .meta {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}
.msg .text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Landing */

.hero {
  max-width: 640px;
  margin: 48px auto;
  text-align: center;
}
.hero h1 {
  font-size: 28px;
  margin-bottom: 12px;
}
.lede {
  font-size: 15px;
  color: var(--muted);
}
.hero-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin: 20px 0;
}
.steps-overview {
  text-align: left;
  color: var(--muted);
  margin: 24px auto;
  max-width: 480px;
  padding-left: 20px;
}

/* Progress bar */

.bar {
  height: 6px;
  background: var(--muted-bg);
  border-radius: 3px;
  overflow: hidden;
  margin: 6px 0;
}
.bar > span {
  display: block;
  height: 100%;
  background: var(--accent);
}
.bar.warn > span {
  background: var(--warn);
}
.bar.bad > span {
  background: var(--bad);
}

/* Responsive */

@media (max-width: 800px) {
  .wizard {
    grid-template-columns: 1fr;
  }
  .wizard-steps {
    position: static;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }
  .wizard-steps li a {
    border-right: 1px solid var(--border);
  }
  .timeline li {
    grid-template-columns: 1fr;
    gap: 2px;
  }
  .who {
    margin-left: 0;
  }
  .kv {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .kv dt {
    margin-top: 6px;
  }
}
