/* Eva Calendar — layout & components. Colors/fonts come from css/themes.css. */

* { box-sizing: border-box; }

/* author display rules below must not defeat the hidden attribute */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
}

html { background: var(--bg); }

body {
  font-family: var(--font-body);
  background: transparent;
  color: var(--text);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

/* ambient aurora: slow-drifting accent-tinted glows behind everything */
body::before {
  content: "";
  position: fixed;
  inset: -30%;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(38% 30% at 18% 28%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%),
    radial-gradient(32% 34% at 82% 18%, color-mix(in srgb, var(--ev-aqua) 14%, transparent), transparent 70%),
    radial-gradient(44% 38% at 60% 88%, color-mix(in srgb, var(--ev-indigo) 11%, transparent), transparent 70%);
  animation: aurora 48s ease-in-out infinite alternate;
}

@keyframes aurora {
  0%   { transform: translate(0, 0) rotate(0deg) scale(1); }
  50%  { transform: translate(2.5%, -2%) rotate(1.5deg) scale(1.06); }
  100% { transform: translate(-2.5%, 2%) rotate(-1.5deg) scale(1.02); }
}

/* ---------- top bar ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  padding-top: calc(10px + env(safe-area-inset-top));
  border-bottom: 1px solid var(--line-soft);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  z-index: 20;
}

.topbar-left, .topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.month-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 600;
  margin: 0 0 0 8px;
  letter-spacing: .01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.month-title .year { color: var(--text-faint); font-weight: 400; }

/* ---------- buttons & inputs ---------- */

.btn {
  font: inherit;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .08s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.96); }

.btn-accent {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
}
.btn-accent:hover { background: var(--accent); filter: brightness(1.08); }

.btn-ghost { border-color: transparent; background: transparent; color: var(--text-soft); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.btn-danger { color: #c0392b; border-color: currentColor; background: transparent; }
[data-theme="abyss"] .btn-danger, [data-theme="nocturne"] .btn-danger { color: #e07b6f; }

.icon-btn {
  font: inherit;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-soft);
  font-size: 1.15rem;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

input[type="text"], input[type="password"], input[type="date"], input[type="time"],
textarea, select {
  font: inherit;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  width: 100%;
}
input:focus, textarea:focus, select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: transparent;
}
input:disabled { opacity: .45; }

label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: .92rem;
  color: var(--text-soft);
}

.hint { color: var(--text-faint); font-size: .8rem; font-weight: 400; }

/* ---------- sync dot ---------- */

.sync-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-faint);
  flex: none;
  transition: background .3s;
}
.sync-dot[data-state="synced"]  { background: #35b88a; }
.sync-dot[data-state="pending"] { background: #e0a63f; }
.sync-dot[data-state="offline"] { background: var(--text-faint); }
.sync-dot[data-state="error"]   { background: #d05548; }

/* ---------- theme menu ---------- */

.ver-badge {
  font-size: .68rem;
  color: var(--text-faint);
  font-weight: 500;
  letter-spacing: .03em;
  flex: none;
}
.theme-menu-wrap { position: relative; }
#theme-btn { color: var(--accent); }

.theme-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 50;
  min-width: 150px;
  animation: panel-in .18s ease;
}

.theme-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
}
.theme-option:hover { background: var(--surface-2); }
.theme-option.active { background: var(--accent-soft); }
.theme-option .dot {
  width: 14px; height: 14px; border-radius: 50%;
  border: 1px solid rgba(0,0,0,.15);
  flex: none;
}

/* ---------- layout ---------- */

.layout {
  flex: 1;
  display: flex;
  min-height: 0;
  position: relative;
}

.calendar {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 14px;
  padding-bottom: calc(14px + env(safe-area-inset-bottom));
  overflow-y: auto;               /* rows grow with content; the month scrolls */
}

.weekday-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  padding: 0 2px 6px;
  color: var(--text-faint);
  font-size: .82rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  text-align: center;
}

.month-grid {
  /* grow to fill a sparse month, but NEVER shrink below content height —
     a definite (compressed) grid height makes the browser squash rows
     instead of growing them; overflow scrolls in .calendar instead */
  flex: 1 0 auto;
  display: grid;
  /* columns are fixed equal sevenths — content can never widen a cell */
  grid-template-columns: repeat(7, minmax(0, 1fr));
  /* rows have a comfortable floor and grow as far as their content needs */
  grid-auto-rows: minmax(clamp(96px, 15.5vh, 150px), auto);
  gap: 6px;
}
.month-grid.turn-left  { animation: grid-from-right .26s ease; }
.month-grid.turn-right { animation: grid-from-left .26s ease; }

.day-cell {
  position: relative;
  background: color-mix(in srgb, var(--surface) 88%, transparent);  /* aurora glows through */
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  padding: 5px 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  /* no min-height:0 here — the natural minimum is what makes the row grow */
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, background .15s, transform .15s;
}
.day-cell:hover { border-color: var(--accent); box-shadow: var(--shadow-soft); }
.day-cell.other-month { background: transparent; border-color: transparent; }
.day-cell.other-month .day-num { color: var(--text-faint); opacity: .55; }

/* live drop target while dragging a note */
.day-cell.drop-target {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow-soft);
  transform: scale(1.03);
}
.board-surface.drop-target { box-shadow: inset 0 0 0 3px var(--accent); }

.day-num {
  font-size: .95rem;
  font-weight: 600;
  color: var(--text-soft);
  align-self: flex-end;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  flex: none;
}
.day-cell.today .day-num {
  background: var(--today);
  color: var(--on-accent);
}

/* everything renders in full — the row stretches, nothing hides or scrolls away */
.day-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

/* event chip inside a day cell: full details, nothing truncated.
   Solid event color everywhere — single-day and spans look the same. */
.chip {
  position: relative;                 /* anchors the edge-resize handles */
  font-size: .95rem;
  line-height: 1.3;
  padding: 4px 9px;
  border-radius: 6px;
  background: var(--ev, var(--accent));
  color: #fff;
  flex: none;
  touch-action: none;
  transition: opacity .45s ease;
}
.chip .chip-main {
  display: flex;
  align-items: center;
  flex-wrap: wrap;              /* narrow cells: title drops below the time */
  gap: 2px 5px;
  min-width: 0;
}
.chip .chip-title { font-weight: 600; overflow-wrap: break-word; min-width: 3ch; }
.chip .chip-time {
  color: rgba(255, 255, 255, .85);
  font-variant-numeric: tabular-nums;
  font-size: .82rem;
  flex: none;
}
.chip .chip-meta {
  font-size: .8rem;
  color: rgba(255, 255, 255, .8);   /* place, people, details read quieter */
  line-height: 1.35;
  overflow-wrap: anywhere;
  margin-top: 1px;
}
/* multi-day span bars: same solid color, flat-edged where the bar continues */
.chip.span { font-weight: 600; }
.chip.span-start { border-radius: 9px 0 0 9px; margin-right: -7px; }
.chip.span-mid   { border-radius: 0; margin-left: -7px; margin-right: -7px; }
.chip.span-end   { border-radius: 0 9px 9px 0; margin-left: -7px; }
.chip.span-mid:not(:has(.chip-main))::after,
.chip.span-end:not(:has(.chip-main))::after { content: "\00a0"; }

/* edge-resize handles: drag to move the start (left) or end (right) date */
.ev-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 20px;
  cursor: ew-resize;
  touch-action: none;
}
.ev-handle.left  { left: -6px; }
.ev-handle.right { right: -6px; }
.ev-handle::after {
  content: "";
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  height: 62%;
  max-height: 18px;
  width: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, .9);   /* chips are solid — grips read white */
  opacity: 0;
  transition: opacity .15s;
}
.ev-handle.left::after  { left: 7px; }
.ev-handle.right::after { right: 7px; }
.chip:hover .ev-handle::after { opacity: .5; }
.ev-handle:hover::after { opacity: 1; }

/* days covered by the event while an edge is being dragged */
.day-cell.resize-range {
  border-color: var(--accent);
  background: var(--accent-soft);
}
body.resizing-ev, body.resizing-ev * { cursor: ew-resize !important; }

/* stickies inside a month-grid day cell: board-width paper that sits exactly
   where it was dropped (absolute against the cell, may overhang — like the
   board, nothing snaps into a stack) */
.month-notes { display: contents; }      /* stickies position against the cell */
.month-notes .sticky {
  position: absolute;
  z-index: 5;                     /* above the day's chips */
  max-width: calc(100% - 6px);    /* text wraps by the cell width at most */
  min-height: 0;                  /* board width, but height hugs the text */
  padding: 9px 11px;
}

/* ---------- checkbox items & done state ---------- */

.item-check {
  position: relative;
  width: 18px;
  height: 18px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: -3px;
  margin-right: 6px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--accent) 55%, var(--text-faint));
  background: color-mix(in srgb, var(--surface) 60%, transparent);
  color: var(--on-accent);
  cursor: pointer;
  transition: transform .15s, border-color .15s, background .2s, box-shadow .2s;
}
.item-check svg {
  width: 11px;
  height: 11px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 15;
  stroke-dashoffset: 15;
  transition: stroke-dashoffset .28s ease .06s;   /* tick draws itself in */
}
.item-check:hover {
  transform: scale(1.18);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
}
.item-check.checked {
  background: linear-gradient(135deg, var(--accent), var(--ev-aqua));
  border-color: transparent;
}
.item-check.checked svg { stroke-dashoffset: 0; }

/* click celebration: pop + expanding ring */
.item-check.burst { animation: check-pop .4s cubic-bezier(.2, 1.5, .4, 1); }
.item-check.burst::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  opacity: .8;
  animation: check-ring .5s ease-out forwards;
}
@keyframes check-pop {
  0%   { transform: scale(.6); }
  55%  { transform: scale(1.35); }
  100% { transform: scale(1); }
}
@keyframes check-ring {
  to { transform: scale(2.1); opacity: 0; }
}

.chip .item-check { width: 16px; height: 16px; border-color: rgba(255,255,255,.85); background: transparent; }
.chip .item-check svg { width: 9px; height: 9px; }
.chip .item-check.checked { background: rgba(255,255,255,.92); color: var(--ev); }
.chip .item-check.burst::after { border-color: rgba(255,255,255,.9); }

/* on paper, the checkbox sits inline with the first line of text */
.sticky .item-check {
  border-color: rgba(0, 0, 0, .45);
  background: rgba(255, 255, 255, .25);   /* clearly hollow until checked */
  color: #fff;
}
.sticky .item-check.checked {
  background: linear-gradient(135deg, var(--accent), var(--ev-aqua));
  border-color: transparent;
}

/* checked-off items dim and their strike fades in (never snaps) */
.chip-title, .sticky-text, .day-item-event .t {
  text-decoration-line: line-through;
  text-decoration-thickness: 1.6px;
  text-decoration-color: transparent;
  transition: text-decoration-color .45s ease .12s, opacity .45s ease;
}
.chip.done, .day-item-event.done { opacity: .55; }
.chip.done .chip-title, .day-item-event.done .t { text-decoration-color: currentColor; }
.sticky.done { opacity: .65; }
.sticky.done .sticky-text { text-decoration-color: currentColor; opacity: .75; }

/* the whole item does a little squash-and-recover when its box is clicked */
.check-settle { animation: item-settle .5s cubic-bezier(.3, 1.4, .5, 1); }
@keyframes item-settle {
  0%   { transform: scale(1)    rotate(var(--tilt, 0deg)); }
  40%  { transform: scale(.94)  rotate(var(--tilt, 0deg)); }
  100% { transform: scale(1)    rotate(var(--tilt, 0deg)); }
}

/* ---------- board ---------- */

.board {
  width: min(380px, 34vw);
  flex: none;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--line);
  background: var(--bg-deep);
}

.board-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--surface);
}
.board-head h2 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  margin: 0;
  flex: 1;
}
.board-head .board-month { color: var(--accent); font-size: .92em; }

.board-surface {
  flex: 1;
  position: relative;
  overflow: auto;
  background: var(--board-bg);
  transition: box-shadow .15s;
}
.board-surface .board-inner {
  position: relative;
  min-width: 100%;
  min-height: 100%;
  width: 700px;
  height: 900px;
}

/* full sticky note (board + day panel) */
.sticky {
  position: relative;                 /* anchors the corner checkbox */
  background: var(--nc, var(--note-lemon));
  color: var(--note-ink);
  padding: 14px 12px 12px;
  width: 168px;
  min-height: 96px;
  border-radius: 2px 10px 3px 9px;
  border: 1px solid rgba(0,0,0,.13);
  box-shadow: var(--shadow);
  font-size: 1rem;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
  cursor: grab;
  user-select: none;
  touch-action: none;
  transform: rotate(var(--tilt, -1deg));
  transition: box-shadow .2s, transform .2s, opacity .45s ease;
}
.sticky:hover { box-shadow: var(--shadow), 0 6px 18px rgba(0,0,0,.12); }
.board-surface .sticky { position: absolute; }

.sticky.font-hand { font-family: var(--font-hand); font-size: 1.08rem; }

.sticky.paper-lined {
  background-image: repeating-linear-gradient(0deg, transparent 0 19px, rgba(0,0,0,.09) 19px 20px);
  background-position: 0 6px;
}
.sticky.paper-grid {
  background-image:
    repeating-linear-gradient(0deg, transparent 0 15px, rgba(0,0,0,.07) 15px 16px),
    repeating-linear-gradient(90deg, transparent 0 15px, rgba(0,0,0,.07) 15px 16px);
}

/* ---------- drag & drop ---------- */

.drag-ghost {
  position: fixed;
  z-index: 300;
  pointer-events: none;
  margin: 0;
  transform: rotate(calc(2deg + var(--sway, 0deg))) scale(1.07);
  box-shadow: 0 18px 40px rgba(0, 0, 0, .3);
  transition: transform .18s ease-out;
}
.drag-ghost.returning {
  transition: left .28s cubic-bezier(.2, .9, .3, 1.2), top .28s cubic-bezier(.2, .9, .3, 1.2),
              transform .28s, opacity .28s;
  transform: rotate(0deg) scale(.6);
  opacity: .4;
}
.drag-source { opacity: .3; }
body.dragging-note, body.dragging-note * { cursor: grabbing !important; }

/* long-press clone: a copy pops out under the pointer, the original stays put */
.drag-ghost.cloning { animation: clone-pop .25s cubic-bezier(.3, 1.4, .5, 1); }
@keyframes clone-pop {
  from { transform: rotate(0deg) scale(.85); opacity: .5; }
  to   { transform: rotate(2deg) scale(1.07); opacity: 1; }
}
.clone-badge {
  position: absolute;
  top: -9px;
  right: -9px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .78rem;
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: var(--shadow-soft);
  pointer-events: none;
}
/* a clone released nowhere useful evaporates */
.drag-ghost.dissolving {
  transition: opacity .2s ease, transform .2s ease;
  opacity: 0;
  transform: rotate(0deg) scale(.75);
}

/* after the drop, the ghost relaxes its lift/rotation onto the real item */
.drag-ghost.settling {
  transition: left .22s cubic-bezier(.2, .8, .3, 1), top .22s cubic-bezier(.2, .8, .3, 1),
              width .22s, transform .18s, box-shadow .18s;
  transform: rotate(0deg) scale(1);
  box-shadow: var(--shadow);
}

/* hold a dragged item at the calendar's top or bottom edge to flip months */
.flip-zone {
  position: fixed;
  z-index: 250;                    /* under the ghost, over the grid */
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .82rem;
  font-weight: 600;
  letter-spacing: .05em;
  color: var(--accent);
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s;
}
.flip-zone.top    { background: linear-gradient(to bottom, color-mix(in srgb, var(--accent) 20%, transparent), transparent); }
.flip-zone.bottom { background: linear-gradient(to top,    color-mix(in srgb, var(--accent) 20%, transparent), transparent); }
body.dragging-note .flip-zone, body.resizing-ev .flip-zone { opacity: 1; }
.flip-zone.armed { animation: zone-pulse .6s ease infinite; }
@keyframes zone-pulse { 50% { opacity: .45; } }

/* ---------- animations ---------- */

@keyframes pop-in {
  from { opacity: 0; transform: scale(.5) rotate(-5deg); }
  60%  { transform: scale(1.06) rotate(1deg); }
  to   { opacity: 1; }
}
.anim-in { animation: pop-in .32s cubic-bezier(.2, .9, .3, 1.2); }

.anim-out {
  transition: opacity .18s ease, transform .18s ease;
  opacity: 0 !important;
  transform: scale(.55) rotate(4deg) !important;
}

@keyframes grid-from-right { from { opacity: 0; transform: translateX(26px); } }
@keyframes grid-from-left  { from { opacity: 0; transform: translateX(-26px); } }

/* dialogs bounce in with a little overshoot, and slide away on close */
@keyframes panel-in {
  from { opacity: 0; transform: translateY(22px) scale(.92); }
  55%  { opacity: 1; transform: translateY(-5px) scale(1.015); }
  to   { transform: translateY(0) scale(1); }
}
@keyframes panel-out {
  to { opacity: 0; transform: translateY(16px) scale(.94); }
}
@keyframes overlay-in  { from { opacity: 0; } }
@keyframes overlay-out { to   { opacity: 0; } }

.overlay.closing { animation: overlay-out .19s ease forwards; }
.overlay.closing .panel { animation: panel-out .19s ease forwards; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- overlays & panels ---------- */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 24, 28, .38);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
  animation: overlay-in .18s ease;
}

.panel {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: min(460px, 100%);
  max-height: min(86vh, 700px);
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: panel-in .22s cubic-bezier(.2, .9, .3, 1.1);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.panel-head h2 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  margin: 0;
}

.panel-foot { display: flex; align-items: center; gap: 10px; }
.spacer { flex: 1; }

.field-row { display: flex; gap: 10px; }
.field-row label { flex: 1; min-width: 0; white-space: nowrap; }
.check-label { flex-direction: row; align-items: center; gap: 6px; padding-bottom: 8px; white-space: nowrap; }
.check-label input { width: auto; }
/* "Add a checkbox" lives in the editor's top bar, next to the close button */
.head-check {
  margin-left: auto;
  padding-bottom: 0;
  font-size: .88rem;
  color: var(--text-soft, var(--text));
  cursor: pointer;
}

/* color swatches */
.swatch-row { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  transition: transform .12s;
}
.swatch:hover { transform: scale(1.15); }
.swatch.selected { border-color: var(--text); box-shadow: 0 0 0 2px var(--surface) inset; transform: scale(1.08); }

/* note editor live preview */
#editor-note-preview { border-radius: var(--radius-sm); }
#editor-note-preview textarea {
  background: var(--nc, var(--note-lemon));
  color: var(--note-ink);
  border: none;
  border-radius: 2px 10px 3px 9px;
  box-shadow: var(--shadow-soft);
  padding: 14px 12px;
  min-height: 110px;
  transition: background-color .35s ease;   /* swatch picks melt into the paper */
}

/* ---------- day panel ---------- */

.day-panel { gap: 14px; }

.day-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 30px;
}
.day-items .empty { color: var(--text-faint); font-size: .9rem; text-align: center; padding: 8px 0; }

.day-item-event {
  display: flex;
  gap: 10px;
  padding: 9px 12px;
  background: var(--surface-2);
  border-left: 4px solid var(--ev, var(--accent));
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .15s, opacity .45s ease;
}
.day-item-event:hover { background: var(--accent-soft); }
.day-item-event .when {
  font-variant-numeric: tabular-nums;
  color: var(--text-soft);
  font-size: .82rem;
  min-width: 68px;
  padding-top: 2px;
  flex: none;
}
.day-item-event .what { min-width: 0; }
.day-item-event .what .t { font-weight: 600; }
.day-item-event .what .meta { color: var(--text-soft); font-size: .82rem; margin-top: 2px; }

.day-notes { display: flex; flex-wrap: wrap; gap: 10px; }
.day-notes .sticky { width: calc(50% - 5px); cursor: pointer; }

.quick-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.kind-toggle {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px;
  flex: none;
}
.kind-pill {
  font: inherit;
  font-size: .85rem;
  padding: 4px 12px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  transition: background .18s, color .18s;
}
.kind-pill.active {
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
}

.quick-note-row { display: flex; gap: 8px; margin-top: 6px; }
.quick-note-row input { flex: 1; }

/* ---------- mobile: calendar on top, board below ---------- */

@media (max-width: 760px) {
  body { overflow: auto; }
  .topbar { padding-left: 8px; padding-right: 8px; gap: 4px; }
  .topbar-left, .topbar-right { gap: 2px; }
  .topbar-left { flex: 1; min-width: 0; }
  .month-title { font-size: 1.02rem; margin-left: 4px; }
  .btn { padding: 6px 9px; }
  .icon-btn { width: 30px; height: 30px; }

  .layout { flex-direction: column; }
  .calendar { height: calc(72vh - 56px); flex: none; padding: 8px; }
  .month-grid { gap: 3px; }
  .day-cell { padding: 3px 4px; border-radius: 6px; }
  .day-num { width: 20px; height: 20px; font-size: .72rem; align-self: center; }
  .chip { font-size: 0; padding: 0; height: 5px; border-radius: 3px; border-left: none;
          background: var(--ev, var(--accent)); }
  .chip.span-start, .chip.span-mid, .chip.span-end { height: 5px; }
  .chip .chip-time { display: none; }
  .chip .item-check,
  .month-notes .sticky .item-check { display: none; }
  .month-notes { display: flex; flex-wrap: wrap; gap: 2px; }   /* dots in flow */
  .month-notes .sticky { position: static; font-size: 0; padding: 0; width: 14px; height: 14px; border-radius: 3px; min-height: 0; background: var(--nc, var(--note-lemon)); }
  .month-notes .sticky .sticky-text { display: none; }
  .more-count { display: none; }

  .board {
    width: 100%;
    height: 300px;
    flex: none;
    border-left: none;
    border-top: 1px solid var(--line);
  }
  .day-notes .sticky { width: 100%; }
  .field-row { flex-wrap: wrap; }
}
