:root {
  --accent: #E20074;
  --accent-dark: #A8005A;
  --accent-soft: #FDE7F2;
  --bg: #f4f5f8;
  --panel: #ffffff;
  --text: #1d2230;
  --muted: #6a7282;
  --line: #e6e8ee;
  --line-strong: #d3d7e0;
  --danger: #c62828;
  --warn: #c77700;
  --radius: 10px;
  --topbar-h: 64px;
  --shadow: 0 1px 2px rgba(20, 24, 40, .06), 0 4px 14px rgba(20, 24, 40, .06);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; background: var(--bg); font-size: 14px; line-height: 1.4; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }

.icon { display: inline-flex; align-items: center; vertical-align: middle; flex: none; }

/* ---- top bar ---- */
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h);
  display: flex; align-items: center; gap: 16px; padding: 0 20px;
  background: var(--panel); border-bottom: 3px solid var(--accent); box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: none; }
.brand-mark { width: 28px; height: 28px; border-radius: 7px; background: var(--accent); position: relative; }
.brand-mark::before, .brand-mark::after { content: ""; position: absolute; left: 6px; height: 4px; border-radius: 2px; background: #fff; }
.brand-mark::before { top: 8px; width: 16px; box-shadow: 0 6px 0 -0px rgba(255,255,255,.75); }
.brand-mark::after { top: 20px; width: 10px; opacity: .55; }
.brand-logo { max-height: 40px; max-width: 150px; object-fit: contain; }
.brand-name { font-weight: 700; font-size: 17px; letter-spacing: -.01em; white-space: nowrap; }
.meeting-title {
  flex: 1 1 260px; min-width: 120px; max-width: 560px; padding: 9px 12px; font-size: 16px; font-weight: 600;
  border: 1px solid transparent; border-radius: 8px; background: var(--bg);
}
.meeting-title:hover { border-color: var(--line-strong); }
.meeting-title:focus { outline: 2px solid var(--accent); background: #fff; }
.top-actions { display: flex; gap: 8px; margin-left: auto; align-items: center; flex-wrap: nowrap; }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; cursor: pointer;
  border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; font-weight: 500; white-space: nowrap;
}
.btn:hover { background: #f3f4f7; }
.btn:focus-visible, .icon-btn:focus-visible, .tab:focus-visible, .card:focus-visible, .block:focus-visible, .swatch:focus-visible, .room-name:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn.danger-text { color: var(--danger); }
.btn.block-btn { width: 100%; justify-content: center; }
.push-left { margin-right: auto; }
.icon-btn {
  display: inline-grid; place-items: center; width: 26px; height: 26px; padding: 0; cursor: pointer;
  border: 0; border-radius: 6px; background: transparent; color: var(--muted);
}
.icon-btn:hover { background: rgba(0, 0, 0, .07); color: var(--text); }
.icon-btn.tiny { width: 20px; height: 20px; }
.icon-btn.confirm { background: var(--danger); color: #fff; width: auto; padding: 0 8px; }
.icon-btn.confirm:hover { background: #a21f1f; color: #fff; }

.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 250px; padding: 6px; z-index: 40;
  background: #fff; border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: 0 8px 30px rgba(20, 24, 40, .18);
}
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; background: none; border-radius: 7px; text-align: left; cursor: pointer; }
.menu-item:hover { background: var(--accent-soft); }

/* ---- layout ---- */
.layout { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 20px; padding: 20px; max-width: 1700px; margin: 0 auto; align-items: start; }
.sidebar {
  position: sticky; top: calc(var(--topbar-h) + 16px); max-height: calc(100vh - var(--topbar-h) - 32px);
  overflow: auto; display: flex; flex-direction: column; gap: 14px; padding-right: 2px;
  border-radius: var(--radius); transition: outline-color .1s;
}
.sidebar.drop-hover { outline: 3px dashed var(--accent); outline-offset: 2px; }
.panel { background: var(--panel); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; }
.panel-title { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); display: flex; align-items: center; gap: 6px; cursor: help; }
.pool { display: flex; flex-direction: column; gap: 8px; }
.empty { color: var(--muted); font-size: 13px; padding: 6px 2px; }
.muted { color: var(--muted); }
.best-practice { display: flex; gap: 10px; padding: 12px; border-radius: var(--radius); background: var(--accent-soft); color: var(--accent-dark); font-size: 13px; cursor: help; }
.best-practice p { margin-top: 2px; color: var(--text); }

.card {
  display: flex; align-items: center; gap: 6px; padding: 8px 8px 8px 10px; cursor: grab; user-select: none;
  background: color-mix(in srgb, var(--c) 9%, #fff); border: 1px solid color-mix(in srgb, var(--c) 28%, #fff); border-left: 5px solid var(--c); border-radius: 8px;
}
.card:hover { box-shadow: var(--shadow); }
.card-main { flex: 1; min-width: 0; }
.card-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-meta { font-size: 12px; color: var(--muted); }
.card-actions { display: flex; gap: 0; opacity: .0; }
.card:hover .card-actions, .card:focus-within .card-actions { opacity: 1; }

/* ---- main ---- */
.main { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; align-items: flex-end; border-bottom: 2px solid var(--line-strong); }
.tab {
  display: flex; flex-direction: column; align-items: flex-start; padding: 8px 16px; cursor: pointer; border: 0; margin-bottom: -2px;
  background: transparent; border-bottom: 3px solid transparent; border-radius: 8px 8px 0 0; color: var(--muted);
}
.tab:hover { background: rgba(0, 0, 0, .04); }
.tab.active { color: var(--accent-dark); border-bottom-color: var(--accent); background: #fff; font-weight: 600; }
.tab-date { font-size: 12px; font-weight: 400; }
.tab.add { flex-direction: row; align-items: center; gap: 6px; padding: 10px 14px; margin-left: 4px; }
.tab.drop-hover { background: var(--accent-soft); outline: 2px dashed var(--accent); }

.daybar { display: flex; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; align-items: center; background: #fff; padding: 10px 14px; border-radius: var(--radius); box-shadow: var(--shadow); }
.daybar-fields, .daybar-summary { display: flex; gap: 10px 18px; flex-wrap: wrap; align-items: center; }
.inline-field { display: inline-flex; align-items: center; gap: 8px; }
.inline-field > span:first-child { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
input[type=date], input[type=text], input[type=number], select, textarea {
  padding: 6px 8px; border: 1px solid var(--line-strong); border-radius: 7px; background: #fff; max-width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
input[type=range] { accent-color: var(--accent); width: 90px; }
input[type=color] { width: 48px; height: 32px; padding: 2px; border: 1px solid var(--line-strong); border-radius: 7px; background: #fff; }
.time-picker { display: inline-flex; align-items: center; gap: 2px; }
.time-picker select { padding: 5px 4px; }
.time-picker.disabled { opacity: .5; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; background: var(--bg); font-size: 12.5px; }
.chip.danger { background: #fde8e8; color: var(--danger); font-weight: 600; }
.chip.warn { background: #fff1d6; color: var(--warn); font-weight: 600; }

.rooms-bar { display: flex; gap: 8px 10px; flex-wrap: wrap; align-items: center; }
.rooms-title { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; cursor: help; }
.room-chip { display: inline-flex; align-items: center; gap: 2px; padding: 2px 4px 2px 4px; background: #fff; border: 1px solid var(--line-strong); border-radius: 999px; }
.room-name { border: 0; background: none; padding: 3px 8px; cursor: pointer; font-weight: 600; border-radius: 999px; }
.room-name:hover { background: var(--accent-soft); }

.legend { display: flex; gap: 6px 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend-item { display: inline-flex; align-items: center; gap: 5px; }
.legend-item i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); }

/* ---- timeline ---- */
.timeline { position: relative; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding-bottom: 8px; }
.tl-head { position: sticky; top: var(--topbar-h); z-index: 20; display: flex; background: #fff; border-bottom: 1px solid var(--line-strong); border-radius: var(--radius) var(--radius) 0 0; }
.axis-spacer { width: 64px; flex: none; }
.lane-heads { flex: 1; display: flex; min-width: 0; }
.lane-head { flex: 1 1 0; min-width: 0; padding: 10px 8px; text-align: center; font-weight: 700; color: var(--accent-dark); border-left: 1px solid var(--line); cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lane-head:hover { background: var(--accent-soft); }
.tl-body { position: relative; margin-top: 8px; }
.axis { position: absolute; left: 0; top: 0; bottom: 0; width: 64px; }
.axis-label { position: absolute; right: 8px; font-size: 11.5px; color: var(--muted); transform: translateY(-50%); background: #fff; padding: 0 2px; }
.axis-label:first-child { transform: translateY(-2px); }
.lanes {
  position: relative; margin-left: 64px; height: 100%; display: flex;
  background-image: linear-gradient(to bottom, var(--line-strong) 1px, transparent 1px), linear-gradient(to bottom, var(--line) 1px, transparent 1px);
  background-size: 100% var(--hour), 100% calc(var(--hour) / 2);
}
.lane { flex: 1 1 0; min-width: 0; position: relative; border-left: 1px solid var(--line); }
.lane:first-child { border-left: 0; }
.span-layer { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.span-layer .block { pointer-events: auto; }
.tl-empty { position: absolute; left: 80px; right: 16px; top: 90px; display: flex; gap: 8px; align-items: center; justify-content: center; padding: 18px; border: 2px dashed var(--line-strong); border-radius: 12px; color: var(--muted); background: rgba(255, 255, 255, .85); pointer-events: none; z-index: 3; }

.block {
  position: absolute; left: 4px; right: 4px; padding: 4px 8px 6px; overflow: hidden; cursor: grab; user-select: none; touch-action: none;
  font-size: 12.5px; line-height: 1.25; border-radius: 8px;
  background: color-mix(in srgb, var(--c) 15%, #fff); border: 1px solid color-mix(in srgb, var(--c) 38%, #fff); border-left: 5px solid var(--c);
}
.block:hover, .block:focus-within { z-index: 6; box-shadow: 0 3px 12px rgba(20, 24, 40, .2); overflow: visible; }
.block.fixed { border-style: solid; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 30%, transparent); }
.block.all { background: color-mix(in srgb, var(--c) 17%, #fff); }
.b-head { display: flex; gap: 6px; align-items: center; color: color-mix(in srgb, var(--c) 55%, #1d2230); font-weight: 600; font-size: 11.5px; }
.b-dur { margin-left: auto; font-weight: 400; opacity: .8; padding-right: 4px; }
.b-title { font-weight: 650; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; }
.b-meta { color: var(--muted); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.b-alert { display: flex; align-items: flex-start; gap: 5px; margin-top: 3px; font-size: 11.5px; font-weight: 600; color: var(--danger); }
.block.warn .b-alert { color: var(--warn); }
.block.compact { padding-top: 2px; padding-bottom: 2px; display: flex; gap: 8px; align-items: center; }
.block.compact .b-head { flex: none; }
.block.compact .b-title { font-size: 12.5px; white-space: nowrap; }
.b-actions { position: absolute; top: 2px; right: 2px; display: flex; gap: 1px; opacity: 0; padding: 1px; background: rgba(255, 255, 255, .95); border-radius: 7px; box-shadow: 0 1px 4px rgba(0, 0, 0, .15); }
.block:hover .b-actions, .block:focus-within .b-actions, .block.flagged .b-actions { opacity: 1; }
.b-resize { position: absolute; left: 0; right: 0; bottom: 0; height: 7px; cursor: ns-resize; }
.b-resize::after { content: ""; position: absolute; left: 50%; bottom: 2px; width: 26px; height: 3px; margin-left: -13px; border-radius: 2px; background: var(--c); opacity: 0; }
.block:hover .b-resize::after { opacity: .5; }

.block.flagged {
  background-color: #fde8e8; border-color: var(--danger); border-left-color: var(--danger);
  background-image: repeating-linear-gradient(135deg, rgba(198, 40, 40, .09) 0 8px, transparent 8px 16px);
  box-shadow: 0 0 0 2px rgba(198, 40, 40, .25);
}
.block.flagged .b-head, .block.flagged .b-title { color: var(--danger); }
.block.warn {
  border-color: #e0a000; border-left-color: #e0a000; background-color: #fff6df;
  background-image: repeating-linear-gradient(135deg, rgba(224, 160, 0, .12) 0 8px, transparent 8px 16px);
}
.block.dragged { opacity: .3; }
.block.placeholder { z-index: 8; pointer-events: none; background: color-mix(in srgb, var(--accent) 14%, transparent); border: 2px dashed var(--accent); border-left-width: 2px; }
.block.placeholder .b-head { color: var(--accent-dark); }

.ghost {
  display: flex; flex-direction: column; padding: 8px 12px; min-width: 150px; max-width: 260px; pointer-events: none;
  background: color-mix(in srgb, var(--c) 18%, #fff); border: 1px solid var(--c); border-left: 5px solid var(--c); border-radius: 8px; box-shadow: 0 10px 30px rgba(20, 24, 40, .3); font-size: 13px;
}
.ghost span { font-size: 11.5px; color: var(--muted); }
.drag-ghost { position: fixed; z-index: 1000; pointer-events: none; }
body.dragging { cursor: grabbing; user-select: none; }
body.dragging * { cursor: grabbing !important; }

.footer { display: flex; justify-content: center; align-items: center; gap: 6px; padding: 18px 20px 28px; color: var(--muted); font-size: 12.5px; }

/* ---- tooltip & toast ---- */
.tooltip { position: fixed; z-index: 2000; max-width: 300px; padding: 8px 11px; border-radius: 8px; background: #1d2230; color: #fff; font-size: 12.5px; line-height: 1.4; box-shadow: 0 6px 20px rgba(0, 0, 0, .3); pointer-events: none; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); z-index: 2100; padding: 10px 18px; border-radius: 10px; background: #1d2230; color: #fff; opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; max-width: 90vw; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); }

/* ---- modal & forms ---- */
.modal-backdrop { position: fixed; inset: 0; z-index: 500; display: grid; place-items: center; padding: 16px; background: rgba(20, 24, 40, .45); }
.modal { width: min(620px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; background: #fff; border-radius: 14px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.modal.small { width: min(440px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 17px; }
.modal-body { padding: 16px 18px; overflow: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; padding: 12px 18px; border-top: 1px solid var(--line); }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span:first-child { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.field.wide, .check.wide { grid-column: 1 / -1; }
.field-row { display: contents; }
.field input[type=text], .field input[type=number], .field select, .field textarea { width: 100%; }
.with-btn { display: flex; gap: 4px; align-items: center; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.fixed-host { margin-top: 6px; }
.segmented { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; width: max-content; }
.segmented button { padding: 7px 14px; border: 0; background: #fff; cursor: pointer; }
.segmented button.on { background: var(--accent); color: #fff; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px 6px 8px; border: 2px solid var(--line-strong); border-radius: 999px; background: #fff; cursor: pointer; }
.swatch i { width: 18px; height: 18px; border-radius: 50%; background: var(--sw); }
.swatch.on { border-color: var(--sw); font-weight: 600; }
.logo-setting { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.logo-setting img { max-height: 44px; max-width: 160px; border: 1px solid var(--line); border-radius: 6px; padding: 4px; background: #fff; }
.logo-none { color: var(--muted); }

@media (max-width: 1000px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; max-height: none; }
  .topbar { flex-wrap: wrap; height: auto; padding: 8px 12px; gap: 8px; --topbar-h: 0px; position: static; }
  .tl-head { top: 0; }
  .form { grid-template-columns: 1fr; }
  .brand-name { display: none; }
}
@media print {
  .topbar, .sidebar, .tabs, .daybar, .rooms-bar, .footer { display: none; }
}

/* ---- presentation mode ---- */
.presenting-bar { gap: 20px; }
.present-title { flex: 1; min-width: 0; font-size: 24px; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layout.presenting { grid-template-columns: minmax(0, 1fr); }
.present-date { font-size: 18px; }
body.presenting .b-title { font-size: 14.5px; }
