:root {
  --bg: #f3efe6;
  --bg-accent: #e7f0ea;
  --ink: #1f2a24;
  --muted: #5c6b63;
  --line: #c9d4ce;
  --brand: #2f6b4f;
  --brand-dark: #214a37;
  --warn: #8a5a12;
  --danger: #8b2e2e;
  --ok: #1f6b3a;
  --card: #fffdf8;
  --radius: 10px;
  --font: "Segoe UI", "Trebuchet MS", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(circle at top left, #dceee3 0, transparent 40%),
    linear-gradient(180deg, var(--bg-accent), var(--bg));
  min-height: 100vh;
}

a {
  color: var(--brand-dark);
}

.site-header {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.9);
  backdrop-filter: blur(6px);
}

.brand {
  font-size: 1.25rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--brand-dark);
}

.nav {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.nav a {
  text-decoration: none;
  font-weight: 600;
}

.role-switch {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.role-badge {
  font-size: 0.85rem;
  color: var(--muted);
}

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem;
}

h1,
h2 {
  margin-top: 0;
}

.flash-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
}

.flash {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
  border: 1px solid var(--line);
  background: var(--card);
}

.flash.success {
  border-color: #b7dfc4;
  color: var(--ok);
}

.flash.error {
  border-color: #e2b4b4;
  color: var(--danger);
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

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

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

label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.95rem;
  flex: 1;
  min-width: 160px;
}

input[type="text"],
input[type="number"],
input[type="search"],
input[type="file"],
select,
textarea {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  background: #fff;
}

textarea {
  min-height: 80px;
  resize: vertical;
}

button,
.button {
  display: inline-block;
  border: 0;
  border-radius: 8px;
  padding: 0.55rem 0.9rem;
  background: var(--brand);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

button.secondary,
.button.secondary {
  background: #60756a;
}

button.danger,
.button.danger {
  background: var(--danger);
}

button.linkish {
  background: transparent;
  color: var(--brand-dark);
  padding: 0;
  font-weight: 600;
}

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

.results li {
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--line);
}

.meta {
  color: var(--muted);
  font-size: 0.92rem;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  background: #e4efe8;
  color: var(--brand-dark);
}

.badge.out {
  background: #f4e7d4;
  color: var(--warn);
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
}

.gallery img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
}

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

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

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

th,
td {
  text-align: left;
  padding: 0.55rem 0.35rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.check {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: auto;
}

.pre-wrap {
  white-space: pre-wrap;
}

.record-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  margin-bottom: 0.75rem;
  background: #fff;
}

.record-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: baseline;
  margin-bottom: 0.5rem;
}

.record-dl {
  display: grid;
  grid-template-columns: minmax(120px, 160px) 1fr;
  gap: 0.25rem 0.75rem;
  margin: 0;
}

.record-dl dt {
  color: var(--muted);
  font-size: 0.9rem;
}

.record-dl dd {
  margin: 0;
}

.edit-block {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--line);
}

.edit-block summary {
  cursor: pointer;
  color: var(--brand-dark);
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.pet-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  gap: 1rem;
  align-items: start;
}

.pet-side {
  position: sticky;
  top: 1rem;
}

.pet-side .warn,
tr.overdue td {
  color: var(--danger);
  font-weight: 600;
}

@media (max-width: 840px) {
  .pet-layout {
    grid-template-columns: 1fr;
  }

  .pet-side {
    position: static;
  }
}

@media print {
  .no-print,
  .flash-list,
  .role-switch,
  .site-header .nav {
    display: none !important;
  }

  body {
    background: #fff;
  }

  .site-header {
    background: #fff;
    border: 0;
  }

  .panel,
  .record-card {
    break-inside: avoid;
    box-shadow: none;
  }

  a {
    text-decoration: none;
    color: #000;
  }
}

