:root {
  --bg: #0f1c1a;
  --bg-elevated: #162825;
  --ink: #e8f2ef;
  --muted: #9bb5ae;
  --accent: #3ecf8e;
  --accent-ink: #062016;
  --danger: #ff7b72;
  --warn: #ffc454;
  --ok: #3ecf8e;
  --border: rgba(232, 242, 239, 0.12);
  --radius: 14px;
  --font-sans: "DM Sans", sans-serif;
  --font-display: "Fraunces", Georgia, serif;
  --shadow-soft: 0 12px 40px rgba(0, 0, 0, 0.28);
  --header-h: 4.25rem;
  --layout-max: min(1400px, calc(100% - 2rem));
  --layout-pad: clamp(1rem, 2.5vw, 1.75rem);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  width: 100%;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  width: 100%;
  font-family: var(--font-sans);
  color: var(--ink);
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(62, 207, 142, 0.18), transparent 55%),
    radial-gradient(ellipse 60% 40% at 90% 0%, rgba(56, 140, 120, 0.2), transparent 50%),
    linear-gradient(160deg, #0c1715 0%, #12201d 45%, #0f1c1a 100%);
  background-attachment: fixed;
}

:focus-visible {
  outline: 2px solid rgba(62, 207, 142, 0.65);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  z-index: 100;
  padding: 0.6rem 1rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  text-decoration: none;
}

.skip-link:focus {
  top: 0.75rem;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  width: 100%;
  margin: 0;
  padding: 0;
  backdrop-filter: blur(14px);
  background: rgba(12, 23, 21, 0.72);
  border-bottom: 1px solid transparent;
}

.site-header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  width: 100%;
  max-width: var(--layout-max);
  margin: 0 auto;
  padding: 0.85rem var(--layout-pad);
}

.site-header.is-scrolled {
  border-bottom-color: var(--border);
}

.brand {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.brand:hover {
  text-decoration: none;
  color: var(--accent);
}

.site-nav {
  display: none;
  flex-direction: column;
  align-items: stretch;
  gap: 0.35rem;
  width: 100%;
  padding: 0.35rem 0 0.5rem;
}

.site-nav.is-open {
  display: flex;
}

.nav-toggle {
  min-height: 44px;
  min-width: 44px;
  padding: 0.55rem 0.95rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(22, 40, 37, 0.7);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--ink);
  text-decoration: none;
}

.site-nav a[aria-current="page"] {
  background: rgba(62, 207, 142, 0.14);
  color: var(--accent);
}

.nav-logout {
  margin: 0.35rem 0 0;
  display: inline-flex;
}

.nav-logout-btn {
  min-height: 44px;
  padding: 0.45rem 0.9rem;
  font-size: 0.92rem;
  width: 100%;
}

@media (min-width: 900px) {
  .nav-toggle {
    display: none;
  }

  .site-nav,
  .site-nav.is-open {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    width: auto;
    gap: 0.25rem;
    align-items: center;
    padding: 0;
  }

  .nav-logout {
    margin: 0 0 0 0.35rem;
  }

  .nav-logout-btn {
    width: auto;
  }
}

.site-main {
  width: 100%;
  max-width: var(--layout-max);
  margin: 0 auto;
  padding: 1rem var(--layout-pad) calc(3rem + env(safe-area-inset-bottom, 0px));
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.7rem 1.2rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: transform 160ms ease, background-color 160ms ease, border-color 160ms ease, opacity 160ms ease;
}

.btn:hover {
  text-decoration: none;
  transform: translateY(-1px);
}

.btn:disabled,
.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
}

.btn-primary:hover {
  background: #58db9f;
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--border);
}

.btn-ghost:hover {
  border-color: rgba(232, 242, 239, 0.35);
}

.btn-danger {
  background: transparent;
  color: var(--danger);
  border-color: rgba(255, 123, 114, 0.45);
}

.btn-danger:hover {
  background: rgba(255, 123, 114, 0.12);
}

.btn-sm {
  min-height: 40px;
  padding: 0.45rem 0.9rem;
  font-size: 0.92rem;
}

.flash-list {
  list-style: none;
  margin: 0.75rem auto 0;
  padding: 0 var(--layout-pad);
  width: 100%;
  max-width: var(--layout-max);
  display: grid;
  gap: 0.5rem;
}

.flash {
  padding: 0.8rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(22, 40, 37, 0.92);
  box-shadow: var(--shadow-soft);
}

.flash-error {
  border-color: rgba(255, 123, 114, 0.45);
  color: var(--danger);
}

.flash-success {
  border-color: rgba(62, 207, 142, 0.45);
  color: var(--ok);
}

.flash-warn {
  border-color: rgba(255, 196, 84, 0.45);
  color: var(--warn);
}

h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 2.85rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin: 0 0 0.75rem;
}

.lede {
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.55;
  margin: 0 0 1.5rem;
  max-width: 38rem;
}

.eyebrow {
  margin: 0 0 0.45rem;
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-size: 0.78rem;
}

.page-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.page-header h1 {
  margin-bottom: 0.35rem;
}

.page-header .lede {
  margin-bottom: 0;
}

@media (min-width: 640px) {
  .page-header {
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
  }
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(22, 40, 37, 0.75);
  padding: 1.15rem 1.2rem;
  margin-bottom: 1rem;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.panel-header h2,
.panel h2,
.section-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  margin: 0 0 0.75rem;
}

.panel-header h2 {
  margin-bottom: 0;
}

.panel-header a {
  font-weight: 600;
  font-size: 0.95rem;
}

.toolbar,
.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0 0 1.25rem;
}

.segmented a,
.toolbar a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
  background: rgba(15, 28, 26, 0.35);
}

.segmented a:hover,
.toolbar a:hover {
  color: var(--ink);
  text-decoration: none;
  border-color: rgba(232, 242, 239, 0.28);
}

.segmented a[aria-current="page"],
.toolbar a[aria-current="page"] {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: transparent;
}

.account-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.55rem;
}

.account-row {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.95rem 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(15, 28, 26, 0.55);
  color: inherit;
  text-decoration: none;
  transition: border-color 160ms ease, background-color 160ms ease, transform 160ms ease;
}

.account-row:hover {
  text-decoration: none;
  border-color: rgba(62, 207, 142, 0.35);
  background: rgba(22, 40, 37, 0.95);
  transform: translateY(-1px);
}

.account-row strong {
  display: block;
}

.account-row .meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.static-row {
  cursor: default;
}

.static-row:hover {
  border-color: var(--border);
  background: rgba(15, 28, 26, 0.55);
  transform: none;
}

@media (min-width: 560px) {
  .account-row {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.money {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  white-space: nowrap;
}

.money-pos {
  color: var(--ok);
}

.money-neg {
  color: var(--danger);
}

.muted {
  color: var(--muted);
  font-weight: 500;
}

.empty,
.empty-state {
  color: var(--muted);
}

.empty-state {
  display: grid;
  gap: 1rem;
  justify-items: start;
  padding: 1.75rem 1.25rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: rgba(15, 28, 26, 0.35);
}

.empty-state p {
  margin: 0;
  max-width: 28rem;
  line-height: 1.5;
}

.detail-grid {
  display: grid;
  gap: 1rem;
  margin: 0 0 1.25rem;
  padding: 1.15rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(22, 40, 37, 0.75);
}

@media (min-width: 560px) {
  .detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .detail-grid .span-all {
    grid-column: 1 / -1;
  }
}

.detail-grid dt {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 0.2rem;
}

.detail-grid dd {
  margin: 0;
  font-weight: 600;
  word-break: break-word;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid var(--border);
}

.status-ok {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: transparent;
}

.status-wait {
  color: var(--muted);
  background: transparent;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 1.5rem;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: rgba(62, 207, 142, 0.16);
  color: var(--accent);
}

.badge-warn {
  background: rgba(255, 196, 84, 0.16);
  color: var(--warn);
}

.stat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 0 0 1.15rem;
}

.stat-chip {
  display: grid;
  gap: 0.15rem;
  min-width: 8.5rem;
  padding: 0.7rem 0.9rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(15, 28, 26, 0.45);
}

.stat-chip .label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-chip .value {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.month-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.month-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
}

.month-nav a:hover {
  text-decoration: none;
  border-color: rgba(62, 207, 142, 0.4);
}

.month-nav .current {
  color: var(--muted);
  font-weight: 600;
}

.soft-details {
  margin-top: 1rem;
  border-top: 1px solid var(--border);
  padding-top: 0.85rem;
}

.soft-details > summary {
  cursor: pointer;
  color: var(--muted);
  font-weight: 600;
  min-height: 44px;
  display: flex;
  align-items: center;
  list-style: none;
}

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

.soft-details[open] > summary {
  color: var(--ink);
  margin-bottom: 0.75rem;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88em;
}

.page-enter {
  animation: rise 420ms ease both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .page-enter,
  .btn,
  .account-row {
    animation: none !important;
    transition: none !important;
  }
}
