:root {
  --bg: #f5f7fa;
  --bg-alt: #e9eef5;
  --surface: #ffffff;
  --surface-soft: #f9fbff;
  --line: #d6deea;
  --line-strong: #b8c5da;
  --text: #152031;
  --muted: #596882;
  --accent: #0b7a75;
  --accent-2: #1f6feb;
  --accent-3: #00a4d6;
  --danger: #c62828;
  --ok: #0f9d58;
  --radius: 16px;
  --shadow: 0 18px 48px rgba(14, 35, 65, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "IBM Plex Sans", sans-serif;
  color: var(--text);
  background:
    radial-gradient(75rem 45rem at -10% -20%, rgba(31, 111, 235, 0.11), transparent 60%),
    radial-gradient(75rem 45rem at 110% -10%, rgba(11, 122, 117, 0.09), transparent 60%),
    linear-gradient(180deg, #f8faff 0%, #f3f6fb 100%);
  min-height: 100vh;
}

h1,
h2,
h3,
h4,
h5 {
  font-family: "Manrope", sans-serif;
  margin: 0;
  letter-spacing: -0.015em;
}

a {
  color: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 24px;
  background: rgba(248, 251, 255, 0.88);
  border-bottom: 1px solid rgba(173, 186, 209, 0.45);
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.02rem;
  text-decoration: none;
}

.brand img {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  object-fit: cover;
  box-shadow: 0 8px 20px rgba(20, 46, 84, 0.2);
}

.topnav {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.topnav a {
  text-decoration: none;
  color: var(--muted);
  font-size: 0.94rem;
  font-weight: 600;
  padding: 7px 10px;
  border-radius: 999px;
}

.topnav a:hover {
  color: var(--text);
  background: rgba(31, 111, 235, 0.09);
}

.actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.user-menu {
  position: relative;
}

.user-trigger {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  overflow: hidden;
}

.user-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.user-avatar-fallback {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 245px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.user-dropdown-head {
  padding: 13px;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 2px;
}

.user-dropdown-head strong {
  font-size: 0.9rem;
}

.user-dropdown-head span {
  font-size: 0.76rem;
  color: var(--muted);
}

.user-dropdown a {
  display: block;
  padding: 11px 13px;
  text-decoration: none;
  border-top: 1px solid var(--line);
  font-size: 0.9rem;
}

.user-dropdown a:hover {
  background: var(--surface-soft);
}

.user-dropdown a.danger-item {
  color: var(--danger);
}

.site-shell {
  width: min(1180px, 100% - 40px);
  margin: 22px auto 28px;
  display: grid;
  gap: 16px;
}

.compact-shell {
  width: min(960px, 100% - 40px);
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-subtle {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.panel {
  padding: 20px;
}

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

.page-head h1 {
  font-size: clamp(1.35rem, 2.8vw, 2rem);
}

.eyebrow {
  margin: 0;
  color: var(--accent-2);
  font-weight: 800;
  font-size: 0.75rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.lead {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 16px;
}

.hero-main,
.hero-side {
  padding: 24px;
}

.hero-main h1 {
  font-size: clamp(1.8rem, 3.4vw, 2.8rem);
  line-height: 1.08;
  margin-top: 10px;
}

.metric-stack {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.metric-stack > div {
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  display: grid;
  gap: 2px;
}

.metric-stack strong {
  font-size: 1rem;
}

.metric-stack span {
  color: var(--muted);
  font-size: 0.9rem;
}

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

.feature-card,
.steps-grid .card {
  padding: 18px;
}

.step-index {
  margin: 0 0 8px;
  font-family: "Manrope", sans-serif;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: 0.14em;
}

.cta-strip {
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

.hero-cta {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.btn {
  appearance: none;
  border: 1px solid transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

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

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

.btn.ghost {
  background: var(--surface);
  color: var(--text);
  border-color: var(--line-strong);
}

.inline-link {
  color: var(--accent-2);
  text-decoration: none;
  font-weight: 600;
}

.dashboard-control {
  padding: 14px;
  margin-bottom: 14px;
}

.dashboard-filter-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(140px, 1fr));
  gap: 10px;
}

.dashboard-filter {
  display: grid;
  gap: 5px;
}

.dashboard-filter label {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  border-radius: 10px;
  padding: 10px 11px;
  color: var(--text);
  font: inherit;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(31, 111, 235, 0.2);
  border-color: var(--accent-2);
}

label {
  display: grid;
  gap: 5px;
  font-size: 0.86rem;
  font-weight: 600;
}

small.statement-sub,
.statement-sub {
  color: var(--muted);
  font-size: 0.78rem;
}

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

.kpi {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
}

.kpi h5 {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 8px;
}

.kpi strong {
  font-size: 1.3rem;
}

.insight-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.insight-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #fff;
}

.insight-card h5 {
  font-size: 0.78rem;
  color: var(--muted);
}

.insight-card p {
  margin: 7px 0 0;
}

.chart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

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

.chart-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  background: #fff;
}

.chart-card h4 {
  margin-bottom: 8px;
}

#timelineChart {
  height: 250px !important;
}

#methodChart {
  height: 221px !important;
  max-height: 221px;
}

#statusChart,
#btcQuoteChart,
#outraQuoteChart {
  height: 220px !important;
  max-height: 220px;
}

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

.statement-table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
}

.statement-table th,
.statement-table td {
  border-bottom: 1px solid var(--line);
  text-align: left;
  padding: 10px 8px;
  vertical-align: top;
  font-size: 0.86rem;
}

.statement-sort-btn,
.status-action-btn {
  border: 1px solid var(--line-strong);
  background: #fff;
  border-radius: 8px;
  color: var(--text);
  padding: 7px 10px;
  font-weight: 600;
  cursor: pointer;
}

.statement-sort-btn.active {
  border-color: var(--accent-2);
  color: var(--accent-2);
}

.status-action-btn {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  border: none;
}

.statement-action-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.statement-main {
  font-weight: 600;
}

.statement-taxid-toggle {
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 1px dashed var(--line-strong);
}

.statement-taxid-toggle:hover {
  color: var(--accent-2);
  border-bottom-color: var(--accent-2);
}

.api-box {
  margin: 14px 0 0;
  padding: 12px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  background: #f7f9fd;
  color: var(--muted);
  white-space: pre-wrap;
  word-break: break-word;
}

.accounts-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: start;
}

.accounts-layout.editor-open {
  grid-template-columns: minmax(500px, 680px) minmax(0, 1fr);
}

.accounts-list-panel,
.account-editor {
  padding: 14px;
}

.accounts-list-head {
  display: grid;
  gap: 5px;
  margin-bottom: 10px;
}

.accounts-grid {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 10px;
}

.account-card {
  flex: 1 1 230px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #fff;
  display: grid;
  gap: 7px;
}

.account-card.active,
.inbox-item-card.active {
  border-color: var(--accent-2);
  box-shadow: 0 8px 18px rgba(31, 111, 235, 0.12);
}

.account-card h4 {
  font-size: 1rem;
}

.account-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.account-card-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.account-card-head h4 {
  margin: 0;
}

.account-method-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.account-method-chip {
  font-size: 0.72rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  padding: 4px 7px;
  color: var(--muted);
}

.account-method-chip.on {
  color: var(--ok);
  border-color: rgba(15, 157, 88, 0.36);
  background: rgba(15, 157, 88, 0.08);
}

.account-meta-grid {
  display: grid;
  gap: 6px;
}

.account-meta-label {
  display: block;
  font-size: 0.74rem;
  color: var(--muted);
}

.account-meta-value {
  font-size: 0.84rem;
  color: var(--text);
}

.copyable-api-key {
  cursor: pointer;
  user-select: none;
  border-bottom: 1px dashed var(--line-strong);
}

.copyable-api-key:hover {
  color: var(--accent-2);
  border-bottom-color: var(--accent-2);
}

.account-inline-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.account-inline-input {
  flex: 1 1 220px;
  min-width: 0;
}

.account-inline-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

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

.account-editor-actions {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.payment-section {
  padding: 12px;
}

.payment-content[hidden] {
  display: none !important;
}

.toggle-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

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

.toggle-hitbox,
.toggle-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.toggle-inline {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.toggle-row {
  justify-content: space-between;
  width: 100%;
  font-size: 0.86rem;
}

.toggle-hitbox input,
.toggle-row input {
  display: none;
}

.toggle-switch {
  width: 44px;
  height: 24px;
  background: #c7d2e7;
  border-radius: 999px;
  position: relative;
  transition: background 0.2s ease;
}

.toggle-switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.toggle-hitbox input:checked + .toggle-switch,
.toggle-row input:checked + .toggle-switch {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.toggle-hitbox input:checked + .toggle-switch::after,
.toggle-row input:checked + .toggle-switch::after {
  transform: translateX(20px);
}

.toggle-meta {
  color: var(--muted);
  font-size: 0.82rem;
}

.toggle-meta.danger {
  color: var(--danger);
}

.wizard-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
}

.wizard-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 21, 38, 0.58);
}

.wizard-dialog {
  position: relative;
  z-index: 1;
  width: min(1020px, calc(100% - 32px));
  max-height: calc(100vh - 30px);
  overflow: auto;
  margin: 15px auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 24px 52px rgba(0, 0, 0, 0.24);
}

.wizard-head,
.wizard-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.wizard-foot {
  border-top: 1px solid var(--line);
  border-bottom: 0;
  justify-content: flex-end;
}

.wizard-body {
  padding: 14px;
  display: grid;
  gap: 10px;
}

.wizard-split {
  grid-template-columns: 0.9fr 1.1fr;
}

.wizard-copy-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wizard-code {
  flex: 1;
  padding: 10px;
  border-radius: 10px;
  border: 1px dashed var(--line-strong);
  background: var(--surface-soft);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.84rem;
}

.wizard-mail-preview iframe,
.inbox-email-frame {
  width: 100%;
  min-height: 230px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.inbox-list,
.inbox-viewer {
  display: grid;
  gap: 8px;
  align-content: start;
}

.inbox-email-text {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: #f7f9fd;
  color: var(--muted);
  font-size: 0.83rem;
}

.inbox-viewer-head p {
  margin: 5px 0;
  font-size: 0.84rem;
  color: var(--muted);
}

.otp-qr {
  max-width: 220px;
  border-radius: 10px;
  border: 1px solid var(--line);
}

.otp-body {
  display: grid;
  place-items: center;
}

.otp-shell {
  width: min(430px, calc(100% - 30px));
  padding: 24px;
}

.otp-brand {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
}

.otp-brand img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.otp-form {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.pangeiaid-login-status {
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.toast-root {
  position: fixed;
  right: 14px;
  bottom: 14px;
  display: grid;
  gap: 8px;
  z-index: 2500;
}

.toast {
  padding: 10px 12px;
  border-radius: 10px;
  color: #fff;
  font-weight: 600;
  font-size: 0.84rem;
  box-shadow: var(--shadow);
  animation: toastIn 0.18s ease;
}

.toast-info {
  background: #2c5aa0;
}

.toast-success {
  background: #157b4d;
}

.toast-error {
  background: #b3261e;
}

.toast-hide {
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.22s ease;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1100px) {
  .dashboard-filter-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .topnav {
    display: none;
  }
  .site-shell {
    width: min(100%, calc(100% - 22px));
    margin-top: 14px;
  }
  .accounts-layout {
    grid-template-columns: 1fr;
  }
  .accounts-layout.editor-open {
    grid-template-columns: 1fr;
  }
  .account-editor-head {
    flex-direction: column;
    align-items: flex-start;
  }
  .account-editor-actions {
    width: 100%;
    justify-content: flex-start;
  }
  .hero-grid,
  .grid-3,
  .chart-grid,
  .chart-grid-3,
  .form-grid,
  .section-grid,
  .insight-grid,
  .wizard-split {
    grid-template-columns: 1fr;
  }
  .page-head,
  .cta-strip {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 600px) {
  .topbar {
    padding: 12px;
  }
  .panel,
  .hero-main,
  .hero-side {
    padding: 14px;
  }
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .dashboard-filter-row {
    grid-template-columns: 1fr 1fr;
  }
}
