/* Terratone enquiries — design system. See DESIGN.md for the rules behind these tokens and components. */

/* ========== 1. tokens ========== */
:root {
  /* surfaces & ink */
  --bg: #f5f3ef; --surface: #ffffff; --surface-2: #faf8f5; --surface-3: #f2eee8;
  --ink: #1c1a17; --muted: #6f6a63; --faint: #9a948b; --line: #e7e2db; --line-2: #d9d2c8;
  /* brand */
  --accent: #a3492b; --accent-soft: #f6e7dd; --accent-ink: #8f3d22;
  /* status (reserved: never used for series) */
  --danger: #b42318; --danger-soft: #fdecea; --ok: #2d6a3e; --ok-soft: #e7f2ea; --warn: #a0581b; --warn-soft: #fbefe2;
  /* enquiry types (validated for colour-blind separation) */
  --room: #2f6fb3; --room-soft: #e9f0f8; --event: #1a9168; --event-soft: #e4f3ec; --restaurant: #c9571f; --restaurant-soft: #fbece2;
  /* phone lines, busiest first (validated as a set) */
  --l1: #a3492b; --l2: #7b5cc4; --l3: #b07f00; --l4: #0f84a8; --l5: #5e8f2e;
  --l2-soft: #f0ebfa; --l3-soft: #f9f0dc; --l4-soft: #e2f1f6; --l4-ink: #0b5f79;

  /* type scale */
  --t-xs: 12px; --t-sm: 13px; --t-base: 15px; --t-md: 16px; --t-lg: 18px; --t-xl: 22px; --t-2xl: 30px; --t-3xl: 36px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  /* radius scale */
  --r-sm: 6px; --r-md: 10px; --r-lg: 14px; --r-xl: 20px; --r-pill: 999px;
  /* elevation */
  --shadow-sm: 0 1px 2px rgba(28,26,23,.04);
  --shadow: 0 1px 2px rgba(28,26,23,.04), 0 8px 24px rgba(28,26,23,.05);
  --shadow-lg: 0 2px 4px rgba(28,26,23,.05), 0 16px 36px rgba(28,26,23,.10);
  --focus: 0 0 0 3px rgba(163,73,43,.28);
  --ease: .16s ease;
}

/* ========== 2. base ========== */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: var(--t-md)/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: none; box-shadow: var(--focus); }
[hidden] { display: none !important; }
h1 { font: 500 var(--t-3xl)/1.1 var(--serif); letter-spacing: -.015em; margin: 0 0 6px; }
h2 { font-size: var(--t-lg); font-weight: 650; letter-spacing: -.005em; margin: 0 0 14px; }
h2 small { font-size: var(--t-sm); font-weight: 400; color: var(--muted); margin-left: 4px; }
h3 { font-size: var(--t-base); margin: 0 0 10px; }
ul.list { margin: 0; padding-left: 20px; }
ul.list li + li { margin-top: 6px; }
code { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 1px 6px; font-size: var(--t-sm); }
audio { width: 100%; }

/* utilities */
.muted, .s { color: var(--muted); }
.s { font-size: var(--t-sm); }
.small { font-size: var(--t-sm); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.m-0 { margin: 0; }
.mt-0 { margin-top: 0 !important; } .mt-1 { margin-top: 6px !important; } .mt-2 { margin-top: 12px !important; } .mt-3 { margin-top: 24px !important; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.between { justify-content: space-between; }
.end { justify-content: flex-end; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; flex: none; }
.ic { width: 16px; height: 16px; flex: none; }
.up { color: var(--ok); } .down { color: var(--danger); } .flat { color: var(--faint); }
.bad.up { color: var(--danger); } .bad.down { color: var(--ok); }

/* ========== 3. layout ========== */
.top { position: sticky; top: 0; z-index: 10; background: rgba(255,255,255,.92); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top); }
.topIn { max-width: 1240px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 20px; }
.mark { font-family: var(--serif); font-size: 26px; letter-spacing: -.01em; white-space: nowrap; text-decoration: none; }
.mark b { font-family: var(--font); font-weight: 300; font-style: italic; margin-right: 5px; }
.nav { display: flex; gap: 2px; }
.nav a { text-decoration: none; padding: 8px 14px; border-radius: var(--r-md); white-space: nowrap; color: var(--muted); transition: background var(--ease), color var(--ease); }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a.on { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.spacer { flex: 1; }
.me { position: relative; }
.me > button { display: flex; align-items: center; gap: 8px; border: 0; background: none; cursor: pointer; padding: 6px 4px; border-radius: var(--r-md); }
.role { font-size: var(--t-xs); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-pill); padding: 1px 10px; color: var(--muted); }
.menu { display: none; position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); min-width: 220px; padding: 6px; z-index: 20; }
.menu.open { display: block; }
.menu button { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border: 0; background: none; padding: 10px 12px; border-radius: var(--r-md); cursor: pointer; }
.menu button:hover { background: var(--surface-2); }
.menu .ic { color: var(--muted); }
.menu .signedIn { padding: 8px 12px; color: var(--muted); font-size: var(--t-sm); border-bottom: 1px solid var(--line); margin-bottom: 4px; }

main { max-width: 1240px; margin: 0 auto; padding: 32px 16px 72px; }
.head { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; justify-content: space-between; margin-bottom: 24px; }
.sub { margin: 0; color: var(--muted); }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.toolbar:last-of-type { margin-bottom: 18px; }

/* ========== 4. controls ========== */
.btn { display: inline-flex; align-items: center; gap: 6px; justify-content: center; text-decoration: none; border: 1px solid var(--line); border-radius: var(--r-lg); padding: 9px 16px; font-size: var(--t-base); background: var(--surface); cursor: pointer; white-space: nowrap; box-shadow: var(--shadow-sm); transition: border-color var(--ease), background var(--ease); }
.btn:hover { border-color: var(--line-2); background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--accent-ink); }
.btn.small { padding: 6px 12px; font-size: var(--t-sm); border-radius: var(--r-md); }
.btn:disabled { opacity: .55; cursor: default; }
.field { border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-lg); padding: 9px 14px; font-size: var(--t-base); min-width: 0; transition: border-color var(--ease); }
.field:hover { border-color: var(--line-2); }
.field:focus { border-color: var(--accent); }
select.field { padding-right: 30px; }
input[type=date].field { border-radius: var(--r-pill); padding: 7px 14px; }
textarea.field { width: 100%; min-height: 72px; resize: vertical; }
.search { flex: 1; min-width: 200px; }
.check { display: inline-flex; gap: 8px; align-items: center; font-size: var(--t-sm); color: var(--muted); cursor: pointer; }
.check input, .perms input { accent-color: var(--accent); }

/* pill: a filter chip; pills: a scrollable row of them */
.pills { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.pills::-webkit-scrollbar { display: none; }
.pill { display: inline-flex; align-items: center; border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-pill); padding: 7px 15px; cursor: pointer; font-size: var(--t-base); white-space: nowrap; transition: border-color var(--ease), background var(--ease); }
.pill:hover { border-color: var(--line-2); }
.pill .n { color: var(--faint); margin-left: 6px; font-variant-numeric: tabular-nums; }
.pill.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }
.pill.on .n { color: var(--accent-ink); opacity: .7; }
/* seg: a compact segmented switch */
.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line); background: var(--surface-2); border-radius: var(--r-pill); padding: 3px; text-transform: none; letter-spacing: 0; font-weight: 400; }
.seg button { border: 0; background: none; padding: 5px 12px; border-radius: var(--r-pill); cursor: pointer; font-size: var(--t-sm); color: var(--muted); transition: background var(--ease), color var(--ease); }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--surface); color: var(--accent-ink); font-weight: 600; box-shadow: var(--shadow-sm); }

/* ========== 5. surfaces ========== */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow); padding: 22px 24px; margin-bottom: 18px; }
.card.flush { padding: 0; overflow: hidden; }
.cardHead { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.cardHead h2 { margin: 0; }
.box { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px 16px; }
.note { background: var(--warn-soft); color: var(--warn); border-radius: var(--r-lg); padding: 10px 14px; font-size: var(--t-sm); margin-bottom: 18px; }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }

/* stat card: tone set per card via --c / --cs */
.stats { display: grid; grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
.stat { --c: var(--accent); --cs: var(--accent-soft); position: relative; overflow: hidden; background: linear-gradient(165deg, var(--cs) 0%, var(--cs) 35%, var(--surface) 100%); border: 1px solid var(--line); border-radius: var(--r-xl); padding: 20px 22px; box-shadow: var(--shadow); text-align: left; cursor: pointer; transition: transform var(--ease), box-shadow var(--ease); }
.stat::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: var(--c); }
.stat:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.stat .k { color: var(--muted); font-size: var(--t-base); display: flex; align-items: center; gap: 10px; }
.stat .k .ic { width: 32px; height: 32px; padding: 7px; border-radius: var(--r-md); color: #fff; background: var(--c); }
.stat .v { font-size: 40px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; margin: 10px 0 6px; font-variant-numeric: tabular-nums; }
.stat .v small { font-size: var(--t-md); font-weight: 500; color: var(--muted); margin-left: 2px; }
.stat .cmp { font-size: var(--t-sm); color: var(--muted); line-height: 1.6; }
.stats.mini .stat { padding: 14px 18px; }
.stats.mini .v { font-size: 28px; margin-top: 8px; }
.stats.mini .k .ic { width: 28px; height: 28px; padding: 6px; }
.stats.plain .stat { cursor: default; background: var(--surface-2); padding: 10px 12px; box-shadow: none; }
.stats.plain .stat::before { display: none; }
.stats.plain .stat:hover { transform: none; }
.stats.plain .v { font-size: var(--t-xl); margin: 2px 0 0; }

/* ========== 6. data display ========== */
/* tag: what kind of call/enquiry */
.tag { display: inline-flex; align-items: center; gap: 5px; border-radius: var(--r-pill); padding: 3px 11px; font-size: var(--t-sm); white-space: nowrap; font-weight: 500; background: var(--surface-2); color: var(--muted); }
.tag .ic { width: 14px; height: 14px; margin-left: -2px; }
.tag.room { background: var(--room-soft); color: var(--room); }
.tag.event { background: var(--event-soft); color: var(--event); }
.tag.restaurant { background: var(--restaurant-soft); color: var(--restaurant); }
.tag.plain { border: 1px solid var(--line); background: var(--surface); }
/* status: follow-up state, always dot + label */
.status { display: inline-flex; align-items: center; gap: 6px; border-radius: var(--r-pill); padding: 3px 12px; font-size: var(--t-sm); font-weight: 500; white-space: nowrap; background: var(--surface-2); border: 1px solid var(--line); }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.status.new { background: var(--accent-soft); border-color: transparent; color: var(--accent-ink); }
.status.follow_up { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.status.followed_up { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.status.confirmed, .status.resolved { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.status.cancelled, .status.lost { color: var(--faint); }
/* chips: requested date, party size, phone line */
.dateChip, .chip { display: inline-block; border-radius: var(--r-sm); padding: 2px 8px; font-size: var(--t-sm); font-weight: 600; }
.dateChip { background: var(--accent-soft); color: var(--accent-ink); }
.dateChip .s { color: inherit; font-weight: 500; opacity: .8; }
.chip { background: var(--l4-soft); color: var(--l4-ink); }
.lineChip { display: inline-flex; align-items: center; font-size: var(--t-sm); color: var(--muted); white-space: nowrap; }
.lineChip .dot { margin-right: 5px; }
/* conv: chance of converting */
.conv { display: inline-flex; align-items: center; gap: 8px; font-size: var(--t-sm); font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.conv i { position: relative; display: inline-block; width: 54px; height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.conv i b { position: absolute; inset: 0 auto 0 0; border-radius: 4px; }
.conv.hi { color: var(--ok); } .conv.hi b { background: var(--ok); }
.conv.mid { color: var(--warn); } .conv.mid b { background: var(--warn); }
.conv.lo { color: var(--danger); } .conv.lo b { background: var(--danger); }
.fixed { font-size: 11px; color: var(--accent-ink); background: var(--accent-soft); border-radius: var(--r-sm); padding: 0 6px; margin-left: 6px; }
.next { color: var(--accent-ink); font-size: var(--t-sm); margin-top: 4px; }
.lastUpd { font-size: var(--t-xs); color: var(--muted); margin-top: 6px; }
.clamp, .clamp3 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clamp3 { -webkit-line-clamp: 3; }
.guest { font-weight: 600; }
.contactLink { text-decoration: none; border-bottom: 1px dotted var(--faint); cursor: pointer; }
.contactLink:hover { color: var(--accent-ink); border-color: var(--accent); }

/* table */
.tableWrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-weight: 500; color: var(--muted); font-size: var(--t-sm); padding: 12px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
td { padding: 14px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: var(--t-base); }
th:first-child, td:first-child { padding-left: 20px; }
th:last-child, td:last-child { padding-right: 20px; }
tr:last-child td { border-bottom: 0; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
td.sum { min-width: 260px; max-width: 360px; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover td { background: var(--surface-2); }
table.compact th, table.compact td { padding-top: 10px; padding-bottom: 10px; font-size: var(--t-sm); }
/* category stripe on rows and list cards */
tr.cat-room td:first-child, .lcard.cat-room { box-shadow: inset 4px 0 0 var(--room); }
tr.cat-event td:first-child, .lcard.cat-event { box-shadow: inset 4px 0 0 var(--event); }
tr.cat-restaurant td:first-child, .lcard.cat-restaurant { box-shadow: inset 4px 0 0 var(--restaurant); }
tr.st-cancelled td, tr.st-lost td { opacity: .6; }

/* list card: the phone version of a table row, and a call in the calls view */
.cards { display: none; }
.lcard { padding: 16px 20px; border-bottom: 1px solid var(--line); cursor: pointer; transition: background var(--ease); }
.lcard:hover { background: var(--surface-2); }
.lcard:last-child { border-bottom: 0; }
.lcard.bare { cursor: default; }
.lcard.bare:hover { background: none; }
.lcard .r1 { display: flex; justify-content: space-between; gap: 10px; align-items: center; margin-bottom: 6px; }
.lcard .meta { color: var(--muted); font-size: var(--t-sm); margin-bottom: 6px; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.lcard .meta.tags { margin: 8px 0 0; }

/* ========== 7. charts ========== */
.bars { display: grid; gap: 6px; }
.bar { display: grid; grid-template-columns: 150px 1fr 64px; gap: 12px; align-items: center; font-size: var(--t-sm); border-radius: var(--r-md); padding: 4px 6px; }
.bar.click { cursor: pointer; }
.bar.click:hover { background: var(--surface-2); }
.bar .n { text-align: right; font-size: var(--t-base); font-variant-numeric: tabular-nums; line-height: 1.2; }
.bar .n .s { font-size: var(--t-xs); }
.track { height: 12px; background: var(--surface-3); border-radius: 6px; overflow: hidden; display: flex; gap: 2px; }
.fill { height: 100%; background: var(--accent); }
.fill:first-child { border-radius: 6px 0 0 6px; }
.fill.m { background: repeating-linear-gradient(135deg, var(--c) 0 2px, transparent 2px 5px); box-shadow: inset 0 0 0 1px var(--c); border-radius: 0 6px 6px 0; }
.chart { display: flex; align-items: flex-end; gap: 3px; height: 160px; margin-top: 4px; }
.chart.hours { height: 130px; }
.chart button { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; border: 0; padding: 0; background: none; cursor: pointer; border-radius: 4px; }
.chart button:hover { background: var(--surface-2); }
.chart.static button { cursor: default; }
.chart i { display: block; background: var(--accent); flex: none; opacity: .5; }
.chart i:first-child { border-radius: 4px 4px 0 0; }
.chart button.same i { opacity: .8; }
.chart button.sel i, .chart.static i { opacity: 1; }
.chart button.sel { box-shadow: 0 0 0 2px var(--accent); }
.chart button.nodata i { background: repeating-linear-gradient(45deg, var(--line) 0 3px, transparent 3px 6px); height: 100% !important; opacity: .7; }
.axis { display: flex; gap: 3px; font-size: 11px; color: var(--faint); margin-top: 6px; }
.axis span { flex: 1; text-align: center; white-space: nowrap; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: var(--t-sm); color: var(--muted); margin-top: 10px; }
.legend:empty { display: none; }
.legend b { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.legend b.solid { background: var(--muted); }
.legend b.hatch { background: repeating-linear-gradient(135deg, var(--muted) 0 2px, transparent 2px 4px); box-shadow: inset 0 0 0 1px var(--muted); }
.tip { position: fixed; z-index: 50; pointer-events: none; background: var(--ink); color: #fff; border-radius: var(--r-md); padding: 8px 10px; font-size: var(--t-xs); line-height: 1.5; box-shadow: var(--shadow-lg); max-width: 240px; }
.tip b { font-weight: 650; }
.tip .r { display: flex; align-items: center; gap: 6px; }
.tip .r span:last-child { margin-left: auto; padding-left: 12px; font-variant-numeric: tabular-nums; }
.tip .sw { width: 8px; height: 8px; border-radius: 2px; flex: none; box-shadow: 0 0 0 1px rgba(255,255,255,.5); }

/* ========== 8. views ========== */
/* to do */
.lcard.todo .actions { margin-top: 10px; }
.lcard .actions .btn { padding: 5px 12px; }

/* insights: demand heatmap (weeks across, weekdays down) */
.heat { --hm: 18px; display: flex; gap: 6px; }
.hm-days { display: grid; grid-template-rows: 16px repeat(7, var(--hm)); gap: 3px; font-size: 10px; line-height: var(--hm); color: var(--faint); }
.hm-scroll { overflow-x: auto; padding-bottom: 4px; }
.hm-months { margin-bottom: 3px; display: grid; grid-auto-flow: column; grid-auto-columns: var(--hm); gap: 3px; height: 16px; font-size: 10px; color: var(--faint); white-space: nowrap; }
.hm-grid { display: grid; grid-template-rows: repeat(7, var(--hm)); grid-auto-flow: column; gap: 3px; }
.hm-grid i { width: var(--hm); height: var(--hm); border-radius: 4px; }
.hm-grid i.hm-off { background: none; }
.hm-grid i.hm-past { opacity: .55; }
.hm-grid i.hm-today { box-shadow: 0 0 0 2px var(--ink); }
.heat + .legend b { margin: 0 2px; }
@media (min-width: 900px) { .heat { --hm: 22px; } }

/* call insights in the detail sheet */
.checks { display: flex; flex-wrap: wrap; gap: 6px; }
.checks span { font-size: var(--t-sm); border-radius: var(--r-pill); padding: 2px 10px; }
.checks .yes { background: var(--ok-soft); color: var(--ok); }
.checks .no { background: var(--surface-2); color: var(--faint); }
.next .ic { width: 14px; height: 14px; vertical-align: -2px; }
.waPick { padding: 5px 12px; font-size: var(--t-sm); border-radius: var(--r-md); width: auto; }
.match { font-size: var(--t-sm); color: var(--muted); background: var(--surface-2); border-radius: var(--r-md); padding: 6px 10px; margin-top: 6px; }
mark { background: #fbe3a6; color: inherit; border-radius: 3px; padding: 0 2px; }
.perms.one { grid-template-columns: 1fr; }

/* calls */
.split { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 18px; align-items: start; }
.side { position: sticky; top: 84px; max-height: calc(100vh - 100px); overflow-y: auto; padding: 12px; }
.side > summary { display: none; }
.side h3 { font-size: var(--t-xs); text-transform: uppercase; letter-spacing: .06em; color: var(--faint); margin: 16px 10px 6px; font-weight: 600; }
.opt { display: flex; justify-content: space-between; gap: 8px; padding: 7px 10px; border-radius: var(--r-md); cursor: pointer; font-size: var(--t-sm); }
.opt:hover { background: var(--surface-2); }
.opt.on { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.opt .n { color: var(--faint); font-variant-numeric: tabular-nums; }
.group { margin-bottom: 22px; }
.group > h3 .n { color: var(--faint); font-weight: 400; margin-left: 4px; }

/* detail sheet */
.scrim { position: fixed; inset: 0; background: rgba(28,26,23,.32); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 30; }
.scrim.open { opacity: 1; pointer-events: auto; }
.sheet { position: fixed; top: 0; right: 0; bottom: 0; width: min(580px, 100vw); background: var(--surface); z-index: 31; transform: translateX(105%); transition: transform .22s ease; display: flex; flex-direction: column; box-shadow: -12px 0 32px rgba(28,26,23,.12); }
.sheet.open { transform: none; }
.sheetHead { padding: 18px 22px 16px; border-bottom: 1px solid var(--line); display: flex; gap: 12px; justify-content: space-between; align-items: flex-start; }
.sheetHead h2 { margin: 0 0 4px; font: 500 var(--t-xl)/1.2 var(--serif); }
.iconBtn { display: inline-grid; place-items: center; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); cursor: pointer; flex: none; }
.iconBtn:hover { background: var(--surface-2); }
.sheetBody { padding: 18px 22px 48px; overflow-y: auto; flex: 1; }
.back { display: inline-block; font-size: var(--t-sm); color: var(--accent-ink); text-decoration: none; margin-bottom: 6px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.sec { font-size: var(--t-xs); text-transform: uppercase; letter-spacing: .06em; color: var(--faint); margin: 26px 0 10px; font-weight: 600; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
dl { display: grid; grid-template-columns: minmax(110px, 36%) minmax(0, 1fr); gap: 8px 14px; margin: 0; font-size: var(--t-base); }
dt { color: var(--muted); } dd { margin: 0; overflow-wrap: anywhere; }
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; }
.form label, dialog label { display: block; font-size: var(--t-sm); color: var(--muted); margin-bottom: 4px; }
.form .full { grid-column: 1 / -1; }
.form .field, dialog .field { width: 100%; }
.err { color: var(--danger); font-size: var(--t-sm); min-height: 1.2em; }
.timeline { list-style: none; margin: 14px 0 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 16px 20px; border-left: 2px solid var(--line); margin-left: 6px; }
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before { content: ''; position: absolute; left: -6px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line-2); }
.timeline .stamp { font-size: var(--t-xs); color: var(--muted); }
.timeline .what { margin-top: 3px; }
.chat { display: flex; flex-direction: column; gap: 8px; }
.turn { max-width: 86%; padding: 9px 13px; border-radius: 16px; font-size: var(--t-base); }
.turn .speaker { font-size: var(--t-xs); color: var(--muted); font-weight: 600; margin-bottom: 2px; }
.turn.staff { align-self: flex-start; background: var(--accent-soft); border-bottom-left-radius: 5px; }
.turn.caller { align-self: flex-end; background: var(--surface-2); border: 1px solid var(--line); border-bottom-right-radius: 5px; }
.turn.unclear { align-self: center; background: var(--surface-2); }

/* access */
.perms { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 18px; }
.perms label { display: flex; gap: 8px; align-items: flex-start; font-size: var(--t-sm); cursor: pointer; }
.perms input { margin-top: 3px; }

/* dialog */
dialog { border: 0; border-radius: var(--r-xl); padding: 24px; width: min(380px, calc(100vw - 32px)); box-shadow: var(--shadow-lg); }
dialog::backdrop { background: rgba(28,26,23,.32); }
dialog h3 { font-size: var(--t-lg); margin: 0 0 6px; }
dialog label { margin-top: 12px; }

/* sign-in page */
.signIn { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.signIn .card { width: min(400px, 100%); padding: 32px 28px; margin: 0; }
.signIn .mark { display: block; font-size: 30px; margin-bottom: 6px; }
.signIn label { display: block; font-size: var(--t-sm); color: var(--muted); margin: 14px 0 6px; }
.signIn .field { width: 100%; padding: 11px 14px; }
.signIn .btn { width: 100%; margin-top: 22px; padding: 12px; }
.signIn .err:not(:empty) { margin-top: 16px; padding: 10px 12px; border-radius: var(--r-md); background: var(--danger-soft); }

/* ========== 9. calendar (FullCalendar theme) ========== */
.fcWrap { padding: 18px; }
.fc { --fc-border-color: var(--line); --fc-page-bg-color: var(--surface); --fc-neutral-bg-color: var(--surface-2); --fc-today-bg-color: #fbf3ec;
  --fc-button-bg-color: var(--surface); --fc-button-text-color: var(--ink); --fc-button-border-color: var(--line);
  --fc-button-hover-bg-color: var(--surface-2); --fc-button-hover-border-color: var(--line-2);
  --fc-button-active-bg-color: var(--accent-soft); --fc-button-active-border-color: var(--accent); font-size: var(--t-sm); }
.fc .fc-toolbar-title { font: 500 var(--t-xl)/1.2 var(--serif); }
.fc .fc-button { border-radius: var(--r-md); box-shadow: none !important; text-transform: capitalize; font-size: var(--t-sm); padding: 6px 12px; }
.fc .fc-button-active { color: var(--accent-ink) !important; font-weight: 600; }
.fc .fc-col-header-cell-cushion, .fc .fc-daygrid-day-number { text-decoration: none; color: var(--muted); }
.fc .fc-col-header-cell-cushion { padding: 8px 4px; font-weight: 600; }
.fc .fc-daygrid-day-number { padding: 6px 8px; }
.fc .fc-dayGridMonth-view .fc-daygrid-day-frame { min-height: 132px; }
.fc .fc-daygrid-event-harness { margin: 0 4px 3px; }
.fc .fc-daygrid-event { font-size: 12.5px; line-height: 1.35; padding: 3px 6px; }
.fc .fc-daygrid-more-link { font-size: var(--t-xs); font-weight: 600; color: var(--accent-ink); margin: 2px 8px; }
.fc .fc-popover { border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-lg); max-width: 320px; }
.fc .fc-popover-body { max-height: 360px; overflow-y: auto; }
.fc .fc-dayGridWeek-view .fc-daygrid-day-frame { min-height: 440px; }
.fc .fc-dayGridWeek-view .fc-daygrid-event { white-space: normal; padding: 6px 8px; }
.fc .evT { color: var(--ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fc .evM { font-size: var(--t-xs); color: var(--muted); }
.fc .evS { font-size: var(--t-xs); color: var(--muted); margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.fc-event { cursor: pointer; border: 0 !important; border-left: 3px solid transparent !important; border-radius: var(--r-sm) !important; }
.fc-event, .fc-event .fc-event-title, .fc-event .fc-event-time { color: var(--ink) !important; }
.fc-event.cat-room { background: var(--room-soft) !important; border-left-color: var(--room) !important; }
.fc-event.cat-event { background: var(--event-soft) !important; border-left-color: var(--event) !important; }
.fc-event.cat-restaurant { background: var(--restaurant-soft) !important; border-left-color: var(--restaurant) !important; }
.fc-event.call-date { opacity: .6; }
.fc-event.st-cancelled, .fc-event.st-lost { opacity: .45; text-decoration: line-through; }
.fc-event.st-confirmed { box-shadow: inset 0 0 0 1px var(--ok); }
.fc .fc-list-event-dot { display: none; }

/* ========== 10. small screens ========== */
@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .stat { padding: 16px 18px; }
  .stat .v { font-size: 32px; }
  .grid2, .split { grid-template-columns: 1fr; }
  .card.side { position: static; max-height: none; padding: 0; }
  .side > summary { display: flex; align-items: center; gap: 6px; padding: 14px 18px; cursor: pointer; list-style: none; font-weight: 600; }
  .side > summary::-webkit-details-marker { display: none; }
  .side > summary::after { content: ""; margin-left: auto; width: 8px; height: 8px; border: solid var(--muted); border-width: 0 2px 2px 0; transform: rotate(45deg); transition: transform var(--ease); }
  .side[open] > summary::after { transform: rotate(-135deg); }
  .side > summary b { font-weight: 600; color: var(--accent-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .side #side { padding: 0 12px 12px; max-height: 60vh; overflow-y: auto; }
}
@media (max-width: 720px) {
  .topIn { flex-wrap: wrap; gap: 8px 12px; padding-bottom: 0; }
  .nav { order: 3; width: 100%; overflow-x: auto; scrollbar-width: none; padding-bottom: 8px; }
  .nav::-webkit-scrollbar { display: none; }
  .me .name { display: none; }
  h1 { font-size: var(--t-2xl); }
  main { padding-top: 20px; }
  .card { padding: 18px; }
  .tableWrap.responsive { display: none; }
  .cards { display: block; }
  .bar { grid-template-columns: 96px 1fr 56px; }
  .sheet { top: auto; left: 0; width: 100%; height: 92vh; border-radius: var(--r-xl) var(--r-xl) 0 0; transform: translateY(105%); }
  .sheet.open { transform: none; }
  .form, .perms { grid-template-columns: 1fr; }
  .head > .row, .head > .pills { width: 100%; }
  .pills.period { flex-wrap: nowrap; }
  .lcard .meta.tags .tag.plain:nth-of-type(n+4) { display: none; }
  .fc .fc-list-event-title { padding: 10px 12px; width: 100%; max-width: 0; } /* max-width 0 lets long titles ellipsis instead of widening the table */
  .fc .evM { margin-top: 2px; }
  .fcWrap { padding: 8px; }
  .fc .fc-toolbar { flex-wrap: wrap; gap: 8px; }
  .fc .fc-toolbar-title { font-size: var(--t-lg); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
div.stat { cursor: default; }
div.stat:hover { transform: none; box-shadow: var(--shadow); }
p.err:empty { display: none; }
