/* appctl-portal - one stylesheet, no framework and no CDN.
   The console runs behind an authenticated proxy on a host that faces the
   internet, so nothing here is fetched from anywhere else. */

:root {
  --bg: #0f1116;
  --panel: #171a21;
  --panel-2: #1d2129;
  --line: #2a2f3a;
  --text: #e6e9ef;
  --muted: #98a1b3;
  --accent: #4c8dff;
  --ok: #35c07a;
  --warn: #e0a458;
  --err: #e5657a;
  --radius: 8px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  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; }

header.top {
  display: flex; align-items: center; gap: 20px;
  padding: 10px 20px; background: var(--panel); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
header.top .brand { font-weight: 600; letter-spacing: .2px; }
header.top .brand span { color: var(--muted); font-weight: 400; }
nav a { margin-right: 14px; color: var(--muted); }
nav a.active, nav a:hover { color: var(--text); }
header.top .who { margin-left: auto; color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 12px; }

main { max-width: 1180px; margin: 0 auto; padding: 20px; }

h1 { font-size: 20px; margin: 0 0 4px; }
h2 { font-size: 15px; margin: 24px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
p.lead { color: var(--muted); margin-top: 0; }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 16px;
}
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.stat { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.stat .k { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.stat .v { font-size: 22px; font-variant-numeric: tabular-nums; }
.stat .v small { font-size: 12px; color: var(--muted); }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
tr:last-child td { border-bottom: 0; }
td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
td.actions { white-space: nowrap; text-align: right; }
/* A row of buttons and forms in a table cell wraps instead of widening the table
   past the card it sits in. */
.cell-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: flex-end; }
.cell-actions select { width: auto; }
.cell-actions > form { display: inline-flex; }
/* Secondary actions in a table: compact, so a row of them fits the column. */
td .cell-actions button, td .cell-actions select { min-height: 30px; font-size: 12.5px; padding: 2px 9px; }

.badge {
  display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--muted);
  white-space: nowrap;
}
.badge.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); }
.badge.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, var(--line)); }
.badge.err { color: var(--err); border-color: color-mix(in srgb, var(--err) 40%, var(--line)); }

/* Inputs, selects and buttons share one height (an input's: 7px padding around a
   15px/1.5 line plus its border), so a row of them lines up instead of each
   sitting a few pixels off its neighbours. */
input:not([type=checkbox]):not([type=radio]), select, button, .btn { min-height: 38px; }

button, .btn {
  font: inherit; font-size: 13px; cursor: pointer; padding: 5px 11px; border-radius: 6px;
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line);
  display: inline-flex; align-items: center; justify-content: center;
}
button:hover, .btn:hover { border-color: var(--accent); text-decoration: none; }
button.primary { background: var(--accent); border-color: var(--accent); color: #0b1020; font-weight: 600; }
button.danger { color: var(--err); }
button[disabled] { opacity: .5; cursor: not-allowed; }

form.inline { display: inline; }
label { display: block; margin: 10px 0 4px; color: var(--muted); font-size: 13px; }
/* A label and its "?" on one line. The marker sits beside the label rather than
   inside it: text inside a <label> becomes the input's accessible name, and
   "Hostname What is this field?" is not a name anyone wants to hear. */
.label-row { display: flex; align-items: flex-start; gap: 6px; }
/* The marker sits immediately after the label's own text, not at the far edge of
   the cell: the cells are side by side, so a right-aligned "?" reads as if it
   belonged to the next field. */
.label-row > label { flex: 0 1 auto; }
/* A field's "?" : hovering reveals the text, a click pins it open. */
.help-wrap { position: relative; display: inline-flex; align-items: center; flex: 0 0 auto; }
button.help {
  width: 16px; height: 16px; min-height: 0; padding: 0;
  /* 10px down: level with the first line of the label beside it. */
  margin-top: 11px;
  border-radius: 50%; border: 1px solid var(--line); background: transparent;
  color: var(--muted); font-size: 11px; font-weight: 600; line-height: 1;
}
button.help:hover, button.help[aria-expanded=true] {
  color: var(--text); border-color: var(--accent); background: var(--panel-2);
}
.help-text {
  display: none; position: fixed; z-index: 60;
  /* Width and position come from the script, which keeps the box inside the
     viewport: a marker near the right edge in a narrow window would otherwise
     open a box that is cut off. */
  width: min(420px, calc(100vw - 20px));
  padding: 10px 12px; border: 1px solid var(--accent); border-radius: var(--radius);
  background: var(--panel-2); color: var(--text);
  font-size: 13px; line-height: 1.45; text-align: left; font-weight: 400;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .55);
}
.help-wrap:hover .help-text,
.help-wrap:focus-within .help-text,
.help-text[data-open] { display: block; }
/* In a heading there is no label to sit beside, so no offset. */
h1 .help-wrap button.help, h2 .help-wrap button.help, h3 .help-wrap button.help { margin-top: 0; }
/* A radio and its caption on one line, rather than a label above a control. */
label.choice { display: flex; align-items: center; gap: 8px; margin: 8px 0 2px; color: var(--text); font-size: 14px; }
label.choice input { width: auto; min-height: 0; }
/* A checkbox standing beside other controls is centred on their line: its own box
   is 13px, so matching tops would leave it hanging at the top of a 38px control. */
.row label.choice { min-height: 38px; }
input, select, textarea {
  width: 100%; padding: 7px 9px; border-radius: 6px; background: var(--panel-2);
  color: var(--text); border: 1px solid var(--line); font: inherit;
}
input[type=checkbox] { width: auto; }
textarea { font-family: var(--mono); font-size: 13px; }
.hint { color: var(--muted); font-size: 12px; margin-top: 4px; }

pre {
  background: #0b0e13; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px; overflow: auto; font-family: var(--mono); font-size: 12.5px; line-height: 1.45;
  max-height: 460px; margin: 0;
}
code { font-family: var(--mono); font-size: 12.5px; color: #cfd6e4; }

.flash { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 12px; border: 1px solid var(--line); }
.flash.ok { border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); }
.flash.error { border-color: color-mix(in srgb, var(--err) 45%, var(--line)); }

.problems { margin: 0; padding-left: 20px; color: var(--warn); }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 12.5px; }
.tight td, .tight th { padding: 5px 8px; }
details summary { cursor: pointer; color: var(--muted); }

.login { max-width: 380px; margin: 12vh auto; }
.login h1 { margin-bottom: 16px; }

/* Fields side by side. Cells align at the top, which puts every label on one
   line and so every control on the next one: a hint under a field is that
   field's own business and cannot push its input out of line. */
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-start; }
.row > * { flex: 1 1 200px; }
.row > .shrink { flex: 0 0 auto; }
/* A button in a row has no <label> above it, so it is given the height one takes
   (the label rule: 13px, 10px above, 4px below) or it rides higher than the
   inputs beside it. */
.row > .field-action::before { content: "\00a0"; display: block; font-size: 13px; margin: 10px 0 4px; }
/* A checkbox with its caption on one line, standing on the control line. */
.check { display: inline-flex; align-items: center; gap: 7px; min-height: 38px; }
.check label { margin: 0; }

/* The way back from a page you drilled into. */
.crumbs { margin: 0 0 10px; }
a.back {
  display: inline-flex; align-items: center; padding: 4px 11px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--line); color: var(--muted); font-size: 13px;
}
a.back:hover { color: var(--text); border-color: var(--accent); text-decoration: none; }

/* A form that is not asking, it is insisting: the forced password change. */
.card.must-change { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); }
