/* PawsInn staff UI — utilitarian, readable, printable.
   Deliberately small and framework-free. */

* { box-sizing: border-box; }

:root {
  --bg: #fbfaf7;
  --fg: #1f2328;
  --muted: #6a737d;
  --accent: #8b5a2b;
  --accent-fg: #fff;
  --warn: #b7791f;
  --danger: #b02a37;
  --ok: #2d6a4f;
  --border: #e1e4e8;
  --card-bg: #fff;
  --chip-bg: #f0f2f5;
}

html, body { margin: 0; padding: 0; background: var(--bg); color: var(--fg); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.topnav {
  display: flex; align-items: center; gap: 1rem;
  background: var(--accent); color: var(--accent-fg);
  padding: 0.5rem 1rem;
}
.topnav .brand { color: #fff; font-weight: 700; font-size: 1.1rem; }
.topnav ul { list-style: none; display: flex; gap: 0.25rem; margin: 0; padding: 0; flex: 1; }
.topnav li a { color: #fff; padding: 0.4rem 0.75rem; border-radius: 4px; display: inline-block; }
.topnav li.active > a,
.topnav li a:hover { background: rgba(255,255,255,0.15); text-decoration: none; }

.topnav li.nav-group { position: relative; }
.topnav .nav-group-toggle {
  color: #fff; background: transparent; border: 0; cursor: pointer;
  padding: 0.4rem 0.75rem; border-radius: 4px;
  font: inherit; line-height: inherit;
  display: inline-flex; align-items: center; gap: 0.35rem;
}
.topnav .nav-group-toggle:hover,
.topnav li.nav-group.active > .nav-group-toggle,
.topnav li.nav-group.open > .nav-group-toggle {
  background: rgba(255,255,255,0.15);
}
.topnav .nav-caret { font-size: 0.75rem; opacity: 0.9; }
.topnav .nav-dropdown {
  position: absolute; top: 100%; left: 0;
  display: none; flex-direction: column;
  background: var(--accent); color: var(--accent-fg);
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  border-radius: 4px; padding: 0.25rem; margin-top: 0.25rem;
  min-width: 10rem; z-index: 10;
  list-style: none;
}
.topnav li.nav-group:hover > .nav-dropdown,
.topnav li.nav-group:focus-within > .nav-dropdown,
.topnav li.nav-group.open > .nav-dropdown {
  display: flex;
}
.topnav .nav-dropdown li { display: block; }
.topnav .nav-dropdown a {
  display: block; white-space: nowrap;
  padding: 0.4rem 0.75rem; border-radius: 3px;
}
.topnav .nav-dropdown li.active > a,
.topnav .nav-dropdown a:hover { background: rgba(255,255,255,0.2); }
.topnav-right { display: flex; gap: 0.5rem; align-items: center; color: #fff; }
.topnav-right .user { opacity: 0.9; }
.logout-form button { background: transparent; border: 1px solid rgba(255,255,255,0.5); color: #fff; padding: 0.3rem 0.6rem; border-radius: 4px; cursor: pointer; }

main { max-width: 1200px; margin: 0 auto; padding: 1.25rem; }
body.bare main { max-width: 440px; }

.page-header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.page-header h1 { margin: 0; font-size: 1.4rem; }
.tally { display: flex; gap: 1rem; color: var(--muted); }
.tally b { color: var(--fg); }

.card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 6px; padding: 1rem; margin-bottom: 1rem; }
.card h2 { margin-top: 0; font-size: 1.1rem; }
.card-nested { margin-top: 0.75rem; }

.btn, .btn-nav, .btn-inline {
  display: inline-block; padding: 0.35rem 0.75rem; border: 1px solid var(--border); border-radius: 4px;
  background: #fff; color: var(--fg); cursor: pointer; font-size: 0.9rem; text-decoration: none;
}
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.warn { background: #fff7e6; border-color: #e6b800; color: #7a5a00; }
.btn.danger { background: #fff0f1; border-color: #e9aeb4; color: var(--danger); }
.btn:hover, .btn-nav:hover { text-decoration: none; filter: brightness(0.97); }
.btn-inline { padding: 0.2rem 0.5rem; font-size: 0.85rem; }

.filters { display: flex; gap: 0.5rem; margin-bottom: 1rem; flex-wrap: wrap; align-items: center; }
.filters input, .filters select { padding: 0.4rem 0.6rem; border: 1px solid var(--border); border-radius: 4px; }
.filters input.live-filter { min-width: 18rem; }
.live-filter-count { font-size: 0.85rem; }

table { width: 100%; border-collapse: collapse; }
table.list th, table.list td, table.daily-table th, table.daily-table td { padding: 0.5rem 0.6rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
table th { background: #f6f6f4; font-weight: 600; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.02em; color: #555; }
.right { text-align: right; }
.muted { color: var(--muted); }

.badge { display: inline-block; padding: 0.1rem 0.5rem; border-radius: 10px; font-size: 0.8rem; background: var(--chip-bg); }
.badge-pending_request { background: #fff5d6; color: #7a5a00; }
.badge-confirmed { background: #d8f0e4; color: var(--ok); }
.badge-cancelled { background: #eceff1; color: #555; text-decoration: line-through; }
.badge-warn { background: #fff5d6; color: #7a5a00; }
.badge-vax-ok { background: #d8f0e4; color: var(--ok); }
.badge-vax-warn { background: #fff5d6; color: #7a5a00; }
.badge-vax-expired { background: #ffd9de; color: var(--danger); }
.badge-vax-missing { background: #eceff1; color: #555; }

.chip { display: inline-block; padding: 0.05rem 0.45rem; border-radius: 10px; background: var(--chip-bg); font-size: 0.8rem; color: #333; margin-right: 0.25rem; }
.chip-arr { background: #d8f0e4; color: var(--ok); }
.chip-dep { background: #fff5d6; color: #7a5a00; }
.chip-pending { background: #fff5d6; color: #7a5a00; }
.chip-in { background: #cfe8fb; color: #123f6b; }
.chip-out { background: #e0d8ef; color: #3b1d6e; }
.chip-paylater { background: #fde2e2; color: #991b1b; font-weight: 600; }
.paylater-form { margin-top: 0.75rem; gap: 0.75rem; align-items: center; }

.daily-table .strike td { text-decoration: line-through; color: var(--muted); }
.daily-table .strike td a { color: var(--muted); }
.daily-table .species { width: 1.8rem; text-align: center; font-size: 1.1rem; }

/* Daily page — 2x2 panel grid. */
.daily-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.daily-grid .panel { background: var(--card-bg); border: 1px solid var(--border); border-radius: 6px; padding: 0.9rem 1rem; }
.daily-grid .panel h3 { display: flex; align-items: center; justify-content: space-between; margin: 0 0 0.5rem 0; font-size: 1rem; font-weight: 600; color: #444; background: #f3f3ef; padding: 0.4rem 0.6rem; border-radius: 4px; }
.daily-grid .panel h3 .panel-count { font-variant-numeric: tabular-nums; color: #555; background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 0 0.45rem; min-width: 1.4rem; text-align: center; font-size: 0.85rem; }
.daily-grid .panel p.muted { margin: 0.5rem 0.6rem; }
.daily-grid .daily-table { font-size: 0.92rem; }
.daily-grid .daily-table th { background: transparent; text-transform: none; letter-spacing: 0; font-size: 0.82rem; color: #666; padding: 0.3rem 0.5rem; border-bottom: 1px solid var(--border); }
.daily-grid .daily-table td { padding: 0.35rem 0.5rem; vertical-align: middle; }
.daily-grid .daily-table tr { cursor: pointer; }
.daily-grid .lastname { font-weight: 600; letter-spacing: 0.02em; }
.daily-grid .animal { letter-spacing: 0.03em; text-transform: uppercase; font-weight: 500; }
.daily-grid .vax { font-size: 0.9rem; }
.colour-swatch {
  display: inline-block; width: 1rem; height: 1rem; border-radius: 3px;
  border: 1px solid rgba(0,0,0,0.15); vertical-align: middle;
}
.colour-swatch.colour-none { width: auto; height: auto; border: 0; color: var(--muted); }
.colour-blue    { background: #4a90e2; }
.colour-green   { background: #6cbf6b; }
.colour-peach   { background: #ffb88a; }
.colour-magenta { background: #d63ca8; }
.daily-grid .actions { white-space: nowrap; }
.daily-grid .edit-link { color: var(--accent); text-decoration: underline; }
.daily-grid form.row-action { display: none; } /* hidden; row click submits via JS */
.vax-ok { color: var(--ok); }
.vax-warn { color: #7a5a00; }
.vax-expired { color: var(--danger); }
.vax-missing { color: #555; }

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

.flash { padding: 0.6rem 0.9rem; border-radius: 4px; margin-bottom: 1rem; }
.flash-ok { background: #d8f0e4; color: var(--ok); }
.flash-warn { background: #fff5d6; color: #7a5a00; }
.flash-error { background: #ffd9de; color: var(--danger); }

.stack { display: flex; flex-direction: column; gap: 0.6rem; max-width: 440px; }
.stack label { display: flex; flex-direction: column; gap: 0.2rem; }
.stack input, .stack select, .stack textarea { padding: 0.45rem 0.6rem; border: 1px solid var(--border); border-radius: 4px; font: inherit; }
.inline-check { flex-direction: row !important; align-items: center; gap: 0.5rem; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
.form-grid label { display: flex; flex-direction: column; gap: 0.2rem; }
.form-grid input, .form-grid select, .form-grid textarea { padding: 0.45rem 0.6rem; border: 1px solid var(--border); border-radius: 4px; font: inherit; }
.form-grid .wide { grid-column: 1 / -1; }

.inline-form { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: end; margin-bottom: 0.75rem; }
.inline-form input, .inline-form select { padding: 0.4rem 0.6rem; border: 1px solid var(--border); border-radius: 4px; }

.kv { display: grid; grid-template-columns: 10rem 1fr; gap: 0.4rem 1rem; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.notes { white-space: pre-wrap; font: inherit; margin: 0; }

.token-plain { display: block; margin-top: 0.5rem; padding: 0.5rem; background: #fff; border: 1px solid var(--border); word-break: break-all; }

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

.calendar { table-layout: fixed; }
.calendar th { width: 14.285%; }
.calendar td { height: 5.5rem; vertical-align: top; padding: 0; }
.calendar td.blank { background: #f6f6f4; }
.calendar .daycell {
  display: block; height: 100%; padding: 0.3rem;
  color: inherit; text-decoration: none;
}
.calendar .daycell:hover { background: #eef2f7; text-decoration: none; }
.calendar .daynum { font-weight: 600; margin-bottom: 0.3rem; }
.calendar .daytally { list-style: none; margin: 0; padding: 0; font-size: 0.85rem; line-height: 1.4; }
.calendar .daytally li { padding: 0.05rem 0.3rem; border-radius: 3px; margin-bottom: 0.1rem; }
.calendar .tally-dogs { background: #e6eef8; }
.calendar .tally-cats { background: #f5e8f0; }
.calendar .tally-pending { background: #fff5d6; }

.login, .owner-form { max-width: 420px; margin: 2rem auto; padding: 1.25rem; background: #fff; border: 1px solid var(--border); border-radius: 6px; }
.login h1, .owner-form h1 { margin-top: 0; }
.animal-block { border: 1px solid var(--border); border-radius: 4px; padding: 0.75rem; margin: 0.5rem 0; }

/* Booking detail — collapsible pricing summary. */
.price-total { margin: 0 0 0.5rem 0; font-size: 1.15rem; }
.price-total-amount { font-variant-numeric: tabular-nums; font-weight: 600; }
.balance-due    { color: #b91c1c; font-weight: 600; font-variant-numeric: tabular-nums; }
.balance-zero   { color: #047857; font-weight: 600; font-variant-numeric: tabular-nums; }
.balance-credit { color: #1d4ed8; font-weight: 600; font-variant-numeric: tabular-nums; }
.price-details { margin-top: 0.25rem; }
.price-details summary {
  cursor: pointer; color: var(--accent); padding: 0.2rem 0;
  font-size: 0.9rem; user-select: none;
}
.price-details[open] summary { margin-bottom: 0.5rem; }
.price-details summary::-webkit-details-marker { color: var(--muted); }

/* On-site page — six kennel columns for one day. */
.onsite-section { margin: 1rem 0; }
.onsite-section h2 { margin: 0 0 0.4rem 0; font-size: 1.1rem; color: #444; }
.onsite-divider {
  border: 0; border-top: 2px solid var(--border); margin: 1.5rem 0;
}
table.onsite { width: 100%; border-collapse: collapse; table-layout: fixed; }
table.onsite th, table.onsite td { border: 1px solid var(--border); padding: 0.35rem 0.5rem; vertical-align: top; }
table.onsite thead th { font-weight: 600; text-align: center; text-transform: uppercase; font-size: 0.75rem; letter-spacing: 0.03em; color: #333; padding: 0.4rem 0.5rem; }
table.onsite .onsite-count { text-align: center; font-weight: 600; font-size: 1.1rem; font-variant-numeric: tabular-nums; padding: 0.25rem; color: #333; }
/* Reserve at least 8 chips worth of height per column. `height` on a <td>
   is treated as a minimum in table layout: the cell grows to fit content
   when there are more than 8 entries. Each chip is ~1.74rem incl. margin,
   so 15rem comfortably holds 8. */
table.onsite .onsite-chips td { height: 15rem; }

.onsite-col-daycare { background: #fff4b8; }  /* yellow */
.onsite-col-peach   { background: #ffe1cc; }
.onsite-col-green   { background: #d8ecd6; }
.onsite-col-blue    { background: #d5e6f7; }
.onsite-col-magenta { background: #f3d1e6; }
.onsite-col-new     { background: #ffd29a; }  /* orange */

table.onsite thead th.onsite-col-daycare { background: #ffe880; }
table.onsite thead th.onsite-col-peach   { background: #ffc7a0; }
table.onsite thead th.onsite-col-green   { background: #b8dcb5; }
table.onsite thead th.onsite-col-blue    { background: #b6d3f0; }
table.onsite thead th.onsite-col-magenta { background: #e6a9cd; }
table.onsite thead th.onsite-col-new     { background: #ffb26a; }

.onsite-chip {
  display: grid;
  grid-template-columns: 1.75rem 1fr 1.75rem;
  align-items: center;
  gap: 0.35rem;
  color: var(--fg); text-decoration: none;
  padding: 0.15rem 0.45rem; margin-bottom: 3px;
  background: rgba(255, 255, 255, 0.6); border-radius: 3px;
  font-weight: 500; font-size: 0.9rem;
}
.onsite-chip:hover { background: rgba(255, 255, 255, 0.95); text-decoration: none; }
.onsite-chip-label {
  text-align: center;
  text-overflow: ellipsis; overflow: hidden; white-space: nowrap;
  min-width: 0;
}
.onsite-mark {
  display: inline-block;
  color: #fff; background: var(--danger);
  font-weight: 800; font-size: 1.05rem; line-height: 1;
  min-width: 1.25rem; padding: 0.1rem 0.3rem;
  border-radius: 3px; text-align: center;
}
.onsite-plus  { justify-self: start; }
.onsite-minus { justify-self: end; }
.onsite-mark-placeholder {
  display: inline-block;
  min-width: 1.25rem;
  padding: 0.1rem 0.3rem;
  visibility: hidden;
}
.onsite-summary {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  margin: 0.5rem 0 1rem;
}
.onsite-summary-left {
  display: flex; gap: 1.5rem; flex-wrap: wrap;
  justify-self: start;
}
.onsite-summary-center { justify-self: center; }
.onsite-summary-item {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-weight: 600;
}

/* Inbox Confirm/Decline email modal. Uses native <dialog> for a11y. */
.email-modal {
  width: min(640px, 92vw); max-width: 640px;
  border: 1px solid var(--border); border-radius: 8px;
  padding: 1rem 1.25rem; background: var(--card-bg); color: var(--fg);
}
.email-modal::backdrop { background: rgba(0, 0, 0, 0.35); }
.email-modal form { display: flex; flex-direction: column; gap: 0.6rem; }
.email-modal h3 { margin: 0; font-size: 1.1rem; }
.email-modal label { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.9rem; color: var(--muted); }
.email-modal input, .email-modal textarea {
  padding: 0.45rem 0.6rem; border: 1px solid var(--border); border-radius: 4px;
  font: inherit; color: var(--fg); background: #fff;
}
.email-modal textarea { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.88rem; line-height: 1.45; }
.email-modal .actions-bar { justify-content: flex-end; margin-top: 0.25rem; }

@media (max-width: 700px) {
  main { padding: 0.75rem; }
  .form-grid { grid-template-columns: 1fr; }
}
