:root {
  --bg: #F6F3EE;
  --surface: #FFFFFF;
  --ink: #1C1917;
  --ink-muted: #6F6A64;
  --line: #E4DFD7;
  --accent: #1E5C48;
  --accent-hover: #174A3A;
  --accent-soft: #E8F2EE;
  --danger: #9B2C1F;
  --shadow-rest: 0 1px 2px rgba(28, 25, 23, 0.06);
  --shadow-lift: 0 8px 24px rgba(28, 25, 23, 0.08);
  --font-display: "Source Serif 4", Georgia, serif;
  --font-ui: "IBM Plex Sans", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
  --radius-input: 6px;
  --radius-card: 12px;
  --radius-photo: 8px;
  --radius-pill: 999px;
}

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

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 24px;
  font-weight: 400;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: var(--accent);
}

a:hover {
  color: var(--accent-hover);
}

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

.wordmark {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 22px;
  line-height: 32px;
  color: var(--ink);
  text-decoration: none;
}

.wordmark:hover {
  color: var(--ink);
}

.wordmark-lg {
  font-size: 32px;
  line-height: 40px;
  margin: 0 0 8px;
}

.topbar {
  height: 64px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 1120px;
  margin: 0 auto;
  height: 64px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

@media (min-width: 768px) {
  .topbar-inner {
    padding: 0 48px;
  }
}

.nav {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav a,
.nav-btn {
  color: var(--ink);
  text-decoration: none;
  font-size: 16px;
  line-height: 24px;
  background: none;
  border: 0;
  padding: 0;
  font-family: inherit;
  cursor: pointer;
}

.nav a:hover,
.nav-btn:hover {
  color: var(--accent);
}

.nav-form {
  display: inline;
  margin: 0;
}

.page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px;
}

@media (min-width: 768px) {
  .page {
    padding: 32px 48px 48px;
  }
}

.page-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 24px;
  line-height: 32px;
  margin: 0 0 32px;
}

@media (min-width: 768px) {
  .page-title {
    font-size: 32px;
    line-height: 40px;
  }
}

.vis-hide {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border-radius: var(--radius-card);
  padding: 32px;
  box-shadow: var(--shadow-rest);
}

.login-lead {
  margin: 0 0 24px;
  color: var(--ink);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-narrow {
  max-width: 400px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field label,
.field > span,
label {
  font-size: 13px;
  line-height: 18px;
  font-weight: 500;
  color: var(--ink-muted);
  letter-spacing: 0.02em;
}

input[type="text"],
input[type="password"],
input[type="date"],
input[type="file"],
select {
  height: 44px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-input);
  padding: 0 12px;
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 24px;
  color: var(--ink);
}

input[type="file"] {
  padding-top: 8px;
}

input:focus,
select:focus {
  border-color: var(--accent);
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.amount {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 16px;
  line-height: 24px;
}

.amount-lg {
  font-size: 20px;
  line-height: 28px;
  margin: 0 0 24px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 24px;
  border-radius: var(--radius-input);
  border: 0;
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 24px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
}

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

.btn-primary:hover {
  background: var(--accent-hover);
  color: #fff;
}

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

.btn-ghost:hover {
  color: var(--accent);
}

.btn-block {
  width: 100%;
}

.btn-text {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: 0;
  padding: 0;
  font-family: inherit;
  font-size: 16px;
  line-height: 24px;
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
}

.btn-text:hover {
  color: var(--accent);
}

.btn-danger {
  display: inline;
  background: none;
  border: 0;
  padding: 0;
  font-family: inherit;
  font-size: 16px;
  line-height: 24px;
  color: var(--danger);
  cursor: pointer;
  text-decoration: none;
}

.btn-row {
  display: flex;
  gap: 16px;
  align-items: center;
}

.error {
  margin: 0;
  font-size: 13px;
  line-height: 18px;
  color: var(--danger);
}

.success {
  margin: 0;
  font-size: 13px;
  line-height: 18px;
  color: var(--accent);
}

.caption {
  font-size: 12px;
  line-height: 16px;
  color: var(--ink-muted);
}

.pill {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  line-height: 16px;
  white-space: nowrap;
}

.pill-no {
  background: var(--bg);
  color: var(--ink-muted);
}

.pill-yes {
  background: var(--accent-soft);
  color: var(--accent);
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-end;
  background: var(--surface);
  padding: 16px;
  border-radius: var(--radius-card);
  margin-bottom: 24px;
  box-shadow: var(--shadow-rest);
}

.field-inline {
  min-width: 160px;
}

.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 768px) {
  .card-grid {
    grid-template-columns: 1fr 1fr;
    gap: 24px;
  }
}

.card {
  background: var(--surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-rest);
  overflow: hidden;
}

.card-link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.card-link:hover {
  box-shadow: var(--shadow-lift);
}

.card-photo {
  margin: 8px 8px 0;
  aspect-ratio: 4 / 3;
  background: var(--line);
  border-radius: var(--radius-photo);
  overflow: hidden;
}

.card-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-photo.missing img,
.thumb-btn.missing img,
.detail-photo.missing img {
  display: none;
}

.card-photo.missing::after,
.thumb-btn.missing::after,
.detail-photo.missing::after {
  content: "Photo unavailable.";
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  font-size: 12px;
  line-height: 16px;
  color: var(--ink-muted);
}

.card-body {
  padding: 16px;
}

.card-pad {
  padding: 16px;
}

.card-purpose {
  margin: 0 0 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 0 16px 16px;
}

.surface-panel {
  background: var(--surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-rest);
  overflow: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.table th {
  font-size: 13px;
  line-height: 18px;
  font-weight: 500;
  color: var(--ink-muted);
  letter-spacing: 0.02em;
}

.table tbody tr:hover {
  background: var(--bg);
}

.table .num {
  text-align: right;
}

.thumb-btn {
  width: 48px;
  height: 48px;
  padding: 0;
  border: 0;
  background: var(--line);
  border-radius: var(--radius-photo);
  overflow: hidden;
  cursor: pointer;
}

.thumb-btn img {
  width: 48px;
  height: 48px;
  object-fit: cover;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.admin-table {
  display: none;
}

.admin-cards {
  display: grid;
}

@media (min-width: 768px) {
  .admin-table {
    display: block;
  }
  .admin-cards {
    display: none;
  }
}

.empty {
  text-align: center;
  padding: 48px 16px;
}

.empty p {
  margin: 0 0 8px;
}

.detail {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.detail-photo {
  display: block;
  background: var(--line);
  width: calc(100% + 48px);
  margin: 0 -24px;
  border-radius: 0;
}

.detail-photo img {
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
  background: var(--line);
}

.detail-purpose {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 24px;
  line-height: 32px;
  margin: 0 0 16px;
}

.defs {
  margin: 0;
}

.defs > div {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.defs dt {
  font-size: 13px;
  line-height: 18px;
  font-weight: 500;
  color: var(--ink-muted);
  letter-spacing: 0.02em;
}

.defs dd {
  margin: 0;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 16px;
  line-height: 24px;
  font-weight: 400;
  letter-spacing: 0;
}

.create-row {
  display: grid;
  gap: 16px;
  margin-bottom: 24px;
  background: var(--surface);
  padding: 16px;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-rest);
}

.user-cards {
  gap: 16px;
}

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(28, 25, 23, 0.8);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
}

.lightbox[hidden] {
  display: none !important;
}

.lightbox img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-lift);
}

.lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
}

@media (min-width: 768px) {
  .detail {
    display: grid;
    grid-template-columns: 58% 1fr;
    gap: 32px;
    align-items: start;
  }
  .detail-photo {
    width: 100%;
    margin: 0;
    border-radius: var(--radius-card);
    overflow: hidden;
  }
  .detail-purpose {
    font-size: 32px;
    line-height: 40px;
  }
  .create-row {
    grid-template-columns: 1fr 1fr 1fr 140px auto;
    align-items: end;
  }
}
