/* AZUKARI - foundation stylesheet */

:root {
  --teal: #12787a;
  --teal-dark: #0d5c5e;
  --purple: #7b5aa6;
  --gold: #c9992e;
  --green: #3a9e5f;
  --blue: #3b7ddd;
  --red: #d05252;
  --ink: #2d3237;
  --muted: #7a828a;
  --bg: #eef0f2;
  --card: #ffffff;
  --line: #dfe3e7;
  --sidebar-bg: #f5f5f7;
  --sidebar-w: 220px;
  --topbar-h: 52px;
  --radius: 8px;
  font-size: 15px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

/* ---- topbar ---------------------------------------------------------- */

.topbar {
  height: var(--topbar-h);
  background: #3a3f44;
  border-bottom: 3px solid var(--teal);
  color: #f2f4f5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand-mark {
  font-weight: 700;
  letter-spacing: 2px;
}

.brand-sub {
  margin-left: 10px;
  color: #aab3b9;
  font-size: 0.85rem;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 18px;
}

.topbar-date { color: #cdd4d9; font-size: 0.85rem; }

/* user menu (pure CSS via <details>) */
.user-menu { position: relative; }

.user-menu summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: var(--radius);
}
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary:hover { background: rgba(255, 255, 255, 0.08); }

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--teal);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  text-transform: uppercase;
}

.user-menu .menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  min-width: 160px;
  padding: 6px;
  display: flex;
  flex-direction: column;
}

.user-menu .menu a,
.user-menu .menu button {
  all: unset;
  cursor: pointer;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 0.95rem;
  display: block;
  width: calc(100% - 20px);
}
.user-menu .menu a:hover,
.user-menu .menu button:hover { background: var(--bg); }
.user-menu .menu form { display: contents; }

/* ---- shell / sidebar -------------------------------------------------- */

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: calc(100vh - var(--topbar-h));
}

.sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--line);
  padding: 12px 8px;
}

.sidebar ul {
  list-style: none;
  margin: 0 0 6px;
  padding: 0;
}

.sidebar a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 10px;
  border-radius: 6px;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.95rem;
}
.sidebar a:hover { background: #e8e8ec; }
.sidebar a.active { background: #dfdfe4; font-weight: 600; }

.nav-label {
  margin: 14px 10px 4px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

/* small colored nav icons, macOS-sidebar style */
.ni {
  width: 20px;
  height: 20px;
  border-radius: 5px;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.ni-green  { background: #4ca464; }
.ni-orange { background: #e08b3c; }
.ni-blue   { background: #4a7fd4; }
.ni-teal   { background: #2e9a9d; }
.ni-purple { background: #8a6bbf; }
.ni-red    { background: #d05f5f; }
.ni-gray   { background: #8b939b; }
.ni-yellow { background: #d3b13a; }
.ni-gold   { background: var(--gold); }
.ni-dark   { background: #4b5157; }

/* ---- content ---------------------------------------------------------- */

.content { padding: 22px 26px; min-width: 0; }

.page-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 18px;
}
.page-head h1 { margin: 0; font-size: 1.4rem; }

h2 { font-size: 1rem; margin: 0 0 12px; }

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

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}

.notice {
  padding: 10px 14px;
  border-radius: var(--radius);
  margin-bottom: 14px;
  font-size: 0.95rem;
}
.notice-ok  { background: #e5f4e9; color: #22633a; border: 1px solid #bfe3ca; }
.notice-err { background: #fbe9e9; color: #8f2f2f; border: 1px solid #eec7c7; }

/* ---- dashboard tiles --------------------------------------------------- */

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}
.tiles-wide { grid-template-columns: 2fr 1fr 1fr; }

.tile h2 { text-align: center; color: var(--ink); }

.tile-body {
  display: flex;
  justify-content: space-evenly;
  gap: 12px;
}
.tile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.stat { text-align: center; }

.stat-num {
  display: block;
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--purple);
  line-height: 1.2;
}
.stat-dim   { color: #a99cc4; }
.stat-gold  { color: var(--gold); }
.stat-green { color: var(--green); }
.stat-blue  { color: var(--blue); }

.stat-label { font-size: 0.78rem; color: var(--muted); }

/* occupancy mini calendar: 7 columns, traffic-light cells */
.occ-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.occ-wd { text-align: center; font-size: 0.72rem; }
.occ-day {
  position: relative;
  text-align: center;
  padding: 6px 0;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: default;
}
.occ-free { background: #e5f4e9; color: #22633a; }
.occ-busy { background: #fdf3dd; color: #8a6516; }
.occ-full { background: #fbe9e9; color: #8f2f2f; }
.occ-none { background: #eceff1; color: var(--muted); }
.occ-day.is-past  { opacity: 0.4; }
.occ-day.is-today { outline: 2px solid var(--teal); outline-offset: -1px; }
.occ-month {
  position: absolute;
  top: 1px;
  left: 4px;
  font-size: 0.6rem;
  font-weight: 400;
  opacity: 0.8;
}
.occ-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 10px;
  font-size: 0.78rem;
}
.occ-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  vertical-align: -1px;
}

/* today's arrivals / departures */
.move-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.move-list li {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}
.move-list li:last-child { border-bottom: none; }
.move-list a { font-weight: 600; }
.move-meta { font-size: 0.8rem; }
.move-list .badge { margin-left: auto; }

/* recent-activity feed */
.feed {
  list-style: none;
  margin: 0;
  padding: 0;
}
.feed li {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid var(--line);
}
.feed li:last-child { border-bottom: none; }
.feed-when { margin-left: auto; font-size: 0.78rem; white-space: nowrap; }
.feed-dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  align-self: center;
  background: var(--muted);
}
.feed-booking  { background: var(--blue); }
.feed-client   { background: var(--gold); }
.feed-pet      { background: var(--green); }
.feed-document { background: var(--purple); }
.feed-picture  { background: var(--teal); }
.feed-log      { background: var(--gold); }
.feed-medical  { background: var(--red); }
.feed-note     { background: var(--muted); }

/* ---- tables ------------------------------------------------------------ */

.table-card { padding: 0; overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

th, td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
td { white-space: normal; }

thead th {
  background: #fafbfc;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  /* sticky resolves against .table-card (overflow-x creates the scroll
     container), so anything > 0 shifts the header over the first row */
  position: sticky;
  top: 0;
}

tbody tr:hover { background: #f6f8f9; }
tbody tr:last-child td { border-bottom: none; }
td.empty { text-align: center; padding: 28px; }

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  background: #eceff1;
  color: #4b5157;
}
.badge-confirmed   { background: #e2ecfb; color: #29538f; }
.badge-checked_in  { background: #e5f4e9; color: #22633a; }
.badge-checked_out { background: #eceff1; color: #4b5157; }
.badge-requested   { background: #fdf3dd; color: #8a6516; }
.badge-cancelled   { background: #fbe9e9; color: #8f2f2f; }

/* ---- forms -------------------------------------------------------------- */

.stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 360px;
}

label { font-size: 0.9rem; font-weight: 600; }

input, select, textarea {
  display: block;
  width: 100%;
  margin-top: 5px;
  padding: 9px 11px;
  font: inherit;
  font-weight: 400;
  color: inherit;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(18, 120, 122, 0.15);
}

/* Pet search results in the calendar's new-booking modal. */
.pet-results {
  max-height: 160px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}
.pet-results .muted { padding: 9px 11px; margin: 0; }
.pet-hit {
  display: block;
  padding: 7px 11px;
  font-weight: 400;
  cursor: pointer;
}
.pet-hit:hover { background: var(--bg); }
.pet-hit input { display: inline-block; width: auto; margin: 0 6px 0 0; }

.btn-primary {
  align-self: flex-start;
  padding: 9px 18px;
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--teal);
  border: none;
  border-radius: 6px;
  cursor: pointer;
}
.btn-primary:hover { background: var(--teal-dark); }

.btn-blue {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  padding: 9px 18px;
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--blue);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
}
.btn-blue:hover { background: #2f68ba; }

.btn-gold {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  padding: 9px 18px;
  font: inherit;
  font-weight: 600;
  color: #4a3200;
  background: var(--gold);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
}
.btn-gold:hover { background: #b5872a; }

.btn-sm { padding: 6px 12px; font-size: 0.85rem; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--teal);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}
.btn-ghost:hover { border-color: var(--teal); background: #f4fafa; }
.btn-ghost.btn-sm { padding: 4px 10px; font-size: 0.8rem; }

/* label-as-button file pickers; the input still works without JS */
.file-form { display: inline-block; }
.file-form input[type="file"] { display: none; }

/* destructive actions (admin only) */
.btn-danger {
  display: inline-flex;
  align-items: center;
  padding: 7px 13px;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--red);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}
.btn-danger:hover { border-color: var(--red); background: #fdf3f3; }
.btn-danger.btn-sm { padding: 4px 10px; font-size: 0.8rem; }

/* tiny per-row delete cross */
.btn-x {
  all: unset;
  cursor: pointer;
  width: 20px;
  height: 20px;
  border-radius: 5px;
  text-align: center;
  line-height: 20px;
  font-size: 0.95rem;
  color: var(--muted);
}
.btn-x:hover { color: #fff; background: var(--red); }
.cell-x { width: 28px; text-align: right; }

/* header action cluster (photo / archive / delete) */
.head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.head-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

/* ---- archived (soft-deleted) entries: grayed out with a red tint ------- */

.badge-archived { background: #f2e6e6; color: #96625f; }
.badge-new      { background: #fdf3dd; color: #8a6516; } /* first-booking discount */

/* second page section (API tokens under the users table) */
.page-head-follow { margin-top: 28px; }
.token-notice code { user-select: all; word-break: break-all; }
.pill-archived  { background: #f2e6e6; color: #96625f; border-color: #e2caca; }

tr.row-archived td { color: #a29191; background: #fbf7f7; }
tr.row-archived:hover { background: #f7f0f0; }
tr.row-archived .dir-name-text,
tr.row-archived .owner-link,
tr.row-archived a { color: #a29191; }
tr.row-archived .avatar, tr.row-archived img.avatar { opacity: 0.55; filter: grayscale(0.6); }
tr.row-archived .badge:not(.badge-archived) { opacity: 0.6; }

/* ---- clients directory ---------------------------------------------------- */

.push-right { margin-left: auto; }

.popover { position: relative; }
.popover summary {
  list-style: none;
  display: inline-block;
  user-select: none;
}
.popover summary::-webkit-details-marker { display: none; }
.popover-body {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 20;
  width: 280px;
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
}
.popover-body.stack { max-width: none; }

.toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.search-form { flex: 1 1 260px; max-width: 380px; }
.search-input { margin-top: 0; }

.chips { display: flex; gap: 6px; }
.chip {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.chip:hover { border-color: var(--teal); }
.chip-active { background: var(--teal); border-color: var(--teal); color: #fff; }

.avatar-sm { width: 28px; height: 28px; font-size: 0.7rem; }
.avatar-md { width: 44px; height: 44px; font-size: 0.9rem; border-radius: 10px; }
.avatar-lg { width: 64px; height: 64px; font-size: 1.3rem; }
img.avatar { object-fit: cover; flex: none; }
.avatar-init { background: var(--teal); flex: none; }
.avatar-pet { background: #e08b3c; }

.dir-name a {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}
.dir-name a:hover .dir-name-text { color: var(--teal); text-decoration: underline; }

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-top: 16px;
}
.pager-btn {
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--card);
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
}
.pager-btn:hover { border-color: var(--teal); color: var(--teal); }
.pager-off { opacity: 0.4; pointer-events: none; }

/* ---- client detail ---------------------------------------------------------- */

.crumbs { margin-bottom: 14px; font-size: 0.9rem; }
.crumbs a { color: var(--teal); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.crumb-sep { margin: 0 8px; color: var(--muted); }

.client-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.client-id { display: flex; align-items: center; gap: 16px; }
.client-id h1 { margin: 0 0 2px; font-size: 1.4rem; }

.client-grid {
  display: grid;
  grid-template-columns: minmax(300px, 360px) 1fr;
  gap: 16px;
  align-items: start;
}
.client-panels {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.stack-wide { max-width: none; }
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.section-head h2 { margin: 0; }

.pet-list { list-style: none; margin: 0; padding: 0; }
.pet-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.pet-list li:first-child { padding-top: 0; }
.pet-item:last-of-type { border-bottom: none; }
.pet-info { flex: 1; min-width: 0; }
.pet-sub { font-size: 0.85rem; }
.pet-notes { font-size: 0.85rem; margin-top: 2px; }

.inline-form { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 10px; }
.inline-form summary {
  cursor: pointer;
  list-style: none;
  color: var(--teal);
  font-weight: 600;
  font-size: 0.9rem;
  user-select: none;
}
.inline-form summary::-webkit-details-marker { display: none; }
.inline-form summary:hover { text-decoration: underline; }

.add-pet-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}
.add-pet-form .span-2 { grid-column: span 2; }
.add-pet-form button { grid-column: span 2; justify-self: start; }

.doc-table td { padding: 8px 10px; }
.doc-table td:first-child { padding-left: 0; }
.doc-table a { color: var(--teal); }

.log-form { margin-bottom: 14px; }
.log-form textarea { margin-bottom: 8px; }

.log-list { list-style: none; margin: 0; padding: 0; }
.log-list li {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.log-list li:last-child { border-bottom: none; }
.log-list p { margin: 4px 0 0; white-space: pre-line; }
.log-meta { display: flex; gap: 10px; align-items: baseline; font-size: 0.85rem; }

/* ---- pet detail --------------------------------------------------------------- */

.pet-link { color: var(--ink); text-decoration: none; }
.pet-link:hover strong { color: var(--teal); text-decoration: underline; }
.owner-link { color: var(--teal); text-decoration: none; }
.owner-link:hover { text-decoration: underline; }

.client-id h1 .badge { vertical-align: middle; margin-left: 4px; }

/* status pills: boarding + medical state, prominent in the header */
.status-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid transparent;
}
.pill-inhouse  { background: #e5f4e9; color: #22633a; border-color: #bfe3ca; }
.pill-arriving { background: #e2ecfb; color: #29538f; border-color: #c3d7f3; }
.pill-ok       { background: #e5f4e9; color: #22633a; border-color: #bfe3ca; }
.pill-due      { background: #fdf3dd; color: #8a6516; border-color: #f0dfb2; }

.badge-inhouse  { background: #e5f4e9; color: #22633a; }
.badge-arriving { background: #e2ecfb; color: #29538f; }

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.tab {
  padding: 8px 16px 10px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab:hover { color: var(--ink); }
.tab-active { color: var(--ink); border-bottom-color: var(--teal); }

.check-label {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-weight: 400;
}
.check-label input[type="checkbox"] {
  display: inline;
  width: auto;
  margin: 0;
}

.portrait-form { margin-top: 14px; }

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}
.gallery-item {
  position: relative;
  display: block;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  aspect-ratio: 4 / 3;
  background: #f3f5f6;
}
.gallery-item > a { display: block; width: 100%; height: 100%; }
.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.gallery-del {
  position: absolute;
  top: 6px;
  right: 6px;
  opacity: 0;
  transition: opacity 120ms ease-in;
}
.gallery-item:hover .gallery-del, .gallery-del:focus-within { opacity: 1; }
.gallery-del .btn-x { background: rgba(255, 255, 255, 0.9); color: var(--ink); }
.gallery-del .btn-x:hover { background: var(--red); color: #fff; }
.gallery-date {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 10px 8px 6px;
  font-size: 0.72rem;
  color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.55));
  opacity: 0;
  transition: opacity 120ms ease-in;
}
.gallery-item:hover .gallery-date { opacity: 1; }

.doc-table thead th { position: static; background: transparent; padding: 6px 10px; }
.doc-table thead th:first-child { padding-left: 0; }

/* ---- facilities (locations & rooms) ------------------------------------- */

.avatar-loc  { background: #4a7fd4; }
.avatar-room { background: #2e9a9d; }

/* housekeeping condition */
.badge-clean      { background: #e5f4e9; color: #22633a; }
.badge-dirty      { background: #fdf3dd; color: #8a6516; }
.badge-renovating { background: #ece5f6; color: #5b3f87; }
.badge-closed     { background: #fbe9e9; color: #8f2f2f; }

/* occupancy, derived from checked-in bookings */
.badge-occupied { background: #e2ecfb; color: #29538f; }
.badge-free     { background: #eceff1; color: #4b5157; }

.pill-clean      { background: #e5f4e9; color: #22633a; border-color: #bfe3ca; }
.pill-dirty      { background: #fdf3dd; color: #8a6516; border-color: #f0dfb2; }
.pill-renovating { background: #ece5f6; color: #5b3f87; border-color: #d8cbec; }
.pill-closed     { background: #fbe9e9; color: #8f2f2f; border-color: #eec7c7; }
.pill-free       { background: #eceff1; color: #4b5157; border-color: #d8dde1; }

/* ---- booking calendar ---------------------------------------------------- */

.cal-loc-form { display: flex; align-items: center; gap: 8px; }
.cal-loc-form select { margin-top: 0; width: auto; padding: 7px 32px 7px 10px; font-weight: 600; }

.cal-nav { display: flex; align-items: center; gap: 8px; }
.cal-nav a.btn-blue,
.cal-nav summary.btn-gold {
  line-height: 1;
  box-sizing: border-box;
}
.cal-nav .popover { display: flex; align-items: center; }

.cal-card { padding: 0; overflow: hidden; }
.cal-scroll { overflow-x: auto; }

.cal-row {
  display: flex;
  width: max-content;
  min-width: 100%;
  border-bottom: 1px solid var(--line);
}
.cal-row:last-child { border-bottom: none; }

/* left column: sticks while the days scroll underneath */
.cal-side {
  position: sticky;
  left: 0;
  z-index: 3;
  flex: none;
  width: 210px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  background: var(--card);
  border-right: 1px solid var(--line);
}
.cal-side-label { font-size: 0.8rem; font-weight: 600; }

.cal-track {
  position: relative;
  display: grid;
  grid-template-columns: repeat(42, 36px);
  grid-template-rows: repeat(var(--lanes, 1), 34px);
}

.cal-cell { grid-row: 1 / -1; border-right: 1px solid #eef1f3; }
.cal-cell.is-weekend { background: #f4f6f8; }
.cal-cell.is-today   { background: #e7f3f3; }
/* room cells are links that start a booking on that day */
a.cal-cell { display: block; }
a.cal-cell:hover { background: #dcebee; cursor: copy; }

/* day header */
.cal-head-row { background: #fafbfc; }
.cal-head-row .cal-side { background: #fafbfc; }
.cal-track-head { grid-template-rows: 52px; }
.cal-headcell {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 5px;
  border-right: 1px solid #eef1f3;
}
.cal-headcell.is-weekend { background: #f4f6f8; }
.cal-month {
  position: absolute;
  top: 3px;
  left: 3px;
  z-index: 2;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--teal);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  white-space: nowrap;
}
.cal-wd { font-size: 0.64rem; color: var(--muted); text-transform: uppercase; }
.cal-num { font-size: 0.92rem; font-weight: 600; line-height: 1.3; }
.cal-headcell.is-today .cal-num {
  background: var(--teal);
  color: #fff;
  border-radius: 999px;
  min-width: 22px;
  text-align: center;
}

/* type group separators */
.cal-group-row { background: #fafbfc; }
.cal-group-row .cal-side { background: #fafbfc; }
.cal-track-group { grid-template-rows: 26px; }
.cal-group-row .cal-cell { border-right-color: transparent; background: transparent; }

/* footer row, plus an empty light strip below it that hosts the
   horizontal scrollbar so it cuts through nothing */
.cal-foot-row { border-top: 1px solid var(--line); }
.cal-foot-row .cal-side { background: #fafbfc; }
.cal-track-foot { grid-template-rows: 24px; }
.cal-footcell {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  color: var(--muted);
  background: #fafbfc;
}
.cal-scrollpad .cal-side { background: #f1f3f5; }
.cal-track-scrollpad { grid-template-rows: 16px; background: #f1f3f5; }
.cal-group-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

/* room label */
.cal-room {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex: 1;
  min-width: 0;
  color: var(--ink);
  text-decoration: none;
}
.cal-roomno { min-width: 30px; font-weight: 700; font-variant-numeric: tabular-nums; }
.cal-roomname {
  font-size: 0.82rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cal-room:hover .cal-roomno, .cal-room:hover .cal-roomname { color: var(--teal); }
.cal-dots { display: flex; gap: 4px; flex: none; }

/* status dots (room condition + occupancy) */
.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #cfd5d9;
  vertical-align: middle;
}
.dot-clean      { background: var(--green); }
.dot-dirty      { background: var(--gold); }
.dot-renovating { background: var(--purple); }
.dot-closed     { background: var(--red); }
.dot-occupied   { background: var(--blue); }

/* booking / note bars */
.cal-bar {
  z-index: 2;
  display: block;
  margin: 3px 2px;
  padding: 0 8px;
  border-radius: 6px;
  line-height: 28px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #fff;
  text-decoration: none;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
a.cal-bar:hover { filter: brightness(1.1); }
.bar-requested   { background: var(--gold); }
.bar-confirmed   { background: var(--blue); }
.bar-checked_in  { background: var(--green); }
.bar-checked_out { background: #9aa2a9; }
.bar-note        { background: #fdeaa7; color: #6b4f0a; border: 1px solid #e8cf76; }
.cal-bar.clip-l { margin-left: 0; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.cal-bar.clip-r { margin-right: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; }

.cal-bar { position: relative; }

/* note bars: a details/summary popover revealing the full text + admin
   delete. The bar itself must not clip (overflow: visible) or the
   absolutely-positioned card would be cut to the 28px lane; the summary
   takes over the label truncation instead. Open bars rise above later
   booking bars (z 2) and the sticky room column (z 3). */
.cal-bar.bar-note { padding: 0; overflow: visible; }
.cal-bar.bar-note[open] { z-index: 30; }
.cal-bar.bar-note > summary {
  display: block;
  height: 100%;
  padding: 0 8px;
  line-height: 28px;
  list-style: none;
  cursor: pointer;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.cal-bar.bar-note > summary::-webkit-details-marker { display: none; }
.bar-note-card {
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  z-index: 20;
  min-width: 220px;
  padding: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 400;
  line-height: 1.4;
  white-space: normal;
}
.bar-note-card h4 { margin: 0 0 6px; font-size: 0.92rem; }
.bar-note-range { color: var(--muted); margin: 0 0 10px; }
.bar-note-card form { margin: 0; }

.cal-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 10px;
  font-size: 0.8rem;
}
.cal-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.cal-legend .dot { width: 10px; height: 10px; }

/* ---- profile ------------------------------------------------------------ */

.profile-card { max-width: 520px; margin-bottom: 16px; }

.kv {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 8px 12px;
  margin: 0;
}
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* ---- auth pages ----------------------------------------------------------- */

.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  {{/* background: linear-gradient(160deg, #34393e, #12787a); */}}
  background-image: url("/static/img/bg-cat.webp");
  background-size: cover;
}

.auth-card {
  background: var(--card);
  border-radius: 12px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  padding: 32px 36px;
  width: min(420px, calc(100vw - 32px));
}
.auth-card h1 { margin-top: 0; font-size: 1.3rem; }
.auth-card .stack { max-width: none; }
.auth-card .btn-primary { align-self: stretch; }

.auth-brand {
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--teal);
  margin-bottom: 10px;
}

/* ---- files area (documents directory & pictures gallery) -------------------- */

.filter-form {
  display: flex;
  gap: 8px;
  align-items: center;
  max-width: none;
}
.filter-form .search-input { flex: 1 1 220px; max-width: 320px; }
.filter-form select { margin: 0; width: auto; padding: 8px 28px 8px 10px; }

/* doc-type select next to the upload button on client/pet pages */
.doc-upload { display: inline-flex; gap: 8px; align-items: center; }
.doc-upload select { margin: 0; width: auto; padding: 6px 24px 6px 8px; font-size: 0.85rem; }

/* always-visible caption on the /pictures gallery tiles */
.gallery-cap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  padding: 16px 8px 6px;
  font-size: 0.75rem;
  color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.65));
  pointer-events: none; /* clicks fall through to the image link ... */
}
.gallery-cap a {
  pointer-events: auto; /* ... except on the subject link itself */
  color: #fff;
  font-weight: 600;
  text-decoration: none;
}
.gallery-cap a:hover { text-decoration: underline; }
.gallery-cap-date { opacity: 0.8; white-space: nowrap; }

/* favorite heart, top-left corner of gallery tiles */
.fav-form {
  position: absolute;
  top: 6px;
  left: 6px;
  opacity: 0;
  transition: opacity 120ms ease-in;
}
.gallery-item:hover .fav-form, .fav-form:focus-within, .fav-form.is-fav { opacity: 1; }
.fav-btn {
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.9);
  color: #b8bfc6;
}
.fav-btn:hover { color: var(--red); }
.fav-form.is-fav .fav-btn { color: var(--red); }

/* profile-picture star, right of the heart (pet pictures only) */
.pin-form {
  position: absolute;
  top: 6px;
  left: 34px;
  opacity: 0;
  transition: opacity 120ms ease-in;
}
.gallery-item:hover .pin-form, .pin-form:focus-within, .pin-form.is-pin { opacity: 1; }
.pin-form .fav-btn:hover { color: var(--gold); }
.pin-form.is-pin .fav-btn { color: var(--gold); }

/* ---- modal dialogs ---------------------------------------------------------- */

dialog.modal {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
  padding: 18px;
  width: min(440px, calc(100vw - 32px));
}
dialog.modal h2 { margin-top: 0; }
dialog::backdrop { background: rgba(45, 50, 55, 0.45); }

/* narrow standalone form pages (new booking, event editor) */
.form-card { max-width: 520px; }
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

/* image lightbox, created by app.js on demand */
#lightbox {
  border: none;
  background: transparent;
  padding: 0;
  max-width: 92vw;
  max-height: 92vh;
}
#lightbox img {
  display: block;
  max-width: 92vw;
  max-height: 92vh;
  border-radius: var(--radius);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
  cursor: zoom-out;
}
#lightbox::backdrop { background: rgba(20, 22, 24, 0.78); }

/* ---- htmx progress ---------------------------------------------------------- */

.htmx-request { opacity: 0.6; transition: opacity 120ms ease-in; }

/* ---- small screens ------------------------------------------------------------ */

@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { border-right: none; border-bottom: 1px solid var(--line); }
  .tiles-wide { grid-template-columns: 1fr; }
  .user-name { display: none; }
  .client-grid { grid-template-columns: 1fr; }
  .add-pet-form { grid-template-columns: 1fr; }
  .add-pet-form .span-2, .add-pet-form button { grid-column: auto; }
}
