/* Planner — layout on top of eventapp's hp.css tokens, so it reads like the desk. */
* { box-sizing: border-box; }
html, body { height: 100%; }
body { display: flex; flex-direction: column; font-size: 14px; }
button { font: inherit; }
.small { font-size: 13px !important; padding: 5px 10px !important; min-height: 0 !important; line-height: 18px !important; }
.btn { padding: 10px 16px; cursor: pointer; }

:root {
  --k-general: #024AD8; --k-breakout: #0E7C86; --k-meal: #B45309; --k-break: #858585;
  --k-activity: #017043; --k-travel: #6B4FBB; --k-crew: #3D3D3D;
  --hour-px: 64px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --k-general: #518CFF; --k-breakout: #2BB3BE; --k-meal: #FD9C5C; --k-break: #A3A3A3;
    --k-activity: #4BD78F; --k-travel: #A48EF0; --k-crew: #C2C2C2;
  }
}

/* ---- header + bar ---- */
.top { display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 8px 16px; border-bottom: 1px solid var(--stroke); background: var(--bg); }
.top-left, .top-right { display: flex; align-items: center; gap: 12px; min-width: 0; }
.logo { width: 28px; height: 28px; }
.app-name { font-weight: 600; font-size: 16px; white-space: nowrap; }
#plan-pick { font: inherit; font-weight: 600; padding: 6px 8px; border: 1px solid var(--stroke-strong);
  border-radius: var(--r-1); background: var(--bg); color: var(--fg); max-width: 40vw; }
.viewers { display: flex; }
.viewers span { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  margin-left: -6px; border: 2px solid var(--bg); font-size: 11px; font-weight: 600; color: #fff; }

.bar { display: flex; align-items: center; gap: 12px; padding: 8px 16px; border-bottom: 1px solid var(--stroke);
  background: var(--bg-container); flex-wrap: wrap; position: relative; }
.seg { display: inline-flex; border: 1px solid var(--stroke-strong); border-radius: var(--r-1); overflow: hidden; }
.seg button { border: 0; background: transparent; color: var(--fg); padding: 5px 12px; cursor: pointer; font-size: 13px; }
.seg button.on { background: var(--neutral); color: var(--neutral-fg); font-weight: 600; }
.days { display: flex; gap: 4px; overflow-x: auto; flex: 1; min-width: 0; }
.days button { border: 1px solid transparent; background: transparent; color: var(--fg-medium); padding: 5px 10px;
  border-radius: var(--r-1); cursor: pointer; white-space: nowrap; font-size: 13px; }
.days button:hover { background: var(--neutral-tint-hover); }
.days button.on { border-color: var(--primary); color: var(--primary); font-weight: 600; background: var(--bg); }
.days button .n { font-size: 11px; opacity: .7; margin-left: 4px; }
.bar-right { display: flex; gap: 6px; align-items: center; position: relative; }
.badge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 999px; font-size: 11px; line-height: 18px;
  background: var(--primary); color: var(--primary-fg); text-align: center; margin-left: 4px; }
.badge.warn { background: var(--attention); color: #fff; }
.menu { position: absolute; right: 0; top: calc(100% + 4px); background: var(--bg); border: 1px solid var(--stroke);
  border-radius: var(--r-2); box-shadow: var(--shadow); padding: 6px; z-index: 50; min-width: 210px; }
.menu button { display: block; width: 100%; text-align: left; border: 0; background: transparent; color: var(--fg);
  padding: 8px 10px; border-radius: var(--r-1); cursor: pointer; }
.menu button:hover { background: var(--neutral-tint-hover); }
.menu hr { border: 0; border-top: 1px solid var(--stroke); margin: 4px 0; }

/* ---- layout ---- */
.layout { flex: 1; display: flex; min-height: 0; }
.lot { width: 220px; flex: none; border-right: 1px solid var(--stroke); background: var(--bg-container);
  display: flex; flex-direction: column; min-height: 0; }
.lot-head { padding: 12px 12px 6px; }
.lot-head .caption { font-size: 12px; color: var(--fg-light); }
.lot-items { flex: 1; overflow-y: auto; padding: 6px 10px 20px; display: flex; flex-direction: column; gap: 6px; }
.lot.drop-hot { background: var(--primary-tint); }
.lot .block { position: relative; height: auto; min-height: 40px; }
.main { flex: 1; overflow: auto; position: relative; min-width: 0; }

.empty { flex: 1; display: grid; place-items: center; padding: 32px; }
.empty .card { max-width: 520px; width: 100%; }

/* ---- board ---- */
.board { display: grid; position: relative; min-width: max-content; }
.colhead { position: sticky; top: 0; z-index: 6; background: var(--bg); border-bottom: 1px solid var(--stroke);
  padding: 8px 8px 6px; font-weight: 600; font-size: 13px; border-left: 1px solid var(--stroke); min-height: 48px; }
.colhead .caption-small { display: block; color: var(--fg-light); font-weight: 400; }
.colhead.corner { left: 0; z-index: 8; border-left: 0; }
.colhead.main-room::after { content: 'main'; font-size: 10px; margin-left: 6px; padding: 1px 5px; border-radius: 999px;
  background: var(--primary-tint); color: var(--primary); font-weight: 600; vertical-align: 1px; }
.times { position: sticky; left: 0; z-index: 5; background: var(--bg); border-right: 1px solid var(--stroke); }
.times div { position: absolute; right: 6px; font-size: 11px; color: var(--fg-light); transform: translateY(-7px); }
.col { position: relative; border-left: 1px solid var(--stroke);
  background-image: linear-gradient(to bottom, var(--stroke) 1px, transparent 1px),
    linear-gradient(to bottom, color-mix(in srgb, var(--stroke) 45%, transparent) 1px, transparent 1px);
  background-size: 100% var(--hour-px), 100% calc(var(--hour-px) / 2); }
.col.drop-hot { background-color: var(--primary-tint); }
.col.noroom { background-color: color-mix(in srgb, var(--bg-sunken) 60%, transparent); }
.nowline { position: absolute; left: 0; right: 0; height: 2px; background: var(--attention); z-index: 3; pointer-events: none; }

.block { position: absolute; left: 3px; right: 3px; border-radius: 6px; padding: 4px 6px 6px 9px; overflow: hidden;
  cursor: grab; user-select: none; font-size: 12px; line-height: 15px; z-index: 2;
  background: color-mix(in srgb, var(--k) 14%, var(--bg)); color: var(--fg);
  border: 1px solid color-mix(in srgb, var(--k) 45%, transparent); border-left: 4px solid var(--k); }
.block:hover { box-shadow: var(--shadow); z-index: 4; }
.block:focus-visible { outline: 2px solid var(--stroke-focus); outline-offset: 1px; }
.block .t { font-weight: 600; display: block; overflow-wrap: anywhere; }
.block .m { color: var(--fg-medium); font-size: 11px; display: block; }
.block .tags { display: flex; gap: 3px; flex-wrap: wrap; margin-top: 2px; }
.block .tag { font-size: 10px; padding: 0 4px; border-radius: 3px; background: color-mix(in srgb, var(--k) 20%, transparent); }
.block.st-idea { border-style: dashed; opacity: .75; background: transparent; }
.block.st-tentative { background-image: repeating-linear-gradient(135deg, transparent 0 8px, color-mix(in srgb, var(--k) 8%, transparent) 8px 16px); }
.block.k-crew { background-image: repeating-linear-gradient(45deg, transparent 0 6px, color-mix(in srgb, var(--k) 12%, transparent) 6px 12px); }
.block.clash { box-shadow: 0 0 0 2px var(--attention); }
.block.clash::before { content: '!'; position: absolute; top: 3px; right: 4px; width: 15px; height: 15px; border-radius: 50%;
  background: var(--attention); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.block.fresh::after { content: ''; position: absolute; top: 4px; right: 22px; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }
.block.selected { outline: 2px solid var(--fg); outline-offset: 1px; z-index: 5; }
.block.dragging { opacity: .35; }
.block .grip { position: absolute; left: 0; right: 0; bottom: 0; height: 7px; cursor: ns-resize; }
.block.ghost { opacity: .9; pointer-events: none; z-index: 20; box-shadow: var(--shadow); cursor: grabbing; }
.ghost-time { position: fixed; z-index: 30; pointer-events: none; background: var(--neutral); color: var(--neutral-fg);
  font-size: 12px; padding: 2px 6px; border-radius: 4px; font-weight: 600; }
.k-general { --k: var(--k-general); } .k-breakout { --k: var(--k-breakout); } .k-meal { --k: var(--k-meal); }
.k-break { --k: var(--k-break); } .k-activity { --k: var(--k-activity); } .k-travel { --k: var(--k-travel); } .k-crew { --k: var(--k-crew); }

.legend { display: flex; gap: 12px; flex-wrap: wrap; padding: 8px 16px; font-size: 12px; color: var(--fg-medium);
  border-top: 1px solid var(--stroke); background: var(--bg-container); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; background: var(--k); margin-right: 4px; vertical-align: -1px; }

/* ---- list view ---- */
.list { max-width: 980px; margin: 0 auto; padding: 16px 20px 60px; }
.list-filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.list h3 { margin: 22px 0 6px; font-size: 16px; }
.list table { width: 100%; border-collapse: collapse; }
.list td { padding: 7px 8px; border-top: 1px solid var(--stroke); vertical-align: top; }
.list td.time { white-space: nowrap; width: 130px; color: var(--fg-medium); }
.list td.room { width: 170px; color: var(--fg-medium); }
.list tr { cursor: pointer; }
.list tr:hover td { background: var(--neutral-tint-hover); }
.list .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--k); margin-right: 6px; }
.list .sub { display: block; color: var(--fg-light); font-size: 12px; }
.pill { display: inline-block; font-size: 11px; padding: 0 6px; border-radius: 999px; border: 1px solid var(--stroke-strong); margin-left: 4px; color: var(--fg-medium); }
.pill.bad { border-color: var(--attention); color: var(--attention); }

/* ---- drawer ---- */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 100vw); background: var(--bg);
  border-left: 1px solid var(--stroke); box-shadow: var(--shadow); z-index: 40; display: flex; flex-direction: column; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--stroke); }
.drawer-head h2 { font-size: 18px; line-height: 22px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px; }
.f { display: block; margin-bottom: 12px; }
.f > span { display: block; font-size: 12px; font-weight: 600; margin-bottom: 3px; color: var(--fg-medium); }
.f > small { display: block; font-size: 12px; color: var(--fg-light); margin-top: 3px; }
.f input[type=text], .f input[type=number], .f input[type=date], .f select, .f textarea {
  width: 100%; font: inherit; font-size: 14px; padding: 7px 9px; border: 1px solid var(--stroke-strong);
  border-radius: var(--r-1); background: var(--bg); color: var(--fg); }
.f textarea { min-height: 64px; resize: vertical; }
.f input:focus, .f select:focus, .f textarea:focus { outline: none; border-color: var(--stroke-focus); box-shadow: 0 0 0 1px var(--stroke-focus); }
.frow { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.frow3 { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 10px; }
.checks { display: flex; flex-wrap: wrap; gap: 6px; }
.checks label { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--stroke-strong); border-radius: 999px;
  padding: 3px 10px; cursor: pointer; font-size: 13px; }
.checks label:has(input:checked) { background: var(--neutral); color: var(--neutral-fg); border-color: var(--neutral); }
.checks input { position: absolute; opacity: 0; pointer-events: none; }
.actions { display: flex; gap: 8px; margin-top: 16px; align-items: center; flex-wrap: wrap; }
.actions .grow { flex: 1; }
.btn.danger { background: transparent; color: var(--attention); border-color: var(--attention); }
.note { font-size: 12px; color: var(--fg-light); }
.warnbox { border: 1px solid var(--attention); background: var(--attention-tint); color: var(--fg); border-radius: var(--r-2); padding: 8px 10px; margin-bottom: 12px; font-size: 13px; }
.infobox { border: 1px solid var(--stroke); background: var(--bg-container); border-radius: var(--r-2); padding: 8px 10px; margin-bottom: 12px; font-size: 13px; }

.feed { list-style: none; margin: 0; padding: 0; }
.feed li { padding: 8px 0; border-bottom: 1px solid var(--stroke); font-size: 13px; }
.feed li.new { border-left: 3px solid var(--primary); padding-left: 8px; }
.feed time { display: block; font-size: 11px; color: var(--fg-light); }
.feed button.linkish, .linkish { border: 0; background: none; color: var(--primary); cursor: pointer; padding: 0; text-decoration: underline; font-size: 12px; }
.rowlist { display: flex; flex-direction: column; gap: 6px; }
.rowlist .r { display: flex; gap: 6px; align-items: center; }
.rowlist .r input[type=text] { flex: 1; }
.code { font-family: ui-monospace, Consolas, monospace; font-size: 12px; background: var(--bg-sunken); padding: 8px; border-radius: 6px;
  white-space: pre-wrap; word-break: break-all; }
.preview { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 8px; }
.preview td, .preview th { border-top: 1px solid var(--stroke); padding: 4px; text-align: left; vertical-align: top; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--neutral); color: var(--neutral-fg);
  padding: 10px 16px; border-radius: var(--r-2); box-shadow: var(--shadow); z-index: 60; font-size: 14px; display: flex; gap: 12px; align-items: center; }
.toast button { background: transparent; border: 0; color: inherit; text-decoration: underline; cursor: pointer; font-weight: 600; }

@media (max-width: 760px) {
  .lot { display: none; }
  .app-name { display: none; }
  .bar-right .btn-ghost[data-act=undo] { display: none; }
}

@media print {
  .top, .bar, .lot, .drawer, .toast, .legend, .list-filters { display: none !important; }
  .layout { display: block; }
  .main { overflow: visible; }
  .list tr { break-inside: avoid; }
  body { background: #fff; color: #000; }
}
