/* ============================================================================
   UTC NEXT — ADMIN  ·  unext.css
   The UNext section (#/unext/*): sidebar group label, badges, drawer, modal,
   forms, chart, versions and recent lists. Uses the tokens from admin.css.
   ========================================================================== */

/* ---- Sidebar group -------------------------------------------------------- */

.nav-group {
  margin: 14px 4px 4px;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
}

.nav-group-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding-left: 11px;
}

@media (max-width: 940px) {
  .nav-group { margin: 10px 0 2px; padding-top: 8px; text-align: center; }
  .nav-group-label { padding-left: 0; letter-spacing: 0.08em; font-size: 9.5px; }
}

/* ---- Inputs ---------------------------------------------------------------- */

.ux-form .field-input,
.ux-modal .field-input,
.ux-drawer .field-input,
.ux-tools .role-select { color-scheme: dark; }

.ux-select, .ux-textarea { width: 100%; }
.ux-select option { background: var(--surface); }
.ux-textarea { resize: vertical; min-height: 62px; line-height: 1.5; font: inherit; }
.ux-field + .ux-field { margin-top: 0; }
.ux-field { min-width: 0; }
.field-input:disabled { opacity: 0.45; }

.ux-hint {
  display: block;
  margin-top: 5px;
  font-size: 12px;
  color: var(--text-faint);
  line-height: 1.5;
}

.ux-lead { margin: 0 0 16px; font-size: 13px; color: var(--text-dim); }

.ux-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
  margin-bottom: 14px;
}

.ux-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.ux-inline { display: flex; align-items: center; gap: 10px; }
.ux-inline .field-input { flex: 1; min-width: 0; }

.ux-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-dim);
  white-space: nowrap;
  cursor: pointer;
}

.ux-check input { accent-color: var(--accent); width: 15px; height: 15px; }

.ux-form-foot { display: flex; justify-content: flex-end; margin-top: 14px; }
.ux-save-bar { margin-top: 18px; }
.ux-num-in { max-width: 180px; }

.ux-card-pad { padding: 18px 20px; }

.ux-tools { flex-wrap: wrap; justify-content: flex-end; }

.ux-footnote { margin-top: 12px; font-size: 12.5px; color: var(--text-faint); }

/* ---- Badges ---------------------------------------------------------------- */

.ux-badges { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }

.ux-type-trial { color: #c39bff; background: rgba(167, 120, 255, 0.12); border-color: rgba(167, 120, 255, 0.4); }
.ux-type-paid { color: var(--accent); background: var(--accent-soft); border-color: var(--accent-glow); }
.ux-type-free { color: #5fd3c7; background: rgba(60, 200, 185, 0.11); border-color: rgba(60, 200, 185, 0.38); }

.ux-st-active { color: var(--good); background: rgba(55, 173, 95, 0.12); border-color: rgba(55, 173, 95, 0.4); }
.ux-st-expired { color: var(--warn); background: rgba(224, 166, 60, 0.12); border-color: rgba(224, 166, 60, 0.4); }
.ux-st-revoked { color: #ff8d84; background: var(--bad-soft); border-color: rgba(224, 72, 60, 0.4); }
.ux-st-hidden { color: var(--text-dim, #9aa4b2); background: transparent; border-style: dashed; }

.ux-dl { font-size: 12px; font-weight: 500; }
.badge.ux-dl { font-weight: 600; }
.ux-dl-ok { color: var(--text-dim); }
.ux-dl-warn { color: var(--warn); }
.ux-dl-bad { color: #ff8d84; }

.ux-ver { margin-left: 7px; font-size: 10.5px; padding: 0 7px; font-variant-numeric: tabular-nums; }

.ux-mono { font-family: 'Cascadia Mono', Consolas, 'SFMono-Regular', Menlo, monospace; font-size: 12.5px; }

.ux-muted { color: var(--text-faint); font-size: 13px; padding: 4px 0; }

.ux-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent);
  cursor: pointer;
  font-family: 'Cascadia Mono', Consolas, monospace;
  font-size: 12.5px;
}

.ux-link:hover { text-decoration: underline; }

/* ---- Tables ---------------------------------------------------------------- */

.ux-row { cursor: pointer; }
.ux-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.ux-row-revoked td { opacity: 0.62; }
.ux-serial { color: var(--text-dim); white-space: nowrap; }
.ux-num { font-variant-numeric: tabular-nums; }
.ux-mc { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text); }
.ux-mc-full { color: var(--warn); }
.ux-table td .user-cell-mail { max-width: 300px; }

/* ---- Error panel ----------------------------------------------------------- */

.ux-error .ux-error-icon { color: var(--warn); opacity: 1; }
.ux-error .empty-msg { max-width: 560px; text-align: center; color: var(--text); }
.ux-error-detail {
  font-size: 12px;
  color: var(--text-faint);
  max-width: 560px;
  text-align: center;
  overflow-wrap: anywhere;
}
.ux-error .btn { margin-top: 6px; }

/* ---- Key block ------------------------------------------------------------- */

.ux-key {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 10px 10px 14px;
}

.ux-key-text {
  flex: 1;
  min-width: 0;
  font-family: 'Cascadia Mono', Consolas, 'SFMono-Regular', Menlo, monospace;
  font-size: 13.5px;
  letter-spacing: 0.04em;
  color: #cfe9ff;
  overflow-wrap: anywhere;
  user-select: all;
}

/* Short code "XXXXX-XXXXX": large, letter-spaced, never wraps. */
.ux-key-short .ux-key-text {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: #e3f3ff;
  white-space: nowrap;
  overflow-wrap: normal;
}
.ux-key-short.ux-key-big { padding: 16px 14px 16px 20px; border-color: rgba(47, 166, 255, 0.5); }
.ux-issued .ux-key-short.ux-key-big .ux-key-text,
.ux-key-short.ux-key-big .ux-key-text { font-size: clamp(24px, 5vw, 34px); text-align: center; }
.ux-key-stack { display: flex; flex-direction: column; gap: 10px; }
.ux-code-cell { white-space: nowrap; letter-spacing: 0.08em; font-weight: 600; color: #cfe9ff; }

/* ---- Modal ----------------------------------------------------------------- */

.ux-modal { max-width: 520px; max-height: calc(100vh - 48px); display: flex; flex-direction: column; }
.ux-modal-wide { max-width: 680px; }
.ux-modal .dlg-head { position: relative; }
.ux-modal-x { margin-left: auto; }
.ux-modal-body { overflow-y: auto; margin: 0 -24px; padding: 4px 24px 2px; flex: 1; min-height: 0; }
.ux-modal .dlg-actions { margin-top: 16px; flex-wrap: wrap; }
.ux-modal .form-error { margin-top: 0; }

.ux-issued { display: flex; flex-direction: column; gap: 14px; padding-bottom: 4px; }
.ux-issued-head { display: flex; align-items: center; gap: 12px; }
.ux-issued-ok {
  width: 38px;
  height: 38px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--good);
  background: rgba(55, 173, 95, 0.14);
  border: 1px solid rgba(55, 173, 95, 0.45);
}
.ux-issued-ok svg { width: 20px; height: 20px; }
.ux-issued-title { font-size: 15px; font-weight: 600; }
.ux-issued .ux-key-text { font-size: 15px; }
.ux-issued .ux-key-short .ux-key-text { font-size: 22px; }

/* ---- Drawer ---------------------------------------------------------------- */

.ux-drawer-wrap { position: fixed; inset: 0; z-index: 90; }

.ux-drawer-scrim {
  position: absolute;
  inset: 0;
  background: rgba(8, 11, 14, 0.5);
  opacity: 0;
  transition: opacity 180ms ease;
}

.ux-drawer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(560px, 100vw);
  background: var(--sidebar);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-pop);
  display: flex;
  flex-direction: column;
  transform: translateX(24px);
  opacity: 0;
  transition: transform 180ms cubic-bezier(0.2, 0.9, 0.3, 1), opacity 180ms ease;
}

.ux-drawer-wrap.open .ux-drawer-scrim { opacity: 1; }
.ux-drawer-wrap.open .ux-drawer { transform: none; opacity: 1; }

.ux-drawer-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px 14px 20px;
  border-bottom: 1px solid var(--border-soft);
}

.ux-drawer-title { font-size: 16px; font-weight: 600; flex: 1; font-variant-numeric: tabular-nums; }

.ux-drawer-body { flex: 1; overflow-y: auto; padding: 4px 20px 40px; }

.ux-drawer-hero { padding: 16px 0 6px; }
.ux-drawer-name { font-size: 19px; font-weight: 600; margin-bottom: 8px; overflow-wrap: anywhere; }
.ux-hero-who { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; min-width: 0; }
.ux-hero-who .avatar { flex: none; }
.ux-hero-names { min-width: 0; }
.ux-hero-who .ux-drawer-name { margin-bottom: 0; }
.ux-hero-sub { font-size: 12.5px; color: var(--text-dim, #8b97a3); overflow-wrap: anywhere; }
.ux-revoked-note { margin-top: 10px; font-size: 13px; color: #ff8d84; }

.ux-sec { padding: 16px 0; border-bottom: 1px solid var(--border-soft); }
.ux-sec:last-child { border-bottom: none; }

.ux-sec-title {
  margin: 0 0 10px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.ux-dl-grid {
  display: grid;
  grid-template-columns: 128px 1fr;
  gap: 7px 14px;
  margin: 0;
  font-size: 13.5px;
}

.ux-dl-grid dt { color: var(--text-faint); }
.ux-dl-grid dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

.ux-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.ux-btn-danger-soft { color: #ff8d84; }
.ux-btn-danger-soft:hover { color: #fff; background: var(--bad-soft); border-color: rgba(224, 72, 60, 0.55); }

.ux-machines { display: flex; flex-direction: column; gap: 8px; }

.ux-machine {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 9px 10px 9px 12px;
}

.ux-machine-off { opacity: 0.55; }

.ux-machine-ic { line-height: 0; color: var(--text-faint); flex: none; }
.ux-machine-ic svg { width: 20px; height: 20px; }
.ux-machine-text { flex: 1; min-width: 0; }
.ux-machine-name { font-weight: 500; display: flex; align-items: center; overflow-wrap: anywhere; }
.ux-machine-meta { font-size: 12px; color: var(--text-faint); }
.ux-release:hover { color: var(--bad); background: var(--bad-soft); }

.ux-customer { display: flex; align-items: flex-start; gap: 12px; }
.ux-customer-text { min-width: 0; }

.ux-drawer .ux-form-grid { gap: 12px 14px; }

/* ---- Audit timeline -------------------------------------------------------- */

.ux-audit { list-style: none; margin: 0; padding: 0; }

.ux-audit-item {
  position: relative;
  display: flex;
  gap: 12px;
  padding: 8px 0 8px 18px;
  border-left: 1px solid var(--border-soft);
  margin-left: 4px;
}

.ux-audit-dot {
  position: absolute;
  left: -4.5px;
  top: 15px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

.ux-audit-main { flex: 1; min-width: 0; }
.ux-audit-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; font-size: 13.5px; }
.ux-audit-by { color: var(--text-dim); font-size: 12.5px; }
.ux-audit-detail { font-size: 12px; color: var(--text-faint); overflow-wrap: anywhere; margin-top: 2px; }
.ux-audit-at { font-size: 12px; color: var(--text-faint); white-space: nowrap; }

/* ---- Overview -------------------------------------------------------------- */

.ux-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.ux-toolbar-text { color: var(--text-dim); font-size: 13.5px; }

.ux-tile-sub { font-size: 11.5px; color: var(--text-faint); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.ux-two {
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr);
  gap: 22px;
  margin-bottom: 22px;
}

.ux-two-even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ux-two > .card + .card { margin-top: 0; }

.ux-chart-wrap { padding: 14px 18px 10px; }
.ux-chart { width: 100%; height: auto; display: block; }
.ux-grid { stroke: var(--border-soft); stroke-width: 1; stroke-dasharray: 3 4; }
.ux-axis { stroke: var(--border); stroke-width: 1; }
.ux-tick { fill: var(--text-faint); font-size: 10.5px; font-family: var(--font); }
.ux-bar-hit { fill: transparent; }
.ux-bar-g:hover .ux-bar-hit { fill: rgba(47, 166, 255, 0.06); }
.ux-bar-a { fill: var(--accent); }
.ux-bar-b { fill: var(--good); }

.ux-legend { display: flex; flex-wrap: wrap; gap: 18px; font-size: 12.5px; color: var(--text-dim); margin-bottom: 8px; }
.ux-legend span { display: inline-flex; align-items: center; gap: 7px; }
.ux-sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.ux-sw-a { background: var(--accent); }
.ux-sw-b { background: var(--good); }

.ux-vers { padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.ux-ver-row { display: grid; grid-template-columns: 110px 1fr auto; align-items: center; gap: 12px; font-size: 13px; }
.ux-ver-name { font-weight: 600; font-variant-numeric: tabular-nums; display: inline-flex; align-items: center; gap: 6px; }
.ux-ver-new { font-size: 10px; padding: 0 6px; }
.ux-ver-track { height: 8px; background: var(--bg-deep); border-radius: 999px; overflow: hidden; border: 1px solid var(--border-soft); }
.ux-ver-fill { display: block; height: 100%; background: linear-gradient(90deg, #1f8ee6, var(--accent)); border-radius: 999px; }
.ux-ver-n { color: var(--text-dim); font-size: 12.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }

.ux-recent { display: flex; flex-direction: column; padding: 6px 8px; }

.ux-recent-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 10px;
  border-radius: var(--radius);
  color: var(--text);
  background: none;
  border: none;
  text-align: left;
  font: inherit;
  width: 100%;
  cursor: pointer;
  transition: background var(--t);
}

.ux-recent-row:hover { background: rgba(47, 166, 255, 0.05); }
.ux-recent-text { flex: 1; min-width: 0; }
.ux-recent-main { font-weight: 500; display: flex; align-items: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ux-recent-sub { font-size: 12px; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ux-recent-at { font-size: 12px; color: var(--text-faint); white-space: nowrap; }

/* ---- Responsive ------------------------------------------------------------ */

@media (max-width: 1120px) {
  .ux-two, .ux-two-even { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .ux-form-grid, .ux-grid-3 { grid-template-columns: 1fr; }
  .ux-toolbar { flex-direction: column; align-items: stretch; }
  .ux-dl-grid { grid-template-columns: 110px 1fr; }
  .ux-ver-row { grid-template-columns: 80px 1fr auto; }
}

/* ---- Person picker (views/unext/person-picker.js) ---- */
.pk { position: relative; }
.pk > .field-input { width: 100%; }
.pk-list {
  position: fixed; z-index: 115; /* above .dlg-overlay (100), below toasts */
  max-height: 320px; overflow-y: auto; padding: 4px; box-sizing: border-box;
  background: var(--surface2); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.45);
}
.pk-list[hidden] { display: none; }
.pk-head { padding: 6px 8px 4px; font-size: 11.5px; font-weight: 600; color: var(--text-faint); }
.pk-note { padding: 10px; font-size: 12.5px; color: var(--text-dim); }
.pk-opt {
  display: flex; align-items: center; gap: 10px; padding: 7px 8px;
  border-radius: 8px; cursor: pointer; min-width: 0;
}
.pk-opt[aria-selected="true"] { background: var(--accent-soft); outline: 1px solid var(--accent-glow); }
.pk-opt .avatar { flex: none; }
.pk-tx { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.35; }
.pk-tx b { font-size: 13px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pk-tx small { font-size: 11.5px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pk-list { container-type: inline-size; }
.pk-chips { flex: none; justify-content: flex-end; flex-wrap: nowrap; }
@container (max-width: 420px) { .pk-chips .pp-chip + .pp-chip { display: none; } }
.pk-chips .pp-chip { font-size: 11px; padding: 0 7px; }
.pk-badge {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%; margin-top: 6px;
  padding: 2px 4px 2px 8px; font-size: 12px; color: var(--accent);
  background: var(--accent-soft); border: 1px solid var(--accent-glow); border-radius: 20px;
}
.pk-badge[hidden] { display: none; }
.pk-badge-ic { display: inline-flex; width: 13px; height: 13px; flex: none; }
.pk-badge-ic svg, .pk-unlink svg { width: 100%; height: 100%; }
.pk-badge-tx { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.pk-unlink {
  display: inline-flex; width: 20px; height: 20px; padding: 4px; flex: none;
  border: 0; border-radius: 50%; background: transparent; color: inherit; cursor: pointer;
}
.pk-unlink:hover { background: var(--accent-glow); }

/* Error reports */
.ux-reports { display: grid; gap: 12px; }
.ux-report { border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; }
.ux-report-done { opacity: .6; }
.ux-report-head { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }
.ux-report-msg { overflow-wrap: anywhere; }
.ux-report-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 6px; font-size: 12.5px; color: var(--text-dim, #9aa4b2); }
.ux-report-detail { margin: 10px 0 0; padding: 8px 10px; border-radius: 6px; background: rgba(0, 0, 0, .25); font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 180px; overflow: auto; }
