/* Shared management and status styling for WireGuard and AnyConnect. */
.speedbox-infrastructure #pageTitle,.infrastructure-modal:is(.wireguard-modal,.anyconnect-modal,.openvpn-modal,.ipsec-modal,.outline-modal,.smartdns-modal) #modalTitle{direction:rtl;unicode-bidi:isolate}
.speedbox-infrastructure :is([data-wg-new],[data-ac-new]){direction:rtl;unicode-bidi:isolate}
.speedbox-infrastructure .wg-table .entity-loading-cell{direction:rtl;unicode-bidi:isolate}
.speedbox-infrastructure :is([data-wg-row],[data-ac-row]) .actions{direction:rtl}

.speedbox-infrastructure .wg-table .actions{flex-wrap:nowrap;white-space:nowrap}.speedbox-infrastructure .wg-table small{display:block;margin-top:.4em;color:var(--muted)}.speedbox-infrastructure .wg-table bdi{display:inline-block;white-space:nowrap}.speedbox-infrastructure .wg-error{max-width:24em;margin:.5em 0 0;color:#ff9292;unicode-bidi:plaintext;white-space:normal;overflow-wrap:anywhere}
.account-connection-body > [role="alert"]{unicode-bidi:plaintext}
.create-modal .final-qr:has(>.account-connection-card),.create-modal .final-qr:has(>.account-connection-card)+.final-link{box-sizing:border-box;width:min(100%,calc(320 * var(--speedbox-ui-unit,1px)));min-width:0;justify-self:center}
.speedbox-infrastructure .plan-name-service{display:flex;align-items:center;justify-content:center;flex-wrap:wrap;gap:.6em}.speedbox-infrastructure .plan-service-badge{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;height:calc(20 * var(--speedbox-ui-unit,1px));min-height:0;margin:0;padding:0 calc(7 * var(--speedbox-ui-unit,1px));border:1px solid;border-radius:calc(5 * var(--speedbox-ui-unit,1px));font-family:Arial,sans-serif;font-size:calc(10 * var(--speedbox-ui-unit,1px))!important;font-weight:500;line-height:1;vertical-align:middle;flex:0 0 auto;white-space:nowrap}
:root:root body .speedbox-infrastructure-overlay .infrastructure-modal:is(.wireguard-modal,.anyconnect-modal,.openvpn-modal,.ipsec-modal,.outline-modal,.smartdns-modal){width:min(calc(576 * var(--speedbox-ui-unit,1px)),94vw);max-width:calc(576 * var(--speedbox-ui-unit,1px));min-width:0;padding:calc(18 * var(--speedbox-ui-unit,1px))}
:root:root body .speedbox-infrastructure-overlay .infrastructure-modal:is(.wireguard-modal,.anyconnect-modal,.openvpn-modal,.ipsec-modal,.outline-modal,.smartdns-modal) .form-grid{display:grid;grid-template-columns:minmax(0,1fr);gap:calc(20 * var(--speedbox-ui-unit,1px))}
:root:root body .speedbox-infrastructure-overlay .infrastructure-modal:is(.wireguard-modal,.anyconnect-modal,.openvpn-modal,.ipsec-modal,.outline-modal,.smartdns-modal) .field{display:grid;grid-template-columns:minmax(0,1fr);gap:calc(9 * var(--speedbox-ui-unit,1px));min-width:0;text-align:right}
:root:root body .speedbox-infrastructure-overlay .infrastructure-modal:is(.wireguard-modal,.anyconnect-modal,.openvpn-modal,.ipsec-modal,.outline-modal,.smartdns-modal) .field>label{font-size:calc(12 * var(--speedbox-ui-unit,1px))!important;padding:0;line-height:1.5;text-align:right}
:root:root body .speedbox-infrastructure-overlay .infrastructure-modal:is(.wireguard-modal,.anyconnect-modal,.openvpn-modal,.ipsec-modal,.outline-modal,.smartdns-modal) .wg-field-row{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:calc(16 * var(--speedbox-ui-unit,1px));align-items:start;min-width:0}
:root:root body .speedbox-infrastructure-overlay .infrastructure-modal:is(.wireguard-modal,.anyconnect-modal,.openvpn-modal,.ipsec-modal,.outline-modal,.smartdns-modal) .field :is(input,select){box-sizing:border-box;width:100%;min-width:0;height:calc(38 * var(--speedbox-ui-unit,1px));padding:calc(8 * var(--speedbox-ui-unit,1px)) calc(12 * var(--speedbox-ui-unit,1px));font-size:calc(11 * var(--speedbox-ui-unit,1px))!important;border-radius:calc(10 * var(--speedbox-ui-unit,1px))}
:root:root body .speedbox-infrastructure-overlay .infrastructure-modal:is(.wireguard-modal,.anyconnect-modal,.openvpn-modal,.ipsec-modal,.outline-modal,.smartdns-modal) .wg-advanced{border-top:1px dashed #ffffff30;padding-top:calc(16 * var(--speedbox-ui-unit,1px))}
:root:root body .speedbox-infrastructure-overlay .infrastructure-modal:is(.wireguard-modal,.anyconnect-modal,.openvpn-modal,.ipsec-modal,.outline-modal,.smartdns-modal) .wg-advanced summary{cursor:pointer;font-size:calc(12 * var(--speedbox-ui-unit,1px));font-weight:600;padding-block:calc(8 * var(--speedbox-ui-unit,1px))}
:root:root body .speedbox-infrastructure-overlay .infrastructure-modal:is(.wireguard-modal,.anyconnect-modal,.openvpn-modal,.ipsec-modal,.outline-modal,.smartdns-modal) .wg-advanced[open]>.wg-field-row{margin-top:calc(16 * var(--speedbox-ui-unit,1px))}
:root:root body .speedbox-infrastructure-overlay .infrastructure-modal:is(.wireguard-modal,.anyconnect-modal,.openvpn-modal,.ipsec-modal,.outline-modal,.smartdns-modal) .form-actions>.button{min-height:calc(38 * var(--speedbox-ui-unit,1px));padding:calc(8 * var(--speedbox-ui-unit,1px)) calc(20 * var(--speedbox-ui-unit,1px));font-size:calc(12 * var(--speedbox-ui-unit,1px))!important;border-radius:calc(10 * var(--speedbox-ui-unit,1px))}
:root:root body .speedbox-infrastructure-overlay .infrastructure-modal.plan-modal .form-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
:root:root body .speedbox-infrastructure-overlay .infrastructure-modal.plan-modal .plan-service-field{grid-column:1/-1}
:root:root body .speedbox-infrastructure-overlay .infrastructure-modal:is(.wireguard-modal,.anyconnect-modal,.openvpn-modal,.ipsec-modal,.outline-modal,.smartdns-modal) [hidden],:root:root body .speedbox-infrastructure-overlay .infrastructure-modal.plan-modal .field[hidden]{display:none!important}
@media(max-width:600px){:root:root body .speedbox-infrastructure-overlay .infrastructure-modal.plan-modal .form-grid,:root:root body .speedbox-infrastructure-overlay .infrastructure-modal:is(.wireguard-modal,.anyconnect-modal,.openvpn-modal,.ipsec-modal,.outline-modal,.smartdns-modal) .wg-field-row{grid-template-columns:minmax(0,1fr)}}

/* Match the tariff header badges and the panel's shared dropdown on all displays. */
:root:root body .settings-final .tariff-group-card .tariff-service-select{--sb-service-shadow:none;position:relative;flex:0 0 auto;width:calc(112 * var(--speedbox-ui-unit,1px));min-width:0;height:calc(34 * var(--speedbox-ui-unit,1px));box-sizing:border-box}
:root:root body .settings-final .tariff-group-card .tariff-service-select .invoice-custom-select__trigger{height:100%;min-height:0;max-height:none;border:1px solid var(--sb-service-border);border-radius:calc(8 * var(--speedbox-ui-unit,1px));padding:0 calc(10 * var(--speedbox-ui-unit,1px));color:var(--sb-service-ink);background:var(--sb-service-trigger,linear-gradient(180deg,#234154cc,#1b2d3dcc));box-shadow:var(--sb-service-shadow);font-size:calc(12.48 * var(--speedbox-ui-unit,1px))!important;font-weight:400;line-height:1;gap:calc(6 * var(--speedbox-ui-unit,1px));margin:0}
:root:root body .settings-final .tariff-group-card .tariff-service-select .invoice-custom-select__trigger>span{display:flex;align-items:center;justify-content:center;align-self:stretch;min-width:0;font-family:Arial,sans-serif;line-height:1;direction:ltr}
:root:root body .settings-final .tariff-group-card .tariff-service-select.is-open .invoice-custom-select__trigger{border-radius:calc(8 * var(--speedbox-ui-unit,1px)) calc(8 * var(--speedbox-ui-unit,1px)) 0 0;border-bottom-color:transparent}
:root:root body .settings-final .tariff-group-card .tariff-service-select .invoice-custom-select__menu{border:1px solid var(--sb-service-border);border-top:0;border-radius:0 0 calc(8 * var(--speedbox-ui-unit,1px)) calc(8 * var(--speedbox-ui-unit,1px));box-shadow:var(--sb-service-shadow)}
:root:root body .settings-final .tariff-group-card .tariff-service-select .invoice-custom-select__option{font-family:Arial,sans-serif;font-size:calc(12.48 * var(--speedbox-ui-unit,1px))!important;text-align:center;direction:ltr}
:root:root body .settings-final .tariff-group-card .tariff-service-select>.speedbox-native-select{height:100%!important}
:root:root body .tariff-plan-select .tariff-plan-label{display:flex;align-items:center;justify-content:center;gap:.35em;min-width:0;max-width:100%;direction:ltr;unicode-bidi:isolate}
:root:root body .tariff-plan-select .tariff-plan-label>bdi{unicode-bidi:isolate;line-height:inherit}
:root:root body .tariff-plan-select .tariff-plan-label>.tariff-plan-title{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
:root:root body .tariff-plan-select .tariff-plan-label>:is(.tariff-plan-protocol,.tariff-plan-separator,.tariff-plan-traffic){flex-shrink:0}
/* Keep the original mobile header/actions; only the new service occupies its own row. */
@media(max-width:900px){
 :root:root body .settings-final .tariff-group-card:not(.tariff-sort-mode) .tariff-secondary-controls{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));align-items:stretch;width:100%;min-width:0;gap:8px}
 :root:root body .settings-final .tariff-group-card .tariff-secondary-controls>.tariff-service-select{grid-column:1/-1;grid-row:1;flex:none;width:100%;min-width:0;max-width:100%}
 :root:root body .settings-final .tariff-group-card .tariff-secondary-controls>.partner-access-badge1{grid-column:1;grid-row:2;width:100%;min-width:0}
 :root:root body .settings-final .tariff-group-card .tariff-secondary-controls>.tariff-connection-field{grid-column:2;grid-row:2;flex:none;width:100%;min-width:0;max-width:none}
}

/* Keep the OpenVPN profile card within the result grid. */
:root:root body .create-modal .final-result>.final-qr:has(>.openvpn-profiles){
  box-sizing:border-box;width:100%;min-width:0;max-width:100%;justify-self:stretch
}
/* Keep dense configuration QR codes independent of the URL QR sizing rules. */
:root:root body .create-modal .final-qr .wireguard-profiles img.wg-profile-qr{
  display:block;width:min(100%,calc(280 * var(--speedbox-ui-unit,1px)));max-width:100%;height:auto;
  margin:0 auto;padding:0;box-sizing:border-box;object-fit:contain;background:#fff;
}
/* Match the existing plan/status pills while keeping Latin text vertically centered. */
:root:root body .account-service-badge{display:inline-flex;align-items:center;justify-content:center;
  box-sizing:border-box;vertical-align:middle;height:calc(24 * var(--speedbox-ui-unit,1px));min-height:calc(24 * var(--speedbox-ui-unit,1px));
  padding:0 calc(10 * var(--speedbox-ui-unit,1px));
  border:1px solid #6d6d6d;border-radius:999px;
  backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px);
  font-family:Arial,system-ui,sans-serif;font-size:calc(10 * var(--speedbox-ui-unit,1px));font-weight:700;line-height:1;white-space:nowrap}
:root:root body :is(.account-service-badge,.account-service-plan-badge){
  border-color:#6d6d6d;background:rgba(13,13,13,.12);color:#fff;
  box-shadow:0 0 calc(10 * var(--speedbox-ui-unit,1px)) calc(1 * var(--speedbox-ui-unit,1px))
    var(--sb-service-glow,rgba(0,132,255,.6))}
:root:root body .expiry-badge.reservation-expiry-badge{border:1px solid #6d6d6d}
:root:root body .account-service-badge .account-service-label{display:block;flex:none;font:inherit;line-height:1;transform:translateY(.05em)}
:root:root body table.users-table.reservation-users-table :is(th.account-service-col,td.account-service-cell){
  width:1%;min-width:0;max-width:none;padding-inline:calc(8 * var(--speedbox-ui-unit,1px));text-align:center;white-space:nowrap}
/* The service column shifted expiry, traffic and actions one position to the left. */
 :root:root body #app .center-box table.users-table.reservation-users-table:is(.admin-user-list-table,.speedbox-partner-accounts-table) :is(th.expiry-date-col,td.expiry-date-cell){
  width:1%;min-width:calc(170 * var(--speedbox-ui-unit,1px));max-width:none;padding-inline:calc(12 * var(--speedbox-ui-unit,1px));white-space:nowrap}
:root:root body #app .center-box table.users-table.reservation-users-table td.expiry-date-cell .expiry-badge{
  display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;width:max-content;max-width:none;margin-inline:auto;white-space:nowrap}
:root:root body table.users-table.reservation-users-table:is(.admin-user-list-table,.speedbox-partner-accounts-table) :is(th,td):nth-child(8){
  width:calc(200 * var(--speedbox-ui-unit,1px));min-width:calc(180 * var(--speedbox-ui-unit,1px));padding-inline:calc(12 * var(--speedbox-ui-unit,1px))}
:root:root body table.users-table.reservation-users-table:is(.admin-user-list-table,.speedbox-partner-accounts-table) :is(th,td):nth-child(9){
  width:calc(105 * var(--speedbox-ui-unit,1px));min-width:calc(100 * var(--speedbox-ui-unit,1px));padding-inline:calc(8 * var(--speedbox-ui-unit,1px))}
:root:root body table.users-table.reservation-users-table:is(.admin-user-list-table,.speedbox-partner-accounts-table) :is(th,td):nth-child(10){
  width:calc(140 * var(--speedbox-ui-unit,1px));min-width:calc(132 * var(--speedbox-ui-unit,1px));padding-inline:calc(8 * var(--speedbox-ui-unit,1px))}
:root:root body .create-modal .final-qr .vpn-profiles .wg-profile-actions{
  width:min(100%,calc(280 * var(--speedbox-ui-unit,1px)));max-width:100%;margin-inline:auto}
:root:root body .create-modal .final-qr .vpn-profiles .wg-profile-actions button{
  width:100%;display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box}

/* Use the same QR/download rhythm and button treatment as the public subscription card. */
:root:root body .create-modal .final-qr .vpn-profiles .wg-profile-config{
  display:grid;gap:calc(14 * var(--speedbox-ui-unit,1px));width:min(100%,calc(280 * var(--speedbox-ui-unit,1px)));min-width:0;margin-inline:auto}
:root:root body .create-modal .final-qr .wireguard-profiles .wg-profile-config img.wg-profile-qr{
  box-sizing:border-box;width:100%;max-width:100%;height:auto;padding:0;margin:0}
:root:root body .create-modal .final-qr .vpn-profiles .wg-profile-config .wg-profile-actions{width:100%;margin:0}
:root:root body .create-modal .final-qr .vpn-profiles .wg-profile-config .wg-profile-actions button{
  width:100%;min-height:calc(44 * var(--speedbox-ui-unit,1px));padding:calc(10 * var(--speedbox-ui-unit,1px)) calc(14 * var(--speedbox-ui-unit,1px));
  border:1px solid rgba(0,180,255,.35);border-radius:calc(10 * var(--speedbox-ui-unit,1px));
  background:linear-gradient(180deg,rgba(0,128,255,.43),rgba(0,100,210,.22));
  box-shadow:inset 0 1px 0 rgba(255,255,255,.11),0 calc(5 * var(--speedbox-ui-unit,1px)) calc(14 * var(--speedbox-ui-unit,1px)) rgba(0,0,0,.2);
  font-size:calc(12 * var(--speedbox-ui-unit,1px));font-weight:750;line-height:1.3}

.speedbox-infrastructure-overlay .anyconnect-modal :is(.ac-certificate-form,.ac-certificate-settings){display:grid;grid-template-columns:minmax(0,1fr);gap:calc(12 * var(--speedbox-ui-unit,1px));min-width:0}
.speedbox-infrastructure-overlay .anyconnect-modal .ac-certificate-form{padding-top:calc(12 * var(--speedbox-ui-unit,1px))}
.speedbox-infrastructure-overlay .anyconnect-modal .ac-certificate-settings [data-ac-dns]{display:contents}
.speedbox-infrastructure-overlay .anyconnect-modal .ac-certificate-settings textarea{box-sizing:border-box;width:100%;min-width:0;resize:vertical}

:is(.plan-service-badge.v2ray, [data-service="v2ray"]) {
  --sb-service-ink: #9edcff;
  --sb-service-fill: #329ce51a;
  --sb-service-border: #58b6ef66;
  --sb-service-glow: rgba(0,132,255,.6);
  --sb-service-trigger: linear-gradient(180deg, #234154cc, #1b2d3dcc);
}
:is(.plan-service-badge.wireguard, [data-service="wireguard"]) {
  --sb-service-ink: #e5baff;
  --sb-service-fill: #ad4ce81a;
  --sb-service-border: #bb78ef66;
  --sb-service-glow: rgba(170,83,237,.6);
  --sb-service-trigger: linear-gradient(180deg, #463153cc, #30223dcc);
}
:is(.plan-service-badge.anyconnect, [data-service="anyconnect"]) {
  --sb-service-ink: #ffdb92;
  --sb-service-fill: #e6a83f20;
  --sb-service-border: #e6a83f77;
  --sb-service-glow: rgba(241,174,64,.6);
  --sb-service-trigger: linear-gradient(180deg, #55452bcc, #392b1bcc);
}
:root:root body :is(.plan-service-badge, .userbot-service-badge[data-service]) {
  color: var(--sb-service-ink);
  background: var(--sb-service-fill);
  border-color: var(--sb-service-border);
}

:is(.plan-service-badge.openvpn, [data-service="openvpn"]) {
  --sb-service-ink: #9ceade;
  --sb-service-fill: #2dab9820;
  --sb-service-border: #56bcac77;
  --sb-service-glow: rgba(36,197,169,.6);
  --sb-service-trigger: linear-gradient(180deg, #235348cc, #163d35cc);
}
/* Shared service palette for plan lists, account badges and tariff settings. */
:is(.plan-service-badge.ikev2, .plan-service-badge.l2tp, [data-service="ikev2"], [data-service="l2tp"]) {
  --sb-service-ink: #c6cbff;
  --sb-service-fill: #6979f325;
  --sb-service-border: #8c97f477;
  --sb-service-glow: rgba(108,124,250,.72);
  --sb-service-trigger: linear-gradient(180deg,#363b62,#242743);
}
:is(.plan-service-badge.outline, [data-service="outline"]) {
  --sb-service-ink: #ffb6d5;
  --sb-service-fill: #e65b9925;
  --sb-service-border: #ed7cad77;
  --sb-service-glow: rgba(244,95,155,.7);
  --sb-service-trigger: linear-gradient(180deg,#5d2e46,#402339);
}
:is(.plan-service-badge.smartdns, [data-service="smartdns"]) {
  --sb-service-ink: #c5ed9e;
  --sb-service-fill: #79ae4925;
  --sb-service-border: #9bc96b77;
  --sb-service-glow: rgba(151,210,78,.7);
  --sb-service-trigger: linear-gradient(180deg,#3e522b,#2c3923);
}
.speedbox-infrastructure-overlay .openvpn-modal .ovpn-destinations,
.speedbox-infrastructure-overlay .openvpn-modal [data-ovpn-destinations]{display:grid;gap:12px;min-width:0}
.speedbox-infrastructure-overlay .openvpn-modal .ovpn-destination{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:end;gap:12px;border:1px solid #94b2c142;border-radius:10px;padding:12px}
.speedbox-infrastructure-overlay .openvpn-modal .ovpn-destination label{display:grid;gap:7px;min-width:0}
.speedbox-infrastructure-overlay .openvpn-modal .ovpn-destination [data-ovpn-remove]{justify-self:end}
@media(max-width:490px){.speedbox-infrastructure-overlay .openvpn-modal .ovpn-destination{grid-template-columns:minmax(0,1fr)}}

:root:root body .speedbox-infrastructure-overlay .openvpn-modal .ovpn-destination [data-ovpn-remove]{
  box-sizing:border-box;height:calc(38 * var(--speedbox-ui-unit,1px));min-height:calc(38 * var(--speedbox-ui-unit,1px));
  padding:calc(8 * var(--speedbox-ui-unit,1px)) calc(14 * var(--speedbox-ui-unit,1px));margin:0
}

/* Shared form spacing for the managed IPsec and Smart DNS editors. */
.speedbox-infrastructure-overlay [data-sdns-edit] .managed-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: calc(14 * var(--speedbox-ui-unit, 1px));
  min-width: 0;
}
.speedbox-infrastructure-overlay [data-sdns-edit] .managed-protocols {
  min-width: 0;
  border: 0;
  padding: 0;
  margin: 0;
}
.speedbox-infrastructure-overlay [data-sdns-edit] .managed-protocols legend {
  margin-block-end: calc(9 * var(--speedbox-ui-unit, 1px));
}
.speedbox-infrastructure-overlay [data-sdns-edit] .managed-protocol-options {
  display: flex;
  flex-wrap: wrap;
  gap: calc(12 * var(--speedbox-ui-unit, 1px)) calc(18 * var(--speedbox-ui-unit, 1px));
}
.speedbox-infrastructure-overlay [data-sdns-edit] .managed-toggle {
  display: flex;
  align-items: center;
  gap: calc(8 * var(--speedbox-ui-unit, 1px));
  min-height: calc(32 * var(--speedbox-ui-unit, 1px));
  margin: 0;
  padding: 0;
  cursor: pointer;
}
.speedbox-infrastructure-overlay [data-sdns-edit] .managed-toggle input {
  width: calc(17 * var(--speedbox-ui-unit, 1px));
  height: calc(17 * var(--speedbox-ui-unit, 1px));
  flex: none;
  margin: 0;
}
.speedbox-infrastructure-overlay [data-sdns-edit] .managed-advanced[open] > .managed-fields {
  margin-block-start: calc(12 * var(--speedbox-ui-unit, 1px));
}
.speedbox-infrastructure-overlay [data-sdns-edit] :is(.tunnel-muted, h4) {
  margin: 0;
}
.speedbox-infrastructure-overlay [data-sdns-edit] .field small {
  color: var(--muted);
  line-height: 1.65;
}
