/* ==========================================================================
   Pokerabend — design tokens
   Palette: deep felt green + antique gold, no black-and-neon or
   cream-and-terracotta defaults. Two type families: Fraunces (display,
   a little idiosyncratic warmth for the "vornehm" feel) and Work Sans
   (body, quiet and legible).
   ========================================================================== */

:root {
  --bg: #0e1912;
  --bg-raise: #142218;
  --felt: #1b3327;
  --felt-line: #2c4635;
  --gold: #b78a3f;
  --gold-bright: #d7ad66;
  --ivory: #ece4d3;
  --ivory-dim: #a49b8a;
  --wine: #a8524f;
  --sage: #7fa07f;

  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 9px;

  --shadow-panel: 0 18px 40px -20px rgba(0, 0, 0, 0.65);

  --font-display: "Fraunces", "Iowan Old Style", serif;
  --font-body: "Work Sans", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  background:
    radial-gradient(ellipse 900px 500px at 50% -10%, rgba(183, 138, 63, 0.10), transparent 60%),
    repeating-linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.012) 0px,
      rgba(255, 255, 255, 0.012) 2px,
      transparent 2px,
      transparent 26px
    ),
    var(--bg);
  color: var(--ivory);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: 0.2px;
  margin: 0 0 0.4em;
  color: var(--ivory);
}

h1 { font-size: 1.7rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; font-weight: 600; }

p { margin: 0 0 0.8em; }

a { color: inherit; }

button, select, input {
  font-family: inherit;
  font-size: 1rem;
}

:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 2px;
}

/* ---------- App shell / header ---------- */

.app-shell {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  background: rgba(14, 25, 18, 0.82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--felt-line);
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  white-space: nowrap;
}

.brand-mark {
  color: var(--gold-bright);
  font-size: 1.15rem;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--ivory);
}

.app-nav {
  display: flex;
  gap: 4px;
  background: var(--bg-raise);
  border: 1px solid var(--felt-line);
  border-radius: 999px;
  padding: 4px;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  padding: 7px 13px;
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--ivory-dim);
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-link:hover {
  color: var(--ivory);
}

.nav-link.is-active {
  background: var(--gold);
  color: #241a08;
}

.app-content {
  flex: 1;
  padding: 24px 20px 56px;
}

/* ---------- Panels ---------- */

.hero-panel {
  background: linear-gradient(165deg, var(--felt) 0%, var(--bg-raise) 100%);
  border: 1px solid var(--gold);
  border-radius: var(--radius-lg);
  padding: 22px 22px 20px;
  box-shadow: var(--shadow-panel);
  margin-bottom: 20px;
}

.hero-panel .kicker {
  color: var(--gold-bright);
  font-size: 0.82rem;
  font-weight: 500;
  margin-bottom: 6px;
}

.hero-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin: 14px 0 18px;
}

.hero-fact dt {
  font-size: 0.74rem;
  color: var(--ivory-dim);
  margin: 0;
}

.hero-fact dd {
  margin: 2px 0 0;
  font-size: 1rem;
  font-weight: 600;
}

.panel {
  background: var(--bg-raise);
  border: 1px solid var(--felt-line);
  border-radius: var(--radius-md);
  padding: 18px 18px 16px;
  margin-bottom: 20px;
}

.empty-panel {
  border: 1px dashed var(--felt-line);
  border-radius: var(--radius-md);
  padding: 26px 18px;
  text-align: center;
  color: var(--ivory-dim);
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 11px 18px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.1s ease, filter 0.15s ease;
  width: 100%;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  color: #241a08;
}

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

.btn-outline {
  background: transparent;
  border: 1px solid var(--gold);
  color: var(--gold-bright);
}

.btn-outline:hover { background: rgba(183, 138, 63, 0.1); }

.btn-quiet {
  background: transparent;
  color: var(--ivory-dim);
  border: 1px solid var(--felt-line);
}

.btn-danger {
  background: transparent;
  border: 1px solid var(--wine);
  color: #d99a97;
}

.btn-row {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.btn-row .btn { width: auto; flex: 1; }

/* ---------- Forms ---------- */

.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-size: 0.82rem;
  color: var(--ivory-dim);
  margin-bottom: 6px;
}

.field select,
.field input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--felt-line);
  border-radius: var(--radius-sm);
  color: var(--ivory);
  padding: 11px 12px;
}

.field select:focus,
.field input:focus {
  border-color: var(--gold);
}

.field .hint {
  font-size: 0.78rem;
  color: var(--ivory-dim);
  margin-top: 5px;
}

.form-msg {
  font-size: 0.86rem;
  margin-top: 10px;
  min-height: 1.2em;
}

.form-msg.is-error { color: #d99a97; }
.form-msg.is-success { color: var(--sage); }

/* ---------- Transactions list ---------- */

.tx-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.tx-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--felt-line);
}

.tx-row:last-child { border-bottom: none; }

.tx-who {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tx-name { font-weight: 600; font-size: 0.94rem; }

.tx-kind {
  font-size: 0.78rem;
  color: var(--ivory-dim);
}

.tx-time {
  font-size: 0.74rem;
  color: var(--ivory-dim);
}

.tx-amount {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  white-space: nowrap;
}

.tx-amount.is-credit { color: var(--sage); }
.tx-amount.is-debit { color: var(--wine); }

/* ---------- Debts / Schuldenbuch ---------- */

.debt-summary {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.debt-summary .stat {
  flex: 1;
  background: var(--bg-raise);
  border: 1px solid var(--felt-line);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
}

.debt-summary .stat-label {
  font-size: 0.78rem;
  color: var(--ivory-dim);
}

.debt-summary .stat-value {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 600;
  margin-top: 4px;
}

.debt-summary .stat-value.is-owe { color: var(--wine); }
.debt-summary .stat-value.is-owed { color: var(--sage); }

.debt-row .amount.is-owe { color: var(--wine); }
.debt-row .amount.is-owed { color: var(--sage); }

.debt-list {
  list-style: none;
  margin: 0 0 6px;
  padding: 0;
}

.debt-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--felt-line);
}

.debt-row:last-child { border-bottom: none; }

.debt-row .name { font-weight: 500; }

.debt-row .amount {
  font-family: var(--font-display);
  font-weight: 600;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.section-heading h2 { margin: 0; }

/* ---------- Utility ---------- */

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
  border: 1px solid var(--felt-line);
  color: var(--ivory-dim);
}

.status-pill.is-open {
  color: var(--sage);
  border-color: var(--sage);
}

.status-pill.is-closed {
  color: var(--wine);
  border-color: var(--wine);
}

.muted { color: var(--ivory-dim); }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ivory-dim);
  text-decoration: none;
  font-size: 0.86rem;
  margin-bottom: 16px;
}

.back-link:hover { color: var(--ivory); }

.mt-md { margin-top: 16px; }

@media (max-width: 420px) {
  .app-header { padding: 14px 16px; }
  .app-content { padding: 20px 16px 48px; }
  .nav-link { padding: 7px 10px; font-size: 0.8rem; }
}
