:root {
  --ok: #1a7f37; --ok-bg: #dafbe1; --warn: #9a6700; --warn-bg: #fff8c5; --bad: #cf222e; --bad-bg: #ffebe9;
  --info: #0969da; --info-bg: #ddf4ff; --muted: #656d76; --mute-bg: #eaeef2; --line: #d8dee4; --bg: #f6f8fa;
  --ink: #1f2328; --head: #24292f; --uat: #bc4c00; --dev: #0969da;
}
* { box-sizing: border-box; }
body { margin: 0; font: 13px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--ink); background: #fff; }
a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 17px; margin: 2px 0 8px; }
h2 { font-size: 14px; margin: 14px 0 6px; }
p { margin: 4px 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; word-break: break-all; }
.ok { color: var(--ok); } .warn { color: var(--warn); } .bad { color: var(--bad); }

/* header and environment tabs */
header.top { display: flex; gap: 18px; align-items: center; padding: 0 16px; height: 38px; background: var(--head); color: #fff; }
header.top a { color: #d0d7de; }
header.top a:hover, header.top a.active { color: #fff; text-decoration: none; }
.brand { font-weight: 600; color: #fff !important; }
.envs { display: flex; gap: 14px; height: 100%; }
.envs a { display: flex; align-items: center; border-bottom: 2px solid transparent; }
.envs a.active { border-bottom-color: #fff; }
.who { margin-left: auto; display: flex; gap: 10px; align-items: center; font-size: 12px; }
.who form { margin: 0; }
.role { background: #424a53; border-radius: 10px; padding: 1px 8px; }
.subnav { display: flex; gap: 2px; align-items: center; padding: 0 16px; border-bottom: 1px solid var(--line); background: var(--bg); }
.subnav a { padding: 8px 12px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.subnav a:hover { color: var(--ink); text-decoration: none; }
.subnav a.active { color: var(--ink); font-weight: 600; border-bottom-color: #fd8c73; }
.subnav .env-badge { margin-right: 10px; }
.subnav .rg { margin-left: auto; font-size: 12px; }
.env-badge { display: inline-block; font-weight: 700; font-size: 11px; letter-spacing: .04em; color: #fff; background: var(--muted);
  border-radius: 4px; padding: 2px 7px; }
.env-badge.env-uat { background: var(--uat); }
.env-badge.env-dev { background: var(--dev); }
main { padding: 12px 16px 24px; max-width: 1600px; }

/* tables */
table { border-collapse: collapse; width: 100%; margin: 6px 0; }
th, td { border-bottom: 1px solid var(--line); padding: 4px 8px; text-align: left; vertical-align: middle; }
th { background: var(--bg); font-weight: 600; font-size: 12px; color: var(--muted); position: sticky; top: 0; }
tbody tr:hover { background: #f8fafc; }
tr.nochange td { color: var(--muted); }
td.num { white-space: nowrap; }
td.arrow { color: var(--muted); width: 1%; padding: 0 2px; }
.tagname { font-weight: 600; color: var(--ink); }
.sub { display: block; font-family: system-ui, sans-serif; font-size: 11px; color: var(--muted); }
table.dim td { color: var(--muted); }

/* pills */
.pill { display: inline-block; font-size: 11px; font-weight: 600; line-height: 16px; padding: 0 7px; border-radius: 9px;
  background: var(--mute-bg); color: var(--muted); white-space: nowrap; }
.pill-running, .pill-runningatmaxscale, .pill-healthy, .pill-succeeded, .pill-ok { background: var(--ok-bg); color: var(--ok); }
.pill-processing, .pill-degraded, .pill-updating, .pill-waiting, .pill-warn, .pill-activating { background: var(--warn-bg); color: var(--warn); }
.pill-stopped, .pill-unhealthy, .pill-failed, .pill-interrupted, .pill-bad { background: var(--bad-bg); color: var(--bad); }
.pill-info { background: var(--info-bg); color: var(--info); }

/* summary strip, notices */
.summary { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; padding: 8px 12px; margin: 4px 0 8px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 6px; }
.stat b { font-size: 14px; }
.push { margin-left: auto; }
.notice { padding: 8px 12px; margin: 6px 0; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); }
.notice.warn { background: var(--warn-bg); border-color: #d4a72c; color: #4d2d00; }
.notice.bad { background: var(--bad-bg); border-color: #ff8182; color: #82071e; }

/* wizard steps */
.steps { display: flex; gap: 6px; list-style: none; padding: 0; margin: 2px 0 10px; }
.steps li { display: flex; align-items: center; gap: 6px; padding: 4px 12px 4px 6px; border-radius: 14px; background: var(--bg);
  color: var(--muted); border: 1px solid var(--line); }
.steps li span { display: inline-flex; width: 18px; height: 18px; border-radius: 50%; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; background: var(--mute-bg); }
.steps li.current { color: var(--ink); border-color: var(--info); font-weight: 600; }
.steps li.current span { background: var(--info); color: #fff; }
.steps li.done span { background: var(--ok); color: #fff; }

/* forms */
form { margin: 6px 0; }
.quick { display: flex; gap: 8px; align-items: center; margin: 4px 0 10px; }
.cols { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-start; }
fieldset { border: 1px solid var(--line); border-radius: 6px; padding: 6px 12px 8px; margin: 0; }
legend { font-weight: 600; font-size: 12px; padding: 0 4px; }
.checks { display: grid; grid-template-columns: repeat(2, minmax(190px, auto)); gap: 2px 18px; }
.checks label { display: flex; gap: 6px; align-items: center; cursor: pointer; }
.bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 10px 0 0; }
.order { margin: 4px 0 10px; padding-left: 22px; }
.order li { margin: 2px 0; }
.danger-zone { border: 1px solid #ff8182; border-radius: 6px; padding: 10px 12px; background: #fff8f8; }
.danger-zone .bar { margin-top: 8px; }
button, .button { display: inline-block; font: inherit; font-weight: 500; padding: 4px 12px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--bg); color: var(--ink); cursor: pointer; }
button:hover, .button:hover { background: #eef1f4; border-color: #afb8c1; text-decoration: none; }
button.primary, .button.primary { background: #1f883d; border-color: #1a7f37; color: #fff; }
button.primary:hover, .button.primary:hover { background: #1a7f37; }
button.danger { background: var(--bad); color: #fff; border-color: var(--bad); }
button.danger:hover { background: #a40e26; }
button.link { background: none; border: none; color: #d0d7de; text-decoration: underline; padding: 0; }
input[type=text], select { font: inherit; padding: 3px 6px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
select { max-width: 100%; }
select.mono { font-size: 12px; }

/* home */
.cards { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.card { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; min-width: 300px; }
.card-head { display: flex; gap: 10px; align-items: center; margin-bottom: 4px; }
.card-actions { display: flex; gap: 6px; margin-top: 8px; }

/* signed-out landing */
.landing { max-width: 340px; margin: 14vh auto 0; padding: 24px 20px; text-align: center; border: 1px solid var(--line); border-radius: 8px; }
.landing h1 { font-size: 20px; }
.landing .button { margin-top: 12px; padding: 7px 16px; font-weight: 600; }

/* builds */
td.actions-cell { white-space: nowrap; text-align: right; }
td.actions-cell .button { margin-left: 4px; }
table.params { width: auto; min-width: 520px; }
table.params th { position: static; text-align: right; white-space: nowrap; width: 1%; vertical-align: top; padding-top: 6px; }
table.params input[type=text], table.params select { min-width: 260px; }
button[disabled] { opacity: .5; cursor: not-allowed; }
.notice.ok-notice { background: var(--ok-bg); border-color: #4ac26b; color: #0d3b1e; }
pre.console { background: #0d1117; color: #c9d1d9; padding: 10px 12px; border-radius: 6px; font-size: 11.5px; line-height: 1.35;
  max-height: 460px; overflow: auto; white-space: pre-wrap; word-break: break-all; }

/* Sortable status board headers */
th a.sort { color: inherit; text-decoration: none; white-space: nowrap; }
th a.sort:hover { color: var(--ink); }
th a.sort.active { color: var(--ink); }
th a.sort .arrow { margin-left: 4px; font-size: 10px; }

/* App types on the status board: colour badge, row stripe and legend */
.kind { display: inline-block; font-size: 11px; font-weight: 600; line-height: 16px; padding: 0 7px; border-radius: 4px; white-space: nowrap; }
a.kind:hover { text-decoration: none; filter: brightness(.95); }
.kind-backend { background: #ddf4ff; color: #0969da; }
.kind-ui { background: #fbefff; color: #8250df; }
.kind-infra { background: #fff1e5; color: #bc4c00; }
.kind-unmanaged { background: var(--mute-bg); color: var(--muted); }
tr.row-backend td:first-child { box-shadow: inset 3px 0 #0969da; }
tr.row-ui td:first-child { box-shadow: inset 3px 0 #8250df; }
tr.row-infra td:first-child { box-shadow: inset 3px 0 #bc4c00; }
tr.row-unmanaged td:first-child { box-shadow: inset 3px 0 var(--line); }
.legend { display: flex; gap: 6px; margin: -4px 0 10px; }

/* Release list on the deploy page */
details.release { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 10px; }
details.release summary { cursor: pointer; font-weight: 600; }
details.release textarea { width: 100%; box-sizing: border-box; font-size: 12px; padding: 6px; }

/* Service page */
.svc-head { margin-bottom: 6px; }
.svc-head h1 { display: flex; align-items: center; gap: 8px; margin: 4px 0; }
.svc-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 10px 0 10px; }
.tabs a { padding: 6px 12px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.active { color: var(--ink); font-weight: 600; border-bottom-color: #fd8c73; }
.svc-grid { display: grid; grid-template-columns: minmax(320px, 1.2fr) minmax(320px, 1fr); gap: 12px; align-items: start; }
@media (max-width: 900px) { .svc-grid { grid-template-columns: 1fr; } }
.svc-grid .card { min-width: 0; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
details.action { border: 1px solid var(--line); border-radius: 6px; margin: 6px 0; }
details.action > summary { cursor: pointer; padding: 6px 10px; font-weight: 600; }
details.action[open] > summary { border-bottom: 1px solid var(--line); }
details.action > form, details.action > p { padding: 4px 10px 10px; margin: 0; }
details.action.inline { margin: 0; border: none; }
details.action.inline > summary { padding: 0; font-weight: 500; color: var(--info); }
details.action.inline[open] > summary { border: none; }
.confirm { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; }
.inline-fields { display: flex; gap: 12px; margin-top: 6px; }
input[type=number] { font: inherit; width: 64px; padding: 3px 6px; border: 1px solid var(--line); border-radius: 6px; }
.oplist { list-style: none; padding: 0; margin: 0 0 6px; }
.oplist li { margin: 3px 0; }
.action-result:empty { display: none; }
.op { border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px; margin: 6px 0; background: var(--bg); }
.op.running { border-color: var(--info); }
.op-line { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.spinner { width: 12px; height: 12px; border: 2px solid var(--line); border-top-color: var(--info); border-radius: 50%;
  display: inline-block; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: inline-block; }

/* Row action menus on the status board */
.menu-col { width: 1%; white-space: nowrap; text-align: right; }
details.rowmenu { position: relative; display: inline-block; }
details.rowmenu > summary { list-style: none; cursor: pointer; padding: 0 8px; border-radius: 4px; font-weight: 700; color: var(--muted); }
details.rowmenu > summary::-webkit-details-marker { display: none; }
details.rowmenu > summary:hover, details.rowmenu[open] > summary { background: var(--mute-bg); color: var(--ink); }
details.rowmenu .menu { position: absolute; right: 0; top: 100%; z-index: 20; min-width: 150px; background: #fff;
  border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 6px 18px rgba(31, 35, 40, .15); padding: 4px 0; text-align: left; }
details.rowmenu .menu a { display: block; padding: 5px 12px; color: var(--ink); }
details.rowmenu .menu a:hover { background: var(--bg); text-decoration: none; }

/* Storage browser */
.crumbs { margin: 4px 0 8px; padding: 6px 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; }
.small-button { padding: 1px 10px; font-size: 12px; }
table.files td a.dir { font-weight: 600; }
table.files tr.selected { background: var(--info-bg); }
.preview { margin: 6px 0 10px; }
.preview .card-head { display: flex; gap: 10px; align-items: center; }
pre.file-text { margin: 8px 0 0; padding: 10px; max-height: 60vh; overflow: auto; background: #0d1117; color: #e6edf3;
  border-radius: 6px; font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre; }

/* ---------- Colour refresh (v1.0) ----------
   A calmer palette: navy header with a warm accent, soft page background, white cards with light shadows.
   Status colours (pills) are unchanged so meaning stays the same. */
:root {
  --head: #0f2742; --head-2: #17406b; --accent: #f97316; --accent-soft: #fff1e6;
  --page: #f4f6fb; --card: #ffffff; --shadow: 0 1px 2px rgba(15, 39, 66, .06), 0 2px 8px rgba(15, 39, 66, .06);
}
body { background: var(--page); }
header.top { background: linear-gradient(90deg, var(--head), var(--head-2)); box-shadow: 0 2px 0 var(--accent); height: 42px; }
.brand { letter-spacing: .01em; }
.brand::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 2px;
  background: var(--accent); vertical-align: 1px; }
.envs a.active { border-bottom-color: var(--accent); }
.role { background: rgba(255, 255, 255, .14); }
.subnav { background: var(--card); box-shadow: var(--shadow); border-bottom: none; }
.subnav a.active, .tabs a.active { border-bottom-color: var(--accent); }
.tabs { border-bottom-color: #dfe4ee; }
.summary, .card, .crumbs { background: var(--card); border-color: #e3e8f0; box-shadow: var(--shadow); }
.card { border-radius: 10px; }
table { background: var(--card); border-radius: 8px; box-shadow: var(--shadow); }
th { background: #eef2f8; color: #4b5563; text-transform: uppercase; font-size: 11px; letter-spacing: .03em; }
th a.sort { color: inherit; }
tbody tr:hover { background: #f7f9fd; }
td, th { border-bottom-color: #edf0f5; }
details.action { background: var(--card); border-color: #e3e8f0; }
details.action > summary:hover { background: #f7f9fd; }
.op { background: var(--card); box-shadow: var(--shadow); }
.op.running { border-color: var(--accent); background: var(--accent-soft); }
.stat.ok b { color: var(--ok); } .stat.warn b { color: var(--warn); } .stat.bad b { color: var(--bad); }
.svc-head h1 { font-size: 20px; }
table.files, table.params { box-shadow: var(--shadow); }

/* Logs and shell */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin: 4px 0 10px; padding: 8px 12px;
  background: var(--card); border: 1px solid #e3e8f0; border-radius: 8px; box-shadow: var(--shadow); }
.toolbar label { display: flex; gap: 6px; align-items: center; }
.logview, .terminal { border-radius: 10px; overflow: hidden; box-shadow: var(--shadow); border: 1px solid #1f2937; }
.log-bar, .term-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 6px 10px; background: #111827; color: #e5e7eb; }
.log-bar label { color: #d1d5db; display: flex; gap: 4px; align-items: center; }
.log-bar button, .log-bar .button, .term-bar button { padding: 2px 10px; font-size: 12px; }
.log-status.ok, .term-status.ok { color: #4ade80; } .log-status.bad { color: #f87171; } .log-status.warn { color: #fbbf24; }
.log-status.muted, .term-status.muted { color: #9ca3af; }
pre.logs, pre.term-out { margin: 0; height: 60vh; overflow: auto; padding: 10px 12px; background: #0b1020; color: #e6edf3;
  font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; word-break: break-all; }
pre.term-out { height: 52vh; }
.term-in { display: flex; gap: 8px; align-items: center; padding: 6px 10px; background: #0b1020; border-top: 1px solid #1f2937; margin: 0; }
.term-in .prompt { color: #4ade80; font-family: ui-monospace, monospace; }
.term-in input { flex: 1; background: transparent; border: none; outline: none; color: #e6edf3;
  font: 13px ui-monospace, SFMono-Regular, Menlo, monospace; }
#shell-area:empty { display: none; }

/* Status board: the whole row is tinted by service type (backend blue, UI purple, infra orange, not managed grey). */
tbody tr.row-backend { background: #e6f1ff; }
tbody tr.row-ui { background: #f3e8ff; }
tbody tr.row-infra { background: #ffefe0; }
tbody tr.row-unmanaged { background: #eceef1; }
tbody tr.row-unmanaged td { color: var(--muted); }
tbody tr.row-backend:hover { background: #dcecff; }
tbody tr.row-ui:hover { background: #efe0ff; }
tbody tr.row-infra:hover { background: #ffe6d0; }
tbody tr.row-unmanaged:hover { background: #e8eaed; }
tr.row-backend td:first-child, tr.row-ui td:first-child,
tr.row-infra td:first-child, tr.row-unmanaged td:first-child { box-shadow: none; border-left: 4px solid var(--line); }
tr.row-backend td:first-child { border-left-color: #0969da; }
tr.row-ui td:first-child { border-left-color: #8250df; }
tr.row-infra td:first-child { border-left-color: #bc4c00; }
tr.row-backend .kind-backend, tr.row-ui .kind-ui, tr.row-infra .kind-infra { background: #fff; }
