:root {
  --bg: #f2efe8;
  --ink: #152018;
  --muted: #5c6b5e;
  --card: #fffdf8;
  --line: #d8d1c3;
  --accent: #2f6f47;
  --warn: #9f2a2a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", serif;
  color: var(--ink);
  background: radial-gradient(circle at 0% 0%, #f8f4eb 0%, var(--bg) 45%, #e9e5dd 100%);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.92);
  backdrop-filter: blur(4px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

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

.shell {
  width: min(1200px, 95vw);
  margin: 1.25rem auto 2rem;
  display: grid;
  gap: 1rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem;
}

.narrow {
  width: min(520px, 95vw);
  margin: 3rem auto;
}

.stack {
  display: grid;
  gap: 0.65rem;
}

.row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.controls {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
}

label {
  font-weight: 600;
}

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.45rem 0.55rem;
  background: #fff;
}

button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  padding: 0.45rem 0.7rem;
  border-radius: 8px;
  cursor: pointer;
}

.logout-form button {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}

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

.error {
  color: var(--warn);
}

.funds-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 0.85rem;
}

.funds-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.85rem;
  background: #fff;
}

.funds-card.is-negative {
  border-color: #d88f8f;
  background: #fff6f6;
}

.app-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--line);
}

.app-table th,
.app-table td {
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  padding: 0.6rem;
}

.app-table th {
  background: #f8f4ec;
  text-align: left;
}

.inline-form {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.inline-form.vertical {
  align-items: stretch;
  flex-direction: column;
}

.notes-wrap {
  display: grid;
  gap: 0.5rem;
}

.notes-pre {
  white-space: pre-wrap;
  max-height: 240px;
  overflow: auto;
  padding: 0.5rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fcfaf5;
}

@media (max-width: 900px) {
  .funds-grid {
    grid-template-columns: 1fr;
  }

  .app-table,
  .app-table thead,
  .app-table tbody,
  .app-table th,
  .app-table td,
  .app-table tr {
    display: block;
  }

  .app-table thead {
    display: none;
  }

  .app-table tr {
    border-bottom: 1px solid var(--line);
    padding: 0.5rem;
  }

  .app-table td {
    border: 0;
    padding: 0.45rem 0;
  }
}
