:root {
  color-scheme: light;
  --bg: #f7f7f6;
  --surface: #ffffff;
  --surface-muted: #eeeeec;
  --text: #111111;
  --subtle: #5f5f5b;
  --muted: #a0a09b;
  --line: #deded9;
  --accent: #171717;
  --accent-soft: #f1f1ee;
  --accent-mid: #e4e4df;
  --danger: #8f2f2f;
  --success: #26764f;
  --shadow: 0 22px 60px rgba(17, 17, 17, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d0d0d;
  --surface: #171717;
  --surface-muted: #252525;
  --text: #f4f4f2;
  --subtle: #b4b4ae;
  --muted: #767670;
  --line: #343434;
  --accent: #f4f4f2;
  --accent-soft: #242424;
  --accent-mid: #303030;
  --danger: #e17070;
  --success: #7fd4a5;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

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

.field-hint {
  color: var(--subtle);
  font-size: 0.82rem;
  line-height: 1.4;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-height: 100vh;
}

.account-stage {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 100vh;
  background: var(--bg);
}

.topbar {
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  gap: 12px;
  padding: max(14px, env(safe-area-inset-top)) 20px 12px;
}

.icon-button {
  min-height: 44px;
  border: 0;
  background: transparent;
  color: var(--subtle);
}

.icon-button {
  display: grid;
  place-items: center;
  justify-self: end;
  width: 44px;
  border-radius: 999px;
}

.icon-button:hover {
  background: var(--surface-muted);
}

.vertical-dots {
  display: grid;
  gap: 3px;
  place-items: center;
}

.vertical-dots span {
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: currentColor;
}

.report-fab {
  position: fixed;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(22px, env(safe-area-inset-bottom));
  z-index: 20;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 999px;
  background: #111111;
  color: #ffffff;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.28);
  text-decoration: none;
}

.report-fab:hover {
  background: #000000;
}

.report-fab:focus-visible {
  outline: 3px solid color-mix(in srgb, #111111 26%, #ffffff);
  outline-offset: 3px;
}

.report-fab svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.toast-region {
  position: fixed;
  top: max(18px, env(safe-area-inset-top));
  right: max(18px, env(safe-area-inset-right));
  z-index: 60;
  display: grid;
  width: min(360px, calc(100vw - 36px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid color-mix(in srgb, var(--success) 44%, var(--line));
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  font-size: 0.92rem;
  font-weight: 700;
}

.toast-icon {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--success);
  color: var(--surface);
  font-size: 0.82rem;
}

.screen {
  flex: 1;
  overflow: auto;
  padding: 12px 22px 34px;
}

.screen h1,
.screen h2 {
  margin: 0 0 8px;
  font-size: clamp(1.85rem, 8vw, 2.35rem);
  line-height: 1.08;
  letter-spacing: 0;
}

.lede {
  margin: 0 0 24px;
  color: var(--subtle);
  line-height: 1.45;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--subtle);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.section-stack {
  display: grid;
  gap: 12px;
}

.panel,
.summary-card,
.notice {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.panel {
  padding: 16px;
}

.summary-card {
  display: grid;
  gap: 8px;
  padding: 18px;
}

.summary-card strong {
  font-size: 1.05rem;
}

.summary-card span {
  color: var(--subtle);
  font-size: 0.9rem;
  line-height: 1.4;
}

.countdown-card {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  color: var(--subtle);
  font-size: 0.95rem;
}

.countdown-card strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.notice {
  padding: 14px;
  color: var(--subtle);
  font-size: 0.9rem;
  line-height: 1.45;
}

.notice.warning {
  border-color: color-mix(in srgb, var(--danger) 44%, var(--line));
  color: var(--danger);
}

.notice.success {
  border-color: color-mix(in srgb, var(--success) 44%, var(--line));
  color: var(--success);
}

.field-label {
  display: block;
  margin: 0 0 10px;
  color: var(--subtle);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.required-note,
.form-link,
.legal-text {
  margin: 0;
  color: var(--subtle);
  font-size: 0.9rem;
  line-height: 1.45;
}

.required-note {
  margin: -10px 0 18px;
}

.legal-text a {
  font-weight: 750;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

.inline-link {
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 0;
  font-weight: 750;
  text-decoration: underline;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

.field {
  display: grid;
  gap: 8px;
}

.form-grid {
  display: grid;
  gap: 14px;
}

.text-input,
.text-area {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  padding: 14px;
}

.read-only-input {
  background: var(--surface-muted);
  color: var(--subtle);
  cursor: not-allowed;
}

.text-area {
  min-height: 104px;
  resize: vertical;
}

.primary-button,
.secondary-button,
.danger-button {
  width: 100%;
  min-height: 50px;
  border-radius: 14px;
  font-weight: 750;
}

.primary-button {
  border: 0;
  background: var(--accent);
  color: var(--surface);
}

.primary-button:disabled {
  background: var(--surface-muted);
  color: var(--muted);
  cursor: default;
}

.secondary-button,
.danger-button {
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--text);
}

.danger-button {
  border-color: color-mix(in srgb, var(--danger) 44%, var(--line));
  color: var(--danger);
}

.inline-actions {
  display: grid;
  gap: 10px;
}

.link-button {
  width: 100%;
  min-height: 44px;
  border: 0;
  background: transparent;
  color: var(--subtle);
  font-weight: 700;
}

.account-grid {
  display: grid;
  gap: 10px;
}

.account-row {
  display: grid;
  grid-template-columns: 40px 1fr 22px;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1.5px solid transparent;
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
}

.reports-dropdown {
  border-radius: 14px;
  background: var(--surface);
}

.reports-dropdown > summary {
  list-style: none;
  cursor: pointer;
}

.reports-dropdown > summary::-webkit-details-marker {
  display: none;
}

.reports-dropdown[open] > summary {
  border-color: var(--accent);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  background: var(--accent-soft);
}

.reports-dropdown[open] > summary .chevron {
  transform: rotate(90deg);
}

.reports-dropdown-content {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1.5px solid var(--accent);
  border-top: 0;
  border-bottom-left-radius: 14px;
  border-bottom-right-radius: 14px;
}

.account-row:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.tile-icon {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--surface-muted);
  color: var(--text);
  font-weight: 800;
}

.account-row strong {
  display: block;
  margin-bottom: 4px;
}

.account-row span:not(.tile-icon):not(.chevron) {
  color: var(--subtle);
  font-size: 0.86rem;
  line-height: 1.35;
}

.chevron {
  color: var(--muted);
  font-weight: 800;
  transition: transform 160ms ease;
}

.report-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.report-metric {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 14px;
  border-radius: 12px;
  background: var(--surface-muted);
}

.report-metric strong {
  font-size: 1.65rem;
  line-height: 1;
}

.report-metric strong small {
  color: var(--subtle);
  font-size: 0.72rem;
  font-weight: 750;
}

.report-metric span {
  color: var(--subtle);
  font-size: 0.82rem;
  line-height: 1.3;
}

.key-value {
  display: grid;
  gap: 10px;
}

.key-value div {
  display: grid;
  gap: 4px;
}

.key-value dt {
  color: var(--subtle);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.key-value dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 180px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  color: var(--subtle);
  text-align: center;
  padding: 24px;
}

.dev-link {
  overflow-wrap: anywhere;
  color: var(--text);
}

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  align-items: end;
  background: rgba(0, 0, 0, 0.34);
  padding-top: 30px;
}

.settings-sheet {
  width: 100%;
  max-height: calc(100vh - 30px);
  overflow: auto;
  border-radius: 28px 28px 0 0;
  background: var(--surface);
  padding: 26px 22px max(34px, env(safe-area-inset-bottom));
}

.sheet-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.sheet-heading h2 {
  margin: 0;
}

.option-list {
  display: grid;
  gap: 8px;
}

.language-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  border: 1.5px solid transparent;
  border-radius: 16px;
  background: var(--surface-muted);
  color: var(--text);
  padding: 12px 16px;
  text-align: left;
}

.language-option span {
  display: block;
  color: var(--subtle);
  font-size: 0.78rem;
}

.language-option.selected {
  border-color: var(--text);
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.segmented button {
  min-height: 50px;
  border: 1.5px solid transparent;
  border-radius: 14px;
  background: var(--surface-muted);
  color: var(--subtle);
  font-weight: 750;
}

.segmented button.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text);
}

@media (min-width: 760px) {
  .account-stage {
    align-self: center;
    min-height: min(880px, 100vh);
  }

  .screen {
    width: min(620px, calc(100vw - 48px));
    margin-inline: auto;
  }

  .screen h1,
  .screen h2 {
    font-size: clamp(2.35rem, 5vw, 4rem);
  }

  .inline-actions {
    grid-template-columns: 1fr 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr 1fr;
  }

  .settings-sheet {
    justify-self: center;
    width: min(460px, calc(100vw - 32px));
    border-radius: 28px;
    margin-bottom: 30px;
  }
}
