/* Super admin portal. The tokens, shapes and components are those of the
   OltBox web UI (node/web/src/styles.css): flat 5 px corners, brand blue for
   actions only, a state always with a word. */
:root {
  color-scheme: light;
  --bg: #f6f5f2;
  --surface: #ffffff;
  --surface-2: #f1f0ed;
  --border: #e4e4e7;
  --border-strong: #d4d4d8;
  --input-border: #71717a;
  --text: #1e293b;
  --text-2: #475569;
  --muted: #5f6b7a;
  --brand: #2563eb;
  --brand-hover: #1d4ed8;
  --brand-press: #1e40af;
  --brand-soft: #eff6ff;
  --on-brand: #ffffff;
  --logo-c: #153a66;
  --logo-b: #2563eb;
  --ok: #15803d;
  --warn: #b45309;
  --bad: #b91c1c;
  --info: #1d4ed8;
  --off: #52525b;
  --focus: #2563eb;
  --shadow: 0 1px 3px 0 rgb(30 33 31 / 0.06), 0 1px 2px -1px rgb(30 33 31 / 0.05);
  --shadow-pop: 0 12px 32px rgba(30, 41, 59, 0.14), 0 2px 6px rgba(30, 41, 59, 0.06);
  --radius: 5px;
  --control-h: 38px;
  --control-h-small: 30px;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #1a1a1c;
    --surface: #28282b;
    --surface-2: #323236;
    --border: #3f3f46;
    --border-strong: #52525b;
    --input-border: #85858f;
    --text: #fafafa;
    --text-2: #d4d4d8;
    --muted: #b8b8c3;
    --brand: #60a5fa;
    --brand-hover: #93c5fd;
    --brand-press: #3b82f6;
    --brand-soft: #1e2a3b;
    --on-brand: #18181b;
    --logo-c: #ffffff;
    --logo-b: #60a5fa;
    --ok: #4ade80;
    --warn: #fbbf24;
    --bad: #fca5a5;
    --info: #93c5fd;
    --off: #a1a1aa;
    --focus: #93c5fd;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.3);
    --shadow-pop: 0 12px 32px rgba(0, 0, 0, 0.5);
  }
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
}
body {
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 14px;
  line-height: 20px;
  color: var(--text);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}
a {
  color: var(--brand);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
h1,
h2 {
  margin: 0;
}
.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 12.5px;
}
.icon {
  flex: none;
  display: block;
}
.grow {
  flex: 1;
}
[hidden] {
  display: none !important;
}

/* ---------------------------------------------------------------- logo */
.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  font-weight: 700;
  font-size: 23px;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--logo-c);
}
.logo span span {
  color: var(--logo-b);
}
.logo .c {
  fill: var(--logo-c);
}
.logo .b {
  fill: var(--logo-b);
}

/* ---------------------------------------------------------------- controls */
input,
select {
  font: inherit;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--input-border);
  border-radius: var(--radius);
  padding: 8px 12px;
  min-height: var(--control-h);
  width: 100%;
}
input[type='checkbox'] {
  width: 16px;
  height: 16px;
  min-height: 0;
  padding: 0;
  accent-color: var(--brand);
}
input:focus-visible,
.btn:focus-visible,
a:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 14px;
}
.field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.field-hint {
  font-size: 12px;
  color: var(--muted);
}
.input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.input-row input {
  flex: 1;
  min-width: 0;
}
.panel-note {
  margin: -8px 0 12px;
}
.badge-plain::before {
  display: none;
}
.you {
  margin-left: 8px;
}
.field-gap {
  margin-top: 14px;
}
.inline-action {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
}
.steps {
  margin: 0 0 4px;
  padding-left: 18px;
  color: var(--text-2);
}
.steps li {
  margin-bottom: 4px;
}
.warn-box {
  margin-top: 0;
}
.check {
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--control-h);
  padding: 0.55rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--input-border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.btn:hover:not(:disabled) {
  background: var(--surface-2);
  text-decoration: none;
}
.btn:active:not(:disabled) {
  transform: scale(0.97);
}
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.btn-primary:not(:disabled) {
  background: linear-gradient(180deg, color-mix(in srgb, var(--brand) 86%, white), var(--brand-press));
  border-color: var(--brand-press);
  color: var(--on-brand);
  box-shadow: 0 8px 20px -8px color-mix(in srgb, var(--brand) 55%, transparent);
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(180deg, color-mix(in srgb, var(--brand) 72%, white), var(--brand-hover));
}
.btn-danger:not(:disabled) {
  background: linear-gradient(180deg, color-mix(in srgb, var(--bad) 86%, white), color-mix(in srgb, var(--bad) 82%, black));
  border-color: color-mix(in srgb, var(--bad) 82%, black);
  color: #fff;
}
.btn-ghost-danger {
  background: transparent;
  border-color: transparent;
  color: var(--bad);
}
.btn-small {
  min-height: var(--control-h-small);
  padding: 0.35rem 0.75rem;
  font-size: 12px;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius);
  font-size: 11px;
  font-weight: 700;
  line-height: 16px;
  white-space: nowrap;
}
.badge::before {
  content: '';
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
}
.badge-ok { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.badge-bad { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); }
.badge-warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.badge-muted { background: color-mix(in srgb, var(--off) 14%, transparent); color: var(--off); }
.badge-info { background: var(--brand-soft); color: var(--info); }
.error-box {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--bad) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--bad) 35%, transparent);
  color: var(--bad);
}
.ok-box {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--ok) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--ok) 35%, transparent);
  color: var(--ok);
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ---------------------------------------------------------------- login */
.login {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 16px;
}
.login-card {
  width: min(400px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px;
}
.login-card .logo {
  margin-bottom: 4px;
}
.login-card p {
  margin: 0 0 24px;
  color: var(--muted);
}
.login-card .btn {
  width: 100%;
}

/* ---------------------------------------------------------------- page */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar .btn + .btn {
  margin-left: -4px;
}
.topbar-tag {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  padding-left: 12px;
  border-left: 1px solid var(--border-strong);
}
.page {
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  gap: 16px;
}
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  min-width: 0;
}
.panel-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}
.panel-head h2 {
  font-size: 16px;
}
.panel-head .search {
  width: 220px;
}
.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
.kpi {
  display: grid;
  gap: 4px;
  padding: 20px 24px;
}
.kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.kpi-value {
  font-size: 24px;
  font-weight: 700;
  line-height: 30px;
}
/* A long value (a release's name) in the same card, on one line. */
.kpi-value-long {
  font-size: 17px;
  overflow-wrap: anywhere;
}
.bar {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}
.bar > span {
  display: block;
  height: 100%;
  background: var(--brand);
}
.bar.warn > span {
  background: var(--warn);
}
.bar.bad > span {
  background: var(--bad);
}
.w0 { width: 0; } .w5 { width: 5%; } .w10 { width: 10%; } .w15 { width: 15%; } .w20 { width: 20%; }
.w25 { width: 25%; } .w30 { width: 30%; } .w35 { width: 35%; } .w40 { width: 40%; } .w45 { width: 45%; }
.w50 { width: 50%; } .w55 { width: 55%; } .w60 { width: 60%; } .w65 { width: 65%; } .w70 { width: 70%; }
.w75 { width: 75%; } .w80 { width: 80%; } .w85 { width: 85%; } .w90 { width: 90%; } .w95 { width: 95%; } .w100 { width: 100%; }

/* ---------------------------------------------------------------- table */
.table-wrap {
  overflow-x: auto;
}
.table {
  width: 100%;
  border-collapse: collapse;
}
.table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tbody tr:last-child td {
  border-bottom: 0;
}
.table tbody tr:hover {
  background: var(--surface-2);
}
.t-name {
  font-weight: 600;
}
.table td .badge {
  margin-top: 2px;
}
.row-actions {
  text-align: right;
  white-space: nowrap;
}
.row-actions .btn + .btn {
  margin-left: 4px;
}
.empty {
  padding: 28px 12px;
  text-align: center;
  color: var(--muted);
}
.activity {
  list-style: none;
  margin: 0;
  padding: 0;
}
.activity li {
  display: flex;
  gap: 12px;
  padding: 8px 0;
  border-top: 1px solid var(--border);
}
.activity li:first-child {
  border-top: 0;
}
.activity time {
  flex: none;
  width: 132px;
  color: var(--muted);
  font-size: 12.5px;
}

/* ---------------------------------------------------------------- modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(15, 23, 42, 0.45);
}
.modal {
  background: var(--surface);
  border-radius: var(--radius);
  width: min(520px, 100%);
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-pop);
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-head h2 {
  font-size: 16px;
}
.modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.modal-close:hover {
  background: var(--surface-2);
}
.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
}
.modal-body p {
  margin: 0 0 12px;
}
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}
.info {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 8px 16px;
  margin: 0 0 16px;
}
.info dt {
  color: var(--muted);
  font-size: 12.5px;
}
.info dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.secret {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.progress-line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  border-top-color: var(--brand);
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation-duration: 2.4s;
  }
}
.joblog {
  margin: 8px 0 0;
  padding: 10px 12px;
  max-height: 180px;
  overflow: auto;
  border-radius: var(--radius);
  background: var(--surface-2);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 60;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--text);
  color: var(--surface);
  box-shadow: var(--shadow-pop);
}

/* ---------------------------------------------------------------- phone */
@media (max-width: 760px) {
  input {
    min-height: 40px;
    font-size: 16px; /* no zoom-in on iOS */
  }
  .btn {
    min-height: 40px;
  }
  .btn-small {
    min-height: 36px;
  }
  .topbar {
    padding: 12px 16px;
  }
  .topbar-tag,
  .topbar .who {
    display: none;
  }
  .topbar .btn {
    padding: 0 10px;
  }
  .page {
    padding: 16px;
  }
  .panel {
    padding: 16px;
  }
  .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  .kpi {
    padding: 14px 16px;
  }
  .kpi-value {
    font-size: 20px;
  }
  .kpi-value-long {
    font-size: 14px;
  }
  .panel-head .search {
    width: 100%;
    order: 3;
  }
  /* The table becomes one card per customer. */
  .table thead {
    display: none;
  }
  .table,
  .table tbody,
  .table tr,
  .table td {
    display: block;
  }
  .table tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 12px;
    padding: 12px 0;
    border-top: 1px solid var(--border);
  }
  .table tbody tr:first-child {
    border-top: 0;
    padding-top: 0;
  }
  .table tbody tr:hover {
    background: transparent;
  }
  .table td {
    padding: 0;
    border: 0;
    min-width: 0;
  }
  .table td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
  }
  .table td.t-main,
  .table td.row-actions {
    grid-column: 1 / -1;
  }
  .table td.row-actions {
    text-align: left;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding-top: 6px;
  }
  .row-actions .btn + .btn {
    margin-left: 0;
  }
  .info {
    grid-template-columns: 1fr;
    gap: 2px 0;
  }
  .info dd {
    margin-bottom: 8px;
  }
  .activity li {
    flex-direction: column;
    gap: 0;
  }
  .modal-backdrop {
    place-items: end center;
    padding: 0;
  }
  .modal {
    width: 100%;
    max-height: 92dvh;
    border-radius: var(--radius) var(--radius) 0 0;
  }
  .modal-foot .btn {
    flex: 1;
  }
}
