:root {
  --bg: #061116;
  --surface: #0c242c;
  --surface-2: #12323c;
  --surface-3: #173d49;
  --line: rgba(142, 220, 224, 0.18);
  --text: #f4fbfd;
  --muted: rgba(226, 240, 243, 0.68);
  --teal: #8edce0;
  --green: #51d4ad;
  --gold: #d6b75f;
  --danger: #ff8585;
  --sans: "Outfit", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--text); font-family: var(--sans); }
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input { font: inherit; }
[hidden] { display: none !important; }

.account-header { border-bottom: 1px solid var(--line); background: #071a21; }
.account-header-inner { max-width: 1180px; min-height: 66px; margin: 0 auto; padding: 0 24px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.account-brand { color: var(--text); display: inline-flex; align-items: center; gap: 11px; font-weight: 700; font-size: 18px; }
.account-brand:hover { text-decoration: none; }
.account-header nav { display: flex; align-items: center; gap: 20px; font-size: 14px; }

main { max-width: 1180px; min-height: calc(100vh - 160px); margin: 0 auto; padding: 48px 24px 64px; }
.eyebrow { color: var(--gold); font-size: 12px; font-weight: 700; letter-spacing: 1px; margin: 0 0 10px; }
h1 { font-size: 40px; line-height: 1.12; letter-spacing: 0; margin: 0; }
h2 { font-size: 21px; letter-spacing: 0; margin: 0; }

.loading-view { min-height: 420px; display: grid; place-items: center; align-content: center; gap: 16px; color: var(--muted); }
.spinner { width: 34px; height: 34px; border: 3px solid rgba(142, 220, 224, .18); border-top-color: var(--teal); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.login-layout { min-height: 600px; display: grid; grid-template-columns: minmax(0, 1fr) 430px; align-items: center; gap: 80px; }
.login-copy > p:not(.eyebrow) { max-width: 640px; color: var(--muted); font-size: 18px; line-height: 1.6; }
.boundary-list { margin: 34px 0 0; border-top: 1px solid var(--line); }
.boundary-list div { display: grid; grid-template-columns: 120px 1fr; gap: 20px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.boundary-list dt { color: var(--teal); font-weight: 600; }
.boundary-list dd { color: var(--muted); margin: 0; }
.login-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 28px; }
.login-panel h2 { margin-bottom: 22px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; margin: 18px 0; }
.divider::before, .divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }
label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 7px; }
input { width: 100%; height: 44px; border: 1px solid var(--line); border-radius: 6px; background: #081c23; color: var(--text); padding: 0 12px; outline: none; }
input:focus { border-color: var(--teal); box-shadow: 0 0 0 2px rgba(142, 220, 224, .12); }
#email-submit { width: 100%; margin-top: 12px; justify-content: center; }
.fine-print { color: var(--muted); font-size: 12px; line-height: 1.55; margin: 18px 0 0; }

.button { min-height: 38px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); border-radius: 6px; padding: 8px 14px; background: var(--surface-2); color: var(--text); cursor: pointer; font-weight: 600; font-size: 14px; }
.button:hover:not(:disabled) { background: var(--surface-3); text-decoration: none; }
.button:disabled { opacity: .45; cursor: not-allowed; }
.button.primary { background: var(--gold); border-color: var(--gold); color: #091419; }
.button.primary:hover:not(:disabled) { background: #e5c76d; }
.button.quiet { background: transparent; }
.button.danger { border-color: rgba(255, 133, 133, .58); background: rgba(255, 133, 133, .1); color: #ffd1d1; }
.button.danger:hover:not(:disabled) { background: rgba(255, 133, 133, .18); }
.button.telegram { width: 100%; background: #1f8cc5; border-color: #36a7df; }
.status { min-height: 20px; color: var(--muted); font-size: 13px; margin: 14px 0 0; }
.status[data-state="error"] { color: var(--danger); }
.status[data-state="success"] { color: var(--green); }

.dashboard-title-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 34px; }
.subtitle { color: var(--muted); margin: 10px 0 0; }
.notice { border-left: 3px solid var(--teal); background: rgba(142, 220, 224, .08); color: var(--text); padding: 12px 16px; margin-bottom: 22px; }
.notice[data-state="error"] { border-color: var(--danger); color: #ffd1d1; background: rgba(255, 133, 133, .08); }
.notice[data-state="success"] { border-color: var(--green); }
.overview-band { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-bottom: 38px; }
.overview-band > div { padding: 19px 20px; border-right: 1px solid var(--line); }
.overview-band > div:first-child { padding-left: 0; }
.overview-band > div:last-child { border-right: 0; }
.overview-band span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.overview-band strong { font-family: var(--mono); font-size: 18px; }

.dashboard-section { margin-top: 34px; }
.section-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; padding-bottom: 13px; border-bottom: 1px solid var(--line); }
.section-heading p { color: var(--muted); margin: 5px 0 0; font-size: 14px; }
.identity-method-list { display: grid; gap: 8px; padding-top: 12px; }
.identity-method { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; }
.identity-method span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.identity-method strong { font-family: var(--mono); font-size: 14px; overflow-wrap: anywhere; }
.identity-link-form { padding: 14px; border-left: 2px solid var(--teal); background: rgba(142, 220, 224, .05); }
.identity-link-form > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
.wallet-list { display: grid; gap: 8px; padding-top: 12px; }
.wallet-row { display: grid; grid-template-columns: minmax(0, 1fr) 180px 140px 82px; align-items: center; gap: 18px; min-height: 72px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; }
.wallet-address { font-family: var(--mono); font-size: 13px; overflow-wrap: anywhere; }
.wallet-meta, .wallet-source { color: var(--muted); font-size: 12px; }
.wallet-balance { font-family: var(--mono); text-align: right; }
.wallet-unlink { width: 82px; }
.compact-actions { margin: 0; }
.active-wallet-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(160px, .7fr) minmax(180px, .8fr); gap: 10px; margin-top: 16px; }
.active-wallet-grid > div { min-height: 88px; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; }
.active-wallet-grid span { display: block; margin-bottom: 8px; color: var(--muted); font-size: 11px; }
.active-wallet-grid strong { display: block; color: var(--green); overflow-wrap: anywhere; }
#active-wallet-address { color: var(--text); font-family: var(--mono); font-size: 12px; }
.active-wallet-send-form { margin-top: 14px; }
.active-wallet-send-form fieldset { display: grid; grid-template-columns: minmax(240px, 1fr) minmax(130px, .35fr) auto; align-items: end; gap: 8px 12px; margin: 0; border: 0; padding: 0; }
.active-wallet-send-form label { color: var(--muted); font-size: 11px; }
.active-wallet-send-form input { width: 100%; min-height: 42px; border: 1px solid var(--line); border-radius: 5px; padding: 9px 11px; background: var(--bg); color: var(--text); }
.active-wallet-send-form input:focus { border-color: var(--teal); outline: 2px solid rgba(142, 220, 224, .15); }
.active-wallet-send-form #active-wallet-recipient { grid-column: 1; }
.active-wallet-send-form label[for="active-wallet-amount"] { grid-column: 2; grid-row: 1; }
.cell-amount-field { grid-column: 2; display: grid; grid-template-columns: minmax(0, 1fr) 52px; }
.cell-amount-field input { border-radius: 5px 0 0 5px; }
.cell-amount-field span { display: grid; place-items: center; border: 1px solid var(--line); border-left: 0; border-radius: 0 5px 5px 0; color: var(--green); font-size: 11px; font-weight: 700; }
.active-wallet-send-form .button { grid-column: 3; grid-row: 2; min-height: 42px; }
.empty-state { padding: 40px 0 10px; color: var(--muted); }
.empty-state strong { color: var(--text); font-size: 17px; }
.empty-state p { margin: 6px 0 16px; }

.security-section { margin-top: 48px; }
.security-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); margin-top: 16px; }
.security-grid > div { min-height: 142px; background: var(--surface); padding: 20px; }
.security-label { display: block; color: var(--teal); font-size: 12px; margin-bottom: 15px; }
.security-grid strong { display: block; margin-bottom: 7px; }
.security-grid small { color: var(--muted); line-height: 1.5; }
.section-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.account-removal { margin-top: 30px; padding-top: 20px; border-top: 1px solid rgba(255, 133, 133, .28); display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.account-removal p { max-width: 740px; color: var(--muted); font-size: 13px; line-height: 1.5; margin: 5px 0 0; }

dialog { width: min(560px, calc(100vw - 32px)); border: 1px solid var(--line); border-radius: 8px; padding: 0; background: var(--surface); color: var(--text); box-shadow: 0 24px 80px rgba(0, 0, 0, .48); }
dialog::backdrop { background: rgba(1, 9, 12, .78); }
dialog form { padding: 26px; }
dialog form > p:not(.eyebrow):not(.status) { color: var(--muted); line-height: 1.6; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.dialog-close { width: 36px; height: 36px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 26px; line-height: 1; }
.dialog-close:hover { color: var(--text); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

footer { max-width: 1180px; margin: 0 auto; padding: 24px; border-top: 1px solid var(--line); color: var(--muted); display: flex; justify-content: space-between; gap: 20px; font-size: 13px; }
footer p { margin: 0; }
footer nav { display: flex; gap: 18px; }

@media (max-width: 820px) {
  .account-header-inner { padding: 0 16px; }
  .account-header nav > a { display: none; }
  main { padding: 32px 16px 48px; }
  h1 { font-size: 31px; }
  .login-layout { display: block; min-height: 0; }
  .login-copy { margin-bottom: 30px; }
  .boundary-list { display: none; }
  .login-panel { padding: 22px; }
  .dashboard-title-row { align-items: flex-start; flex-direction: column; }
  .overview-band { grid-template-columns: 1fr; }
  .overview-band > div, .overview-band > div:first-child { padding: 13px 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .overview-band > div:last-child { border-bottom: 0; }
  .identity-method { align-items: flex-start; flex-direction: column; }
  .identity-method .button { width: 100%; }
  .identity-link-form > div { grid-template-columns: 1fr; }
  .wallet-row { grid-template-columns: 1fr; gap: 7px; }
  .wallet-balance { text-align: left; }
  .wallet-unlink { width: 100%; }
  .active-wallet-grid, .active-wallet-send-form fieldset { grid-template-columns: 1fr; }
  .active-wallet-send-form label,
  .active-wallet-send-form #active-wallet-recipient,
  .active-wallet-send-form label[for="active-wallet-amount"],
  .cell-amount-field,
  .active-wallet-send-form .button { grid-column: 1; grid-row: auto; }
  .security-grid { grid-template-columns: 1fr; }
  .account-removal { align-items: flex-start; flex-direction: column; }
  .account-removal .button { width: 100%; }
  .dialog-actions { flex-direction: column-reverse; }
  .dialog-actions .button { width: 100%; }
  footer { flex-direction: column; }
}
