/* Keep the dashboard header at the top of the available grid area. */
.content {
  padding: 32px 48px 72px;
  margin: 0 auto;
}

.clients-table .subscription strong,
.clients-table .tariff strong,
.clients-table .telegram-cell strong,
.clients-table .usage strong {
  display: inline-block;
  font-size: 15px;
}

.clients-table .subscription-date,
.clients-table .tariff-duration,
.clients-table .telegram-id,
.clients-table .usage small {
  display: block;
  margin-top: 5px;
  color: #8a94a9;
}

.clients-table { min-width: 1060px; }
.clients-table .telegram-id { font: 11px/1.35 ui-monospace, SFMono-Regular, Menlo, monospace; }
.clients-table .tariff-duration { font-size: 11px; }

.clients-table .usage .spent { color: #36d7a0; }
.clients-table .usage-limit { color: #aab5c8; }

/* A table cell must remain a table-cell; flex on the <td> breaks row alignment. */
.clients-table td.row-actions {
  display: table-cell;
  white-space: nowrap;
}

.clients-table td.row-actions button + button { margin-left: 6px; }

select {
  width: 100%;
  border: 1px solid #30384a;
  border-radius: 9px;
  padding: 11px 12px;
  background: #0b0e14;
  color: #fff;
  outline: none;
  height: 46px;
}

input:not([type="checkbox"]) { height: 46px; }

select:focus { border-color: #6579ff; box-shadow: 0 0 0 3px #6579ff20; }
select:disabled { opacity: .55; }
#account-dialog { width: min(760px, calc(100% - 30px)); }
#account-keys-dialog,
#account-subs-dialog { width: min(1180px, calc(100% - 30px)); }
.accounts-table { min-width: 1280px; }
.analytics-table { min-width: 720px; }
.analytics-table .url-cell {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  word-break: break-all;
}
.analytics-table .method-cell { font-weight: 600; }
.analytics-table .spent { color: #36d7a0; }
.analytics-table .error-count { color: #ff9ba7; }
.account-keys-table { min-width: 1000px; }
.token-state { display: grid; gap: 4px; }
.token-state.good strong { color: #70dfa0; }
.token-state.off strong { color: #ff9ba7; }

#account-dialog[open],
#account-keys-dialog[open],
#account-subs-dialog[open] {
  position: fixed;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  z-index: 1000;
  max-height: calc(100vh - 40px);
  overflow: auto;
}

.context-loader {
  text-align: center;
  padding: 40px 20px;
  color: #9ba6ba;
}

.loader-dot,
button.is-loading::before {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 8px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  vertical-align: -2px;
  animation: loader-spin .7s linear infinite;
}

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

.settings-card { max-width: 720px; padding: 26px; border: 1px solid #252b3a; border-radius: 14px; background: rgba(18,22,31,.88); }
.settings-card h2 { margin: 0 0 8px; }
.settings-card form { display: grid; gap: 14px; margin-top: 22px; }
.settings-card button { justify-self: start; }
.auto-account-button { justify-self: start; }
.auto-progress { display: grid; gap: 8px; padding: 12px; border: 1px solid #30384a; border-radius: 10px; background: #0b0e14; }
.auto-progress pre { margin: 0; max-height: 180px; overflow: auto; font: 12px/1.5 ui-monospace, monospace; color: #aab5c8; }
.password-cell { display: table-cell; }
.password-cell .icon-button { margin-left: 7px; }
.icon-button { width: 38px; height: 36px; padding: 0; border-radius: 9px; background: #202634; color: #cbd2e3; font-size: 17px; line-height: 36px; text-align: center; vertical-align: middle; }
.icon-button.danger { background: #52242b; color: #ffb8c1; }
.icon-button:hover { filter: brightness(1.18); }
.accounts-table td.row-actions { display: table-cell; white-space: nowrap; }
.accounts-table td.row-actions button + button { margin-left: 6px; }
.accounts-table td.name { display: table-cell; }
.accounts-table .date-cell { white-space: nowrap; }
.accounts-table .date-cell span, .accounts-table .date-cell small { display: block; }
.accounts-table .date-cell small { margin-top: 3px; color: #8a94a9; }
.accounts-table .name { white-space: nowrap; }
.history-card { margin-top: 18px; padding: 16px; border: 1px solid #252b3a; border-radius: 12px; background: #0c1017; }
.history-card h3 { margin: 0 0 10px; }
.history-list { display: grid; gap: 8px; }
.history-item { display: grid; gap: 2px; padding: 9px 11px; border-left: 2px solid #6579ff; background: #121824; }
.history-item strong { color: #dbe2f1; font-size: 13px; }
.history-item span, .history-item small { color: #8995ab; }
.details-tabs { display:flex; gap:10px; margin:2px 0 22px; border-bottom:1px solid #252b3a; padding:0 0 10px; flex-wrap:wrap; }
#details-dialog .details-tab { background:#171d2a; color:#9da8bd; border:1px solid #2d374b; border-radius:9px; padding:9px 16px; box-shadow:none; }
#details-dialog .details-tab:hover { background:#20283a; color:#fff; }
#details-dialog .details-tab.active { background:#6579ff; border-color:#6579ff; color:#fff; }
.details-panel { min-width:0; }
select { width:100%; border:1px solid #30384a; border-radius:9px; padding:11px 12px; background:#0b0e14; color:#fff; outline:none; }
#tariffs-view, #plans-panel { min-height:0; }
#plans-panel { display:flex; flex-direction:column; gap:18px; }
#plans-panel[hidden] { display:none !important; }
.payments-table-wrap { border-radius:0 0 14px 14px; }
.payments-table { min-width:1240px; }
.payments-table th, .payments-table td { padding:16px 18px; }
.payments-table td { vertical-align:middle; }
.payment-heading { display:flex; align-items:flex-end; justify-content:space-between; gap:18px; margin:8px 0 20px; }
.payment-heading h2 { margin:0; font-size:28px; letter-spacing:-.4px; }
.payment-heading p { margin:8px 0 0; color:#8a94a9; }
.payment-provider-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(250px,1fr)); gap:14px; margin-bottom:22px; }
.payment-provider-card {
  display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; gap:14px;
  min-height:116px; padding:18px; border:1px solid #252b3a; border-radius:16px;
  background:rgba(18,22,31,.92); cursor:pointer; outline:none; transition:border-color .15s,background .15s,transform .15s;
}
.payment-provider-card:hover { border-color:#3b465c; transform:translateY(-1px); }
.payment-provider-card:focus-visible { box-shadow:0 0 0 3px rgba(101,121,255,.24); }
.payment-provider-card.selected { border-color:#6579ff; background:rgba(31,38,61,.95); }
.payment-provider-card-title { display:flex; align-items:center; gap:13px; min-width:0; }
.payment-provider-card-title strong { display:block; overflow:hidden; text-overflow:ellipsis; font-size:17px; }
.payment-provider-card-title small { display:block; margin-top:6px; color:#7d879c; }
.payment-provider-logo { display:flex; align-items:center; justify-content:center; width:44px; height:44px; flex:0 0 44px; border-radius:13px; background:#28345d; color:#aebcff; font-size:19px; font-weight:800; }
.payment-provider-card > .status-pill { justify-self:end; }
.payment-provider-actions { grid-column:1 / -1; display:flex; justify-content:flex-end; gap:6px; padding-top:12px; border-top:1px solid #252b3a; }
.payment-methods-panel { border:1px solid #252b3a; border-radius:16px; overflow:hidden; background:rgba(18,22,31,.92); }
.payment-methods-heading { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:18px 20px; border-bottom:1px solid #252b3a; }
.payment-methods-heading span { color:#7d879c; font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.08em; }
.payment-methods-heading h3 { margin:4px 0 0; font-size:18px; }
.payment-methods-panel .payments-table-wrap { border:0; border-radius:0; }
.rate-muted { color:#778198; font-weight:650; }

.tariffs-heading { display:flex; align-items:flex-end; justify-content:space-between; gap:16px; margin:0 0 4px; }
.tariffs-heading h2 { margin:0; font-size:28px; letter-spacing:-0.4px; }
.tariffs-heading p { margin:8px 0 0; color:#8a94a9; max-width:640px; }
.tariffs-heading-actions { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.tariffs-add {
  display:inline-flex; align-items:center; justify-content:center;
  height:42px; padding:0 16px; border-radius:12px;
  background:#2ee59b; color:#062016; font-size:14px; font-weight:800;
}
.tariffs-add:hover { filter:brightness(1.08); }
#tariff-board-dialog { width:min(1120px, calc(100% - 24px)); max-height:calc(100vh - 32px); overflow:auto; }
.tariff-board-body { width:auto; max-width:none; }
.tariff-board { display:grid; grid-template-columns:repeat(3, minmax(0, 1fr)); gap:12px; min-height:420px; }
.tariff-board-col {
  display:flex; flex-direction:column; min-height:360px;
  border:1px solid #252b3a; border-radius:14px; background:#0e131c;
}
.tariff-board-col header {
  display:flex; align-items:center; justify-content:space-between; gap:8px;
  padding:12px 14px; border-bottom:1px solid #252b3a;
}
.tariff-board-col h3 { margin:0; font-size:14px; color:#edf0f7; }
.tariff-board-hint { margin:0; padding:8px 14px 0; font-size:12px; }
.tariff-board-list {
  flex:1; display:grid; align-content:start; gap:8px;
  padding:10px; overflow:auto; min-height:280px;
}
.tariff-board-list.droppable { background:rgba(46,229,155,.06); outline:1px dashed #2ee59b; outline-offset:-6px; }
.tariff-board-empty { padding:18px 8px; text-align:center; color:#6f7a90; font-size:12px; }
.tariff-board-card {
  display:grid; grid-template-columns:auto minmax(0,1fr) auto; gap:8px; align-items:center;
  padding:10px 10px; border:1px solid #2a3344; border-radius:10px;
  background:#161c28; cursor:grab;
}
.tariff-board-card:active { cursor:grabbing; }
.tariff-board-card.dragging { opacity:.45; }
.tariff-board-card strong, .tariff-board-card small { display:block; }
.tariff-board-card small { margin-top:3px; color:#8a94a9; font-size:11px; }
.tariff-board-moves { display:flex; gap:4px; }
.tariff-board-moves button {
  width:28px; height:28px; padding:0; border-radius:8px;
  background:#202634; color:#cbd2e3; font-size:14px; font-weight:800;
}

.tariffs-kpis { display:grid; grid-template-columns:repeat(4, minmax(0, 1fr)); gap:12px; }
.tariffs-kpi {
  position:relative; padding:16px 18px 18px;
  border:1px solid #252b3a; border-radius:16px;
  background:rgba(18, 22, 31, .92);
}
.tariffs-kpi-top { display:flex; align-items:center; gap:10px; min-height:36px; padding-right:64px; }
.tariffs-kpi-top > span:not(.tariffs-kpi-icon) { color:#c7d0df; font-size:13px; font-weight:650; }
.tariffs-kpi-icon {
  width:36px; height:36px; border-radius:10px; flex-shrink:0;
  display:inline-flex; align-items:center; justify-content:center;
}
.tariffs-kpi-icon .ico { width:18px; height:18px; }
.tariffs-kpi-icon.green { background:#163528; color:#70dfa0; }
.tariffs-kpi-icon.blue { background:#17324a; color:#7ec8ff; }
.tariffs-kpi strong { display:block; margin-top:12px; font-size:28px; letter-spacing:-0.6px; }
.tariffs-kpi small { display:block; margin-top:6px; color:#6f7a90; font-size:12px; }
.tariffs-kpi .kpi-delta { top:18px; right:16px; }
.tariffs-kpi .kpi-delta:empty { display:none; }

.tariffs-card {
  background:rgba(18, 22, 31, .92); border:1px solid #252b3a; border-radius:16px; overflow:hidden;
}
.tariffs-card-head {
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  padding:14px 20px 12px;
}
.tariffs-card-head h3 { margin:0; padding:0; color:#edf0f7; font-size:16px; }
.tariffs-card-head select {
  width:auto; min-width:150px; height:34px; padding:0 10px;
  font-size:13px; font-weight:650;
}
.tariffs-table-wrap { border:0; border-radius:0; background:transparent; overflow:auto; }
.tariffs-table { min-width:1080px; }
.tariffs-table thead th {
  position:sticky; top:0; z-index:2;
  background:#12161f; box-shadow:0 1px 0 #252b3a;
  color:#7d879c; font-size:11px; font-weight:700; text-transform:none; letter-spacing:0;
}
.tariffs-table th, .tariffs-table td { padding:8px 12px; vertical-align:middle; }
.tariffs-table td small { display:block; margin-top:1px; color:#8a94a9; font-size:11px; line-height:1.2; }
.tariffs-table td strong { display:block; }
.th-tip {
  display:inline-flex; align-items:center; justify-content:center;
  width:14px; height:14px; margin-left:4px; border-radius:50%;
  background:#2a3344; color:#8a94a9; font-size:9px; font-weight:800; vertical-align:1px; cursor:help;
}
.tariff-name { min-width:200px; }
.tariff-name-cell { display:flex; align-items:center; gap:8px; }
.tariff-name-text { min-width:0; flex:1; }
.tariff-name-text small { margin-top:1px; }
.tariff-inline { display:flex; align-items:center; gap:6px; min-width:0; }
.tariff-inline.has-prefix { width:max-content; }
.tariff-inline-prefix { color:#8a94a9; font-weight:700; font-size:13px; }
.tariffs-table input.tariff-name-input,
.tariffs-table input.tariff-price-input {
  height:26px; min-width:0; padding:0 6px;
  border:1px solid transparent; border-radius:6px;
  background:transparent; color:#edf0f7; line-height:26px;
}
.tariffs-table input.tariff-name-input { width:100%; min-width:96px; font-size:13px; font-weight:700; }
.tariffs-table input.tariff-price-input {
  width:72px; font-size:13px; font-variant-numeric:tabular-nums; font-weight:650;
  -moz-appearance:textfield;
}
.tariffs-table input.tariff-price-input::-webkit-outer-spin-button,
.tariffs-table input.tariff-price-input::-webkit-inner-spin-button { -webkit-appearance:none; margin:0; }
.tariffs-table input.tariff-name-input:hover, .tariffs-table input.tariff-price-input:hover,
.tariffs-table input.tariff-name-input:focus, .tariffs-table input.tariff-price-input:focus {
  border-color:#2a3344; background:#161c28; outline:none;
}
.tariff-inline-save {
  height:24px; padding:0 8px; border:0; border-radius:6px; flex-shrink:0;
  background:#2ee59b; color:#062016; font-size:11px; font-weight:800; cursor:pointer;
}
.tariff-inline-save[hidden] { display:none !important; }
.tariff-inline-save:hover { filter:brightness(1.08); }
.tariff-glyph {
  width:28px; height:28px; border-radius:8px; flex-shrink:0;
  display:inline-flex; align-items:center; justify-content:center;
}
.tariff-glyph .ico { width:14px; height:14px; }
.tariff-glyph.day { background:#163528; color:#70dfa0; }
.tariff-glyph.week { background:#17324a; color:#7ec8ff; }
.tariff-glyph.month { background:#2a2150; color:#b79cff; }
.tariff-glyph.premium { background:#2a2416; color:#e7c56a; }
.tariff-cost, .tariff-price { font-variant-numeric:tabular-nums; }
.tariff-margin { color:#70dfa0; font-weight:750; }
.tariff-limit { font-variant-numeric:tabular-nums; }
.tariff-visibility { background:#2a3344; }
.tariff-visibility:checked { background:#2ee59b; }
.tariff-visibility:checked::after { background:#0b1a14; }
.tariff-edit {
  display:inline-flex; align-items:center; gap:6px;
  height:28px; padding:0 8px; border-radius:8px;
  background:transparent; color:#c7d0df; font-size:12px; font-weight:700;
}
.tariff-edit:hover { background:#1b2230; color:#fff; filter:none; }
.tariff-edit .ico { width:14px; height:14px; }
.tariffs-table td.row-actions {
  display:table-cell;
  white-space:nowrap;
  vertical-align:middle;
}
.tariffs-table td.row-actions button + button { margin-left:6px; }
.tariffs-table td.row-actions .icon-button { width:28px; height:28px; }

.assign-subscription { margin-top:18px; padding-top:16px; border-top:1px solid #252b3a; }
.client-subscriptions-table { width:100%; }
#details-dialog .history-card .dialog-title { margin-bottom:12px; }
#orders .buyer-link { background:none; border:0; padding:0; color:#8ea2ff; cursor:pointer; font:inherit; font-weight:700; box-shadow:none; }
#orders .buyer-link:hover { color:#fff; text-decoration:underline; }
#orders .telegram-username, #orders .price-cell small { display:block; margin-top:4px; color:#8a94a9; }
#orders .price-cell strong { display:block; }
#activate-dialog { width:min(560px, calc(100% - 24px)); max-height:calc(100vh - 32px); overflow:auto; }
#activate-dialog .dialog-body.wide { width:auto; max-width:none; }
.activate-steps { display:flex; gap:8px; list-style:none; padding:0; margin:0 0 18px; }
.activate-steps li { flex:1; min-width:0; border:1px solid #2d374b; border-radius:10px; padding:10px 12px; color:#8a94a9; background:#12161f; font-size:13px; }
.activate-steps li strong { display:block; color:#fff; margin-bottom:4px; }
.activate-steps li.current { border-color:#6579ff; color:#c9d2ff; }
.activate-steps li.done { border-color:#2d6a4f; }
.activate-panel { margin-top:8px; min-width:0; }
.activate-panel label { display:grid; gap:8px; }
.asxs-sub-list { display:grid; gap:8px; min-width:0; }
.asxs-sub-card { display:grid; grid-template-columns:auto minmax(0,1fr); gap:10px 12px; align-items:start; width:100%; margin:0; padding:12px; border:1px solid #2d374b; border-radius:12px; background:#12161f; color:inherit; text-align:left; cursor:pointer; }
.asxs-sub-card:hover { border-color:#4b5d86; }
.asxs-sub-card.selected { border-color:#6579ff; background:#1b2440; }
.asxs-sub-card.unavailable { opacity:.55; cursor:not-allowed; }
.asxs-sub-card input { margin-top:3px; }
.asxs-sub-card strong { display:block; overflow-wrap:anywhere; }
.asxs-sub-card small { display:block; color:#8a94a9; margin-top:4px; line-height:1.35; }
.activate-purchase-box { margin:0 0 18px; padding:16px; border:1px solid #2d374b; border-radius:12px; background:#111722; display:grid; gap:12px; }
.activate-purchase-box h3, .activate-panel h3 { margin:0; }
.activate-purchase-box .dialog-actions { justify-content:flex-start; }
.activate-quota { margin-top:16px; display:grid; gap:12px; }
#activate-quota-box[hidden], #activate-asxs-done[hidden], #activate-asxs-empty[hidden], #activate-purchase-result[hidden] { display:none !important; }

.nav-item { display:flex; align-items:center; gap:10px; }
.nav-item span.ico { width:18px !important; height:18px; min-width:18px; color:#8ea0ff; }
.search .ico { width:16px !important; height:16px; min-width:16px; color:#8490a8; }
.ico { display:inline-flex; align-items:center; justify-content:center; line-height:0; }
.ico svg { width:100%; height:100%; display:block; }
.icon-button { display:inline-flex; align-items:center; justify-content:center; }
.icon-button .ico { width:16px; height:16px; color:currentColor; }
.model-name-cell { display:flex; align-items:center; gap:10px; }
.model-badge { display:inline-flex; align-items:center; justify-content:center; min-width:38px; height:22px; padding:0 7px; border-radius:7px; font:700 10px/1 ui-sans-serif,system-ui,sans-serif; letter-spacing:.04em; }
.model-badge.gpt { background:#1d2a4a; color:#9db4ff; }
.model-badge.grok { background:#2a2416; color:#e7c56a; }
.search { display:flex; align-items:center; gap:8px; }
#asxs-purchase-dialog { width:min(720px, calc(100% - 24px)); max-height:calc(100vh - 32px); overflow:auto; }
#asxs-purchase-pay { display:inline-flex; align-items:center; justify-content:center; padding:11px 16px; border-radius:10px; background:#6579ff; color:#fff; text-decoration:none; font-weight:700; }
.asxs-wallet-option { display:flex; align-items:flex-start; gap:10px; margin-top:14px; padding:13px 14px; border:1px solid #30394b; border-radius:10px; background:#111722; cursor:pointer; }
.asxs-wallet-option input { width:18px; height:18px; margin:2px 0 0; flex:0 0 auto; accent-color:#6579ff; }
.asxs-wallet-option span { display:grid; gap:4px; }
.asxs-wallet-option strong { color:#dce3f0; font-size:13px; }
.asxs-wallet-option small { color:#8f9bb0; font-size:11px; line-height:1.4; }
#key-edit-dialog { width:min(640px, calc(100% - 24px)); }
#key-edit-form select[multiple] { height:auto; min-height:96px; }
#client-bonus { margin-top:18px; }
.help-sections { display:flex; gap:8px; flex-wrap:wrap; }
.help-article { white-space:pre-wrap; line-height:1.45; color:#d5dbe8; font-size:13px; }
.help-article b { color:#fff; }
.help-article code { font-family:ui-monospace,monospace; color:#93a5ff; }
.help-article pre { margin:10px 0; white-space:pre-wrap; }

/* Subscription workspace: a readable overview, with secondary actions disclosed. */
#details-dialog [hidden], #subscription-editor [hidden] { display:none !important; }
#details-dialog { max-height:calc(100dvh - 30px); overflow:auto; }
#details-dialog:has([data-details-panel="settings"]:not([hidden])),
#details-dialog:has([data-details-panel="keys"]:not([hidden])),
#details-dialog:has([data-details-panel="subscription"]:not([hidden])) { width:min(960px,calc(100% - 24px)); }
#details-dialog:has([data-details-panel="settings"]:not([hidden])) .dialog-body,
#details-dialog:has([data-details-panel="keys"]:not([hidden])) .dialog-body,
#details-dialog:has([data-details-panel="subscription"]:not([hidden])) .dialog-body { max-width:100%; width:auto; }
#details-dialog:not(:has([data-details-panel="settings"]:not([hidden]))) > form > .dialog-actions button[type="submit"] { display:none; }
#details-dialog .subscription-workspace { padding:0; background:transparent; border:0; margin-top:20px; min-width:0; }
.subscription-heading { display:flex; align-items:center; justify-content:space-between; gap:16px; margin-bottom:22px; }
.subscription-heading h3 { margin:0 0 6px; font-size:19px; }
.subscription-heading p { margin:0; font-size:13px; line-height:1.5; }
.subscription-heading button { flex-shrink:0; }
.subscription-cards { display:grid; gap:14px; }
.subscription-card { min-width:0; padding:22px; border:1px solid #303747; border-radius:16px; background:#141a25; }
.subscription-card.current { border-color:#6475ee; background:linear-gradient(120deg,#202944,#141a25 80%); }
.subscription-card-head { display:flex; justify-content:space-between; align-items:flex-start; gap:12px; }
.subscription-card-head h3 { font-size:20px; margin:7px 0 0; overflow-wrap:anywhere; }
.subscription-kind { color:#9daac1; font-size:10px; font-weight:700; letter-spacing:.09em; }
.subscription-badge { padding:6px 10px; border-radius:7px; color:#b2bed3; background:#252d3d; font-size:11px; font-weight:650; white-space:nowrap; }
.subscription-badge.live { color:#a6efd5; background:#213e3e; }
.subscription-metrics { display:grid; grid-template-columns:1fr 1fr 1.5fr; gap:16px; margin:22px 0; }
.subscription-metrics span { display:block; font-size:12px; color:#93a0b7; margin-bottom:7px; }
.subscription-metrics strong { display:block; font-size:19px; font-variant-numeric:tabular-nums; overflow-wrap:anywhere; }
.subscription-metrics > div:last-child strong { font-size:14px; line-height:1.6; }
.subscription-card-actions { display:flex; gap:8px; flex-wrap:wrap; border-top:1px solid #2d3649; padding-top:14px; }
.subscription-card-actions button { font-size:12px; padding:9px 14px; }
.subscription-card p { font-size:12px; line-height:1.5; }
.subscription-history-title { margin:4px 0 0; font-size:15px; }
.subscription-history-wrap { overflow:auto; border:1px solid #303747; border-radius:12px; background:#111722; }
.subscription-history-table { width:100%; min-width:920px; border-collapse:collapse; table-layout:auto; }
.subscription-history-table th { padding:8px 12px; color:#8996ad; background:#151c28; font-size:10px; font-weight:700; letter-spacing:.05em; text-align:left; white-space:nowrap; }
.subscription-history-table td { height:42px; padding:6px 12px; border-top:1px solid #283142; color:#c8d1e1; font-size:12px; line-height:1.2; white-space:nowrap; vertical-align:middle; }
.subscription-history-table tbody tr:hover { background:#182131; }
.subscription-history-table .purchase-title { max-width:250px; overflow:hidden; color:#edf1f8; font-size:13px; font-weight:700; text-overflow:ellipsis; }
.subscription-history-table .provider-snapshot { max-width:260px; overflow:hidden; text-overflow:ellipsis; }
.subscription-history-table .purchase-id { max-width:190px; overflow:hidden; color:#8f9bb0; font-family:ui-monospace,SFMono-Regular,Menlo,monospace; text-overflow:ellipsis; }
.subscription-history-table .subscription-badge { display:inline-block; padding:4px 7px; font-size:10px; }
.subscription-empty { border:1px dashed #3b475e; background:#151c29; border-radius:12px; color:#b2bed3; padding:18px; font-size:13px; line-height:1.6; }
.subscription-archive summary, .subscription-extra summary { cursor:pointer; font-weight:650; font-size:13px; padding:16px 0; color:#c4cddd; }
.subscription-archive .subscription-card { margin-top:10px; }
.subscription-extra { border-top:1px solid #2b3344; margin-top:22px; }
.subscription-extra summary span { display:block; margin-top:5px; color:#8996ad; font-size:12px; font-weight:400; }
.subscription-extra-body { display:grid; gap:12px; padding:4px 0 16px; }
.subscription-extra-body p { font-size:13px; line-height:1.6; margin:0; }
.subscription-extra-body .history-item:empty { display:none; }
#assign-subscription { background:#171e2c; border:1px solid #394660; border-radius:14px; padding:20px; }
#assign-subscription p { font-size:13px; line-height:1.6; }
.assign-asxs-subscription-control { display:grid; grid-template-columns:minmax(0,1fr) auto 46px; gap:8px; }
.assign-asxs-purchase { min-width:88px; height:46px; padding:0 16px; }
.assign-asxs-refresh { width:46px; height:46px; padding:11px; display:inline-flex; align-items:center; justify-content:center; }
.assign-asxs-refresh svg { width:21px; height:21px; display:block; }
#subscription-editor { width:min(590px,calc(100% - 24px)); max-height:calc(100dvh - 32px); overflow:auto; }
#subscription-editor .dialog-body { width:auto; max-width:100%; padding:26px; }
#subscription-editor h2 { font-size:23px; }
#subscription-editor small { line-height:1.5; }

/* Client settings are grouped by intent instead of one long form. */
.settings-layout { display:grid; gap:14px; }
.settings-section { padding:20px; border:1px solid #2d3545; border-radius:14px; background:#0d121b; }
.settings-section-title { display:flex; align-items:flex-start; justify-content:space-between; gap:18px; margin-bottom:18px; }
.settings-section-title h3 { margin:0 0 5px; color:#e3e8f3; font-size:16px; }
.settings-section-title p { margin:0; font-size:12px; line-height:1.5; }
.settings-section-title .switch-label { flex-shrink:0; align-self:center; padding:0; color:#d5dceb; }
.advanced-settings { margin-top:16px; border-top:1px solid #252d3d; padding-top:14px; }
.advanced-settings summary { color:#aab5c8; cursor:pointer; font-size:12px; font-weight:700; }
.advanced-settings .form-grid { margin-top:16px; }

/* CXP and ASXS key mapping. */
.panel-heading, .keys-section-title { display:flex; align-items:center; justify-content:space-between; gap:16px; }
.panel-heading { margin-bottom:18px; }
.panel-heading h3, .keys-section-title h3 { margin:0 0 5px; color:#e4e9f4; font-size:18px; }
.panel-heading p { margin:0; font-size:12px; }
.keys-section { margin-top:18px; }
.keys-section-title { margin-bottom:10px; }
.keys-section-title h3 { margin:0; font-size:14px; }
.client-key-grid { display:grid; gap:12px; }
.key-management-card { padding:18px; border:1px solid #30394b; border-radius:14px; background:#111722; }
.key-management-card.asxs { border-color:#384361; background:linear-gradient(120deg,#151d30,#111722 78%); }
.key-management-head { display:flex; justify-content:space-between; align-items:flex-start; gap:12px; }
.key-management-head h4 { margin:5px 0 0; font-size:16px; }
.key-kind { color:#8495d8; font-size:10px; font-weight:800; letter-spacing:.1em; }
.key-state { padding:5px 9px; border-radius:999px; background:#252d3b; color:#aab5c8; font-size:10px; font-weight:800; }
.key-state.good { background:#173a30; color:#82e4bb; }
.key-state.off { background:#47242b; color:#ffabb6; }
.key-code { display:block; margin:15px 0; padding:11px 12px; border:1px solid #2d3545; border-radius:9px; background:#090d14; color:#9cacf8; font:12px/1.4 ui-monospace,SFMono-Regular,Menlo,monospace; overflow-wrap:anywhere; }
.key-facts { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; margin:0; }
.key-facts div { min-width:0; }
.key-facts dt { color:#7f8ba1; font-size:10px; text-transform:uppercase; letter-spacing:.07em; }
.key-facts dd { margin:5px 0 0; color:#d7deeb; font-size:12px; line-height:1.45; overflow-wrap:anywhere; }
.key-management-actions { display:flex; gap:8px; flex-wrap:wrap; margin-top:16px; padding-top:14px; border-top:1px solid #293142; }
.key-management-actions button { padding:9px 12px; font-size:11px; }
.pagination { display:flex; align-items:center; justify-content:center; gap:14px; margin-top:16px; padding-top:14px; border-top:1px solid #293142; }
.pagination button { min-width:92px; }
.settings-credentials { margin-bottom:18px; }
.content:has(#clients-view:not([hidden])) > header > div:first-child,
.content:has(#tariffs-view:not([hidden])) > header { display: none; }

.users-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 8px 0 22px; }
.users-heading h2 { margin: 0; font-size: 28px; letter-spacing: -0.4px; }
.users-heading p { margin: 8px 0 0; color: #8a94a9; }

.users-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin: 0 0 18px; }
.users-kpi { position: relative; padding: 16px 18px 18px; border: 1px solid #252b3a; border-radius: 16px; background: rgba(18, 22, 31, .92); overflow: hidden; }
.users-kpi span { display: block; color: #8690a6; font-size: 12px; }
.users-kpi strong { display: block; margin-top: 10px; font-size: 28px; letter-spacing: -0.6px; }
.users-kpi small { display: block; margin-top: 6px; color: #6f7a90; font-size: 12px; }
.kpi-delta { position: absolute; top: 16px; right: 14px; font-style: normal; font-size: 12px; font-weight: 750; color: #70dfa0; }
.kpi-delta.down { color: #ff9ba7; }
.kpi-active { box-shadow: inset 3px 0 0 #2ee59b; }
.kpi-new { box-shadow: inset 3px 0 0 #4ea0ff; }
.kpi-keys { box-shadow: inset 3px 0 0 #7d92ff; }
.kpi-expiring { box-shadow: inset 3px 0 0 #ffb454; }
.kpi-blocked { box-shadow: inset 3px 0 0 #ff6b81; }

.users-mid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr); gap: 14px; margin-bottom: 18px; }
.users-chart-card, .users-expiring-card, .users-table-panel, .users-drawer {
  background: rgba(18, 22, 31, .92); border: 1px solid #252b3a; border-radius: 16px;
}
.users-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 18px 0; }
.users-card-head h3 { margin: 0; font-size: 16px; color: #edf0f7; }
.users-chart-sub { margin: 8px 0 0; color: #8a94a9; font-size: 12px; }
.users-chart-sub i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.users-chart-sub .issued { background: #2ee59b; }
.users-chart-sub .renewed { background: #2f5a48; margin-left: 8px; }
.users-inline-filter { display: flex; align-items: center; gap: 8px; color: #8a94a9; font-size: 12px; }
.users-inline-filter select {
  width: auto; height: 32px; padding: 0 10px;
  background: #0e131c; border: 1px solid #2a3344; border-radius: 10px;
}
.text-link { background: transparent; color: #8ea0ff; padding: 0; font-size: 13px; }
.text-link:hover { filter: none; color: #fff; }

.users-chart-body { padding: 8px 18px 16px; }
.users-chart-plot {
  display: flex; align-items: flex-end; gap: 4px;
  height: 168px; padding-top: 8px;
  border-bottom: 1px solid #232b3a;
}
.users-chart-col {
  flex: 1 1 0; min-width: 0; height: 100%;
  display: flex; align-items: flex-end; justify-content: center; gap: 2px;
}
.users-chart-col b, .users-chart-col i {
  display: block; width: 5px; min-height: 3px; max-height: 100%;
  border-radius: 2px 2px 0 0; flex: 0 0 auto;
}
.users-chart-col b { background: #2ee59b; }
.users-chart-col i { background: #2f5a48; }
.users-chart-axis { display: flex; gap: 4px; margin-top: 8px; }
.users-chart-axis span {
  flex: 1 1 0; min-width: 0;
  display: flex; flex-direction: column; align-items: center;
  color: #667086; font-size: 10px; line-height: 1.15; font-variant-numeric: tabular-nums;
}
.users-chart-axis span b { font-weight: 500; }

.users-expiring-list { display: grid; gap: 8px; padding: 14px 16px 16px; }
.users-expiring-item { display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: center; padding: 8px 4px; border-radius: 10px; cursor: pointer; }
.users-expiring-item:hover { background: #151b27; }
.users-avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: #24304a; color: #9db0ff; font-size: 12px; font-weight: 800; }
.users-expiring-item strong { display: block; font-size: 13px; }
.users-expiring-item small { display: block; color: #7d879c; font-size: 11px; }
.days-pill { min-width: 58px; text-align: center; border-radius: 999px; padding: 4px 8px; font-size: 11px; font-weight: 750; background: #3a2a1f; color: #ffb454; }
.days-pill.soon { background: #3a1f24; color: #ff9ba7; }

.users-workspace { display: grid; gap: 14px; }
.users-workspace.drawer-open { grid-template-columns: minmax(0, 1fr) minmax(0, 380px); align-items: start; }
.users-table-panel { overflow: hidden; }
.users-table-panel .table-toolbar,
.users-table-panel .table-wrap {
  background: transparent; border: 0; border-radius: 0;
}
.users-table-panel .table-wrap { overflow-x: auto; overflow-y: hidden; }
.drawer-block-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.drawer-block-head h4 { margin: 12px 0 8px; }
.users-toolbar { gap: 10px; flex-wrap: wrap; padding: 14px 16px 8px; }
.users-toolbar .search { width: min(320px, 100%); }
.users-toolbar select { width: auto; height: 40px; padding: 0 12px; border-radius: 999px; }
.users-toolbar #users-export { height: 40px; margin-left: auto; border-radius: 999px; }

.users-table { min-width: 1120px; table-layout: auto; }
.users-table th, .users-table td {
  display: table-cell !important;
  white-space: nowrap;
  vertical-align: middle;
  padding: 13px 12px;
}
.users-table tbody tr { cursor: pointer; }
.users-table tbody tr.selected { background: #182033; }
.users-table .person-cell { font-weight: 700; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.users-table .telegram-cell strong { display: block !important; font-size: 13px; }
.users-table .key-cell { color: #93a5ff; font: 12px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace; }
.users-table .row-actions { display: inline-flex; gap: 6px; vertical-align: middle; }
.status-pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 4px 9px; font-size: 12px; font-weight: 750; }
.status-pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-pill.good, .status-pill.online { background: #163528; color: #70dfa0; }
.status-pill.wait { background: #3a2a1f; color: #ffb454; }
.status-pill.off { background: #3a1f24; color: #ff9ba7; }

.users-pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px 16px; }
.users-pager .pagination { margin: 0; padding: 0; border: 0; gap: 8px; }
.users-pager .pagination button { min-width: 40px; height: 36px; padding: 0 10px; background: #202634; }
.users-pager .pagination button.active { background: #6579ff; }

.users-drawer {
  width: 100%;
  max-width: 380px;
  min-width: 0;
  padding: 16px 16px 20px;
  position: sticky;
  top: 18px;
  max-height: calc(100vh - 40px);
  overflow-x: hidden;
  overflow-y: auto;
}
.users-drawer-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 14px; min-width: 0; }
.users-drawer-title-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.users-drawer-title-row h3 { margin: 0; font-size: 16px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.users-drawer-who { display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: 12px; align-items: center; min-width: 0; }
.users-avatar.lg { width: 42px; height: 42px; font-size: 16px; }
.users-drawer-who strong { display: block; font-size: 16px; overflow: hidden; text-overflow: ellipsis; }
.users-drawer-who p { margin: 3px 0 0; font-size: 12px; }
.users-online { color: #70dfa0; }
.users-online::before { content: ''; display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: currentColor; }
.users-drawer-tabs {
  display: flex; flex-wrap: wrap; gap: 0 12px; margin: 16px 0 14px; padding: 0;
  background: transparent; border-bottom: 1px solid #232b3a; min-width: 0; overflow: hidden;
}
.users-tab {
  flex: 0 1 auto; background: transparent; color: #8a94a9; border: 0; border-radius: 0;
  padding: 8px 0 10px; font-size: 12px; box-shadow: none; border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.users-tab:hover { filter: none; background: transparent; color: #fff; }
.users-tab.active { background: transparent; color: #fff; border-bottom-color: #6579ff; }
.users-drawer-info, #drawer-keys, #drawer-orders, #drawer-notes, #drawer-history { display: grid; gap: 12px; min-width: 0; }
.drawer-block { border: 1px solid #2a3344; border-radius: 12px; padding: 4px 14px 12px; background: #10151e; min-width: 0; }
.drawer-block h4 { margin: 12px 0 4px; font-size: 13px; color: #9aa6bc; font-weight: 700; }
.drawer-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, auto) auto; gap: 8px; align-items: center; padding: 10px 0; border-bottom: 1px solid #232b3a; font-size: 13px; }
.drawer-row:last-child { border-bottom: 0; }
.drawer-row span { color: #7d879c; }
.drawer-row strong, .drawer-tariff { font-weight: 700; min-width: 0; overflow-wrap: anywhere; }
.drawer-row .ghost, .drawer-key-line .ghost, .users-drawer button.ghost {
  background: #171d2a; color: #c5cde0; border: 1px solid #2d374b; padding: 6px 10px; font-size: 11px; border-radius: 8px;
}
.drawer-usage {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 12px; align-items: center;
  padding: 10px 0; border-bottom: 1px solid #232b3a; font-size: 13px; min-width: 0;
}
.drawer-usage:last-child { border-bottom: 0; }
.drawer-usage-main { display: grid; gap: 6px; min-width: 0; }
.drawer-usage-top { display: flex; justify-content: space-between; gap: 8px; }
.drawer-usage-top span { color: #7d879c; }
.drawer-remain { color: #8a94a9; font-size: 12px; white-space: nowrap; }
.usage-bar { height: 8px; border-radius: 99px; background: #243044; overflow: hidden; }
.usage-bar i { display: block; height: 100%; background: #2ee59b; }
.drawer-key-line { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; align-items: center; padding: 10px 0 6px; min-width: 0; }
.users-drawer .drawer-key {
  grid-column: 1 / -1;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: auto;
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid #2d3545;
  border-radius: 8px;
  background: #090d14;
  color: #93a5ff;
  font: 12px/1.35 ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 500;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.users-drawer .drawer-key:hover { filter: none; background: #101826; }
.users-drawer .drawer-key:disabled { opacity: .6; cursor: default; }
.drawer-key-meta { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; padding: 8px 0 4px; font-size: 13px; min-width: 0; }
.drawer-key-meta span { color: #7d879c; }
.drawer-key-meta > div { min-width: 0; overflow-wrap: anywhere; }
.drawer-tariff { text-align: right; min-width: 0; }
.drawer-tariff small { display: block; margin-top: 2px; color: #8a94a9; font-size: 12px; font-weight: 650; }
.drawer-actions { display: grid; gap: 8px; padding: 4px 14px 12px; min-width: 0; }
.drawer-actions h4 { margin: 12px 0 2px; }
.drawer-actions-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr); gap: 8px; min-width: 0; }
.drawer-actions-row.two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.users-drawer .drawer-actions button {
  width: 100%; min-width: 0; min-height: 32px; height: auto; padding: 6px 6px;
  font-size: 11px; line-height: 1.2; border-radius: 10px; white-space: normal;
}
.drawer-actions .fill { background: #2ee59b; color: #062315; }
.drawer-actions .extend { background: #3d6dff; color: #fff; }
.drawer-actions .ghost { background: #171d2a; color: #c5cde0; border: 1px solid #2d374b; }
.drawer-actions .danger { background: #3a2228; color: #ffb8c1; border: 1px solid #6a3038; }
.drawer-note { width: 100%; max-width: 100%; min-width: 0; min-height: 64px; resize: vertical; border: 1px solid #2d3545; border-radius: 8px; background: #090d14; color: #edf0f7; padding: 10px; }
.drawer-note-actions { display: flex; justify-content: flex-end; margin-top: 8px; }
.drawer-kv { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; font-size: 13px; }
.drawer-kv span { color: #7d879c; }
.users-workspace.drawer-open.keys-tab,
.users-workspace.drawer-open.orders-tab { grid-template-columns: minmax(0, 1fr) minmax(0, min(720px, 54vw)); }
.users-drawer.keys-tab,
.users-drawer.orders-tab { max-width: min(720px, 54vw); }
.keys-board { display: grid; gap: 12px; min-width: 0; }
.keys-panel { border: 1px solid #2a3344; border-radius: 12px; padding: 12px; background: #10151e; min-width: 0; }
.keys-panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.keys-panel-head h4 { margin: 0; font-size: 14px; color: #edf0f7; }
.keys-panel-head .muted { margin: 4px 0 0; font-size: 11px; }
.keys-add { background: #243044; color: #9db0ff; padding: 7px 10px; font-size: 12px; white-space: nowrap; }
.keys-table-wrap { overflow-x: auto; }
.keys-table { width: 100%; min-width: 640px; border-collapse: collapse; }
.keys-table th, .keys-table td { padding: 8px 8px; text-align: left; border-bottom: 1px solid #232b3a; font-size: 12px; white-space: nowrap; vertical-align: top; }
.keys-table th { color: #7d879c; font-size: 10px; text-transform: uppercase; letter-spacing: .04em; }
.keys-table tbody tr { cursor: pointer; }
.keys-table tbody tr.selected { background: #182033; }
.keys-table .name-cell strong { display: block; }
.keys-table .name-cell small { display: block; margin-top: 3px; color: #7d879c; }
.keys-table .limits { font-variant-numeric: tabular-nums; }
.keys-table .limits small { display: block; margin-top: 3px; color: #8a94a9; }
.keys-chain { display: grid; gap: 8px; }
.keys-chain-flow { display: flex; flex-wrap: wrap; gap: 8px; align-items: stretch; }
.keys-chain-card { flex: 1 1 120px; min-width: 0; border: 1px solid #2a3344; border-radius: 10px; padding: 10px; background: #0e131c; }
.keys-chain-card span { display: block; color: #7d879c; font-size: 10px; text-transform: uppercase; letter-spacing: .04em; }
.keys-chain-card strong { display: block; margin-top: 6px; font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
.keys-chain-card small { display: block; margin-top: 4px; color: #8a94a9; }
.keys-chain-note { margin: 0; padding: 10px 12px; border: 1px solid #1e3a55; border-radius: 10px; background: #101b28; color: #9db8d8; font-size: 12px; }
.orders-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; }
.orders-head h4, .orders-stats h4 { margin: 0; font-size: 14px; color: #edf0f7; }
.orders-filter {
  min-width: 140px; height: 32px; padding: 0 10px; border: 1px solid #2d374b; border-radius: 8px;
  background: #171d2a; color: #c5cde0; font-size: 12px;
}
.orders-list { border: 1px solid #2a3344; border-radius: 14px; background: #10151e; overflow: hidden; min-width: 0; }
.orders-empty { padding: 18px 14px; }
.order-card { border-bottom: 1px solid #232b3a; }
.order-card:last-child { border-bottom: 0; }
.order-card.open {
  margin: 8px; border: 1px solid #3d6dff; border-radius: 12px; background: #121a2a;
  box-shadow: 0 0 0 1px #3d6dff33;
}
.users-drawer .order-summary {
  display: grid;
  grid-template-columns: 14px auto minmax(0, 1.3fr) auto auto auto minmax(92px, 0.9fr);
  gap: 8px; align-items: center; width: 100%;
  background: transparent; color: #edf0f7; border: 0; border-radius: 0;
  padding: 10px 12px; text-align: left; font: inherit; font-weight: 600; box-shadow: none;
}
.users-drawer .order-summary:hover { filter: none; background: #182033; }
.order-card.open .order-summary:hover { background: transparent; }
.order-chevron { color: #8a94a9; font-size: 12px; }
.order-id { font-size: 12px; color: #c5cde0; }
.order-plan { display: flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.order-glyph { flex: none; }
.order-price { font-size: 12px; font-weight: 800; white-space: nowrap; }
.order-pill {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px; padding: 3px 8px; font-size: 10px; font-weight: 750; white-space: nowrap;
}
.order-pill.paid, .order-pill.done { background: #163528; color: #70dfa0; }
.order-pill.wait { background: #3a2a1f; color: #ffb454; }
.order-pill.refund, .order-pill.fail { background: #3a1f24; color: #ff9ba7; }
.order-pill.idle { background: #1c2330; color: #8a94a9; }
.order-when { display: grid; justify-items: end; min-width: 0; }
.order-when strong { font-size: 11px; font-weight: 650; color: #c5cde0; }
.order-when small { font-size: 10px; }
.order-details { padding: 0 12px 12px; display: grid; gap: 10px; min-width: 0; }
.order-details-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.order-details-title h5 { margin: 0; font-size: 14px; }
.order-facts { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px 14px; }
.order-fact { min-width: 0; }
.order-fact-label { display: block; color: #7d879c; font-size: 11px; margin-bottom: 4px; }
.order-fact strong { display: block; font-size: 12px; overflow-wrap: anywhere; }
.order-alipay { border: 1px solid #2a3344; border-radius: 10px; padding: 10px; background: #0e1522; display: grid; gap: 8px; }
.order-alipay-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.order-alipay-head h5 { margin: 0; font-size: 13px; }
.order-alipay-list { display: grid; gap: 6px; }
.order-alipay-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 8px; border: 1px solid #233048; border-radius: 9px; background: #101827; }
.order-alipay-row.paid { border-color: #225b3c; }
.order-alipay-row.expired { border-color: #55303a; }
.order-alipay-main { display: grid; gap: 4px; min-width: 0; }
.order-alipay-main strong { font-size: 12px; overflow-wrap: anywhere; }
.order-alipay-main small { color: #8a94a9; font-size: 11px; overflow-wrap: anywhere; }
.order-alipay-actions { display: flex; align-items: center; justify-content: flex-end; gap: 5px; flex-wrap: wrap; }
.order-card-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.users-drawer .order-act {
  min-height: 34px; padding: 7px 8px; font-size: 11px; line-height: 1.2; border-radius: 10px;
  background: #1b2a4d; color: #9db0ff; border: 1px solid #2c4274; white-space: nowrap;
}
.users-drawer a.order-act { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.users-drawer .order-act.small, .users-drawer .order-act.tiny { min-height: 28px; padding: 5px 8px; font-size: 10px; }
.users-drawer .order-act.refund { background: #3a2228; color: #ffb8c1; border-color: #6a3038; }
.orders-stats { display: grid; gap: 10px; }
.orders-stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.orders-stat {
  border: 1px solid #2a3344; border-radius: 10px; padding: 10px 10px 10px 12px; background: #10151e;
  border-left: 3px solid #2ee59b; min-width: 0;
}
.orders-stat:nth-child(2) { border-left-color: #8b7cff; }
.orders-stat:nth-child(3) { border-left-color: #3d6dff; }
.orders-stat:nth-child(4) { border-left-color: #ffb454; }
.orders-stat-icon { display: block; font-size: 14px; margin-bottom: 6px; }
.orders-stat small { display: block; color: #7d879c; font-size: 10px; }
.orders-stat strong { display: block; margin-top: 4px; font-size: 14px; }
.orders-stat em { display: block; margin-top: 2px; font-style: normal; color: #8a94a9; font-size: 11px; }
.drawer-history-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; }
.drawer-history-head h4 { margin: 0; font-size: 14px; color: #edf0f7; }
.drawer-history-list { border: 1px solid #2a3344; border-radius: 14px; background: #10151e; overflow: hidden; min-width: 0; }
.drawer-history-item {
  display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 10px;
  padding: 12px 14px; border-bottom: 1px solid #232b3a;
}
.drawer-history-item:last-child { border-bottom: 0; }
.drawer-history-dot {
  display: block; width: 8px; height: 8px; margin-top: 6px; border-radius: 50%;
  background: #6579ff;
}
.drawer-history-item.good .drawer-history-dot { background: #2ee59b; }
.drawer-history-item.bad .drawer-history-dot { background: #ff9ba7; }
.drawer-history-item strong { display: block; font-size: 13px; overflow-wrap: anywhere; }
.drawer-history-item span { display: block; margin-top: 3px; color: #8a94a9; font-size: 12px; overflow-wrap: anywhere; }
.drawer-history-item small { display: block; margin-top: 4px; color: #667086; font-size: 11px; }
.drawer-history-pager { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.users-drawer .drawer-history-pager button {
  width: auto; min-width: 72px; min-height: 32px; padding: 6px 10px; font-size: 11px;
  background: #171d2a; color: #c5cde0; border: 1px solid #2d374b;
}
.users-drawer .drawer-history-pager button:disabled { opacity: .45; }
#key-edit-dialog { width: min(680px, calc(100% - 24px)); }
#proxy-key-dialog { width: min(560px, calc(100% - 24px)); }
#asxs-add-dialog { width: min(640px, calc(100% - 24px)); }
.asxs-add-mode {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-self: end;
}
.asxs-add-mode label {
  display: flex; align-items: center; gap: 8px; min-height: 42px; padding: 9px 12px;
  border: 1px solid #30384a; border-radius: 10px; background: #0b0e14; color: #dbe1ef;
  font-weight: 750; cursor: pointer;
}
.asxs-add-mode input { width: 16px; height: 16px; }
.asxs-add-panel {
  display: grid; gap: 12px; padding: 14px; border: 1px solid #273145;
  border-radius: 14px; background: #10151f;
}
.key-edit-sections { display: grid; gap: 14px; }
.key-edit-section {
  display: grid; gap: 12px; padding: 14px; border: 1px solid #273145;
  border-radius: 14px; background: #10151f;
}
.key-edit-section h3 { margin: 0; color: #edf0f7; font-size: 15px; }
.expiry-field { display: grid; grid-template-columns: minmax(0, 1fr) 42px; gap: 8px; align-items: center; }
.expiry-field input { min-width: 0; }
button.expiration-clear {
  height: 42px; padding: 0; border: 1px solid #33405a; border-radius: 10px;
  background: #171d2a; color: #f0f3fb; line-height: 1;
}
.key-edit-usage { display: grid; gap: 8px; font-size: 13px; }
.key-edit-usage p { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0; }
.key-popup textarea { min-height: 64px; }

#provider-form textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid #30384a;
  border-radius: 9px;
  padding: 11px 12px;
  background: #0b0e14;
  color: #fff;
  font: inherit;
  outline: none;
}

#provider-form textarea:focus {
  border-color: #6579ff;
  box-shadow: 0 0 0 3px #6579ff20;
}
.drawer-kv span { color: #7d879c; }

@media (max-width: 1280px) {
  .tariffs-kpis { grid-template-columns: 1fr 1fr; }
  .users-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .users-mid, .users-workspace.drawer-open { grid-template-columns: 1fr; }
  .users-drawer { position: static; }
  .users-drawer .order-summary { grid-template-columns: 14px auto minmax(0, 1fr) auto; }
  .order-pill, .order-when { display: none; }
  .order-card.open .order-pill, .order-card.open .order-when { display: inline-flex; }
  .order-card.open .order-when { display: grid; grid-column: 1 / -1; justify-items: start; }
  .orders-stats-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .payment-heading, .payment-methods-heading { align-items:stretch; flex-direction:column; }
  .tariffs-heading, .tariffs-heading-actions { align-items: stretch; flex-direction: column; }
  .tariffs-add { width: 100%; }
  .tariff-board { grid-template-columns: 1fr; min-height:0; }
  .tariffs-kpis { grid-template-columns: 1fr; }
  .users-kpis { grid-template-columns: 1fr 1fr; }
  .users-toolbar #users-export { margin-left: 0; width: 100%; }
}
@media (max-width: 640px) {
  .subscription-heading { align-items: flex-start; flex-direction: column; }
  .subscription-heading button { width: 100%; }
  .subscription-card { padding: 16px; }
  .subscription-card-head { flex-wrap: wrap; }
  .subscription-metrics { grid-template-columns: 1fr 1fr; }
  .subscription-metrics > div:last-child { grid-column: 1 / -1; }
  #details-dialog .dialog-body { padding: 18px; }
  .settings-section { padding: 15px; }
  .settings-section-title, .panel-heading { align-items: flex-start; flex-direction: column; }
  .panel-heading button { width: 100%; }
  .key-facts { grid-template-columns: 1fr 1fr; }
  .assign-asxs-subscription-control { grid-template-columns:minmax(0,1fr) 46px; }
  .assign-asxs-purchase { grid-column:1 / -1; grid-row:2; width:100%; }
}

.client-chat { display: grid; gap: 12px; min-width: 0; }
.chat-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.chat-heading h4 { margin: 0; font-size: 16px; }
.chat-messages { display: flex; flex-direction: column; gap: 12px; height: 400px; max-height: 50vh; overflow: auto; padding: 12px 2px; overscroll-behavior: contain; }
.chat-message { flex: none; width: fit-content; max-width: 88%; padding: 12px; border: 1px solid #30384a; border-radius: 8px; background: #151b24; overflow-wrap: anywhere; }
.chat-message.outgoing { align-self: flex-end; background: #18352d; border-color: #2c6150; }
.chat-message strong { font-size: 12px; }
.chat-message p { margin: 8px 0; white-space: pre-wrap; }
.chat-message small { display: block; margin-top: 8px; }
.chat-message button { max-width: 100%; white-space: normal; overflow-wrap: anywhere; border-radius: 8px; margin-top: 8px; }
.chat-composer { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: end; }
.chat-composer textarea { width: 100%; min-width: 0; min-height: 90px; max-height: 220px; resize: vertical; padding: 12px; border: 1px solid #30384a; border-radius: 8px; background: #0b0e14; color: #edf0f7; font: inherit; }
.chat-composer textarea:focus { outline: 2px solid #7d92ff; outline-offset: 1px; }
.chat-composer button { border-radius: 8px; }

.nav-item .nav-badge { width: auto; margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; display: inline-grid; place-items: center; border-radius: 999px; background: #ef5350; color: #fff; font-size: 11px; font-weight: 700; line-height: 1; }
.nav-badge[hidden] { display: none; }
.messages-workspace { display: grid; grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); min-height: calc(100vh - 120px); border: 1px solid #293142; border-radius: 14px; overflow: hidden; background: #0d121b; }
.messages-inbox { min-width: 0; border-right: 1px solid #293142; background: #101620; }
.messages-inbox-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px; border-bottom: 1px solid #293142; }
.messages-inbox-head h2 { margin: 0 0 4px; font-size: 19px; }
.messages-inbox-head p { margin: 0; color: #8f9aad; font-size: 12px; }
.messages-inbox-head button { padding: 8px 10px; border-radius: 8px; }
.messages-search { display: flex; align-items: center; gap: 8px; margin: 12px; padding: 0 11px; border: 1px solid #30384a; border-radius: 9px; background: #0b0e14; }
.messages-search .ico { flex: none; width: 17px; height: 17px; color: #7f8ca1; }
.messages-search input { width: 100%; min-width: 0; padding: 10px 0; border: 0; outline: 0; background: transparent; color: #edf0f7; }
.messages-list { display: flex; flex-direction: column; max-height: calc(100vh - 240px); overflow: auto; }
.messages-chat-row { position: relative; display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; align-items: center; gap: 11px; width: 100%; padding: 13px 14px; border: 0; border-bottom: 1px solid #232b39; border-radius: 0; background: transparent; color: #dce3ef; text-align: left; }
.messages-chat-row:hover { background: #171e2a; transform: none; }
.messages-chat-row.active { background: #1b2535; box-shadow: inset 3px 0 #7d92ff; }
.messages-chat-row.unread .messages-chat-row-top strong { color: #fff; }
.messages-avatar { display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: #26334b; color: #aebdff; font-size: 15px; font-weight: 700; }
.messages-chat-body { display: grid; min-width: 0; gap: 4px; }
.messages-chat-row-top { display: flex; justify-content: space-between; gap: 8px; min-width: 0; }
.messages-chat-row-top strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.messages-chat-row-top time { flex: none; color: #7f8ca1; font-size: 10px; font-weight: 500; }
.messages-preview, .messages-chat-meta { overflow: hidden; color: #9aa6b9; font-size: 12px; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.messages-chat-meta { color: #6f7c90; font-size: 11px; }
.messages-count { display: inline-grid; place-items: center; min-width: 21px; height: 21px; padding: 0 6px; border-radius: 999px; background: #7d92ff; color: #09101d; font-size: 11px; font-weight: 800; }
.messages-conversation { min-width: 0; padding: 20px; background: #0b1018; }
.messages-placeholder { display: grid; place-content: center; height: 100%; min-height: 430px; color: #8f9aad; text-align: center; }
.messages-placeholder[hidden], #messages-active-chat[hidden] { display: none !important; }
.messages-placeholder strong { color: #dce3ef; font-size: 18px; }
.messages-placeholder p { margin: 7px 0 0; }
.messages-chat-head { display: flex; align-items: center; justify-content: flex-start; gap: 12px; padding: 0 0 16px; margin-bottom: 4px; border-bottom: 1px solid #293142; }
.messages-chat-head h3 { margin: 0 0 3px; color: #edf0f7; font-size: 17px; }
.messages-chat-head p { margin: 0; color: #8290a6; font-size: 12px; }
.messages-chat-title-row { display: flex; align-items: center; gap: 8px; }
.messages-chat-title-row h3 { margin: 0; }
.messages-language { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border: 1px solid #3d4c68; border-radius: 999px; background: #1a2538; color: #aebdff; font-size: 10px; font-weight: 800; letter-spacing: .06em; }
.messages-language[hidden] { display: none; }
.messages-username-copy { padding: 0; border: 0; border-radius: 4px; background: transparent; color: #8fa2c2; font: inherit; font-weight: 600; }
.messages-username-copy:hover { color: #c6d1ff; filter: none; text-decoration: underline; }
.messages-meta-separator { color: #5f6d82; }
.messages-conversation .chat-heading h4 { display: none; }
.messages-conversation .chat-messages { height: calc(100vh - 360px); min-height: 320px; max-height: none; }
@media (max-width: 680px) {
  .chat-composer { grid-template-columns: minmax(0, 1fr); }
  .chat-composer button { justify-self: end; }
  .chat-message { max-width: 95%; }
  .chat-messages { height: min(300px, 35dvh); max-height: none; }
  .messages-workspace { grid-template-columns: 1fr; min-height: 0; }
  .messages-inbox { border-right: 0; border-bottom: 1px solid #293142; }
  .messages-list { max-height: 340px; }
  .messages-conversation { padding: 14px; }
  .messages-conversation .chat-messages { height: min(360px, 42dvh); min-height: 260px; }
}
