:root {
  color-scheme: light;
  --background: #f5f6f7;
  --paper: #fff;
  --ink: #141b18;
  --muted: #52605a;
  --line: #dde4df;
  --accent: #125d42;
  --accent-hover: #084b32;
  --tint: #e6f3eb;
  --radius: 19px;
  --width: 520px;
  --nav-height: 68px;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--ink); background: var(--background); }
p, h1, dl, dd { margin: 0; }
input, button { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .66; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
a { color: var(--accent); text-underline-offset: .2em; }
h1 { font-size: 2.125rem; line-height: 1.14; letter-spacing: -.055em; font-weight: 740; }

main {
  width: min(var(--width), calc(100% - 32px));
  margin-inline: auto;
  padding-top: calc(25px + env(safe-area-inset-top));
  padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom) + 32px);
}

.initial, .lead { color: var(--muted); line-height: 1.45; }
.screen > .lead, .auth-box > .lead { margin: 8px 0 16px; }
.screen > .surface, .screen > .segmented { margin-top: 14px; }

.surface, .auth-box, .balance {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  padding: 17px;
}

.auth-box { max-width: 406px; margin: 18px auto 0; }
.auth-box > .segmented { margin-bottom: 22px; }

form { display: flex; flex-direction: column; gap: 9px; }
form label, .field-label { font-size: .875rem; font-weight: 680; }
form label:not(:first-child) { margin-top: 4px; }
input {
  width: 100%;
  min-height: 47px;
  border: 1px solid #cbd6cf;
  border-radius: 11px;
  color: var(--ink);
  background: #fbfcfb;
  padding: 10px 12px;
}
input::placeholder { color: var(--muted); }
:is(.password-field, .recipient-field) { position: relative; display: flex; align-items: center; }
:is(.password-field, .recipient-field) input { padding-right: 91px; }
:is(.password-field, .recipient-field) button { position: absolute; right: 4px; padding: 0 7px; min-height: 44px; border: 0; background: transparent; color: var(--accent); font-size: .8125rem; font-weight: 700; }
.recipient-field button:hover { text-decoration: underline; }
#password-hint { color: var(--muted); }
form > .button { margin-top: 4px; }

.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  min-height: 45px;
  padding: 10px 14px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-weight: 680;
  text-align: center;
}
.primary { background: var(--accent); color: #fff; }
.primary:hover { background: var(--accent-hover); }
.secondary { background: var(--paper); border-color: #cbd6cf; color: var(--accent); }
.secondary:hover, .settings-links a:hover { background: var(--tint); }
.error, .notice { padding: 10px 12px; border-radius: 11px; line-height: 1.4; font-size: .875rem; }
.error { background: #fdf0ee; color: #8d2c20; }
.notice { background: var(--tint); color: #234b3a; }
.wallet-message { margin-bottom: 14px; }

.recipient-actions { display: flex; justify-content: space-between; gap: 8px; margin-top: -5px; }
.recipient-actions button {
  min-height: 44px;
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  text-align: left;
  font-size: .875rem;
  font-weight: 680;
}
.recipient-actions button:hover { text-decoration: underline; }
.recipient-actions button[aria-disabled="true"] { color: var(--muted); cursor: wait; }
.favorites-panel { border: 1px solid var(--line); border-radius: 11px; background: #fbfcfb; }
.favorites-panel p { padding: 11px 12px; color: var(--muted); font-size: .875rem; }
.favorites-panel ul { margin: 0; padding: 0; list-style: none; }
.favorites-panel li + li { border-top: 1px solid var(--line); }
.favorites-panel button {
  width: 100%;
  min-height: 44px;
  padding: 9px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--accent);
  text-align: left;
  font: .875rem/1.5 ui-monospace, monospace;
  overflow-wrap: anywhere;
}
.favorites-panel button:hover { background: var(--tint); }

.balance {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 14px;
  background: var(--tint);
  border-color: #d8e9df;
}
.balance-label, .reserved { color: #355347; font-size: .875rem; }
.balance-value { font-size: 2.45rem; line-height: 1.12; font-weight: 740; letter-spacing: -.065em; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.balance-value small { color: #355347; font-size: .95rem; font-weight: 700; letter-spacing: 0; }

.rows div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 9px 0; }
.rows div + div { border-top: 1px solid var(--line); }
.rows dt { color: var(--muted); }
.rows dd { font-weight: 670; font-variant-numeric: tabular-nums; text-align: right; overflow-wrap: anywhere; }
.quote, .settings-list { font-size: .9375rem; }

.receive-card { display: grid; gap: 10px; }
.qr { display: block; margin: 0 auto 4px; }
.address {
  display: block;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 11px;
  background: var(--background);
  font: .875rem/1.5 ui-monospace, monospace;
  text-align: center;
  overflow-wrap: anywhere;
  user-select: all;
}
.deposit-search { padding-block: 7px; }
.deposit-search summary { padding: 11px 0; color: var(--accent); font-weight: 680; cursor: pointer; }
.deposit-search form { padding-bottom: 9px; }

.segmented { display: grid; grid-auto-columns: 1fr; grid-auto-flow: column; gap: 2px; padding: 3px; background: #e7ebe8; border-radius: 11px; }
.segmented button {
  min-width: 0;
  min-height: 42px;
  padding: 5px 2px;
  color: var(--muted);
  font-size: .875rem;
  font-weight: 650;
  border: 0;
  border-radius: 8px;
  background: transparent;
}
.segmented button[aria-pressed="true"] { color: var(--ink); background: var(--paper); box-shadow: 0 1px 3px #19352624; }
.empty { display: grid; gap: 6px; text-align: center; padding: 24px 0; }
.empty p:first-child { font-weight: 680; }
.empty p:last-child { color: var(--muted); font-size: .875rem; }
.operations { list-style: none; margin: 0; padding: 0; }
.operations li { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; gap: 5px 8px; padding: 11px 0; font-size: .9375rem; }
.operations li + li { border-top: 1px solid var(--line); }
.operations time, .operations small { display: block; color: var(--muted); font-size: .8125rem; margin-top: 3px; }
.operation-status { grid-row: 2; color: var(--muted); font-size: .875rem; }
.operation-status.confirmed, .operation-amount.deposit { color: var(--accent); }
.operation-status.failed { color: #8d2c20; }
.operation-amount { grid-column: 2; grid-row: 1 / span 2; text-align: right; font-weight: 700; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.more { display: flex; width: 100%; margin-top: 6px; }

.settings-list, .settings-links { padding-block: 5px; }
.settings-links a { display: block; padding: 12px 0; font-weight: 650; }
.settings-links a + a { border-top: 1px solid var(--line); }
.logout { width: 100%; background: var(--paper); color: #982f24; border-color: var(--line); }
.logout:hover { background: #fdf0ee; }

.navigation {
  position: fixed;
  z-index: 1;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(100%, calc(var(--width) + 32px));
  padding-inline: max(6px, env(safe-area-inset-left)) max(6px, env(safe-area-inset-right));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--paper);
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 17px 17px 0 0;
  box-shadow: 0 -6px 28px #1935260b;
}
.tabbar { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: stretch; padding: 5px 0; min-height: var(--nav-height); gap: 2px; }
.tab { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 2px; padding: 3px 0; font-size: .8125rem; font-weight: 650; line-height: 1.25; color: var(--muted); border: 0; border-radius: 12px; background: transparent; }
.tab svg { width: 24px; height: 24px; flex-shrink: 0; }
.tab:hover { background: #f0f4f1; }
.tab[aria-selected="true"] { color: var(--accent); background: var(--tint); font-weight: 740; }

@media (max-width: 552px) {
  .navigation { border-inline: 0; border-radius: 0; }
}

@media (max-width: 360px) {
  main {
    width: calc(100% - 24px);
    padding-top: calc(19px + env(safe-area-inset-top));
  }
  .surface, .balance, .auth-box { padding-inline: 13px; }
  .tab { font-size: .75rem; }
  .segmented button { font-size: .8125rem; }
}
