/* npportal — restrained, neutral UI. Colour is used for status only. */
:root {
  --bg: #f5f6f7;
  --panel: #ffffff;
  --border: #dde0e4;
  --border-strong: #c5cad1;
  --text: #1f2328;
  --muted: #5f6873;
  --faint: #8b939c;
  --accent: #2f5d8a;
  --accent-hover: #264d73;
  --accent-soft: #e8eef5;
  --ok: #3d6b4f;      --ok-bg: #e9f1ec;
  --warn: #8a6420;    --warn-bg: #f6efe1;
  --err: #8f3b36;     --err-bg: #f6e8e7;
  --info: #3f5873;    --info-bg: #eaeff4;
  --neutral-bg: #eef0f2;
  --radius: 4px;
  --sidebar: 212px;
  font-size: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text); background: var(--bg); line-height: 1.45;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
h1 { font-size: 20px; font-weight: 600; margin: 0 0 16px; }
h2 { font-size: 15px; font-weight: 600; margin: 24px 0 10px; }
h3 { font-size: 13px; font-weight: 600; margin: 16px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
p { margin: 0 0 10px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }

/* ---------- layout */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar { background: #24292f; color: #d0d4d9; padding: 14px 0; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar .brand { color: #fff; font-weight: 600; font-size: 15px; padding: 0 18px 14px; border-bottom: 1px solid #343a41; margin-bottom: 8px; }
.sidebar .brand small { display: block; color: #9aa2ab; font-weight: 400; font-size: 12px; }
.sidebar nav a { display: block; color: #c9ced4; padding: 7px 18px; font-size: 13.5px; border-left: 3px solid transparent; }
.sidebar nav a:hover { background: #2d3339; text-decoration: none; color: #fff; }
.sidebar nav a.active { background: #2d3339; color: #fff; border-left-color: #7fa3c6; }
.sidebar nav .section { color: #7d858e; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; padding: 14px 18px 4px; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; justify-content: flex-end; padding: 8px 24px; background: var(--panel); border-bottom: 1px solid var(--border); }
.topbar form { margin: 0; display: inline-flex; gap: 6px; align-items: center; }
.topbar .user { color: var(--muted); font-size: 13px; }
.content { padding: 22px 28px 40px; max-width: 1360px; width: 100%; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 14px; }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- panels and grids */
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; }
.panel > h2:first-child, .panel > h3:first-child { margin-top: 0; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1000px) { .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; } }
.stat { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; }
.stat .label { color: var(--muted); font-size: 12px; }
.stat .value { font-size: 22px; font-weight: 600; margin-top: 2px; }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; overflow-wrap: anywhere; }

/* ---------- tables */
.table-wrap { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: #f9fafb; font-weight: 600; font-size: 12px; color: var(--muted); position: sticky; top: 0; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fafbfc; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.nowrap { white-space: nowrap; }
.empty { color: var(--faint); padding: 18px; text-align: center; }
.pager { display: flex; gap: 10px; align-items: center; justify-content: flex-end; padding: 8px 2px; color: var(--muted); font-size: 13px; }

/* ---------- forms */
form.stack { display: grid; gap: 12px; max-width: 640px; }
.field { display: grid; gap: 4px; }
.field label, label.lbl { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.field .hint { font-size: 12px; color: var(--faint); }
/* Fields in a row line up at the top, so hints under some inputs do not
   push the others out of line. Labels are one line (22px with the gap);
   buttons and checkboxes next to fields are offset to match the inputs. */
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-start; }
.row > .field { flex: 1 1 160px; min-width: 0; }
.row > .field > label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row > button, .row > .btn, .row > div > .btn { margin-top: 22px; }
.row > .check { margin-top: 30px; }
.filters > button, .filters > .check { align-self: flex-end; }
.filters > .check { min-height: 32px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=datetime-local], input[type=search], input[type=file], select, textarea {
  font: inherit; color: var(--text); background: #fff; border: 1px solid var(--border-strong); border-radius: var(--radius);
  padding: 6px 8px; width: 100%; min-height: 32px;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
input[type=checkbox] { width: 15px; height: 15px; vertical-align: -2px; }
.check { display: flex; gap: 6px; align-items: center; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 12px; }
.filters .field { min-width: 140px; }
.err-field { color: var(--err); font-size: 12px; }

.btn, button {
  font: inherit; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  border: 1px solid var(--border-strong); background: #fff; color: var(--text); border-radius: var(--radius);
  padding: 6px 12px; min-height: 32px; text-decoration: none; white-space: nowrap;
}
.btn:hover, button:hover { background: #f3f4f6; text-decoration: none; }
.btn.primary, button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover, button.primary:hover { background: var(--accent-hover); }
.btn.danger, button.danger { color: var(--err); border-color: #d9b8b5; }
.btn.danger:hover, button.danger:hover { background: var(--err-bg); }
.btn.small, button.small { padding: 2px 8px; min-height: 26px; font-size: 12px; }
button.link { border: 0; background: none; color: var(--accent); padding: 0; min-height: 0; }
button.link:hover { text-decoration: underline; background: none; }
button:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- alerts and badges */
.alert { border: 1px solid var(--border); border-left-width: 3px; border-radius: var(--radius); padding: 9px 12px; margin-bottom: 14px; background: var(--panel); }
.alert.ok { border-left-color: var(--ok); background: var(--ok-bg); }
.alert.error { border-left-color: var(--err); background: var(--err-bg); }
.alert.warn { border-left-color: var(--warn); background: var(--warn-bg); }
.alert.info { border-left-color: var(--info); background: var(--info-bg); }
.badge { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 11.5px; font-weight: 500; background: var(--neutral-bg); color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.err { background: var(--err-bg); color: var(--err); }
.badge.info { background: var(--info-bg); color: var(--info); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12px; }
.right { text-align: right; }
.secret { font-family: ui-monospace, monospace; background: var(--neutral-bg); padding: 8px 10px; border-radius: var(--radius); word-break: break-all; }

/* ---------- usage bar */
.bar { height: 8px; background: var(--neutral-bg); border-radius: 4px; overflow: hidden; min-width: 120px; }
.bar > span { display: block; height: 100%; background: #7f9bb7; }

/* ---------- timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 140px 1fr; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.timeline li:last-child { border-bottom: 0; }
.timeline .when { color: var(--muted); font-size: 12px; white-space: nowrap; }

/* ---------- xml */
pre.xml { background: #f7f8f9; border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; overflow: auto; max-height: 420px; white-space: pre-wrap; word-break: break-all; margin: 0; }

/* ---------- tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.tabs a { padding: 7px 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.active { color: var(--text); border-bottom-color: var(--accent); }
.tabs a:hover { text-decoration: none; color: var(--text); }

/* ---------- login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login { width: 360px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; }
.login h1 { font-size: 18px; }
.login .langs { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

/* ---------- htmx */
.htmx-indicator { opacity: 0; transition: opacity 120ms; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }

/* ---------- print (confirmation document) */
@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  .shell { display: block; }
  body { background: #fff; }
  .content { padding: 0; }
  .panel { border: 0; padding: 0; }
}
.mt { margin-top: 16px; }
progress.usage { width: 140px; height: 8px; vertical-align: middle; appearance: none; -webkit-appearance: none; border: 0; border-radius: 4px; background: var(--neutral-bg); overflow: hidden; }
progress.usage::-webkit-progress-bar { background: var(--neutral-bg); border-radius: 4px; }
progress.usage::-webkit-progress-value { background: #7f9bb7; border-radius: 4px; }
progress.usage::-moz-progress-bar { background: #7f9bb7; border-radius: 4px; }
.w-180 { width: 180px; }
details.xml summary { cursor: pointer; color: var(--accent); font-size: 12.5px; }
details.xml[open] summary { margin-bottom: 6px; }
.inline-form { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
.actions-panel form { margin-bottom: 10px; }
.actions-panel .row { align-items: flex-end; }
.doc { max-width: 760px; }
.doc h1 { font-size: 22px; }
.doc .box { border: 1px solid var(--border-strong); padding: 14px 18px; border-radius: var(--radius); margin: 12px 0; }
.mb { margin-bottom: 16px; }
form.stack.wide { max-width: none; }
input.w-180, .w-180 { width: 180px; }
/* search results picker (UKE register lookup) */
.picker { border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); max-width: 900px; }
.picker-head { padding: 6px 10px; border-bottom: 1px solid var(--border); background: #f9fafb; }
.picker-item { display: flex; gap: 10px; align-items: baseline; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--border);
  border-radius: 0; background: none; padding: 7px 10px; min-height: 0; font-size: 13px; white-space: normal; }
.picker-item:last-child { border-bottom: 0; }
button.picker-item:hover, button.picker-item:focus { background: var(--accent-soft); outline: none; }
.picker-item.disabled { color: var(--faint); }
.picker-empty { padding: 4px 2px; }
.picker-row { display: flex; align-items: center; gap: 8px; padding-right: 10px; border-bottom: 1px solid var(--border); }
.picker-row:last-child { border-bottom: 0; }
.picker-row > .picker-item { border-bottom: 0; flex: 1; }
