:root {
  --primary: #1B4D3E;
  --primary-dark: #143d32;
  --accent: #C4A35A;
  --accent-hover: #b08f45;
  --bg: #ffffff;
  --bg-soft: #f6f8f7;
  --text: #1a1a1a;
  --muted: #5a6a64;
  --border: #d5ddd9;
  --danger: #a33;
  --warn: #8a6d1d;
  --warn-bg: #fff8e6;
  --ok: #1B4D3E;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(27, 77, 62, 0.08), 0 4px 16px rgba(27, 77, 62, 0.06);
  --sticky-h: 64px;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg-soft);
  color: var(--text);
  line-height: 1.45;
  padding-bottom: calc(var(--sticky-h) + 24px);
}

.wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 16px;
}

.site-header {
  background: var(--primary);
  color: #fff;
  padding: 1.25rem 0 1.5rem;
  margin-bottom: 1.25rem;
  border-bottom: 4px solid var(--accent);
}

.site-header h1 {
  margin: 0 0 0.25rem;
  font-size: clamp(1.35rem, 4vw, 1.75rem);
  font-weight: 700;
}

.subtitle {
  margin: 0;
  opacity: 0.9;
  font-size: 0.95rem;
}

.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.35rem;
  margin-bottom: 1.1rem;
}

.card h2 {
  margin: 0 0 0.35rem;
  color: var(--primary);
  font-size: 1.2rem;
  border-bottom: 2px solid var(--accent);
  padding-bottom: 0.4rem;
  display: inline-block;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.25rem;
}

.section-head h2 { margin-bottom: 0; }

.section-hint {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0.5rem 0 1rem;
}

.hint {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0.75rem 0 0;
}

.opt { color: var(--muted); font-weight: 400; font-size: 0.85em; }
.req { color: var(--danger); }

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem 1rem;
}

.grid-2 .full { grid-column: 1 / -1; }

label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--primary-dark);
}

input[type="text"],
input[type="email"],
input[type="date"],
input[type="url"],
select,
textarea {
  font: inherit;
  font-weight: 400;
  color: var(--text);
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  width: 100%;
}

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

.stack { display: flex; flex-direction: column; gap: 0.85rem; }

.row-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.9rem;
  background: var(--bg-soft);
  position: relative;
}

.row-card .row-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.65rem;
  font-weight: 700;
  color: var(--primary);
  font-size: 0.95rem;
}

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

.row-grid .span-2 { grid-column: span 2; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.55rem 0.95rem;
  border-radius: 8px;
  border: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

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

.btn-accent {
  background: var(--accent);
  color: #1a1a1a;
}
.btn-accent:hover:not(:disabled) { background: var(--accent-hover); }

.btn-secondary {
  background: #fff;
  color: var(--primary);
  border-color: var(--primary);
}
.btn-secondary:hover:not(:disabled) { background: var(--bg-soft); }

.btn-danger {
  background: #fff;
  color: var(--danger);
  border-color: var(--danger);
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
}
.btn-danger:hover:not(:disabled) { background: #fff0f0; }

.btn-small { padding: 0.4rem 0.7rem; font-size: 0.85rem; }
.btn-lg { padding: 0.75rem 1.25rem; font-size: 1rem; width: 100%; }

.file-btn { position: relative; overflow: hidden; }

.actions-bar .actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.badge {
  background: var(--primary);
  color: #fff;
  font-size: 0.8rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-weight: 600;
}

.banner {
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  border: 1px solid;
  font-size: 0.95rem;
}
.banner.error { background: #fff0f0; border-color: #e0b0b0; color: var(--danger); }
.banner.warn { background: var(--warn-bg); border-color: #e6d48a; color: var(--warn); }
.banner.ok { background: #e8f5f0; border-color: #a8d5c4; color: var(--ok); }

.toast {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  background: var(--primary);
  color: #fff;
  padding: 0.7rem 1.2rem;
  border-radius: 8px;
  box-shadow: var(--shadow);
  max-width: 90vw;
  font-size: 0.9rem;
}

.sticky-add {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.65rem 16px calc(0.65rem + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.95);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 16px rgba(0,0,0,0.06);
  z-index: 50;
}

.desktop-add-dog { margin-top: 1rem; }

.site-footer {
  margin-top: 2rem;
  padding: 1.5rem 0;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}

/* ---------- Inline Saved dogs panel ---------- */
.roster-panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-soft);
  padding: 0.75rem 0.85rem;
  margin: 0 0 1rem;
}

.roster-panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.roster-panel-title {
  margin: 0;
  font-size: 0.95rem;
  color: var(--primary);
  font-weight: 700;
}

.roster-panel-count {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 600;
}

.roster-panel-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.5rem;
  align-items: center;
}

.roster-panel-search {
  flex: 1 1 160px;
  min-width: 0;
  font: inherit;
  font-weight: 400;
  font-size: 0.88rem;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}

.roster-panel-search:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--primary);
}

.roster-panel-list {
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.roster-empty {
  margin: 0;
  padding: 0.75rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.roster-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.55rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}

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

.roster-check {
  flex: 0 0 auto;
  margin: 0;
  padding: 0;
  font-weight: 400;
}

.roster-check input {
  width: auto;
  margin: 0;
}

.roster-name-btn {
  flex: 1 1 auto;
  min-width: 0;
  text-align: left;
  background: transparent;
  border: none;
  padding: 0.15rem 0.2rem;
  cursor: pointer;
  font: inherit;
  color: var(--text);
  border-radius: 4px;
}

.roster-name-btn:hover {
  background: var(--bg-soft);
}

.roster-line {
  display: block;
  line-height: 1.3;
}

.roster-reg {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 0.1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.roster-add-one {
  flex: 0 0 auto;
  min-width: 2rem;
  padding: 0.25rem 0.55rem;
  font-size: 1rem;
  line-height: 1;
}

.days-entered {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.75rem;
  font-weight: 400;
  padding-top: 0.25rem;
}
.days-entered label {
  flex-direction: row;
  align-items: center;
  gap: 0.3rem;
  font-weight: 500;
  font-size: 0.85rem;
}
.days-entered input { width: auto; }

code {
  font-size: 0.85em;
  background: var(--bg-soft);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

@media (max-width: 640px) {
  .grid-2 { grid-template-columns: 1fr; }
  .row-grid .span-2 { grid-column: span 1; }
  .sticky-add { display: block; }
  .desktop-add-dog { display: none; }
  .actions-row .btn { flex: 1 1 calc(50% - 0.5rem); }
}

@media (min-width: 641px) {
  body { padding-bottom: 24px; }
}


.actions-more {
  margin-top: 0.65rem;
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 0.35rem 0.65rem 0.55rem;
  background: var(--bg-soft);
}

.actions-more-summary {
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--primary);
  padding: 0.35rem 0;
  list-style: none;
}

.actions-more-summary::-webkit-details-marker { display: none; }
.actions-more-summary::before {
  content: "▸ ";
  color: var(--accent);
}
.actions-more[open] .actions-more-summary::before { content: "▾ "; }

.actions-more-row {
  margin-top: 0.4rem;
}

@media (max-width: 640px) {
  .actions-more-row .btn { flex: 1 1 calc(50% - 0.5rem); }
  .actions-more-row .btn:last-child { flex: 1 1 100%; }
}



/* ---------- Auth / beta chrome ---------- */
.beta-banner {
  display: inline-block;
  margin: 0 0 0.65rem;
  padding: 0.25rem 0.65rem;
  background: var(--accent);
  color: #1a1a1a;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  border-radius: 999px;
  text-transform: uppercase;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  align-items: center;
  margin-top: 0.85rem;
  font-size: 0.9rem;
}

.site-nav a {
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  border-bottom: 2px solid transparent;
  padding-bottom: 0.1rem;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  border-bottom-color: var(--accent);
}

.site-nav .nav-user {
  opacity: 0.85;
  font-size: 0.85rem;
  margin-left: auto;
}

.auth-page body,
body.auth-page {
  padding-bottom: 24px;
}

.auth-wrap {
  max-width: 440px;
}

.auth-card h2 {
  margin-bottom: 0.5rem;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-top: 0.75rem;
}

.auth-form .btn-lg {
  width: 100%;
  margin-top: 0.35rem;
}

.auth-switch {
  margin-top: 1rem;
  text-align: center;
}

.auth-switch a {
  color: var(--primary);
  font-weight: 600;
}

.account-dl {
  display: grid;
  grid-template-columns: 8rem 1fr;
  gap: 0.5rem 1rem;
  margin: 1rem 0 0;
}

.account-dl dt {
  font-weight: 600;
  color: var(--muted);
  font-size: 0.88rem;
}

.account-dl dd {
  margin: 0;
  font-weight: 500;
}

input[type="password"] {
  font: inherit;
  font-weight: 400;
  color: var(--text);
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  width: 100%;
}

input[type="password"]:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--primary);
}

a.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  box-sizing: border-box;
}

/* ---------- Add to Home Screen ---------- */
.btn-a2hs {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}
.btn-a2hs:hover {
  background: rgba(255, 255, 255, 0.22);
  border-color: var(--accent);
}
.header-a2hs {
  margin: 0.75rem 0 0;
}
body.auth-page .btn-a2hs {
  font-size: 0.85rem;
}
.linkish {
  appearance: none;
  border: 0;
  background: none;
  color: var(--primary);
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
}
.a2hs-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(20, 40, 34, 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
}
.a2hs-overlay[hidden] {
  display: none !important;
}
.a2hs-sheet {
  width: min(420px, 100%);
  background: var(--bg);
  border-radius: 16px 16px 12px 12px;
  box-shadow: 0 -8px 32px rgba(27, 77, 62, 0.2);
  padding: 1.25rem 1.35rem 1.5rem;
  position: relative;
  outline: none;
  border-top: 4px solid var(--accent);
  max-height: min(85vh, 560px);
  overflow: auto;
}
@media (min-width: 640px) {
  .a2hs-overlay {
    align-items: center;
  }
  .a2hs-sheet {
    border-radius: 14px;
  }
}
.a2hs-close {
  position: absolute;
  top: 0.55rem;
  right: 0.65rem;
  appearance: none;
  border: 0;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 0.2rem 0.45rem;
}
.a2hs-sheet h2 {
  margin: 0 1.5rem 0.35rem 0;
  color: var(--primary);
  font-size: 1.2rem;
}
.a2hs-lead {
  margin: 0 0 0.85rem;
  color: var(--muted);
  font-size: 0.92rem;
}
.a2hs-steps {
  margin: 0 0 0.75rem;
  padding-left: 1.2rem;
  line-height: 1.55;
}
.a2hs-steps li {
  margin-bottom: 0.45rem;
}
.a2hs-icon-share {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35em;
  height: 1.35em;
  vertical-align: -0.2em;
  border: 1.5px solid var(--primary);
  border-radius: 4px;
  color: var(--primary);
  font-size: 0.85em;
  font-weight: 700;
}
.a2hs-install-btn {
  width: 100%;
  margin-top: 0.5rem;
}
/* [hidden] must beat .btn { display: inline-flex } */
.btn[hidden],
[data-a2hs-install][hidden],
.a2hs-install-btn[hidden] {
  display: none !important;
}

body.a2hs-open {
  overflow: hidden;
}
