:root {
  font-family: Inter, 'Segoe UI', sans-serif;
  color: var(--ink);
  background: #18191c;
  color-scheme: dark;
  font-synthesis: none;
  --ink: #f0f1f4;
  --muted: #adb2bd;
  --line: #34373d;
  --surface: #222428;
  --header: #1e1f23;
  --raised: #292b30;
  --input: #22262d;
  --input-line: #404958;
  --accent: #aac8f1;
  --primary: #a9c7f4;
  --primary-hover: #bdd5f8;
  --primary-ink: #152339;
  --soft: #303c4e;
  --soft-ink: #c1d7f8;
  --error: #eca0aa;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 300px; }
button, textarea, input, select { font: inherit; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; }
button:disabled { cursor: default; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.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; }
.shell { width: min(100% - 64px, 1080px); margin-inline: auto; }

.topbar { background: var(--header); border-bottom: 1px solid var(--line); }
.topbar-inner { min-height: 73px; display: flex; align-items: center; gap: 32px; }
.brand { display: inline-flex; align-items: center; gap: 9px; flex: 0 0 auto; font-size: 20px; font-weight: 730; letter-spacing: -.045em; }
.brand-accent { color: var(--accent); }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; background: var(--soft); display: grid; align-content: center; gap: 3px; padding: 7px; }
.brand-mark i { display: block; height: 2px; width: 15px; border-radius: 3px; background: var(--accent); transform: skewY(-17deg); }
.brand-mark i:nth-child(2) { width: 11px; }
.brand-mark i:nth-child(3) { width: 7px; }
.brand-product { border-left: 1px solid var(--line); padding-left: 9px; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .035em; }
.primary-nav { display: flex; gap: 4px; align-items: center; }
.primary-nav a { padding: 9px 12px; border-radius: 8px; color: var(--muted); font-size: 14px; font-weight: 650; white-space: nowrap; }
.primary-nav a:hover, .primary-nav a[aria-current] { background: var(--soft); color: var(--soft-ink); }
.primary-nav #sign-out { margin-left: 8px; padding: 9px 6px; white-space: nowrap; }
.wallet { margin-left: auto; display: flex; align-items: center; gap: 13px; }
.wallet-amount { display: flex; flex-direction: column; gap: 3px; text-align: right; white-space: nowrap; }
.wallet-amount span { color: var(--muted); font-size: 11px; }
.wallet-amount strong { font-size: 16px; font-variant-numeric: tabular-nums; line-height: 1; }

.main-content { padding-top: clamp(28px, 5vw, 55px); padding-bottom: 30px; }
.account-notice { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; padding: 12px 16px; border: 1px solid var(--input-line); border-radius: 9px; background: var(--surface); color: var(--muted); font-size: 14px; }
.auth-panel { max-width: 420px; margin-inline: auto; padding: clamp(21px, 5vw, 32px); }
.auth-panel h1 { font-size: 30px; }
.auth-panel > p { color: var(--muted); margin-top: 8px; }
.auth-panel form { display: grid; gap: 8px; margin-top: 21px; }
.auth-panel label, #topup-form label, #rate-form label { font-size: 14px; font-weight: 650; }
.auth-panel input, #topup-amount, #topup-method, #sell-rate { width: 100%; min-height: 42px; padding: 8px 12px; color: var(--ink); background: var(--input); border: 1px solid var(--input-line); border-radius: 8px; }
.auth-panel label:not(:first-child) { margin-top: 7px; }
.auth-panel button { margin-top: 9px; }
.auth-panel > a { display: inline-block; margin-top: 4px; }
.send-access { padding: 14px 16px; line-height: 1.45; background: var(--soft); border-color: #536781; }
.send-access-copy { flex: 1 1 230px; }
.send-access-title { color: var(--ink); font-size: 16px; font-weight: 700; }
.send-access-detail { margin-top: 4px; }
.send-access-countdown { color: var(--soft-ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.send-access-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.send-access .form-error { flex-basis: 100%; margin-top: 0; }
.admin-panel { max-width: 530px; padding: clamp(18px, 4vw, 27px); }
#rate-form { display: grid; gap: 8px; }
#rate-form .hint { margin: 0; }
#rate-form button, #retry-rate { justify-self: start; margin-top: 8px; }
.page-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 28px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(34px, 5vw, 49px); line-height: 1.04; letter-spacing: -.055em; font-weight: 740; }
.page-heading p { color: var(--muted); line-height: 1.55; font-size: 15px; margin-top: 10px; }
h2, .message-heading label { color: var(--ink); font-size: 18px; font-weight: 700; letter-spacing: -.025em; }
.button { min-height: 42px; border-radius: 9px; border: 1px solid transparent; display: inline-flex; align-items: center; justify-content: center; gap: 12px; padding: 9px 14px; font-size: 14px; font-weight: 660; line-height: 1.2; white-space: nowrap; transition: background-color .15s, border-color .15s; }
.button-small { min-height: 36px; padding-inline: 12px; font-size: 13px; }
.button-secondary { color: var(--ink); background: var(--raised); border-color: var(--input-line); }
.button-secondary:hover { background: var(--soft); border-color: #56657b; }
.button-primary { color: var(--primary-ink); background: var(--primary); border-color: #b7d0f7; }
.button-primary:hover { background: var(--primary-hover); }
.button-primary:disabled { color: var(--muted); background: var(--raised); border-color: var(--line); }

.workspace-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, 1fr); gap: 20px; align-items: start; }
.surface { background: var(--surface); border: 1px solid var(--line); border-radius: 17px; box-shadow: 0 4px 15px #0002; }
.compose-section { padding: 23px 25px; }
.message-section, .send-checklist { border-top: 1px solid var(--line); }
.send-checklist ol { display: grid; gap: 5px; margin: 8px 0 0; padding-inline-start: 20px; }
.tabs { display: flex; width: max-content; max-width: 100%; gap: 3px; padding: 4px; margin: 15px 0 12px; background: var(--raised); border-radius: 9px; }
.tabs button { background: transparent; color: var(--muted); border: 1px solid transparent; border-radius: 6px; min-height: 33px; font-weight: 650; font-size: 13px; padding: 5px 11px; }
.tabs button:hover { color: var(--soft-ink); }
.tabs button[aria-selected='true'] { color: #d0e2fd; background: #3a4b65; border-color: #4b6081; }
textarea { width: 100%; min-height: 104px; display: block; resize: vertical; padding: 12px 14px; border: 1px solid var(--input-line); border-radius: 9px; background: var(--input); color: var(--ink); font-size: 15px; line-height: 1.55; transition: border-color .15s; }
textarea::placeholder { color: var(--muted); opacity: 1; }
textarea:focus { border-color: var(--accent); outline: 2px solid #aac8f160; outline-offset: 1px; }
.numbers-input { font-variant-numeric: tabular-nums; }
.hint { color: var(--muted); font-size: 13px; line-height: 1.45; margin-top: 8px; }
.message-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 11px; }
.counter { color: var(--soft-ink); background: var(--soft); padding: 5px 9px; border-radius: 6px; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.counter[data-over='true'] { background: #412c36; color: var(--error); }
.form-error { color: var(--error); font-size: 13px; font-weight: 600; margin-top: 8px; line-height: 1.45; }
.drop-area { position: relative; min-height: 106px; padding: 14px; border: 1px dashed #666f81; border-radius: 9px; background: var(--input); display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.drop-area[data-drag='true'] { border-color: var(--accent); background: var(--soft); }
.drop-area:focus-within .file-button { outline: 3px solid var(--accent); outline-offset: 3px; }
.drop-area strong { font-size: 14px; }
.drop-area p { margin-top: 3px; }
.upload-icon { display: grid; place-items: center; background: var(--soft); border-radius: 8px; width: 36px; height: 36px; color: var(--soft-ink); font-size: 21px; font-weight: 700; }
.file-button { margin-left: auto; cursor: pointer; }
.file-status { display: flex; justify-content: space-between; gap: 10px; align-items: center; background: var(--raised); border-radius: 8px; margin-top: 10px; padding: 8px 10px; font-size: 13px; }
.file-status span { overflow-wrap: anywhere; }
.text-button { color: var(--accent); border: 0; background: transparent; text-decoration: underline; text-underline-offset: 3px; font-size: 13px; font-weight: 650; padding: 3px 0; }

.summary { padding: 22px; }
.summary-heading { display: flex; gap: 10px; align-items: center; }
.summary-icon { width: 32px; height: 32px; border-radius: 8px; background: var(--soft); display: grid; align-content: center; gap: 3px; padding: 8px; }
.summary-icon i { display: block; height: 2px; width: 15px; background: var(--accent); border-radius: 2px; }
.summary-icon i:last-child { width: 10px; }
.summary-counts { display: grid; gap: 12px; padding: 0; margin: 19px 0; }
.summary-counts div { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; line-height: 1.3; }
.summary-counts dt { color: var(--muted); }
.summary-counts dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.estimate { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 15px 12px; border-radius: 9px; background: var(--raised); }
.estimate span { font-size: 14px; font-weight: 700; }
.estimate .hint { font-size: 12px; margin-top: 3px; }
.estimate strong { font-size: 23px; letter-spacing: -.045em; white-space: nowrap; font-variant-numeric: tabular-nums; }
.review-button { width: 100%; margin-top: 17px; min-height: 46px; }
.review-hint { min-height: 2.9em; text-align: center; font-size: 12px; margin-top: 9px; }

.history { overflow: auto; }
.history-notice { padding: 18px; color: var(--muted); font-size: 14px; }
.delivery-counts { display: flex; flex-wrap: wrap; gap: 4px; }
.empty { padding: 36px 25px; text-align: center; }
.empty p { margin: 8px 0 12px; font-size: 14px; color: var(--muted); }
table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
th, td { text-align: left; border-bottom: 1px solid var(--line); padding: 14px 18px; }
th { font-size: 12px; color: var(--muted); background: var(--raised); }
tbody tr:last-child td { border-bottom: 0; }
.status-label { display: inline-block; border-radius: 6px; padding: 4px 7px; background: var(--soft); color: var(--soft-ink); font-size: 12px; font-weight: 650; }

dialog { max-width: 460px; width: calc(100% - 36px); padding: 0; color: var(--ink); background: #25282f; border: 1px solid #465164; border-radius: 16px; box-shadow: 0 16px 60px #0008; }
dialog::backdrop { background: #0b0c0eb0; }
.dialog-content { padding: 24px; }
.dialog-content h2 { font-size: 23px; }
.dialog-copy { color: var(--muted); font-size: 14px; line-height: 1.5; margin: 10px 0 14px; }
.message-preview { padding: 12px; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--input); border: 1px solid var(--line); border-radius: 8px; font-size: 14px; line-height: 1.45; }
.refund-notice { padding: 9px 11px; color: var(--soft-ink); background: var(--raised); border-radius: 8px; }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: end; gap: 8px; margin-top: 19px; }
#topup-amount, #topup-method { display: block; margin-top: 7px; }
#topup-form label[for='topup-method'] { display: block; margin-top: 14px; }
.toast { position: fixed; z-index: 2; bottom: 20px; left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 32px); border-radius: 10px; background: var(--soft); color: var(--soft-ink); box-shadow: 0 5px 22px #0006; padding: 11px 15px; font-size: 14px; line-height: 1.4; }
.toast:empty { visibility: hidden; }

@media (max-width: 730px) {
  .shell { width: calc(100% - 36px); }
  .topbar-inner { flex-wrap: wrap; gap: 10px 18px; padding-top: 13px; }
  .primary-nav { order: 3; width: 100%; padding-bottom: 9px; }
  .primary-nav a { padding: 7px 10px; }
  .primary-nav #sign-out { margin-left: auto; }
  .workspace-grid { grid-template-columns: minmax(0, 1fr); gap: 13px; }
  .page-heading { margin-bottom: 20px; align-items: start; }
  .compose-section, .summary { padding: 18px; }
}
@media (max-width: 415px) {
  .shell { width: calc(100% - 28px); }
  .brand { font-size: 18px; gap: 6px; }
  .brand-mark { width: 27px; height: 27px; padding: 6px; }
  .brand-product { padding-left: 6px; }
  .wallet { gap: 7px; }
  .wallet-amount span { font-size: 10px; }
  .wallet .button { padding-inline: 8px; }
  .page-heading { flex-wrap: wrap; gap: 12px; }
  th, td { padding: 11px 8px; font-size: 12px; }
  .status-label { font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }
