/* VMGate tenant portal — align :root with main marketing site */
:root {
  --color-primary: #0d6e6e;
  --color-primary-hover: #0a5a5a;
  --color-text: #1a1a1a;
  --color-text-muted: #5c5c5c;
  --color-border: #e2e2e2;
  --color-bg-page: #f6f7f8;
  --color-bg-card: #ffffff;
  --color-error: #b42318;
  --color-link: var(--color-primary);
  --font-sans: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --radius-card: 12px;
  --radius-input: 8px;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.06);
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --max-form: 420px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg-page);
  line-height: 1.5;
}

/* ——— Auth layout (login / create-account) ——— */
.auth-page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
}

.auth-card {
  width: 100%;
  max-width: var(--max-form);
  background: var(--color-bg-card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: var(--space-xl);
  border: 1px solid var(--color-border);
}

.auth-card-wide {
  max-width: 520px;
}

.field-row {
  display: block;
}

@media (min-width: 540px) {
  .field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 var(--space-md);
  }
}

.field-hint {
  display: block;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: var(--space-xs);
}

.input-upper {
  text-transform: uppercase;
}

.registration-terms {
  margin: var(--space-md) 0 var(--space-lg);
  font-size: 0.875rem;
  line-height: 1.45;
  align-items: flex-start;
}

.auth-logo {
  display: block;
  text-align: center;
  margin-bottom: var(--space-md);
  text-decoration: none;
  color: var(--color-text);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.auth-logo img {
  height: 32px;
  width: auto;
}

.auth-logo:hover {
  color: var(--color-primary);
}

.auth-title {
  margin: 0 0 var(--space-lg);
  font-size: 1.375rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  text-align: center;
}

.field {
  margin-bottom: var(--space-md);
}

.field label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: var(--space-xs);
  color: var(--color-text);
}

.field input[type="email"],
.field input[type="password"],
.field input[type="text"],
.field input[type="date"],
.field select {
  width: 100%;
  padding: 0.65rem 0.75rem;
  font: inherit;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-input);
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input:hover {
  border-color: #ccc;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 22%, transparent);
}

.password-wrap {
  position: relative;
}

.password-wrap input {
  padding-inline-end: 4.25rem;
}

.password-toggle {
  position: absolute;
  inset-inline-end: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  font: inherit;
  font-size: 0.8125rem;
  color: var(--color-primary);
  cursor: pointer;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
}

.password-toggle:hover {
  background: color-mix(in srgb, var(--color-primary) 10%, transparent);
}

.password-toggle:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* >>> SMS-PASSWORD-EYE BEGIN (2026-06-25) — icon toggle on SMS connection modals */
.password-toggle-eye {
  font-size: 0;
  padding: 0.35rem;
  line-height: 0;
  color: var(--color-text-muted);
}

.password-toggle-eye:hover {
  color: var(--color-primary);
}

.password-toggle-eye .pw-icon {
  display: block;
}

.password-toggle-eye .pw-icon[hidden] {
  display: none;
}
/* <<< SMS-PASSWORD-EYE END */

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
  flex-wrap: wrap;
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.875rem;
  cursor: pointer;
  user-select: none;
}

.checkbox-field input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--color-primary);
}

.btn-primary {
  display: block;
  width: 100%;
  padding: 0.75rem 1rem;
  font: inherit;
  font-weight: 600;
  font-size: 0.9375rem;
  color: #fff;
  background: var(--color-primary);
  border: none;
  border-radius: var(--radius-input);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease;
}

.btn-primary:hover {
  background: var(--color-primary-hover);
}

.btn-primary:active {
  transform: scale(0.99);
}

.btn-primary:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.link-muted {
  font-size: 0.875rem;
  color: var(--color-link);
  text-decoration: none;
}

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

.auth-error {
  display: none;
  font-size: 0.875rem;
  color: var(--color-error);
  margin-bottom: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: #fef3f2;
  border-radius: var(--radius-input);
  border: 1px solid #fecdca;
}

.auth-error.is-visible {
  display: block;
}

.auth-success {
  display: none;
  font-size: 0.875rem;
  color: #0d4f2d;
  margin-bottom: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: #ecfdf3;
  border-radius: var(--radius-input);
  border: 1px solid #6ee7b7;
}

.auth-success.is-visible {
  display: block;
}

.auth-smtp-off-note {
  margin: 0 0 1.25rem;
  padding: var(--space-sm) var(--space-md);
  text-align: center;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--color-text);
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: var(--radius-input);
}

.auth-secondary {
  text-align: center;
  margin-top: var(--space-lg);
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.auth-secondary a {
  color: var(--color-link);
  font-weight: 500;
  text-decoration: none;
}

.auth-secondary a:hover {
  text-decoration: underline;
}

.auth-footer {
  margin-top: var(--space-xl);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--color-border);
  text-align: center;
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.auth-footer a {
  color: var(--color-text-muted);
  text-decoration: none;
}

.auth-footer a:hover {
  color: var(--color-primary);
  text-decoration: underline;
}

/* Legal documents (terms, privacy, cookies) */
.auth-card-legal {
  max-width: 42rem;
  text-align: left;
}

.legal-meta {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  margin: 0 0 var(--space-lg);
  line-height: 1.5;
}

.legal-doc {
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--color-text);
}

.legal-doc h2 {
  font-size: 1rem;
  font-weight: 600;
  margin: var(--space-lg) 0 var(--space-sm);
  letter-spacing: -0.01em;
}

.legal-doc h2:first-child {
  margin-top: 0;
}

.legal-doc p {
  margin: 0 0 var(--space-md);
}

.legal-doc ul,
.legal-doc ol {
  margin: 0 0 var(--space-md);
  padding-left: 1.25rem;
}

.legal-doc li {
  margin-bottom: var(--space-xs);
}

.legal-doc a {
  color: var(--color-primary);
}

.legal-counsel-note {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-bottom: var(--space-lg);
  padding: var(--space-sm) var(--space-md);
  background: var(--color-bg-subtle, rgba(0, 0, 0, 0.03));
  border-radius: var(--radius-sm, 4px);
  border-left: 3px solid var(--color-border);
}

.auth-back {
  margin-top: var(--space-lg);
  text-align: center;
  font-size: 0.8125rem;
}

.auth-back a {
  color: var(--color-text-muted);
  text-decoration: none;
}

.auth-back a:hover {
  color: var(--color-primary);
}

.sep {
  margin: 0 0.35rem;
  opacity: 0.5;
}

/* ——— App shell + cookie bar ——— */
.app-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.app-header {
  padding: var(--space-md) var(--space-lg);
  background: #0f4c5c;
  border-bottom: 1px solid #0b3f4d;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  color: #fff;
}

.app-header-left {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-xs);
  min-width: 0;
}

.app-header strong {
  font-size: 0.9375rem;
  color: #fff;
}

.app-header-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-md);
  flex-wrap: wrap;
  flex-shrink: 0;
  max-width: 100%;
}

/* In-header language row: not fixed; must not cover Sign out */
.app-header .lang-switcher {
  margin-top: 0;
  text-align: end;
  font-size: 0.7rem;
  line-height: 1.45;
  max-width: min(100%, 18rem);
  color: #d5e8ec;
}

.app-header .lang-switcher-label {
  display: inline;
  margin-inline-end: 0.35rem;
  margin-bottom: 0;
  color: #d5e8ec;
}

.app-header .lang-switcher-link {
  color: #e4f2f4;
}

.app-header .lang-switcher-link.is-active {
  color: #ffffff;
}

[dir="rtl"] .app-header-right {
  flex-direction: row-reverse;
}

.btn-small {
  font-size: 0.8125rem;
  padding: 0.4rem 0.65rem;
}

.tenant-status-strip {
  display: grid;
  /* >>> STATUS-STRIP-SIX-COL BEGIN (2026-06-25) — Plan + compact Ports/Calls + SIP + SMS + Network on one row */
  grid-template-columns:
    minmax(72px, 0.8fr)
    minmax(5.5rem, 0.55fr)
    minmax(5.5rem, 0.55fr)
    minmax(0, 1.45fr)
    minmax(0, 1.45fr)
    minmax(72px, 0.85fr);
  /* Superseded: max-content on Ports/Calls — too narrow, no growth */
  /* Superseded: grid-template-columns: repeat(5, minmax(120px, 1fr)); — wrapped when SMS ingress added */
  /* <<< STATUS-STRIP-SIX-COL END */
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg);
  background: linear-gradient(180deg, #edf6f8 0%, #e4f0f2 100%);
  border-bottom: 1px solid #d3e4e7;
}

.status-card {
  background: linear-gradient(180deg, #ffffff 0%, #f5fafb 100%);
  border: 1px solid #dbe9ec;
  border-radius: 10px;
  padding: 0.5rem 0.65rem;
  min-width: 0;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset;
}

/* >>> STATUS-STRIP-COMPACT BEGIN (2026-06-25) — Ports + Active calls tiles (min width, stretch in column) */
.status-card-compact {
  padding: 0.45rem 0.55rem;
  width: 100%;
  min-width: 5.5rem;
  box-sizing: border-box;
}

.status-card-compact .status-label {
  font-size: 0.65rem;
  line-height: 1.15;
  white-space: nowrap;
}

.status-card-compact .status-value {
  margin-top: 0.15rem;
  text-align: center;
}
/* Superseded: justify-self: start; max-content column — tiles stayed tiny */
/* <<< STATUS-STRIP-COMPACT END */

/* >>> CLOUD-SAAS-SUBSCRIPTION-UI BEGIN (2026-05-23) — clickable Plan → subscription.html */
.status-card-plan-link {
  display: block;
  color: inherit;
  text-decoration: none;
  border-radius: 8px;
  margin: -0.15rem -0.2rem;
  padding: 0.15rem 0.2rem;
  transition: background 0.15s ease;
}

.status-card-plan-link:hover,
.status-card-plan-link:focus-visible {
  background: rgba(34, 211, 238, 0.12);
  outline: 2px solid rgba(34, 211, 238, 0.35);
  outline-offset: 1px;
}
/* <<< CLOUD-SAAS-SUBSCRIPTION-UI END */

/* >>> CLOUD-SAAS-SUBSCRIPTION-UI BEGIN (2026-05-21) — pricing card grid (ElevenLabs-style) */
.subscription-page-card {
  max-width: 1180px;
  width: 100%;
  margin-inline: auto;
}

.subscription-manage {
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
}

.subscription-overview {
  display: grid;
  gap: var(--space-md);
}

@media (min-width: 768px) {
  .subscription-overview {
    grid-template-columns: 1fr minmax(240px, 320px);
    align-items: start;
  }
}

.subscription-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-sm);
}

.subscription-stat-card {
  background: linear-gradient(180deg, #ffffff 0%, #f5fafb 100%);
  border: 1px solid #dbe9ec;
  border-radius: 10px;
  padding: 0.75rem 0.85rem;
  min-width: 0;
}

.subscription-stat-label {
  display: block;
  font-size: 0.72rem;
  color: var(--color-text-muted);
  line-height: 1.3;
}

.subscription-stat-value {
  display: block;
  margin-top: 0.35rem;
  font-size: 1.15rem;
  font-weight: 600;
  color: #113741;
  line-height: 1.2;
}

.subscription-stat-sub {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.subscription-billing-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  padding: var(--space-md);
}

.subscription-billing-card h3 {
  margin: 0 0 var(--space-sm);
  font-size: 0.9rem;
  font-weight: 600;
}

.subscription-lines {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.subscription-lines td {
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
}

.subscription-lines td:last-child {
  text-align: right;
  white-space: nowrap;
  padding-left: var(--space-md);
}

.subscription-lines .subscription-total td {
  border-bottom: none;
  padding-top: var(--space-sm);
  font-size: 0.95rem;
}

.subscription-invoices-card {
  margin-top: var(--space-md);
  padding: var(--space-md);
  background: var(--surface-elevated, #fff);
  border: 1px solid var(--border-subtle, #e8e8ec);
  border-radius: var(--radius-input);
}

.subscription-invoices-card h3 {
  margin: 0 0 var(--space-sm);
  font-size: 1.05rem;
}

.subscription-invoices-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.subscription-invoices-table th,
.subscription-invoices-table td {
  padding: 0.45rem 0.35rem;
  border-bottom: 1px solid var(--border-subtle, #ececf0);
  text-align: left;
}

.subscription-invoices-table th:last-child,
.subscription-invoices-table td:last-child {
  text-align: right;
}

.subscription-invoice-link {
  font-weight: 600;
  white-space: nowrap;
}

/* >>> AMERIA-VPOS-INVOICE-POLISH BEGIN (2026-07-14) — download is button + Bearer fetch */
button.subscription-invoice-dl {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
}
/* <<< AMERIA-VPOS-INVOICE-POLISH END */

.subscription-cancel-card {
  margin-top: var(--space-md);
  padding: var(--space-md);
  border: 1px solid var(--border-subtle, #ececf0);
  border-radius: var(--radius-input);
}

.subscription-cancel-card h3 {
  margin: 0 0 var(--space-xs);
  font-size: 1.05rem;
}

.subscription-notice {
  margin: var(--space-sm) 0 0;
  padding: 0.65rem 0.75rem;
  background: #fff8e6;
  border: 1px solid #f0dfa0;
  border-radius: var(--radius-input);
  font-size: 0.82rem;
}

/* >>> WIRE-TRANSFER-PAYMENT-UI BEGIN (2026-07-02) — subscription wire dialog */
.subscription-notice .btn-link {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  color: var(--color-primary, #2563eb);
  text-decoration: underline;
  cursor: pointer;
}

.subscription-wire-dl {
  margin: var(--space-md) 0 0;
  display: grid;
  grid-template-columns: minmax(8rem, 34%) 1fr;
  gap: 0.35rem 1rem;
  font-size: 0.875rem;
}

.subscription-wire-dl dt {
  margin: 0;
  font-weight: 600;
  color: var(--color-text-muted, #64748b);
}

.subscription-wire-dl dd {
  margin: 0;
  word-break: break-word;
}

.subscription-wire-dl code {
  font-size: 0.8125rem;
}
/* <<< WIRE-TRANSFER-PAYMENT-UI END */

.billing-notice-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding: 0.65rem 1rem;
  font-size: 0.875rem;
  border-bottom: 1px solid transparent;
}

.billing-notice-warning {
  background: #fff8e6;
  border-bottom-color: #f0dfa0;
  color: #5c4a00;
}

.billing-notice-error {
  background: #fdecea;
  border-bottom-color: #f5c2c0;
  color: #7f1d1d;
}

.billing-notice-text {
  flex: 1 1 auto;
}

.billing-notice-action {
  flex: 0 0 auto;
  font-weight: 600;
  white-space: nowrap;
}

.subscription-pricing-section h3 {
  margin: 0 0 var(--space-xs);
  font-size: 1.05rem;
}

.subscription-change-hint {
  margin: 0 0 var(--space-md);
  font-size: 0.85rem;
}

/* >>> FREE-TIER-BILLING-UI-LOCK BEGIN (2026-05-25) */
.subscription-pricing-section.is-locked .subscription-plan-card:not(.is-current),
.subscription-addon-section.is-locked .subscription-addon-card {
  opacity: 0.72;
}

.subscription-pricing-section.is-locked .subscription-plan-cta.is-locked-btn,
.subscription-addon-section.is-locked .btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
/* <<< FREE-TIER-BILLING-UI-LOCK END */

.subscription-pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: var(--space-md);
  align-items: stretch;
}

@media (min-width: 900px) {
  .subscription-pricing-grid {
    grid-template-columns: repeat(auto-fill, minmax(152px, 1fr));
  }
}

.subscription-plan-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  padding: var(--space-md) var(--space-md) var(--space-sm);
  box-shadow: var(--shadow-card);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.subscription-plan-card:hover {
  border-color: #b8d4d8;
}

.subscription-plan-card.is-current {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 1px var(--color-primary), var(--shadow-card);
}

.subscription-plan-card-enterprise {
  border-style: dashed;
}

.subscription-plan-badge {
  position: absolute;
  top: -0.55rem;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.15rem 0.55rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #fff;
  background: var(--color-primary);
  border-radius: 999px;
  white-space: nowrap;
}

.subscription-plan-tier {
  margin: 0.25rem 0 0;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.subscription-plan-price {
  margin: var(--space-xs) 0 var(--space-sm);
  font-size: 1.65rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--color-text);
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.2rem;
}

.subscription-plan-price .subscription-plan-period {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text-muted);
}

.subscription-plan-features {
  list-style: none;
  margin: 0 0 var(--space-md);
  padding: 0;
  flex: 1;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  line-height: 1.45;
}

.subscription-plan-features li {
  position: relative;
  padding-left: 1.1rem;
  margin-bottom: 0.35rem;
}

.subscription-plan-features li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--color-primary);
  font-weight: 700;
  font-size: 0.75rem;
}

.subscription-plan-card .subscription-plan-cta {
  width: 100%;
  margin-top: auto;
  padding: 0.55rem 0.65rem;
  font-size: 0.8125rem;
  font-weight: 600;
}

.subscription-plan-card .subscription-plan-cta.btn-primary {
  display: block;
}

.subscription-plan-card .subscription-plan-cta.is-current-btn {
  opacity: 0.65;
  cursor: default;
  pointer-events: none;
}

/* >>> CRYPTO-USDT-BILLING BEGIN (2026-06-09) — USDT plan card + modal */
.subscription-plan-card .subscription-crypto-btn {
  display: block;
  width: 100%;
  margin-top: 0.5rem;
}

.subscription-crypto-dl {
  display: grid;
  grid-template-columns: minmax(8rem, 11rem) 1fr;
  gap: 0.35rem 1rem;
  margin: 1rem 0;
  font-size: 0.9375rem;
}

.subscription-crypto-dl dt {
  margin: 0;
  color: var(--color-text-muted, #8b949e);
  font-weight: 500;
}

.subscription-crypto-dl dd {
  margin: 0;
  word-break: break-all;
}

.subscription-crypto-address {
  font-size: 0.8125rem;
}
/* <<< CRYPTO-USDT-BILLING END */

.subscription-addon-section h3 {
  margin: 0 0 var(--space-xs);
  font-size: 1.05rem;
}

.subscription-addon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-md);
  margin-top: var(--space-md);
}

.subscription-addon-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  padding: var(--space-md);
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
}

.subscription-addon-card strong {
  font-size: 0.95rem;
}

.subscription-addon-card .muted {
  margin: 0;
  font-size: 0.82rem;
}

.subscription-addon-card .btn-primary {
  margin-top: var(--space-sm);
  width: auto;
  align-self: flex-start;
  padding: 0.5rem 0.85rem;
  font-size: 0.8125rem;
}
/* <<< CLOUD-SAAS-SUBSCRIPTION-UI END */

.status-label {
  display: block;
  font-size: 0.72rem;
  color: #3d5a63;
}

.status-value {
  display: block;
  font-size: 0.88rem;
  margin-top: 0.2rem;
  color: #113741;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-ip-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* P5-S5a — clickable network selector in the status strip.
 * The .status-network-toggle wraps the network name + chevron and
 * becomes a button when the .is-interactive class is added by JS
 * (which only happens once /portal/network/list returns >=1 row). */
.status-card-network {
  position: relative;
}
.status-network-toggle {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  margin-top: 0.2rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: default;
  outline: none;
}
.status-network-toggle .status-value {
  margin-top: 0;
}
.status-network-toggle.is-interactive {
  cursor: pointer;
  border-radius: 6px;
}
.status-network-toggle.is-interactive:hover .status-value,
.status-network-toggle.is-interactive:focus-visible .status-value {
  text-decoration: underline;
}
.status-network-toggle.is-interactive:focus-visible {
  outline: 2px solid var(--color-primary, #1a78a3);
  outline-offset: 2px;
}
.status-network-chevron {
  font-size: 0.7rem;
  color: #4a6770;
  line-height: 1;
}

.network-selector-popover {
  position: absolute;
  top: calc(100% + 4px);
  left: 0.4rem;
  z-index: 50;
  min-width: 14rem;
  max-width: 22rem;
  margin: 0;
  padding: 0.25rem 0;
  list-style: none;
  background: #ffffff;
  border: 1px solid #d3e4e7;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(17, 55, 65, 0.14);
}
.network-popover-item {
  display: grid;
  grid-template-columns: 1.2rem 1fr auto;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.65rem;
  font-size: 0.88rem;
  color: #113741;
  cursor: pointer;
  user-select: none;
}
.network-popover-item:hover,
.network-popover-item:focus {
  background: #eef6f8;
}
.network-popover-item.is-active {
  background: #e1eef1;
  font-weight: 600;
}
.network-popover-check {
  color: var(--color-primary, #1a78a3);
  font-weight: 700;
  text-align: center;
}
.network-popover-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.network-popover-status {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.btn-tiny {
  font-size: 0.72rem;
  padding: 0.2rem 0.4rem;
}

.portal-layout {
  flex: 1;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 0;
  align-items: start;
}

.portal-sidebar {
  background: linear-gradient(180deg, #f5f8fa 0%, #edf3f6 100%);
  border-right: 1px solid #dce6ea;
  padding: var(--space-md) var(--space-sm);
}

.portal-nav-item {
  display: block;
  text-decoration: none;
  color: var(--color-text);
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  font-size: 0.88rem;
  margin-bottom: 0.2rem;
  border: 1px solid transparent;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.7) 0%, rgba(245, 250, 251, 0.45) 100%);
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.12s ease;
}

.portal-nav-item:hover {
  background: linear-gradient(180deg, #eef5f7 0%, #e4eef2 100%);
  border-color: #d4e3e8;
  color: #0f4c5c;
  transform: translateX(1px);
}

.portal-nav-item.is-active {
  background: linear-gradient(135deg, #dff1f4 0%, #cfe6ea 100%);
  color: #0f4c5c;
  font-weight: 600;
  border-color: #bad8de;
  box-shadow: inset 3px 0 0 #0f4c5c;
}

/* >>> GPS-MAP BEGIN (2026-06-06) — sub-item indented under a parent nav entry */
.portal-nav-sub {
  padding-left: 1.5rem;
  font-size: 0.82rem;
  margin-bottom: 0.1rem;
  opacity: 0.85;
}
.portal-nav-sub:hover { opacity: 1; }
.portal-nav-sub.is-active { opacity: 1; }
/* <<< GPS-MAP END */

.app-header .btn-ghost {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.06);
}

.app-header .btn-ghost:hover {
  background: rgba(255, 255, 255, 0.14);
}

.portal-workspace {
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  align-items: stretch;
  min-width: 0;
  width: 100%;
}

.workspace-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: var(--space-lg);
}

.workspace-card h1 {
  margin: 0 0 var(--space-sm);
  font-size: 1.2rem;
}

.workspace-card h2 {
  margin: 0 0 var(--space-sm);
  font-size: 1.05rem;
}

.network-onboarding-row {
  margin-top: var(--space-sm);
}

.network-onboarding-row.actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.network-onboarding-row label {
  display: block;
  font-size: 0.82rem;
  margin-bottom: 0.25rem;
}

.network-onboarding-row input {
  width: 100%;
  max-width: 420px;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-input);
  font: inherit;
}

/* >>> VMGATE-NETWORK-SERVER-JOIN BEGIN (2026-05-27) — dashboard onboarding spinner during network create */
.network-create-busy {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-text-muted, #555);
}

.network-create-busy[hidden] { display: none !important; }
/* <<< VMGATE-NETWORK-SERVER-JOIN END */

/* >>> PORTAL-FRUIT-PRESENCE-TOAST BEGIN (2026-08-04) — tab-open presence toasts */
.fruit-presence-toasts {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: min(22rem, calc(100vw - 2rem));
  pointer-events: none;
}

.fruit-presence-toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--color-border, #e5e7eb);
  background: var(--color-bg-card, #fff);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  font-size: 0.875rem;
  line-height: 1.35;
  color: var(--color-text, #111827);
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.fruit-presence-toast.is-leaving {
  opacity: 0;
  transform: translateY(-0.35rem);
}

.fruit-presence-toast--online,
.fruit-presence-toast--dongle-in {
  border-left: 3px solid #16a34a;
}

.fruit-presence-toast--offline,
.fruit-presence-toast--dongle-out {
  border-left: 3px solid #dc2626;
}

.fruit-presence-toast__msg {
  flex: 1;
  min-width: 0;
}

.fruit-presence-toast__close {
  flex-shrink: 0;
  border: 0;
  background: transparent;
  color: var(--color-text-muted, #6b7280);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.15rem;
}

.fruit-presence-toast__close:hover {
  color: var(--color-text, #111827);
}

[dir="rtl"] .fruit-presence-toasts {
  right: auto;
  left: 1rem;
}

[dir="rtl"] .fruit-presence-toast--online,
[dir="rtl"] .fruit-presence-toast--dongle-in,
[dir="rtl"] .fruit-presence-toast--offline,
[dir="rtl"] .fruit-presence-toast--dongle-out {
  border-left: 1px solid var(--color-border, #e5e7eb);
  border-right: 3px solid #16a34a;
}

[dir="rtl"] .fruit-presence-toast--offline,
[dir="rtl"] .fruit-presence-toast--dongle-out {
  border-right-color: #dc2626;
}
/* <<< PORTAL-FRUIT-PRESENCE-TOAST END */

.cookie-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: var(--space-md) var(--space-lg);
  background: var(--color-bg-card);
  border-top: 1px solid var(--color-border);
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.06);
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  flex-wrap: wrap;
  z-index: 50;
}

.cookie-bar.is-visible {
  display: flex;
}

.cookie-bar p {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  max-width: 52rem;
}

.cookie-bar-actions {
  display: flex;
  gap: var(--space-sm);
  flex-shrink: 0;
}

.btn-ghost {
  font: inherit;
  font-size: 0.8125rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-input);
  border: 1px solid var(--color-border);
  background: #fff;
  cursor: pointer;
}

.btn-ghost:hover {
  background: var(--color-bg-page);
}

.settings-link {
  display: inline-block;
  text-decoration: none;
  color: inherit;
}

.btn-small-primary {
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: var(--radius-input);
  background: var(--color-primary);
  color: #fff;
  cursor: pointer;
}

.btn-small-primary:hover {
  background: var(--color-primary-hover);
}

/* Language switcher (login / auth pages) */
.lang-switcher {
  margin-top: var(--space-md);
  text-align: center;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  line-height: 1.6;
}

.lang-switcher-label {
  display: block;
  margin-bottom: var(--space-xs);
  font-weight: 500;
}

.lang-switcher-link {
  color: var(--color-link);
  text-decoration: none;
  margin: 0 0.15rem;
}

.lang-switcher-link:hover {
  text-decoration: underline;
}

.lang-switcher-link.is-active {
  font-weight: 700;
  text-decoration: underline;
}

.lang-switcher--fixed {
  position: fixed;
  top: 0.5rem;
  inset-inline-end: 0.5rem;
  margin-top: 0 !important;
  z-index: 40;
  max-width: min(100vw - 1rem, 22rem);
  text-align: center;
}

.app-header-badge {
  font-size: 0.8125rem;
  color: #d5e8ec;
}

.app-dashboard-lead {
  color: var(--color-text-muted);
  font-size: 0.9375rem;
  margin: 0;
  line-height: 1.5;
}

@media (max-width: 980px) {
  .tenant-status-strip {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }

  .portal-layout {
    grid-template-columns: 1fr;
  }

  .portal-sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    padding: var(--space-sm);
    max-height: min(42vh, 22rem);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .portal-nav-item {
    margin-bottom: 0;
    border: 1px solid var(--color-border);
    background: #fff;
  }
}

@media (max-width: 640px) {
  .app-header {
    padding: var(--space-sm);
  }

  .tenant-status-strip {
    grid-template-columns: 1fr;
    padding: var(--space-sm);
  }

  .portal-workspace {
    padding: var(--space-sm);
  }
}

.settings-layout {
  display: grid;
  gap: var(--space-md);
}

.settings-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: var(--space-lg);
}

.settings-card h2 {
  margin: 0 0 var(--space-sm);
  font-size: 1.05rem;
}

.settings-card .muted {
  margin: 0 0 var(--space-md);
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

html[lang="ar"] body {
  font-family: "Segoe UI", "Arial", "Noto Naskh Arabic", sans-serif;
}

html[lang="zh-Hans"] body {
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
}

/* ── Portal management pages ──────────────────────────────────── */

/* Ensure hidden attribute always wins */
[hidden] { display: none !important; }

.ws-section { display: block; }

.ws-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.ws-page-header h1 {
  margin: 0;
  font-size: 1.4rem;
}

.ws-subtitle {
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

.header-actions {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
}

/* Stat grid */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.stat-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.stat-label {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--color-primary);
}

/* Data table */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 2px solid var(--color-border);
  color: var(--color-text-muted);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.data-table td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #fafbfc; }

.empty-row {
  color: var(--color-text-muted);
  text-align: center;
  padding: 2rem !important;
  font-size: 0.9rem;
}

.card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-sm);
}

.card-header-row h2 { margin: 0; font-size: 1rem; }

/* Badges */
.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge-green  { background: #dcfce7; color: #166534; }
.badge-yellow { background: #fef9c3; color: #854d0e; }
.badge-orange { background: #ffedd5; color: #9a3412; }
.badge-red    { background: #fee2e2; color: #991b1b; }
.badge-gray   { background: #f3f4f6; color: #374151; }

/* Sidebar group labels (old flat style — keep for fallback) */
.sidebar-group-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  padding: 0.8rem 0.7rem 0.25rem;
  font-weight: 600;
}

/* Sidebar accordion toggle button */
.sidebar-group-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.55rem 0.7rem;
  margin-top: 0.4rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  transition: background 0.15s, color 0.15s;
}

.sidebar-group-toggle:hover {
  background: rgba(0,0,0,0.04);
  color: var(--color-text);
}

.sidebar-group-toggle.is-open .group-arrow { transform: rotate(90deg); }

.group-arrow {
  font-size: 0.6rem;
  transition: transform 0.2s;
  display: inline-block;
}

/* Group items container — hidden by default */
.sidebar-group-items {
  overflow: hidden;
}

.sidebar-group-items[hidden] { display: none !important; }
.sidebar-group-items:not([hidden]) { display: block; }

/* Quick actions on dashboard */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.quick-action-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  padding: 0.75rem 1rem;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text);
  transition: border-color 0.15s, box-shadow 0.15s;
  text-align: left;
}

.quick-action-btn:hover {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(13, 110, 110, 0.12);
}

.qa-icon { font-size: 1.1rem; }

.qa-badge {
  margin-left: auto;
  background: var(--color-primary);
  color: #fff;
  font-size: 0.75rem;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  font-weight: 700;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-overlay[hidden] { display: none; }

.modal-box {
  position: relative;
  background: var(--color-bg-card);
  border-radius: var(--radius-card);
  box-shadow: 0 8px 40px rgba(0,0,0,0.2);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow: auto;
  display: flex;
  flex-direction: column;
}

.modal-busy-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  background: rgba(255, 255, 255, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: inherit;
}

.modal-busy-overlay[hidden] { display: none; }

.modal-busy-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: var(--space-lg);
}

.modal-busy-spinner {
  width: 2rem;
  height: 2rem;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary, #0d9488);
  border-radius: 50%;
  animation: vmgate-spin 0.75s linear infinite;
}

@keyframes vmgate-spin {
  to { transform: rotate(360deg); }
}

.modal-busy-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-text-muted, #555);
}

/* Customer row: ⋮ actions menu */
.action-menu-wrap {
  position: relative;
  display: inline-block;
}

.action-menu-trigger {
  font-size: 1.1rem;
  line-height: 1;
  padding: 0.2rem 0.45rem;
  min-width: 2rem;
}

.action-menu-dropdown {
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 0.2rem;
  min-width: 11rem;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-input);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  z-index: 10;
  padding: 0.25rem 0;
  list-style: none;
  margin: 0;
}

.action-menu-dropdown[hidden] { display: none !important; }

.action-menu-dropdown li {
  list-style: none;
  margin: 0;
  padding: 0;
}

.action-menu-dropdown button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.45rem 0.85rem;
  border: none;
  background: none;
  font-size: 0.875rem;
  cursor: pointer;
  color: inherit;
}

.action-menu-dropdown button:hover:not(:disabled) {
  background: rgba(0, 0, 0, 0.06);
}

.action-menu-dropdown button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.action-menu-dropdown .action-menu-danger {
  color: #b91c1c;
  font-weight: 600;
}

.data-table .actions-cell {
  width: 3rem;
  text-align: right;
  vertical-align: middle;
}

/* >>> PORTAL-ACTIVE-CALL-END BEGIN (2026-06-06) — STOP icon on Active Calls */
.active-call-end-btn {
  color: var(--color-danger, #c0392b);
  font-size: 1.1rem;
  line-height: 1;
  padding: 0.15rem 0.35rem;
  min-width: 2rem;
}
.active-call-end-btn:hover:not(:disabled) {
  color: #991b1b;
  background: rgba(192, 57, 43, 0.08);
}
/* <<< PORTAL-ACTIVE-CALL-END END */

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--color-border);
}

.modal-body {
  padding: var(--space-lg);
  flex: 1;
  overflow: auto;
}

.modal-footer {
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--color-border);
  display: flex;
  gap: var(--space-sm);
  justify-content: flex-end;
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.modal-form label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.modal-form input, .modal-form select, .modal-form textarea {
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-input);
  font-size: 0.9rem;
  font-family: inherit;
}

/* Add Customer (and similar): checkbox left, label text beside */
.modal-checkbox-line {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 0.5rem;
  margin-top: 0.2rem;
}

.modal-checkbox-line input[type="checkbox"] {
  margin-top: 0.2rem;
  flex-shrink: 0;
}

.modal-form .modal-checkbox-label {
  display: block;
  font-weight: 400;
  line-height: 1.4;
  cursor: pointer;
  margin: 0;
}

/* FRUIT expand */
.expand-cell { width: 32px; }
.btn-expand  {
  background: none; border: none; cursor: pointer;
  color: var(--color-text-muted); font-size: 0.75rem; padding: 2px 4px;
}

.slot-row td { background: #f9fafb !important; }
.slot-indent { padding-left: 2rem !important; }
.slot-badge  {
  display: inline-block; background: #dbeafe; color: #1e40af;
  padding: 0.1rem 0.4rem; border-radius: 4px; font-size: 0.75rem; font-weight: 600;
}

/* Join code display */
.join-code-display {
  background: #f1f5f9; padding: 0.2rem 0.5rem; border-radius: 4px;
  font-size: 0.9rem; letter-spacing: 0.06em; font-weight: 600;
  margin-right: 0.4rem;
}

/* Pagination */
.pagination-row {
  display: flex; align-items: center; gap: var(--space-sm);
  padding: var(--space-sm) 0; font-size: 0.875rem;
}

/* Misc */
.text-red { color: #991b1b; }
.input-small {
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-input);
  font-size: 0.85rem;
}
.ts-cell { font-size: 0.8rem; white-space: nowrap; }
.codec-list { font-size: 0.8rem; color: var(--color-text-muted); }

/* Trunk modal: authorized IPs table */
.trunk-ip-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin-top: 0.35rem;
}
.trunk-ip-table th,
.trunk-ip-table td {
  border: 1px solid var(--color-border);
  padding: 0.35rem 0.5rem;
  vertical-align: middle;
}
.trunk-ip-table th {
  background: var(--color-bg-subtle, #f8fafc);
  font-weight: 600;
  text-align: left;
}
.trunk-ip-table .trunk-ip-codec-cells {
  white-space: nowrap;
  min-width: 13.5rem;
}
.trunk-ip-table .trunk-ip-codec-inline {
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 0.65rem;
  align-items: center;
}
.trunk-ip-table .trunk-ip-codec-label {
  font-weight: 400;
  cursor: pointer;
  margin: 0;
  white-space: nowrap;
}
.trunk-ip-table .trunk-ip-action-cell {
  width: 2.5rem;
  text-align: center;
  vertical-align: middle;
}
.trunk-ip-table .trunk-ip-remove-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem;
  border: none;
  background: transparent;
  color: var(--color-text-muted, #64748b);
  cursor: pointer;
  border-radius: var(--radius-input, 4px);
  line-height: 0;
}
.trunk-ip-table .trunk-ip-remove-btn:hover {
  color: #b91c1c;
  background: rgba(185, 28, 28, 0.08);
}
.trunk-ip-table .trunk-ip-remove-btn:focus-visible {
  outline: 2px solid var(--color-border-focus, #3b82f6);
  outline-offset: 1px;
}

/* Inline form (billing payment entry) */
.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  align-items: center;
  padding: var(--space-sm) 0;
}

/* Workspace card spacing when multiple */
.ws-section > .workspace-card + .workspace-card {
  margin-top: var(--space-md);
}

/* Support / Manual — reuse quick-action cards as external links */
a.quick-action-btn {
  text-decoration: none;
}

a.quick-action-btn .qa-detail {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--color-text-muted);
  line-height: 1.35;
  word-break: break-word;
}

.support-channel-actions,
.support-manual-actions {
  margin-bottom: 0;
}

[dir="rtl"] .auth-back a,
[dir="rtl"] .link-muted {
  display: inline-block;
}

[dir="rtl"] .cookie-bar {
  flex-direction: row-reverse;
}

[dir="rtl"] .cookie-bar-actions {
  flex-direction: row-reverse;
}

/* ── Rate plan 3-dot dropdown ─────────────────────────── */
.dropdown-wrapper {
  position: relative;
  display: inline-block;
}
.dropdown-trigger {
  font-size: 1.15rem;
  padding: 0.1rem 0.35rem;
  line-height: 1;
}
.dropdown-menu {
  position: absolute;
  right: 0;
  top: 100%;
  min-width: 11rem;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-input);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  z-index: 20;
  padding: 0.25rem 0;
}
.dropdown-menu[hidden] { display: none !important; }
.dropdown-item {
  display: block;
  width: 100%;
  padding: 0.45rem 0.85rem;
  font-size: 0.875rem;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}
.dropdown-item:hover:not(.disabled) {
  background: rgba(0,0,0,0.06);
}
.dropdown-item.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}
.dropdown-item.danger {
  color: #b91c1c;
  font-weight: 600;
}

/* ── Association dialog rows ──────────────────────────── */
.assoc-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--color-border);
}
.assoc-row:last-child { border-bottom: none; }
.assoc-add-section {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  padding-top: 0.75rem;
}
.assoc-add-section label { flex: 1; }
.assoc-add-section select { width: 100%; }

/* ── CDR filter bar ───────────────────────────────── */
.cdr-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  padding: 0.75rem 1rem;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-input);
  margin-bottom: 0.75rem;
}
.cdr-filter-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-size: 0.8rem;
}
.cdr-filter-item span { font-weight: 500; color: var(--color-text-muted); }
.cdr-filter-item input,
.cdr-filter-item select { min-width: 140px; }

/* >>> CDR-DIRECTION-FILTER BEGIN (2026-07-24) */
.cdr-filter-bar-row2 {
  margin-top: -0.35rem;
}
.cdr-dir-arrow {
  display: inline-block;
  font-weight: 700;
  margin-right: 0.35em;
  font-size: 1.05em;
  line-height: 1;
  vertical-align: -0.05em;
}
.cdr-dir-in { color: #c62828; }   /* red ← incoming */
.cdr-dir-out { color: #2e7d32; }  /* green → outgoing */
/* <<< CDR-DIRECTION-FILTER END */

/* >>> PORTAL-ACTIVE-CALLS-FIX BEGIN (2026-05-21) — active calls toolbar layout */
.active-calls-toolbar {
  align-items: flex-end;
}
.active-calls-interval-item {
  margin-left: auto;
  min-width: 7rem;
}
.active-calls-interval-item input {
  min-width: 4.5rem;
  max-width: 5rem;
}
/* <<< PORTAL-ACTIVE-CALLS-FIX END */

/* ── CDR detail dialog ────────────────────────────── */
.cdr-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.35rem 1.25rem;
  font-size: 0.85rem;
}
.cdr-field {
  display: flex;
  justify-content: space-between;
  padding: 0.15rem 0;
  border-bottom: 1px solid var(--color-border);
}
.cdr-label { color: var(--color-text-muted); font-weight: 500; }
.cdr-value { text-align: right; word-break: break-all; max-width: 60%; }
.cdr-detail-tabs {
  display: flex;
  gap: 0.25rem;
  margin-top: 0.5rem;
  border-bottom: 2px solid var(--color-border);
  padding-bottom: 0;
}
.cdr-tab-btn {
  border-radius: var(--radius-input) var(--radius-input) 0 0 !important;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  padding: 0.4rem 0.75rem;
}
.cdr-tab-btn.active {
  border-bottom-color: var(--color-primary, #0ea5e9);
  font-weight: 600;
}
.cdr-tab-content {
  padding-top: 0.5rem;
  max-height: 300px;
  overflow-y: auto;
}
.data-table-compact { font-size: 0.8rem; }
.data-table-compact th, .data-table-compact td { padding: 0.25rem 0.5rem; }

/* ── SIP ladder diagram ──────────────────────────── */
.sip-ladder { font-size: 0.8rem; }
.ladder-header {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
  padding: 0.25rem 0;
  border-bottom: 2px solid var(--color-border);
  margin-bottom: 0.25rem;
}
.ladder-col { width: 140px; text-align: center; }
.ladder-col-mid { flex: 1; }
.ladder-row {
  display: flex;
  align-items: center;
  padding: 0.15rem 0;
  border-bottom: 1px solid var(--color-border);
}
.ladder-ts {
  width: 130px;
  color: var(--color-text-muted);
  font-size: 0.75rem;
  flex-shrink: 0;
}
.ladder-arrow {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.arrow-right { justify-content: flex-start; }
.arrow-left { justify-content: flex-end; }
.arrow-line { font-size: 1.1rem; color: var(--color-primary, #0ea5e9); }
.arrow-label { font-weight: 500; }

/* ── FRUIT detail (P5-S1) ─────────────────────────────────────────── */
.fruit-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-sm);
}
.fruit-info-cell {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.fruit-info-label {
  color: var(--color-text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.fruit-info-value {
  font-size: 0.95rem;
  font-weight: 500;
}

/* >>> FRUIT-DISPLAY-LABEL BEGIN (2026-07-23) — Label edit cell matches fruit-info-cell column align. */
.fruit-display-label-cell .fruit-label-edit {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.25rem;
  width: 100%;
}
.fruit-display-label-cell .fruit-label-input {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0.2rem 0.4rem;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background: var(--color-surface, #fff);
  color: inherit;
}
.fruit-display-label-cell .fruit-label-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}
.fruit-display-label-cell .fruit-label-status:empty {
  display: none;
}
/* <<< FRUIT-DISPLAY-LABEL END */

/* ── FRUIT detail · per-FRUIT timezone row (P5-S8) ──────────────── */
.fruit-tz-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--color-border);
  flex-wrap: wrap;
}
.fruit-tz-label {
  color: var(--color-text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.fruit-tz-select {
  font-size: 0.9rem;
  padding: 0.25rem 0.4rem;
  min-width: 14rem;
}
.fruit-tz-status {
  font-size: 0.8rem;
}

.slot-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-md);
  margin-top: var(--space-md);
}

.slot-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.slot-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  border-bottom: 1px solid var(--color-border);
  padding-bottom: var(--space-xs, 0.5rem);
}
.slot-card-header h3 {
  margin: 0;
  font-size: 1.05rem;
}
.slot-card-badges {
  display: inline-flex;
  gap: 0.35rem;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.slot-card-phone {
  font-size: 0.85rem;
}

/* >>> SMS-POLICY-PANE (2026-06-30) — per-slot Voice/SMS selector + panes. The voice card body
 * lives in .policy-pane[data-pane="voice"]; the SMS pane mirrors it. Segmented-control toggle. */
.policy-toggle {
  display: inline-flex;
  align-self: flex-start;
  margin: 0.1rem 0 0.35rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-input, 8px);
  overflow: hidden;
}
.policy-toggle-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--color-text-muted, #5c5c5c);
  font: inherit;
  font-size: 0.8rem;
  line-height: 1.2;
  padding: 0.28rem 0.85rem;
  cursor: pointer;
}
.policy-toggle-btn + .policy-toggle-btn {
  border-left: 1px solid var(--color-border);
}
.policy-toggle-btn.is-active {
  background: var(--color-primary, #0d6e6e);
  color: #fff;
}
.policy-pane[hidden] {
  display: none;
}
/* <<< SMS-POLICY-PANE */

.slot-card-section {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  border-top: 1px dashed var(--color-border);
  padding-top: var(--space-xs, 0.5rem);
}
.slot-card-section:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.slot-metric {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-sm);
  font-size: 0.85rem;
}
.slot-metric-label {
  color: var(--color-text-muted);
}
.slot-metric-value {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* P5 followup (2026-05-05) — stacked cap metric.
 * Replaces the old "used / cap (range)" one-liner where the slash read
 * as "of" and made operators misread the cap as consumption. The new
 * shape is: title row, "Used" sub-row, thin progress bar (filled by
 * used/cap %), "Cap" sub-row, optional muted "drawn from min–max"
 * footer when the cap is randomly redrawn each midnight from a range.
 * No-cap case drops the progress bar and dims the cap value. */
.cap-metric {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.85rem;
  padding-bottom: 0.25rem;
}
.cap-metric:not(:last-child) {
  border-bottom: 1px dotted var(--color-border, #d8e0e3);
  margin-bottom: 0.25rem;
}
.cap-metric-title {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted, #6b7e85);
  margin-bottom: 0.15rem;
}
.cap-metric-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-sm);
}
.cap-metric-sublabel {
  color: var(--color-text-muted, #6b7e85);
}
.cap-metric-value {
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.cap-metric-value.muted {
  color: var(--color-text-muted, #6b7e85);
  font-style: italic;
}
.cap-metric-progress {
  position: relative;
  height: 6px;
  background: #e8eef0;
  border-radius: 3px;
  overflow: hidden;
  margin: 0.1rem 0;
}
.cap-metric-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #6abf7a 0%, #4aa563 100%);
  transition: width 0.25s ease-out;
  border-radius: 3px;
}
.cap-metric-progress-bar.is-over {
  background: linear-gradient(90deg, #d97557 0%, #c0392b 100%);
}
.cap-metric-range {
  font-size: 0.75rem;
  color: var(--color-text-muted, #6b7e85);
  font-style: italic;
  text-align: right;
}

.slot-card-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  border-top: 1px solid var(--color-border);
  padding-top: var(--space-xs, 0.5rem);
  margin-top: 0.25rem;
}
.slot-card-footer button {
  flex: 1 1 auto;
  min-width: 5.5rem;
}
.slot-card-footer button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* P5-S3 — inline slot-policy edit form. Lives at the bottom of every
 * slot card, hidden by default, toggled visible by the "Edit policy"
 * button. Three labelled sections (daily / monthly+package / idle)
 * each holding a row of small number inputs, then a Save/Cancel pair. */
.slot-edit-form {
  margin-top: 0.5rem;
  padding-top: var(--space-sm, 0.75rem);
  border-top: 1px dashed var(--color-border);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm, 0.75rem);
}
.slot-edit-form[hidden] {
  display: none;
}
.slot-edit-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
}
.slot-edit-section {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.slot-edit-section-title {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted, #666);
}
.slot-edit-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
  gap: 0.5rem;
}
.slot-edit-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.85rem;
}
.slot-edit-label {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  color: var(--color-text-muted, #666);
}
.slot-edit-field input[type="number"] {
  width: 100%;
  padding: 0.35rem 0.5rem;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm, 4px);
  background: var(--color-surface, #fff);
}
.slot-edit-field input[type="number"]:invalid {
  border-color: var(--color-danger, #c0392b);
}
.slot-edit-actions {
  display: flex;
  gap: 0.4rem;
  justify-content: flex-end;
}
.slot-edit-actions button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* P5-S5b — bulk-selection toolbar above the FRUIT Devices table.
 * The master checkbox sits flush with the left edge so it visually
 * aligns with the per-row checkboxes in column 1 of the table below.
 * The scope select sits to its right, the counter is muted in the
 * middle, and the action button is right-aligned via the spacer. */
.bulk-toolbar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--color-border);
  background: #fafbfc;
}
.bulk-toolbar-master {
  display: inline-flex;
  align-items: center;
  /* col-1 select-cell uses 0.75rem horizontal padding (inherited from
   * .data-table td); align the master checkbox to the same offset so
   * it stacks visually above the per-row boxes. */
  padding-left: 0;
  margin: 0;
}
.bulk-toolbar-master input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  cursor: pointer;
}
.bulk-toolbar-master input[type="checkbox"]:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}
.bulk-toolbar-scope {
  font-size: 0.85rem;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm, 4px);
  background: #fff;
  color: var(--color-text, #113741);
}
.bulk-toolbar-counter {
  font-size: 0.85rem;
  color: var(--color-text-muted, #4a6770);
  font-variant-numeric: tabular-nums;
}
.bulk-toolbar-spacer {
  flex: 1 1 auto;
}
.bulk-toolbar button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Per-row select column. The header cell is .select-cell; the body
 * cells follow the same class. We give it a small fixed width so the
 * checkbox is centered and doesn't push the device name around. */
.data-table th.select-cell,
.data-table td.select-cell {
  width: 2rem;
  padding-left: 0.75rem;
  padding-right: 0.25rem;
  text-align: left;
}
.fruit-row-checkbox {
  width: 1rem;
  height: 1rem;
  cursor: pointer;
  margin: 0;
  vertical-align: middle;
}

/* P5-S5c — bulk-edit dialog. Reuses the shared modal as its shell and
 * the .slot-edit-* layout classes for inputs. Two visual tweaks vs the
 * inline P5-S3 form:
 *   1. The modal already provides framing (header / body / footer)
 *      so the dashed top-border is redundant inside the dialog.
 *   2. Inputs whose value is heterogeneous across the selection get
 *      a "mixed" placeholder rendered italic + dimmed, telegraphing
 *      "this is a hint, not a value — leave alone to preserve". */
.bulk-edit-form {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}
.bulk-edit-subtitle {
  margin: 0 0 0.25rem 0;
  font-size: 0.9rem;
}
.slot-edit-field.is-mixed input[type="number"]::placeholder {
  color: var(--color-text-muted, #6b7e85);
  font-style: italic;
  opacity: 0.85;
}
.slot-edit-field.is-mixed input[type="number"][data-dirty="0"] {
  background: #fbfbfb;
}

/* P5-S6 — Network defaults page reuses the P5-S3 .slot-edit-form for
 * authoring the per-(network, slot) policy template, but here the
 * form is the FIRST and only child of the slot-card (there is no
 * detail header / stats / footer above it like there is on the FRUIT
 * detail page). The dashed top-border + 0.5rem margin-top from the
 * inline form would float visually above the card edge and look
 * orphaned, so we kill them inside #ws-network-defaults only. */
#ws-network-defaults .slot-card {
  padding: var(--space-md, 1rem);
}
#ws-network-defaults .slot-edit-form {
  margin-top: var(--space-sm, 0.75rem);
  padding-top: 0;
  border-top: none;
}

.slot-edit-hint {
  margin: 0 0 var(--space-sm, 0.5rem) 0;
}

.client-qr-host {
  margin: var(--space-md, 1rem) 0;
  min-height: 2rem;
  display: flex;
  justify-content: center;
  align-items: center;
}

.client-qr-fold {
  margin-top: var(--space-md, 1rem);
}

.client-qr-url-wrap {
  word-break: break-all;
  margin: var(--space-sm, 0.5rem) 0;
}

.client-qr-url {
  font-size: 0.85rem;
}

/* ── Portal optional 2FA (TOTP) ───────────────────────────────── */
.auth-subtitle {
  margin: 0 0 var(--space-sm);
  font-size: 1.05rem;
}

.link-button {
  background: none;
  border: none;
  padding: 0;
  color: var(--color-accent, #3b82f6);
  cursor: pointer;
  font: inherit;
  text-decoration: underline;
}

.mfa-status-line {
  margin: 0 0 var(--space-md);
  font-size: 0.95rem;
}

.mfa-setup-panel,
.mfa-backup-panel,
.mfa-disable-panel {
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--color-border);
}

.mfa-qr-wrap {
  display: flex;
  justify-content: center;
  margin: var(--space-md) 0;
  padding: var(--space-sm);
  background: #fff;
  border-radius: var(--radius-card);
  max-width: 220px;
}

.mfa-manual-key code {
  word-break: break-all;
  font-size: 0.85rem;
}

.mfa-backup-list {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-md);
  font-family: ui-monospace, monospace;
  font-size: 0.95rem;
}

.mfa-backup-list li {
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--color-border);
}

/* >>> SMS-CONTENT-REWRITE-UI-HELP BEGIN (2026-07-16) — content rewrite modal layout + i-help */
.sms-cr-block {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin: 0.85rem 0;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-input, 6px);
  background: #fafbfc;
}
.sms-cr-legend {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0;
}
.sms-cr-intro { margin: 0; }
.sms-cr-field {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.3rem;
  width: 100%;
}
.sms-cr-label,
.sms-cr-label-row .sms-cr-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin: 0;
}
.sms-cr-label-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.sms-cr-input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-input, 6px);
  font-size: 0.9rem;
  font-family: inherit;
  resize: vertical;
}
.sms-cr-actions {
  display: flex;
  justify-content: flex-start;
  gap: 0.5rem;
}
.sms-cr-radios {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
}
.sms-cr-radios .modal-radio {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.45rem;
  font-weight: 400;
  font-size: 0.875rem;
  margin: 0;
  cursor: pointer;
}
.sms-cr-radios .modal-radio input {
  margin: 0;
  flex-shrink: 0;
}
.sms-cr-sample-out {
  white-space: pre-wrap;
  margin: 0;
  min-height: 1.2em;
  padding: 0.4rem 0.5rem;
  background: #fff;
  border: 1px dashed var(--color-border);
  border-radius: 4px;
}
.btn-help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: #fff;
  color: var(--color-primary, #0f766e);
  font-size: 0.75rem;
  font-weight: 700;
  font-style: italic;
  font-family: Georgia, "Times New Roman", serif;
  cursor: pointer;
  line-height: 1;
  flex-shrink: 0;
}
.btn-help:hover {
  background: #ecfdf5;
  border-color: var(--color-primary, #0f766e);
}
.sms-cr-help-panel {
  margin: 0.15rem 0 0.35rem;
  padding: 0.65rem 0.75rem;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  max-height: 22rem;
  overflow: auto;
}
.sms-cr-help-body {
  margin: 0;
  white-space: pre-wrap;
  font-size: 0.8rem;
  line-height: 1.45;
  font-weight: 400;
  color: var(--color-text, #1e293b);
}
.sms-cr-adv-toggle {
  margin-top: 0.65rem;
  align-self: flex-start;
  text-align: left;
  white-space: normal;
  max-width: 100%;
}
.sms-cr-help-advanced {
  margin-top: 0.55rem;
  padding-top: 0.55rem;
  border-top: 1px dashed var(--color-border);
}
/* >>> SMS-CONTENT-REWRITE-DRAFT-UX BEGIN (2026-07-16) — drag grip + label column */
.sms-cr-table .sms-cr-grip-h,
.sms-cr-table .sms-cr-grip {
  width: 1.6rem;
  text-align: center;
  cursor: grab;
  color: var(--color-text-muted, #64748b);
  user-select: none;
}
.sms-cr-table tr.sms-cr-dragging {
  opacity: 0.55;
  background: #ecfdf5;
}
.sms-cr-label-cell {
  max-width: 8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* <<< SMS-CONTENT-REWRITE-DRAFT-UX END */
.sms-cr-rule-form .modal-checkbox-line {
  margin-top: 0.15rem;
}
.modal-form label.checkbox-row,
.sms-cr-rule-form .checkbox-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  font-weight: 400;
}
.modal-form label.checkbox-row input[type="checkbox"],
.sms-cr-rule-form .checkbox-row input[type="checkbox"] {
  margin: 0;
  flex-shrink: 0;
}
/* <<< SMS-CONTENT-REWRITE-UI-HELP END */

/* >>> INBOUND-GSM-IVR-UX BEGIN (2026-07-24) — step icon actions + upload progress bar */
.ig-step-actions {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.2rem;
  white-space: nowrap;
}
.ig-step-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  min-height: 2rem;
  padding: 0.2rem 0.35rem;
  cursor: pointer;
  margin: 0;
  font-size: 1rem;
  line-height: 1;
}
.ig-step-icon-btn input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
}
.ig-upload-progress {
  margin-top: 0.35rem;
  height: 4px;
  background: var(--color-border, #e5e7eb);
  border-radius: 2px;
  overflow: hidden;
}
.ig-upload-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--color-primary, #0f766e);
  transition: width 0.1s linear;
}
#ig-ivr-steps-table {
  min-width: 0;
}
#ig-ivr-steps-table .actions-cell {
  width: 1%;
  white-space: nowrap;
}
/* <<< INBOUND-GSM-IVR-UX END */

/* >>> INBOUND-GSM-IVR-DIGIT-GRAPH-REVIEW BEGIN (2026-07-26) — File col: name + equal icons row */
.ig-da-file-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  max-width: 12rem;
}
.ig-da-file-wrap .muted {
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
/* modal-form label { flex-direction: column } stretches upload — force icon size */
.modal-form .ig-da-file-wrap label.ig-da-upload-label,
.modal-form .ig-da-file-wrap label.ig-step-icon-btn {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  width: 2rem;
  min-width: 2rem;
  max-width: 2rem;
  height: 2rem;
  min-height: 2rem;
  padding: 0.2rem 0.35rem;
  box-sizing: border-box;
}
.modal-form .ig-da-file-wrap .ig-step-icon-btn {
  width: 2rem;
  min-width: 2rem;
  height: 2rem;
  min-height: 2rem;
  box-sizing: border-box;
}
/* Status left, Close/Save right — always visible while table scrolls */
.modal-footer:has(.ig-da-footer-msg) {
  justify-content: space-between;
  align-items: center;
  gap: var(--space-md);
}
.ig-da-footer-msg {
  flex: 1;
  margin: 0;
  text-align: left;
  min-width: 0;
}
.ig-da-footer-btns {
  display: flex;
  gap: var(--space-sm);
  flex-shrink: 0;
}
/* <<< INBOUND-GSM-IVR-DIGIT-GRAPH-REVIEW END */

/* >>> INBOUND-GSM-IVR-PREVIEW-GRAPH BEGIN (2026-07-26) */
.modal-body:has(.ig-prev-layout) {
  max-height: min(80vh, 720px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.ig-prev-layout {
  display: flex;
  flex-direction: row;
  gap: 1rem;
  min-height: 420px;
  height: 100%;
  flex: 1;
  min-width: 0;
}
.ig-prev-graph-scroll {
  flex: 1;
  min-width: 0;
  overflow: auto;
  border: 1px solid var(--color-border, #e5e7eb);
  border-radius: 6px;
  background: var(--color-bg-subtle, #f9fafb);
  /* 4-way scroll for large tenant graphs */
}
.ig-prev-canvas {
  position: relative;
  min-width: 100%;
  min-height: 100%;
}
.ig-prev-edges {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
  color: #64748b;
}
.ig-prev-edge-label {
  font-size: 10px;
  fill: #64748b;
}
.ig-prev-ivr-label {
  position: absolute;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text, #111);
  max-width: 168px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ig-prev-node {
  position: absolute;
  box-sizing: border-box;
  padding: 0.35rem 0.45rem;
  border: 1px solid var(--color-border, #cbd5e1);
  border-radius: 6px;
  background: #fff;
  font-size: 11px;
  z-index: 1;
}
.ig-prev-node-active {
  border-color: var(--color-primary, #0f766e);
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.25);
  z-index: 2;
}
.ig-prev-node-title {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ig-prev-node-meta {
  color: #64748b;
  font-size: 10px;
}
.ig-prev-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  margin-top: 2px;
}
.ig-prev-chip {
  font-size: 9px;
  background: #e2e8f0;
  border-radius: 3px;
  padding: 0 3px;
}
.ig-prev-phone {
  width: 168px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.ig-prev-phone-ctrl {
  display: flex;
  gap: 0.35rem;
  justify-content: center;
}
.ig-prev-pad {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.ig-prev-pad-row {
  display: flex;
  gap: 0.35rem;
  justify-content: center;
}
.ig-prev-pad .ig-prev-key {
  width: 2.75rem;
  height: 2.75rem;
  font-size: 1.1rem;
  font-weight: 600;
}
.ig-prev-status {
  font-size: 12px;
  margin: 0;
  min-height: 2.5em;
}
.modal:has(.ig-prev-layout) .modal-dialog,
.modal:has(.ig-prev-layout) .modal-content {
  width: min(960px, 96vw);
  max-width: 96vw;
}
/* <<< INBOUND-GSM-IVR-PREVIEW-GRAPH END */

/* >>> INBOUND-GSM-IVR-FORWARD-CALLED BEGIN (2026-07-26) */
.ig-da-dp-cell {
  min-width: 9rem;
  vertical-align: top;
}
.ig-da-dp-cell .ig-da-dp {
  width: 100%;
  box-sizing: border-box;
}
/* Superseded: inline called under DP
.ig-da-called-lab {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-top: 0.4rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text, #111);
}
.ig-da-called-lab[hidden] {
  display: none !important;
}
.ig-da-called {
  width: 100%;
  min-width: 7rem;
  box-sizing: border-box;
  font-weight: 400;
}
*/
/* <<< INBOUND-GSM-IVR-FORWARD-CALLED END */

/* >>> INBOUND-GSM-IVR-FORWARD-RING BEGIN (2026-07-26) */
.ig-da-modal-wrap {
  position: relative;
}
.ig-da-dp-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.ig-da-dp-row .ig-da-dp {
  flex: 1 1 auto;
  min-width: 0;
}
.ig-da-dp-row .ig-da-fwd-cog:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
/* Superseded: absolute inset on .ig-da-modal-wrap (card sat bottom-left when body scrolled)
.ig-fwd-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.45);
  padding: 1rem;
}
*/
.ig-fwd-overlay {
  position: fixed;
  inset: 0;
  z-index: 220;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.45);
  padding: 1rem;
}
.ig-fwd-overlay[hidden] {
  display: none !important;
}
.ig-fwd-overlay-card {
  width: min(420px, 100%);
  max-height: min(80vh, 560px);
  overflow: auto;
  background: var(--color-surface, #fff);
  border: 1px solid var(--color-border, #d0d5dd);
  border-radius: 8px;
  padding: 1rem 1.1rem;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.2);
}
.ig-fwd-overlay-card h4 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
}
.ig-fwd-overlay-card label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 0.65rem;
  font-size: 0.8rem;
  font-weight: 600;
}
.ig-fwd-overlay-card input[type="text"],
.ig-fwd-overlay-card input[type="number"] {
  font-weight: 400;
  width: 100%;
  box-sizing: border-box;
}
.ig-fwd-ov-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}
.ig-fwd-ov-btns {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.75rem;
}
.ig-fwd-overlay-card .small {
  font-size: 0.75rem;
  margin: 0 0 0.65rem;
}
/* <<< INBOUND-GSM-IVR-FORWARD-RING END */
