:root {
  --bg: #f6f3ee; --card: #ffffff; --ink: #24312f; --muted: #6f7775; --line: #e6e1d8;
  --primary: #1f5f5b; --primary-2: #2c7a74; --primary-soft: #e3efed;
  --good: #2f7d4f; --bad: #b4443a; --warn: #a86a12; --warn-soft: #fbf1df; --bad-soft: #fbe9e7;
  --radius: 12px; --shadow: 0 1px 2px rgba(30, 40, 38, .06), 0 2px 8px rgba(30, 40, 38, .04);
  font-family: "Segoe UI", "Assistant", "Rubik", Arial, sans-serif;
  color: var(--ink); background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; font-size: 15px; line-height: 1.45; }
h1 { font-size: 24px; margin: 0; } h2 { font-size: 18px; margin: 0; } h3 { font-size: 15px; margin: 0 0 10px; color: var(--muted); font-weight: 600; } h4 { margin: 0 0 6px; }
a { color: var(--primary); text-decoration: none; }
.link { cursor: pointer; } .link:hover { text-decoration: underline; } .strong { font-weight: 600; }
.muted { color: var(--muted); } .hint { color: var(--muted); font-size: 13px; margin: 6px 0; }
.pos { color: var(--good); } .neg { color: var(--bad); }
.money { font-variant-numeric: tabular-nums; white-space: nowrap; direction: ltr; unicode-bidi: isolate; }
.spacer { flex: 1; } .nowrap { white-space: nowrap; } .pre { white-space: pre-wrap; }
.loading { padding: 60px; text-align: center; color: var(--muted); }

/* layout */
.topbar { display: flex; align-items: center; gap: 10px; padding: 10px 20px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--ink); }
.crumb { color: var(--muted); }
.me { color: var(--muted); font-size: 12px; direction: ltr; }
.tabs { display: flex; align-items: center; gap: 4px; padding: 0 20px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 53px; z-index: 4; overflow-x: auto; }
.tab { padding: 12px 14px; color: var(--muted); border-bottom: 3px solid transparent; white-space: nowrap; }
.tab.active { color: var(--primary); border-color: var(--primary); font-weight: 600; }
.page { max-width: 1280px; margin: 0 auto; padding: 20px; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.section-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card.inset { box-shadow: none; background: #fbfaf7; margin: 12px 0 0; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px 16px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.grid2 > .card, .grid3 > .card { margin-bottom: 0; }
.grid2 + .grid3, .grid3 + .card, .grid2 + .card { margin-top: 16px; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }

/* controls */
.btn { font: inherit; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 8px; padding: 7px 14px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.btn:hover { border-color: var(--primary-2); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-2); }
.btn.big { padding: 10px 18px; font-weight: 600; }
.btn.small { padding: 3px 9px; font-size: 13px; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.danger-ghost { color: var(--bad); }
.icon-btn { border: 0; background: transparent; cursor: pointer; color: var(--muted); font-size: 15px; padding: 4px 6px; border-radius: 6px; }
.icon-btn:hover { background: var(--bg); color: var(--ink); }
.in { font: inherit; border: 1px solid var(--line); border-radius: 7px; padding: 6px 8px; background: #fff; color: var(--ink); min-width: 0; width: 100%; }
.in:focus { outline: 2px solid var(--primary-soft); border-color: var(--primary-2); }
select.in { padding-inline-end: 4px; }
.money-in { direction: ltr; text-align: right; max-width: 120px; }
.num-in { max-width: 90px; }
.in.tiny { width: 52px; max-width: 52px; padding: 4px; text-align: center; }
.title-in { font-size: 17px; font-weight: 600; border-color: transparent; max-width: 320px; }
.title-in:hover { border-color: var(--line); }
.in.search { max-width: 240px; } .in.export { max-width: 170px; }
.section-head select.in, .page-head select.in { width: auto; }
.table.budget td:first-child .in { min-width: 160px; }
textarea.in { resize: vertical; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field-label { font-size: 13px; color: var(--muted); }
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.checks { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; align-items: center; }
.seg { display: flex; gap: 0; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; width: fit-content; margin-bottom: 12px; flex-wrap: wrap; }
.seg-btn { font: inherit; border: 0; background: #fff; padding: 8px 16px; cursor: pointer; color: var(--muted); }
.seg-btn.on { background: var(--primary); color: #fff; }
.inline-form { display: flex; gap: 6px; margin-top: 10px; }
.badge { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 99px; background: var(--primary-soft); color: var(--primary); white-space: nowrap; }
.badge.optional, .badge.planning { background: #eef0f6; color: #4d5a86; }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.full, .badge.done { background: #e4f2e9; color: var(--good); }
.badge.partial, .badge.open { background: var(--warn-soft); color: var(--warn); }
.badge.empty { background: #f0eeea; color: var(--muted); }

/* retreat cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.retreat-card { display: flex; flex-direction: column; gap: 10px; margin: 0; }
.retreat-card.archived { opacity: .6; }
.retreat-card .card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; cursor: pointer; }
.retreat-card h3 { color: var(--ink); font-size: 18px; margin: 0; }
.mini-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 0; cursor: pointer; }
.mini-kpis dt { font-size: 12px; color: var(--muted); } .mini-kpis dd { margin: 0; font-weight: 600; }
.target-line { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.card-actions { display: flex; gap: 6px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 10px; }
.progress { height: 8px; background: #ece8e0; border-radius: 99px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--primary); border-radius: 99px; }

/* overview */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.kpi.warn { border-color: #ecd3a8; background: var(--warn-soft); }
.kpi.good { border-color: #cfe5d7; }
.kpi-label { font-size: 13px; color: var(--muted); } .kpi-value { font-size: 22px; font-weight: 700; margin: 2px 0; } .kpi-sub { font-size: 12px; color: var(--muted); }
.room-dots { display: flex; flex-wrap: wrap; gap: 6px; }
.room-dot { border-radius: 8px; padding: 6px 8px; font-size: 12px; display: flex; flex-direction: column; min-width: 78px; border: 1px solid var(--line); }
.room-dot.full { background: #e4f2e9; } .room-dot.partial { background: var(--warn-soft); } .room-dot.empty { background: #f3f0eb; } .room-dot.optional { background: #fff; border-style: dashed; }
.room-dot.over { background: var(--bad-soft); border-color: var(--bad); }
.legend { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.pipeline { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.stage { text-align: center; border-radius: 8px; padding: 10px 4px; background: var(--bg); display: flex; flex-direction: column; }
.stage b { font-size: 22px; } .stage span { font-size: 12px; color: var(--muted); }
.stage.confirmed { background: #e4f2e9; } .stage.reserved { background: var(--primary-soft); } .stage.cancelled { background: var(--bad-soft); }
.alerts, .warnings, .list { list-style: none; padding: 0; margin: 0; }
.alerts li, .list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.alerts li.late { color: var(--bad); }
.warnings li { padding: 6px 10px; border-radius: 6px; margin-bottom: 4px; background: var(--warn-soft); }
.warnings li.error { background: var(--bad-soft); color: var(--bad); }

/* rooms */
.category { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 12px; }
.category-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.cat-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px 12px; }
.cat-fields .money-in, .cat-fields .num-in { max-width: none; }
.cat-notes { margin-top: 8px; }
.rooms-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; margin-top: 10px; }
.room { border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; background: #fcfbf8; font-size: 14px; }
.room.vacant { background: #fff; border-style: dashed; } .room.over { border-color: var(--bad); background: var(--bad-soft); }
.room-head { display: flex; justify-content: space-between; }
.room ul { margin: 6px 0; padding-inline-start: 18px; min-height: 18px; }
.room-foot { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); gap: 6px; }
.room-warn { font-size: 12px; color: var(--warn); margin-top: 4px; }

/* tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: right; font-size: 12px; color: var(--muted); font-weight: 600; padding: 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 5px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table.compact td { padding: 4px 6px; }
.table tr.cancelled td { opacity: .55; } .table tr.lead td, .table tr.waitlist td { background: #fbfaf7; }
.table tr.overdue td:first-child { box-shadow: inset -3px 0 0 var(--bad); }
.table tr.error td { background: var(--bad-soft); } .table tr.income td { background: #f4faf6; } .table tr.off td { opacity: .5; }
.table .tags { font-size: 12px; color: var(--muted); }
.table.budget .in { min-width: 90px; } .table.budget td.explain { font-size: 12px; color: var(--muted); max-width: 220px; }
.table.compare th[scope], .table.compare tbody th { color: var(--ink); }
.summary-bar { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.summary-bar .sum { display: flex; flex-direction: column; } .summary-bar .sum span { font-size: 12px; color: var(--muted); } .summary-bar .sum .money, .summary-bar .sum b { font-size: 18px; font-weight: 700; }
details.card > summary { cursor: pointer; list-style: none; } details.card > summary::-webkit-details-marker { display: none; }
h2.inline { display: inline; } details.card > summary::before { content: '▸ '; color: var(--muted); } details[open].card > summary::before { content: '▾ '; }

/* sims */
.grid-sims { display: grid; grid-template-columns: 220px 1fr; gap: 16px; align-items: start; }
.scen-list { display: flex; flex-direction: column; gap: 4px; padding: 8px; }
.scen { font: inherit; text-align: right; border: 0; background: transparent; padding: 8px 10px; border-radius: 7px; cursor: pointer; }
.scen.on { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.room-counts { display: flex; gap: 4px; flex-wrap: wrap; }
.preview { margin-top: 12px; padding: 10px 12px; border-radius: 8px; background: var(--primary-soft); }
.preview.error { background: var(--bad-soft); color: var(--bad); }
.steps { display: flex; gap: 14px; margin-bottom: 14px; font-size: 14px; color: var(--muted); flex-wrap: wrap; }
.steps .on { color: var(--primary); font-weight: 700; } .steps .done { color: var(--good); }

/* modal & toast */
.overlay { position: fixed; inset: 0; background: rgba(30, 36, 35, .35); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; z-index: 20; overflow-y: auto; }
.modal { background: var(--card); border-radius: 14px; width: 100%; max-width: 560px; box-shadow: 0 10px 40px rgba(0,0,0,.18); }
.modal.wide { max-width: 860px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 16px 18px; }
.modal-body > .grid2 + *, .modal-body h3 { margin-top: 14px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-start; padding: 12px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.modal-actions .btn.primary { margin-inline-start: auto; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translate(-50%, 20px); opacity: 0; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 9px; transition: .25s; z-index: 30; max-width: 90vw; }
.toast.show { opacity: 1; transform: translate(-50%, 0); } .toast.error { background: var(--bad); }
.error-card { max-width: 520px; margin: 60px auto; text-align: center; }

@media (max-width: 760px) {
  .page { padding: 12px; } .topbar { padding: 8px 12px; } .me, .crumb { display: none; }
  .tabs { top: 49px; padding: 0 8px; }
  .grid-sims { grid-template-columns: 1fr; }
  .mini-kpis, .kpis { grid-template-columns: repeat(2, 1fr); } .kpi-value { font-size: 18px; }
  .pipeline { grid-template-columns: repeat(3, 1fr); }
  .overlay { padding: 0; } .modal { border-radius: 0; min-height: 100vh; }
}
@media print {
  .topbar, .tabs, .btn, .icon-btn, .inline-form, .page-head .spacer ~ * { display: none !important; }
  body { background: #fff; } .card, .kpi { box-shadow: none; break-inside: avoid; }
  .page { max-width: none; padding: 0; }
}
