:root {
  --bg: #070b16;
  --card: #121a2c;
  --line: rgba(120, 170, 255, 0.22);
  --text: #e8eefc;
  --muted: #93a0bc;
  --accent: #3d8bff;
  --ok: #22c55e;
  --warn: #f59e0b;
  --bad: #ef4444;
  --danger: #b91c1c;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}
.bg {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(800px 400px at 10% 0%, rgba(61, 139, 255, 0.18), transparent 60%),
    radial-gradient(700px 360px at 90% 20%, rgba(34, 197, 94, 0.08), transparent 55%);
  pointer-events: none;
  z-index: 0;
}
.view { position: relative; z-index: 1; padding: 24px; max-width: 1100px; margin: 0 auto; }
.hidden { display: none !important; }

.card {
  background: rgba(18, 26, 44, 0.92);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 18px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}
.login-card { max-width: 420px; margin: 10vh auto; }
.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 12px;
}
h1 { margin: 0 0 8px; font-size: 28px; }
h2 { margin: 0; font-size: 18px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hint { color: var(--muted); font-size: 13px; margin: 12px 0 0; }

label {
  display: block;
  margin: 14px 0;
  font-size: 14px;
  color: var(--muted);
}
.remember-row {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}
.remember-row input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
}
input[type="text"],
input[type="password"] {
  width: 100%;
  margin-top: 6px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #0b1220;
  color: var(--text);
  font-size: 15px;
}
.password-field {
  position: relative;
  margin-top: 6px;
}
.password-field input {
  margin-top: 0;
  padding-inline-end: 46px;
}
.eye-btn {
  position: absolute;
  inset-inline-end: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
}
.eye-btn:hover {
  color: var(--text);
  background: rgba(61, 139, 255, 0.12);
}
.eye-btn[aria-pressed="true"] {
  color: var(--accent);
}
.eye-icon.hidden {
  display: none;
}

button {
  border: 0;
  border-radius: 10px;
  padding: 11px 16px;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease, opacity 0.12s ease, box-shadow 0.12s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
button:hover:not(:disabled):not(.is-busy) {
  filter: brightness(1.06);
}
button:active:not(:disabled):not(.is-busy) {
  transform: translateY(1px) scale(0.98);
}
button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}
button.is-ok {
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.55);
}
button.is-fail {
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.55);
}
.primary { background: var(--accent); color: white; }
.danger { background: var(--danger); color: white; }
.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}
.error { color: #fecaca; margin-top: 12px; }

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 18px;
}
.topbar-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  height: 40px;
}
.topbar-actions .pill,
#session-user {
  flex: 0 1 auto;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Quiet blue admin identity chip */
#session-user.pill {
  box-sizing: border-box;
  height: 40px;
  min-height: 40px;
  max-height: 40px;
  border-radius: 10px;
  border: 1px solid rgba(61, 139, 255, 0.28);
  background: rgba(14, 24, 44, 0.92);
  color: #9eb6d9;
  font-family: "IBM Plex Mono", "Cascadia Mono", "Consolas", "Courier New", monospace;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  box-shadow: none;
  text-shadow: none;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.topbar-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 40px !important;
  height: 40px !important;
  min-width: 40px !important;
  max-width: 40px !important;
  min-height: 40px !important;
  max-height: 40px !important;
  padding: 0 !important;
  margin: 0 !important;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(11, 18, 32, 0.85);
  color: var(--text);
  cursor: pointer;
  flex: 0 0 40px;
  line-height: 0;
  font-size: 0;
  overflow: hidden;
  transform: none;
}
.topbar-icon-btn .topbar-icon,
.topbar-icon-btn svg.topbar-icon {
  width: 20px;
  height: 20px;
  display: block;
  flex: 0 0 20px;
}
.topbar-icon-btn:hover:not(:disabled):not(.is-busy),
.topbar-icon-btn:active:not(:disabled):not(.is-busy) {
  filter: none;
  transform: none;
}
.topbar-icon-btn:hover:not(:disabled):not(.is-busy) {
  border-color: rgba(61, 139, 255, 0.45);
  background: rgba(61, 139, 255, 0.12);
}
.topbar-power {
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.35);
}
.topbar-power:hover:not(:disabled):not(.is-busy) {
  border-color: rgba(239, 68, 68, 0.55);
  background: rgba(239, 68, 68, 0.14);
  color: #fecaca;
}
.topbar-factory-key {
  color: #93c5fd;
  border-color: rgba(61, 139, 255, 0.35);
  position: relative;
}
.topbar-factory-key:hover:not(:disabled):not(.is-busy) {
  border-color: rgba(61, 139, 255, 0.55);
  background: rgba(61, 139, 255, 0.14);
  color: #bfdbfe;
}
.topbar-burger[aria-expanded="true"] {
  border-color: rgba(61, 139, 255, 0.55);
  background: rgba(61, 139, 255, 0.16);
}
.burger-lines {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 18px;
  height: 14px;
  flex: 0 0 auto;
}
.burger-lines span {
  display: block;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: transform 0.18s ease, opacity 0.18s ease;
}
.topbar-burger[aria-expanded="true"] .burger-lines span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.topbar-burger[aria-expanded="true"] .burger-lines span:nth-child(2) {
  opacity: 0;
}
.topbar-burger[aria-expanded="true"] .burger-lines span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}
.topbar-menu {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  min-width: 40px;
  max-width: 40px;
  line-height: 0;
}
.topbar-menu > .topbar-icon-btn {
  width: 40px !important;
  height: 40px !important;
}
.topbar-menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  inset-inline-end: 0;
  min-width: 220px;
  padding: 8px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(12, 18, 32, 0.98);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  z-index: 40;
  display: grid;
  gap: 4px;
}
.topbar-menu-panel.hidden {
  display: none !important;
}
.topbar-menu-item {
  width: 100%;
  text-align: start;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 600;
  min-height: 40px;
  cursor: pointer;
}
.topbar-menu-item:hover:not(:disabled) {
  background: rgba(61, 139, 255, 0.12);
  border-color: rgba(61, 139, 255, 0.25);
  filter: none;
}
.topbar-menu-item.is-current {
  background: rgba(61, 139, 255, 0.18);
  border-color: rgba(61, 139, 255, 0.4);
  color: #dbeafe;
}
.pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  color: var(--muted);
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.card-head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}
.card-head-actions button {
  width: auto;
  padding: 8px 12px;
  min-height: 36px;
  font-size: 13px;
}
#cat-upload-mount {
  margin: 10px 0 8px;
}
#cat-upload-mount .kfu-dropzone {
  border: 1.5px dashed rgba(96, 165, 250, 0.45);
  background: rgba(61, 139, 255, 0.04);
  padding: 22px 16px;
}
#cat-upload-mount .kfu-dropzone:hover,
#cat-upload-mount .kfu-dropzone.dragover {
  border-color: rgba(61, 139, 255, 0.75);
  background: rgba(61, 139, 255, 0.1);
}
#cat-upload-status {
  margin: 0 0 12px;
  min-height: 1.35em;
}
.kfu-phase-done .kfu-bar-fill {
  background: var(--ok);
}
.kfu-phase-error .kfu-bar-fill {
  background: var(--bad);
}

.badge {
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
}
.badge-running { background: rgba(34, 197, 94, 0.18); color: var(--ok); }
.badge-stopped { background: rgba(239, 68, 68, 0.18); color: #fca5a5; }
.badge-starting, .badge-stopping { background: rgba(245, 158, 11, 0.18); color: var(--warn); }
.badge-unknown, .badge-unavailable { background: rgba(148, 163, 184, 0.18); color: #cbd5e1; }

.sql-infra-runnable { color: var(--ok); }
.sql-infra-maintenance { color: var(--warn); }

.sql-dual {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 12px 0 10px;
}
.sql-dual-item {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  background:
    linear-gradient(180deg, rgba(16, 28, 52, 0.72), rgba(8, 14, 28, 0.58));
  box-shadow: inset 0 1px 0 rgba(148, 163, 184, 0.08);
}
.sql-dual-item[data-layer="gate"].is-open {
  border-color: rgba(34, 197, 94, 0.35);
}
.sql-dual-item[data-layer="gate"].is-blocked {
  border-color: rgba(239, 68, 68, 0.28);
}
.sql-dual-item[data-layer="infra"].is-runnable {
  border-color: rgba(34, 197, 94, 0.35);
}
.sql-dual-item[data-layer="infra"].is-down {
  border-color: rgba(239, 68, 68, 0.28);
}
.sql-dual-item[data-layer="infra"].is-transit {
  border-color: rgba(245, 158, 11, 0.4);
}
.sql-dual-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.sql-dual-copy {
  min-width: 0;
  flex: 1;
}
.sql-dual-label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}
.sql-dual-value {
  display: block;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.25;
}
.sql-dual-hint {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  line-height: 1.4;
  color: var(--muted);
}
.sql-access-open { color: var(--ok); }
.sql-access-opening { color: var(--warn); }
.sql-access-blocked { color: #fca5a5; }
.sql-infra-running,
.sql-infra-runnable { color: var(--ok); }
.sql-infra-starting,
.sql-infra-stopping,
.sql-infra-maintenance { color: var(--warn); }
.sql-infra-stopped,
.sql-infra-unavailable,
.sql-infra-unknown { color: #fca5a5; }

.sql-switch {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
}
.sql-switch input {
  position: absolute;
  inset: 0;
  z-index: 2;
  margin: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}
.sql-switch-ui {
  position: relative;
  width: 46px;
  height: 26px;
  display: block;
  pointer-events: none;
}
.sql-switch-track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: rgba(71, 85, 105, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.35);
  transition: background 160ms ease, border-color 160ms ease;
}
.sql-switch-knob {
  position: absolute;
  top: 3px;
  inset-inline-start: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #e2e8f0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  transition: inset-inline-start 160ms ease, background 160ms ease;
}
.sql-switch input:checked + .sql-switch-ui .sql-switch-track {
  background: rgba(34, 197, 94, 0.45);
  border-color: rgba(74, 222, 128, 0.55);
}
.sql-switch input:checked + .sql-switch-ui .sql-switch-knob {
  inset-inline-start: 25px;
  background: #86efac;
}
.sql-switch input:focus-visible + .sql-switch-ui .sql-switch-track {
  outline: 2px solid rgba(96, 165, 250, 0.85);
  outline-offset: 2px;
}
.sql-switch input:disabled + .sql-switch-ui {
  opacity: 0.45;
}
.sql-switch:has(input:disabled) {
  cursor: not-allowed;
}
.sql-switch-caption {
  font-size: 11px;
  font-weight: 650;
  color: var(--muted);
  letter-spacing: 0.02em;
}

@media (max-width: 720px) {
  .sql-dual { grid-template-columns: 1fr; }
}

.sql-stage {
  margin: 0 0 8px;
  min-height: 1.35em;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.45;
}
.sql-stage.is-busy { color: #fcd34d; }
.sql-stage.is-warn { color: var(--warn); }
.sql-stage.is-error { color: #fca5a5; }
.sql-stage.is-ok { color: #86efac; }
.sql-card-head {
  align-items: center;
}
.sql-card-head-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}
.sql-card-head-main h2 {
  margin: 0;
}
.sql-card-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.sql-icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 36px;
  height: 36px;
  min-width: 36px;
  padding: 0;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(11, 18, 32, 0.9);
  color: var(--text);
  cursor: pointer;
  line-height: 0;
}
.sql-icon-btn .sql-icon {
  width: 18px;
  height: 18px;
  display: block;
}
.sql-icon-btn:hover:not(:disabled) {
  border-color: rgba(61, 139, 255, 0.45);
  background: rgba(61, 139, 255, 0.12);
}
.sql-icon-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.sql-icon-btn.is-busy .sql-icon {
  opacity: 0;
}
.sql-icon-btn .btn-spinner {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 16px;
  height: 16px;
}
.sql-icon-btn.is-spinning .sql-icon {
  animation: sql-refresh-spin 0.7s linear;
}
@keyframes sql-refresh-spin {
  to { transform: rotate(-360deg); }
}
.sql-clock-btn.is-off {
  color: #94a3b8;
}
.sql-clock-btn.is-on {
  color: #93c5fd;
  border-color: rgba(59, 130, 246, 0.45);
  background: rgba(37, 99, 235, 0.14);
}
.sql-clock-btn.is-countdown {
  color: #bfdbfe;
  border-color: rgba(59, 130, 246, 0.65);
  background: rgba(37, 99, 235, 0.2);
  animation: sql-clock-breathe 2.4s ease-in-out infinite;
}
@keyframes sql-clock-breathe {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.12);
    background: rgba(37, 99, 235, 0.16);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(59, 130, 246, 0.08);
    background: rgba(59, 130, 246, 0.28);
  }
}

.sql-auto-panel {
  margin: 10px 0 8px;
  padding: 12px 14px;
  border: 1px solid rgba(59, 130, 246, 0.35);
  border-radius: 12px;
  background: rgba(11, 18, 32, 0.88);
}
.sql-auto-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.sql-auto-close {
  width: auto;
  min-height: 32px;
  padding: 4px 10px;
  font-size: 12px;
}
.sql-auto-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}
.sql-auto-actions button {
  width: auto;
  min-height: 36px;
  padding: 8px 12px;
  font-size: 13px;
}
.sql-hours-wrap { margin-top: 0; }
.sql-hours-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--muted);
}
.sql-hours-head strong { color: var(--text); font-size: 15px; }
#sql-hours-range {
  width: 100%;
  accent-color: var(--accent);
  /* Range inputs break in RTL documents — track must stay LTR. */
  direction: ltr;
}
.sql-time-panel {
  margin: 10px 0 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sql-time-caption {
  margin: 0;
  font-size: 13px;
}
.sql-time-rows {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
.sql-time-row {
  /* LTR row so the clock sits on the left edge, label on the right. */
  direction: ltr;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 14px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(61, 139, 255, 0.28);
  background:
    linear-gradient(135deg, rgba(61, 139, 255, 0.10), rgba(11, 18, 32, 0.85));
}
.sql-time-label {
  order: 2;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
.sql-time-value {
  order: 1;
  font-family: "Cascadia Mono", "JetBrains Mono", "SF Mono", "Segoe UI Mono", ui-monospace, Consolas, monospace;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: #e8f1ff;
  white-space: nowrap;
  direction: ltr;
  unicode-bidi: isolate;
  text-align: left;
  margin: 0;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 14px rgba(61, 139, 255, 0.22);
}
.sql-schedule-box {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(59, 130, 246, 0.4);
  background: rgba(37, 99, 235, 0.1);
}
.sql-schedule-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.sql-schedule-summary {
  margin: 0;
  font-size: 14px;
  flex: 1;
  min-width: 0;
  line-height: 1.4;
}
.sql-schedule-cancel {
  width: auto;
  min-width: 72px;
  min-height: 34px;
  padding: 6px 12px;
  font-size: 13px;
  flex-shrink: 0;
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}
.sql-schedule-cancel:hover:not(:disabled) {
  border-color: rgba(239, 68, 68, 0.65);
  background: rgba(239, 68, 68, 0.14);
  color: #fecaca;
}
.mono { font-family: ui-monospace, Consolas, monospace; }

.progress {
  /* Always LTR so fill grows left → right. */
  direction: ltr;
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: #0b1220;
  overflow: hidden;
  margin-bottom: 6px;
  border: 1px solid var(--line);
}
.progress-bar {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2563eb, var(--accent));
  transition: width 0.65s ease-out;
}
.progress-bar.is-warn {
  background: linear-gradient(90deg, #d97706, var(--warn), #fde68a);
}
.progress-bar.is-error {
  background: linear-gradient(90deg, #b91c1c, var(--bad));
}
.progress-bar.is-ok {
  background: linear-gradient(90deg, #15803d, var(--ok));
}
.sql-progress-wrap {
  margin-bottom: 14px;
}
.sql-progress-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 13px;
}
.sql-progress-label {
  color: var(--text);
  font-weight: 600;
}
.sql-progress-percent {
  color: var(--accent);
  font-family: ui-monospace, Consolas, monospace;
  font-variant-numeric: tabular-nums;
}
.sql-progress-eta {
  margin: 0;
  min-height: 1.2em;
}

.dropzone {
  border: 1.5px dashed var(--line);
  border-radius: 14px;
  padding: 28px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--accent);
  background: rgba(61, 139, 255, 0.08);
}
.dropzone.disabled {
  opacity: 0.45;
  pointer-events: none;
}

.table-wrap { overflow: auto; }
.ver-devices-table-wrap,
.registry-table-wrap {
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
  padding-bottom: 18px;
}
.ver-devices-table,
.registry-table {
  border-collapse: separate;
  border-spacing: 0;
  width: max(100%, 72rem);
}
.ver-devices-table .ver-devices-col-actions,
.registry-table .registry-col-actions {
  position: sticky;
  inset-inline-end: 0;
  z-index: 2;
  width: 1%;
  white-space: nowrap;
  background: #121a2c;
  box-shadow: -8px 0 12px -8px rgba(0, 0, 0, 0.55);
}
[dir="rtl"] .ver-devices-table .ver-devices-col-actions,
[dir="rtl"] .registry-table .registry-col-actions {
  box-shadow: 8px 0 12px -8px rgba(0, 0, 0, 0.55);
}
.ver-devices-table thead .ver-devices-col-actions,
.registry-table thead .registry-col-actions {
  z-index: 3;
}
.ver-devices-table .ver-devices-col-actions .ghost,
.registry-table .registry-col-actions .ghost,
.registry-table .registry-col-actions .import-delete-btn {
  white-space: nowrap;
}
.ver-devices-table tbody tr:last-child td,
.registry-table tbody tr:last-child td {
  border-bottom: none;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th, td {
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  text-align: right;
  white-space: nowrap;
}
th {
  white-space: normal;
  vertical-align: bottom;
  line-height: 1.25;
}
th .th-en {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}
td.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.status-activated { color: var(--ok); font-weight: 700; }
.status-registered { color: var(--warn); font-weight: 700; }

button.is-busy {
  position: relative;
  opacity: 0.8;
  cursor: wait;
}
.btn-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-inline-start: 8px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  vertical-align: -2px;
  animation: spin 0.7s linear infinite;
}
.ghost .btn-spinner {
  border-color: rgba(147, 160, 188, 0.35);
  border-top-color: var(--text);
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.dropzone.is-busy {
  opacity: 0.7;
  pointer-events: none;
  cursor: wait;
}
.import-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
}
.import-summary.summary-ok {
  border-color: rgba(34, 197, 94, 0.4);
  background: rgba(34, 197, 94, 0.1);
}
.import-summary.summary-warn {
  border-color: rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.1);
}
.import-summary strong { width: 100%; }
.ok-text { color: #86efac; }
.error-text { color: #fecaca; }
.error-cell { color: #fecaca; white-space: normal; }

.import-preview {
  margin-top: 16px;
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: 12px;
  background: rgba(8, 47, 99, 0.18);
  padding: 14px;
  box-shadow: 0 0 18px rgba(14, 165, 233, 0.16);
}
.import-preview.hidden { display: none; }
.import-preview-head h3 {
  margin: 0 0 6px;
  font-size: 16px;
}
.import-preview-table-wrap {
  margin-top: 10px;
  max-height: 360px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 10px;
}
.import-preview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}
#single-import-toggle-btn[aria-expanded="true"] {
  border-color: rgba(56, 189, 248, 0.55);
  color: #7dd3fc;
}
.single-import {
  margin: 0 0 14px;
  padding: 14px;
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: 12px;
  background: rgba(8, 47, 99, 0.18);
}
.single-import.hidden { display: none; }
.single-import-product {
  margin: 0 0 12px;
  max-width: 320px;
}
.single-import-product select {
  width: 100%;
  margin: 0;
  padding: 10px 12px;
  padding-inline-end: 36px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background-color: #0b1220;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(0.85rem) calc(50% - 2px),
    calc(0.85rem + 5px) calc(50% - 2px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  appearance: none;
  -webkit-appearance: none;
  min-height: 42px;
  cursor: pointer;
  color-scheme: dark;
}
.single-import-product select:focus {
  outline: none;
  border-color: rgba(61, 139, 255, 0.7);
  box-shadow: 0 0 0 2px rgba(61, 139, 255, 0.18);
}
.single-import-fields {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(180px, 1.5fr) minmax(110px, 1fr) minmax(110px, 1fr) minmax(120px, 1fr) auto;
  gap: 10px;
  align-items: end;
}
.single-import-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  min-width: 0;
  font-size: 13px;
  color: var(--muted);
}
.single-import-req {
  color: #fda4af;
  font-weight: 700;
}
.single-import-field input[type="text"] {
  width: 100%;
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #0b1220;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}
.single-import-field-cpu input[type="text"] {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}
.single-import-field input[type="text"]:focus {
  outline: none;
  border-color: rgba(61, 139, 255, 0.7);
  box-shadow: 0 0 0 2px rgba(61, 139, 255, 0.18);
}
.single-import-actions {
  display: flex;
  align-items: end;
}
.single-import-actions .primary {
  width: auto;
  min-width: 132px;
  min-height: 42px;
  white-space: nowrap;
}
#single-import-upload-btn.is-ok {
  background: #16a34a;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.45);
}
#single-import-upload-btn.is-fail {
  background: var(--danger);
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.45);
}
#single-import-upload-btn.is-ok:disabled,
#single-import-upload-btn.is-fail:disabled {
  opacity: 1;
  cursor: default;
}
.import-flag {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 700;
  white-space: normal;
  max-width: 160px;
  line-height: 1.3;
}
.import-flag-ok {
  color: #86efac;
  background: rgba(34, 197, 94, 0.14);
  border: 1px solid rgba(34, 197, 94, 0.35);
}
.import-flag-dup-file {
  color: #fcd34d;
  background: rgba(245, 158, 11, 0.14);
  border: 1px solid rgba(245, 158, 11, 0.4);
}
.import-flag-dup-db {
  color: #fda4af;
  background: rgba(244, 63, 94, 0.14);
  border: 1px solid rgba(244, 63, 94, 0.4);
}
.import-flag-error {
  color: #fecaca;
  background: rgba(239, 68, 68, 0.14);
  border: 1px solid rgba(239, 68, 68, 0.4);
}
.import-row-dup {
  background: rgba(245, 158, 11, 0.06);
}
.import-row-dup-db {
  background: rgba(244, 63, 94, 0.07);
}
.import-row-error {
  background: rgba(239, 68, 68, 0.08);
}
.import-row-removing {
  opacity: 0.35;
  transition: opacity 0.25s ease, background 0.25s ease;
  background: rgba(239, 68, 68, 0.18) !important;
}
.registry-cpu-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  white-space: nowrap;
  vertical-align: middle;
}
.registry-cpu-short {
  min-width: 0;
  line-height: 1.3;
}
.registry-cpu-copy-btn {
  position: relative;
  box-sizing: border-box;
  flex: 0 0 auto;
  width: 28px;
  min-width: 28px;
  max-width: 28px;
  height: 28px;
  min-height: 28px;
  max-height: 28px;
  padding: 0;
  margin: 0;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(15, 23, 42, 0.65);
  color: #e2e8f0;
  cursor: pointer;
  line-height: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
}
.registry-cpu-copy-btn .registry-cpu-copy-icon,
.registry-cpu-copy-btn .registry-cpu-copy-check {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.registry-cpu-copy-btn .registry-cpu-copy-icon svg {
  display: block;
  width: 14px;
  height: 14px;
}
.registry-cpu-copy-btn .registry-cpu-copy-check {
  opacity: 0;
  transform: scale(0.85);
  color: #4ade80;
}
.registry-cpu-copy-btn.is-ok {
  border-color: rgba(74, 222, 128, 0.75);
  background: rgba(22, 101, 52, 0.35);
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.45);
}
.registry-cpu-copy-btn.is-ok .registry-cpu-copy-icon {
  opacity: 0;
  transform: scale(0.85);
}
.registry-cpu-copy-btn.is-ok .registry-cpu-copy-check {
  opacity: 1;
  transform: scale(1);
}
.registry-cpu-copy-btn.is-fail {
  border-color: rgba(248, 113, 113, 0.75);
  background: rgba(127, 29, 29, 0.35);
}
.registry-cpu-copy-btn:hover:not(:disabled):not(.is-ok) {
  border-color: rgba(56, 189, 248, 0.65);
  color: #fff;
}
.registry-cpu-copy-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.import-delete-btn {
  border: 1px solid rgba(239, 68, 68, 0.45);
  background: rgba(239, 68, 68, 0.12);
  color: #fecaca;
  border-radius: 8px;
  padding: 6px 10px;
  min-height: 34px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.import-delete-btn:hover {
  background: rgba(239, 68, 68, 0.24);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.25);
}
.import-delete-btn:active {
  transform: scale(0.97);
}

.admin-dialog {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.admin-dialog.hidden { display: none; }
.admin-dialog-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.72);
}
.admin-dialog-panel {
  position: relative;
  z-index: 1;
  width: min(480px, 100%);
  border-radius: 14px;
  border: 1px solid rgba(56, 189, 248, 0.4);
  background: #121a2c;
  padding: 18px;
  box-shadow:
    0 0 0 1px rgba(14, 165, 233, 0.15) inset,
    0 0 28px rgba(14, 165, 233, 0.2),
    0 20px 50px rgba(0, 0, 0, 0.45);
}
.admin-dialog-panel h3 {
  margin: 0 0 10px;
  font-size: 17px;
}
.admin-dialog-message {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.admin-dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.registry-device-dialog-panel {
  width: min(560px, calc(100vw - 32px));
  max-height: min(90vh, 860px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
}
.registry-device-cpu-card {
  margin: 0 0 4px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #0b1220;
}
.registry-device-cpu-label {
  display: block;
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
}
.registry-device-cpu {
  margin: 0;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  word-break: break-all;
}
.registry-device-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 12px 0 0;
  min-height: 0;
  overflow-y: auto;
  padding-inline-end: 2px;
}
.registry-device-form .reg-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  min-width: 0;
  font-size: 13px;
  color: var(--muted);
}
.registry-device-form .reg-field input[type="text"],
.registry-device-form .reg-field textarea {
  width: 100%;
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #0b1220;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}
.registry-device-form .reg-field textarea {
  min-height: 88px;
  resize: vertical;
  line-height: 1.45;
}
.registry-device-form .reg-field input[type="text"]:focus,
.registry-device-form .reg-field textarea:focus {
  outline: none;
  border-color: rgba(61, 139, 255, 0.7);
  box-shadow: 0 0 0 2px rgba(61, 139, 255, 0.18);
}
.registry-device-notes-field,
.registry-device-tags-field {
  grid-column: 1 / -1;
}
.registry-device-status {
  margin: 12px 0 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.registry-device-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 14px;
  flex-shrink: 0;
}
.registry-device-actions button {
  width: 100%;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 560px) {
  .registry-device-form {
    grid-template-columns: 1fr;
  }
  .registry-device-actions {
    grid-template-columns: 1fr;
  }
}

.admin-dialog-stacked {
  z-index: 90;
}
.registry-rotate-dialog-panel {
  width: min(480px, calc(100vw - 32px));
}
.registry-rotate-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.registry-rotate-actions button {
  width: 100%;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
@media (max-width: 560px) {
  .registry-rotate-actions {
    grid-template-columns: 1fr;
  }
}

.links-dialog-panel {
  width: min(520px, 100%);
}
.cat-gallery-dialog-panel {
  width: min(1120px, 96vw);
  max-height: min(90vh, 900px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.cat-gallery-dialog-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.cat-gallery-dialog-head h3 {
  margin: 0 0 6px;
}
.cat-gallery-dialog-head .muted {
  margin: 0;
}
.cat-gallery-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.cat-table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 10px;
  flex-wrap: wrap;
}
.cat-tier-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-inline-start: auto;
}
.cat-tier-chip {
  height: 30px;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(11, 18, 32, 0.85);
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
  line-height: 1;
}
.cat-tier-chip:hover {
  border-color: rgba(61, 139, 255, 0.45);
  color: var(--text);
}
.cat-tier-chip.is-active {
  color: #dbeafe;
  border-color: rgba(61, 139, 255, 0.7);
  background: rgba(37, 99, 235, 0.28);
}
.cat-tier-chip[data-tier-filter="FREE"].is-active {
  color: #bbf7d0;
  border-color: rgba(34, 197, 94, 0.65);
  background: rgba(22, 163, 74, 0.28);
}
.cat-tier-chip[data-tier-filter="PAID"].is-active {
  color: #fde68a;
  border-color: rgba(245, 158, 11, 0.65);
  background: rgba(180, 83, 9, 0.28);
}
#cat-packages-filter-count {
  min-width: 5.5rem;
  text-align: end;
}
.cat-search {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.cat-search-toggle {
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}
.cat-search-input {
  width: 0;
  min-width: 0;
  opacity: 0;
  padding: 0;
  margin: 0;
  border: 0;
  overflow: hidden;
  pointer-events: none;
  transition: width 0.2s ease, opacity 0.2s ease, padding 0.2s ease;
  background: #0b1220;
  color: var(--text);
  border-radius: 8px;
  font-size: 13px;
  height: 34px;
}
.cat-search.is-open .cat-search-input {
  width: min(280px, 55vw);
  opacity: 1;
  padding: 0 10px;
  border: 1px solid var(--line);
  pointer-events: auto;
}
.cat-search.is-open .cat-search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(61, 139, 255, 0.22);
}
.cat-th-icon,
.cat-td-icon {
  width: 44px;
  min-width: 44px;
  padding-inline: 6px !important;
  vertical-align: middle;
}
.cat-pkg-icon-wrap {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
}
.cat-pkg-icon,
.cat-pkg-icon-fallback {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  display: block;
  object-fit: cover;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(15, 23, 42, 0.95);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}
.cat-pkg-icon {
  position: relative;
  z-index: 1;
  opacity: 0;
}
.cat-pkg-icon.is-ready {
  opacity: 1;
}
.cat-pkg-icon.is-missing {
  display: none;
}
.cat-pkg-icon-fallback {
  display: none;
  place-items: center;
  font-size: 14px;
  font-weight: 700;
  color: #93c5fd;
  background: linear-gradient(145deg, rgba(59, 130, 246, 0.28), rgba(15, 23, 42, 0.95));
}
.cat-pkg-icon-fallback.is-pending,
.cat-pkg-icon-fallback.is-visible {
  display: grid;
}
.cat-pkg-icon-wrap:has(.cat-pkg-icon.is-ready) .cat-pkg-icon-fallback {
  display: none;
}
.links-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 10px;
}
.links-dialog-header h3 {
  margin: 0;
  min-width: 0;
}
.links-vito9-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-decoration: none;
  line-height: 1.2;
  color: #eef6ff;
  background: linear-gradient(160deg, #163a72 0%, #1f4f96 55%, #163a72 100%);
  border: 1px solid rgba(120, 180, 255, 0.55);
  box-shadow:
    0 1px 0 rgba(180, 214, 255, 0.16) inset,
    0 6px 14px rgba(0, 0, 0, 0.32),
    0 0 14px rgba(61, 139, 255, 0.18);
  text-shadow: 0 1px 1px rgba(6, 12, 28, 0.45);
  transition: transform 0.12s ease, filter 0.12s ease, box-shadow 0.12s ease;
}
.links-vito9-btn:hover {
  filter: brightness(1.06);
  box-shadow:
    0 1px 0 rgba(180, 214, 255, 0.22) inset,
    0 8px 18px rgba(0, 0, 0, 0.36),
    0 0 18px rgba(61, 139, 255, 0.26);
}
.links-vito9-btn:active {
  transform: translateY(1px) scale(0.98);
  filter: brightness(0.98);
}
.cat-orders-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.cat-orders-badge {
  min-width: 1.35rem;
  padding: 0 6px;
  border-radius: 999px;
  background: #f59e0b;
  color: #111827;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}
.cat-orders-badge.is-zero {
  background: rgba(148, 163, 184, 0.35);
  color: #e2e8f0;
}
.cat-orders-dialog-panel {
  width: min(1040px, 96vw);
  max-height: min(92vh, 960px);
  overflow: auto;
}
.cat-price-dialog-panel {
  width: min(420px, 96vw);
}
.cat-price-dialog-pkg {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--accent);
  word-break: break-all;
}
.cat-price-dialog-panel label {
  display: grid;
  gap: 6px;
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}
.cat-price-dialog-panel input[type="number"] {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #0b1220;
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
}
.cat-orders-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background:
    linear-gradient(180deg, rgba(30, 41, 59, 0.55), rgba(11, 18, 32, 0.72));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}
.cat-orders-status-seg {
  --seg-index: 0;
  --seg-accent: rgba(251, 191, 36, 0.95);
  --seg-accent-soft: rgba(251, 191, 36, 0.22);
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: stretch;
  min-width: min(420px, 100%);
  flex: 1 1 360px;
  max-width: 480px;
  padding: 3px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(7, 11, 22, 0.88);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.35);
}
.cat-orders-status-seg[data-orders-status-active="PENDING"] {
  --seg-index: 0;
  --seg-accent: #fbbf24;
  --seg-accent-soft: rgba(251, 191, 36, 0.22);
  --seg-ring: rgba(251, 191, 36, 0.55);
}
.cat-orders-status-seg[data-orders-status-active="APPROVED"] {
  --seg-index: 1;
  --seg-accent: #69f0ae;
  --seg-accent-soft: rgba(105, 240, 174, 0.2);
  --seg-ring: rgba(105, 240, 174, 0.5);
}
.cat-orders-status-seg[data-orders-status-active="REJECTED"] {
  --seg-index: 2;
  --seg-accent: #fca5a5;
  --seg-accent-soft: rgba(252, 165, 165, 0.2);
  --seg-ring: rgba(252, 165, 165, 0.5);
}
.cat-orders-status-seg[data-orders-status-active="CANCELLED"] {
  --seg-index: 3;
  --seg-accent: #cbd5e1;
  --seg-accent-soft: rgba(148, 163, 184, 0.28);
  --seg-ring: rgba(148, 163, 184, 0.55);
}
.cat-orders-status-thumb {
  position: absolute;
  z-index: 0;
  inset-block: 3px;
  inset-inline-start: calc(3px + (100% - 6px) * var(--seg-index) / 4);
  width: calc((100% - 6px) / 4);
  border-radius: 999px;
  background: var(--seg-accent-soft);
  border: 1px solid var(--seg-ring, rgba(255, 255, 255, 0.14));
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.15),
    0 6px 14px rgba(0, 0, 0, 0.22);
  transition:
    inset-inline-start 0.24s cubic-bezier(0.22, 0.9, 0.28, 1),
    background-color 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
  pointer-events: none;
}
.cat-orders-status-opt {
  position: relative;
  z-index: 1;
  appearance: none;
  margin: 0;
  min-height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1;
  cursor: pointer;
  transition: color 0.18s ease;
}
.cat-orders-status-opt:hover {
  color: var(--text);
}
.cat-orders-status-opt.is-active {
  color: var(--seg-accent);
}
.cat-orders-status-opt:focus-visible {
  outline: 2px solid rgba(61, 139, 255, 0.7);
  outline-offset: 2px;
}
.cat-orders-toolbar-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  flex: 1 1 260px;
  justify-content: flex-end;
  min-width: 0;
}
.cat-orders-search-label {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 220px;
  max-width: 320px;
  min-width: 0;
  margin: 0;
  color: var(--muted);
}
.cat-orders-search-icon {
  position: absolute;
  inset-inline-start: 12px;
  width: 14px;
  height: 14px;
  pointer-events: none;
  color: var(--muted);
  opacity: 0.85;
}
.cat-orders-search-label input {
  width: 100%;
  min-width: 0;
  height: 40px;
  margin: 0;
  padding: 0 14px;
  padding-inline-start: 34px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.32);
  background: rgba(7, 11, 22, 0.88);
  color: var(--text);
  font-size: 13px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.28);
}
.cat-orders-search-label input::placeholder {
  color: rgba(147, 160, 188, 0.85);
}
.cat-orders-search-label input:focus {
  outline: none;
  border-color: rgba(56, 189, 248, 0.7);
  box-shadow:
    0 0 0 2px rgba(56, 189, 248, 0.18),
    inset 0 1px 2px rgba(0, 0, 0, 0.28);
}
.cat-orders-refresh-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  white-space: nowrap;
}
.cat-orders-refresh-icon {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  color: currentColor;
}
.cat-order-add-search-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}
.cat-order-add-search-label input {
  min-width: 220px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(11, 18, 32, 0.75);
  color: var(--text);
  font-size: 13px;
}
.cat-order-add-search-label input:focus {
  outline: none;
  border-color: rgba(56, 189, 248, 0.7);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}
.cat-order-add-search-label {
  margin: 0 0 10px;
}
.cat-order-add-search-label input {
  width: 100%;
  min-width: 0;
  max-width: 420px;
}
.cat-orders-table-wrap {
  max-height: 280px;
  overflow: auto;
}
.cat-order-row {
  cursor: pointer;
}
.cat-order-row.is-selected {
  background: rgba(14, 165, 233, 0.16);
}
.cat-orders-detail {
  margin-top: 14px;
  padding: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--text);
}
.cat-order-empty,
.cat-order-empty-inline {
  padding: 18px 16px;
  border-radius: 12px;
  border: 1px dashed rgba(148, 163, 184, 0.35);
  background: rgba(11, 18, 32, 0.55);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}
.cat-order-empty-inline {
  padding: 14px 12px;
}
.cat-order-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background:
    linear-gradient(180deg, rgba(30, 41, 59, 0.55), rgba(11, 18, 32, 0.92));
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
}
.cat-order-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.cat-order-chip-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.cat-order-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(11, 18, 32, 0.75);
  font-size: 13px;
}
.cat-order-chip.is-total {
  border-color: rgba(61, 139, 255, 0.45);
  background: rgba(37, 99, 235, 0.18);
}
.cat-order-chip-k {
  display: block;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.03em;
  color: var(--muted);
  line-height: 1.1;
}
.cat-order-status {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
}
.cat-order-status-pending { background: rgba(251, 191, 36, 0.2); color: #fbbf24; }
.cat-order-status-approved { background: rgba(105, 240, 174, 0.2); color: #69f0ae; }
.cat-order-status-rejected { background: rgba(252, 165, 165, 0.2); color: #fca5a5; }
.cat-order-status-cancelled { background: rgba(148, 163, 184, 0.25); color: #cbd5e1; }
.cat-order-meta-grid,
.cat-order-card-foot {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.cat-order-meta-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(2, 6, 23, 0.45);
}
.cat-order-meta-cell.is-wide {
  grid-column: 1 / -1;
}
.cat-order-meta-cell strong,
.cat-order-meta-cell code {
  font-size: 13px;
  word-break: break-word;
}
.cat-order-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cat-order-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.cat-order-section-title {
  margin: 0;
  font-size: 14px;
  font-weight: 750;
  color: var(--text);
}
.cat-order-section-count,
.cat-order-section-hint {
  font-size: 12px;
  color: var(--muted);
}
.cat-order-tile-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 240px;
  overflow: auto;
  padding: 2px;
}
.cat-order-tile {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(15, 23, 42, 0.88);
}
.cat-order-tile.is-in-cart {
  border-color: rgba(34, 197, 94, 0.35);
  background: linear-gradient(90deg, rgba(22, 163, 74, 0.12), rgba(15, 23, 42, 0.9));
}
.cat-order-tile.is-available {
  border-color: rgba(61, 139, 255, 0.28);
}
.cat-order-tile-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(2, 6, 23, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.2);
}
.cat-order-tile-icon .cat-pkg-icon-wrap,
.cat-order-tile-icon .cat-pkg-icon,
.cat-order-tile-icon .cat-pkg-icon-fallback {
  width: 36px;
  height: 36px;
}
.cat-order-tile-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cat-order-tile-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cat-order-tile-pkg {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cat-order-tile-price {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(245, 158, 11, 0.4);
  background: rgba(180, 83, 9, 0.18);
  color: #fde68a;
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}
.cat-order-tile-btn {
  min-width: 64px;
  height: 32px;
  padding: 0 12px;
  border-radius: 9px;
  border: 1px solid transparent;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
  line-height: 1;
}
.cat-order-tile-btn.is-add {
  color: #dbeafe;
  border-color: rgba(61, 139, 255, 0.55);
  background: rgba(37, 99, 235, 0.28);
}
.cat-order-tile-btn.is-add:hover {
  background: rgba(37, 99, 235, 0.42);
}
.cat-order-tile-btn.is-remove {
  color: #fecaca;
  border-color: rgba(239, 68, 68, 0.5);
  background: rgba(185, 28, 28, 0.28);
}
.cat-order-tile-btn.is-remove:hover {
  background: rgba(185, 28, 28, 0.42);
}
.cat-orders-detail .mono,
.cat-table .mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}
@media (max-width: 720px) {
  .cat-order-meta-grid,
  .cat-order-card-foot {
    grid-template-columns: 1fr;
  }
  .cat-order-tile {
    grid-template-columns: 36px minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
  }
  .cat-order-tile-price {
    grid-column: 2;
  }
  .cat-order-tile-btn {
    grid-column: 3;
    grid-row: 1 / span 2;
    align-self: center;
  }
}
.links-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.links-row {
  position: relative;
  display: grid;
  gap: 10px;
  padding: 14px 14px 14px 16px;
  border: 1px solid rgba(120, 170, 255, 0.22);
  border-radius: 16px;
  background:
    linear-gradient(155deg, rgba(36, 78, 148, 0.2) 0%, rgba(8, 14, 28, 0.78) 48%, rgba(6, 12, 24, 0.88) 100%);
  box-shadow:
    0 1px 0 rgba(180, 214, 255, 0.07) inset,
    0 10px 28px rgba(0, 0, 0, 0.28);
  overflow: hidden;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease;
}
.links-row::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 999px;
  background: linear-gradient(180deg, #5ec8ff 0%, #3d8bff 55%, #1f4f96 100%);
  box-shadow: 0 0 12px rgba(61, 139, 255, 0.45);
}
.links-row:hover {
  border-color: rgba(94, 200, 255, 0.45);
  box-shadow:
    0 1px 0 rgba(180, 214, 255, 0.12) inset,
    0 14px 34px rgba(0, 0, 0, 0.36),
    0 0 28px rgba(61, 139, 255, 0.14);
  transform: translateY(-1px);
}
.links-row-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  min-width: 0;
}
.links-row-title strong {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #eef4ff;
  line-height: 1.3;
}
.links-path-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(94, 200, 255, 0.28);
  background: rgba(15, 28, 52, 0.85);
  color: #8ec5ff;
  font-family: "Cascadia Mono", Consolas, "Courier New", monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.2;
  white-space: nowrap;
}
/*
 * Combo bar (RTL visual order):
 * [פתח] | [העתק] | [URL ……………]
 * compact actions — URL gets remaining width (full link visible)
 */
.links-combo {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: stretch;
  min-height: 34px;
  width: 100%;
  border-radius: 10px;
  border: 1px solid rgba(120, 170, 255, 0.24);
  background:
    linear-gradient(180deg, rgba(12, 22, 42, 0.96), rgba(8, 14, 28, 0.98));
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset;
  overflow: hidden;
  direction: rtl;
}
.links-url {
  display: block;
  min-width: 0;
  margin: 0;
  padding: 0 10px;
  min-height: 34px;
  line-height: 34px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #b9ceff;
  font-family: "Cascadia Mono", Consolas, "Courier New", monospace;
  font-size: 11.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  direction: ltr;
  unicode-bidi: isolate;
  /* Pin URL string to the card's right edge (RTL shell) */
  text-align: right;
  user-select: all;
}
.links-combo-sep {
  margin: 7px 0;
}
.links-row-actions {
  display: inline-grid;
  grid-template-columns: auto auto auto;
  align-items: stretch;
  width: max-content;
  max-width: 100%;
  height: 100%;
  direction: rtl;
}
.links-action-sep {
  width: 1px;
  align-self: stretch;
  margin: 7px 0;
  background: rgba(120, 170, 255, 0.32);
}
.links-action-copy,
.links-action-open {
  appearance: none;
  margin: 0;
  border: 0;
  border-radius: 0;
  min-height: 34px;
  height: 34px;
  padding: 0 9px;
  background: transparent;
  color: #e8eefc;
  font: inherit;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.links-action-copy:hover,
.links-action-open:hover {
  background: rgba(61, 139, 255, 0.18);
  color: #fff;
}
.links-action-copy:focus-visible,
.links-action-open:focus-visible {
  outline: 2px solid rgba(94, 200, 255, 0.65);
  outline-offset: -2px;
}
.links-action-open {
  color: #86efac;
}
.links-action-open:hover {
  background: rgba(34, 197, 94, 0.18);
  color: #bbf7d0;
}
.links-copy-status {
  min-height: 1.2em;
  margin: 12px 0 0;
}
.links-copy-status.is-ok { color: #86efac; }
.links-copy-status.is-error { color: #fca5a5; }

@media (max-width: 560px) {
  .links-row {
    padding: 14px;
  }
  .links-combo {
    grid-template-columns: 1fr;
  }
  .links-combo-sep {
    width: 100%;
    height: 1px;
    margin: 0;
  }
  .links-url {
    white-space: normal;
    word-break: break-all;
    line-height: 1.4;
    padding: 8px 10px;
    min-height: 0;
  }
  .links-row-actions {
    width: 100%;
    grid-template-columns: 1fr auto 1fr;
  }
  .links-action-copy,
  .links-action-open {
    width: 100%;
  }
}

.card-head-stack { flex-direction: column; align-items: stretch; gap: 12px; }
.card-head-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.card-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.card-head-actions .ghost {
  width: auto;
  min-height: 36px;
  padding: 8px 12px;
}
#registry-search-toggle-btn[aria-expanded="true"] {
  border-color: rgba(56, 189, 248, 0.55);
  color: #7dd3fc;
}
.search-label {
  display: block;
  margin: 0;
  width: 100%;
  color: var(--muted);
  font-size: 13px;
}
.stats-hint {
  margin: 0;
  line-height: 1.45;
}

.stats-board {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stats-row {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  align-items: center;
  gap: 10px 12px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.4);
  padding: 8px 10px;
}

.stats-row-neon {
  border: 1px solid rgba(56, 189, 248, 0.55);
  background:
    linear-gradient(180deg, rgba(8, 47, 99, 0.45), rgba(15, 23, 42, 0.55));
  box-shadow:
    0 0 0 1px rgba(14, 165, 233, 0.2) inset,
    0 0 14px rgba(14, 165, 233, 0.35),
    0 0 28px rgba(37, 99, 235, 0.22);
}

.stats-row-title {
  color: #cbd5e1;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
}

.stats-row-sub {
  display: inline-block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
}

.stats-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  min-width: 0;
}

.stat-chip {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 8px;
  background: rgba(2, 6, 23, 0.35);
  padding: 6px 8px;
}

.stat-chip-ok {
  border-color: rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.08);
}

.stat-chip-warn {
  border-color: rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.08);
}

.stat-chip-total {
  border-color: rgba(56, 189, 248, 0.45);
  background: rgba(14, 165, 233, 0.1);
  box-shadow: 0 0 10px rgba(14, 165, 233, 0.18);
}

.stat-label {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
  white-space: nowrap;
}

.stat-value {
  font-size: 0.95rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  color: #e2e8f0;
  max-width: 8ch;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: end;
}

.stat-chip-ok .stat-value { color: #86efac; }
.stat-chip-warn .stat-value { color: #fcd34d; }
.stat-chip-total .stat-value { color: #7dd3fc; }

.stats-filter-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
  border: 1px solid rgba(56, 189, 248, 0.45);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(8, 47, 99, 0.28), rgba(15, 23, 42, 0.4));
  padding: 12px;
  box-shadow:
    0 0 0 1px rgba(14, 165, 233, 0.15) inset,
    0 0 18px rgba(14, 165, 233, 0.22),
    0 0 36px rgba(37, 99, 235, 0.14);
}

.stats-filter-heading {
  margin: 0;
  color: #e2e8f0;
  font-size: 13px;
  font-weight: 700;
}

.stats-filter-note {
  margin: 0;
  line-height: 1.4;
}

.stats-row-results {
  margin-top: 2px;
}

.stats-presets {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.stats-presets-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin-inline-end: 2px;
}

.stats-preset-btn {
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.65);
  color: #e2e8f0;
  padding: 7px 12px;
  min-height: 34px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.stats-preset-btn:hover {
  border-color: rgba(96, 165, 250, 0.55);
  color: #dbeafe;
}

.stats-preset-btn.is-active {
  border-color: rgba(34, 197, 94, 0.55);
  background: rgba(34, 197, 94, 0.16);
  color: #86efac;
}

.stats-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: stretch;
  gap: 10px 12px;
  width: 100%;
}

.registry-more-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
}

.registry-more-wrap.hidden {
  display: none;
}

.stats-filter-field {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
  min-width: 0;
  width: 100%;
  margin: 0;
}

.stats-filter-caption {
  display: block;
  height: 1.2em;
  line-height: 1.2em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stats-filter-field input,
.stats-filter-field select,
.stats-clear-btn {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 8px;
  background: #0b1220;
  color: var(--text);
  padding: 8px 10px;
  height: 40px;
  min-height: 40px;
  max-height: 40px;
  font: inherit;
  margin: 0;
  line-height: 1.2;
}

.stats-clear-btn {
  cursor: pointer;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    color 0.15s ease,
    transform 0.1s ease;
}

.stats-clear-btn:hover {
  border-color: rgba(56, 189, 248, 0.65);
  background: rgba(14, 165, 233, 0.14);
  color: #e0f2fe;
  box-shadow: 0 0 12px rgba(14, 165, 233, 0.28);
}

.stats-clear-btn:focus-visible {
  outline: 2px solid rgba(56, 189, 248, 0.85);
  outline-offset: 2px;
}

.stats-clear-btn:active {
  transform: translateY(1px) scale(0.98);
  border-color: rgba(56, 189, 248, 0.9);
  background: rgba(14, 165, 233, 0.28);
  box-shadow: 0 0 0 1px rgba(14, 165, 233, 0.45) inset;
}

.stats-clear-btn.is-flash {
  border-color: rgba(56, 189, 248, 0.95);
  background: rgba(14, 165, 233, 0.32);
  color: #f0f9ff;
  box-shadow:
    0 0 0 1px rgba(125, 211, 252, 0.45) inset,
    0 0 16px rgba(14, 165, 233, 0.45);
  animation: stats-clear-pulse 0.9s ease;
}

@keyframes stats-clear-pulse {
  0% { transform: scale(0.97); }
  35% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

#registry-search {
  width: 100%;
  margin-top: 6px;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #0b1220;
  color: var(--text);
  font-size: 14px;
}

/* —— Global KioskFileUpload —— */
.kfu-root { margin-top: 8px; }
.kfu-dropzone {
  border: 1.5px dashed var(--line);
  border-radius: 14px;
  padding: 28px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.kfu-dropzone:hover, .kfu-dropzone.dragover {
  border-color: var(--accent);
  background: rgba(61, 139, 255, 0.08);
}
.kfu-dropzone.disabled {
  opacity: 0.45;
  pointer-events: none;
}
.kfu-title { margin: 0 0 8px; }
.kfu-hint { margin: 0; }
.kfu-queue {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
.kfu-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: #0b1220;
}
.kfu-item-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.kfu-bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.kfu-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #22c55e);
  transition: width 0.15s ease;
}
.kfu-error { display: block; margin-top: 6px; color: #fca5a5; font-size: 12px; }
.kfu-actions { margin-top: 10px; }

/* —— Versions backoffice —— */
.versions-upload-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 10px;
}
.versions-upload-form label { margin: 0; }
.versions-upload-form input[type="number"],
.versions-upload-form input[type="text"],
.versions-upload-form select,
.ver-stage-fields input:not([type="checkbox"]),
.ver-stage-fields select,
#ver-device-search {
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #0b1220;
  color: var(--text);
  font-size: 14px;
  line-height: 1.3;
  min-height: 40px;
  color-scheme: dark;
}
.versions-upload-form select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  /* RTL: chevron on the visual start (left in RTL layout). */
  padding-inline-end: 36px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(0.85rem) calc(50% - 2px),
    calc(0.85rem + 5px) calc(50% - 2px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  background-color: #0b1220;
  cursor: pointer;
}
.versions-upload-form select:hover {
  border-color: rgba(61, 139, 255, 0.45);
}
.versions-upload-form select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(61, 139, 255, 0.25);
}
.versions-upload-form select option {
  background: #0b1220;
  color: var(--text);
}
/* Compact action buttons inside catalog/versions field grids (desktop: not full-cell). */
.versions-upload-form > button {
  width: auto;
  max-width: 100%;
  justify-self: start;
  align-self: end;
  min-height: 40px;
  padding: 8px 14px;
  white-space: nowrap;
}
.versions-upload-form > label.remember-row {
  align-self: end;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}
#cat-package-form > button,
#cat-grant-form > button {
  width: fit-content;
}
#ver-device-search { margin: 10px 0 14px; }
.ver-filename-hint {
  margin: 10px 0 6px;
}
.ver-filename-hint code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12px;
  color: #93c5fd;
}
.ver-staging {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.ver-staging h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}
.ver-staging-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
.ver-stage-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: #0b1220;
}
.ver-stage-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}
.ver-stage-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.55rem;
  margin-top: 0.25rem;
}
.ver-stage-size strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.ver-stage-size.is-over {
  color: #f87171;
  font-weight: 600;
}
.ver-upload-status:empty,
.ver-upload-status[hidden] {
  display: none !important;
}
.ver-stage-fields {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 10px;
  margin-bottom: 10px;
}
.ver-stage-fields label { margin: 0; font-size: 13px; }
.ver-staging-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}
/* Catalog bulk staging — desktop console grid (mobile collapses ≤820px) */
.cat-staging-actions {
  flex-wrap: wrap;
}
.cat-stage-item {
  border: 1px solid rgba(96, 165, 250, 0.42);
  border-radius: 12px;
  padding: 0;
  background:
    linear-gradient(180deg, rgba(15, 23, 42, 0.96) 0%, rgba(11, 18, 32, 0.98) 100%);
  box-shadow:
    0 0 0 1px rgba(61, 139, 255, 0.12),
    0 0 18px rgba(61, 139, 255, 0.14),
    0 0 0 1px rgba(0, 0, 0, 0.25) inset;
  overflow: hidden;
}
.cat-stage-item.ver-phase-uploading {
  border-color: rgba(61, 139, 255, 0.65);
  box-shadow:
    0 0 0 1px rgba(61, 139, 255, 0.22),
    0 0 22px rgba(61, 139, 255, 0.28),
    0 0 0 1px rgba(0, 0, 0, 0.25) inset;
}
.cat-stage-item.ver-phase-done {
  border-color: rgba(34, 197, 94, 0.55);
  box-shadow:
    0 0 0 1px rgba(34, 197, 94, 0.18),
    0 0 18px rgba(34, 197, 94, 0.18),
    0 0 0 1px rgba(0, 0, 0, 0.25) inset;
}
.cat-stage-item.ver-phase-error,
.cat-stage-item.ver-phase-cancelled {
  border-color: rgba(239, 68, 68, 0.55);
  box-shadow:
    0 0 0 1px rgba(239, 68, 68, 0.18),
    0 0 18px rgba(239, 68, 68, 0.16),
    0 0 0 1px rgba(0, 0, 0, 0.25) inset;
}

/* Header: one horizontal desktop row, all items vertically centered */
.cat-stage-card-top {
  display: grid;
  grid-template-columns: 22px 64px minmax(160px, 1fr) auto auto;
  align-items: center;
  column-gap: 12px;
  padding: 10px 16px;
  min-height: 72px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  background: rgba(255, 255, 255, 0.02);
}
.cat-stage-appicon {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  justify-self: center;
}
.cat-stage-appicon-img,
.cat-stage-appicon-fallback {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  display: block;
  object-fit: cover;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.28);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}
.cat-stage-appicon-fallback {
  display: grid;
  place-items: center;
  font-size: 22px;
  font-weight: 700;
  color: #93c5fd;
  background:
    linear-gradient(145deg, rgba(59, 130, 246, 0.28), rgba(15, 23, 42, 0.95));
}
.cat-stage-include {
  margin: 0;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.cat-stage-include input,
.cat-stage-toggle input {
  width: 16px;
  height: 16px;
  margin: 0;
  padding: 0;
  min-height: 0;
  min-width: 0;
  accent-color: var(--accent);
  cursor: pointer;
  appearance: auto;
  -webkit-appearance: checkbox;
}
.cat-stage-filename {
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: ui-monospace, Consolas, monospace;
  line-height: 1;
}
.cat-stage-chips {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  align-items: center;
}
.cat-stage-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  background: rgba(148, 163, 184, 0.1);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.14);
  white-space: nowrap;
  box-sizing: border-box;
}
.cat-stage-chip-size {
  background: rgba(61, 139, 255, 0.1);
  border-color: rgba(61, 139, 255, 0.22);
  color: #dbeafe;
}
.cat-stage-chip-k {
  color: var(--muted);
  font-weight: 600;
  font-size: 10px;
}
.cat-stage-chip-phase.cat-stage-phase-ready {
  background: rgba(148, 163, 184, 0.12);
}
.cat-stage-chip-phase.cat-stage-phase-uploading {
  background: rgba(61, 139, 255, 0.18);
  color: #93c5fd;
  border-color: rgba(61, 139, 255, 0.3);
}
.cat-stage-chip-phase.cat-stage-phase-done {
  background: rgba(34, 197, 94, 0.16);
  color: #86efac;
  border-color: rgba(34, 197, 94, 0.3);
}
.cat-stage-chip-phase.cat-stage-phase-error,
.cat-stage-chip-phase.cat-stage-phase-cancelled {
  background: rgba(239, 68, 68, 0.14);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.3);
}
.cat-stage-chip-apk {
  font-family: ui-monospace, Consolas, monospace;
  letter-spacing: 0.04em;
  background: rgba(59, 130, 246, 0.14);
  border-color: rgba(59, 130, 246, 0.3);
  color: #93c5fd;
}
.cat-stage-chip-tier {
  font-family: ui-monospace, Consolas, monospace;
  letter-spacing: 0.04em;
}
.cat-stage-chip-tier-free {
  background: rgba(34, 197, 94, 0.16);
  border-color: rgba(34, 197, 94, 0.4);
  color: #86efac;
}
.cat-stage-chip-tier-paid {
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.35);
  color: #fcd34d;
}
.cat-stage-remove {
  height: 32px;
  min-height: 32px;
  padding: 0 12px;
  white-space: nowrap;
  align-self: center;
}

/* Form: one desktop row — pkg | label | tier | category [| price] | cert | active */
.cat-stage-body {
  padding: 14px 16px 16px;
}
.cat-stage-fields {
  display: grid;
  grid-template-columns:
    minmax(160px, 1.8fr)
    minmax(120px, 1.2fr)
    88px
    96px
    minmax(140px, 1.3fr)
    92px;
  column-gap: 10px;
  row-gap: 10px;
  margin: 0;
  align-items: end;
}
.cat-stage-item.is-paid .cat-stage-fields {
  grid-template-columns:
    minmax(140px, 1.6fr)
    minmax(110px, 1.1fr)
    88px
    96px
    96px
    minmax(130px, 1.2fr)
    92px;
}
.cat-stage-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  min-width: 0;
}
.cat-stage-field-tier,
.cat-stage-field-category,
.cat-stage-field-price,
.cat-stage-fields .cat-stage-active {
  flex: 0 0 auto;
}
.cat-stage-fields .cat-stage-active .cat-stage-toggle {
  width: auto;
  min-width: 0;
  justify-content: flex-start;
  padding: 0 8px;
}
.cat-stage-field-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--muted);
  line-height: 1;
  height: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cat-stage-fields input:not([type="checkbox"]),
.cat-stage-fields select {
  width: 100%;
  margin: 0;
  padding: 0 11px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: #0b1220;
  color: var(--text);
  font-size: 13px;
  line-height: 1;
  height: 36px;
  min-height: 36px;
  color-scheme: dark;
  box-sizing: border-box;
}
.cat-stage-fields input:not([type="checkbox"]):focus,
.cat-stage-fields select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(61, 139, 255, 0.22);
}
.cat-stage-fields input[readonly] {
  color: var(--muted);
  background: rgba(11, 18, 32, 0.72);
  cursor: default;
}
.cat-stage-fields select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-inline-end: 34px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(0.8rem) calc(50% - 2px),
    calc(0.8rem + 5px) calc(50% - 2px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  background-color: #0b1220;
  cursor: pointer;
}
.cat-stage-fields select option {
  background: #0b1220;
  color: var(--text);
}
.cat-stage-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  min-height: 36px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: #0b1220;
  width: 100%;
  box-sizing: border-box;
}
.cat-stage-toggle-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1;
}
.cat-stage-progress {
  display: none;
  padding: 0 16px 12px;
}
.cat-stage-progress.is-visible {
  display: block;
}
.cat-stage-progress .kfu-bar {
  height: 6px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.12);
  overflow: hidden;
}
.cat-stage-alerts:empty {
  display: none;
}
.cat-stage-alerts {
  display: grid;
  gap: 8px;
  padding: 0 16px 14px;
}

/* Banner: single desktop line, vertically centered */
.cat-stage-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 10px 12px;
  min-height: 40px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
}
.cat-stage-banner-icon {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}
.cat-stage-banner-text {
  margin: 0;
  min-width: 0;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cat-stage-banner-text strong {
  font-weight: 700;
  margin-inline-end: 4px;
}
.cat-stage-banner-warn {
  background: rgba(245, 158, 11, 0.1);
  color: #fcd34d;
  border: 1px solid rgba(245, 158, 11, 0.35);
}
.cat-stage-banner-warn .cat-stage-banner-icon {
  background: rgba(245, 158, 11, 0.22);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}
.cat-stage-banner-error {
  background: rgba(239, 68, 68, 0.1);
  color: #fecaca;
  border: 1px solid rgba(239, 68, 68, 0.35);
}
.cat-stage-banner-error .cat-stage-banner-icon {
  background: rgba(239, 68, 68, 0.22);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.4);
}
.ver-phase-done .kfu-bar-fill {
  background: #22c55e;
}
.ver-phase-error .kfu-bar-fill,
.ver-phase-cancelled .kfu-bar-fill {
  background: #ef4444;
}
.ver-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.ver-delete-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
}
.ver-delete-btn.is-busy,
#ver-delete-confirm-btn.is-busy,
#ver-approve-search-btn.is-busy,
#ver-approve-confirm-btn.is-busy {
  opacity: 0.85;
  cursor: wait;
}
#ver-add-device-btn {
  min-width: 42px;
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
}
.ver-bulk-bar {
  margin: 0 0 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0b1220;
  display: grid;
  gap: 8px;
  min-width: 0;
  overflow: visible;
}
.ver-bulk-row {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
  min-width: 0;
}
/* Desktop: approve-all + date + release + approve-by-date on one visible row */
.ver-bulk-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: end;
  gap: 10px;
  min-width: 0;
  width: 100%;
}
.ver-bulk-actions > .primary {
  flex: 0 1 auto;
  white-space: nowrap;
  max-width: 100%;
}
.ver-bulk-actions .btn-label {
  white-space: nowrap;
}
.ver-bulk-field {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  display: grid;
  gap: 6px;
  flex: 1 1 12rem;
  min-width: 0;
  max-width: 20rem;
}
.ver-bulk-field select,
.ver-bulk-actions select {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #0f172a;
  color: var(--text);
  font-size: 14px;
}
.ver-bulk-previews {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  min-width: 0;
}
.ver-bulk-previews .muted {
  min-width: 0;
  overflow-wrap: anywhere;
}
.ver-bulk-hint {
  margin: 0;
  overflow-wrap: anywhere;
}
/* Narrow / tablet: wrap to multiple rows — never clip controls */
@media (max-width: 1100px) {
  .ver-bulk-actions {
    flex-wrap: wrap;
  }
  .ver-bulk-field {
    flex: 1 1 calc(50% - 10px);
    max-width: none;
  }
}
@media (max-width: 640px) {
  .ver-bulk-actions > .primary {
    flex: 1 1 100%;
  }
  .ver-bulk-field {
    flex: 1 1 100%;
  }
}
.ver-bulk-status {
  margin: 0 0 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.72);
}
#ver-approve-all-btn.is-busy,
#ver-approve-by-date-btn.is-busy,
#ver-bulk-confirm-btn.is-busy {
  opacity: 0.85;
  cursor: wait;
}
.ver-approve-search-label {
  display: block;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.ver-approve-search-label input {
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #0b1220;
  color: var(--text);
  font-size: 14px;
}
.ver-approve-search-actions {
  margin-top: 10px;
}
.ver-approve-results {
  margin-top: 12px;
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
}
.ver-approve-option {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 0;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #0b1220;
  cursor: pointer;
}
.ver-approve-option:has(input:checked) {
  border-color: rgba(61, 139, 255, 0.55);
  background: rgba(61, 139, 255, 0.1);
}
.ver-approve-empty { margin: 0; color: #fca5a5; }
.row-selected { background: rgba(61, 139, 255, 0.1); }
.mono { font-family: ui-monospace, Consolas, monospace; }
.badge-ok {
  background: rgba(34, 197, 94, 0.15);
  color: #86efac;
  border: 1px solid rgba(34, 197, 94, 0.35);
}
.badge-fail {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.35);
}
.ver-success-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 28px;
  padding: 2px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 13px;
  color: #86efac;
  background: rgba(34, 197, 94, 0.16);
  border: 1px solid rgba(34, 197, 94, 0.4);
}
.ver-updates-cell { min-width: 120px; }
.versions-status {
  position: sticky;
  bottom: 12px;
  margin: 0 auto;
  max-width: 1100px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(18, 26, 44, 0.96);
  z-index: 5;
}
.versions-status.ok { border-color: rgba(34, 197, 94, 0.45); color: #86efac; }
.versions-status.error { border-color: rgba(239, 68, 68, 0.45); color: #fca5a5; }
.versions-status.info { border-color: rgba(61, 139, 255, 0.45); color: #93c5fd; }

@media (max-width: 820px) {
  .view { padding: 14px; }
  h1 { font-size: 22px; }
  .topbar {
    flex-direction: row;
    align-items: flex-start;
    gap: 12px;
  }
  .topbar-actions {
    max-width: none;
    justify-content: flex-end;
  }
  .topbar-actions .pill {
    max-width: 110px;
  }
  .topbar-menu-panel {
    min-width: min(260px, calc(100vw - 48px));
  }
  .login-card { margin: 4vh auto; }
  th, td { padding: 8px 6px; font-size: 12px; }
  .stats-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .versions-upload-form { grid-template-columns: 1fr; }
  .single-import-fields {
    grid-template-columns: 1fr 1fr;
  }
  .single-import-field-cpu,
  .single-import-actions {
    grid-column: 1 / -1;
  }
  .single-import-actions .primary {
    width: 100%;
  }
  .versions-upload-form > button {
    width: 100%;
    justify-self: stretch;
  }
  .ver-stage-fields { grid-template-columns: 1fr; }
  /* Compact staging header — no empty 1fr void beside the icon */
  .cat-stage-card-top {
    grid-template-columns: 20px 48px minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    grid-template-areas:
      "include icon name remove"
      "chips chips chips chips";
    column-gap: 8px;
    row-gap: 6px;
    min-height: 0;
    padding: 8px 10px;
    align-items: center;
  }
  .cat-stage-include {
    grid-area: include;
  }
  .cat-stage-appicon {
    grid-area: icon;
    width: 48px;
    height: 48px;
    justify-self: start;
  }
  .cat-stage-appicon-img,
  .cat-stage-appicon-fallback {
    width: 48px;
    height: 48px;
    border-radius: 12px;
  }
  .cat-stage-filename {
    grid-area: name;
    font-size: 12px;
    line-height: 1.25;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .cat-stage-chips {
    grid-area: chips;
    flex-wrap: wrap;
    gap: 4px;
  }
  .cat-stage-remove {
    grid-area: remove;
    align-self: start;
    height: 30px;
    min-height: 30px;
    padding: 0 10px;
    font-size: 12px;
  }
  .cat-stage-body {
    padding: 10px;
  }
  .cat-stage-fields,
  .cat-stage-item.is-paid .cat-stage-fields {
    grid-template-columns: 1fr 1fr;
    column-gap: 8px;
    row-gap: 8px;
  }
  .cat-stage-field-cert,
  .cat-stage-fields .cat-stage-active {
    grid-column: 1 / -1;
  }
  .cat-stage-alerts {
    padding: 0 10px 10px;
  }
  .cat-stage-banner-text {
    white-space: normal;
  }
  .ver-staging {
    margin-top: 8px;
    padding-top: 8px;
  }
  .ver-staging-list {
    margin-top: 8px;
    gap: 8px;
  }
  .ver-staging-actions { flex-direction: column; }
  .ver-staging-actions button { width: 100%; }
  #cat-upload-mount {
    margin: 6px 0 4px;
  }
  #cat-upload-mount.kfu-root {
    margin-top: 0;
  }
  #cat-upload-mount .kfu-dropzone {
    padding: 12px 10px;
  }
  #cat-upload-mount .kfu-title {
    margin-bottom: 2px;
    font-size: 14px;
  }
  #cat-upload-status {
    margin: 0 0 8px;
    min-height: 0;
  }
}

@media (max-width: 520px) {
  .card { padding: 12px; }
  .dropzone { padding: 18px 12px; }
  .stats-filters { grid-template-columns: 1fr; }
  .stats-metrics { grid-template-columns: 1fr; }
  .topbar-actions .pill {
    display: none;
  }
  .cat-stage-fields,
  .cat-stage-item.is-paid .cat-stage-fields {
    grid-template-columns: 1fr;
  }
  .cat-stage-field-cert,
  .cat-stage-fields .cat-stage-active {
    grid-column: auto;
  }
  .cat-stage-card-top {
    padding: 8px;
    column-gap: 6px;
  }
  .cat-intro-text {
    font-size: 11.5px;
    line-height: 1.3;
  }
  #cat-upload-mount {
    margin: 4px 0 2px;
  }
  #cat-upload-mount .kfu-dropzone {
    padding: 10px 8px;
  }
  #cat-upload-mount .kfu-hint {
    font-size: 11px;
  }
  .single-import-fields {
    grid-template-columns: 1fr;
  }
}

/* —— Catalog sync (gallery) — mobile-safe rows —— */
#fk-confirm-dialog {
  z-index: 90;
}

.factory-keys-dialog-panel {
  width: min(720px, 100%);
  max-width: min(720px, calc(100vw - 32px));
  max-height: min(92vh, 920px);
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-sizing: border-box;
}

.fk-dialog-intro {
  margin: 0;
}

.fk-create-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 12px;
  min-width: 0;
  width: 100%;
}

.fk-create-form .fk-create-name {
  flex: 1 1 160px;
  min-width: 0;
  max-width: 100%;
  margin: 0;
}

.fk-create-form input {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.fk-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
}

.fk-section-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

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

.fk-copy-emergency-btn.is-copied {
  color: #4ade80;
  border-color: rgba(34, 197, 94, 0.65);
  background: rgba(34, 197, 94, 0.14);
}

.fk-copy-emergency-btn.is-copied .fk-copy-idle-label {
  display: none;
}

.fk-copy-emergency-btn.is-copied .fk-copy-done-label {
  display: inline;
}

.fk-copy-emergency-btn .fk-copy-done-label.hidden {
  display: none;
}

.fk-row-actions {
  display: inline-flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  white-space: nowrap;
}

.fk-row-actions .ghost:not(.cat-icon-btn) {
  flex: 0 0 auto;
  box-sizing: border-box;
  height: 36px;
  min-height: 36px;
  max-height: 36px;
  padding: 0 12px;
  margin: 0;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.fk-row-actions .cat-icon-btn {
  flex: 0 0 32px;
  margin: 0;
}

.fk-row-disabled td {
  opacity: 0.78;
}

.fk-copy-key-btn {
  box-sizing: border-box;
  width: 36px;
  height: 36px;
  min-width: 36px;
  max-width: 36px;
  min-height: 36px;
  max-height: 36px;
  padding: 0;
  margin: 0;
  border-radius: 10px;
  border: 1px solid rgba(61, 139, 255, 0.35);
  background: rgba(11, 18, 32, 0.85);
  color: #93c5fd;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  flex: 0 0 36px;
}

.fk-copy-key-btn:hover:not(:disabled) {
  border-color: rgba(61, 139, 255, 0.55);
  background: rgba(61, 139, 255, 0.14);
  color: #bfdbfe;
  filter: none;
  transform: none;
}

.fk-copy-key-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.fk-copy-key-btn .fk-key-icon {
  width: 18px;
  height: 18px;
  display: block;
  flex: 0 0 18px;
}

/* Brief green flash after copy — key icon stays, no V */
.fk-copy-key-btn.is-copied {
  color: #4ade80;
  border-color: rgba(34, 197, 94, 0.65);
  background: rgba(34, 197, 94, 0.14);
}

.fk-table-wrap {
  min-height: 120px;
  max-height: min(42vh, 360px);
  overflow: auto;
  min-width: 0;
  width: 100%;
}

.fk-table {
  width: 100%;
  table-layout: fixed;
}

.fk-table .fk-col-name {
  width: 38%;
  min-width: 0;
}

.fk-name-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.fk-name-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fk-edit-name-btn {
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  padding: 0;
  margin: 0;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: #93a0bc;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  line-height: 0;
}

.fk-edit-name-btn:hover:not(:disabled) {
  color: #bfdbfe;
  border-color: rgba(61, 139, 255, 0.35);
  background: rgba(61, 139, 255, 0.1);
  filter: none;
  transform: none;
}

.fk-name-input {
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid rgba(61, 139, 255, 0.45);
  background: rgba(8, 14, 28, 0.95);
  color: var(--text);
  font-size: 13px;
}

.fk-table .fk-col-created {
  width: 24%;
  white-space: nowrap;
}

.fk-table .fk-col-status {
  width: 12%;
  white-space: nowrap;
}

.fk-table .fk-col-actions {
  width: 26%;
  white-space: nowrap;
}

.fk-table .fk-col-actions .fk-row-actions {
  justify-content: flex-start;
}

.fk-status-active {
  color: #4ade80;
  font-weight: 700;
}

.fk-status-disabled {
  color: var(--muted);
  font-weight: 600;
}

#fk-status.ok {
  color: #6ee7b7;
}

#fk-status.error {
  color: #fca5a5;
}

#fk-status.info {
  color: var(--muted);
}

#factory-keys-host {
  display: contents;
}

#catalog-panels {
  min-width: 0;
  max-width: 100%;
}
#catalog-panels > .card {
  min-width: 0;
  max-width: 100%;
}
.cat-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px 12px;
  margin-bottom: 10px;
}
.cat-intro-text {
  margin: 0;
  /* Row toolbar: grow horizontally; min-width only — never use flex-basis rem on column (mobile) or it becomes min-height. */
  flex: 1 1 auto;
  min-width: 16rem;
  max-width: 42rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.cat-intro-actions {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  margin: 0;
}
.cat-edit-dialog-panel label {
  margin-top: 10px;
}
.cat-field-hint {
  display: inline;
  white-space: normal;
}
/* Defaults bar: tier + optional unlock price + active — one desktop row. */
#cat-package-form.cat-defaults-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) auto;
  gap: 12px 16px;
  align-items: end;
  margin-bottom: 6px;
}
#cat-package-form.cat-defaults-row.has-unlock-price {
  grid-template-columns: minmax(220px, 1.4fr) minmax(120px, 160px) auto;
}
#cat-package-form.cat-defaults-row > label {
  display: flex;
  flex-direction: column;
  margin: 0;
  min-width: 0;
}
#cat-package-form.cat-defaults-row > label.remember-row {
  flex-direction: row;
  align-items: center;
  align-self: end;
  min-height: 40px;
  margin-top: 0;
  padding-bottom: 8px;
  white-space: nowrap;
}
#cat-package-form.cat-defaults-row select,
#cat-package-form.cat-defaults-row input[type="number"] {
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #0b1220;
  color: var(--text);
  font-size: 14px;
  line-height: 1.3;
  min-height: 40px;
  color-scheme: dark;
}
#cat-package-form.cat-defaults-row select {
  appearance: none;
  -webkit-appearance: none;
  padding-inline-end: 36px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(0.85rem) calc(50% - 2px),
    calc(0.85rem + 5px) calc(50% - 2px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  background-color: #0b1220;
  cursor: pointer;
}
.cat-defaults-hint {
  margin: 0 0 12px;
  line-height: 1.4;
}
.cat-unlock-price-wrap {
  margin: 0;
  min-width: 0;
}
.cat-unlock-price-wrap.is-hidden,
.cat-unlock-price-wrap[hidden] {
  display: none !important;
}
.cat-unlock-price-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #fbbf24;
  font-weight: 700;
  white-space: nowrap;
  line-height: 1.3;
}
.cat-unlock-key {
  font-size: 14px;
  line-height: 1;
}
#cat-package-form #cat-pkg-price,
#cat-package-form #cat-pkg-cert {
  width: 100%;
  margin-top: 6px;
  max-width: none;
}
.cat-unlock-th {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.cat-unlock-price-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.14);
  color: #fbbf24;
  font-weight: 800;
  font-size: 12px;
  white-space: nowrap;
}
.cat-package-form label,
#cat-grant-form label {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.cat-package-form input,
#cat-grant-form input,
.cat-package-form select,
#cat-grant-form select {
  max-width: 100%;
  min-width: 0;
}
#cat-upload-status {
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.45;
}
.cat-table-wrap {
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}
.cat-actions-cell {
  width: 1%;
  white-space: nowrap;
  vertical-align: middle;
}
.cat-row-actions {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 4px;
}
.cat-icon-btn {
  width: 32px;
  min-width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}
/* FREE tier marker — same slot as PAID dollar button; display-only */
.cat-icon-btn.cat-tier-free-mark {
  box-sizing: border-box;
  cursor: default;
  pointer-events: none;
  user-select: none;
}
.cat-icon-btn.cat-tier-free-mark .btn-label {
  font-size: 15px;
  line-height: 1;
}
/* Active/inactive power toggle — replaces the removed Active text column */
.cat-icon-btn.cat-toggle-active.is-on {
  color: #bbf7d0;
  border-color: rgba(34, 197, 94, 0.6);
  background: rgba(22, 163, 74, 0.28);
}
.cat-icon-btn.cat-toggle-active.is-on:hover:not(:disabled) {
  background: rgba(22, 163, 74, 0.42);
}
.cat-icon-btn.is-off,
.cat-icon-btn.cat-toggle-active.is-off {
  color: #fecaca;
  border-color: rgba(239, 68, 68, 0.55);
  background: rgba(185, 28, 28, 0.28);
}
.cat-icon-btn.is-off:hover:not(:disabled),
.cat-icon-btn.cat-toggle-active.is-off:hover:not(:disabled) {
  background: rgba(185, 28, 28, 0.42);
}
.cat-icon-btn .btn-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}
.cat-icon-btn .btn-spinner {
  width: 14px;
  height: 14px;
  border-width: 2px;
}
.cat-table td .cat-icon-btn.ghost,
.cat-table td .cat-icon-btn.danger {
  white-space: nowrap;
  margin-bottom: 0;
}
.cat-table td.cat-table-empty,
.cat-table td.muted.cat-table-empty {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.4;
}
.cat-card-head {
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-start;
}
.cat-card-head h2 {
  min-width: 0;
  overflow-wrap: anywhere;
}

@media (max-width: 820px) {
  #cat-package-form.cat-defaults-row,
  #cat-package-form.cat-defaults-row.has-unlock-price {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
  #cat-package-form.cat-defaults-row > label.remember-row {
    padding-bottom: 0;
    min-height: 0;
  }
  .cat-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    margin-bottom: 6px;
  }
  .cat-intro-text {
    max-width: none;
    order: 1;
    flex: 0 1 auto;
    min-width: 0;
    font-size: 12px;
    line-height: 1.35;
  }
  .cat-intro-actions {
    order: 0;
    width: 100%;
    justify-content: stretch;
    gap: 6px;
  }
  .cat-intro-actions button {
    flex: 1 1 0;
    min-width: 0;
    min-height: 36px;
    padding: 8px 10px;
  }
  #cat-package-form > button,
  #cat-grant-form > button {
    width: 100%;
    max-width: 100%;
    white-space: normal;
    justify-self: stretch;
  }
  .cat-table th,
  .cat-table td {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    vertical-align: top;
  }
  .cat-table td code {
    display: inline-block;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-all;
  }
  .cat-table td .ghost:not(.cat-icon-btn),
  .cat-table td .danger:not(.cat-icon-btn) {
    white-space: normal;
    margin-bottom: 4px;
  }
  .cat-row-actions {
    flex-wrap: wrap;
    max-width: 112px;
  }
}

@media (max-width: 520px) {
  .view {
    padding: 12px;
  }
  .versions-upload-form select {
    font-size: 13px;
    padding-inline-end: 32px;
  }
}
