/* mypremium.store — application shell and shared components. */

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--body);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.drawer-open { overflow: hidden; }

h1, h2, h3, h4, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; }
[x-cloak] { display: none !important; }

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---------- Logo ---------- */

.logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  color: #000;
  font-size: 17px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -.015em;
  white-space: nowrap;
}
.logo img { width: 30px; height: 30px; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  transition: background-color .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease);
}
.btn:disabled { cursor: not-allowed; opacity: .68; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-strong); }
.btn-secondary { background: var(--surface); border-color: var(--border); color: var(--body); }
.btn-secondary:hover:not(:disabled) { background: #f8fafc; color: var(--ink); }
.btn-block { width: 100%; }
.btn-auth { height: 44px; }
.btn .ti { font-size: 17px; }

.spinner {
  width: 16px;
  height: 16px;
  flex: none;
  border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.spinner-dark {
  border-color: rgba(37, 99, 235, .2);
  border-top-color: var(--primary);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Auth layout ---------- */

.auth-layout {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}
.auth-main {
  width: 50%;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}
.auth-view { width: 100%; display: flex; justify-content: center; }
.auth-view > .view-page { width: 100%; display: flex; justify-content: center; }

.auth-promo {
  position: relative;
  width: 50%;
  min-height: 100vh;
  flex: none;
  display: flex;
  align-items: center;
  padding: 64px 72px;
  overflow: hidden;
  background: var(--promo-bg) url('../assets/promo-pattern.svg') center / cover no-repeat;
}
.auth-promo-content { width: 560px; max-width: 100%; }
.promo-headline {
  max-width: 460px;
  margin: 0 0 25px;
  color: #fff;
  font-size: 36px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -.015em;
}
.promo-bar {
  width: 40px;
  height: 4px;
  margin-bottom: 23px;
  border-radius: 2px;
  background: var(--promo-line);
}
.promo-sub {
  max-width: 420px;
  margin: 0 0 23px;
  color: var(--promo-text);
  font-size: 15px;
  line-height: 1.6;
}
.promo-bullets {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}
/* The reset-password canvas uses a taller 24px rhythm than sign in/register. */
.promo-forgot-password .promo-bullets { gap: 24px; }
.promo-bullet {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  line-height: 24px;
}
.promo-bullet .ti { flex: none; color: var(--primary); font-size: 20px; }

/* ---------- Auth card / forms ---------- */

.auth-card {
  width: 420px;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 40px;
  background: var(--surface);
  /* A visual border only: the card's content box must stay exactly 340px. */
  box-shadow: 0 0 0 1px var(--border);
  border-radius: var(--radius-card);
}
.auth-logo { height: 32px; }
.auth-card > form { display: flex; flex-direction: column; gap: 20px; }
.auth-heading {
  color: var(--ink);
  font-size: 20px;
  font-weight: 700;
  line-height: 24px;
  letter-spacing: -.01em;
}
.auth-heading:focus,
.page-title:focus { outline: none; }
.auth-sub {
  color: var(--body);
  font-size: 14px;
  line-height: 21px;
}
.auth-muted { color: var(--body); font-size: 13px; line-height: 24px; }
.auth-link { color: var(--primary); font-size: 13px; font-weight: 500; line-height: 24px; }
.auth-link:hover { color: var(--primary-strong); text-decoration: underline; }
.auth-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 24px;
  font-size: 13px;
  text-align: center;
}
.auth-footer .auth-link { line-height: 24px; }

.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.field > label {
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  line-height: 24px;
}
.field-box {
  position: relative;
  display: flex;
  align-items: center;
  height: 44px;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.field-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.field.invalid .field-box {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, .1);
}
.field-box > input {
  width: 100%;
  height: 100%;
  min-width: 0;
  padding: 0 14px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  font-size: 14px;
}
.field-box > input::placeholder { color: var(--muted); }
.field-box > input:focus { outline: none; }
.field-box.has-action > input { padding-right: 46px; }
.field-action {
  position: absolute;
  right: 6px;
  top: 6px;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}
.field-action:hover { background: #f1f5f9; color: var(--ink); }
.field-action .ti { font-size: 17px; }

.auth-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 24px;
}
.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--body);
  font-size: 13px;
  line-height: 24px;
  cursor: pointer;
  user-select: none;
}
.checkbox input {
  appearance: none;
  width: 16px;
  height: 16px;
  flex: none;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  display: grid;
  place-content: center;
  cursor: pointer;
  transition: background-color .12s var(--ease), border-color .12s var(--ease);
}
.checkbox input:checked { background: var(--primary); border-color: var(--primary); }
.checkbox input:checked::after {
  content: "";
  width: 8px;
  height: 4px;
  margin-top: -2px;
  border-left: 1.6px solid #fff;
  border-bottom: 1.6px solid #fff;
  transform: rotate(-45deg);
}
.checkbox input:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 24px;
  color: var(--muted);
  font-size: 12px;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.alert {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 13px;
  line-height: 18px;
}
.alert .ti { flex: none; margin-top: 1px; font-size: 16px; }
.alert-danger { background: var(--danger-bg); border-color: #fecaca; color: #b91c1c; }
.alert-danger .ti { color: var(--danger); }
.alert-inline { margin-bottom: 0; }

.strength { display: flex; flex-direction: column; gap: 8px; margin-top: -12px; }
.strength-bars { display: flex; gap: 6px; }
.strength-bars span {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: #e2e8f0;
  transition: background-color .18s var(--ease);
}
.strength-bars span.medium { background: var(--warning); }
.strength-bars span.strong { background: var(--success); }
.strength-hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 24px;
}
.strength-hint.state-medium { color: #b45309; }
.strength-hint.state-strong { color: #047857; }

.forgot-host { min-width: 0; }
.forgot-form { display: flex; flex-direction: column; gap: 20px; }
.forgot-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: center;
  width: fit-content;
  color: var(--body);
  font-size: 14px;
  font-weight: 500;
  line-height: 24px;
}
.forgot-back .ti { font-size: 14px; }
.forgot-back:hover { color: var(--ink); }

.auth-success {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-height: 140px;
  padding: 4px 0;
  text-align: center;
}
.auth-success-icon {
  width: 40px;
  height: 40px;
  margin-bottom: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--success-bg);
  color: var(--success);
}
.auth-success-icon .ti { font-size: 24px; }
.auth-success h3 { color: var(--ink); font-size: 18px; font-weight: 600; line-height: 24px; }
.auth-success p { color: var(--body); font-size: 14px; line-height: 21px; }
.auth-success p strong { color: var(--ink); font-weight: 500; overflow-wrap: anywhere; }

/* ---------- Panel shell ---------- */

.panel-layout { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--topbar-h);
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.hamburger {
  display: none;
  width: 40px;
  height: 40px;
  flex: none;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--body);
}
.hamburger:hover { background: #f1f5f9; color: var(--ink); }
.hamburger .ti { font-size: 22px; }

.avatar-wrap { position: relative; }
.avatar-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: transparent;
}
.avatar-circle {
  width: 36px;
  height: 36px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .01em;
}
.avatar-btn .ti {
  color: var(--body);
  font-size: 16px;
  transition: transform .16s var(--ease);
}
.avatar-btn[aria-expanded="true"] .ti { transform: rotate(180deg); }
.avatar-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }

.avatar-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 232px;
  height: 135px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--surface);
  /* Border drawn with a shadow so the 232×135 box and 220px items are exact. */
  box-shadow: 0 0 0 1px var(--border), var(--shadow-dropdown);
  border-radius: var(--radius);
  z-index: 60;
}
.avatar-menu a,
.avatar-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 36px;
  flex: none;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--body);
  font-size: 14px;
  line-height: 1;
  text-align: left;
}
.avatar-menu a + a { margin-top: 2px; }
.avatar-menu a:hover,
.avatar-menu button:hover { background: #f8fafc; color: var(--ink); }
.avatar-menu .ti { flex: none; font-size: 16px; color: var(--body); }
.avatar-menu .divider { height: 1px; flex: none; margin: 6px 0; background: var(--border); }
.avatar-menu .danger { color: var(--danger); }
.avatar-menu .danger .ti { color: var(--danger); }
.avatar-menu .danger:hover { background: var(--danger-bg); color: var(--danger); }

.panel-body { display: flex; flex: 1; min-height: 0; }
.sidebar {
  position: sticky;
  top: var(--topbar-h);
  width: var(--sidebar-w);
  height: calc(100vh - var(--topbar-h));
  flex: none;
  overflow-y: auto;
  padding: 16px 12px;
  background: var(--surface);
  /* Inset border keeps each nav item at its exact 216px width. */
  box-shadow: inset -1px 0 0 var(--border);
}
.nav-list { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 40px;
  padding: 0 12px;
  border-radius: var(--radius);
  color: var(--body);
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  transition: background-color .14s var(--ease), color .14s var(--ease);
}
.nav-item .ti { flex: none; width: 20px; color: var(--muted); font-size: 20px; }
.nav-item:hover { background: #f8fafc; color: var(--ink); }
.nav-item:hover .ti { color: var(--body); }
.nav-item.active { background: var(--primary-soft); color: var(--primary); }
.nav-item.active .ti { color: var(--muted); }

.panel-main {
  flex: 1;
  min-width: 0;
  padding: var(--content-pad);
  background: var(--bg);
}
.scrim { display: none; }

/* ---------- Pages ---------- */

.view-mount { min-width: 0; }
.view-page { min-width: 0; }
.page {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.page-title {
  color: var(--ink);
  font-size: 24px;
  font-weight: 700;
  line-height: 24px;
  letter-spacing: -.02em;
}
.page-sub { margin-top: 4px; color: var(--body); font-size: 14px; line-height: 21px; }
.card {
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--border);
  border-radius: var(--radius-card);
}
.card-pad { padding: 24px; }
.card-title { color: var(--ink); font-size: 16px; font-weight: 600; line-height: 24px; }

/* ---------- Panel components ---------- */

.btn-lg { height: 44px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.page-value { color: var(--muted); font-size: 13px; line-height: 24px; }

/* Balance cards */
.balance-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 16px;
}
.balance-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 0 0 1px var(--border);
}
.balance-head {
  height: 32px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}
.coin-glyph {
  width: 32px;
  height: 32px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  line-height: 24px;
}
.balance-ticker {
  min-width: 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  line-height: 24px;
  white-space: nowrap;
}
.balance-amount {
  color: var(--ink);
  font-size: 20px;
  font-weight: 700;
  line-height: 24px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.balance-fiat { color: var(--muted); font-size: 13px; line-height: 24px; }

/* Tables */
.table-card {
  min-width: 0;
  padding: 24px 0 16px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 0 0 1px var(--border);
  overflow: hidden;
}
.panel-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 24px 20px;
}
.recent-card,
.api-keys-card { padding-top: 0; }
.table-wrap { width: 100%; overflow-x: auto; }
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}
.data-table th {
  height: 44px;
  padding: 0;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 24px;
  letter-spacing: .5px;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}
.data-table td {
  height: 56px;
  padding: 0;
  border-bottom: 1px solid var(--border);
  color: var(--body);
  font-size: 13px;
  line-height: 24px;
  vertical-align: middle;
}
.data-table th:first-child,
.data-table td:first-child { padding-left: 24px; }
.data-table th:last-child,
.data-table td:last-child { padding-right: 24px; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table .cell-link {
  color: var(--primary);
  font-family: var(--font-mono);
  font-size: 13px;
}
.data-table .cell-muted { color: var(--muted); }
.data-table .cell-strong { color: var(--ink); font-weight: 500; }
.data-table .cell-mono { font-family: var(--font-mono); font-size: 13px; }
.data-table .cell-small { font-size: 12px; }
.data-table .cell-date { font-size: 14px; }
.data-table .key-name { font-size: 14px; }
.data-table .empty-cell { color: var(--muted); text-align: center; padding: 32px 24px !important; }
.data-table .empty-cell::before { content: none; }
.amount-stack { display: flex; flex-direction: column; gap: 2px; }
.amount-main {
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  line-height: 24px;
}
.badge {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  line-height: 24px;
  white-space: nowrap;
}
.badge-completed { background: var(--success-bg); color: var(--success); }
.badge-pending { background: var(--warning-bg); color: var(--warning); }
.badge-failed { background: var(--danger-bg); color: var(--danger); }
.badge-new { background: #f0f9ff; color: #0ea5e9; }
.badge-cancelled { background: #f1f5f9; color: #64748b; }

.table-foot {
  min-height: 32px;
  margin-top: 16px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.table-count { color: var(--muted); font-size: 13px; line-height: 24px; }
.pagination { display: flex; align-items: center; gap: 8px; }
.page-btn {
  width: 32px;
  height: 32px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--body);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
}
.page-btn .ti { color: var(--muted); font-size: 14px; }
.page-btn:hover:not(:disabled) { background: #f8fafc; color: var(--ink); }
.page-btn.is-active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}
.page-btn:disabled { cursor: default; }

.icon-btn {
  width: 24px;
  height: 24px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}
.icon-btn:hover { background: #f1f5f9; color: var(--ink); }
.icon-btn .ti { font-size: 14px; }
.link-danger {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--danger);
  font-size: 13px;
  font-weight: 500;
  line-height: 24px;
}
.link-danger:hover { color: #dc2626; text-decoration: underline; }
.link-primary {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--primary);
  font-size: 13px;
  font-weight: 500;
  line-height: 24px;
}
.link-primary:hover { color: var(--primary-strong); text-decoration: underline; }
.dest-cell { display: flex; align-items: center; gap: 6px; min-width: 0; }
.dest-cell .dest-addr {
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.actions-cell { display: flex; align-items: center; gap: 12px; }
.pubkey-cell { display: flex; align-items: center; gap: 6px; min-width: 0; }
.pubkey-cell .pubkey-text {
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Filters */
.filters { display: flex; align-items: center; gap: 12px; min-width: 0; }
.filter-control,
.search-control {
  position: relative;
  height: 36px;
  display: flex;
  align-items: center;
  flex: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--body);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.filter-control:focus-within,
.search-control:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.filter-control select {
  appearance: none;
  width: 100%;
  height: 100%;
  padding: 0 32px 0 12px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--body);
  font-size: 13px;
  line-height: 24px;
  cursor: pointer;
}
.filter-control select:focus { outline: none; }
.filter-control > .ti {
  position: absolute;
  right: 12px;
  color: var(--muted);
  font-size: 14px;
  pointer-events: none;
}
.filter-control.has-leading > .filter-leading { left: 12px; right: auto; }
.filter-control.has-leading select { padding-left: 34px; }
.filter-currency { width: 180px; }
.filter-status { width: 160px; }
.filter-date { width: 190px; }
.search-control { flex: 1 1 570px; min-width: 0; padding: 0 12px; gap: 8px; }
.search-control > .ti { flex: none; color: var(--muted); font-size: 14px; }
.search-control input {
  width: 100%;
  height: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  outline: none;
}
.search-control input::placeholder { color: var(--muted); }

/* Section tabs */
.section-tabs {
  height: 40px;
  display: flex;
  align-items: stretch;
  gap: 24px;
  border-bottom: 1px solid var(--border);
}
.section-tab {
  position: relative;
  height: 40px;
  padding: 0 4px;
  border: 0;
  background: transparent;
  color: var(--body);
  font-size: 14px;
  font-weight: 500;
  line-height: 24px;
  white-space: nowrap;
}
.section-tab:hover { color: var(--ink); }
.section-tab.is-active { color: var(--primary); }
.section-tab.is-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  border-radius: 1px;
  background: var(--primary);
}
.tab-panel { min-width: 0; }
.api-keys-card { padding-bottom: 24px; }

/* Plugins */
.plugin-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.plugin-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 0 0 1px var(--border);
}
.plugin-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.plugin-icon {
  width: 44px;
  height: 44px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-size: 24px;
}
.plugin-version {
  height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 22px;
}
.plugin-name { color: var(--ink); font-size: 16px; font-weight: 600; line-height: 24px; }
.plugin-desc { color: var(--muted); font-size: 13px; line-height: 19.5px; }
.plugin-actions { margin-top: auto; display: flex; align-items: center; gap: 12px; }
.plugin-guide { color: var(--primary); font-size: 13px; font-weight: 500; line-height: 24px; }
.plugin-guide:hover { color: var(--primary-strong); text-decoration: underline; }

/* API docs */
.docs-layout { display: flex; align-items: flex-start; gap: 24px; min-width: 0; }
.docs-nav {
  width: 200px;
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 0 0 1px var(--border);
}
.docs-nav button {
  height: 36px;
  flex: none;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--body);
  font-size: 13px;
  font-weight: 500;
  line-height: 24px;
  text-align: left;
  white-space: nowrap;
}
.docs-nav button:hover { background: #f8fafc; color: var(--ink); }
.docs-nav button.is-active { background: var(--primary-soft); color: var(--primary); }
.docs-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 0 0 1px var(--border);
}
.docs-title { color: var(--ink); font-size: 16px; font-weight: 600; line-height: 24px; }
.docs-endpoint {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--bg);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 24px;
}
.docs-method { color: var(--primary); font-weight: 600; }
.docs-path { color: var(--body); }
.docs-desc { color: var(--body); font-size: 13px; line-height: 19.5px; }
.params-table { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.params-row {
  min-height: 44px;
  display: grid;
  grid-template-columns: 110px 90px 100px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  line-height: 24px;
}
.params-row:last-child { border-bottom: 0; }
.params-head {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .5px;
  text-transform: uppercase;
}
.params-name { font-family: var(--font-mono); color: var(--ink); }
.params-type { color: var(--body); }
.params-required { color: var(--ink); font-weight: 500; }
.params-optional { color: var(--muted); font-weight: 500; }
.params-desc { color: var(--body); font-size: 13px; }
.docs-code {
  margin: 0;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--body);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 19.2px;
  white-space: pre;
  overflow-x: auto;
}

/* Settings forms */
.form-card {
  width: 480px;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 24px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 0 0 1px var(--border);
}
.form-card .btn-lg { width: 100%; }
.form-card .card-title { margin: 0; }

/* Modals */
body.modal-open { overflow: hidden; }
.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(15, 23, 42, .4);
}
.modal {
  width: 480px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: 24px;
  background: var(--surface);
  border-radius: 12px;
  box-shadow: var(--shadow-modal);
}
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.modal-title { color: var(--ink); font-size: 18px; font-weight: 600; line-height: 24px; }
.modal-close {
  width: 32px;
  height: 32px;
  flex: none;
  margin: 0 -4px 0 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}
.modal-close:hover { background: #f1f5f9; color: var(--ink); }
.modal-close .ti { font-size: 16px; }
.modal-form { display: flex; flex-direction: column; gap: 20px; margin-top: 20px; }
.modal-avail {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: -12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 24px;
}
.modal-fee { color: var(--muted); font-size: 13px; line-height: 24px; }
.modal-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.key-box {
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 14px;
  border-radius: var(--radius);
  background: var(--bg);
}
.key-box .key-text {
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 24px;
  color: var(--body);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.key-box .icon-btn { margin-right: -6px; }
.modal-warning {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--warning-bg);
  color: var(--warning);
  font-size: 12px;
  font-weight: 500;
  line-height: 24px;
}
.modal-warning .ti { flex: none; font-size: 16px; }


/* Phase 1 panel placeholders — the real page bodies arrive in phase 2. */
.placeholder-card {
  min-height: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 32px;
  text-align: center;
}
.placeholder-icon {
  width: 56px;
  height: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
}
.placeholder-icon .ti { font-size: 28px; }
.placeholder-card h2 { color: var(--ink); font-size: 16px; font-weight: 600; line-height: 24px; }
.placeholder-card p { max-width: 420px; color: var(--muted); font-size: 13px; line-height: 20px; }

/* Loading / error states for lazily loaded pages */
.view-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 320px;
  color: var(--muted);
  font-size: 13px;
}
.auth-view .view-loading { min-height: 544px; }
.view-loading .spinner { width: 20px; height: 20px; border-width: 2px; }
.view-error {
  max-width: 440px;
  margin: 64px auto;
  padding: 32px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
}
.view-error .ti { margin: 0 auto 12px; color: var(--danger); font-size: 28px; }
.view-error h2 { color: var(--ink); font-size: 16px; font-weight: 600; }
.view-error p { margin: 6px 0 20px; color: var(--body); font-size: 13px; }

/* ---------- Toasts ---------- */

.toasts {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1000;
  width: min(360px, calc(100vw - 32px));
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 12px 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius);
  box-shadow: var(--shadow-dropdown);
  pointer-events: auto;
}
.toast.ok { border-left-color: var(--success); }
.toast.danger { border-left-color: var(--danger); }
.toast.info { border-left-color: var(--primary); }
.toast > .ti { flex: none; margin-top: 1px; font-size: 18px; color: var(--primary); }
.toast.ok > .ti { color: var(--success); }
.toast.danger > .ti { color: var(--danger); }
.toast-body { flex: 1; min-width: 0; }
.toast-title { color: var(--ink); font-size: 13px; font-weight: 600; line-height: 18px; }
.toast-text { color: var(--body); font-size: 13px; line-height: 18px; overflow-wrap: anywhere; }
.toast-close {
  flex: none;
  width: 24px;
  height: 24px;
  margin: -2px -2px 0 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}
.toast-close:hover { background: #f1f5f9; color: var(--ink); }
.toast-close .ti { font-size: 15px; }

/* ---------- Responsive ---------- */

/* Keep every data table at its designed width; the wrapper scrolls between
   1024 and 1439px instead of squeezing columns. */
.data-table { min-width: 1136px; }

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

@media (max-width: 1099px) {
  .auth-promo { padding: 48px; }
  .promo-headline { font-size: 32px; }
}

@media (max-width: 1023px) {
  .hamburger { display: inline-flex; }
  .topbar { padding: 0 16px; }
  .sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    bottom: 0;
    height: auto;
    z-index: 45;
    visibility: hidden;
    transform: translateX(-100%);
    transition: transform .22s var(--ease), visibility .22s var(--ease);
    box-shadow: inset -1px 0 0 var(--border), 8px 0 24px rgba(15, 23, 42, .08);
  }
  .panel-layout.drawer-open .sidebar {
    visibility: visible;
    transform: translateX(0);
  }
  .scrim {
    display: block;
    position: fixed;
    inset: var(--topbar-h) 0 0;
    z-index: 40;
    background: rgba(15, 23, 42, .42);
    opacity: 0;
    visibility: hidden;
    transition: opacity .2s var(--ease), visibility .2s;
  }
  .panel-layout.drawer-open .scrim { opacity: 1; visibility: visible; }
  .panel-main { padding: 24px; }
}

@media (min-width: 1024px) {
  .scrim { display: none !important; }
}

@media (max-width: 899px) {
  .auth-layout { display: block; }
  .auth-main { width: 100%; min-height: 100vh; padding: 32px 24px; }
  .auth-promo { display: none; }
}

@media (max-width: 767px) {
  .auth-main { padding: 24px 16px; }
  .auth-card { padding: 28px 24px; border-radius: var(--radius-card); }
  .auth-card .auth-heading { font-size: 20px; }
  .promo-headline { font-size: 28px; }
  .topbar { padding: 0 12px; }
  .logo { gap: 7px; font-size: 16px; }
  .logo img { width: 28px; height: 28px; }
  .panel-main { padding: 20px 16px; }
  .page-title { font-size: 22px; line-height: 24px; }
  .page { gap: 20px; }
  .page-head { flex-wrap: wrap; align-items: flex-start; gap: 12px; }
  .balance-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters { flex-wrap: wrap; }
  .filter-control { flex: 1 1 140px; width: auto; }
  .search-control { flex: 1 1 100%; }
  .plugin-grid { grid-template-columns: 1fr; }
  .docs-layout { flex-direction: column; }
  .docs-nav {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    overflow: visible;
  }
  .docs-nav button { flex: none; }
  .docs-content { width: 100%; padding: 20px; }
  .params-head { display: none; }
  .params-row {
    grid-template-columns: 1fr 1fr;
    gap: 4px 12px;
    padding: 10px 12px;
    align-items: start;
  }
  .params-desc { grid-column: 1 / -1; }
  .form-card { width: 100%; }
  .table-foot { flex-wrap: wrap; }
  .panel-card-head { padding: 20px 16px 16px; }
  .section-tabs { gap: 20px; overflow-x: auto; }
  .toasts { right: 16px; bottom: 16px; }
  .auth-view .view-loading { min-height: 420px; }
}

@media (max-width: 720px) {
  .table-card { padding-top: 0; padding-bottom: 8px; }
  .table-wrap { overflow: visible; }
  .data-table { min-width: 0; }
  .data-table,
  .data-table tbody,
  .data-table tr,
  .data-table td { display: block; width: 100%; }
  .data-table colgroup,
  .data-table thead { display: none; }
  .data-table tr {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
  }
  .data-table tr:last-child { border-bottom: 0; }
  .data-table td,
  .data-table td:first-child,
  .data-table td:last-child {
    height: auto;
    min-height: 28px;
    padding: 2px 0;
    border: 0;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    text-align: right;
  }
  .data-table td::before {
    content: attr(data-label);
    flex: none;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    line-height: 24px;
    letter-spacing: .5px;
    text-align: left;
    text-transform: uppercase;
  }
  .data-table td > * { min-width: 0; max-width: 66%; }
  .data-table td .amount-stack { align-items: flex-end; }
  .data-table td .dest-cell,
  .data-table td .pubkey-cell,
  .data-table td .actions-cell { justify-content: flex-end; }
  .data-table td .badge { flex: none; }
  .table-foot { margin-top: 8px; padding: 8px 16px; }
}

@media (max-width: 480px) {
  .auth-card { padding: 24px 20px; }
  .auth-options { gap: 8px; }
  .avatar-menu { right: -4px; }
  .page-title { font-size: 20px; }
  .balance-row { grid-template-columns: 1fr; }
  .filter-control { flex: 1 1 100%; }
  .modal { padding: 20px; }
  .modal-form { gap: 16px; }
  .modal-avail { margin-top: -8px; }
  .page-btn { width: 30px; height: 30px; }
}

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