/* GuestMan — "front desk ledger" look: cool paper, slate ink, brass keys, sea-green for free rooms */
:root {
  --ink: #1d2b36;
  --ink-2: #4a5a64;
  --ink-3: #7b8a92;
  --paper: #f2f4f1;
  --sheet: #ffffff;
  --line: #d6ded9;
  --line-2: #e7ece9;
  --brass: #b07d24;
  --brass-soft: #f1dfb6;
  --brass-pale: #f8efd9;
  --sea: #2f6f62;
  --sea-soft: #d5eae3;
  --mulberry: #8c3d5a;
  --mulberry-soft: #efd9e2;
  --danger: #a12b2b;
  --focus: #d4a043;
  --radius: 8px;
  --nav-w: 232px;
  --top-h: 56px;
  --serif: "Young Serif", Georgia, "Times New Roman", serif;
  --sans: "Instrument Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--sans); font-size: 15px; line-height: 1.5; color: var(--ink); background: var(--paper); -webkit-font-smoothing: antialiased; }
h1, h2 { font-family: var(--serif); font-weight: 400; line-height: 1.15; margin: 0; }
h1 { font-size: 1.9rem; }
h2 { font-size: 1.3rem; }
a { color: var(--sea); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.muted { color: var(--ink-3); }
.num, td.num, th.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- buttons & inputs ---------- */
.btn { font: inherit; font-weight: 600; border: 1px solid var(--ink); background: var(--sheet); color: var(--ink); border-radius: var(--radius); padding: 8px 14px; cursor: pointer; white-space: nowrap; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { background: var(--line-2); }
.btn.primary { background: var(--ink); color: #fff; }
.btn.primary:hover { background: #2b3f4e; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: rgba(29,43,54,.07); }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn.small { padding: 4px 10px; font-size: .86rem; }
.btn.wide { width: 100%; justify-content: center; padding: 12px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.icon-btn { font: inherit; font-size: 1.15rem; background: none; border: 0; cursor: pointer; padding: 6px 10px; border-radius: 6px; color: inherit; }
.icon-btn:hover { background: rgba(0,0,0,.06); }
input, select, textarea { font: inherit; color: var(--ink); background: var(--sheet); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; width: 100%; }
input:focus, select:focus, textarea:focus { border-color: var(--ink-2); }
input[type=checkbox] { width: auto; accent-color: var(--sea); transform: scale(1.15); }
textarea { min-height: 80px; resize: vertical; }
input[readonly], select:disabled, textarea[readonly] { background: var(--paper); color: var(--ink-2); }
.form-error { color: var(--danger); margin: 0; min-height: 0; }
.form-error:not(:empty) { padding: 8px 20px; }

/* ---------- login ---------- */
#login { min-height: 100vh; display: grid; place-items: center; position: relative; overflow: hidden; background: var(--ink); }
#sunrise { position: absolute; inset: 0; width: 100%; height: 100%; }
.login-card { position: relative; background: var(--sheet); padding: 34px 32px 30px; border-radius: 12px; width: min(380px, 92vw); }
.login-card h1 { margin-top: 10px; font-size: 2.2rem; }
.login-card label { display: block; font-weight: 600; margin: 14px 0 4px; }
.login-card .btn { margin-top: 18px; }
.login-card .form-error:not(:empty) { padding: 10px 0 0; }

/* ---------- shell ---------- */
.topbar { position: fixed; inset: 0 0 auto 0; height: var(--top-h); display: flex; align-items: center; gap: 12px; padding: 0 16px; background: var(--sheet); border-bottom: 1px solid var(--line); z-index: 20; }
.brand { display: flex; align-items: center; gap: 9px; font-family: var(--serif); font-size: 1.25rem; color: var(--ink); text-decoration: none; }
.biz { color: var(--ink-3); border-left: 1px solid var(--line); padding-left: 12px; }
.spacer { flex: 1; }
.who { font-size: .9rem; color: var(--ink-2); }
.who b { font-weight: 600; color: var(--ink); }
.menu-btn { display: none; }
.sidenav { position: fixed; top: var(--top-h); bottom: 0; left: 0; width: var(--nav-w); overflow-y: auto; padding: 14px 10px 30px; border-right: 1px solid var(--line); background: var(--paper); z-index: 15; }
.sidenav a { display: block; padding: 7px 12px; border-radius: 6px; color: var(--ink-2); text-decoration: none; }
.sidenav a:hover { background: rgba(29,43,54,.06); color: var(--ink); }
.sidenav a.active { background: var(--ink); color: #fff; }
.sidenav h3 { font-size: .8rem; font-weight: 600; color: var(--ink-3); margin: 18px 12px 4px; }
#view { margin-left: var(--nav-w); padding: calc(var(--top-h) + 26px) 32px 60px; max-width: 1400px; outline: none; }

.page-head { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { margin-right: auto; }
.page-head .sub { width: 100%; margin: -6px 0 0; color: var(--ink-2); }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar input[type=search] { max-width: 260px; }
.toolbar input[type=date], .toolbar select { width: auto; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tabs button { font: inherit; background: none; border: 0; padding: 9px 14px; cursor: pointer; color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--brass); font-weight: 600; }

section.block { margin: 0 0 34px; }
section.block > h2 { margin-bottom: 10px; display: flex; align-items: baseline; gap: 10px; }
section.block > h2 small { font-family: var(--sans); font-size: .9rem; color: var(--ink-3); }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 10px 34px; }

/* stat strip — figures set in the serif, separated by rules, not cards */
.stats { display: flex; flex-wrap: wrap; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-bottom: 30px; }
.stat { padding: 14px 26px 14px 0; margin-right: 26px; border-right: 1px solid var(--line-2); }
.stat:last-child { border-right: 0; }
.stat b { display: block; font-family: var(--serif); font-weight: 400; font-size: 1.7rem; font-variant-numeric: tabular-nums; }
.stat span { color: var(--ink-2); font-size: .9rem; }
.stat.warn b { color: var(--danger); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius); }
table.grid { border-collapse: collapse; width: 100%; font-size: .93rem; }
table.grid th { text-align: left; font-weight: 600; color: var(--ink-2); padding: 9px 12px; border-bottom: 1px solid var(--line); background: #f8faf8; white-space: nowrap; }
table.grid td { padding: 8px 12px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
table.grid tr:last-child td { border-bottom: 0; }
table.grid tbody tr.click { cursor: pointer; }
table.grid tbody tr.click:hover td { background: var(--brass-pale); }
table.grid tfoot td { font-weight: 600; border-top: 1px solid var(--line); background: #f8faf8; }
.empty { padding: 22px; color: var(--ink-3); }
.tag { display: inline-block; font-size: .8rem; padding: 1px 8px; border-radius: 20px; background: var(--line-2); color: var(--ink-2); white-space: nowrap; }
.tag.sea { background: var(--sea-soft); color: var(--sea); }
.tag.brass { background: var(--brass-soft); color: #7a5410; }
.tag.mul { background: var(--mulberry-soft); color: var(--mulberry); }
.tag.red { background: #f6dede; color: var(--danger); }
.list-plain { list-style: none; margin: 0; padding: 0; background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius); }
.list-plain li { padding: 10px 14px; border-bottom: 1px solid var(--line-2); display: flex; gap: 12px; align-items: center; }
.list-plain li:last-child { border-bottom: 0; }
.list-plain li .grow { flex: 1; }
.list-plain li.overdue .when { color: var(--danger); font-weight: 600; }

/* ---------- availability board: rooms hang like brass key tags ---------- */
.board-wrap { overflow-x: auto; background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 12px 6px; }
table.board { border-collapse: separate; border-spacing: 3px; min-width: 100%; }
table.board th.day { font-weight: 500; font-size: .78rem; color: var(--ink-2); text-align: center; padding: 2px 0 6px; min-width: 64px; line-height: 1.25; }
table.board th.day b { display: block; font-family: var(--serif); font-weight: 400; font-size: 1.15rem; color: var(--ink); }
table.board th.day.today b { color: var(--brass); }
table.board th.day.weekend { color: var(--ink-3); }
table.board th.keytag { position: sticky; left: 0; z-index: 2; background: var(--sheet); padding: 0 8px 0 0; text-align: left; }
.key { display: inline-flex; align-items: center; gap: 8px; min-width: 112px; padding: 6px 12px 6px 8px; border-radius: 6px 22px 22px 6px; background: var(--brass); color: #fff; font-weight: 600; white-space: nowrap; }
.key::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--sheet); box-shadow: inset 0 0 0 2px #8a6119; }
.key small { font-weight: 400; opacity: .85; }
.key.off { background: #9aa6ad; }
table.board td { height: 40px; border-radius: 5px; font-size: .78rem; padding: 0 6px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 64px; }
td.s-free { background: var(--sea-soft); }
td.s-free:hover { background: #b9dccf; }
td.s-booked { background: var(--brass-soft); color: #5d400c; }
td.s-provisional { background: repeating-linear-gradient(135deg, var(--brass-pale) 0 6px, var(--brass-soft) 6px 12px); color: #5d400c; }
td.s-blocked { background: var(--mulberry-soft); color: var(--mulberry); }
td.s-renovation { background: repeating-linear-gradient(45deg, #eceff0 0 6px, #e1e5e7 6px 12px); cursor: default; }
td.start { box-shadow: inset 3px 0 0 #8a6119; font-weight: 600; }
.legend { display: flex; gap: 18px; flex-wrap: wrap; margin: 12px 2px 4px; font-size: .86rem; color: var(--ink-2); }
.legend i { display: inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: -2px; margin-right: 6px; }

/* ---------- drawer (dialog) ---------- */
dialog#drawer { padding: 0; border: 0; border-radius: 12px 0 0 12px; margin: 0 0 0 auto; height: 100vh; max-height: 100vh; width: min(620px, 100vw); background: var(--sheet); color: var(--ink); }
dialog#drawer::backdrop { background: rgba(20, 30, 38, .45); }
dialog#drawer[open] { animation: slidein .22s ease-out; }
@keyframes slidein { from { transform: translateX(40px); opacity: .4; } }
#drawerForm { display: flex; flex-direction: column; height: 100%; }
#drawerForm > header { display: flex; align-items: center; gap: 10px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
#drawerForm > header h2 { flex: 1; }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 20px 24px; }
#drawerForm > footer { display: flex; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); background: #f8faf8; flex-wrap: wrap; }
#drawerForm > footer .push { margin-left: auto; }
.fgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field.full { grid-column: 1 / -1; }
.field > label { font-weight: 600; font-size: .9rem; }
.field > label .req { color: var(--brass); }
.field .hint { font-size: .82rem; color: var(--ink-3); }
.field.check { flex-direction: row; align-items: center; gap: 10px; padding-top: 22px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips label { display: inline-flex; gap: 6px; align-items: center; padding: 5px 10px; border: 1px solid var(--line); border-radius: 20px; cursor: pointer; font-size: .88rem; }
.chips label:has(input:checked) { border-color: var(--sea); background: var(--sea-soft); color: var(--sea); }
.callout { padding: 10px 14px; border-radius: var(--radius); background: var(--brass-pale); border-left: 3px solid var(--brass); margin: 0 0 14px; }
.callout.ok { background: var(--sea-soft); border-color: var(--sea); }
.callout.bad { background: #f8e3e3; border-color: var(--danger); }
.subhead { font-family: var(--serif); font-size: 1.05rem; margin: 22px 0 8px; }
.pick-list { display: grid; gap: 6px; }
.pick-list button { text-align: left; font: inherit; padding: 9px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--sheet); cursor: pointer; display: flex; justify-content: space-between; gap: 10px; }
.pick-list button:hover, .pick-list button.on { border-color: var(--sea); background: var(--sea-soft); }

#toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 8px; opacity: 0; transition: .2s; pointer-events: none; z-index: 100; max-width: 90vw; }
#toast.show { opacity: 1; transform: translateX(-50%); }
#toast.bad { background: var(--danger); }

.report-out h2 { margin: 26px 0 10px; }
.timesheet-print { display: none; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .menu-btn { display: inline-block; }
  .biz, .who { display: none; }
  .sidenav { transform: translateX(-100%); transition: transform .2s; box-shadow: none; }
  .sidenav.open { transform: none; box-shadow: 4px 0 24px rgba(0,0,0,.18); }
  #view { margin-left: 0; padding: calc(var(--top-h) + 18px) 14px 50px; }
  .fgrid { grid-template-columns: 1fr; }
  dialog#drawer { border-radius: 0; }
  h1 { font-size: 1.55rem; }
  .stat { padding-right: 16px; margin-right: 16px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- print ---------- */
@media print {
  body { background: #fff; font-size: 12px; }
  .topbar, .sidenav, .toolbar, .no-print, .tabs, #toast { display: none !important; }
  #view { margin: 0; padding: 0; max-width: none; }
  .table-wrap, .board-wrap { border: 0; overflow: visible; }
  table.grid th { background: #fff; }
  .timesheet-print { display: block; margin-top: 40px; }
}
