:root {
  --ink: #17202e; --ink2: #4a5568; --mute: #7b8494; --line: #e3e7ee; --bg: #f6f7f9; --card: #fff;
  --acc: #0a7f8f; --acc2: #e6f4f6; --acc-ink: #06505a; --warn: #b45309; --bad: #b42318; --ok: #157347;
  --busy: #3b4a63; --tent: #8a94a8; --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); }
a { color: var(--acc-ink); }
h1 { font-size: 1.75rem; line-height: 1.2; margin: 0 0 .4rem; letter-spacing: -.01em; text-wrap: balance; }
h2 { font-size: 1.1rem; margin: 1.4rem 0 .5rem; }
h3 { font-size: .95rem; margin: 1.2rem 0 .4rem; color: var(--ink2); }
p { margin: .4rem 0 .8rem; }
.muted { color: var(--mute); } .small { font-size: .86rem; } .bad { color: var(--bad); }
.row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.row.spread { justify-content: space-between; }
.wrap { max-width: 860px; margin: 0 auto; padding: 1.2rem 1rem 3rem; }
.wide { max-width: none; padding: 0; }

.top { display: flex; justify-content: space-between; align-items: center; padding: .6rem 1.1rem; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.brand { font-weight: 700; font-size: 1.15rem; color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: .45rem; }
.brand-dom { color: var(--mute); font-weight: 400; font-size: .85rem; }
.brand-mark { width: 18px; height: 18px; border-radius: 5px; background: linear-gradient(180deg, var(--acc) 0 33%, #fff 33% 40%, var(--acc) 40% 66%, #fff 66% 73%, #8fd0d8 73%); display: inline-block; }
.who { display: flex; gap: .7rem; align-items: center; }
.who-name { color: var(--ink2); font-size: .9rem; }
.foot { text-align: center; color: var(--mute); font-size: .8rem; padding: 2rem 0; }
.editing .foot { display: none; }

.btn { display: inline-block; border: 1px solid var(--acc); background: var(--acc); color: #fff; border-radius: 8px; padding: .45rem .9rem; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; line-height: 1.3; }
.btn:hover { filter: brightness(1.07); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.ghost { background: transparent; color: var(--acc-ink); }
.btn.ghost:hover { background: var(--acc2); }
.btn.small { padding: .25rem .6rem; font-size: .85rem; }
.btn.danger { background: transparent; border-color: var(--bad); color: var(--bad); }
.linkish { background: none; border: 0; color: var(--acc-ink); cursor: pointer; font: inherit; padding: 0; text-decoration: underline; }
input, select, textarea { font: inherit; color: inherit; border: 1px solid #cfd5df; border-radius: 7px; padding: .4rem .55rem; background: #fff; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--acc); outline-offset: -1px; border-color: var(--acc); }
input.num { width: 4.6rem; }
textarea { width: 100%; resize: vertical; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; margin: 1rem 0; }
.card.narrow { max-width: 520px; margin: 3rem auto; }
.card h2 { margin-top: 0; }
details > summary { cursor: pointer; color: var(--acc-ink); margin: .3rem 0; }

.hero { padding: 3rem 0 1rem; }
.hero h1 { font-size: 2.3rem; }
.lede { font-size: 1.1rem; color: var(--ink2); max-width: 40em; }
.dash-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .8rem; margin: 1rem 0; }
.event-list { list-style: none; padding: 0; margin: 0; }
.event-item { display: flex; align-items: center; gap: .8rem; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem 1rem; margin-bottom: .5rem; }
.event-item.archived { opacity: .55; }
.event-main { flex: 1; display: flex; flex-direction: column; text-decoration: none; color: var(--ink); }
.event-title { font-weight: 600; }
.kind-tag { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--acc-ink); }
.kind-tag.poll { color: #7c3aed; }
#feed-form input { flex: 1; min-width: 16rem; }

/* ---------------------------------------------------------------- participant view */
.event-head { margin: 1.4rem 0 1rem; }
.kicker { text-transform: uppercase; letter-spacing: .08em; font-size: .72rem; color: var(--acc-ink); font-weight: 700; margin: 0 0 .3rem; }
.meta { color: var(--ink2); font-weight: 500; }
.desc p { max-width: 42em; }
.gate { background: #fff8e6; border: 1px solid #f1d7a0; border-radius: var(--radius); padding: .8rem 1rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.gate p { margin: 0; }
.who-form { display: flex; gap: 1rem; flex-wrap: wrap; margin: 1rem 0; }
.who-form label { display: flex; flex-direction: column; gap: .2rem; font-size: .86rem; color: var(--ink2); flex: 1; min-width: 14rem; }
.who-form input { font-size: 1rem; }
.mine-banner { background: var(--acc2); border: 1px solid #b7e0e5; border-radius: var(--radius); padding: .7rem 1rem; display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin: .8rem 0; }
.summary { color: var(--ink2); font-weight: 600; margin: .6rem 0; }
.day h2 { border-bottom: 1px solid var(--line); padding-bottom: .3rem; }
.block-title { margin: .9rem 0 .3rem; }
.agenda-note { display: grid; grid-template-columns: 7.2rem 1fr; padding: .55rem .9rem; background: repeating-linear-gradient(135deg, #f1f3f6 0 8px, #f7f8fa 8px 16px); border-radius: 8px; margin: .4rem 0; font-weight: 500; }
.agenda-note .t, .slot .t { font-variant-numeric: tabular-nums; color: var(--ink2); }
ul.slots { list-style: none; padding: 0; margin: .3rem 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); overflow: hidden; }
ul.slots .slot { display: grid; grid-template-columns: 7.2rem 1fr auto; align-items: center; gap: .6rem; padding: .55rem .9rem; border-top: 1px solid var(--line); min-height: 2.9rem; }
ul.slots .slot:first-child { border-top: 0; }
ul.slots .slot.free .who { color: var(--ok); }
ul.slots .slot.full .who { color: var(--ink); font-weight: 500; }
ul.slots .slot.mine { background: var(--acc2); }
ul.slots .slot.past { opacity: .55; }
.slot .answer { color: var(--ink2); font-weight: 400; }
.slot .moved { color: var(--warn); font-weight: 400; font-size: .85rem; }
.slot .me { font-weight: 700; }
.toast { position: fixed; left: 50%; bottom: 1.4rem; transform: translateX(-50%) translateY(150%); background: var(--ink); color: #fff; padding: .6rem 1rem; border-radius: 9px; transition: transform .2s; z-index: 50; max-width: 92vw; box-shadow: 0 6px 24px rgba(0,0,0,.18); }
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.bad { background: var(--bad); }
.grid-scroll { overflow-x: auto; margin: .8rem 0; }
table.poll { border-collapse: separate; border-spacing: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
table.poll th, table.poll td { padding: .45rem .6rem; text-align: center; border-bottom: 1px solid var(--line); min-width: 4.4rem; }
table.poll .pname { text-align: left; min-width: 10rem; font-weight: 500; }
table.poll .dhead { border-bottom: 0; color: var(--ink2); }
table.poll .thead.final { background: var(--acc2); }
.otitle { font-size: .75rem; color: var(--mute); }
td.v.yes { background: #e6f6ec; color: var(--ok); font-weight: 700; }
td.v.maybe { background: #fff6e0; color: var(--warn); }
td.v.no { background: #fbeaea; color: var(--bad); }
td.v.editable button { width: 100%; border: 1px dashed #c3cad6; background: transparent; border-radius: 6px; padding: .25rem; cursor: pointer; font: inherit; color: inherit; }
tr.totals td, tr.totals th { font-weight: 700; border-bottom: 0; }
tr.totals td.best { background: var(--acc); color: #fff; }

/* ---------------------------------------------------------------- editor */
.editor { display: grid; grid-template-columns: 320px 1fr; min-height: calc(100vh - 52px); }
.side { background: var(--card); border-right: 1px solid var(--line); padding: 1rem 1.1rem 3rem; overflow-y: auto; max-height: calc(100vh - 52px); position: sticky; top: 52px; }
.side .field, .insp .field { display: flex; flex-direction: column; gap: .2rem; margin: .55rem 0; font-size: .86rem; color: var(--ink2); }
.side .field input, .side .field select { width: 100%; }
.check { display: flex; gap: .45rem; align-items: center; font-size: .9rem; margin: .5rem 0; }
.linkrow { margin: .5rem 0; }
.linkrow .lbl { font-size: .82rem; color: var(--ink2); display: block; margin-bottom: .15rem; }
.linkrow .row { flex-wrap: nowrap; }
.linkrow input { flex: 1; font-size: .8rem; color: var(--ink2); }
.stage { padding: 1rem 1.2rem 3rem; min-width: 0; }
.toolbar { display: flex; flex-direction: column; gap: .4rem; margin-bottom: .6rem; }
.toolbar .sep { width: 1px; height: 1.4rem; background: var(--line); margin: 0 .3rem; }
.toolbar .inline { display: flex; align-items: center; gap: .35rem; color: var(--ink2); }
.help { margin: 0; }
.board-scroll { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.days { display: flex; min-width: min-content; }
.day-col { flex: 1 0 300px; max-width: 640px; border-right: 1px solid var(--line); }
.day-col:last-child { border-right: 0; }
.day-head { padding: .5rem .7rem; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--card); display: flex; gap: .5rem; align-items: baseline; flex-wrap: wrap; min-height: 2.6rem; }
.allday { color: var(--mute); flex-basis: 100%; }
.day-body { position: relative; margin-left: 44px; user-select: none; }
.hour { position: absolute; left: -44px; right: 0; border-top: 1px solid #eef0f4; }
.hour span { position: absolute; left: 4px; top: -.6rem; font-size: .7rem; color: var(--mute); background: var(--card); padding: 0 2px; font-variant-numeric: tabular-nums; }
.cal-lane { position: absolute; left: 0; width: 34%; top: 0; bottom: 0; }
.cal-ev { position: absolute; border-radius: 5px; padding: 1px 4px; font-size: .68rem; line-height: 1.2; overflow: hidden; color: #fff; background: var(--busy); border: 1px solid #fff; }
.cal-ev.tentative { background: repeating-linear-gradient(135deg, var(--tent) 0 5px, #a3abbb 5px 10px); }
.cal-ev.free { background: #d8dde6; color: var(--ink2); }
.cal-ev.oof { background: #7c3aed; }
.cal-ev span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.blk-lane { position: absolute; left: 36%; right: 6px; top: 0; bottom: 0; cursor: crosshair; }
.blk { position: absolute; left: 0; right: 0; border-radius: 7px; background: var(--acc2); border: 1.5px solid var(--acc); cursor: grab; overflow: visible; touch-action: none; }
.blk.sel { box-shadow: 0 0 0 3px rgba(10,127,143,.25); }
.blk.dragging { cursor: grabbing; opacity: .92; }
.blk.note { background: repeating-linear-gradient(135deg, #eef0f4 0 8px, #f6f7f9 8px 16px); border-color: #9aa3b2; }
.blk.option { background: #f1ebfe; border-color: #7c3aed; }
.blk.clash { outline: 2px dashed var(--warn); }
.blk .handle { position: absolute; left: 18%; right: 18%; height: 9px; cursor: ns-resize; z-index: 3; }
.blk .handle::after { content: ""; position: absolute; left: 35%; right: 35%; top: 3px; height: 3px; border-radius: 3px; background: var(--acc); opacity: .5; }
.blk:hover .handle::after, .blk.sel .handle::after { opacity: 1; }
.blk .handle.h-top { top: -5px; } .blk .handle.h-bottom { bottom: -5px; }
.blk.note .handle::after { background: #6b7280; }
.blk .slot { position: absolute; left: 3px; right: 3px; border-radius: 4px; background: #fff; border: 1px solid #b7dfe4; font-size: .72rem; display: flex; gap: .35rem; align-items: center; padding: 0 .35rem; overflow: hidden; white-space: nowrap; }
.blk .slot .st { font-variant-numeric: tabular-nums; color: var(--acc-ink); font-weight: 600; }
.blk .slot .sp { overflow: hidden; text-overflow: ellipsis; color: var(--ink2); }
.blk .slot.taken { background: var(--acc); border-color: var(--acc); }
.blk .slot.taken .st, .blk .slot.taken .sp { color: #fff; }
.blk .slot.off { background: repeating-linear-gradient(135deg, #f3f4f6 0 5px, #fff 5px 10px); border-style: dashed; }
.blk .slot.off .st { color: var(--mute); text-decoration: line-through; }
.blk .slot.clash { box-shadow: inset 3px 0 0 var(--warn); }
.blk-tag { position: absolute; right: 4px; bottom: -1.15rem; font-size: .68rem; color: var(--acc-ink); white-space: nowrap; pointer-events: none; background: rgba(255,255,255,.9); padding: 0 3px; border-radius: 3px; }
.blk-label { padding: .2rem .45rem; font-size: .78rem; font-weight: 600; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; line-height: 1.25; }
.blk-label .st { font-variant-numeric: tabular-nums; color: var(--ink2); font-weight: 500; }
.inspector { margin: .9rem 0; min-height: 3rem; }
.insp { display: flex; flex-wrap: wrap; gap: .3rem .9rem; align-items: flex-end; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .4rem .9rem .7rem; }
.insp .field.grow { flex: 1; min-width: 14rem; }
.insp .field.grow input { width: 100%; }
.insp-actions { display: flex; gap: .4rem; margin-left: auto; padding-bottom: .1rem; }
.insp-sum { margin: .35rem .2rem; color: var(--ink2); }
table.list { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.list th { text-align: left; font-size: .78rem; color: var(--mute); font-weight: 600; border-bottom: 1px solid var(--line); padding: .35rem .4rem; }
table.list td { border-bottom: 1px solid var(--line); padding: .45rem .4rem; vertical-align: top; }
table.list td.act { white-space: nowrap; text-align: right; }
table.list td.act select { font-size: .82rem; padding: .2rem; }
table.list tr.best td:first-child { font-weight: 700; }
table.list tr.final { background: var(--acc2); }
.add-person { margin-top: .8rem; }
.add-person input { flex: 1; min-width: 9rem; }
ul.plain { list-style: none; padding: 0; margin: .4rem 0; }
ul.plain li { padding: .15rem 0; }

@media (max-width: 900px) {
  .editor { grid-template-columns: 1fr; }
  .side { position: static; max-height: none; border-right: 0; border-bottom: 1px solid var(--line); }
  .day-col { flex-basis: 260px; }
}
@media (max-width: 560px) {
  h1 { font-size: 1.45rem; }
  ul.slots .slot { grid-template-columns: 1fr auto; }
  ul.slots .slot .t { grid-column: 1 / -1; font-weight: 600; }
  .agenda-note { grid-template-columns: 1fr; }
  .brand-dom { display: none; }
}
