/*
  Wasabi: Built for Freedom — design system (mobile-first).

  Look: deep green-black surfaces, soft glass cards, lime accents sampled from the logo
  (#a5f829 → #72d014 → #4e9e05, ink #0f0e0d), rounded outline icons (see templates/macros/icons.html).
  Base styles target phones; @media (min-width: 768px) upgrades to the desktop window + sidebar layout.
*/

/* ───────────── Tokens ───────────── */
:root {
  color-scheme: dark;

  --wb-bg: #060a07;
  --wb-card: #0e150f;
  --wb-card-2: #131c14;
  --wb-field: #0a100b;
  --wb-line: rgba(200, 255, 130, 0.1);
  --wb-line-2: rgba(200, 255, 130, 0.2);

  --wb-text: #f3f8ef;
  --wb-text-2: #cbd6c6;
  --wb-muted: #8a9a85;
  --wb-faint: #5f6d5b;

  --wb-ink: #0f0e0d;
  --wb-accent-hot: #a5f829;
  --wb-accent: #72d014;
  --wb-accent-deep: #4e9e05;
  --wb-accent-soft: rgba(114, 208, 20, 0.16);
  --wb-accent-glow: rgba(114, 208, 20, 0.35);

  --wb-pos: #86e51f;
  --wb-neg: #ff6b6b;
  --wb-warn: #f5c542;

  --wb-btn: linear-gradient(180deg, #b9f74f 0%, #8ddf1c 55%, #6cc10f 100%);
  --wb-panel: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));

  --wb-font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif;
  --tabbar-h: 4.6rem;
}

/* ───────────── Reset ─────────────
   Self-contained: the app no longer loads Tailwind from a CDN (a render-blocking third-party script). */
*,
*::before,
*::after {
  box-sizing: border-box;
  border-width: 0;
  border-style: solid;
  border-color: #e5e7eb;
}

html {
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  tab-size: 4;
}

body {
  margin: 0;
  line-height: inherit;
}

hr {
  height: 0;
  color: inherit;
  border-top-width: 1px;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-size: inherit;
  font-weight: inherit;
}

b,
strong {
  font-weight: bolder;
}

small {
  font-size: 80%;
}

table {
  text-indent: 0;
  border-color: inherit;
  border-collapse: collapse;
}

button,
input,
optgroup,
select,
textarea {
  font-family: inherit;
  font-size: 100%;
  font-weight: inherit;
  line-height: inherit;
  color: inherit;
  margin: 0;
  padding: 0;
}

button,
select {
  text-transform: none;
}

button,
[type="button"],
[type="reset"],
[type="submit"] {
  -webkit-appearance: button;
  background-color: transparent;
  background-image: none;
}

blockquote,
dl,
dd,
h1,
h2,
h3,
h4,
h5,
h6,
hr,
figure,
p,
pre {
  margin: 0;
}

fieldset {
  margin: 0;
  padding: 0;
}

legend {
  padding: 0;
}

ol,
ul,
menu {
  list-style: none;
  margin: 0;
  padding: 0;
}

textarea {
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  opacity: 1;
  color: #9ca3af;
}

button,
[role="button"] {
  cursor: pointer;
}

:disabled {
  cursor: default;
}

img,
svg,
video,
canvas,
audio,
iframe,
embed,
object {
  display: block;
  vertical-align: middle;
}

img,
video {
  max-width: 100%;
  height: auto;
}

[hidden] {
  display: none;
}

/* ───────────── Base ───────────── */

/* Zoom is disabled app-wide: no pinch-zoom or double-tap zoom (scrolling still works). */
html,
body {
  touch-action: pan-x pan-y;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-family: var(--wb-font);
  color: var(--wb-text);
  background:
    radial-gradient(90% 46% at 50% -8%, rgba(114, 208, 20, 0.2), transparent 62%),
    radial-gradient(60% 40% at 105% 32%, rgba(78, 158, 5, 0.12), transparent 62%),
    var(--wb-bg);
  background-repeat: no-repeat;
}

body.modal-open {
  overflow: hidden;
}

a,
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

a {
  text-decoration: none;
}

button {
  border: 0;
  cursor: pointer;
  background: none;
  -webkit-tap-highlight-color: transparent;
}

h1,
h2,
h3,
p {
  margin: 0;
}

:focus-visible {
  outline: 2px solid var(--wb-accent-hot);
  outline-offset: 2px;
}

.pos {
  color: var(--wb-pos);
}

.neg {
  color: var(--wb-neg);
}

.cell-right {
  text-align: right;
}

/* Visibility helpers (mirror the Tailwind names used in the templates so layout never depends on the CDN). */
.hidden {
  display: none !important;
}

@media (min-width: 768px) {
  .md\:hidden {
    display: none !important;
  }

  .md\:block {
    display: block !important;
  }

  .md\:flex {
    display: flex !important;
  }

  .md\:grid {
    display: grid !important;
  }

  .md\:inline {
    display: inline !important;
  }
}

/* ───────────── Icons ───────────── */
.ico {
  width: 1.5rem;
  height: 1.5rem;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  overflow: visible;
  --ico-fill: transparent;
  --ico-fill-soft: transparent;
}

.ico-lime {
  stroke: url(#wb-grad);
  --ico-fill: url(#wb-grad);
  --ico-fill-soft: rgba(114, 208, 20, 0.16);
}

/* ───────────── Toasts (flash messages) ───────────── */
.flash-stack {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 0.75rem);
  left: 50%;
  z-index: 90;
  transform: translateX(-50%);
  width: min(26rem, calc(100vw - 2rem));
  display: grid;
  gap: 0.5rem;
  pointer-events: none;
}

.flash-card {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.7rem 0.9rem 0.7rem 0.7rem;
  border-radius: 16px;
  border: 1px solid var(--wb-line-2);
  background: rgba(16, 24, 17, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.5);
  font-size: 0.92rem;
  font-weight: 600;
  animation: toast-in 0.32s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.flash-icon {
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--wb-accent-soft);
}

.flash-icon .ico {
  width: 1.05rem;
  height: 1.05rem;
  stroke-width: 2.3;
}

.flash-error {
  border-color: rgba(255, 107, 107, 0.4);
}

.flash-error .flash-icon {
  color: var(--wb-neg);
  background: rgba(255, 107, 107, 0.15);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.98);
  }
}

/* ───────────── Confirm dialog ───────────── */
.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom))
    max(1rem, env(safe-area-inset-left));
}

.confirm-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 6, 4, 0.66);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.confirm-modal-card {
  position: relative;
  width: min(24rem, 100%);
  padding: 1.5rem 1.35rem 1.25rem;
  border-radius: 24px;
  border: 1px solid var(--wb-line-2);
  background: linear-gradient(180deg, #172018, #0d130e);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  animation: pop-in 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.confirm-modal-title {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.confirm-modal-message {
  margin-top: 0.5rem;
  color: var(--wb-muted);
  line-height: 1.5;
}

.confirm-modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin-top: 1.35rem;
}

.confirm-modal-cancel,
.confirm-modal-approve {
  min-height: 2.9rem;
  padding: 0.55rem 1rem;
  border-radius: 14px;
  font-weight: 700;
}

.confirm-modal-cancel {
  color: var(--wb-text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--wb-line-2);
}

.confirm-modal-approve {
  color: #ff9a9a;
  background: rgba(255, 107, 107, 0.14);
  border: 1px solid rgba(255, 107, 107, 0.4);
}

@keyframes pop-in {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(6px);
  }
}

/* ───────────── Buttons ───────────── */
.plain-primary-button,
.plain-secondary-button,
.plain-danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 3rem;
  padding: 0.7rem 1.4rem;
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-align: center;
  transition: transform 0.12s ease, filter 0.15s ease, background 0.15s ease;
}

.plain-primary-button:active,
.plain-secondary-button:active,
.plain-danger-button:active {
  transform: scale(0.98);
}

.plain-primary-button {
  color: var(--wb-ink);
  background: var(--wb-btn);
  box-shadow: 0 10px 28px rgba(114, 208, 20, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.plain-primary-button:hover {
  filter: brightness(1.06);
}

.plain-secondary-button {
  color: var(--wb-text);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--wb-line-2);
}

.plain-secondary-button:hover {
  background: rgba(255, 255, 255, 0.09);
}

.plain-danger-button {
  color: #ff9a9a;
  background: rgba(255, 107, 107, 0.14);
  border: 1px solid rgba(255, 107, 107, 0.4);
}

.wallet-cta {
  width: 100%;
  min-height: 3.4rem;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.sheet-actions {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 0.65rem;
  padding-top: 0.25rem;
}

/* ───────────── Fields ───────────── */
.form-sheet {
  display: grid;
  gap: 1.05rem;
  padding: 1.15rem;
  border-radius: 22px;
  border: 1px solid var(--wb-line);
  background: var(--wb-panel);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.3);
}

.field-row {
  display: grid;
  gap: 0.45rem;
}

.field-row label {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--wb-text-2);
}

.field-control {
  min-width: 0;
}

.field-control-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.9fr);
  gap: 0.6rem;
}

/* Selectors carry an element name so they out-rank Tailwind's forms plugin (loaded after this file). */
input.plain-input,
textarea.plain-textarea,
button.ios-picker-trigger {
  width: 100%;
  min-height: 3rem;
  padding: 0.7rem 0.95rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 2px solid rgba(255, 255, 255, 0.12);
  background-color: var(--wb-field);
  color: var(--wb-text);
  font-size: 1rem; /* 16px keeps iOS from zooming on focus */
  line-height: 1.3;
  box-shadow: none;
  outline: none;
  appearance: none;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

textarea.plain-textarea {
  min-height: 7rem;
  resize: vertical;
}

input.plain-input::placeholder,
textarea.plain-textarea::placeholder {
  color: var(--wb-faint);
  opacity: 1;
}

input.plain-input:focus,
textarea.plain-textarea:focus,
.ios-picker:focus-within button.ios-picker-trigger {
  outline: none;
  border-color: rgba(114, 208, 20, 0.45);
  border-bottom-color: var(--wb-accent);
  background-color: #0c140d;
  box-shadow: 0 0 0 3px var(--wb-accent-soft);
}

/* Valid, non-empty fields get a lime underline and a check mark (like the reference dialogs). */
input.plain-input:required:not([type="date"]):not(:placeholder-shown):valid {
  border-bottom-color: var(--wb-accent-deep);
  padding-right: 2.7rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2372d014' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.8 4.2 4.2L19 7.2'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
  background-size: 1.15rem;
}

input.plain-input[type="date"] {
  color-scheme: dark;
  min-width: 0;
}

/* Native <select> stays in the DOM for form posts; ios-select.js swaps in the styled picker below. */
select.ios-picker-native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
  appearance: none !important;
  background: transparent none !important;
}

.ios-picker {
  position: relative;
  width: 100%;
  min-width: 0;
}

button.ios-picker-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  text-align: left;
}

.ios-picker-value {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ios-picker-chevron {
  display: flex;
  flex-shrink: 0;
  color: var(--wb-accent);
}

.ios-picker-mount {
  position: fixed;
  inset: 0;
  z-index: 160;
  pointer-events: none;
}

.ios-picker-mount > * {
  pointer-events: auto;
}

.ios-picker-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 6, 4, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.ios-picker-sheet-wrap {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 1;
  transform: translateZ(0);
}

.ios-picker-sheet {
  padding: 0.35rem;
  border-radius: 18px;
  border: 1px solid var(--wb-line-2);
  background: rgba(17, 25, 18, 0.96);
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  overflow-x: hidden;
  overflow-y: auto;
  animation: pop-in 0.16s ease;
}

.ios-picker-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.7rem 0.8rem;
  border-radius: 12px;
  color: var(--wb-text);
  font-size: 1rem;
  text-align: left;
}

.ios-picker-option:hover,
.ios-picker-option:focus-visible {
  outline: none;
  background: var(--wb-accent-soft);
}

.ios-picker-check {
  width: 1.1rem;
  flex-shrink: 0;
  font-weight: 800;
  color: var(--wb-accent);
}

.ios-picker-option-label {
  flex: 1;
  min-width: 0;
}

/* ───────────── Brand marks ───────────── */
.brand-logo {
  display: block;
  flex-shrink: 0;
  object-fit: cover;
  border-radius: 24%;
  box-shadow: 0 0 0 1px rgba(114, 208, 20, 0.32), 0 6px 18px rgba(0, 0, 0, 0.4);
}

/* ───────────── Auth screen ───────────── */
.auth-screen {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  background:
    radial-gradient(90% 52% at 50% -10%, rgba(114, 208, 20, 0.3), transparent 62%),
    radial-gradient(70% 46% at 112% 62%, rgba(78, 158, 5, 0.18), transparent 62%),
    var(--wb-bg);
}

/* Soft dotted "coin" shapes, like the reference backdrop. */
.auth-screen::before,
.auth-screen::after {
  content: "";
  position: absolute;
  z-index: 0;
  border-radius: 50%;
  pointer-events: none;
}

.auth-screen::before {
  right: -4.5rem;
  top: 46%;
  width: 11rem;
  height: 11rem;
  background: radial-gradient(circle, rgba(114, 208, 20, 0.22) 0 36%, rgba(114, 208, 20, 0.1) 37% 68%, transparent 69%);
  box-shadow: inset 0 0 0 0.5rem rgba(114, 208, 20, 0.08);
}

.auth-screen::after {
  left: -4rem;
  bottom: 6%;
  width: 9rem;
  height: 9rem;
  border: 0.9rem dotted rgba(114, 208, 20, 0.1);
}

.auth-stage {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  align-content: center;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(1.5rem, env(safe-area-inset-top)) max(1.25rem, env(safe-area-inset-right)) max(1.5rem, env(safe-area-inset-bottom))
    max(1.25rem, env(safe-area-inset-left));
}

.auth-dropzone {
  width: 100%;
  max-width: 26.5rem;
  transition: opacity 0.25s ease, filter 0.25s ease;
}

.auth-stage-modal .auth-dropzone {
  opacity: 0.35;
  filter: blur(3px);
  pointer-events: none;
}

.auth-access-shell {
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
}

.auth-access-brand {
  text-align: center;
}

.auth-hero-mark {
  position: relative;
  width: 7rem;
  height: 7rem;
  margin: 0 auto 1rem;
  display: grid;
  place-items: center;
}

.auth-hero-mark::before {
  content: "";
  position: absolute;
  inset: -30%;
  background: radial-gradient(circle, rgba(114, 208, 20, 0.42), transparent 62%);
  filter: blur(14px);
}

.auth-access-logo {
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 10px 26px rgba(0, 0, 0, 0.55));
}

.auth-access-brand-mark {
  display: block;
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 1.1;
}

.auth-access-tagline {
  margin-top: 0.3rem;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--wb-accent-hot);
}

.auth-access-blurb {
  max-width: 21rem;
  margin: 0.7rem auto 0;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--wb-muted);
}

.auth-access-group {
  margin: 0;
  padding: 0;
  list-style: none;
  overflow: hidden;
  border-radius: 22px;
  border: 1px solid var(--wb-line-2);
  background: var(--wb-panel);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.4);
}

.auth-access-group > li + li {
  border-top: 1px solid var(--wb-line);
}

.auth-access-row-form {
  margin: 0;
}

.auth-access-row {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  width: 100%;
  min-height: 4.1rem;
  padding: 0.75rem 1rem;
  text-align: left;
  transition: background 0.15s ease;
}

.auth-access-row:hover,
.auth-access-row:active {
  background: rgba(114, 208, 20, 0.07);
}

.auth-access-icon {
  width: 2.6rem;
  height: 2.6rem;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 14px;
  border: 1px solid rgba(114, 208, 20, 0.22);
  background: var(--wb-accent-soft);
}

.auth-access-copy {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.auth-access-title {
  font-size: 1.02rem;
  font-weight: 700;
}

.auth-access-sub {
  font-size: 0.84rem;
  color: var(--wb-muted);
}

.auth-access-chevron .ico {
  width: 1.05rem;
  height: 1.05rem;
  color: var(--wb-faint);
}

/* Sign in / create account — bottom sheet on phones, centred dialog on larger screens. */
.auth-modal-layer {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(3, 6, 4, 0.66);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.auth-panel {
  width: 100%;
  max-width: 28rem;
  padding: 0.85rem 1.35rem calc(1.5rem + env(safe-area-inset-bottom));
  border-radius: 28px 28px 0 0;
  border: 1px solid var(--wb-line-2);
  border-bottom: 0;
  background: linear-gradient(180deg, #172018, #0d130e);
  box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.6);
  animation: sheet-up 0.32s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.auth-panel::before {
  content: "";
  display: block;
  width: 2.6rem;
  height: 0.28rem;
  margin: 0 auto 1.1rem;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.18);
}

.auth-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.35rem;
}

.auth-panel-head-title {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.15;
}

.auth-panel-head-close {
  padding: 0.35rem 0.6rem;
  margin: -0.2rem -0.6rem 0 0;
  border-radius: 10px;
  font-size: 0.95rem;
  color: var(--wb-muted);
}

.auth-panel-head-close:hover {
  color: var(--wb-text);
}

.auth-form {
  display: grid;
  gap: 1.1rem;
}

.auth-field {
  display: grid;
  gap: 0.45rem;
}

.auth-field > span {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--wb-text-2);
}

.auth-actions {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

@keyframes sheet-up {
  from {
    transform: translateY(40px);
    opacity: 0;
  }
}

@media (min-width: 640px) {
  .auth-modal-layer {
    align-items: center;
  }

  .auth-panel {
    padding: 2rem;
    border-radius: 26px;
    border-bottom: 1px solid var(--wb-line-2);
  }

  .auth-panel::before {
    display: none;
  }
}

/* ───────────── App shell (mobile) ───────────── */
.window-screen {
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
}

.workspace {
  width: 100%;
  max-width: 40rem;
  margin: 0 auto;
  padding: 0 max(1rem, env(safe-area-inset-right)) 1.75rem max(1rem, env(safe-area-inset-left));
}

/* Mobile home app bar */
.appbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: calc(0.85rem + env(safe-area-inset-top)) 0 0.9rem;
}

.appbar-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.appbar-logo {
  width: 2.6rem;
  height: 2.6rem;
}

.appbar-name {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.035em;
}

.appbar-actions {
  display: flex;
  gap: 0.35rem;
}

.icon-btn {
  width: 2.5rem;
  height: 2.5rem;
  display: grid;
  place-items: center;
  border-radius: 13px;
  border: 1px solid var(--wb-line);
  background: rgba(255, 255, 255, 0.04);
  transition: background 0.15s ease, transform 0.12s ease;
}

.icon-btn:active {
  transform: scale(0.94);
  background: var(--wb-accent-soft);
}

.icon-btn .ico {
  width: 1.3rem;
  height: 1.3rem;
}

/* Sub-screen header: back · title · spacer */
.screen-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: 2.75rem 1fr 2.75rem;
  align-items: center;
  margin: 0 -1rem 1rem;
  padding: calc(0.55rem + env(safe-area-inset-top)) 0.75rem 0.55rem;
  border-bottom: 1px solid var(--wb-line);
  background: rgba(6, 10, 7, 0.82);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
}

.header-back {
  width: 2.5rem;
  height: 2.5rem;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: var(--wb-text);
}

.header-back:active {
  background: var(--wb-accent-soft);
}

.header-back .ico {
  width: 1.4rem;
  height: 1.4rem;
  stroke-width: 2;
}

.screen-title {
  text-align: center;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* Page title: screen-reader only on phones (the app bar / header shows it), visible on desktop. */
.workspace-top {
  padding: 0;
}

.workspace-title {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Bottom tab bar */
.mobile-tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  padding: 0.4rem 0.3rem calc(0.4rem + env(safe-area-inset-bottom));
  border-top: 1px solid var(--wb-line);
  background: rgba(7, 12, 8, 0.88);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
}

.mobile-tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.22rem;
  padding: 0.2rem 0 0.1rem;
  color: var(--wb-muted);
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.mobile-tab-item .nav-ico {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 1.85rem;
  border-radius: 999px;
  transition: background 0.2s ease;
}

.mobile-tab-item.is-active {
  color: var(--wb-text);
}

.mobile-tab-item.is-active .nav-ico {
  background: var(--wb-accent-soft);
}

.nav-icon {
  width: 1.35rem;
  height: 1.35rem;
}

/* ───────────── Shared content bits ───────────── */
.plain-strip,
.context-strip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  font-size: 0.84rem;
  color: var(--wb-text-2);
}

.plain-strip {
  padding: 0.65rem 0.85rem;
  border-radius: 14px;
  border: 1px solid rgba(114, 208, 20, 0.22);
  background: rgba(114, 208, 20, 0.07);
}

.plain-strip .ico {
  width: 1.2rem;
  height: 1.2rem;
}

.context-strip {
  flex-wrap: wrap;
  width: fit-content;
  max-width: 100%;
  padding: 0.5rem 0.9rem 0.5rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--wb-line);
  background: rgba(255, 255, 255, 0.035);
  color: var(--wb-muted);
}

.context-strip strong {
  color: var(--wb-text);
}

.context-avatar {
  width: 1.6rem;
  height: 1.6rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--wb-accent-soft);
}

.context-avatar .ico {
  width: 1rem;
  height: 1rem;
}

.section-title,
.explore-category-title,
.section-break {
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--wb-accent-hot);
}

.section-title {
  margin-bottom: 0.7rem;
}

/* Page-level titles duplicate the mobile header, so they only show on desktop. */
.workspace-section > .section-title,
.subhead-row > .section-title {
  display: none;
}

.subhead-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-bottom: 0.85rem;
}

.square-stat {
  display: inline-flex;
  align-items: baseline;
  gap: 0.55rem;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(114, 208, 20, 0.25);
  background: rgba(114, 208, 20, 0.09);
}

.square-stat span {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--wb-muted);
}

.square-stat strong {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--wb-accent-hot);
}

.empty-table {
  padding: 1.6rem 1rem;
  text-align: center;
  color: var(--wb-muted);
}

.settings-grid .empty-table {
  border-radius: 18px;
  border: 1px dashed var(--wb-line-2);
  background: rgba(255, 255, 255, 0.02);
}

.metric-row,
.stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 0;
  border-top: 1px solid var(--wb-line);
}

.metric-row:first-child,
.stat-row:first-child {
  border-top: 0;
}

.metric-row span,
.stat-row span {
  color: var(--wb-muted);
}

.metric-row strong,
.stat-row strong {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.row-primary {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.row-secondary {
  font-size: 0.8rem;
  color: var(--wb-muted);
}

.mini-icon-button {
  width: 2.1rem;
  height: 2.1rem;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: var(--wb-faint);
  transition: color 0.15s ease, background 0.15s ease;
}

.mini-icon-button .ico {
  width: 1.1rem;
  height: 1.1rem;
}

.mini-icon-button:hover,
.mini-icon-button:active {
  color: var(--wb-neg);
  background: rgba(255, 107, 107, 0.12);
}

.row-delete {
  margin: 0;
  justify-self: end;
}

/* ───────────── Home ───────────── */
.balance-card {
  position: relative;
  overflow: hidden;
  padding: 1.35rem 1.25rem 0.6rem;
  border-radius: 26px;
  border: 1px solid var(--wb-line-2);
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(114, 208, 20, 0.24), transparent 56%),
    linear-gradient(180deg, #111b12, #0a110b);
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.balance-eyebrow {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--wb-muted);
}

.balance-amount {
  margin: 0.3rem 0 0.9rem;
  font-size: clamp(2.2rem, 10vw, 3rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.045em;
  font-variant-numeric: tabular-nums;
}

.balance-flow {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.flow-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.34rem 0.65rem 0.34rem 0.5rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.flow-chip .ico {
  width: 0.95rem;
  height: 0.95rem;
  stroke-width: 2.3;
}

.flow-in {
  color: var(--wb-pos);
  background: rgba(134, 229, 31, 0.12);
}

.flow-out {
  color: #ff8a8a;
  background: rgba(255, 107, 107, 0.12);
}

.balance-chart {
  margin: 0.85rem -0.35rem 0;
}

.chart-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.chart-grid {
  stroke: rgba(255, 255, 255, 0.07);
  stroke-dasharray: 3 4;
}

.chart-axis,
.chart-tick {
  stroke: rgba(255, 255, 255, 0.14);
  stroke-width: 1;
}

.chart-line {
  fill: none;
  stroke: #9af22a;
  stroke-width: 2.4;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 5px rgba(140, 230, 30, 0.55));
}

.chart-label {
  fill: var(--wb-muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.home-strip {
  display: grid;
  gap: 0.85rem;
  margin-top: 0.85rem;
}

.quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.quick-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  padding: 1.1rem 0.75rem;
  border-radius: 20px;
  border: 1px solid var(--wb-line);
  background: var(--wb-panel);
  text-align: center;
  transition: transform 0.12s ease, border-color 0.15s ease, background 0.15s ease;
}

.quick-tile:hover {
  border-color: var(--wb-line-2);
  background: rgba(114, 208, 20, 0.07);
}

.quick-tile:active {
  transform: scale(0.97);
}

.quick-icon {
  width: 3rem;
  height: 3rem;
  display: grid;
  place-items: center;
  border-radius: 16px;
  border: 1px solid rgba(114, 208, 20, 0.24);
  background: var(--wb-accent-soft);
}

.quick-icon .ico {
  width: 1.5rem;
  height: 1.5rem;
}

.quick-label {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.stat-list {
  padding: 0.2rem 1.1rem;
  border-radius: 20px;
  border: 1px solid var(--wb-line);
  background: var(--wb-panel);
}

/* Activity ledger / tables */
.ledger-shell {
  margin-top: 1rem;
  overflow: hidden;
  border-radius: 22px;
  border: 1px solid var(--wb-line);
  background: var(--wb-panel);
}

.ledger-head {
  padding: 0.75rem 1.1rem;
  border-bottom: 1px solid var(--wb-line);
  background: rgba(255, 255, 255, 0.02);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--wb-muted);
}

.transaction-head-caret {
  font-size: 0.6rem;
  color: var(--wb-accent);
}

.ledger-row {
  border-top: 1px solid var(--wb-line);
}

.ledger-body > .ledger-row:first-child {
  border-top: 0;
}

/* Transaction row — phone layout:
     (icon)  Title                         +$450.00
             Note / category
     ───────────────────────────────────────────────
     2026-09-20 12:00 · Account   Balance $3,543.00  [trash]
   On desktop the footer dissolves (display: contents) so its children become table columns. */
.tx-row {
  display: grid;
  grid-template-columns: 2.7rem minmax(0, 1fr) auto;
  grid-template-areas:
    "icon main value"
    "foot foot foot";
  align-items: start;
  gap: 0.15rem 0.7rem;
  padding: 0.95rem 1rem 0.55rem;
}

.tx-foot {
  grid-area: foot;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.45rem;
  padding-top: 0.15rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.tx-icon {
  grid-area: icon;
  align-self: start;
  width: 2.7rem;
  height: 2.7rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
}

.tx-icon .ico {
  width: 1.2rem;
  height: 1.2rem;
  stroke-width: 2.1;
}

.tx-icon-in {
  color: var(--wb-pos);
  background: rgba(134, 229, 31, 0.13);
}

.tx-icon-out {
  color: var(--wb-neg);
  background: rgba(255, 107, 107, 0.13);
}

.tx-main {
  grid-area: main;
  min-width: 0;
}

.tx-title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  font-weight: 700;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.tx-meta {
  margin-top: 0.1rem;
  font-size: 0.82rem;
  color: var(--wb-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tx-when {
  grid-area: when;
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  font-size: 0.74rem;
  color: var(--wb-faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.tx-account {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tx-value {
  grid-area: value;
  text-align: right;
  padding-top: 0.05rem;
}

.tx-balance {
  grid-area: balance;
  text-align: right;
  font-size: 0.74rem;
  color: var(--wb-muted);
  white-space: nowrap;
}

.tx-figure {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.tx-value .tx-figure {
  font-size: 1rem;
}

.tx-balance .tx-figure {
  font-weight: 600;
}

.tx-label {
  margin-right: 0.3rem;
}

/* "Value" is redundant next to a signed, coloured amount, so it stays screen-reader only. */
.tx-value .tx-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.tx-row .row-delete {
  grid-area: del;
  margin-right: -0.5rem;
}

/* Budgets — phone layout: name + delete, progress, then Used / Remaining / Limit. */
.budget-row {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.7rem 0.75rem;
  padding: 1rem;
}

.budget-name {
  grid-column: 1 / -1;
  grid-row: 1;
  min-width: 0;
  padding-right: 2.2rem;
}

.budget-name .progress {
  margin-right: -2.2rem;
}

.budget-row .row-delete {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  margin: 0;
}

.budget-cell {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.cell-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--wb-muted);
}

.progress {
  height: 0.5rem;
  margin-top: 0.7rem;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
}

.progress-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--wb-accent-deep), var(--wb-accent-hot));
  box-shadow: 0 0 10px rgba(114, 208, 20, 0.5);
}

.progress-fill.is-warn {
  background: linear-gradient(90deg, #b8891a, var(--wb-warn));
  box-shadow: 0 0 10px rgba(245, 197, 66, 0.4);
}

.progress-fill.is-over {
  background: linear-gradient(90deg, #b83a3a, var(--wb-neg));
  box-shadow: 0 0 10px rgba(255, 107, 107, 0.4);
}

/* Accounts — phone layout: icon | name over type | balance | delete. */
.account-row {
  display: grid;
  grid-template-columns: 2.7rem minmax(0, 1fr) auto auto;
  grid-template-areas:
    "icon name balance del"
    "icon type balance del";
  align-items: center;
  column-gap: 0.75rem;
  padding: 0.9rem 1rem;
}

.account-icon {
  grid-area: icon;
  width: 2.7rem;
  height: 2.7rem;
  display: grid;
  place-items: center;
  border-radius: 14px;
  border: 1px solid rgba(114, 208, 20, 0.22);
  background: var(--wb-accent-soft);
}

.account-icon .ico {
  width: 1.3rem;
  height: 1.3rem;
}

.account-name {
  grid-area: name;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-type {
  grid-area: type;
}

.account-balance {
  grid-area: balance;
  text-align: right;
  font-weight: 700;
}

.account-row .row-delete {
  grid-area: del;
  margin-right: -0.4rem;
}

/* ───────────── Add / entry form ───────────── */
.form-sheet-compact {
  margin-bottom: 0.25rem;
}

.section-break {
  padding-top: 0.9rem;
  border-top: 1px solid var(--wb-line);
}

.review-grid {
  display: grid;
  gap: 1rem;
}

.review-left {
  padding: 0 1rem;
  border-radius: 16px;
  border: 1px solid var(--wb-line);
  background: rgba(255, 255, 255, 0.025);
}

.review-right {
  display: grid;
  gap: 0.6rem;
  justify-items: start;
  padding: 0.85rem 0.85rem 0.4rem;
  border-radius: 16px;
  border: 1px solid var(--wb-line);
  background: rgba(255, 255, 255, 0.025);
}

.review-right .chart-svg {
  width: 100%;
}

.mini-switch {
  display: inline-flex;
  padding: 0.2rem;
  border-radius: 999px;
  border: 1px solid var(--wb-line);
  background: rgba(255, 255, 255, 0.04);
}

.mini-switch span {
  padding: 0.3rem 0.85rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--wb-muted);
}

.mini-switch .mini-switch-active {
  color: var(--wb-accent-hot);
  background: rgba(114, 208, 20, 0.18);
}

/* ───────────── Settings ───────────── */
.settings-grid {
  display: grid;
  gap: 1.35rem;
}

.detail-box {
  padding: 1.1rem 1.1rem 1.15rem;
  border-radius: 22px;
  border: 1px solid var(--wb-line);
  background: var(--wb-panel);
}

.session-badge {
  display: flex;
  justify-content: center;
  margin-bottom: 0.6rem;
}

.session-logo {
  width: 4.2rem;
  height: 4.2rem;
  box-shadow: 0 0 0 1px rgba(114, 208, 20, 0.35), 0 12px 32px rgba(114, 208, 20, 0.22);
}

.detail-box .sheet-actions {
  margin: 0.4rem 0 0;
}

/* ───────────── Explore / Freedom guide ───────────── */
.explore-intro {
  margin: 0.25rem 0 0.5rem;
  line-height: 1.55;
  color: var(--wb-text-2);
}

.explore-category-title {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin: 1.5rem 0 0.7rem;
}

.explore-category-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--wb-line-2), transparent);
}

.explore-card {
  position: relative;
  margin-bottom: 0.75rem;
  padding: 1.1rem 1.15rem 1.1rem 1.35rem;
  border-radius: 20px;
  border: 1px solid var(--wb-line);
  background: var(--wb-panel);
}

.explore-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 1.1rem;
  bottom: 1.1rem;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, var(--wb-accent-hot), var(--wb-accent-deep));
}

.explore-card-title {
  font-size: 1.06rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.explore-card-lead {
  margin-top: 0.35rem;
  font-weight: 600;
  line-height: 1.45;
  color: var(--wb-text-2);
}

.explore-card-detail {
  margin-top: 0.5rem;
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--wb-muted);
}

/* ───────────── Add income / expense pages ───────────── */
.wallet-flow-sheet .screen-header-flow {
  margin-bottom: 1.15rem;
}

.form-sheet.flow-form {
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
  gap: 1.15rem;
}

.flow-submit {
  padding-top: 0.6rem;
}

.wallet-flow-footnote {
  font-size: 0.84rem;
  color: var(--wb-muted);
}

.wallet-inline-link {
  font-weight: 700;
  color: var(--wb-accent-hot);
}

.wallet-inline-link:hover {
  text-decoration: underline;
}

/* Very small phones (≤ 359px): keep the app bar on one line. */
@media (max-width: 359px) {
  .appbar {
    gap: 0.5rem;
  }

  .appbar-logo {
    width: 2.3rem;
    height: 2.3rem;
  }

  .appbar-name {
    font-size: 1.15rem;
  }

  .appbar-actions {
    gap: 0.25rem;
  }

  .icon-btn {
    width: 2.2rem;
    height: 2.2rem;
  }

  .balance-amount {
    font-size: 2.1rem;
  }
}

/* ───────────── Desktop / tablet ───────────── */
@media (min-width: 768px) {
  .window-screen {
    padding: 1.5rem 1.5rem 2rem;
  }

  .window-frame {
    max-width: 1180px;
    min-height: calc(100vh - 3.5rem);
    margin: 0 auto;
    overflow: hidden;
    border-radius: 28px;
    border: 1px solid var(--wb-line-2);
    background: linear-gradient(180deg, rgba(18, 27, 19, 0.88), rgba(9, 14, 10, 0.94));
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
  }

  .shell-strip {
    align-items: center;
    justify-content: space-between;
    height: 4rem;
    padding: 0 1.4rem;
    border-bottom: 1px solid var(--wb-line);
    background: rgba(255, 255, 255, 0.02);
  }

  .shell-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: -0.02em;
  }

  .shell-brand-logo {
    width: 2.3rem;
    height: 2.3rem;
  }

  .shell-brand-tagline {
    font-weight: 500;
    color: var(--wb-muted);
    letter-spacing: 0;
  }

  .shell-context {
    padding: 0.38rem 0.9rem;
    border-radius: 999px;
    border: 1px solid rgba(114, 208, 20, 0.25);
    background: rgba(114, 208, 20, 0.09);
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--wb-accent-hot);
  }

  .window-body {
    display: flex;
    min-height: calc(100vh - 3.5rem - 4rem);
  }

  .desktop-sidebar {
    width: 15.5rem;
    flex-shrink: 0;
    padding: 1.1rem;
    border-right: 1px solid var(--wb-line);
  }

  .sidebar-grid {
    display: grid;
    gap: 0.3rem;
    align-content: start;
  }

  .sidebar-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.8rem 0.95rem;
    border-radius: 14px;
    border: 1px solid transparent;
    color: var(--wb-muted);
    font-weight: 600;
    transition: background 0.15s ease, color 0.15s ease;
  }

  .sidebar-item:hover {
    color: var(--wb-text);
    background: rgba(255, 255, 255, 0.04);
  }

  .sidebar-item.is-active {
    color: var(--wb-text);
    border-color: rgba(114, 208, 20, 0.26);
    background: var(--wb-accent-soft);
  }

  .sidebar-item .nav-icon {
    width: 1.45rem;
    height: 1.45rem;
  }

  .workspace {
    flex: 1;
    min-width: 0;
    max-width: none;
    margin: 0;
    padding: 1.9rem 2.25rem 2.5rem;
  }

  .workspace > * {
    max-width: 62rem;
  }

  .workspace-top {
    margin-bottom: 1.35rem;
  }

  .workspace-title {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.035em;
    white-space: normal;
  }

  .flash-stack {
    top: 1.25rem;
  }

  /* Section titles come back on desktop, where there is no mobile header. */
  .workspace-section > .section-title,
  .subhead-row > .section-title {
    display: block;
    margin: 0;
  }

  .subhead-row {
    justify-content: space-between;
  }

  /* Home */
  .balance-card {
    display: grid;
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.35fr);
    align-items: center;
    gap: 2rem;
    padding: 1.9rem 2rem 1.5rem;
  }

  .balance-chart {
    margin: 0;
  }

  .home-strip {
    grid-template-columns: 1fr 1fr;
    align-items: stretch;
  }

  .stat-list {
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  /* Tables */
  .tx-grid,
  .budget-grid,
  .account-grid {
    display: grid;
    align-items: center;
    column-gap: 1rem;
  }

  .tx-grid {
    grid-template-columns: 2.7rem minmax(0, 1.1fr) minmax(0, 1.5fr) minmax(0, 0.9fr) minmax(0, 0.9fr) 2.5rem;
    grid-template-areas: "icon when main value balance del";
  }

  .tx-row {
    align-items: center;
    padding: 0.85rem 1.1rem;
  }

  .tx-foot {
    display: contents;
  }

  .tx-row:hover,
  .budget-row:hover,
  .account-row:hover {
    background: rgba(255, 255, 255, 0.025);
  }

  .tx-icon {
    align-self: center;
  }

  .tx-when {
    flex-direction: column;
    gap: 0.1rem;
    font-size: 0.9rem;
    color: var(--wb-text);
  }

  .tx-account {
    font-size: 0.8rem;
    color: var(--wb-muted);
  }

  .tx-balance {
    font-size: 0.95rem;
    color: var(--wb-text);
  }

  .tx-balance .tx-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .tx-row .row-delete,
  .budget-row .row-delete {
    margin-right: 0;
  }

  .budget-grid {
    grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(0, 0.8fr)) 2.5rem;
  }

  .budget-row {
    padding: 0.95rem 1.1rem;
  }

  .budget-name {
    grid-column: auto;
    grid-row: auto;
    padding-right: 0;
  }

  .budget-name .progress {
    margin-right: 0;
  }

  .budget-row .row-delete {
    position: static;
    align-self: center;
  }

  .budget-cell {
    text-align: right;
  }

  .progress {
    max-width: 14rem;
    margin-top: 0.55rem;
  }

  .account-grid {
    grid-template-columns: 2.7rem minmax(0, 1.4fr) minmax(0, 0.9fr) minmax(0, 0.9fr) 2.5rem;
    grid-template-areas: "icon name type balance del";
  }

  .account-row {
    padding: 0.8rem 1.1rem;
  }

  .account-row .row-delete {
    margin-right: 0;
  }

  /* Forms: label on the left, control on the right, hairline between rows. */
  .form-sheet {
    padding: 0.5rem 1.6rem 1.4rem;
    gap: 0;
  }

  .form-sheet:not(.flow-form) .field-row {
    grid-template-columns: 10rem minmax(0, 1fr);
    align-items: center;
    gap: 1.25rem;
    padding: 0.95rem 0;
    border-bottom: 1px solid var(--wb-line);
  }

  .form-sheet:not(.flow-form) .field-row-top {
    align-items: start;
  }

  .section-break {
    margin-top: 0.4rem;
    padding: 1.1rem 0 0.9rem;
    border-top: 0;
  }

  .review-grid {
    grid-template-columns: 1fr 1.5fr;
    padding-bottom: 1rem;
  }

  .sheet-actions {
    display: flex;
    justify-content: flex-end;
    padding-top: 1.1rem;
  }

  .sheet-actions-left {
    justify-content: flex-start;
  }

  .sheet-actions > .plain-primary-button,
  .sheet-actions > .plain-secondary-button {
    min-width: 8rem;
  }

  .form-sheet-compact {
    margin-bottom: 1rem;
  }

  .form-sheet.flow-form {
    max-width: 34rem;
    padding: 0.5rem 1.6rem 1.6rem;
    border: 1px solid var(--wb-line);
    background: var(--wb-panel);
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.3);
    gap: 1.15rem;
  }

  .flow-form .sheet-actions {
    display: grid;
  }

  .wallet-flow-sheet .screen-header-flow {
    position: static;
    grid-template-columns: 2.75rem auto;
    justify-content: start;
    gap: 0.75rem;
    margin: 0 0 1.25rem;
    padding: 0;
    border: 0;
    background: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .wallet-flow-sheet .header-spacer {
    display: none;
  }

  .wallet-flow-sheet .screen-title {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.035em;
  }

  .header-back {
    border: 1px solid var(--wb-line);
    background: rgba(255, 255, 255, 0.04);
  }

  .header-back:hover {
    background: var(--wb-accent-soft);
  }

  /* Settings */
  .settings-grid {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }

  .settings-full {
    grid-column: 1 / -1;
  }

  .form-sheet-compact .field-row:last-of-type {
    border-bottom: 0;
  }

  /* Explore */
  .explore-catalog {
    max-width: 46rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
