/* Subscription portal — separate from APP / ADMIN styling */
:root {
  --sp-bg: #e8e9ed;
  --sp-surface: #ffffff;
  --sp-elevated: #f2f2f5;
  --sp-border: #cfd0d8;
  --sp-text: #252630;
  --sp-muted: #5c5d6e;
  --sp-accent: #c9213b;
  --sp-accent-dim: #a01b30;
  --sp-success: #34c759;
  --sp-danger: #ff6b6b;
  --sp-font: "Segoe UI", system-ui, Roboto, sans-serif;
}
* {
  box-sizing: border-box;
}
body.sp-portal {
  margin: 0;
  font-family: var(--sp-font);
  background: radial-gradient(1200px 600px at 20% -10%, rgba(201, 33, 59, 0.1), transparent),
    var(--sp-bg);
  color: var(--sp-text);
  min-height: 100vh;
  line-height: 1.45;
}
.sp-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--sp-border);
  background: var(--sp-surface);
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}
.sp-header h1 {
  margin: 0 0 6px;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--sp-text);
}
.sp-header .sp-brand {
  color: var(--sp-accent);
  font-weight: 800;
  letter-spacing: 0.12em;
}
.sp-header p {
  margin: 0;
  font-size: 13px;
  color: var(--sp-muted);
  max-width: 640px;
}
.sp-main {
  padding: 14px 16px 28px;
  max-width: 100%;
  margin: 0 auto;
}
.sp-userbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--sp-muted);
}
.sp-userbar strong {
  color: var(--sp-text);
  font-weight: 600;
}
.sp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 14px;
  border-radius: 6px;
  border: 1px solid var(--sp-border);
  background: var(--sp-elevated);
  color: var(--sp-text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
}
.sp-btn:hover {
  border-color: rgba(61, 154, 237, 0.45);
  color: var(--sp-accent);
}
.sp-btn-primary {
  background: #24A0ED;
  border-color: #1a8fd0;
  color: #ffffff;
}
.sp-btn-primary:hover {
  background: #1a8fd0;
  border-color: #1a8fd0;
  color: #ffffff;
  filter: none;
}
.sp-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: auto;
}
.sp-btn-danger {
  border-color: rgba(255, 107, 107, 0.5);
  color: var(--sp-danger);
}
.sp-toolbar {
  margin-bottom: 14px;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  align-items: center;
}
/* Avoid “flash then wrong state” while /capabilities is in flight */
.sp-toolbar.sp-toolbar-cap-pending {
  opacity: 0;
  pointer-events: none;
}
.sp-toolbar.sp-toolbar-cap-ready {
  opacity: 1;
  pointer-events: auto;
  transition: opacity 0.14s ease-out;
}
/* Hidden placeholder button kept out of layout (DO NOT USE). */
.sp-toolbar #createCompanyBtnLegacy {
  display: none !important;
  visibility: hidden !important;
  position: absolute !important;
  width: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  pointer-events: none !important;
}
/* Never collapse the primary provisioning control when JS mis-detects API mode. */
.sp-toolbar #createCompanyBtn {
  display: inline-flex !important;
}
.sp-card {
  background: var(--sp-surface);
  border: 1px solid var(--sp-border);
  border-radius: 10px;
  padding: 22px 24px;
  max-width: 440px;
  margin: 0 auto 20px;
}
.sp-card h2 {
  margin: 0 0 16px;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--sp-muted);
}
.sp-field {
  margin-bottom: 12px;
}
.sp-field label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--sp-muted);
  margin-bottom: 4px;
}
.sp-field input,
.sp-field textarea,
.sp-field select {
  width: 100%;
  padding: 6px 11px;
  line-height: 1.35;
  border-radius: 6px;
  border: 1px solid var(--sp-border);
  background: var(--sp-bg);
  color: var(--sp-text);
  font-size: 14px;
  font-family: inherit;
}
.sp-field-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
.sp-field-check input {
  width: auto;
}
.sp-field-check label {
  text-transform: none;
  font-size: 14px;
  color: var(--sp-text);
  margin: 0;
}
.sp-field textarea {
  min-height: 64px;
  resize: vertical;
}
.sp-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 520px) {
  .sp-field-row {
    grid-template-columns: 1fr;
  }
}
.sp-err {
  color: var(--sp-danger);
  font-size: 13px;
  margin: 0 0 12px;
}
.sp-success {
  color: var(--sp-success);
  font-size: 13px;
  margin: 0 0 12px;
}
.sp-warn {
  color: var(--sp-danger);
  font-size: 13px;
  margin: 0 0 12px;
  line-height: 1.45;
}
.sp-hint {
  font-size: 12px;
  color: var(--sp-muted);
  margin: 0 0 12px;
  line-height: 1.45;
}
.sp-table-wrap {
  overflow-x: auto;
}
table.sp-table {
  width: max-content;
  max-width: 100%;
  border-collapse: collapse;
  table-layout: auto;
  font-size: 13px;
  background: var(--sp-surface);
  border: 1px solid var(--sp-border);
  border-radius: 8px;
  overflow: hidden;
}
.sp-table th,
.sp-table td {
  padding: 5px 7px;
  text-align: left;
  border-bottom: 1px solid var(--sp-border);
  vertical-align: top;
  line-height: 1.35;
}
/* Vertical separators between columns */
.sp-table th + th,
.sp-table td + td {
  border-left: 1px solid var(--sp-border);
}
/* Company — wrap; cap width so table stays scannable */
.sp-table th:nth-child(1),
.sp-table td:nth-child(1) {
  width: 1%;
  max-width: 11rem;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}
/* Email */
.sp-table th:nth-child(2),
.sp-table td:nth-child(2) {
  width: 1%;
  max-width: 9.5rem;
  font-size: 12px;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}
/* Phone through License (cols 3–9) */
.sp-table th:nth-child(n + 3):nth-child(-n + 9),
.sp-table td:nth-child(n + 3):nth-child(-n + 9) {
  width: 1%;
  white-space: nowrap;
}
/* Features */
.sp-table th:nth-child(10),
.sp-table td:nth-child(10) {
  width: 1%;
  white-space: nowrap;
  padding-left: 6px;
  padding-right: 6px;
}
.sp-feature-select {
  display: block;
  width: max-content;
  max-width: 10.25rem;
  min-width: 0;
  box-sizing: border-box;
  font-size: 12px;
  line-height: 1.3;
  padding: 3px 5px;
  border-radius: 6px;
  border: 1px solid var(--sp-border);
  background: var(--sp-panel);
  color: inherit;
}
/* Verify */
.sp-table:not(.sp-table-records) th:nth-child(11),
.sp-table:not(.sp-table-records) td:nth-child(11) {
  width: 1%;
  white-space: nowrap;
}
/* Last import */
.sp-table th:nth-child(12),
.sp-table td:nth-child(12) {
  width: 1%;
  max-width: 8.5rem;
  font-size: 11px;
  line-height: 1.3;
  white-space: normal;
  overflow-wrap: anywhere;
}
.sp-table th {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--sp-muted);
  background: rgba(0, 0, 0, 0.2);
}
.sp-table tr:last-child td {
  border-bottom: none;
}
.sp-table tr:hover td {
  background: rgba(61, 154, 237, 0.05);
}

/* Manage Users (users.html) — 7 cols: Username, Full name, Email, Phone, Active, Last login, actions.
   Overrides Records-grid rules (width:1%, word-break) that were crushing username/email. */
table.sp-table.sp-table-users {
  width: 100%;
  min-width: 56rem;
  max-width: none;
  table-layout: auto;
}
table.sp-table.sp-table-users th,
table.sp-table.sp-table-users td {
  width: auto !important;
  max-width: none !important;
  white-space: nowrap !important;
  word-break: normal !important;
  overflow-wrap: normal !important;
  vertical-align: middle;
}
table.sp-table.sp-table-users th:nth-child(1),
table.sp-table.sp-table-users td:nth-child(1) {
  min-width: 17rem;
}
table.sp-table.sp-table-users th:nth-child(2),
table.sp-table.sp-table-users td:nth-child(2) {
  min-width: 9rem;
}
table.sp-table.sp-table-users th:nth-child(3),
table.sp-table.sp-table-users td:nth-child(3) {
  min-width: 15rem;
}
table.sp-table.sp-table-users th:nth-child(4),
table.sp-table.sp-table-users td:nth-child(4) {
  min-width: 6.5rem;
}
table.sp-table.sp-table-users th:nth-child(5),
table.sp-table.sp-table-users td:nth-child(5) {
  min-width: 3.5rem;
  text-align: center;
}
table.sp-table.sp-table-users th:nth-child(6),
table.sp-table.sp-table-users td:nth-child(6) {
  min-width: 10rem;
  font-size: 11px;
}
table.sp-table.sp-table-users th:nth-child(7),
table.sp-table.sp-table-users td:nth-child(7) {
  min-width: 8rem;
  padding-right: 10px;
}
body.sp-users-page .sp-table-wrap {
  overflow-x: auto;
}
.sp-mono {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12px;
}
.sp-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  background: rgba(61, 154, 237, 0.15);
  color: var(--sp-accent);
}
.sp-pill-off {
  background: rgba(255, 107, 107, 0.12);
  color: var(--sp-danger);
}
.sp-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.sp-modal-overlay.open {
  display: flex;
}
.sp-modal-overlay.sp-modal-on-top {
  z-index: 1100;
}
.sp-modal {
  width: 480px;
  max-width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  background: var(--sp-elevated);
  border: 1px solid var(--sp-border);
  border-radius: 10px;
  padding: 22px;
}
.sp-modal h3 {
  margin: 0 0 16px;
  font-size: 1rem;
  color: var(--sp-text);
}
.sp-inline-pane-form {
  width: 100% !important;
  max-width: 100% !important;
  max-height: none !important;
  overflow: visible !important;
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
}
.sp-inline-pane-form h3 {
  margin-bottom: 8px;
  font-size: 0.9rem;
}
.sp-inline-pane-form .sp-field {
  margin-bottom: 8px;
}
.sp-inline-pane-form .sp-field-row {
  gap: 8px;
}
.sp-inline-pane-form .sp-field label {
  margin-bottom: 2px;
  font-size: 10px;
}
.sp-inline-pane-form .sp-field input,
.sp-inline-pane-form .sp-field textarea,
.sp-inline-pane-form .sp-field select {
  padding: 4px 9px;
  line-height: 1.2;
  font-size: 13px;
}
.sp-inline-pane-form .sp-field-check {
  margin-top: 4px;
}
.sp-inline-pane-form .sp-field textarea {
  min-height: 42px;
}
.sp-inline-pane-form .sp-actions {
  margin-top: 10px;
}
.sp-inline-pane-form .sp-inline-create-grid {
  max-width: 900px;
  width: auto;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 8px 10px;
  align-items: start;
}
.sp-inline-pane-form .sp-inline-create-grid > .sp-field,
.sp-inline-pane-form .sp-inline-create-grid > .sp-field-check,
.sp-inline-pane-form .sp-inline-create-grid > .sp-actions {
  margin: 0;
}
.sp-inline-pane-form .sp-inline-create-grid .cc-span-2 {
  grid-column: span 2;
}
.sp-inline-pane-form .sp-inline-create-grid .cc-span-3 {
  grid-column: span 3;
}
.sp-inline-pane-form .sp-inline-create-grid .cc-span-4 {
  grid-column: 1 / -1;
}
@media (max-width: 1180px) {
  .sp-inline-pane-form .sp-inline-create-grid {
    grid-template-columns: repeat(3, minmax(130px, 1fr));
    max-width: 760px;
  }
  .sp-inline-pane-form .sp-inline-create-grid .cc-span-4 {
    grid-column: 1 / -1;
  }
}
@media (max-width: 860px) {
  .sp-inline-pane-form .sp-inline-create-grid {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
    max-width: 100%;
  }
  .sp-inline-pane-form .sp-inline-create-grid .cc-span-3,
  .sp-inline-pane-form .sp-inline-create-grid .cc-span-4 {
    grid-column: 1 / -1;
  }
}
.sp-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 18px;
  flex-wrap: wrap;
}
.sp-btn-sm {
  padding: 6px 10px;
  font-size: 12px;
}
.sp-users-modal {
  width: 680px;
  max-width: min(680px, 100%);
  max-height: min(92vh, 760px);
}
.sp-users-form-grid {
  display: grid;
  grid-template-columns: minmax(170px, 0.95fr) minmax(240px, 1.35fr) minmax(160px, 0.9fr);
  gap: 8px 10px;
  align-items: start;
}
.sp-users-form-grid .uf-span-1 {
  grid-column: span 1;
}
.sp-users-form-grid .uf-span-2 {
  grid-column: span 2;
}
.sp-users-form-grid .uf-span-3 {
  grid-column: 1 / -1;
}
.sp-users-form-grid .sp-field,
.sp-users-form-grid .sp-actions {
  margin: 0;
}
.sp-users-form-grid #f_username {
  max-width: 180px;
}
.sp-users-form-grid #f_phone {
  max-width: 100%;
}
.sp-users-form-grid #f_email {
  max-width: 100%;
}
.sp-users-form-grid #f_address {
  min-height: 44px;
}
@media (max-width: 760px) {
  .sp-users-form-grid {
    grid-template-columns: 1fr;
  }
  .sp-users-form-grid .uf-span-1,
  .sp-users-form-grid .uf-span-2,
  .sp-users-form-grid .uf-span-3 {
    grid-column: 1 / -1;
  }
  .sp-users-form-grid #f_username,
  .sp-users-form-grid #f_phone {
    max-width: 100%;
  }
}

/* Forgot-password testing: masked URL/token + Peep toggle */
.sp-peep-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
  width: 100%;
}
.sp-peep-row input {
  flex: 1;
  min-width: 0;
  padding: 9px 11px;
  border: 1px solid var(--sp-border);
  border-radius: 6px;
  background: var(--sp-input-bg);
  color: var(--sp-text);
  font-size: 12px;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
}
.sp-peep-btn {
  flex-shrink: 0;
  padding: 9px 12px;
  min-width: 4.5rem;
}

.sp-testing-hint {
  font-size: 13px;
  line-height: 1.45;
  color: var(--sp-text);
  border-left: 3px solid #e6a23c;
  padding: 10px 12px;
  margin: 12px 0 0;
  background: rgba(230, 162, 60, 0.12);
  border-radius: 0 6px 6px 0;
}

/* Subscription records: admin-style shell */
body.sp-records .sp-main {
  max-width: 100%;
  padding-left: 12px;
  padding-right: 12px;
}
.sp-rec-shell {
  display: grid;
  grid-template-columns: fit-content(300px) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}
.sp-rec-nav {
  position: sticky;
  top: 14px;
  background: var(--sp-surface);
  border: 1px solid var(--sp-border);
  border-radius: 10px;
  padding: 12px;
  width: fit-content;
  max-width: 300px;
}
.sp-rec-nav-title-mgmt {
  color: var(--sp-accent);
  font-weight: 800;
  margin-top: 0;
}
.sp-rec-menu-mgmt {
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--sp-border);
}
.sp-corporate-board-frame {
  display: block;
}
.sp-rec-nav-title {
  margin: 0 0 10px;
  font-size: 11px;
  color: var(--sp-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
}
.sp-rec-menu {
  display: grid;
  gap: 8px;
}
.sp-rec-menu-item {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
  width: 100%;
  background: transparent;
  color: var(--sp-text);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
}
.sp-rec-menu-item:hover {
  border-color: rgba(36, 160, 237, 0.35);
  background: rgba(36, 160, 237, 0.12);
  color: var(--sp-text);
}
.sp-rec-menu-item.is-active {
  background: #24A0ED;
  border-color: #1a8fd0;
  color: #fff;
}
.sp-rec-menu-item.sp-rec-menu-item--disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.sp-rec-menu-item.sp-rec-menu-item--disabled:hover {
  border-color: transparent;
  background: transparent;
}
.sp-rec-submenu-item {
  font-size: 12px;
  font-weight: 500;
  padding-left: 22px;
  color: var(--sp-muted);
}
.sp-rec-submenu-item:hover {
  color: var(--sp-text);
}
.sp-rec-content {
  display: grid;
  gap: 12px;
  min-width: 0;
}
.sp-rec-section {
  background: var(--sp-surface);
  border: 1px solid var(--sp-border);
  border-radius: 10px;
  padding: 12px;
  display: none;
}
.sp-rec-section.is-active {
  display: block;
}
.sp-tools-frame {
  width: 100%;
  min-height: 70vh;
  border: 1px solid var(--sp-border);
  border-radius: 8px;
  background: var(--sp-surface);
}
.sp-rec-section h2 {
  margin: 0 0 10px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sp-muted);
}
.sp-rec-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 10px;
}
.sp-rec-kpi {
  border: 1px solid var(--sp-border);
  border-radius: 9px;
  background: var(--sp-elevated);
  padding: 10px;
}
.sp-rec-kpi-label {
  font-size: 11px;
  color: var(--sp-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.sp-rec-kpi-value {
  margin-top: 5px;
  font-size: 24px;
  line-height: 1;
  font-weight: 700;
}
body.sp-records .sp-toolbar {
  margin: 0;
  justify-content: flex-start;
}
body.sp-records .sp-table-wrap {
  border: 1px solid var(--sp-border);
  border-radius: 8px;
  overflow-x: auto;
}
body.sp-records #section-overview .sp-table-wrap {
  overflow-x: auto;
}
/* Other tables on Records page (import history, etc.) */
body.sp-records .sp-table:not(.sp-table-records) {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}
body.sp-records .sp-table:not(.sp-table-records) th,
body.sp-records .sp-table:not(.sp-table-records) td {
  white-space: nowrap;
  word-break: normal;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Subscription Records list — auto-fit columns by content type */
body.sp-records table.sp-table-records {
  width: 100%;
  min-width: 68rem;
  max-width: none;
  table-layout: auto;
}
body.sp-records table.sp-table-records th,
body.sp-records table.sp-table-records td {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  overflow-wrap: anywhere;
  word-break: normal;
}
body.sp-records table.sp-table-records col.sp-rec-col--company {
  width: 16%;
  min-width: 11rem;
}
body.sp-records table.sp-table-records col.sp-rec-col--email {
  width: 11%;
  min-width: 8.5rem;
}
body.sp-records table.sp-table-records col.sp-rec-col--phone {
  width: 7%;
  min-width: 6.5rem;
}
body.sp-records table.sp-table-records col.sp-rec-col--date {
  width: 5.25rem;
}
body.sp-records table.sp-table-records col.sp-rec-col--amount {
  width: 4.5rem;
}
body.sp-records table.sp-table-records col.sp-rec-col--license {
  width: 5.5rem;
}
body.sp-records table.sp-table-records col.sp-rec-col--features {
  width: 18%;
  min-width: 13.5rem;
}
body.sp-records table.sp-table-records col.sp-rec-col--verify {
  width: 6.5rem;
}
body.sp-records table.sp-table-records col.sp-rec-col--import {
  width: 11%;
  min-width: 9rem;
}
body.sp-records table.sp-table-records th:nth-child(1),
body.sp-records table.sp-table-records td:nth-child(1) {
  min-width: 11rem;
  max-width: 20rem;
}
body.sp-records table.sp-table-records th:nth-child(2),
body.sp-records table.sp-table-records td:nth-child(2) {
  min-width: 8.5rem;
  max-width: 14rem;
  font-size: 12px;
}
body.sp-records table.sp-table-records th:nth-child(3),
body.sp-records table.sp-table-records td:nth-child(3) {
  white-space: nowrap;
  width: 1%;
}
body.sp-records table.sp-table-records th:nth-child(n + 4):nth-child(-n + 7),
body.sp-records table.sp-table-records td:nth-child(n + 4):nth-child(-n + 7) {
  white-space: nowrap;
  width: 1%;
  padding-left: 6px;
  padding-right: 6px;
  font-size: 12px;
}
body.sp-records table.sp-table-records th:nth-child(8),
body.sp-records table.sp-table-records td:nth-child(8) {
  white-space: nowrap;
  width: 1%;
  text-align: right;
}
body.sp-records table.sp-table-records th:nth-child(9),
body.sp-records table.sp-table-records td:nth-child(9) {
  white-space: nowrap;
  width: 1%;
}
body.sp-records table.sp-table-records th:nth-child(10),
body.sp-records table.sp-table-records td:nth-child(10),
body.sp-records table.sp-table-records .sp-rec-cell-features {
  min-width: 13.5rem;
  max-width: 22rem;
  vertical-align: top;
}
.sp-feature-checklist {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 11px;
  line-height: 1.3;
  max-width: 20rem;
}
.sp-feature-check {
  display: flex;
  align-items: flex-start;
  gap: 5px;
  cursor: pointer;
  white-space: normal;
  margin: 0;
}
.sp-feature-check input {
  margin: 2px 0 0;
  flex-shrink: 0;
}
body.sp-records table.sp-table-records th:nth-child(11),
body.sp-records table.sp-table-records td:nth-child(11),
body.sp-records table.sp-table-records .sp-rec-cell-verify {
  white-space: nowrap;
  width: 1%;
  min-width: 5.5rem;
}
body.sp-records table.sp-table-records th:nth-child(12),
body.sp-records table.sp-table-records td:nth-child(12),
body.sp-records table.sp-table-records .sp-rec-cell-import {
  min-width: 9rem;
  max-width: 14rem;
  font-size: 11px;
  line-height: 1.35;
}
@media (max-width: 980px) {
  .sp-rec-shell {
    grid-template-columns: 1fr;
  }
  .sp-rec-nav {
    position: static;
  }
  .sp-rec-kpis {
    grid-template-columns: repeat(2, minmax(130px, 1fr));
  }
}

/* Full-screen wait while provisioning a new company (RESTORE / tenant create) */
.sp-provision-wait-overlay {
  position: fixed;
  inset: 0;
  z-index: 12000;
  background: rgba(15, 23, 42, 0.58);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
}
.sp-provision-wait-overlay.is-visible {
  display: flex;
}
.sp-provision-wait-card {
  background: var(--sp-surface);
  border-radius: 14px;
  padding: 26px 28px 22px;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
  text-align: center;
  border: 1px solid var(--sp-border);
}
.sp-truck-track {
  position: relative;
  width: 100%;
  max-width: 280px;
  margin: 0 auto 16px;
  height: 46px;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.04), rgba(0, 0, 0, 0.08));
  overflow: hidden;
}
.sp-truck-body {
  position: absolute;
  top: 50%;
  margin-top: -15px;
  left: 8px;
  width: 56px;
  height: 30px;
  animation: spTruckPatrol 2.2s ease-in-out infinite alternate;
  will-change: left;
}
.sp-truck-svg {
  display: block;
  width: 56px;
  height: 30px;
}
@keyframes spTruckPatrol {
  0% {
    left: 8px;
  }
  100% {
    left: calc(100% - 64px);
  }
}
.sp-provision-wait-msg {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--sp-text);
}

/* Full-screen wait during portal comprehensive import / reverse import (above modals) */
.sp-long-op-overlay {
  position: fixed;
  inset: 0;
  z-index: 12500;
  background: rgba(15, 23, 42, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
}
.sp-long-op-overlay.is-visible {
  display: flex;
}
.sp-long-op-card {
  background: var(--sp-surface);
  border-radius: 14px;
  padding: 28px 32px 24px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
  text-align: center;
  border: 1px solid var(--sp-border);
}
.sp-long-op-spinner {
  width: 44px;
  height: 44px;
  margin: 0 auto 18px;
  border-radius: 50%;
  border: 3px solid var(--sp-border);
  border-top-color: var(--sp-accent);
  animation: spLongOpSpin 0.85s linear infinite;
}
@keyframes spLongOpSpin {
  to {
    transform: rotate(360deg);
  }
}
.sp-long-op-title {
  margin: 0 0 8px;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--sp-text);
}
.sp-long-op-sub {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--sp-muted);
}
.sp-outcome-badge {
  display: none;
  margin: 0 0 12px;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  width: fit-content;
}
.sp-outcome-badge.is-success {
  display: inline-block;
  background: rgba(52, 199, 89, 0.18);
  color: #187236;
}
.sp-outcome-badge.is-attention {
  display: inline-block;
  background: rgba(255, 107, 107, 0.15);
  color: #a01b30;
}

