:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-muted: #eef2ff;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --text: #111827;
  --text-muted: #6b7280;
  --text-soft: #94a3b8;

  --primary: #111827;
  --primary-hover: #1f2937;
  --secondary: #ffffff;

  --feeding: #2d6a4f;
  --shed: #6c757d;
  --measurement: #1d4ed8;
  --vet: #b45309;
  --reminder: #a12c7b;
  --danger: #991b1b;

  --shadow-sm: 0 4px 10px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 10px 30px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 20px 40px rgba(15, 23, 42, 0.08);

  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 22px;

  --container: 1180px;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #f8fafc 0%, var(--bg) 100%);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
}

a {
  color: inherit;
  text-decoration: none;
}

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

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

button {
  cursor: pointer;
}

.container {
  width: min(var(--container), calc(100vw - 32px));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(16px);
  background: rgba(255, 255, 255, 0.86);
  border-bottom: 1px solid rgba(229, 231, 235, 0.9);
}

.site-header__inner {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-subtitle {
  font-size: 13px;
  color: var(--text-muted);
}

.main-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 10px 14px;
  border-radius: 999px;
  color: var(--text-muted);
  transition: 160ms ease;
}

.nav-link:hover {
  color: var(--text);
  background: var(--surface-soft);
}

.nav-link.is-active {
  color: var(--text);
  background: var(--surface-muted);
}

.nav-link--ghost {
  border: 1px solid var(--border);
  color: var(--text);
}

.page-shell {
  padding: 26px 0 40px;
}

.page-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.page-title {
  margin: 0;
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.page-subtitle {
  margin: 8px 0 0;
  color: var(--text-muted);
  max-width: 72ch;
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 700;
  transition: 160ms ease;
}

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

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: var(--secondary);
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-secondary:hover {
  background: var(--surface-soft);
}

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

.content-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-md);
}

.content-card--form {
  max-width: 860px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}

.stat-label {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.2;
}

.layout-two {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 16px;
}

.panel-title {
  margin: 0 0 14px;
  font-size: 18px;
}

.stack {
  display: grid;
  gap: 12px;
}

.feed-list {
  display: grid;
  gap: 14px;
}

.feed-item,
.list-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  background: var(--surface);
}

.item-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.item-meta,
.muted,
.small-muted {
  color: var(--text-muted);
}

.small-muted {
  font-size: 13px;
}

.form-grid {
  display: grid;
  gap: 16px;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.field {
  display: grid;
  gap: 8px;
}

.field label,
.label {
  font-size: 14px;
  font-weight: 700;
}

.input,
.textarea,
.select,
.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
}

.textarea,
.field textarea {
  min-height: 120px;
  resize: vertical;
}

.input:focus,
.textarea:focus,
.select:focus,
.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: 2px solid rgba(29, 78, 216, 0.18);
  border-color: #93c5fd;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
}

.filters-card {
  margin-bottom: 20px;
}

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

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #374151;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  display: inline-block;
}

.badge {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
}

.badge.feeding { background: var(--feeding); }
.badge.shed { background: var(--shed); }
.badge.measurement { background: var(--measurement); }
.badge.vet { background: var(--vet); }
.badge.reminder { background: var(--reminder); }

.feed-row-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  margin-bottom: 8px;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.pager {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
  align-items: center;
  flex-wrap: wrap;
}

.error-box {
  padding: 10px 12px;
  border-radius: 12px;
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
  font-size: 14px;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(420px, calc(100vw - 32px));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: var(--shadow-lg);
}

.auth-title {
  margin: 0 0 8px;
  font-size: 28px;
}

.auth-subtitle {
  margin: 0 0 20px;
  color: var(--text-muted);
}

.fc {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
}

.event-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}

.event-modal.open {
  display: flex;
}

.event-modal-card {
  width: min(520px, 100%);
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow-lg);
}

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

@media (max-width: 980px) {
  .stats-grid,
  .layout-two {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .site-header__inner,
  .page-header,
  .feed-row-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .form-row-2 {
    grid-template-columns: 1fr;
  }

  .container {
    width: min(var(--container), calc(100vw - 24px));
  }

  .page-shell {
    padding-top: 18px;
  }
}
.stats-grid--five {
  grid-template-columns: repeat(5, 1fr);
}

.stat-value--sm {
  font-size: 16px;
  line-height: 1.35;
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

@media (max-width: 1180px) {
  .stats-grid--five {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .stats-grid--five {
    grid-template-columns: 1fr;
  }
}