:root {
  /* Uniweb's customer panel. Light by default; dark when the browser prefers it,
     unless the theme button chose (html[data-theme], saved in the browser) */
  --bg: #fafafa;
  --side: #f4f4f4;
  --card: #ffffff;
  --ink: #1a1a1a;
  --muted: #6b6b6b;
  --line: #dedede;
  --accent: #df3042;
  --accent-ink: #ffffff;
  --accent-soft: #fbe8eb;
  --btn: #4b0a2c;
  --btn-hover: #6a1240;
  --sel: #ece3e7;
  --good: #1f7a4d;
  --good-bg: #e3f2e9;
  --warn: #7a4a12;
  --warn-bg: #fde9d9;
  --bad: #b3261e;
  --bad-bg: #fbe5e3;
  --run: #23508f;
  --run-bg: #e3ecf8;
  --code: #f0eff0;
  color-scheme: light;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1b1a1e;
    --side: #151417;
    --card: #252428;
    --ink: #f2f0f4;
    --muted: #a9a4ae;
    --line: #3a383e;
    --accent: #f0566a;
    --accent-ink: #ffffff;
    --accent-soft: #3d0d1d;
    --btn: #8c1d47;
    --btn-hover: #a8285a;
    --sel: #3a2a31;
    --good: #7bd3a0;
    --good-bg: #1d3328;
    --warn: #f0c28a;
    --warn-bg: #3d2a1a;
    --bad: #f19a92;
    --bad-bg: #3d2120;
    --run: #8fb5ea;
    --run-bg: #1d2a3d;
    --code: #2e2d32;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1b1a1e;
  --side: #151417;
  --card: #252428;
  --ink: #f2f0f4;
  --muted: #a9a4ae;
  --line: #3a383e;
  --accent: #f0566a;
  --accent-ink: #ffffff;
  --accent-soft: #3d0d1d;
  --btn: #8c1d47;
  --btn-hover: #a8285a;
  --sel: #3a2a31;
  --good: #7bd3a0;
  --good-bg: #1d3328;
  --warn: #f0c28a;
  --warn-bg: #3d2a1a;
  --bad: #f19a92;
  --bad-bg: #3d2120;
  --run: #8fb5ea;
  --run-bg: #1d2a3d;
  --code: #2e2d32;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
code, kbd, pre { font-family: var(--mono); font-size: 0.9em; }
code { background: var(--code); padding: 0 4px; border-radius: 3px; }
code.wrap { word-break: break-all; }
kbd { border: 1px solid var(--line); border-radius: 3px; padding: 0 4px; }
h1 { font-size: 1.5rem; margin: 0 0 4px; font-weight: 650; letter-spacing: -0.01em; }
h2 { font-size: 1rem; margin: 0 0 10px; font-weight: 650; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
h3 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 14px 0 6px; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 0.85em; }
.nowrap { white-space: nowrap; }
.bad { color: var(--bad); }

.top { display: flex; align-items: center; gap: 24px; padding: 10px 24px; border-bottom: 1px solid var(--line); background: var(--card); flex-wrap: wrap; }
.brand { font-weight: 700; color: var(--ink); text-decoration: none; }
.brand span { color: var(--muted); font-weight: 400; }
.top nav { display: flex; gap: 16px; flex: 1; }
.top nav a { text-decoration: none; color: var(--ink); }
.me { display: flex; gap: 10px; align-items: center; margin: 0; }
.me em { color: var(--muted); font-style: normal; font-size: 0.85em; margin-left: 2px; }
main { margin: 0 auto; padding: 24px; }
footer { text-align: center; color: var(--muted); font-size: 0.8em; padding: 24px; }
.head { margin-bottom: 18px; }
.crumb { margin: 0 0 2px; color: var(--muted); }
.kind { font-size: 0.8rem; font-weight: 500; color: var(--muted); border: 1px solid var(--line); border-radius: 99px; padding: 1px 8px; vertical-align: middle; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; margin-bottom: 16px; }
.narrow { max-width: 440px; margin: 40px auto; }
.grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 900px) { .grid { grid-template-columns: 1fr; } main { padding: 16px; } }

.stack { display: flex; flex-direction: column; gap: 12px; }
label { display: flex; flex-direction: column; gap: 4px; font-weight: 550; font-size: 0.9em; }
input { font: inherit; padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--ink); min-width: 0; }
input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
button, .button { font: inherit; font-weight: 550; padding: 6px 14px; border-radius: 6px; border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; text-decoration: none; display: inline-block; }
button:hover:not([disabled]) { border-color: var(--accent); }
button.primary, .button { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button[disabled] { opacity: 0.45; cursor: not-allowed; }
button.link { background: none; border: none; padding: 0; color: var(--accent); text-decoration: underline; font-weight: 400; }
form.inline { display: inline; }

.alert { padding: 10px 14px; border-radius: 6px; margin: 0 0 16px; }
.alert.bad { background: var(--bad-bg); color: var(--bad); }
.alert.warn { background: var(--warn-bg); color: var(--warn); }
.alert.run { background: var(--run-bg); color: var(--run); }
.pill { font-size: 0.75rem; font-weight: 600; padding: 1px 8px; border-radius: 99px; white-space: nowrap; display: inline-block; }
.pill.good { background: var(--good-bg); color: var(--good); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.run { background: var(--run-bg); color: var(--run); }
.pill.muted { background: var(--code); color: var(--muted); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 2px; }
.dot.good { background: var(--good); }
.dot.bad { background: var(--bad); }

table { border-collapse: collapse; width: 100%; }
table.list { background: var(--card); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
table.list th { text-align: left; font-size: 0.8rem; color: var(--muted); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line); }
table.list td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list tr:last-child td { border-bottom: 0; }
@media (max-width: 700px) { table.list { display: block; overflow-x: auto; } }
.stage { font-family: var(--mono); font-size: 0.85em; }

.track { display: flex; gap: 0; list-style: none; padding: 0; margin: 10px 0 0; flex-wrap: wrap; }
.track li { font-size: 0.8rem; padding: 3px 12px; border: 1px solid var(--line); margin-right: -1px; color: var(--muted); background: var(--card); }
.track li:first-child { border-radius: 99px 0 0 99px; }
.track li:last-child { border-radius: 0 99px 99px 0; }
.track li.done { color: var(--good); }
.track li.cur { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }

.facts dl { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 6px 12px; margin: 0; }
.facts dt { color: var(--muted); font-size: 0.85em; padding-top: 1px; }
.facts dd { margin: 0; word-break: break-word; }

.appr { border-top: 1px solid var(--line); padding-top: 4px; }
.appr:first-of-type { border-top: 0; }
.appr p { margin: 4px 0; }
.appr h3 span { text-transform: none; letter-spacing: 0; font-weight: 400; margin-left: 4px; }
.approve { display: flex; gap: 8px; margin: 8px 0 4px; flex-wrap: wrap; }
.approve input { flex: 1; min-width: 180px; }

.group { margin-bottom: 4px; }
.act { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 2px 12px; align-items: start; padding: 5px 0; margin: 0; }
.act button { width: 100%; text-align: left; }
.act .help { font-size: 0.85em; color: var(--muted); padding-top: 6px; }
.act .help em { color: var(--warn); font-style: normal; }
.act .fields { grid-column: 2; display: flex; gap: 6px; flex-wrap: wrap; }
.act .fields input { flex: 1; min-width: 140px; }
@media (max-width: 520px) { .act { grid-template-columns: 1fr; } .act .fields { grid-column: 1; } }

.findings td { padding: 6px 0; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 0.9em; }
.findings tr:last-child td { border-bottom: 0; }
.findings .sev { width: 52px; font-size: 0.75rem; text-transform: uppercase; font-weight: 700; color: var(--muted); padding-top: 8px; }
.findings tr.bad .sev { color: var(--bad); }
.findings tr.warn .sev { color: var(--warn); }
.hist td { padding: 4px 8px 4px 0; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 0.88em; }
.hist tr:last-child td { border-bottom: 0; }
ul.runs, ul.files { list-style: none; padding: 0; margin: 0; }
ul.runs li, ul.files li { padding: 5px 0; border-bottom: 1px solid var(--line); }
ul.runs li:last-child, ul.files li:last-child { border-bottom: 0; }

.log { background: #101413; color: #d6dcd9; border-radius: 8px; padding: 14px 16px; overflow: auto; max-height: 70vh; min-height: 240px; font-size: 12.5px; line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
.log .head { color: #8fd3c3; font-weight: 600; }
.log .bad { color: #ff8a80; }
.log .warn { color: #f1c66a; }
.log .good { color: #8fe0a8; }
#stopform { margin-bottom: 12px; }

.steps { padding-left: 20px; }
.steps li { margin-bottom: 12px; }
.secret { margin: 8px 0; }
.secret code { font-size: 1.15em; letter-spacing: 0.08em; padding: 6px 10px; display: inline-block; }

/* ---- 0.20: tabs, keys, forms ---- */
.alert.good { background: var(--good-bg); color: var(--good); }
.head.row { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
button.plain, .button.plain { background: var(--card); color: var(--ink); border-color: var(--line); }
.tabs { display: flex; gap: 4px; margin: 8px 0 0; flex-wrap: wrap; }
.tabs a { text-decoration: none; color: var(--muted); padding: 4px 12px; border-radius: 6px; border: 1px solid transparent; }
.tabs a.cur { color: var(--ink); background: var(--card); border-color: var(--line); font-weight: 600; }
.tabs.big { margin: 0 0 14px; border-bottom: 1px solid var(--line); gap: 0; }
.tabs.big a { border-radius: 6px 6px 0 0; padding: 6px 18px; margin-bottom: -1px; }
.tabs.big a.cur { border-bottom-color: var(--bg); background: var(--bg); }

/* key badges show only with keys on */
kbd { font-size: 0.75em; }
button kbd, .button kbd { display: none; margin-left: 8px; float: right; opacity: 0.7; border-color: currentColor; padding: 0 5px; font-weight: 500; }
.keys-on button kbd, .keys-on .button kbd { display: inline-block; }
.keyhint { display: none; }
.keys-on .keyhint { display: block; }
.top .keys { display: flex; gap: 8px; align-items: center; margin: 0; font-size: 0.85em; }
.act > .button { width: 100%; text-align: left; }
.act.next > button, .act.next > .button { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.nextmark { color: var(--accent); white-space: nowrap; }
.act .fields label.mini { flex: 1; min-width: 160px; font-weight: 500; font-size: 0.8em; color: var(--muted); }
table.jobs tr.sel td { background: var(--code); }
table.jobs tr.sel td:first-child { box-shadow: 3px 0 0 var(--accent) inset; }

dialog { border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink); max-width: 560px; width: calc(100% - 32px); padding: 18px 22px; }
dialog::backdrop { background: rgba(0, 0, 0, 0.35); }
#keylist table td { padding: 3px 12px 3px 0; vertical-align: top; }
#keylist kbd { white-space: nowrap; }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 8px 16px; border-radius: 8px; opacity: 0; transition: opacity 0.2s; pointer-events: none; max-width: calc(100% - 32px); }
#toast.show { opacity: 0.95; }

.jobform { max-width: 820px; }
.jobform h3.section { margin-top: 22px; padding-top: 12px; border-top: 1px solid var(--line); }
.jobform h3.section:first-of-type { margin-top: 0; padding-top: 0; border-top: 0; }
.field { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 4px 16px; padding: 6px 0; align-items: start; }
.field > label { padding-top: 8px; }
.field .ctl { display: flex; flex-direction: column; gap: 4px; }
.field .hint { color: var(--muted); font-size: 0.82em; }
.field .err { color: var(--bad); font-size: 0.85em; font-weight: 550; }
.field.bad input, .field.bad textarea, .field.bad select { border-color: var(--bad); }
.field .ro { padding-top: 7px; }
select, textarea { font: inherit; padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--ink); min-width: 0; max-width: 100%; }
textarea { font-family: var(--mono); font-size: 0.9em; resize: vertical; }
select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
@media (max-width: 620px) { .field { grid-template-columns: 1fr; } .field > label { padding-top: 0; } }
.buttons { display: flex; gap: 14px; align-items: center; margin-top: 18px; flex-wrap: wrap; }
.buttons kbd { font-size: 0.7em; }
.suggest { background: var(--warn-bg); color: var(--warn); padding: 10px 14px; border-radius: 6px; }
.suggest code { background: transparent; }
details.diag summary { cursor: pointer; font-weight: 600; }
details.diag .findings { margin-top: 10px; }
.narrowish { max-width: 560px; }
label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 450; }
.act { grid-template-columns: 178px minmax(0, 1fr); }
.act > button, .act > .button { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.keys-on .act > button kbd, .keys-on .act > .button kbd { float: none; margin-left: 0; flex: none; }

/* ---- 0.21: customer link ---- */
.pill.cust { background: var(--warn-bg); color: var(--warn); }
.custline { margin: 0 0 12px; }
.linkurl { display: flex; gap: 8px; }
.linkurl input { flex: 1; min-width: 0; font-family: ui-monospace, monospace; font-size: 14px; }

/* ---- 0.25: Uniweb customer-panel layout: top bar, side menu, cards ---- */
body { display: flex; flex-direction: column; min-height: 100vh; }
.top { padding: 0 32px; min-height: 52px; gap: 20px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand svg { height: 22px; width: auto; display: block; }
.top .spacer { flex: 1; }
.shell { flex: 1; display: flex; align-items: stretch; }
.side { width: 240px; flex: none; background: var(--side); border-right: 1px solid var(--line); padding: 40px 16px 24px; }
.side p { margin: 18px 8px 8px; color: var(--muted); font-weight: 550; font-size: 0.95em; }
.side p:first-child { margin-top: 0; }
.side a { display: block; padding: 8px 10px; border-radius: 6px; color: var(--ink); text-decoration: none; }
.side a:hover { background: var(--sel); }
.side a.on { background: var(--sel); font-weight: 550; }
.shell main { flex: 1; min-width: 0; margin: 0; padding: 40px 48px; max-width: 1280px; }
main h1 { font-size: 2rem; font-weight: 600; margin-bottom: 8px; }
.card { border-radius: 4px; }
.card > h2:first-child { margin-bottom: 12px; }
button, .button { border-radius: 4px; }
button.primary, .button { background: var(--btn); border-color: var(--btn); color: #fff; padding: 8px 16px; }
button.primary:hover:not([disabled]), .button:hover { background: var(--btn-hover); border-color: var(--btn-hover); }
button:hover:not([disabled]) { border-color: var(--btn); }
.alert.warn { background: var(--warn-bg); color: var(--ink); border-color: transparent; }
.theme { background: none; border: 1px solid var(--line); border-radius: 99px; padding: 3px 10px; font-weight: 500; color: var(--ink); }
@media (max-width: 800px) {
  .shell { flex-direction: column; }
  .side { width: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 12px 16px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
  .side p { display: none; }
  .shell main { padding: 24px 16px; }
  .top { padding: 8px 16px; }
}
.top button.link { color: var(--ink); text-decoration: none; } .top button.link:hover { text-decoration: underline; }
/* centred on wide screens: the top bar's contents and the menu + page share one 1440px column */
.top { padding-left: max(32px, calc((100% - 1440px) / 2 + 16px)); padding-right: max(32px, calc((100% - 1440px) / 2 + 16px)); }
.shell { width: 100%; max-width: 1440px; margin: 0 auto; }
.shell main { max-width: none; margin: 0 auto; }
.shell > main:only-child { max-width: 1100px; }
@media (min-width: 1441px) { .side { border-left: 1px solid var(--line); } }
/* batches */
.fieldgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px 16px; }
.fieldgrid label { display: flex; flex-direction: column; gap: 4px; }
.fieldgrid .hint { color: var(--muted); font-size: 0.85em; }
.scrollx { overflow-x: auto; }
table.rows td { padding: 4px 6px; }
table.rows input, table.rows select { width: 100%; min-width: 120px; }
ul.problems { margin: 0; padding-left: 18px; }
.group { margin-top: 8px; }
.group h3 { margin: 8px 0 6px; font-size: 0.95em; color: var(--muted); }
.group form { margin: 0 6px 6px 0; }
/* phones: the page takes the screen's width (auto margins would size it to its widest table) */
@media (max-width: 800px) { .shell main { width: 100%; margin: 0; } }
textarea#csv { width: 100%; font-family: var(--mono); font-size: 0.9em; }
.scrollx { margin-bottom: 16px; }
fieldset.site { border: 1px solid var(--line); border-radius: 4px; padding: 10px 14px 14px; margin: 0 0 12px; }
fieldset.site legend { padding: 0 6px; font-weight: 600; }
.fieldgrid.onehop { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
.fieldgrid input, .fieldgrid select { width: 100%; }
