:root {
  --control-height: 36px;
  --action-size: 32px;
  --action-compact-size: 32px;
  --icon-size: 16px;
  --control-radius: 7px;
  --card-radius: 10px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --focus-ring: 0 0 0 3px rgba(155, 108, 255, .2);
}

button,
input,
select,
a {
  -webkit-tap-highlight-color: transparent;
}

[hidden] { display: none !important; }

button,
.btn,
.icon-action,
.mini-btn,
.eye-btn {
  font-family: inherit;
}

input,
select {
  height: var(--control-height);
  min-height: var(--control-height);
  padding: 0 11px;
  border: 1px solid var(--border-control);
  border-radius: var(--control-radius);
  background: var(--surface-input);
  color: var(--text);
  line-height: 1;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

input:hover,
select:hover {
  border-color: var(--border-hover);
}

input:focus,
select:focus {
  border-color: var(--accent2);
  box-shadow: var(--focus-ring);
}

input:disabled,
select:disabled,
button:disabled,
.btn[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: .52;
}

input[readonly] {
  cursor: default;
  background: var(--surface-readonly);
  color: #d9e0f2;
}

input[type="datetime-local"] {
  color-scheme: dark;
}

.btn,
button.btn,
.login-submit {
  min-height: var(--control-height);
  height: var(--control-height);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: var(--control-radius);
  background: var(--accent);
  color: white;
  font: inherit;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: transform .16s ease, border-color .16s ease, background .16s ease, color .16s ease;
}

.btn svg,
button.btn svg,
.login-submit svg {
  width: var(--icon-size);
  height: var(--icon-size);
  flex: 0 0 var(--icon-size);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.btn:hover,
button.btn:hover,
.login-submit:hover {
  background: var(--accent2);
  transform: translateY(-1px);
}

.btn:active,
button.btn:active,
.login-submit:active,
.icon-action:active,
.refresh-btn:active,
.eye-btn:active {
  transform: translateY(0);
}

.btn:disabled:hover,
button.btn:disabled:hover,
.login-submit:disabled:hover,
.icon-action:disabled:hover,
.refresh-btn:disabled:hover {
  transform: none;
  filter: none;
}

.btn.ghost,
button.btn.ghost {
  border-color: var(--border);
  background: transparent;
  color: #d9e0f2;
}

.btn.ghost:hover,
button.btn.ghost:hover {
  border-color: var(--border-hover);
  background: rgba(255, 255, 255, .035);
  color: white;
}

:where(button, a, input, select):focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.icon-action {
  width: var(--action-size);
  min-width: var(--action-size);
  height: var(--action-size);
  min-height: var(--action-size);
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--border-control);
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  color: #bcaaff;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: transform .16s ease, border-color .16s ease, background .16s ease, color .16s ease;
}

.icon-action svg {
  width: var(--icon-size);
  height: var(--icon-size);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-action:hover {
  border-color: var(--accent2);
  background: var(--surface-hover);
  color: white;
  transform: translateY(-1px);
}

.icon-action.action-edit {
  color: #bcaaff;
}

.icon-action.action-reset {
  color: var(--info);
}

.icon-action.action-delete {
  color: #ff8585;
}

.icon-action.action-delete:hover {
  border-color: rgba(255, 107, 107, .65);
  background: rgba(255, 107, 107, .12);
}

.actions,
.reseller-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 5px;
  direction: ltr;
  flex-wrap: nowrap;
  min-height: var(--action-compact-size);
}

.actions form,
.reseller-actions form,
.toggle-form {
  display: inline-flex;
  align-items: center;
  margin: 0;
}

.switch-field {
  display: grid;
  align-content: start;
  justify-items: start;
  gap: var(--space-2);
  color: var(--text-secondary);
  font-size: 13px;
}

label.switch-control,
label.switch-control.switch-sm {
  position: relative;
  display: inline-block;
  width: 42px;
  min-width: 42px;
  height: 24px;
  cursor: pointer;
}

.switch-control input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.switch-track {
  position: relative;
  display: block;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: #555d70;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06);
  transition: background .2s ease, box-shadow .2s ease;
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  inset-inline-start: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .32);
  transition: transform .2s ease;
}

.switch-control input:checked + .switch-track {
  background: var(--accent);
}

.switch-control input:checked + .switch-track::after {
  transform: translateX(-18px);
}

.switch-control:hover .switch-track {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14);
}

.switch-control input:focus-visible + .switch-track {
  outline: none;
  box-shadow: var(--focus-ring);
}

.switch-control input:disabled + .switch-track {
  cursor: not-allowed;
  opacity: .52;
}

.input-with-action {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  direction: rtl;
}

.input-with-action > input,
.input-with-action > .password-wrap {
  min-width: 0;
  flex: 1;
}

.refresh-btn {
  width: 40px;
  min-width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--border-control);
  border-radius: 8px;
  background: var(--surface-raised);
  color: #cfd8ef;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, color .16s ease;
}

.refresh-btn:hover {
  border-color: var(--accent2);
  background: var(--surface-hover);
  color: white;
}

.refresh-btn svg {
  width: var(--icon-size);
  height: var(--icon-size);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.refresh-btn.is-loading svg {
  animation: ds-spin .8s linear infinite;
}

.refresh-btn:disabled {
  cursor: wait;
  opacity: .52;
}

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

.password-wrap {
  position: relative;
  display: block;
  width: 100%;
}

.password-wrap input {
  width: 100%;
  padding-inline-end: 44px;
}

.eye-btn {
  position: absolute;
  inset-inline-end: 2px;
  top: 50%;
  width: 32px;
  min-width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  margin: 0;
  padding: 0;
  transform: translateY(-50%);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: #aeb9cf;
  cursor: pointer;
  transition: background .16s ease, color .16s ease;
}

.eye-btn:hover {
  background: rgba(124, 77, 255, .12);
  color: white;
}

.eye-btn svg {
  width: var(--icon-size);
  height: var(--icon-size);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.eye-btn .eye-closed {
  display: none;
}

.eye-btn.is-visible .eye-open {
  display: none;
}

.eye-btn.is-visible .eye-closed {
  display: block;
}

.card {
  padding: var(--space-4);
  border-radius: var(--card-radius);
  margin-bottom: var(--space-4);
}

.grid {
  gap: 14px 16px;
}

.form label,
.modal-form label,
.login-card label {
  gap: 6px;
}

.form h2:not(:first-child) {
  margin-top: 6px;
}

.section-head {
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-top: var(--space-4);
}

.switches {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin: var(--space-4) 0;
}

.expiry-stack {
  display: grid;
  gap: var(--space-4);
}

.create-client-shell {
  width: 100%;
  max-width: 1050px;
  margin-inline: auto;
}

.create-client-page {
  direction: rtl;
  text-align: right;
}

.client-form-card {
  max-width: none;
  padding: 22px 24px;
  border-radius: 10px;
}

.create-client-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 20px;
  row-gap: 18px;
  align-items: start;
}

.client-form .form-field {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 6px;
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  text-align: right;
}

.client-form .form-label {
  display: block;
  min-width: 0;
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  line-height: 18px;
  text-align: right;
}

.client-form input,
.client-form select,
.client-form .btn {
  height: 40px;
  min-height: 40px;
  border-radius: 8px;
}

.client-form input,
.client-form select {
  padding-inline: 12px;
}

.client-form .technical-input {
  direction: ltr;
  text-align: left;
  unicode-bidi: isolate;
}

.admin-reseller-field {
  grid-column: 1 / -1;
  width: calc(50% - 10px);
  justify-self: start;
}

.field-with-action,
.credential-field {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  direction: rtl;
}

.field-with-action input,
.credential-field input {
  min-width: 0;
  flex: 1;
}

.client-form .generate-btn {
  flex: 0 0 40px;
  width: 40px;
  min-width: 40px;
  height: 40px;
  border-radius: 8px;
}

.client-form .credential-eye-btn {
  position: relative;
  inset: auto;
  top: auto;
  width: 40px;
  min-width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border: 1px solid var(--border-control);
  border-radius: 8px;
  background: var(--surface-raised);
  transform: none;
}

.client-form .credential-eye-btn:hover {
  border-color: var(--accent2);
  background: var(--surface-hover);
}

.client-form .credential-eye-btn:active {
  transform: none;
}

.client-form .generate-btn svg {
  width: 16px;
  height: 16px;
}

.field-error {
  display: block;
  color: #ff9b9b;
  font-size: 10px;
  font-weight: 400;
  line-height: 16px;
  overflow-wrap: anywhere;
}

.field-error:empty { display: none; }

.compact-switch-field {
  min-height: 64px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  align-content: center;
  column-gap: 12px;
  padding: 12px;
  border: 1px solid var(--border-control);
  border-radius: 8px;
  background: var(--surface-input);
}

.compact-switch-field .form-label {
  align-self: center;
}

.compact-switch-field .switch-control {
  align-self: center;
}

.expiry-mode-field {
  gap: 6px;
}

.expiry-mode-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 24px;
}

.expiry-mode-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}

.expiry-mode-toggle .switch-control {
  flex: 0 0 auto;
}

.expiry-mode-control.is-inactive {
  display: none;
}

.date-input-wrap {
  position: relative;
  display: block;
  min-width: 0;
}

.date-input-wrap input {
  width: 100%;
  direction: rtl;
  text-align: right;
}

.date-placeholder {
  position: absolute;
  inset-inline-start: 12px;
  top: 50%;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  line-height: 1;
  transform: translateY(-50%);
  pointer-events: none;
}

.date-input-wrap.has-value .date-placeholder,
.date-input-wrap:focus-within .date-placeholder,
.date-input-wrap input:disabled + .date-placeholder {
  display: none;
}

.date-input-wrap:not(.has-value):not(:focus-within) input::-webkit-datetime-edit {
  color: transparent;
}

.input-suffix {
  position: relative;
  display: block;
  min-width: 0;
}

.input-suffix input {
  width: 100%;
  padding-inline-end: 46px;
}

.input-suffix > span {
  position: absolute;
  inset-inline-end: 12px;
  top: 50%;
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
  transform: translateY(-50%);
  pointer-events: none;
}

.client-form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.client-form-actions .primary-submit {
  padding-inline: 18px;
}

@media (max-width: 860px) {
  .create-client-grid { grid-template-columns: minmax(0, 1fr); }
  .admin-reseller-field { grid-column: auto; width: auto; }
}

@media (max-width: 720px) {
  .client-form-card { padding: 18px 16px; }
}

@media (max-width: 480px) {
  .client-form-card { padding: 16px 14px; }
  .client-form .technical-input { font-size: 13px; text-overflow: ellipsis; }
  .client-form-actions { flex-wrap: wrap; }
}

@media (max-width: 360px) {
  .client-form-card { padding-inline: 12px; }
  .client-form-actions .btn { flex: 1; padding-inline: 10px; }
}

.search {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.search input {
  min-width: 280px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table {
  table-layout: fixed;
}

th,
td {
  height: 58px;
  padding: 8px 10px;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  white-space: nowrap;
  background: rgba(255, 255, 255, .012);
}

td {
  border-bottom: 1px solid rgba(38, 50, 77, .65);
}

tbody tr:last-child td {
  border-bottom: 0;
}

.status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 3px 9px;
  border-radius: 6px;
  line-height: 1;
  white-space: nowrap;
}

.status,
.online-status,
.metric-badge {
  border: 1px solid transparent;
  font-weight: 500;
}

.status.ok {
  border-color: rgba(61, 220, 151, .2);
  background: rgba(61, 220, 151, .1);
  color: var(--success);
}

.status.off {
  border-color: rgba(255, 107, 107, .18);
  background: rgba(255, 107, 107, .09);
  color: #ff8585;
}

.table-card {
  padding: 0;
  overflow: hidden;
}

.table-card .table-heading {
  margin: 0;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.table-card > .table-scroll {
  border-radius: 0 0 var(--card-radius) var(--card-radius);
}

.table-card th,
.table-card td {
  height: 58px;
  padding: 8px 10px;
}

.table-card thead {
  background: rgba(255, 255, 255, .012);
}

.table-card tbody tr {
  transition: background .16s ease;
}

.table-card tbody tr:hover {
  background: rgba(255, 255, 255, .018);
}

.table-actions {
  gap: var(--space-1);
  direction: ltr;
  white-space: nowrap;
}

.table-actions .icon-action {
  width: var(--action-compact-size);
  min-width: var(--action-compact-size);
  height: var(--action-compact-size);
  min-height: var(--action-compact-size);
  border-color: var(--border-control);
  border-radius: var(--radius-sm);
  background: rgba(24, 34, 58, .72);
}

.table-actions .icon-action svg {
  width: var(--icon-size);
  height: var(--icon-size);
}

.table-actions .icon-action:hover {
  border-color: var(--primary-hover);
  background: var(--surface-hover);
}

.table-actions .icon-action.action-reset:hover {
  border-color: rgba(103, 183, 255, .55);
  background: rgba(103, 183, 255, .1);
}

.table-actions .icon-action.action-delete:hover {
  background: rgba(255, 107, 107, .1);
}

.online-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 26px;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 11px;
  white-space: nowrap;
}

.online-status i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 16%, transparent);
}

.online-status.online {
  background: rgba(61, 220, 151, .1);
  color: var(--ok);
  border-color: rgba(61, 220, 151, .18);
}

.online-status.offline {
  background: rgba(255, 107, 107, .09);
  color: #ff8585;
  border-color: rgba(255, 107, 107, .16);
}

.online-status.unknown {
  background: rgba(143, 155, 182, .1);
  color: var(--muted);
  border-color: rgba(143, 155, 182, .14);
}

.traffic-cell {
  min-width: 190px;
}

.traffic-meter {
  width: 100%;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #2a3244;
}

.traffic-meter i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
  transition: width .25s ease;
}

.metric-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 11px;
  white-space: nowrap;
}

.metric-badge.ok {
  background: rgba(61, 220, 151, .1);
  color: var(--ok);
}

.metric-badge.warning {
  background: rgba(255, 190, 92, .1);
  color: #ffc267;
}

.metric-badge.danger {
  background: rgba(255, 107, 107, .1);
  color: #ff8585;
}

.metric-badge.pending {
  background: rgba(103, 183, 255, .1);
  color: #67b7ff;
}

.metric-badge.unlimited {
  background: rgba(155, 108, 255, .1);
  color: #bcaaff;
}

.metric-badge.unknown {
  background: rgba(143, 155, 182, .1);
  color: var(--muted);
}

.modal-card {
  width: min(620px, calc(100vw - 32px));
  min-width: 0;
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 18px;
  border-radius: 12px;
}

.modal-card:focus-visible { outline: none; }

.create-client-modal {
  width: min(720px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  padding: 0;
  overflow: hidden;
  border-radius: 10px;
  direction: rtl;
}

.create-client-modal-header {
  min-height: 66px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px 12px;
  border-bottom: 1px solid var(--border);
}

.create-client-modal-header h2 {
  margin: 0;
  color: var(--text);
  font-size: 17px;
  line-height: 24px;
}

.create-client-modal-header p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 18px;
}

.create-client-modal-content {
  min-height: 180px;
  max-height: calc(100vh - 108px);
  overflow: hidden;
}

.create-client-form {
  max-height: calc(100vh - 108px);
  display: flex;
  flex-direction: column;
}

.create-client-modal-body {
  min-height: 0;
  padding: 20px 24px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.create-client-form .create-client-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 20px;
}

.create-client-form .form-field {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 6px;
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  text-align: right;
}

.create-client-form .form-label {
  min-width: 0;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  line-height: 18px;
  text-align: right;
}

.create-client-form input:not([type="hidden"]),
.create-client-form .date-picker-trigger {
  width: 100%;
  height: 40px;
  min-height: 40px;
  border-radius: 8px;
}

.create-client-form input:not([type="hidden"]) {
  padding-inline: 12px;
}

.create-client-form .field-with-action {
  display: flex;
  align-items: center;
  gap: 8px;
  direction: rtl;
}

.create-client-form .field-with-action input {
  min-width: 0;
  flex: 1;
}

.create-client-form .refresh-btn {
  flex: 0 0 40px;
  width: 40px;
  min-width: 40px;
  height: 40px;
}

.credential-readonly {
  direction: ltr;
  text-align: left;
  cursor: default;
  color: #cbd4e8;
  background: rgba(8, 15, 29, .72);
}

.credential-readonly:focus {
  cursor: default;
}

.create-client-form .expiry-mode-header {
  min-height: 18px;
}

.create-client-form .expiry-mode-toggle {
  font-size: 10px;
}

.create-client-form .expiry-mode-toggle .switch-control {
  position: relative;
  display: inline-block;
  width: 42px;
  min-width: 42px;
  height: 24px;
}

.date-only-picker {
  position: relative;
  min-width: 0;
}

.date-picker-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 12px;
  border: 1px solid var(--border-control);
  background: var(--surface-input);
  color: var(--muted);
  font: inherit;
  text-align: right;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, box-shadow .16s ease;
}

.date-picker-trigger:hover {
  border-color: var(--accent2);
  background: var(--surface-hover);
}

.date-picker-trigger:focus-visible {
  outline: none;
  border-color: var(--accent2);
  box-shadow: var(--focus-ring);
}

.date-picker-trigger svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.date-picker-value.has-value {
  direction: ltr;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.date-calendar {
  position: absolute;
  z-index: 20;
  inset-block-start: calc(100% + 6px);
  inset-inline-start: 0;
  width: min(286px, 100%);
  padding: 10px;
  border: 1px solid var(--border-control);
  border-radius: 9px;
  background: #111a2d;
  box-shadow: 0 18px 42px rgba(0, 0, 0, .42);
}

.date-calendar[hidden] { display: none; }

.date-calendar-head {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 30px;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.date-calendar-head strong {
  color: var(--text);
  font-size: 12px;
  text-align: center;
}

.date-calendar-head button,
.date-calendar-days button {
  display: grid;
  place-items: center;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
}

.date-calendar-head button {
  width: 30px;
  height: 30px;
}

.date-calendar-head svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

.date-calendar-week,
.date-calendar-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 3px;
}

.date-calendar-week {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 9px;
  text-align: center;
}

.date-calendar-days button,
.date-calendar-spacer {
  height: 29px;
  font-size: 10px;
}

.date-calendar-days button:hover {
  background: var(--surface-hover);
  color: white;
}

.date-calendar-days button.selected {
  background: var(--accent);
  color: white;
}

.duration-days-wrapper {
  position: relative;
  display: block;
  min-width: 0;
}

.create-client-form .duration-days-input {
  padding-inline-start: 48px;
  padding-inline-end: 12px;
}

.duration-days-suffix {
  position: absolute;
  inset-inline-start: 12px;
  inset-inline-end: auto;
  top: 50%;
  color: var(--muted);
  font-size: 11px;
  transform: translateY(-50%);
  pointer-events: none;
}

.create-client-form input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

.create-client-form input[type="number"]::-webkit-inner-spin-button,
.create-client-form input[type="number"]::-webkit-outer-spin-button {
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
}

.create-client-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 12px 24px 18px;
  border-top: 1px solid var(--border);
}

.create-client-modal-footer .btn {
  height: 40px;
  min-height: 40px;
  border-radius: 8px;
}

.credit-preview {
  display: flex;
  align-items: center;
  gap: 10px 22px;
  min-height: 42px;
  margin-top: 16px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--primary) 5%, var(--surface));
  color: var(--muted);
  font-size: .82rem;
}
.credit-preview b { margin-inline-start: 5px; color: var(--text); font-variant-numeric: tabular-nums; }
.credit-preview small { margin-inline-start: auto; color: var(--danger); font-weight: 700; }
.credit-preview.is-insufficient { border-color: color-mix(in srgb, var(--danger) 55%, var(--line)); background: color-mix(in srgb, var(--danger) 7%, var(--surface)); }
.create-client-error { white-space: pre-line; }

/* Reseller dashboard: allocated credit and actual traffic intentionally use
   separate visual groups because they are separate accounting concepts. */
.reseller-dashboard { display: grid; gap: 16px; }
.credit-overview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 0;
  overflow: hidden;
}
.credit-stat { display: grid; gap: 5px; padding: 18px 20px 14px; border-inline-end: 1px solid var(--line); }
.credit-stat:nth-child(3) { border-inline-end: 0; }
.credit-stat span, .traffic-kpi span { color: var(--muted); font-size: .8rem; }
.credit-stat strong { font-size: 1.4rem; font-variant-numeric: tabular-nums; }
.credit-stat.used strong { color: var(--warning); }
.credit-stat.remaining strong { color: var(--success); }
.credit-progress { grid-column: 1 / -1; height: 6px; margin: 0 20px; border-radius: 99px; background: var(--surface-input); overflow: hidden; }
.credit-progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent2)); }
.credit-percent { grid-column: 1 / -1; padding: 8px 20px 14px; color: var(--muted); }
.traffic-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.traffic-kpi { display: grid; gap: 5px; padding: 14px 16px; }
.traffic-kpi strong { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.dashboard-main-grid { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(280px, .8fr); gap: 16px; }
.usage-chart-card, .account-card, .credit-history-card { padding: 18px 20px; }
.usage-chart-card .section-head, .account-card .section-head, .credit-history-card .section-head { margin-bottom: 16px; }
.usage-chart-card h2, .account-card h2, .credit-history-card h2 { margin: 0; font-size: 1rem; }
.usage-chart-card .section-head small, .credit-history-card .section-head small { color: var(--muted); font-size: .74rem; }
.yesterday-usage { color: var(--muted); font-size: .76rem; }
.usage-chart { display: grid; grid-template-columns: repeat(7, minmax(32px, 1fr)); gap: 10px; height: 225px; padding-top: 8px; direction: ltr; }
.usage-bar-column { display: grid; grid-template-rows: 24px 1fr 20px; align-items: end; justify-items: center; min-width: 0; }
.usage-value { color: var(--muted); font-size: .68rem; }
.usage-bar-track { position: relative; width: min(28px, 70%); height: 100%; border-radius: 5px 5px 2px 2px; background: var(--surface-input); overflow: hidden; }
.usage-bar-track span { position: absolute; inset-inline: 0; bottom: 0; min-height: 4px; border-radius: inherit; background: linear-gradient(180deg, var(--accent2), var(--accent)); }
.usage-bar-column small { color: var(--muted); font-size: .66rem; }
.account-details { display: grid; gap: 0; margin: 0; }
.account-details div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.account-details div:last-child { border-bottom: 0; }
.account-details dt { color: var(--muted); font-size: .76rem; }
.account-details dd { margin: 0; font-size: .78rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.credit-transaction-list { display: grid; }
.credit-transaction { display: grid; grid-template-columns: 110px minmax(0, 1fr) 90px; gap: 14px; align-items: center; min-height: 56px; border-bottom: 1px solid var(--line); }
.credit-transaction:last-child { border-bottom: 0; }
.transaction-sign { font-weight: 800; font-variant-numeric: tabular-nums; }
.transaction-sign.positive { color: var(--success); }
.transaction-sign.negative { color: var(--danger); }
.transaction-detail { display: grid; gap: 3px; min-width: 0; }
.transaction-detail b { font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.transaction-detail small, .credit-transaction time { color: var(--muted); font-size: .7rem; }
.credit-transaction time { text-align: end; }
.compact-empty { padding: 24px; }
.credit-stack { display: grid; gap: 2px; }
.credit-stack small { color: var(--muted); font-size: .68rem; white-space: nowrap; }

/* Admin dashboard monitors reseller credit only; it deliberately has no client UI. */
.admin-dashboard { display: grid; min-width: 0; gap: 16px; }
.admin-dashboard-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.admin-dashboard-head h2 { margin: 0 0 3px; font-size: 1.05rem; }
.admin-dashboard-head p { margin: 0; color: var(--muted); font-size: .76rem; }
.admin-quick-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.admin-summary { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0; padding: 12px; }
.admin-stat { min-width: 0; display: flex; align-items: center; gap: 10px; padding: 5px 12px; border-inline-end: 1px solid var(--line); }
.admin-stat:last-child { border-inline-end: 0; }
.admin-stat-icon { display: grid; place-items: center; width: 38px; height: 38px; flex: 0 0 38px; border-radius: 8px; color: var(--accent2); background: rgba(155,108,255,.1); }
.admin-stat-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.admin-stat > span:last-child { display: grid; min-width: 0; gap: 2px; }
.admin-stat strong { overflow: hidden; color: var(--text); font-size: 1.12rem; line-height: 1.1; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.admin-stat small { color: var(--muted); font-size: .67rem; white-space: nowrap; }
.admin-stat.active .admin-stat-icon, .admin-stat.remaining-credit .admin-stat-icon { color: var(--success); background: rgba(50,215,150,.1); }
.admin-stat.inactive .admin-stat-icon { color: var(--danger); background: rgba(255,105,110,.1); }
.admin-stat.used-credit .admin-stat-icon { color: var(--warning); background: rgba(255,194,103,.1); }
.admin-dashboard-main { display: grid; grid-template-columns: minmax(0,1.6fr) minmax(300px,1fr); gap: 16px; }
.admin-credit-chart-card, .admin-credit-health, .admin-attention-card, .admin-transactions-card, .admin-system-card, .admin-activity-card { min-width: 0; padding: 16px; }
.admin-dashboard .section-head { margin-bottom: 14px; }
.admin-dashboard .section-head h2 { margin: 0; font-size: .94rem; }
.admin-dashboard .section-head small { color: var(--muted); font-size: .69rem; }
.metric-chip { display: grid; justify-items: end; gap: 1px; }
.metric-chip b { font-size: .84rem; }
.metric-chip small { font-size: .62rem !important; }
.metric-chip em { font-size: .62rem; font-style: normal; }
.metric-chip em.up { color: var(--danger); }
.metric-chip em.down { color: var(--success); }
.admin-credit-chart { display: grid; grid-template-columns: repeat(7,minmax(32px,1fr)); gap: 10px; height: 210px; direction: ltr; }
.admin-chart-column { display: grid; grid-template-rows: 22px 1fr 20px; align-items: end; justify-items: center; min-width: 0; }
.admin-chart-column > span, .admin-chart-column small { color: var(--muted); font-size: .63rem; }
.admin-chart-column > div { position: relative; width: min(30px,72%); height: 100%; overflow: hidden; border-radius: 5px 5px 2px 2px; background: var(--surface-input); }
.admin-chart-column i { position: absolute; inset-inline: 0; bottom: 0; min-height: 4px; border-radius: inherit; background: linear-gradient(180deg,var(--accent2),var(--accent)); }
.credit-health-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.credit-health-list > div { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-input); }
.credit-health-list > div > span { position: relative; display: grid; gap: 1px; padding-inline-start: 14px; }
.credit-health-list i { position: absolute; inset-inline-start: 0; top: 6px; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.credit-health-list b { font-size: .72rem; }
.credit-health-list small { color: var(--muted); font-size: .59rem; }
.credit-health-list strong { font-size: 1rem; }
.credit-health-list .healthy { color: var(--success); }
.credit-health-list .depleting { color: var(--warning); }
.credit-health-list .critical { color: #ff906b; }
.credit-health-list .exhausted { color: var(--danger); }
.admin-today { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.admin-today h3 { margin: 0 0 8px; color: var(--muted); font-size: .7rem; }
.admin-today > div { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; }
.admin-today span { display: grid; gap: 2px; }
.admin-today b { font-size: .78rem; font-variant-numeric: tabular-nums; }
.admin-today small { color: var(--muted); font-size: .58rem; }
.admin-attention-card .section-head > a { color: var(--accent2); font-size: .7rem; text-decoration: none; }
.admin-attention-card .table-scroll { min-width: 0; max-width: 100%; }
.admin-attention-table { table-layout: fixed; min-width: 980px; }
.admin-attention-table th, .admin-attention-table td { padding-inline: 10px; }
.admin-attention-table th:first-child { width: 180px; }
.admin-attention-table th:last-child { width: 150px; }
.admin-attention-table td:first-child b, .admin-attention-table td:first-child small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-attention-table td:first-child small { margin-top: 3px; color: var(--muted); font-size: .65rem; }
.credit-health-badge { display: inline-flex; padding: 3px 7px; border-radius: 5px; font-size: .66rem; background: rgba(140,150,175,.1); color: var(--muted); }
.credit-health-badge.healthy { color: var(--success); background: rgba(50,215,150,.1); }
.credit-health-badge.depleting { color: var(--warning); background: rgba(255,194,103,.1); }
.credit-health-badge.critical, .credit-health-badge.exhausted, .credit-health-badge.inactive { color: var(--danger); background: rgba(255,105,110,.1); }
.reseller-credit-progress { width: 100%; height: 5px; margin-bottom: 4px; overflow: hidden; border-radius: 99px; background: var(--surface-input); }
.reseller-credit-progress span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.reseller-credit-progress.warning span { background: var(--warning); }
.reseller-credit-progress.danger span { background: var(--danger); }
.admin-attention-table td[data-label="درصد مصرف"] > small { color: var(--muted); font-size: .62rem; }
.attention-actions { display: flex; gap: 6px; white-space: nowrap; }
.mini-link { display: inline-flex; align-items: center; min-height: 28px; padding: 0 8px; border: 1px solid var(--line); border-radius: 6px; color: var(--text); font-size: .64rem; text-decoration: none; }
.mini-link:hover { border-color: var(--accent2); color: var(--accent2); }
.mini-link.primary { background: rgba(124,77,255,.1); color: var(--accent2); }
.admin-bottom-grid { display: grid; grid-template-columns: minmax(0,1.55fr) minmax(290px,.65fr); gap: 16px; }
.admin-transaction-list { display: grid; }
.admin-transaction-list article { display: grid; grid-template-columns: 90px minmax(130px,1fr) 190px 78px; gap: 10px; align-items: center; min-height: 48px; border-bottom: 1px solid var(--line); }
.admin-transaction-list article:last-child { border-bottom: 0; }
.admin-transaction-amount { font-size: .76rem; font-weight: 800; }
.admin-transaction-amount.positive { color: var(--success); }
.admin-transaction-amount.negative { color: var(--danger); }
.admin-transaction-amount.neutral, .transaction-sign.neutral { color: var(--muted); }
.admin-transaction-list article > span:nth-child(2) { display: grid; min-width: 0; gap: 2px; }
.admin-transaction-list article > span:nth-child(2) b { overflow: hidden; font-size: .72rem; text-overflow: ellipsis; white-space: nowrap; }
.admin-transaction-list article > span:nth-child(2) small, .balance-change, .admin-transaction-list time { color: var(--muted); font-size: .62rem; }
.admin-side-stack { display: grid; align-content: start; gap: 16px; }
.admin-system-card dl { display: grid; margin: 0; }
.admin-system-card dl > div { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.admin-system-card dl > div:last-child { border-bottom: 0; }
.admin-system-card dt, .admin-system-card dd { margin: 0; font-size: .7rem; }
.admin-system-card dd { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.admin-system-card dd i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.admin-system-card dd.ok { color: var(--success); }
.admin-activity-card > div:last-child { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 6px; }
.admin-activity-card span { display: grid; gap: 2px; }
.admin-activity-card b { font-size: 1rem; }
.admin-activity-card small { color: var(--muted); font-size: .58rem; }
.admin-empty { display: grid; justify-items: center; gap: 8px; padding: 42px 20px; text-align: center; }
.admin-empty-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 10px; color: var(--accent2); background: rgba(124,77,255,.12); font-size: 1.5rem; }
.admin-empty h2, .admin-empty p { margin: 0; }
.admin-empty h2 { font-size: 1rem; }
.admin-empty p { color: var(--muted); font-size: .74rem; }

@media (max-width: 1200px) {
  .admin-summary { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .admin-stat:nth-child(3) { border-inline-end: 0; }
  .admin-stat:nth-child(n+4) { margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
  .admin-bottom-grid { grid-template-columns: 1fr; }
  .admin-side-stack { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 980px) {
  .admin-dashboard-main, .admin-bottom-grid { grid-template-columns: 1fr; }
  .admin-side-stack { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 720px) {
  .admin-dashboard-head { align-items: flex-start; flex-direction: column; }
  .admin-summary { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .admin-stat:nth-child(2n) { border-inline-end: 0; }
  .admin-stat:nth-child(3) { border-inline-end: 1px solid var(--line); }
  .admin-stat:nth-child(n+3) { margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
  .admin-attention-card .table-scroll { overflow: visible; }
  .admin-attention-card .admin-attention-table, .admin-attention-table tbody { display: grid; min-width: 0; gap: 10px; }
  .admin-attention-table thead { display: none; }
  .admin-attention-table tr { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
  .admin-attention-table td { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; height: auto; padding: 0; border: 0; font-size: .7rem; }
  .admin-attention-table td::before { content: attr(data-label); color: var(--muted); font-size: .62rem; }
  .admin-attention-table td:first-child, .admin-attention-table td:last-child { grid-column: 1 / -1; }
  .admin-attention-table td:first-child { display: grid; grid-template-columns: 1fr auto; }
  .admin-attention-table td:first-child::before { grid-column: 2; grid-row: 1 / span 2; }
  .admin-attention-table td[data-label="درصد مصرف"] { display: grid; grid-template-columns: auto 1fr auto; }
  .admin-attention-table td[data-label="درصد مصرف"]::before { content: attr(data-label); }
  .admin-attention-table td:last-child::before { display: none; }
  .attention-actions { width: 100%; }
  .attention-actions .mini-link { flex: 1; justify-content: center; }
  .admin-transaction-list article { grid-template-columns: 82px minmax(0,1fr) 70px; padding: 8px 0; }
  .balance-change { grid-column: 2 / -1; grid-row: 2; }
  .admin-side-stack { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .admin-quick-actions { width: 100%; }
  .admin-quick-actions .btn { flex: 1; }
  .admin-summary { padding: 8px; }
  .admin-stat { gap: 7px; padding-inline: 7px; }
  .admin-stat-icon { width: 32px; height: 32px; flex-basis: 32px; }
  .admin-stat strong { font-size: .86rem; }
  .admin-stat small { font-size: .58rem; }
  .admin-credit-chart-card, .admin-credit-health, .admin-attention-card, .admin-transactions-card, .admin-system-card, .admin-activity-card { padding: 12px; }
  .credit-health-list { grid-template-columns: 1fr; }
  .admin-credit-chart { gap: 4px; height: 180px; }
  .admin-chart-column > div { width: min(22px,75%); }
  .admin-attention-table tr { grid-template-columns: 1fr; }
  .admin-attention-table td, .admin-attention-table td:first-child, .admin-attention-table td:last-child { grid-column: 1; }
  .admin-attention-table td:first-child { grid-template-columns: 1fr; }
  .admin-attention-table td:first-child::before { display: none; }
  .admin-attention-table tbody tr:nth-child(n+6) { display: none; }
}

@media (max-width: 900px) {
  .dashboard-main-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .credit-preview { align-items: flex-start; flex-direction: column; gap: 4px; }
  .credit-preview small { margin-inline-start: 0; }
  .credit-overview { grid-template-columns: 1fr 1fr; }
  .credit-stat { padding: 14px; }
  .credit-stat:first-child { grid-column: 1 / -1; border-bottom: 1px solid var(--line); border-inline-end: 0; }
  .credit-stat:nth-child(2) { border-inline-end: 1px solid var(--line); }
  .credit-stat strong { font-size: 1.08rem; }
  .traffic-kpis { grid-template-columns: 1fr; gap: 8px; }
  .traffic-kpi { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; }
  .usage-chart-card, .account-card, .credit-history-card { padding: 14px; }
  .usage-chart-card .section-head { align-items: flex-start; }
  .usage-chart { gap: 4px; height: 190px; }
  .usage-bar-track { width: min(22px, 76%); }
  .usage-value { font-size: .58rem; }
  .credit-transaction { grid-template-columns: 88px minmax(0, 1fr); gap: 10px; padding: 9px 0; }
  .credit-transaction time { grid-column: 2; text-align: start; }
  .transaction-detail small { white-space: normal; }
}

.create-client-modal-loading,
.create-client-load-error {
  min-height: 180px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.create-client-modal-loading span {
  width: 24px;
  height: 24px;
  border: 2px solid rgba(155, 108, 255, .25);
  border-top-color: var(--accent2);
  border-radius: 50%;
  animation: ds-spin .7s linear infinite;
}

.create-client-modal-loading p,
.create-client-load-error p { margin: 0; font-size: 12px; }

@media (max-width: 640px) {
  .create-client-modal {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
  }
  .create-client-modal-header { padding-inline: 16px; }
  .create-client-modal-content,
  .create-client-form { max-height: calc(100vh - 84px); }
  .create-client-modal-body { padding: 16px; }
  .create-client-form .create-client-grid { grid-template-columns: minmax(0, 1fr); }
  .create-client-modal-footer { padding: 12px 16px 16px; }
  .date-calendar {
    position: relative;
    inset: auto;
    width: 100%;
    margin-top: 6px;
  }
}

.modal-form {
  display: grid;
  gap: var(--space-4);
}

.login-card {
  width: min(420px, 100%);
  padding: 24px;
  border-radius: 10px;
}

.login-card .login-submit {
  width: 100%;
  margin-top: var(--space-2);
}

.technical-input,
input[dir="ltr"],
dd[dir="ltr"] {
  direction: ltr;
  text-align: left;
  font-variant-numeric: tabular-nums;
}

input[type="number"],
input[type="datetime-local"] {
  direction: ltr;
  text-align: left;
  font-variant-numeric: tabular-nums;
}

.btn,
.icon-action,
.refresh-btn,
.login-submit {
  position: relative;
}

.btn.is-loading,
.icon-action.is-loading,
.login-submit.is-loading {
  color: transparent;
  pointer-events: none;
}

.btn.is-loading::after,
.icon-action.is-loading::after,
.login-submit.is-loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 15px;
  height: 15px;
  margin: -9px 0 0 -9px;
  border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: white;
  border-radius: 50%;
  animation: ds-spin .7s linear infinite;
}

.toggle-form.is-loading .switch-control {
  cursor: wait;
  opacity: .62;
  pointer-events: none;
}

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

  .table-card {
    overflow: hidden;
  }

  .table-scroll {
    overflow: auto;
    scrollbar-width: thin;
  }

  .data-table {
    min-width: 720px;
  }

  .actions,
  .reseller-actions {
    min-width: max-content;
  }
}

@media (max-width: 480px) {
  .card {
    padding: 12px;
    border-radius: 10px;
  }

  .section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .search {
    width: 100%;
  }

  .search input {
    min-width: 0;
    flex: 1;
  }

  .section-head > .btn {
    width: 100%;
  }

  .form-actions .btn {
    flex: 1;
  }

  .login-wrap {
    padding: 12px;
  }

  .login-card {
    padding: 20px 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* Client management — compact density inspired by the upstream client view. */
.clients-summary {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0;
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 10px;
}

.client-stat {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 2px 12px;
  border-inline-end: 1px solid rgba(51, 64, 95, .62);
  color: var(--muted);
  direction: rtl;
  font-size: 11px;
}

.client-stat:last-child { border-inline-end: 0; }
.client-stat b { color: var(--text); font-size: 15px; font-variant-numeric: tabular-nums; }

.stat-mark {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent2);
  box-shadow: 0 0 0 3px rgba(155, 108, 255, .1);
}

.stat-mark.online,
.stat-mark.active { background: var(--ok); box-shadow: 0 0 0 3px rgba(61, 220, 151, .1); }
.stat-mark.ended { background: #ff7373; box-shadow: 0 0 0 3px rgba(255, 115, 115, .1); }
.stat-mark.depleting { background: #ffc267; box-shadow: 0 0 0 3px rgba(255, 194, 103, .1); }
.stat-mark.disabled { background: #8994ab; box-shadow: 0 0 0 3px rgba(137, 148, 171, .1); }

.clients-list-card {
  padding: 0;
  overflow: hidden;
  border-radius: 10px;
}

.clients-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(51, 64, 95, .72);
}

.client-filters {
  min-width: 0;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}

.client-filters input:not([type="hidden"]),
.client-filters select,
.clients-list-head .create-client {
  height: 36px;
  min-height: 36px;
  border-radius: 7px;
  font-size: 12px;
}

.client-filters[aria-busy="true"] .search-box::after {
  content: "";
  position: absolute;
  top: 50%;
  inset-inline-end: 13px;
  width: 14px;
  height: 14px;
  margin-top: -7px;
  border: 2px solid rgba(155, 108, 255, .25);
  border-top-color: var(--accent2);
  border-radius: 50%;
  animation: ds-spin .7s linear infinite;
}

.search-box {
  position: relative;
  width: min(320px, 34vw);
  min-width: 220px;
}

.search-box input {
  width: 100%;
  padding-inline-start: 42px;
}

.search-box > svg {
  position: absolute;
  z-index: 1;
  top: 50%;
  inset-inline-start: 14px;
  width: var(--icon-size);
  height: var(--icon-size);
  transform: translateY(-50%);
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.client-filters select {
  width: auto;
  min-width: 142px;
  padding-inline: 10px 28px;
}

.client-filters select[name="sort"] { min-width: 128px; }
.clients-list-head .create-client { padding-inline: 13px; }

.filter-error {
  margin: 10px 12px 0;
  padding: 7px 10px;
  border: 1px solid rgba(255, 107, 107, .25);
  border-radius: 8px;
  background: rgba(255, 107, 107, .08);
  color: #ffaaaa;
  font-size: 12px;
}

.runtime-notice {
  margin: 10px 12px 0;
  padding: 7px 10px;
  border: 1px solid rgba(103, 183, 255, .2);
  border-radius: 8px;
  background: rgba(103, 183, 255, .07);
  color: #9bcfff;
  font-size: 12px;
}

.connection-banner {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 14px;
}

.connection-banner svg {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.reseller-connection { margin: 0 0 12px; }

.table-scroll {
  width: 100%;
  overflow: auto;
  border-radius: inherit;
  scrollbar-width: thin;
}

.clients-list-card .table-scroll {
  max-height: calc(100vh - 286px);
}

.clients-table {
  min-width: 1216px;
  table-layout: fixed;
  direction: ltr;
}

.clients-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface);
  box-shadow: 0 1px 0 var(--line);
}

.clients-table .actions-column { width: 216px; }
.clients-table .enabled-column { width: 90px; }
.clients-table .online-column { width: 110px; }
.clients-table .client-column { width: 220px; }
.clients-table .traffic-column { width: 300px; }
.clients-table .remaining-column { width: 150px; }
.clients-table .duration-column { width: 130px; }

.clients-table th,
.clients-table td {
  height: 58px;
  padding: 8px 12px;
  direction: rtl;
  text-align: right;
}

.clients-table th {
  height: 44px;
  color: #99a5bd;
  font-size: 12px;
  letter-spacing: .01em;
}

.clients-table tbody tr.client-row.depleted {
  background: rgba(255, 107, 107, .018);
}

.clients-table tbody tr.client-row.inactive {
  background: rgba(143, 155, 182, .018);
}

.client-identity {
  overflow: hidden;
}

.client-identity b,
.client-identity small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.client-identity b {
  color: #edf1ff;
  font-size: 14px;
  font-weight: 600;
  text-align: right;
}

.client-identity small {
  max-width: 100%;
  margin-top: 3px;
  direction: ltr;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  text-align: right;
  unicode-bidi: isolate;
}

.clients-table .enabled-cell {
  text-align: right;
}

.clients-table .enabled-cell .toggle-form {
  justify-content: flex-start;
}

.client-actions {
  width: 192px;
  min-width: 192px;
  justify-content: flex-start;
  gap: 8px;
  direction: ltr;
  min-height: 28px;
}

.clients-table .client-actions-cell {
  text-align: right;
}

.clients-table .traffic-cell {
  min-width: 0;
}

.table-actions.client-actions .icon-action {
  width: 32px;
  min-width: 32px;
  height: 32px;
  min-height: 32px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
}

.table-actions.client-actions .icon-action svg {
  width: 16px;
  height: 16px;
}

#clients-results {
  transition: opacity .14s ease;
}

#clients-results.is-loading {
  opacity: .55;
  pointer-events: none;
}

.table-actions.client-actions .icon-action:hover {
  border-color: rgba(155, 108, 255, .28);
  background: rgba(155, 108, 255, .09);
}

.action-qr { color: #d7dfef; }
.action-info { color: #9ccfff; }

.clients-table .online-status {
  min-height: 26px;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
}

.clients-table .online-status i {
  width: 6px;
  height: 6px;
  box-shadow: none;
}

.traffic-stack {
  display: grid;
  gap: 5px;
  direction: rtl;
  color: #cfd7e9;
  font-size: 12px;
  line-height: 1.1;
}

.traffic-summary { display: flex; align-items: center; gap: 4px; direction: rtl; white-space: nowrap; }
.traffic-percent { color: var(--muted); font-size: 10px; text-align: right; }
.clients-table .traffic-meter { height: 6px; }

.clients-table .metric-badge {
  min-height: 26px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
}

.mobile-field-label { display: none; }

.clients-pagination {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border-top: 1px solid rgba(51, 64, 95, .72);
  color: var(--muted);
  font-size: 11px;
}

.pagination-pages {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.page-item {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 6px;
  color: #bec8dc;
  font-size: 11px;
  line-height: 1;
  text-decoration: none;
}

.page-item:hover { border-color: var(--border-hover); background: rgba(255, 255, 255, .035); color: white; }
.page-item.current { border-color: rgba(155, 108, 255, .46); background: rgba(155, 108, 255, .12); color: #d9ccff; }
.page-item.disabled { opacity: .35; }
.page-arrow svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }
.page-ellipsis { width: 18px; color: var(--muted); text-align: center; }

.page-size {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.page-size select {
  width: 78px;
  height: 34px;
  min-height: 34px;
  padding: 0 8px;
  border-radius: 7px;
  font-size: 11px;
}

.traffic-meter.exhausted i {
  background: #ff7373;
}

.client-dialog {
  width: min(580px, calc(100vw - 28px));
}

.delete-client-dialog { width: min(470px, calc(100vw - 28px)); }
.delete-refund-message { margin: 0 0 14px; color: var(--text); font-size: .82rem; line-height: 1.8; }
.refund-preview { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0 0 10px; }
.refund-preview > div { min-width: 0; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-input); }
.refund-preview dt { margin-bottom: 5px; color: var(--muted); font-size: .68rem; }
.refund-preview dd { margin: 0; overflow: hidden; color: var(--text); font-size: .78rem; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.refund-preview .refund-total { border-color: color-mix(in srgb, var(--success) 40%, var(--line)); background: color-mix(in srgb, var(--success) 7%, var(--surface-input)); }
.refund-preview .refund-total dd { color: var(--success); }
.refund-preview-note { display: block; margin-bottom: 16px; color: var(--muted); font-size: .66rem; line-height: 1.7; }
.btn.danger { border-color: color-mix(in srgb, var(--danger) 55%, transparent); background: color-mix(in srgb, var(--danger) 18%, var(--surface)); color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 25%, var(--surface)); }

.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.dialog-head h3 { margin: 0 0 4px; }
.dialog-head small { color: var(--muted); }

.client-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.client-details > div {
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(51, 64, 95, .75);
  border-radius: 10px;
  background: #0c1426;
}

.client-details .detail-wide { grid-column: 1 / -1; }
.client-details dt { margin-bottom: 6px; color: var(--muted); font-size: 11px; }
.client-details dd { margin: 0; overflow-wrap: anywhere; color: #e4e9f7; font-size: 13px; }

.qr-dialog { width: min(420px, calc(100vw - 28px)); }
.qr-frame { display: grid; place-items: center; min-height: 230px; padding: 16px; border-radius: 10px; background: white; }
.qr-frame img { display: block; width: min(260px, 100%); height: auto; }
.qr-frame p { margin: 0; color: #495166; text-align: center; }
.qr-hint { margin: 14px 0 0; color: var(--muted); font-size: 11px; line-height: 1.8; }

@media (max-width: 1200px) {
  .clients-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .client-stat:nth-child(3) { border-inline-end: 0; }
  .client-stat:nth-child(-n+3) { border-bottom: 1px solid rgba(51, 64, 95, .52); }
}

@media (max-width: 980px) {
  .clients-list-head { align-items: stretch; flex-wrap: wrap; }
  .client-filters { flex: 1 1 100%; flex-wrap: wrap; }
  .search-box { width: 100%; min-width: 0; flex: 1 1 100%; }
  .client-filters select { flex: 1; min-width: 140px; }
  .clients-list-head .create-client { width: auto; align-self: flex-start; }
}

@media (max-width: 720px) {
  .clients-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 7px 8px; }
  .client-stat { min-height: 30px; padding: 2px 8px; }
  .client-stat:nth-child(3) { border-inline-end: 1px solid rgba(51, 64, 95, .62); }
  .client-stat:nth-child(even) { border-inline-end: 0; }
  .client-stat:nth-child(-n+4) { border-bottom: 1px solid rgba(51, 64, 95, .52); }
  .client-filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .client-filters .search-box { grid-column: 1 / -1; }
  .client-filters select { min-width: 0; }
  .clients-list-head .create-client { justify-self: start; }
  .clients-list-card { overflow: visible; background: transparent; border: 0; box-shadow: none; }
  .clients-list-head { border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
  .runtime-notice,
  .filter-error { margin-inline: 0; }
  .clients-list-card .table-scroll { max-height: none; overflow: visible; }
  .clients-table,
  .clients-table tbody { min-width: 0; display: block; }
  .clients-table colgroup { display: none; }
  .clients-table thead { display: none; }
  .clients-table tr.client-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "online client enabled"
      "traffic traffic traffic"
      "remaining duration actions";
    align-items: center;
    gap: 9px 10px;
    margin-top: 8px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    box-shadow: var(--shadow-card);
    direction: rtl;
  }
  .clients-table tr.client-row:hover { background: var(--surface); border-color: var(--border-hover); }
  .clients-table tr.client-row td { width: auto; height: auto; min-height: 0; padding: 0; border: 0; }
  .clients-table .client-actions-cell { grid-area: actions; }
  .clients-table .enabled-cell { grid-area: enabled; }
  .clients-table .online-cell { grid-area: online; }
  .clients-table .client-identity { grid-area: client; }
  .clients-table .traffic-cell { grid-area: traffic; min-width: 0; padding-block: 3px; }
  .clients-table .remaining-cell { grid-area: remaining; }
  .clients-table .duration-cell { grid-area: duration; }
  .clients-table .client-identity b { font-size: 12px; }
  .clients-table .client-identity small { max-width: 100%; font-size: 9px; }
  .clients-table .online-status { width: 20px; padding: 0; justify-content: center; background: transparent; border: 0; }
  .clients-table .online-status span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .clients-table .online-status i { width: 8px; height: 8px; }
  .clients-table .traffic-stack { gap: 5px; }
  .client-actions { width: 192px; min-width: 192px; }
  .mobile-field-label { display: block; margin-bottom: 3px; color: var(--muted); font-size: 9px; direction: ltr; }
  .clients-pagination { margin-top: 8px; flex-wrap: wrap; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
  .pagination-pages { order: 3; width: 100%; justify-content: center; }
  .empty-row { display: block; margin-top: 8px; }
  .clients-table .empty-row td { display: block; height: auto; padding: 22px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
  .client-details { grid-template-columns: 1fr; }
  .client-details .detail-wide { grid-column: auto; }
  .client-dialog { padding: 18px; }
}

@media (max-width: 480px) {
  .client-filters { grid-template-columns: 1fr; }
  .client-filters .search-box { grid-column: auto; }
  .clients-list-head .create-client { width: 100%; }
}

@media (max-width: 400px) {
  .clients-table tr.client-row {
    grid-template-areas:
      "online client enabled"
      "traffic traffic traffic"
      "remaining duration duration"
      "actions actions actions";
  }
  .clients-table .client-actions-cell { padding-top: 2px; }
  .client-actions { width: auto; min-width: 0; flex-wrap: wrap; }
}

/* Admin system center: operational metadata only, never customer secrets. */
.admin-system-center { display: grid; gap: 14px; }
.system-center-card { min-width: 0; padding: 16px; }
.system-center-card .section-head { margin-bottom: 14px; }
.system-center-card h2 { margin: 0; font-size: 1rem; }
.system-center-card .section-head small { color: var(--muted); font-size: .72rem; }
.sync-restore-warning { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 14px; border: 1px solid color-mix(in srgb, var(--warning) 45%, var(--line)); border-radius: 9px; background: color-mix(in srgb, var(--warning) 8%, var(--surface)); color: var(--warning); }
.sync-restore-warning span { font-size: .72rem; }
.sync-status-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.sync-status-grid article { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-input); }
.sync-status-grid span { color: var(--muted); font-size: .68rem; }
.sync-status-grid b { font-size: 1rem; }
.sync-status-grid .ok b { color: var(--success); }
.sync-status-grid .danger b { color: var(--danger); }
.sync-status-grid .warning b { color: var(--warning); }
.sync-status-grid .info b { color: var(--info); }
.sync-last-run { display: flex; flex-wrap: wrap; gap: 10px 20px; margin-top: 10px; color: var(--muted); font-size: .68rem; }
.backup-table { min-width: 760px; table-layout: fixed; }
.backup-table th, .backup-table td { height: 52px; padding: 7px 10px; }
.backup-table th:first-child { width: 24%; }
.backup-table th:last-child { width: 190px; }
.backup-table td:first-child { display: table-cell; }
.backup-table td:first-child b, .backup-table td:first-child small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.backup-table td:first-child small { margin-top: 2px; color: var(--muted); font-size: .65rem; }
.backup-status { display: inline-flex; padding: 3px 7px; border-radius: 5px; background: var(--surface-input); color: var(--muted); font-size: .64rem; }
.backup-status.completed, .backup-status.delivered, .backup-status.sent { color: var(--success); background: color-mix(in srgb, var(--success) 10%, transparent); }
.backup-status.failed, .backup-status.telegram_failed, .backup-status.manual_review_required, .backup-status.partial_failed { color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); }
.backup-status.pending, .backup-status.creating, .backup-status.ambiguous, .backup-status.reconcile_required { color: var(--warning); background: color-mix(in srgb, var(--warning) 10%, transparent); }
.backup-status.sending, .backup-status.remote_in_progress, .backup-status.remote_succeeded, .backup-status.local_in_progress, .backup-status.running { color: var(--info); background: color-mix(in srgb, var(--info) 10%, transparent); }
.deletion-pending-badge { display: inline-flex; align-items: center; min-height: 24px; padding: 3px 8px; border-radius: 6px; color: var(--warning); background: color-mix(in srgb, var(--warning) 10%, transparent); font-size: .66rem; white-space: nowrap; }
.reseller-row.deletion-pending { background: color-mix(in srgb, var(--warning) 3%, transparent); }
.system-row-actions { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.action-backup, .action-download, .action-send, .action-settings { color: var(--info); }
.backup-settings-dialog { width: min(440px, calc(100vw - 28px)); }
.backup-settings-dialog label { display: grid; gap: 6px; }
.backup-settings-dialog .inline-switch { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; }
.restore-upload { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.restore-upload input[type=file] { min-width: 0; height: 40px; padding: 7px 10px; }
.restore-report { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.restore-report > div { min-width: 0; padding: 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-input); }
.restore-report span { display: block; margin-bottom: 4px; color: var(--muted); font-size: .64rem; }
.restore-report b { display: block; overflow: hidden; font-size: .76rem; text-overflow: ellipsis; white-space: nowrap; }
.restore-report.blocked { border-top-color: color-mix(in srgb, var(--danger) 50%, var(--line)); }
.restore-apply { display: flex; align-items: end; justify-content: flex-end; gap: 10px; margin-top: 12px; }
.restore-apply label { display: grid; gap: 5px; color: var(--muted); font-size: .68rem; }
.restore-apply select { min-width: 180px; }
.restore-remote-error, .restore-blocked, .restore-success { margin: 10px 0 0; padding: 8px 10px; border-radius: 7px; color: var(--muted); background: var(--surface-input); font-size: .7rem; }
.restore-blocked { color: var(--danger); }
.restore-success { color: var(--success); }

@media (max-width: 900px) {
  .sync-status-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .restore-report { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .system-center-card { padding: 12px; }
  .sync-restore-warning { align-items: flex-start; flex-direction: column; }
  .sync-status-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .restore-upload { grid-template-columns: 1fr; }
  .restore-upload .btn { width: 100%; }
  .restore-report { grid-template-columns: 1fr; }
  .restore-apply { align-items: stretch; flex-direction: column; }
  .restore-apply select, .restore-apply .btn { width: 100%; }
}

.dashboard-table-card .table-heading h2 {
  margin: 0;
}

.dashboard-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.dashboard-table-card .data-table {
  min-width: 680px;
}

.dashboard-table-card td:first-child,
.dashboard-table-card td:last-child,
.reseller-table td:nth-child(2) {
  direction: ltr;
  text-align: left;
  font-variant-numeric: tabular-nums;
}

.reseller-table {
  min-width: 720px;
  table-layout: fixed;
}

.summary-card {
  padding: 14px 16px;
  border-radius: 10px;
}

.reseller-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.summary-stat {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding-inline-end: 10px;
  border-inline-end: 1px solid rgba(51, 64, 95, .58);
}

.summary-stat:last-child { border-inline-end: 0; }
.summary-stat > span:last-child { min-width: 0; }
.summary-stat b { display: block; color: var(--text); font-size: 20px; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.summary-stat small { display: block; margin-block-start: 3px; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }

.summary-icon {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--primary-soft);
  color: #bcaaff;
}

.summary-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.summary-icon.active { background: rgba(61, 220, 151, .1); color: var(--success); }
.summary-icon.inactive { background: rgba(255, 107, 107, .1); color: #ff8585; }
.summary-icon.clients { background: rgba(103, 183, 255, .1); color: var(--info); }
.summary-icon.credit { background: rgba(255, 194, 103, .1); color: var(--warning); }

.reseller-list-card { padding: 0; overflow: hidden; }

.table-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 170px 180px auto;
  gap: 10px;
  align-items: center;
  padding: 12px 16px;
  border-block-end: 1px solid var(--border);
}

.table-toolbar input,
.table-toolbar select,
.table-toolbar .btn { height: 36px; min-height: 36px; border-radius: 7px; font-size: 12px; }
.reseller-search { width: 100%; min-width: 0; }
.reseller-search input { padding-inline-start: 38px; padding-inline-end: 10px; }
.reseller-search > svg { inset-inline-start: 12px; inset-inline-end: auto; }
.add-reseller { padding-inline: 14px; gap: 6px; }

.reseller-table th,
.reseller-table td { height: 58px; padding: 8px 10px; }
.reseller-table .toggle-column { width: 80px; text-align: center; }
.reseller-table .reseller-actions-column { width: 128px; }
.reseller-table .toggle-cell { text-align: center; }
.reseller-table .toggle-cell .toggle-form { justify-content: center; }
.reseller-table .reseller-actions { min-width: 106px; }
.reseller-name-cell b { display: block; overflow: hidden; font-size: 13px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.reseller-username,
.reseller-credit { font-variant-numeric: tabular-nums; }
.reseller-username bdi { direction: ltr; unicode-bidi: isolate; }
.reseller-row-credit-progress { display: block; width: min(170px, 100%); height: 4px; margin-block-start: 3px; overflow: hidden; border-radius: 99px; background: var(--surface-input); }
.reseller-row-credit-progress i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent2)); }
.mobile-only-meta { display: none; }

.table-footer {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-block-start: 1px solid var(--border);
  color: var(--muted);
  font-size: 11px;
}

.reseller-pagination .page-item { width: 30px; height: 30px; background: transparent; cursor: pointer; }
.reseller-pagination .page-item.current { opacity: 1; cursor: default; }
.reseller-dialog { width: min(680px, calc(100vw - 32px)); }
.modal-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.reset-credit-dialog { width: min(510px, calc(100vw - 28px)); }
.reset-credit-question { margin: 0 0 12px; font-size: .86rem; font-weight: 700; }
.reset-credit-preview { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0 0 12px; }
.reset-credit-preview > div { min-width: 0; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-input); }
.reset-credit-preview dt { margin-bottom: 5px; color: var(--muted); font-size: .68rem; }
.reset-credit-preview dd { margin: 0; overflow: hidden; color: var(--text); font-size: .8rem; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.reset-credit-note { margin: 0 0 16px; color: var(--muted); font-size: .72rem; line-height: 1.85; }
.reset-credit-submit { color: var(--info); }

.btn.reset-traffic-btn {
  color: var(--info);
}

@media (max-width: 1200px) {
  .reseller-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .summary-stat:nth-child(3) { border-inline-end: 0; }
  .table-toolbar { grid-template-columns: minmax(220px, 1fr) 150px 160px auto; }
}

@media (max-width: 860px) {
  .dashboard-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-summary .summary-stat:nth-child(even) { border-inline-end: 0; }
}

@media (max-width: 980px) {
  .table-toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .table-toolbar .reseller-search { grid-column: 1 / -1; }
  .table-toolbar .add-reseller { width: max-content; justify-self: start; }
}

@media (max-width: 720px) {
  .reseller-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 10px; }
  .summary-stat { padding: 4px; border-inline-end: 0; }
  .summary-icon { width: 32px; height: 32px; flex-basis: 32px; }
  .summary-stat b { font-size: 17px; }
  .reseller-list-card { overflow: visible; border: 0; background: transparent; box-shadow: none; }
  .reseller-toolbar { border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
  .reseller-table-shell { overflow: visible; }
  .reseller-table,
  .reseller-table tbody { min-width: 0; display: block; }
  .reseller-table thead { display: none; }
  .reseller-table tr.reseller-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "name toggle"
      "username username"
      "credit clients"
      "actions actions";
    align-items: center;
    gap: 8px 12px;
    margin-block-start: 8px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    box-shadow: var(--shadow-card);
  }
  .reseller-table tr.reseller-row td { width: auto; height: auto; padding: 0; border: 0; }
  .reseller-name-cell { grid-area: name; }
  .reseller-username { grid-area: username; }
  .reseller-credit { grid-area: credit; }
  .reseller-clients { grid-area: clients; }
  .reseller-table .toggle-cell { grid-area: toggle; }
  .reseller-table tr.reseller-row td.reseller-actions-cell { grid-area: actions; padding-block-start: 4px; border-block-start: 1px solid rgba(51, 64, 95, .55); }
  .reseller-actions { margin-block-start: 8px; }
  .mobile-only-meta { display: block; margin-block-start: 2px; color: var(--muted); font-size: 10px; }
  .reseller-empty { display: block; margin-block-start: 8px; }
  .reseller-empty td { display: block; height: auto; padding: 22px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
  .reseller-pagination { margin-block-start: 8px; flex-wrap: wrap; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
  .reseller-pagination .pagination-pages { order: 3; width: 100%; justify-content: center; }
  .modal-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .table-toolbar { grid-template-columns: 1fr; padding: 10px; }
  .table-toolbar .reseller-search { grid-column: auto; }
  .table-toolbar .add-reseller { width: 100%; }
}

@media (max-width: 400px) {
  .reseller-summary { gap: 6px; }
  .summary-stat { gap: 7px; }
  .summary-icon { width: 30px; height: 30px; flex-basis: 30px; }
  .reseller-actions { flex-wrap: wrap; }
}
