:root {
  --bg: #eef3f9;
  --surface: #ffffff;
  --surface-soft: #f8fbff;
  --ink: #0f172a;
  --muted: #64748b;
  --border: #dbe5f2;
  --brand: #2563eb;
  --brand-strong: #1d4ed8;
  --brand-soft: #e9f1ff;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.08);
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 24px 48px rgba(15, 23, 42, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  zoom: 0.75;
  margin: 0;
  padding: 0;
  min-height: 100%;
  overflow-y: scroll;
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  font-family: "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: linear-gradient(180deg, #f8fbff 0%, var(--bg) 100%);
  color: var(--ink);
  line-height: 1.55;
}

a {
  color: var(--brand);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  color: var(--ink);
  line-height: 1.3;
}

.container {
  padding: 24px;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.page-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.page-subtitle {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
}

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.ui-icon,
.nav-icon,
.btn-icon,
.title-icon,
.stat-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  line-height: 1;
}

.nav-icon {
  width: 1.25em;
}

.btn-icon {
  font-size: 1em;
}

.title-icon {
  font-size: 1.05em;
  margin-right: 2px;
}

.panel-title,
.page-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.stat-label,
.chip,
label {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface);
  color: var(--ink);
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover {
  background: #f4f8ff;
  border-color: #c9d7ea;
  text-decoration: none;
}

.btn:active {
  transform: translateY(1px);
}

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

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn.primary {
  background: linear-gradient(180deg, var(--brand) 0%, var(--brand-strong) 100%);
  border-color: var(--brand-strong);
  color: #fff;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.25);
}

.btn.primary:hover {
  filter: brightness(1.03);
}

.btn.danger {
  background: linear-gradient(180deg, #ef4444 0%, #dc2626 100%);
  border-color: #b91c1c;
  color: #fff;
  box-shadow: 0 8px 20px rgba(220, 38, 38, 0.25);
}

.btn.danger:hover {
  filter: brightness(1.03);
}

.btn.ghost {
  background: transparent;
}

.app-sidebar .btn.ghost,
.side .btn.ghost,
.reseller-topbar .btn.ghost,
.topnav .btn.ghost {
  color: #e2e8f0;
  border-color: rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.35);
}

.app-sidebar .btn.ghost:hover,
.side .btn.ghost:hover,
.reseller-topbar .btn.ghost:hover,
.topnav .btn.ghost:hover {
  color: #fff;
  background: rgba(51, 65, 85, 0.55);
  border-color: rgba(148, 163, 184, 0.55);
}

.card,
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 18px;
}

.panel {
  margin-bottom: 16px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.panel-title {
  font-size: 18px;
  font-weight: 700;
}

label {
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cdd9ea;
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  font: inherit;
  padding: 10px 11px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

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

.hint {
  font-size: 12px;
  color: var(--muted);
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid #d7e3f2;
  background: #f8fbff;
  color: #334155;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.alert {
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  font-size: 13px;
  border: 1px solid transparent;
  margin-bottom: 14px;
}

.alert.success {
  border-color: #bbf7d0;
  background: #dcfce7;
  color: #166534;
}

.alert.error {
  border-color: #fecaca;
  background: #fee2e2;
  color: #991b1b;
}

.stat-grid,
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-soft);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.stat-label {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

.stat-value,
.stat b {
  display: block;
  font-size: 25px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.table-wrap {
  width: 100%;
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

th,
td {
  text-align: left;
  font-size: 13px;
  padding: 11px 12px;
  border-bottom: 1px solid #e9eff7;
  vertical-align: top;
}

th {
  background: #f4f8fe;
  color: #334155;
  font-weight: 700;
}

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

tr:hover > td {
  background: #fafcff;
}

.edit-row > td {
  background: #f8fbff;
}

.table-empty {
  text-align: center;
  color: var(--muted);
  padding: 20px;
}

.actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.inline-form {
  display: inline-flex;
  margin: 0;
}

td.actions {
  display: table-cell;
  white-space: nowrap;
  vertical-align: middle;
  width: 1%;
}

td.actions > .btn,
td.actions > .inline-form {
  display: inline-flex;
  vertical-align: middle;
  margin: 0 6px 0 0;
}

td.actions > .btn:last-child,
td.actions > .inline-form:last-child {
  margin-right: 0;
}

td.actions .btn {
  white-space: nowrap;
}

.table-panel-head {
  justify-content: flex-start;
}

.table-search {
  min-width: 260px;
  max-width: 360px;
  width: 100%;
}

.account-summary-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.account-filter-grid {
  grid-template-columns: minmax(260px, 2fr) repeat(3, minmax(160px, 1fr));
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
}

.account-filter-grid .filter-field label {
  margin-bottom: 4px;
  font-size: 12px;
}

.reseller-account-filter-grid {
  grid-template-columns: minmax(260px, 2fr) repeat(2, minmax(160px, 1fr));
}

.account-charge-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 128px;
}

.account-charge-total {
  font-weight: 700;
  white-space: nowrap;
}

.account-bonus-note {
  margin: 0;
}

@media (max-width: 1180px) {
  .account-filter-grid,
  .reseller-account-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .account-summary-grid,
  .account-filter-grid,
  .reseller-account-filter-grid {
    grid-template-columns: 1fr;
  }
}

.aligned-table td {
  vertical-align: middle;
}

.aligned-table td.actions {
  white-space: nowrap;
  vertical-align: middle;
}

.aligned-table tr.edit-row > td,
.aligned-table tr[id^="dash-edit-row-"] > td,
.aligned-table tr[id^="edit-row-"] > td,
.aligned-table tr[id^="topup-"] > td,
.aligned-table tr[id^="edit-"] > td {
  vertical-align: top;
}

.aligned-table .owner-list {
  align-items: center;
}

.aligned-table .badge,
.aligned-table .owner-chip {
  vertical-align: middle;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
}

.badge.paid {
  background: #dcfce7;
  color: #166534;
}

.badge.free {
  background: #fef3c7;
  color: #92400e;
}

.badge.expired {
  background: #fee2e2;
  color: #991b1b;
}

.badge.muted {
  background: #e2e8f0;
  color: #334155;
}

.owner-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.owner-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.owner-chip.admin {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #1e3a8a;
}

.owner-chip.reseller {
  background: #dcfce7;
  border-color: #86efac;
  color: #166534;
}

.topups-table td,
.charge-history-table td {
  height: 58px;
  vertical-align: middle;
}

.requested-usd-cell {
  min-width: 160px;
  white-space: nowrap;
}

.requested-usd-main {
  display: inline-block;
  font-size: inherit;
  font-weight: 400;
  line-height: inherit;
  white-space: nowrap;
  color: inherit;
}

.requested-usd-main.has-failed {
}


.requested-usd-breakdown {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  min-height: 36px;
  gap: 4px;
  margin-left: 6px;
  margin-top: 0;
  vertical-align: middle;
}

.credit-breakdown {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  border-radius: 999px;
  padding: 3px 8px;
  border: 1px solid transparent;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.credit-breakdown.success {
  background: #dcfce7;
  border-color: #86efac;
  color: #166534;
}

.credit-breakdown.failed {
  background: #fee2e2;
  border-color: #fecaca;
  color: #991b1b;
}

.credit-breakdown.bonus {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #9a3412;
}

.progress-info-box {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border-radius: 10px;
  padding: 14px 16px;
  margin-top: 16px;
  font-size: 13px;
  line-height: 1.6;
}

.progress-info-icon {
  font-size: 22px;
  flex-shrink: 0;
}

.progress-info-text a {
  font-weight: 700;
  text-decoration: underline;
}

.progress-info-box--running {
  background: #f0f7ff;
  border: 1px solid #c3dafe;
  color: #1e3a8a;
}

.progress-info-box--running .progress-info-text a {
  color: #2563eb;
}

.progress-info-box--completed {
  background: #f0fdf4;
  border: 1px solid #86efac;
  color: #166534;
}

.progress-info-box--completed .progress-info-text a {
  color: #16a34a;
}

.progress-info-box--failed {
  background: #fff1f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.progress-info-box--failed .progress-info-text a {
  color: #dc2626;
}


.status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 11px;
  font-size: 12px;
  font-weight: 700;
}

.status-pill.pending {
  background: #e2e8f0;
  color: #334155;
}

.status-pill.running {
  background: #dbeafe;
  color: #1e40af;
}

.status-pill.completed {
  background: #dcfce7;
  color: #166534;
}

.status-pill.partial {
  background: #fef3c7;
  color: #92400e;
}

.status-pill.failed {
  background: #fee2e2;
  color: #991b1b;
}

.cost {
  background: #f1f7ff;
  border: 1px solid #d7e7ff;
  color: #0f3a85;
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  font-size: 13px;
}

.bar {
  width: 100%;
  height: 11px;
  border-radius: 999px;
  background: #e4ebf4;
  overflow: hidden;
}

.fill {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #22c55e 0%, #16a34a 100%);
  transition: width 0.3s ease;
}

.log {
  background: #0a1224;
  color: #cbd5e1;
  border-radius: 12px;
  padding: 13px;
  min-height: 220px;
  max-height: 300px;
  overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  line-height: 1.65;
}

.log div {
  white-space: pre-wrap;
  word-break: break-word;
}

.log .ok {
  color: #4ade80;
}

.log .err {
  color: #f87171;
}

.app-shell,
.layout {
  min-height: calc(100vh / 0.75);
  display: flex;
}

.app-sidebar,
.side {
  width: 260px;
  background: radial-gradient(120% 120% at 0% 0%, #1f2a44 0%, #111827 60%, #0f172a 100%);
  color: #cbd5e1;
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(148, 163, 184, 0.18);
  position: sticky;
  top: 0;
  height: calc(100vh / 0.75);
  max-height: calc(100vh / 0.75);
}

.sidebar-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  padding: 0 8px;
}

.brand-dot {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(180deg, #3b82f6 0%, #1d4ed8 100%);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.brand-title {
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}

.brand-sub {
  color: #93a5c0;
  font-size: 11px;
  margin-top: 1px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
}

.nav-link,
.side a {
  color: #c8d5ea;
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 600;
  padding: 9px 10px;
  text-decoration: none;
  transition: all 0.15s ease;
}

.nav-link:hover,
.side a:hover {
  color: #fff;
  text-decoration: none;
  background: rgba(51, 65, 85, 0.45);
  border-color: rgba(148, 163, 184, 0.2);
}

.nav-link.active,
.side a.active {
  color: #fff;
  background: linear-gradient(180deg, rgba(37, 99, 235, 0.32) 0%, rgba(29, 78, 216, 0.22) 100%);
  border-color: rgba(96, 165, 250, 0.4);
}

.sidebar-foot,
.side-logout {
  margin-top: auto;
  padding-top: 16px;
  flex: 0 0 auto;
}

.sidebar-foot .btn,
.side-logout .btn {
  width: 100%;
  justify-content: flex-start;
}

.app-main,
.main {
  flex: 1;
  min-width: 0;
  padding: 24px;
}

.app-body {
  display: block;
}

.reseller-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.reseller-topbar,
.topnav {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  background: linear-gradient(120deg, #111827 0%, #0f172a 60%, #1e293b 100%);
  color: #fff;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  padding: 14px 24px;
}

.top-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.top-brand,
.topnav .brand {
  font-weight: 700;
  font-size: 15px;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.top-link,
.topnav a {
  color: #c8d5ea;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 11px;
  border-radius: 10px;
  border: 1px solid transparent;
}

.top-link:hover,
.topnav a:hover,
.top-link.active,
.topnav a.active {
  color: #fff;
  text-decoration: none;
  background: rgba(51, 65, 85, 0.55);
  border-color: rgba(148, 163, 184, 0.2);
}

.top-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.wallet-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.45);
  font-size: 13px;
}

.wallet-pill b {
  color: #4ade80;
}

.reseller-main {
  flex: 1;
  padding: 24px;
}

.wallet {
  display: inline-flex;
  flex-direction: column;
  gap: 3px;
  background: linear-gradient(135deg, #0f172a 0%, #1d4ed8 100%);
  color: #fff;
  border-radius: 16px;
  padding: 15px 18px;
  box-shadow: var(--shadow);
}

.wallet b {
  font-size: 28px;
  line-height: 1;
}

.auth-page,
.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at top right, rgba(59, 130, 246, 0.18), transparent 46%),
    radial-gradient(circle at bottom left, rgba(16, 185, 129, 0.12), transparent 42%),
    #0b1220;
}

.auth-grid {
  width: min(980px, 100%);
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 18px;
}

.auth-side {
  background: linear-gradient(170deg, rgba(37, 99, 235, 0.4) 0%, rgba(15, 23, 42, 0.85) 70%);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: var(--radius-lg);
  color: #dbeafe;
  padding: 28px;
  box-shadow: var(--shadow-lg);
}

.auth-side h1 {
  color: #fff;
  font-size: 28px;
  margin-bottom: 10px;
}

.auth-side p {
  margin: 0;
  color: #c6d8f6;
}

.auth-panel,
.auth-card {
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 28px;
}

.auth-panel h2,
.auth-card h1 {
  font-size: 24px;
  margin-bottom: 6px;
}

.auth-sub {
  color: var(--muted);
  margin: 0 0 16px;
}

.auth-submit {
  width: 100%;
  margin-top: 14px;
}

.hero {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

.hero-card {
  width: min(620px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 32px;
  text-align: center;
}

.hero-card p {
  color: var(--muted);
  margin: 8px 0 22px;
}

.financial-filter-panel .page-subtitle {
  margin: 4px 0 0;
}

.financial-tabs {
  margin-top: 16px;
}

.tx-tab-input {
  position: absolute;
  width: 1px;
  height: 1px;
  min-width: 0;
  padding: 0;
  margin: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
}

.tx-tab-labels {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.tx-tab-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: #334155;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease;
}

.tx-tab-label:hover {
  border-color: #b9c8dc;
  background: #f8fbff;
}

.tx-tab-panel {
  display: none;
}

#tx-tab-wallet:checked ~ .tx-tab-labels label[for="tx-tab-wallet"],
#tx-tab-topups:checked ~ .tx-tab-labels label[for="tx-tab-topups"] {
  border-color: var(--brand-strong);
  background: linear-gradient(180deg, var(--brand) 0%, var(--brand-strong) 100%);
  color: #fff;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.2);
}

#tx-tab-wallet:checked ~ .tx-tab-panels #tx-panel-wallet,
#tx-tab-topups:checked ~ .tx-tab-panels #tx-panel-topups {
  display: block;
}

.tx-summary-grid .stat {
  min-height: 104px;
}

.money-positive {
  color: var(--success) !important;
  font-weight: 800;
}

.money-negative {
  color: var(--danger) !important;
  font-weight: 800;
}

.transaction-type-badge {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 800;
  border: 1px solid transparent;
}

.transaction-type-badge.topup {
  background: #dcfce7;
  border-color: #86efac;
  color: #166534;
}

.transaction-type-badge.deduction {
  background: #fee2e2;
  border-color: #fecaca;
  color: #991b1b;
}

.transaction-type-badge.refund {
  background: #dbeafe;
  border-color: #bfdbfe;
  color: #1e40af;
}

.transaction-type-badge.adjustment {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #334155;
}

.wallet-impact {
  display: inline-flex;
  flex-direction: column;
  gap: 3px;
  min-width: 135px;
  border: 1px solid #d7e7ff;
  border-radius: var(--radius-sm);
  background: #f8fbff;
  color: #334155;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.35;
}

.wallet-impact-admin {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  background: #f8fafc;
  color: #475569;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 700;
}

.wallet-activity-table .transaction-type-badge,
.wallet-activity-table .money-positive,
.wallet-activity-table .money-negative {
  font-size: inherit;
  font-weight: 400;
  line-height: inherit;
}

.related-job-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: #e9f1ff;
  color: var(--brand);
  padding: 4px 9px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.related-job-button:hover {
  background: #dbeafe;
  border-color: #93c5fd;
  color: var(--brand-strong);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
}

.related-job-button:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.related-job-missing {
  color: var(--muted);
}

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

.job-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.48);
}

.job-modal {
  width: min(560px, 100%);
  max-height: min(760px, calc(100vh - 48px));
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  padding: 18px;
}

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

.job-modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.job-modal-close:hover {
  background: #eef4ff;
  border-color: #bfdbfe;
}

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

.job-modal-details > div {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  padding: 10px;
}

.job-modal-details dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.job-modal-details dd {
  margin: 4px 0 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  overflow-wrap: anywhere;
}



.reseller-add-account-btn {
  min-width: 190px;
  height: 38px;
  padding: 0 14px;
  white-space: nowrap;
}

.reseller-topbar .wallet-pill {
  min-height: 38px;
}



@media (max-width: 1080px) {
  .stat-grid,
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .auth-grid {
    grid-template-columns: 1fr;
  }

  .auth-side {
    display: none;
  }
}

@media (max-width: 860px) {
  .app-shell,
  .layout {
    flex-direction: column;
  }

  .app-sidebar,
  .side {
    width: 100%;
    border-right: 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
    position: static;
    height: auto;
    max-height: none;
  }

  .sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
    overflow: visible;
    flex: 0 1 auto;
  }

  .sidebar-foot,
  .side-logout {
    margin-top: 12px;
    padding-top: 12px;
  }

  .sidebar-foot .btn,
  .side-logout .btn {
    width: auto;
  }

  .grid2 {
    grid-template-columns: 1fr;
  }

  .app-main,
  .main,
  .reseller-main,
  .container {
    padding: 16px;
  }

  .top-actions {
    width: 100%;
    justify-content: space-between;
    margin-left: 0;
  }

  .reseller-add-account-btn {
    flex: 1;
    min-width: 180px;
  }
}

@media (max-width: 620px) {
  .stat-grid,
  .stats {
    grid-template-columns: 1fr;
  }

  th,
  td {
    font-size: 12px;
    padding: 9px 8px;
  }

  .job-modal-details {
    grid-template-columns: 1fr;
  }
}


/* Compact financial filters + pagination */
.compact-filter-panel {
  padding: 14px;
  margin-bottom: 16px;
}

.compact-filter-panel .compact-panel-head,
.compact-filter-panel .panel-head {
  margin-bottom: 10px;
}

.compact-filter-panel .page-subtitle {
  margin-top: 3px;
  font-size: 12px;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 10px;
  align-items: end;
}

.filter-field {
  min-width: 0;
}

.filter-field-wide {
  grid-column: span 2;
}

.compact-filter-panel label {
  margin-bottom: 4px;
  font-size: 12px;
}

.compact-filter-panel input,
.compact-filter-panel select {
  min-height: 38px;
  padding: 8px 10px;
  font-size: 13px;
}

.filter-actions {
  display: flex;
  align-items: end;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-actions .btn {
  min-height: 38px;
  padding: 8px 12px;
}

.per-page-control {
  min-width: 116px;
}

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 12px 0;
  color: var(--muted);
  font-size: 12px;
}

.pagination-summary {
  font-weight: 700;
}

.pagination-links {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.pagination-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  min-height: 32px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: #334155;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
}

.pagination-link:hover {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: var(--brand-strong);
  text-decoration: none;
}

.pagination-link.active {
  border-color: var(--brand-strong);
  background: linear-gradient(180deg, var(--brand) 0%, var(--brand-strong) 100%);
  color: #fff;
}

.pagination-link.disabled {
  opacity: 0.5;
  pointer-events: none;
  box-shadow: none;
}

.stat-note {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.dashboard-summary-grid,
.tx-summary-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.admin-financial-filter-grid {
  grid-template-columns: repeat(7, minmax(120px, 1fr));
}

@media (max-width: 1180px) {
  .filter-grid,
  .admin-financial-filter-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .filter-field-wide {
    grid-column: span 3;
  }
}

@media (max-width: 760px) {
  .filter-grid,
  .admin-financial-filter-grid {
    grid-template-columns: 1fr;
  }

  .filter-field-wide {
    grid-column: span 1;
  }

  .pagination-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .dashboard-summary-grid,
  .tx-summary-grid {
    grid-template-columns: 1fr;
  }
}


.per-page-control input[type="number"] {
  width: 100%;
  max-width: 120px;
}

/* Live financial filters and clean job modal overrides */
html {
  overflow-y: scroll;
  scrollbar-gutter: stable;
}

.financial-tabs,
.tx-tab-panel,
#financial-tabs,
#tx-panel-topups,
#tx-panel-wallet {
  scroll-margin-top: 92px;
}

.live-filter-form .filter-actions noscript {
  display: contents;
}

.live-filter-form input[type="search"]::-webkit-search-cancel-button {
  cursor: pointer;
}

.tx-tab-label.active,
.tx-tab-label[aria-selected="true"] {
  border-color: var(--brand-strong);
  background: linear-gradient(180deg, var(--brand) 0%, var(--brand-strong) 100%);
  color: #fff;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.2);
}

.reseller-financial-tabs .tx-tab-panels,
.financial-tabs .tx-tab-panels {
  min-width: 0;
}

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

.job-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.42);
  overflow: auto;
}

.job-modal {
  width: min(540px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  border: 1px solid #d8e2ee;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.22);
  padding: 0;
}

.job-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  padding: 16px 18px;
  border-bottom: 1px solid #e2e8f0;
  background: #fff;
}

.job-modal-head .panel-title {
  margin: 0 0 4px;
  font-size: 17px;
}

.job-modal-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.job-modal-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #eef6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  font-size: 12px;
  font-weight: 800;
}

.job-modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border: 1px solid #d8e2ee;
  border-radius: 999px;
  background: #f8fafc;
  color: #0f172a;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.job-modal-close:hover {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.job-modal-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding: 16px 18px 18px;
  background: #f8fafc;
}

.job-modal-details > div {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  padding: 10px 12px;
}

.job-modal-details dt {
  color: #64748b;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.job-modal-details dd {
  margin: 4px 0 0;
  color: #0f172a;
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

@media (max-width: 760px) {
  .job-modal-backdrop {
    align-items: flex-start;
    padding: 16px 12px;
  }

  .job-modal {
    max-height: calc(100vh - 32px);
    border-radius: 16px;
  }

  .job-modal-details {
    grid-template-columns: 1fr;
    padding: 14px;
  }
}


/* Reseller top-up confirm modal helpers */
.job-modal-details dt{font-size:12px;color:#64748b;}
.job-modal-details dd{font-size:14px;font-weight:700;}
#topup-confirm-modal .job-modal{max-width:560px;}
#topup-confirm-modal .job-modal-details{grid-template-columns:1fr 1fr;}

/* Reseller progress estimated message */
.panel .hint.estimated{font-style:italic;color:#475569;margin-top:12px;}


/* Reseller bottom-right toast notifications */
.toast-stack.toast-bottom-right {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(380px, calc(100vw - 36px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid #dbe7f5;
  border-radius: 16px;
  background: #fff;
  color: #0f172a;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.16);
  padding: 12px 12px 12px 14px;
  pointer-events: auto;
  transform: translateY(0);
  opacity: 1;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.toast-success {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.toast-error {
  border-color: #fecaca;
  background: #fef2f2;
}

.toast-info {
  border-color: #bfdbfe;
  background: #eff6ff;
}

.toast-icon {
  flex: 0 0 auto;
  line-height: 1.4;
}

.toast-message {
  flex: 1;
  min-width: 0;
  color: inherit;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
}

.toast-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.06);
  color: #334155;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.toast-close:hover {
  background: rgba(15, 23, 42, 0.12);
}

.toast.is-hiding {
  opacity: 0;
  transform: translateY(8px);
}

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

.job-submitted-summary > div {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  padding: 12px;
}

.summary-label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

@media (max-width: 620px) {
  .toast-stack.toast-bottom-right {
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: auto;
  }

  .job-submitted-summary {
    grid-template-columns: 1fr;
  }
}
/* Shared UI helpers (app-ui.js): spinner + button loading state + dynamic toasts */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 8px;
  vertical-align: -2px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: app-spin 0.6s linear infinite;
}

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

.btn.is-loading {
  opacity: 0.75;
  cursor: progress;
  pointer-events: none;
}

.toast-stack.toast-bottom-right .toast {
  pointer-events: auto;
}

/* Row highlight flash after AJAX update / add (app-ui.js -> AppUI.flashRow) */
@keyframes app-row-flash {
  0%   { background-color: rgba(34, 197, 94, 0.30); }
  55%  { background-color: rgba(34, 197, 94, 0.16); }
  100% { background-color: transparent; }
}

tr.row-flash > td {
  animation: app-row-flash 2.6s ease-out;
}
