/* Brindlecove Health: one stylesheet for the public site and the admin. */
:root {
  --sand: #f6efe4;
  --sand-mid: #efe4d2;
  --sand-dark: #d9c3a0;
  --teal: #2f6f6a;
  --teal-dark: #1f4f4b;
  --deep: #183b3a;
  --ink: #1d2726;
  --muted: #5f6b6a;
  --line: #e2d8c7;
  --white: #fff;
  --red: #b3412f;
  --amber: #a86b12;
  --green: #2e7d4f;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(24, 59, 58, .06), 0 4px 16px rgba(24, 59, 58, .06);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  line-height: 1.5;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--sand); overflow-x: hidden; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--teal); }
a:hover { color: var(--teal-dark); }
h1, h2, h3 { line-height: 1.2; color: var(--deep); margin: 0 0 .5em; }
h1 { font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.4rem); }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; }
.wrap { width: 100%; max-width: 1160px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 760px; }
.section { padding: 56px 16px; }
.wrap.section { padding-left: 16px; padding-right: 16px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4em; padding: .7em 1.2em; border-radius: 999px; border: 1px solid var(--teal); background: var(--teal); color: var(--white); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--teal-dark); border-color: var(--teal-dark); color: var(--white); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn--ghost { background: transparent; color: var(--teal); }
.btn--ghost:hover { background: var(--teal); color: var(--white); }
.btn--light { background: var(--white); border-color: var(--white); color: var(--deep); }
.btn--light:hover { background: var(--sand); border-color: var(--sand); color: var(--deep); }
.btn--danger { background: var(--red); border-color: var(--red); }
.btn--danger:hover { background: #8f3324; border-color: #8f3324; }
.btn--sm { padding: .4em .9em; font-size: .9rem; }

/* Logo */
.logo { display: inline-flex; align-items: center; gap: .5em; font-weight: 700; color: var(--deep); text-decoration: none; font-size: 1.1rem; }
.logo--light { color: var(--white); }
.logo--light:hover { color: var(--white); }
.logo__mark { flex: none; }

/* Public header/footer */
.site-header { background: var(--white); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.site-header__inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
.site-nav { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.site-nav { margin-left: auto; }
.site-nav a:not(.btn) { color: var(--ink); text-decoration: none; font-weight: 500; }
.site-nav a:not(.btn):hover { color: var(--teal); }
.site-footer { background: var(--deep); color: #cfe0dd; padding: 40px 0; }
.site-footer__inner { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.site-footer .muted { color: #a9c3bf; margin-top: .6em; }
.site-footer nav { display: flex; gap: 18px; flex-wrap: wrap; align-items: flex-start; }
.site-footer nav a { color: #e6f0ee; text-decoration: none; }
.site-footer nav a:hover { text-decoration: underline; }

/* Hero */
.hero { position: relative; min-height: min(78vh, 640px); display: flex; align-items: flex-end; overflow: hidden; }
.hero picture, .hero__img { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero__img { object-fit: cover; object-position: 30% center; }
.hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(24, 59, 58, .55) 0%, rgba(24, 59, 58, 0) 60%), linear-gradient(180deg, rgba(24, 59, 58, 0) 30%, rgba(24, 59, 58, .8) 100%); }
.hero__content { position: relative; z-index: 1; padding-top: 48px; padding-bottom: 48px; color: var(--white); }
.hero h1, .hero p { text-shadow: 0 1px 12px rgba(0, 0, 0, .25); }
.hero h1 { color: var(--white); font-size: clamp(2rem, 1.4rem + 3vw, 3.4rem); max-width: 14ch; }
.hero p { font-size: 1.15rem; max-width: 34ch; }
.hero__actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* Cards & sections */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 20px; min-width: 0; }
.services { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.service { margin: 0; border-top: 4px solid var(--teal); }
.service p { margin: 0; color: var(--muted); }
.stats { background: var(--teal); color: var(--white); padding: 36px 0; }
.stats__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; text-align: center; }
.stats strong { display: block; font-size: 2.2rem; line-height: 1.1; }
.stats span { color: #d6e8e5; }
.depts { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.dept { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.dept p { margin: 0 0 .4em; color: var(--muted); font-size: .95rem; }
.dept__meta { font-size: .85rem !important; color: var(--teal) !important; font-weight: 600; margin: 0 !important; }
.split { display: grid; grid-template-columns: 1.2fr 1fr; gap: 32px; align-items: center; }
.split__img { border-radius: var(--radius); box-shadow: var(--shadow); }
.contact-list { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 20px; }
.contact-list dt { font-weight: 600; color: var(--deep); }
.contact-list dd { margin: 0; overflow-wrap: anywhere; }

/* Forms */
.form { display: grid; gap: 14px; }
.field { display: grid; gap: 4px; font-weight: 600; color: var(--deep); font-size: .95rem; min-width: 0; }
.field input, .field select, .field textarea, .filters input, .filters select {
  font: inherit; font-weight: 400; color: var(--ink); background: var(--white); border: 1px solid #cdbfa8; border-radius: 8px; padding: .6em .7em; width: 100%; min-width: 0;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--teal); outline-offset: 1px; border-color: var(--teal); }
.field__error { color: var(--red); font-weight: 500; }
.has-error input, .has-error select { border-color: var(--red); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.file-list { margin: 0; padding-left: 1.2em; color: var(--muted); }
.file-list:empty { display: none; }
.alert { padding: 10px 14px; border-radius: 8px; margin: 0 0 12px; border: 1px solid; }
.alert--error { background: #fbeae6; border-color: #e7b4a9; color: #7d2a1d; }
.alert--ok { background: #e6f4ec; border-color: #a9d6bb; color: #1f5a37; }
.alert--info { background: #e8f1f0; border-color: #b6d2ce; color: var(--deep); }
.login { max-width: 440px; }

/* Admin layout */
.admin { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--deep); color: #d9e7e5; padding: 20px 14px; display: flex; flex-direction: column; gap: 20px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar nav { display: grid; gap: 2px; }
.sidebar nav a { color: #d9e7e5; text-decoration: none; padding: 8px 10px; border-radius: 8px; }
.sidebar nav a:hover { background: rgba(255, 255, 255, .08); color: var(--white); }
.sidebar nav a.active { background: var(--teal); color: var(--white); }
.sidebar__foot { margin-top: auto; display: grid; gap: 8px; overflow-wrap: anywhere; }
.sidebar .btn--ghost { color: #d9e7e5; border-color: #5d807c; }
.admin-main { padding: 24px; min-width: 0; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { font-size: 1.6rem; margin: 0; }
.page-head p { margin: 4px 0 0; }
.count { font-size: .9rem; color: var(--muted); font-weight: 500; background: var(--sand-mid); border-radius: 999px; padding: 2px 10px; vertical-align: middle; }
.actions { display: flex; gap: 8px; align-items: center; }
.inline { display: inline; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 20px; }
.kpi { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); display: grid; gap: 2px; }
.kpi:hover { border-color: var(--teal); color: var(--ink); }
.kpi span { color: var(--muted); font-size: .9rem; }
.kpi strong { font-size: 1.7rem; color: var(--deep); }
.kpi small { color: var(--muted); }
.chart { position: relative; height: 260px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.filters input { flex: 1 1 220px; width: auto; }
.filters select { width: auto; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; background: var(--white); font-size: .93rem; }
.table th, .table td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #fbf8f2; }
.table .num { text-align: right; white-space: nowrap; }
.table tr:hover td { background: #fcfaf6; }
.card > .table-wrap { margin: 0 -20px -20px; }
.card > .table-wrap .table { border-radius: 0 0 var(--radius) var(--radius); }
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.message-body { white-space: pre-wrap; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.occupancy { display: grid; gap: 6px; }
.occ { display: grid; grid-template-columns: 150px minmax(0, 1fr) 56px; gap: 10px; align-items: center; font-size: .9rem; }
.occ progress { width: 100%; height: 10px; appearance: none; border: 0; border-radius: 99px; background: var(--sand-mid); overflow: hidden; }
.occ progress::-webkit-progress-bar { background: var(--sand-mid); }
.occ progress::-webkit-progress-value { background: var(--teal); }
.occ progress::-moz-progress-bar { background: var(--teal); }
.occ .num { text-align: right; }

/* Status badges */
.badge { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: .8rem; font-weight: 600; background: var(--sand-mid); color: var(--deep); white-space: nowrap; }
.badge--active, .badge--completed, .badge--paid, .badge--normal, .badge--available, .badge--read, .badge--discharged { background: #e3f1e8; color: var(--green); }
.badge--scheduled, .badge--sent, .badge--admitted, .badge--occupied, .badge--unread { background: #e2eeec; color: var(--teal-dark); }
.badge--cancelled, .badge--void, .badge--inactive, .badge--draft, .badge--maintenance { background: #ece9e3; color: #6c6559; }
.badge--high, .badge--low, .badge--no_show, .badge--cleaning { background: #f8ecd6; color: var(--amber); }
.badge--critical, .badge--overdue { background: #f8e1dc; color: var(--red); }

@media (max-width: 900px) {
  .split { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .sidebar nav { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}
@media (max-width: 640px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .section { padding-top: 40px; padding-bottom: 40px; }
  .site-nav { gap: 16px; font-size: .95rem; order: 3; width: 100%; margin-left: 0; }
  .hero { min-height: 520px; }
  .occ { grid-template-columns: 110px minmax(0, 1fr) 48px; }
  .admin-main { padding: 16px; }
}
