/* ========================================
   NEXUS AUTH TOOL — Panel layer
   Client cabinet + admin panel. Loaded after nexus.css and reuses
   its tokens, header, logo, buttons and inputs so the panels read as
   one product with the public pages.
   ======================================== */

:root {
  --px-surface: rgba(17, 24, 39, 0.55);
  --px-surface-solid: #0b1222;
  --px-line: rgba(255, 255, 255, 0.07);
  --px-line-soft: rgba(255, 255, 255, 0.045);
  --px-ink-dim: #64748b;
  --px-grad: linear-gradient(135deg, #4A9EFF, #6b4aff);
  --px-ok: #22c55e;
  --px-bad: #ef4444;
  --px-warn: #f59e0b;
  --px-info: #a78bfa;
  --px-mute: #94a3b8;
  --px-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace;

  /* Theme-dependent surfaces and inks (dark is the default) */
  --px-canvas-glow: radial-gradient(ellipse 1000px 600px at 50% -120px, rgba(74, 158, 255, 0.16), rgba(74, 158, 255, 0.05) 45%, transparent 72%),
                    radial-gradient(ellipse 80% 55% at 50% 0%, rgba(30, 80, 180, 0.18), transparent 70%);
  --px-bar-bg: rgba(8, 13, 26, 0.85);
  --px-chip-bg: rgba(14, 20, 32, 0.8);
  --px-pop-bg: rgba(11, 18, 34, 0.94);
  --px-modal-bg: rgba(13, 19, 33, 0.97);
  --px-scrim: rgba(4, 7, 15, 0.72);
  --px-ctrl-bg: #0e1420;
  --px-ctrl-border: #1b2436;
  --px-well: rgba(0, 0, 0, 0.3);
  --px-well-soft: rgba(0, 0, 0, 0.2);
  --px-tint: rgba(255, 255, 255, 0.025);
  --px-hover: rgba(30, 41, 59, 0.4);
  --px-row-hover: rgba(74, 158, 255, 0.035);
  --px-track: #1e293b;
  --px-knob: #94a3b8;
  --px-shadow-color: rgba(0, 0, 0, 0.35);
  --px-shadow-strong: rgba(0, 0, 0, 0.5);
  --px-ink-ok: #4ade80;
  --px-ink-ok-soft: #86efac;
  --px-ink-bad: #f87171;
  --px-ink-bad-soft: #fca5a5;
  --px-ink-bad-strong: #fecaca;
  --px-ink-warn: #fbbf24;
  --px-ink-info: #c4b5fd;
  --px-ink-primary: #93c5fd;
  --px-ink-code: #cbd5e1;
}

/* Global scrollbars (Firefox & Webkit); colors follow the theme via --sb-* */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--sb-thumb) var(--sb-track);
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--sb-track);
}

::-webkit-scrollbar-thumb {
  background: var(--sb-thumb);
  border-radius: 4px;
  border: 1px solid var(--sb-track);
  transition: background 0.2s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--sb-thumb-hover);
  box-shadow: 0 0 10px var(--sb-glow);
}

::-webkit-scrollbar-corner {
  background: var(--sb-track);
}

/* ---------- Page canvas ---------- */
body.px-body {
  background-color: var(--bg);
  background-image: var(--px-canvas-glow);
  background-repeat: no-repeat;
  background-attachment: fixed;
  min-height: 100vh;
}

.px-particles {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.px-main {
  position: relative;
  z-index: 1;
  padding-top: 40px;
  padding-bottom: 56px;
}

.px-icon { flex-shrink: 0; }

/* ---------- Header ---------- */
.px-top { z-index: 100; }

.px-top .nx-header-inner { gap: 16px; }

.px-brand { min-width: 0; }

.px-context {
  margin-left: 4px;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-family: var(--px-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}

body[data-panel="admin"] .px-context {
  color: var(--px-ink-info);
  border-color: rgba(107, 74, 255, 0.4);
  background: rgba(107, 74, 255, 0.1);
}

.px-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.px-lang {
  display: inline-flex;
  align-items: center;
  background: var(--px-ctrl-bg);
  border: 1px solid var(--px-ctrl-border);
  border-radius: 8px;
  padding: 3px;
  font-size: 12px;
  font-weight: 700;
}

.px-lang a {
  padding: 4px 8px;
  border-radius: 5px;
  color: var(--px-ink-dim);
  transition: color var(--transition), background var(--transition);
}

.px-lang a:hover { color: var(--text); }

.px-lang a.active {
  color: #fff;
  background: #4A9EFF;
}

.px-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 4px 0 12px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--px-chip-bg);
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}

.px-chip-value {
  font-family: var(--px-mono);
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.px-chip-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--px-grad);
  color: #fff;
  transition: filter var(--transition);
}

.px-chip-action:hover { filter: brightness(1.15); }

.px-chip-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--px-ok);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18);
}

.px-chip-dot.is-mock {
  background: var(--px-warn);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18);
}

.px-chip--plain { padding-right: 12px; }

.admin-panel-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid rgba(107, 74, 255, 0.4);
  background: rgba(107, 74, 255, 0.1);
  color: var(--px-ink-info);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: background var(--transition);
}

.admin-panel-btn:hover { background: rgba(107, 74, 255, 0.18); }

.px-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 3px 10px 3px 3px;
  border-radius: 10px;
  border: 1px solid transparent;
  transition: border-color var(--transition), background var(--transition);
}

.px-user:hover {
  border-color: var(--border);
  background: var(--px-hover);
}

.px-avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--primary-10);
  border: 1px solid var(--primary-20);
  color: var(--primary);
  font-weight: 700;
  font-size: 14px;
}

.px-user-meta h4 {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.px-user-meta span {
  display: block;
  font-size: 11px;
  color: var(--px-ink-dim);
  line-height: 1.3;
}

.px-sep {
  width: 1px;
  height: 20px;
  background: var(--px-line);
  flex-shrink: 0;
}

/* Language + theme: one segmented control */
.px-prefs {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 40px;
  padding: 4px;
  border: 1px solid var(--px-ctrl-border);
  border-radius: 11px;
  background: var(--px-ctrl-bg);
}

.px-prefs .px-sep { margin: 0 3px; }

.px-prefs-lang {
  display: inline-grid;
  place-items: center;
  min-width: 32px;
  height: 30px;
  padding: 0 6px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--px-ink-dim);
  transition: color var(--transition), background var(--transition);
}

.px-prefs-lang:hover { color: var(--text); }

.px-prefs-lang.active {
  color: #fff;
  background: var(--px-grad);
}

.px-theme-btn {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition), background var(--transition);
}

.px-theme-btn:hover { color: var(--text); background: var(--px-hover); }

/* Account pill: who you are + quick actions */
.px-account {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 40px;
  padding: 3px;
  border: 1px solid var(--px-ctrl-border);
  border-radius: 12px;
  background: var(--px-ctrl-bg);
}

.px-account .px-user {
  height: 32px;
  padding: 0 10px 0 2px;
  border: 0;
  border-radius: 9px;
}

.px-account .px-sep { margin: 0 2px; }

.px-account-btn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 9px;
  color: var(--text-muted);
  transition: color var(--transition), background var(--transition);
}

.px-account-btn:hover { color: var(--text); background: var(--px-hover); }
.px-account-btn.admin-panel-btn { color: var(--px-ink-info); border: 0; background: transparent; padding: 0; }
.px-account-btn.admin-panel-btn:hover { background: rgba(107, 74, 255, 0.12); }
.px-logout:hover { color: var(--px-ink-bad); background: rgba(239, 68, 68, 0.1); }

/* Admin: supplier state as quiet text, not a button */
.px-supplier {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 6px;
}

.px-supplier-text { display: flex; flex-direction: column; line-height: 1.25; }

.px-supplier-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--px-ink-dim);
}

.px-supplier-value {
  font-family: var(--px-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

/* Public pages: guest actions */
.px-guest { display: inline-flex; align-items: center; gap: 8px; }
.px-guest .nx-btn { height: 40px; padding: 0 16px; border-radius: 11px; }
.px-guest .nx-btn-primary { background: var(--px-grad); }

/* Shows the mode you switch to: sun while dark, moon while light */
.px-theme-moon { display: none; }
html[data-theme="light"] .px-theme-sun { display: none; }
html[data-theme="light"] .px-theme-moon { display: block; }

/* ---------- Section tabs ---------- */
.px-tabs {
  position: sticky;
  top: 64px;
  z-index: 99;
  border-bottom: 1px solid var(--border);
  background: var(--px-bar-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.px-tabs-inner {
  display: flex;
  align-items: stretch;
  gap: 2px;
  height: 48px;
  overflow-x: auto;
  scrollbar-width: none;
}

.px-tabs-inner::-webkit-scrollbar { display: none; }

.px-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  transition: color var(--transition);
}

.px-tab:hover { color: var(--text); }

.px-tab::after {
  content: '';
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: var(--px-grad);
  transform: scaleX(0);
  transition: transform var(--transition);
}

.px-tab.active { color: var(--text); }
.px-tab.active::after { transform: scaleX(1); }
.px-tab.active .px-icon { color: var(--primary); }

.px-tabs-gap { flex: 1 0 16px; }

.px-tab--muted { color: var(--px-ink-dim); }
.px-tab--danger:hover { color: var(--px-ink-bad); }

.px-tab.admin-nav-link { color: var(--px-ink-info); }

/* Admin has more tabs: slightly tighter so they fit the 1280px container without side scroll */
body[data-panel="admin"] .px-tab { padding: 0 11px; }
body[data-panel="admin"] .px-tab::after { left: 11px; right: 11px; }

/* Tabs never scroll sideways: when the row is too narrow, inactive tabs show only their icon
   (the label is in the tooltip); on phones every tab is icon-only, the active one is underlined. */
/* Same when the labels simply do not fit (panel.js measures the row and sets .is-compact) */
.px-tabs.is-compact .px-tab:not(.active) .px-tab-label { display: none; }
.px-tabs.is-compact .px-tab:not(.active) { padding: 0 12px; }

@media (max-width: 1279px) {
  .px-tab:not(.active) .px-tab-label { display: none; }
  .px-tab:not(.active), body[data-panel="admin"] .px-tab:not(.active) { padding: 0 12px; }
}
@media (max-width: 639px) {
  .px-tabs-inner { justify-content: space-between; }
  .px-tab .px-tab-label { display: none; }
  .px-tab, body[data-panel="admin"] .px-tab { padding: 0 9px; }
  .px-tab::after, body[data-panel="admin"] .px-tab::after { left: 6px; right: 6px; }
  .px-tabs-gap { flex: 0 0 0; }
}

/* ---------- Page head ---------- */
.px-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.px-head .px-eyebrow { margin-bottom: 16px; }

.px-head h1 {
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.px-head p {
  margin-top: 10px;
  max-width: 62ch;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.px-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ---------- Metric strip ---------- */
.px-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1px;
  background: var(--px-line);
  border: 1px solid var(--px-line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 28px;
}

.px-metric {
  padding: 22px 24px;
  background: var(--px-pop-bg);
}

.px-metric-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.px-metric-label::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--px-mute);
}

.px-metric[data-tone="ok"] .px-metric-label::before { background: var(--px-ok); }
.px-metric[data-tone="bad"] .px-metric-label::before { background: var(--px-bad); }
.px-metric[data-tone="warn"] .px-metric-label::before { background: var(--px-warn); }
.px-metric[data-tone="info"] .px-metric-label::before { background: var(--px-info); }
.px-metric[data-tone="primary"] .px-metric-label::before { background: var(--primary); }

.px-metric .value,
.px-metric .stat-value {
  margin: 12px 0 4px;
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.px-metric .value.is-small { font-size: 1.25rem; padding: 6px 0 3px; }

.px-metric-hint {
  font-size: 12.5px;
  color: var(--px-ink-dim);
}

/* ---------- Cards ---------- */
.px-card {
  position: relative;
  background: var(--px-surface);
  border: 1px solid var(--px-line);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  margin-bottom: 24px;
}

.px-card--accent { border-color: var(--primary-20); }

.px-card--accent::before {
  content: '';
  position: absolute;
  top: 0;
  left: 24px;
  right: 24px;
  height: 2px;
  background: linear-gradient(to right, transparent, #4A9EFF, #6b4aff, transparent);
}

.px-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--px-line);
  flex-wrap: wrap;
}

.px-card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.px-card-title h2 {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.px-card-title .px-icon { color: var(--primary); }

.px-count {
  font-family: var(--px-mono);
  font-size: 12px;
  color: var(--px-ink-dim);
  padding: 2px 8px;
  border: 1px solid var(--px-line);
  border-radius: 999px;
}

.px-card-body { padding: 24px; }

.px-card-note {
  font-size: 13px;
  color: var(--px-ink-dim);
}

.px-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

.px-grid-main {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.px-grid-2 > .px-card,
.px-grid-main > .px-card,
.px-grid-main > div > .px-card:last-child { margin-bottom: 0; }

.px-grid-2,
.px-grid-main { margin-bottom: 24px; }

/* ---------- Forms ---------- */
.px-field { margin-bottom: 18px; }
.px-field:last-child { margin-bottom: 0; }

.px-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.px-help {
  margin-top: 6px;
  font-size: 12px;
  color: var(--px-ink-dim);
}

.nx-input.px-plain { padding-left: 16px; }

.nx-input[readonly],
.nx-input:disabled {
  color: var(--text-muted);
  background: var(--px-tint);
  cursor: not-allowed;
}

select.nx-input {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  cursor: pointer;
}

select.nx-input option { background: var(--px-ctrl-bg); color: var(--text); }

.nx-input.px-mono { font-family: var(--px-mono); letter-spacing: 0.02em; }

.px-actions-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 20px;
}

.px-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12.5px;
  color: var(--px-ink-dim);
  max-width: 52ch;
}

.px-note .px-icon { margin-top: 2px; color: var(--primary); }

/* Toggle rows */
.px-toggle {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: start;
  padding: 16px 18px;
  border: 1px solid var(--px-line);
  border-radius: 12px;
  background: var(--px-well-soft);
  cursor: pointer;
  transition: border-color var(--transition);
}

.px-toggle + .px-toggle { margin-top: 12px; }
.px-toggle:hover { border-color: var(--primary-20); }

.px-toggle input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  width: 38px;
  height: 22px;
  margin-top: 1px;
  border-radius: 11px;
  background: var(--px-track);
  border: 1px solid var(--px-line);
  cursor: pointer;
  transition: background var(--transition);
}

.px-toggle input[type="checkbox"]::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--px-knob);
  transition: transform var(--transition), background var(--transition);
}

.px-toggle input[type="checkbox"]:checked { background: var(--px-grad); border-color: transparent; }
.px-toggle input[type="checkbox"]:checked::after { transform: translateX(16px); background: #fff; }
.px-toggle input[type="checkbox"]:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.px-toggle-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-weight: 600;
  font-size: 14px;
}

.px-toggle-desc {
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.55;
}

.px-section-label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0 16px;
  font-family: var(--px-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--px-ink-dim);
}

.px-section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--px-line);
}

/* ---------- Buttons (extends .nx-btn) ---------- */
.nx-btn.px-btn-sm { padding: 7px 12px; font-size: 0.8125rem; border-radius: 7px; }
.nx-btn.px-btn-icon { width: 32px; height: 32px; padding: 0; }

.nx-btn-danger {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: var(--px-ink-bad);
}

.nx-btn-danger:hover { background: rgba(239, 68, 68, 0.18); }

.nx-btn-outline:hover,
.nx-btn-secondary:hover { border-color: var(--primary-30); }

.nx-btn[disabled] { opacity: 0.6; cursor: progress; }

/* ---------- Toolbar & segmented filter ---------- */
.px-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--px-line);
  flex-wrap: wrap;
}

.px-toolbar .nx-input-group { flex: 1 1 260px; max-width: 380px; }
.px-toolbar select.nx-input { width: auto; min-width: 200px; }
.px-toolbar .nx-input { padding-top: 9px; padding-bottom: 9px; }

.px-seg {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border-radius: 9px;
  background: var(--px-well);
  border: 1px solid var(--px-line);
}

.px-seg a {
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
}

.px-seg a:hover { color: var(--text); }

.px-seg a.active {
  color: var(--text);
  background: var(--bg-secondary);
  border-color: var(--border);
}

/* ---------- Tables ---------- */
.px-table-wrap { overflow-x: auto; }

.px-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.px-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--px-ink-dim);
  border-bottom: 1px solid var(--px-line);
  white-space: nowrap;
}

.px-table--wrap-head th.is-num { white-space: normal; min-width: 96px; max-width: 150px; line-height: 1.4; }

.px-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--px-line-soft);
  vertical-align: middle;
}

.px-table th:first-child,
.px-table td:first-child { padding-left: 24px; }

.px-table th:last-child,
.px-table td:last-child { padding-right: 24px; }

.px-table tbody tr { transition: background var(--transition); }
.px-table tbody tr:hover { background: var(--px-row-hover); }
.px-table tbody tr:last-child td { border-bottom: none; }

.px-table .is-num { text-align: right; }
.px-table .is-actions { text-align: right; white-space: nowrap; }

.px-id {
  font-family: var(--px-mono);
  font-size: 12.5px;
  color: var(--px-ink-dim);
}

.px-num {
  font-family: var(--px-mono);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.px-strong { font-weight: 600; color: var(--text); }

/* Job number in job tables: one line, primary ink */
.px-table td.px-nowrap { white-space: nowrap; }
.px-id-op { color: var(--px-ink-primary); font-weight: 700; }

/* Dense ledger (11 columns, admin job monitor): tighter cells, long names cut with a tooltip.
   Never scrolls sideways: below 1280px the optional columns (.px-col-opt, also shown in the
   details modal) hide, below 900px every row becomes a card of "label: value" lines. */
.px-table--dense th,
.px-table--dense td { padding-left: 10px; padding-right: 10px; }
.px-ellipsis { display: inline-block; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }

@media (max-width: 1279px) {
  .px-table--dense .px-col-opt { display: none; }
}

@media (max-width: 899px) {
  .px-table--dense thead { display: none; }
  .px-table--dense,
  .px-table--dense tbody,
  .px-table--dense tr { display: block; width: 100%; }
  .px-table--dense tr { padding: 10px 16px; border-bottom: 1px solid var(--px-line-soft); }
  .px-table--dense tbody tr:last-child { border-bottom: none; }
  .px-table--dense td,
  .px-table--dense .px-col-opt {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    padding: 5px 0 !important;
    border: 0;
    text-align: right;
    white-space: normal;
  }
  .px-table--dense td::before {
    content: attr(data-label);
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--px-ink-dim);
    text-align: left;
    margin-right: auto;
  }
  .px-table--dense td.px-empty { display: block; text-align: center; }
  .px-table--dense td.px-empty::before { content: none; }
  .px-table--dense .px-ellipsis { max-width: 60vw; }
}

/* Icon-only row action: keeps its button look (outline / danger tint), square, tooltip from title */
.nx-btn.px-btn-sm.px-btn-icon { width: 32px; height: 32px; padding: 0; justify-content: center; gap: 0; }
.px-dim { color: var(--px-ink-dim); }
.px-muted { color: var(--text-muted); }
.px-pos { color: var(--px-ink-ok); }
.px-neg { color: var(--px-ink-bad); }

/* Date over time in narrow table columns (PanelUi::dtStack) */
.px-dt-stack { display: inline-flex; flex-direction: column; gap: 1px; line-height: 1.25; white-space: nowrap; font-variant-numeric: tabular-nums; }
.px-dt-date { font-size: 12.5px; color: var(--text); }
.px-dt-time { font-size: 11.5px; color: var(--px-ink-dim); }

.px-time {
  font-size: 12.5px;
  color: var(--px-ink-dim);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.px-key {
  font-family: var(--px-mono);
  font-size: 12px;
  color: var(--px-ink-code);
  background: var(--px-well);
  border: 1px solid var(--px-line-soft);
  padding: 3px 7px;
  border-radius: 6px;
  white-space: nowrap;
}

.px-sub {
  display: block;
  font-size: 12px;
  color: var(--px-ink-dim);
  margin-top: 2px;
}

.px-empty {
  padding: 48px 24px !important;
  text-align: center;
  color: var(--px-ink-dim);
}

.px-cell-actions {
  display: inline-flex;
  gap: 6px;
  justify-content: flex-end;
}

.px-cell-actions form { display: inline-flex; }

/* Services: markup for new services in the card head, stats under each service */
.px-markup-form { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.px-markup-label { font-size: 13px; color: var(--text-muted); }
.px-markup-input { position: relative; display: inline-flex; align-items: center; }
.px-markup-input .nx-input { width: 84px; padding-top: 7px; padding-bottom: 7px; padding-right: 26px; text-align: right; }
.px-markup-input span { position: absolute; right: 10px; color: var(--text-muted); font-size: 13px; pointer-events: none; }
.px-service-stats { margin-top: 4px; }
.px-markup-label { display: inline-flex; align-items: center; gap: 5px; cursor: help; }
.px-markup-note { display: flex; align-items: flex-start; gap: 8px; margin: 0; padding: 10px 24px; border-bottom: 1px solid var(--px-line); font-size: 12.5px; color: var(--text-muted); }
.px-markup-note .px-icon { flex-shrink: 0; margin-top: 2px; color: var(--primary); }
.px-service-stats a { color: var(--primary); }
.px-textarea { height: auto; min-height: 120px; resize: vertical; }

/* Phone platform badge and the "Free" chip of operations (admin models, cabinet models) */
.mdl-plat {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid var(--px-line);
  font-family: var(--px-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.mdl-plat--qualcomm { color: var(--px-ink-primary); border-color: var(--primary-30); background: var(--primary-10); }
.mdl-plat--mediatek { color: var(--px-ink-warn); border-color: rgba(245, 158, 11, 0.4); background: rgba(245, 158, 11, 0.1); }
.mdl-plat--unisoc { color: var(--px-ink-info); border-color: rgba(107, 74, 255, 0.4); background: rgba(107, 74, 255, 0.1); }
.mdl-free {
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.1);
  color: var(--px-ink-ok);
  font-family: var(--px-mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Facts of a job or a model in a window: label over value */
.px-job-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px 18px; margin: 0 0 18px; }
.px-job-facts dt { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--px-ink-dim); margin-bottom: 4px; }
.px-job-facts dd { margin: 0; font-size: 14px; overflow-wrap: anywhere; }

/* Cabinet: phone models */
.cm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; padding: 20px 24px 24px; }
.cm-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--px-line);
  border-radius: var(--radius-lg);
  background: var(--px-surface);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--transition), transform var(--transition);
}
.cm-card:hover { border-color: var(--primary-30); transform: translateY(-2px); }
.cm-pic {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 4 / 3;
  margin-bottom: 6px;
  border-radius: 12px;
  border: 1px solid var(--px-line);
  background: var(--px-well);
  color: var(--px-ink-dim);
  overflow: hidden;
}
html[data-theme="light"] .cm-pic { background: #fff; }
.cm-pic img { position: absolute; inset: 8px; width: calc(100% - 16px); height: calc(100% - 16px); object-fit: contain; background: inherit; }
.cm-pic img[hidden] { display: none; }
.cm-pic--lg { width: 180px; aspect-ratio: 1 / 1; flex-shrink: 0; margin: 0; }
.cm-name { font-weight: 700; font-size: 15px; line-height: 1.3; }
.cm-code { font-family: var(--px-mono); font-size: 12px; color: var(--text-muted); }
.cm-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 2px; }
.cm-meta { font-size: 12.5px; color: var(--text-muted); margin-top: auto; padding-top: 4px; }
.cm-empty { padding: 40px 24px; }
.cm-detail-top { display: flex; gap: 20px; align-items: flex-start; margin-bottom: 8px; }
.cm-detail-top .px-job-facts { flex: 1; }
.cm-ops { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.cm-op { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; border: 1px solid var(--px-line); border-radius: 10px; font-size: 13px; font-weight: 500; }
.cm-ops-mode { text-transform: none; letter-spacing: 0; font-family: inherit; font-size: 12px; font-weight: 600; color: var(--px-ink-warn); }
.cm-ops-note { margin: -8px 0 18px; font-size: 12.5px; color: var(--text-muted); }
.cm-ops-note[hidden] { display: none; }
.cm-ops-note a { color: var(--primary); }
.cm-price { font-family: var(--px-mono); font-size: 12px; font-weight: 700; color: var(--primary); }
[data-cm-general-box][hidden] { display: none; }
.cm-files { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.cm-file { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid var(--px-line); border-radius: 10px; }
.cm-file-name { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
@media (max-width: 600px) {
  .cm-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 14px 16px; }
  .cm-detail-top { flex-direction: column; }
  .cm-pic--lg { width: 140px; }
}

/* Supplier chip in the admin header opens the supplier page */
a.px-supplier { color: inherit; text-decoration: none; }
a.px-supplier:hover { border-color: var(--primary-30); }

/* Metric card that opens its page */
a.px-metric--link { color: inherit; text-decoration: none; transition: background var(--transition); }
a.px-metric--link:hover { background: var(--px-row-hover); }

/* Admin dashboard: what needs attention; each tile opens the place to act */
.px-attention { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 18px 0 24px; }
.px-attention-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border: 1px solid var(--px-line);
  border-radius: var(--radius-lg);
  background: var(--px-surface);
  color: inherit;
  text-decoration: none;
  transition: border-color var(--transition), background var(--transition);
}
.px-attention-item:hover { border-color: var(--primary-30); background: var(--px-row-hover); }
.px-attention-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 10px;
  background: var(--px-tint);
  color: var(--px-ink-dim);
}
.px-attention-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.px-attention-label { font-weight: 600; font-size: 14px; }
.px-attention-hint { font-size: 12.5px; color: var(--text-muted); }
.px-attention-count { font-family: var(--px-mono); font-size: 22px; font-weight: 700; color: var(--px-ink-dim); }
.px-attention-item.is-on { border-color: rgba(245, 158, 11, 0.4); }
.px-attention-item.is-on .px-attention-icon { background: rgba(245, 158, 11, 0.12); color: var(--px-ink-warn); }
.px-attention-item.is-on .px-attention-count { color: var(--px-ink-warn); }
@media (max-width: 900px) { .px-attention { grid-template-columns: 1fr; } }

/* Phone of a job: catalog picture + name + codename (PanelUi::device) */
.px-dev { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.px-dev-thumb {
  position: relative;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--px-line);
  background: var(--px-well);
  color: var(--px-ink-dim);
  overflow: hidden;
}
html[data-theme="light"] .px-dev-thumb { background: #fff; }
.px-dev-thumb img { position: absolute; inset: 2px; width: calc(100% - 4px); height: calc(100% - 4px); object-fit: contain; background: inherit; }
.px-dev-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; line-height: 1.25; }
.px-dev-name { font-weight: 600; color: var(--text); }
a.px-dev-name:hover { color: var(--primary); }
.px-dev-code { font-family: var(--px-mono); font-size: 0.75rem; color: var(--text-muted); }

/* Client login linked to the client card (PanelUi::userLink) */
a.px-user-link { color: inherit; text-decoration: none; border-bottom: 1px dashed transparent; }
a.px-user-link:hover { color: var(--primary); border-bottom-color: currentColor; }

/* Status dot + label */
.px-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.px-status i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.px-status--ok { color: var(--px-ink-ok); }
.px-status--ok i { box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.16); }
.px-status--bad { color: var(--px-ink-bad); }
.px-status--bad i { box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.16); }
.px-status--warn { color: var(--px-ink-warn); }
.px-status--warn i { box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.16); }
.px-status--info { color: var(--px-ink-info); }
.px-status--info i { box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.16); }
.px-status--mute { color: var(--px-mute); }

/* Outline tag */
.px-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--px-line);
  background: var(--px-tint);
  font-family: var(--px-mono);
  font-size: 11px;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  white-space: nowrap;
}

.px-tag--primary { color: var(--px-ink-primary); border-color: var(--primary-30); background: var(--primary-10); }
.px-tag--violet { color: var(--px-ink-info); border-color: rgba(107, 74, 255, 0.4); background: rgba(107, 74, 255, 0.1); }

a.px-tag:hover { border-color: var(--primary-30); color: var(--text); }

/* ---------- Pagination ---------- */
.px-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  border-top: 1px solid var(--px-line);
  flex-wrap: wrap;
}

.px-pager-info { font-size: 13px; color: var(--px-ink-dim); }

.px-pager-pages { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.px-pager-size { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--px-ink-dim); }
.px-pager-size .px-seg a { padding: 4px 10px; font-family: var(--px-mono); font-size: 12px; }

.px-page {
  display: inline-grid;
  place-items: center;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border-radius: 7px;
  border: 1px solid var(--px-line);
  font-family: var(--px-mono);
  font-size: 12.5px;
  color: var(--text-muted);
  transition: all var(--transition);
}

.px-page:hover { color: var(--text); border-color: var(--primary-30); }

.px-page.active {
  color: #fff;
  border-color: transparent;
  background: var(--px-grad);
}

.px-page-gap { color: var(--px-ink-dim); padding: 0 4px; }

/* ---------- Flash ---------- */
.px-flash {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px 12px 16px;
  margin-bottom: 24px;
  border-radius: 10px;
  border: 1px solid;
  font-size: 14px;
  font-weight: 500;
  word-break: break-word;
}

.px-flash--ok { background: rgba(34, 197, 94, 0.08); border-color: rgba(34, 197, 94, 0.3); color: var(--px-ink-ok-soft); }
.px-flash--bad { background: rgba(239, 68, 68, 0.08); border-color: rgba(239, 68, 68, 0.3); color: var(--px-ink-bad-soft); }

.px-flash-close {
  margin-left: auto;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  opacity: 0.7;
  cursor: pointer;
}

.px-flash-close:hover { opacity: 1; background: var(--px-hover); }

/* ---------- Modals ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: var(--px-scrim);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.modal-overlay.active,
.modal-overlay.open { display: flex; animation: pxFade 0.18s ease-out; }

.modal-container {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  background: var(--px-modal-bg);
  border: 1px solid var(--primary-20);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px var(--px-shadow-strong);
  animation: pxRise 0.22s ease-out;
}

.modal-container.is-wide { max-width: 720px; }

.modal-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 24px;
  right: 24px;
  height: 2px;
  background: linear-gradient(to right, transparent, #4A9EFF, #6b4aff, transparent);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--px-line);
}

.modal-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1rem;
  font-weight: 700;
}

.modal-title .px-icon { color: var(--primary); }

.modal-close {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--px-line);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}

.modal-close:hover { color: var(--text); border-color: var(--primary-30); }

.modal-body { padding: 24px; }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--px-line);
}

.px-target {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  margin-bottom: 20px;
  border-radius: 12px;
  border: 1px solid var(--px-line);
  background: var(--px-well-soft);
}

.px-target-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--px-ink-dim);
}

.px-target-value { font-weight: 700; font-size: 15px; }

.px-warning {
  display: flex;
  gap: 10px;
  padding: 14px 16px;
  margin-bottom: 20px;
  border-radius: 12px;
  border: 1px solid rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.07);
  color: var(--px-ink-bad-soft);
  font-size: 13px;
  line-height: 1.5;
}

.px-warning strong { display: block; color: var(--px-ink-bad-strong); margin-bottom: 2px; }

.px-code,
.detail-value,
.json-viewer {
  font-family: var(--px-mono);
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--px-ink-code);
  background: var(--px-well);
  border: 1px solid var(--px-line);
  border-radius: 10px;
  padding: 12px 14px;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 220px;
  overflow: auto;
}

.px-code-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.px-code-head .nx-label { margin-bottom: 0; }

.px-kv {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.px-kv > div {
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--px-line);
  background: var(--px-well-soft);
}

.px-kv dt {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--px-ink-dim);
  margin-bottom: 4px;
}

.px-kv dd { font-weight: 600; }

/* ---------- Definition list (account info) ---------- */
.px-dl {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1px;
  background: var(--px-line-soft);
}

.px-dl > div {
  padding: 18px 24px;
  background: var(--px-surface);
}

.px-card > .px-dl:last-child {
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  overflow: hidden;
}

.px-dl dt {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--px-ink-dim);
  margin-bottom: 6px;
}

.px-dl dd { font-weight: 600; font-size: 14px; }

/* ---------- Quick links (admin overview) ---------- */
.px-quick {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}


/* ---------- Admin specifics ---------- */
.px-inline-form { display: inline-flex; margin: 0; }

.px-row-off td:not(.is-actions) { opacity: 0.5; }

.px-mono-inline { font-family: var(--px-mono); font-size: 11.5px; }

.px-stack { display: flex; flex-direction: column; gap: 10px; }

.px-lines > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--px-line-soft);
}

.px-lines > div:last-child { border-bottom: none; }
.px-lines dt { font-size: 13px; color: var(--text-muted); }
.px-lines dd { font-size: 13px; }

.px-savebar {
  position: relative;
  margin-top: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px 14px 24px;
  border: 1px solid var(--primary-20);
  border-radius: 14px;
  background: var(--px-modal-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 12px 32px var(--px-shadow-color);
  flex-wrap: wrap;
}

.px-head-actions .px-status { font-size: 14px; }

/* ---------- Footer ---------- */
.px-foot {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--border);
}

.px-foot-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 32px;
  font-size: 13px;
  color: var(--px-ink-dim);
  flex-wrap: wrap;
}

.px-foot-inner strong { color: var(--text-muted); font-weight: 600; }

.px-foot-links { display: flex; gap: 18px; align-items: center; }
.px-foot-links a:hover { color: var(--text); }

/* ---------- Motion ---------- */
@keyframes pxFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pxRise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.px-reveal { animation: pxRise 0.35s ease-out both; }

@media (prefers-reduced-motion: reduce) {
  .modal-overlay.active, .modal-container, .px-reveal { animation: none; }
}

/* ---------- Responsive ---------- */
body.px-body { overflow-x: clip; }

@media (max-width: 1100px) {
  .px-grid-main { grid-template-columns: 1fr; }
  .px-user-meta { display: none; }
  .px-user { padding-right: 3px; }
}

@media (max-width: 900px) {
  .px-grid-2 { grid-template-columns: 1fr; }
  .px-hide-md { display: none !important; }
}

@media (max-width: 640px) {
  .px-main { padding-top: 28px; }
  .px-context, .px-hide-sm { display: none !important; }
  .px-row, .px-kv { grid-template-columns: 1fr; }
  .px-card-head, .px-card-body, .px-toolbar, .px-pager { padding-left: 16px; padding-right: 16px; }
  .px-table th:first-child, .px-table td:first-child { padding-left: 16px; }
  .px-table th:last-child, .px-table td:last-child { padding-right: 16px; }
  .px-metric { padding: 18px; }
  .px-metric .value, .px-metric .stat-value { font-size: 1.4rem; }
  .px-toolbar .nx-input-group { max-width: none; }
  .px-toolbar select.nx-input { width: 100%; }
  .px-top .nx-logo-text { display: none; }
  .px-tools { gap: 8px; }
  .px-metrics { grid-template-columns: 1fr 1fr; }
  .px-head-actions { width: 100%; }
  .px-head-actions .nx-btn { flex: 1; }
  .modal-footer { flex-direction: column-reverse; }
  .modal-footer .nx-btn { width: 100%; }
}

/* Free-text description column: keep it readable inside wide ledgers */
.px-table td.px-desc { min-width: 260px; max-width: 420px; line-height: 1.5; }

/* ========================================
   Day mode — html[data-theme="light"], set by assets/js/theme.js
   ======================================== */
html[data-theme="light"] {
  color-scheme: light;
  --bg: #f2f5fa;
  --bg-card: rgba(255, 255, 255, 0.86);
  --bg-card-hover: #ffffff;
  --bg-secondary: rgba(226, 232, 240, 0.7);
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --text: #0f172a;
  --text-muted: #475569;
  --border: rgba(15, 23, 42, 0.1);
  --border-hover: rgba(37, 99, 235, 0.45);
  --shadow: 0 4px 24px rgba(15, 23, 42, 0.08);

  --px-surface: rgba(255, 255, 255, 0.8);
  --px-surface-solid: #ffffff;
  --px-line: rgba(15, 23, 42, 0.09);
  --px-line-soft: rgba(15, 23, 42, 0.055);
  --px-ink-dim: #64748b;
  --px-canvas-glow: radial-gradient(ellipse 1000px 600px at 50% -120px, rgba(59, 130, 246, 0.16), rgba(59, 130, 246, 0.05) 45%, transparent 72%),
                    radial-gradient(ellipse 70% 50% at 85% 0%, rgba(107, 74, 255, 0.07), transparent 70%);
  --px-bar-bg: rgba(255, 255, 255, 0.82);
  --px-chip-bg: rgba(255, 255, 255, 0.92);
  --px-pop-bg: rgba(255, 255, 255, 0.92);
  --px-modal-bg: #ffffff;
  --px-scrim: rgba(15, 23, 42, 0.42);
  --px-ctrl-bg: #ffffff;
  --px-ctrl-border: #dbe3ee;
  --px-well: #f1f5f9;
  --px-well-soft: rgba(241, 245, 249, 0.8);
  --px-tint: rgba(15, 23, 42, 0.02);
  --px-hover: rgba(226, 232, 240, 0.65);
  --px-row-hover: rgba(37, 99, 235, 0.045);
  --px-track: #cbd5e1;
  --px-knob: #ffffff;
  --px-shadow-color: rgba(15, 23, 42, 0.1);
  --px-shadow-strong: rgba(15, 23, 42, 0.2);
  --px-ink-ok: #15803d;
  --px-ink-ok-soft: #166534;
  --px-ink-bad: #dc2626;
  --px-ink-bad-soft: #b91c1c;
  --px-ink-bad-strong: #991b1b;
  --px-ink-warn: #b45309;
  --px-ink-info: #6d28d9;
  --px-ink-primary: #1d4ed8;
  --px-ink-code: #1e293b;
}

html[data-theme="light"] .nx-header { background: var(--px-bar-bg); }

html[data-theme="light"] .nx-input,
html[data-theme="light"] .nx-input:focus { background-color: #ffffff; }

html[data-theme="light"] .nx-input::placeholder { color: #94a3b8; }

html[data-theme="light"] .px-card,
html[data-theme="light"] .px-metrics,
html[data-theme="light"] .px-savebar,
html[data-theme="light"] .px-chip,
html[data-theme="light"] .px-lang {
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.05);
}

html[data-theme="light"] .modal-container { box-shadow: 0 24px 60px var(--px-shadow-strong); }

html[data-theme="light"] .px-toggle input[type="checkbox"]::after { box-shadow: 0 1px 2px rgba(15, 23, 42, 0.25); }

html[data-theme="light"] body[data-panel="admin"] .px-context,
html[data-theme="light"] .admin-panel-btn,
html[data-theme="light"] .px-tag--violet { color: #6d28d9; }

html[data-theme="light"] .px-foot { color: var(--text-muted); }


@media (max-width: 640px) {
  .px-tools { gap: 6px; }
  .px-prefs-lang { min-width: 28px; padding: 0 4px; }
  .px-account .px-user { padding: 0 2px; }
  .px-account-btn { width: 30px; }
}

@media (max-width: 420px) {
  .px-account .px-user, .px-account .px-sep { display: none; }
  /* 360px: balance, language and account pills (plus the admin button) must fit without side scroll */
  .px-top .nx-header-inner { gap: 8px; }
  .px-tools { gap: 4px; }
  .px-chip { gap: 6px; padding-left: 8px; }
  .px-prefs .px-sep { margin: 0 1px; }
}

@media (max-width: 420px) {
  .px-guest .nx-btn { padding: 0 11px; font-size: 13px; }
  .px-guest { gap: 4px; }
}


/* Financial journal: date with the entry number under it, operation title + one sub-line */
.px-ledger-date { white-space: nowrap; }
.px-ledger-op { min-width: 260px; }
.px-ledger-op .px-sub { margin-top: 4px; line-height: 1.45; }
.px-ledger-op .px-ledger-job { color: var(--px-ink-primary); font-weight: 600; white-space: nowrap; }
.px-ledger-op .px-ledger-job:hover { text-decoration: underline; }
.px-ledger-amount { font-weight: 700; }

/* ---------- Cabinet: IMEI check ---------- */
.ic-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 20px; margin-bottom: 20px; align-items: start; }
.ic-grid > .px-card { margin-bottom: 0; }
.ic-form { display: flex; flex-direction: column; gap: 10px; padding: 20px 24px 24px; }
.ic-form[hidden] { display: none; }
.ic-imei, .ic-code { font-size: 18px; letter-spacing: 1.5px; }
.ic-for { font-size: 13px; color: var(--text-muted); }
.ic-captcha { display: flex; gap: 10px; align-items: stretch; }
.ic-captcha .ic-code { flex: 1; min-width: 0; }
.ic-captcha-img { position: relative; display: grid; place-items: center; min-width: 120px; padding: 4px 10px; border-radius: 10px; border: 1px solid var(--px-line); background: #fff; cursor: pointer; }
.ic-captcha-img img { display: block; height: 40px; }
.ic-captcha-refresh { position: absolute; right: 4px; top: 4px; color: #64748b; opacity: .7; }
.ic-captcha-img:hover .ic-captcha-refresh { opacity: 1; }
.ic-msg { font-size: 13px; color: var(--px-neg, #ef4444); }
.ic-msg.is-ok { color: var(--text-muted); }
.ic-msg[hidden] { display: none; }
.nx-btn.is-busy { opacity: .6; pointer-events: none; }
.ic-empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 48px 24px; color: var(--text-muted); text-align: center; }
.ic-empty[hidden], .ic-result[hidden], .ic-catalog[hidden], .ic-facts[hidden] { display: none; }
.ic-empty-icon { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 16px; background: var(--px-well); }
.ic-result { padding: 20px 24px 24px; display: flex; flex-direction: column; gap: 16px; }
.ic-result-top { display: flex; gap: 18px; align-items: center; }
.ic-pic { width: 112px; aspect-ratio: 1 / 1; margin: 0; flex-shrink: 0; }
.ic-result-name { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.ic-name { font-size: 20px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.ic-badge { align-self: flex-start; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; }
.ic-badge.is-ok { color: var(--px-pos, #10b981); background: rgba(16, 185, 129, .12); }
.ic-badge.is-bad { color: var(--px-neg, #ef4444); background: rgba(239, 68, 68, .1); align-self: stretch; border-radius: 10px; font-weight: 500; }
.ic-catalog { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 14px; border-radius: 12px; border: 1px dashed var(--px-line); font-size: 13px; color: var(--text-muted); }
.ic-catalog.is-on { border-style: solid; border-color: var(--primary-30); background: var(--primary-10); color: inherit; }
.ic-catalog-text { font-weight: 600; }
.ic-note { margin: 0; }
@media (max-width: 899px) {
  .ic-grid { grid-template-columns: 1fr; }
  .ic-form, .ic-result { padding: 16px; }
  .ic-pic { width: 84px; }
}
