:root {
  --green: #2f5d50; --green-dk: #23473d; --green-lt: #e3efe9; --cream: #faf7f0; --brown: #6b4f3a; --gold: #c9a35b;
  --ink: #1f2a26; --muted: #66736e; --line: #e4e0d6; --card: #ffffff; --err: #a33a2e; --err-bg: #fbeae7; --ok-bg: #e6f3ea;
  --radius: 14px; --side: 240px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif; background: var(--cream); color: var(--ink); line-height: 1.5; font-size: 16px; }
a { color: var(--green); }
h1 { font-family: Georgia, "Times New Roman", serif; font-weight: 500; font-size: 1.9rem; margin: 0 0 .6rem; color: var(--green-dk); }
h2 { font-family: Georgia, serif; font-weight: 500; font-size: 1.3rem; margin: 1.6rem 0 .6rem; color: var(--green-dk); }
h3 { font-size: 1.05rem; margin: 1rem 0 .4rem; }
p { margin: .4rem 0 .8rem; }
small, .muted { color: var(--muted); }
.lead { color: var(--muted); margin-top: -.2rem; }

body.app main { margin-left: var(--side); padding: 28px 36px 60px; max-width: 1100px; }
body.app main.wide { max-width: 1400px; }
body.guest main { max-width: 440px; margin: 8vh auto; padding: 0 16px; }

.side { position: fixed; inset: 0 auto 0 0; width: var(--side); background: var(--green-dk); color: #e8efe9; display: flex; flex-direction: column; padding: 22px 14px; }
.brand { display: flex; gap: 10px; align-items: center; color: #fff; text-decoration: none; padding: 4px 8px 18px; }
.brand .leaf { font-size: 1.5rem; color: var(--gold); }
.brand b { display: block; font-family: Georgia, serif; font-weight: 500; font-size: 1.05rem; line-height: 1.1; }
.brand small { display: block; opacity: .75; font-size: .78rem; }
.side nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav { color: #d7e3dc; text-decoration: none; padding: 9px 10px; border-radius: 9px; display: flex; gap: 10px; align-items: center; font-size: .95rem; }
.nav .ic { width: 20px; text-align: center; opacity: .8; }
.nav:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav.active { background: rgba(255,255,255,.14); color: #fff; }
.who { border-top: 1px solid rgba(255,255,255,.15); padding-top: 12px; font-size: .88rem; }
.who-name { font-weight: 600; color: #fff; }
.who-role { opacity: .7; margin-bottom: 6px; }
button.link { background: none; border: none; color: var(--gold); cursor: pointer; padding: 0; font-size: .88rem; }
.menu-btn { display: none; position: fixed; top: 10px; left: 10px; z-index: 20; background: var(--green-dk); color: #fff; border: none; border-radius: 8px; width: 40px; height: 40px; font-size: 1.2rem; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; margin: 0 0 16px; }
.card.soft { background: var(--green-lt); border-color: transparent; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.grid .card { margin: 0; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.stat { font-size: 1.7rem; font-family: Georgia, serif; color: var(--green-dk); }
.stat-label { color: var(--muted); font-size: .85rem; }

.btn { display: inline-block; background: var(--green); color: #fff; border: none; border-radius: 999px; padding: 10px 18px; font-size: .95rem; cursor: pointer; text-decoration: none; font-family: inherit; }
.btn:hover { background: var(--green-dk); }
.btn.secondary { background: #fff; color: var(--green-dk); border: 1px solid var(--green); }
.btn.gold { background: var(--gold); color: #2b2416; }
.btn.danger { background: #fff; color: var(--err); border: 1px solid var(--err); }
.btn.sm { padding: 6px 12px; font-size: .85rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

form.stack { display: flex; flex-direction: column; gap: 12px; }
label { display: block; font-size: .9rem; font-weight: 600; margin-bottom: 4px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], input[type=url], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 1rem; font-family: inherit; background: #fff; }
textarea { min-height: 110px; resize: vertical; }
input[type=file] { font-size: .95rem; }
.inline-form { display: inline; }
.help { font-size: .85rem; color: var(--muted); margin-top: 4px; }

table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; }
tr:last-child td { border-bottom: none; }

.pill { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: .78rem; font-weight: 600; background: var(--green-lt); color: var(--green-dk); }
.pill.warn { background: #fdf1dc; color: #8a5a0b; }
.pill.bad { background: var(--err-bg); color: var(--err); }
.pill.gray { background: #eeece6; color: #555; }
.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; }
.flash.ok { background: var(--ok-bg); color: var(--green-dk); }
.flash.err { background: var(--err-bg); color: var(--err); }
.demo-banner { background: #fff6dc; border: 1px dashed var(--gold); color: #6b4f1a; padding: 8px 14px; border-radius: 10px; font-size: .85rem; margin-bottom: 16px; }

/* Chat */
.chat { display: flex; flex-direction: column; height: calc(100vh - 220px); min-height: 420px; }
.chat-log { flex: 1; overflow-y: auto; padding: 8px 4px; display: flex; flex-direction: column; gap: 10px; }
.bubble { max-width: 78%; padding: 12px 16px; border-radius: 18px; line-height: 1.45; }
.bubble.user { align-self: flex-end; background: var(--green); color: #fff; border-bottom-right-radius: 4px; }
.bubble.assistant { align-self: flex-start; background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.bubble p:first-child { margin-top: 0; } .bubble p:last-child { margin-bottom: 0; }
.chat-form { display: flex; gap: 8px; padding-top: 10px; }
.chat-form input { flex: 1; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 10px; }
.chip { background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font-size: .85rem; cursor: pointer; font-family: inherit; }
.chip:hover { border-color: var(--green); }

/* Messaging */
.thread { display: flex; flex-direction: column; gap: 10px; max-height: 55vh; overflow-y: auto; padding: 4px; }
.msg { max-width: 80%; padding: 10px 14px; border-radius: 14px; background: #fff; border: 1px solid var(--line); }
.msg.mine { align-self: flex-end; background: var(--green-lt); border-color: transparent; }
.msg .meta { font-size: .75rem; color: var(--muted); margin-bottom: 2px; }

/* Booking slots */
.slots { display: flex; flex-wrap: wrap; gap: 8px; }
.slot { border: 1px solid var(--green); color: var(--green-dk); background: #fff; border-radius: 10px; padding: 8px 12px; cursor: pointer; font-family: inherit; }
.slot:hover, .slot.sel { background: var(--green); color: #fff; }
.service { cursor: pointer; border: 2px solid transparent; }
.service.sel, .service:hover { border-color: var(--green); }
.resource-cat { margin-top: 24px; }
.foot { margin-top: 40px; font-size: .78rem; color: var(--muted); border-top: 1px solid var(--line); padding-top: 12px; }
.prose img { max-width: 100%; }
.video-wrap { position: relative; padding-top: 56.25%; border-radius: 12px; overflow: hidden; background: #000; }
.video-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.login-logo { text-align: center; margin-bottom: 18px; }
.login-logo .leaf { font-size: 2.4rem; color: var(--gold); }
.login-logo h1 { margin: 0; }
details summary { cursor: pointer; font-weight: 600; }

@media (max-width: 860px) {
  body.app main { margin-left: 0; padding: 64px 16px 40px; }
  .side { transform: translateX(-100%); transition: transform .2s; z-index: 10; }
  body.nav-open .side { transform: none; }
  .menu-btn { display: block; }
  .bubble, .msg { max-width: 92%; }
  th, td { padding: 8px 4px; font-size: .88rem; }
}

/* Phone layout for tables (see public/app.js): stacked rows with labels; headerless tables scroll sideways. */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
@media (max-width: 640px) {
  table.stack thead { display: none; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack tr { border-bottom: 1px solid var(--line); padding: 8px 0; }
  table.stack tr:last-child { border-bottom: none; }
  table.stack td { border-bottom: none; padding: 4px 0; overflow-wrap: anywhere; }
  table.stack td[data-label] { display: grid; grid-template-columns: 92px 1fr; gap: 8px; align-items: baseline; }
  table.stack td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
  table.stack td[data-label=""] { display: block; }
  table.stack td[data-label] > .pill, table.stack td[data-label] > .btn { justify-self: start; }
  table.stack td:empty { display: none; }
  table.stack td form.row { flex-wrap: wrap; }
}
.msg .chart-act { margin-top: 6px; text-align: right; }
.msg .chart-act .btn.sm { padding: 3px 10px; font-size: .75rem; }
