/* Merkzeit, the Kopfkino calendar: the Kopfkino look (the shared neutrals, Inter, the Kopfkino corner at the top right),
   Merkzeit's own accent: the blue of its icon, only on New event, today and the selection. Classes only (the CSP allows
   no inline styles; positions and colours of events go through the CSSOM).
   Unslop polish (kopfkino-login design/UNSLOP.md §8, 2026-11-23): the shared tokens, radius 10 instead of pills, a
   segmented view switch, sentence case, weights at most 600, one focus ring; the signature is the red now line, the
   only red on the calendar, drawn in the month's today cell too. */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("/static/fonts/Inter-latin-var.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("/static/fonts/Inter-latin-ext-var.woff2") format("woff2");
  unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; }
:root {
  /* the shared Kopfkino base (kopfkino-login design/kopfkino-tokens.css): neutral greys, three text roles */
  --bg: #0a0a0b; --surface: #121214; --raised: #18181b; --hover: #1f1f23;
  --line: rgba(236, 236, 240, .08); --line-hi: rgba(236, 236, 240, .14);
  --text: #ececf0; --muted: #b3b3bb; --dim: #8b8b94; --faint: #6e6e77;
  --accent: #7cc6fe; --accent-hi: #a9daff; --accent-text: #04131f; --accent-rgb: 124, 198, 254;
  --today: #7cc6fe; --danger: #ff6b6b; --negative-text: #ff8a8f; --focus: #ececf0;
  --radius: 12px; --hour: 48px; --r-control: 10px; --r-tag: 6px;
  --ease: cubic-bezier(.22, 1, .36, 1); --t-quick: 140ms; --t-menu: 200ms;
  color-scheme: dark; accent-color: var(--accent);
  font: 14px/1.45 Inter, system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); height: 100%; -webkit-font-smoothing: antialiased; }
@media (prefers-reduced-motion: reduce) { :root { --t-quick: 0ms; --t-menu: 0ms; } }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---- the Kopfkino bar: 64px, the corner 16px from the right (as in every Kopfkino app) ---- */
.bar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px; min-height: 64px; padding: 0 16px 0 8px;
  background: rgba(8, 9, 13, .94); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 9px; padding: 0 10px 0 4px; color: inherit; text-decoration: none;
  font-size: 18px; font-weight: 600; letter-spacing: -.01em; white-space: nowrap; }
.brand img { border-radius: 7px; }
.spacer { flex: 1; }
.ib { display: inline-grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 50%; background: transparent;
  color: var(--muted); cursor: pointer; }
.ib:hover { background: var(--hover); color: var(--text); }
.ib svg { width: 20px; height: 20px; }
#menu { display: none; }
.nav { display: flex; align-items: center; gap: 4px; margin-left: 8px; }
.nav { gap: 8px; }
.nav .today { height: 36px; padding: 0 14px; border: 1px solid var(--line-hi); border-radius: var(--r-control); background: transparent; cursor: pointer; font-weight: 500; }
.nav .today:hover { background: var(--hover); }
.nav h1 { margin: 0 0 0 4px; font-size: 20px; font-weight: 500; letter-spacing: -.01em; white-space: nowrap; }
.views { display: inline-flex; border: 1px solid var(--line-hi); border-radius: var(--r-control); padding: 3px; gap: 2px; background: var(--surface); }
.views button { height: 30px; padding: 0 14px; border: 0; border-radius: var(--r-tag); background: transparent; color: var(--muted); cursor: pointer; font-weight: 500;
  transition: background var(--t-quick) var(--ease), color var(--t-quick) var(--ease); }
.views button:hover { color: var(--text); }
.views button .short { display: none; }   /* (phones: D W M, see the end) */
.views button[aria-pressed="true"] { background: var(--hover); color: var(--text); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06); }
button.primary { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 16px 0 12px; border: 0; border-radius: var(--r-control);
  background: var(--accent); color: var(--accent-text); font-weight: 600; cursor: pointer; white-space: nowrap; transition: background var(--t-quick) var(--ease); }
button.primary:hover { background: var(--accent-hi); }
button.primary svg { width: 18px; height: 18px; }

/* ---- the layout: calendars on the left, the view ---- */
.layout { display: grid; grid-template-columns: 248px minmax(0, 1fr); height: calc(100vh - 64px); height: calc(100dvh - 64px); }
.side { border-right: 1px solid var(--line); padding: 14px 12px; overflow-y: auto; }
main { min-width: 0; overflow: hidden; display: flex; flex-direction: column; }
.mini { margin-bottom: 18px; }
.mini-head { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 6px; font-weight: 600; }
.mini-head .ib { width: 28px; height: 28px; }
.mini-grid { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; font-size: 11.5px; }
.mini-grid .dow { color: var(--dim); padding: 4px 0; }
.mini-grid button { height: 28px; border: 0; border-radius: 50%; background: transparent; cursor: pointer; color: var(--muted); font-size: 11.5px; }
.mini-grid button.in { color: var(--text); }
.mini-grid button:hover { background: var(--hover); }
.mini-grid button.on { box-shadow: inset 0 -1px 0 var(--line-hi); border-radius: 0; }
.mini-grid button.today { background: var(--today); color: var(--accent-text); font-weight: 600; border-radius: 50%; }
.side h2 { font-size: 13px; color: var(--dim); margin: 24px 6px 8px; font-weight: 500; }
.side .cal-row + .cal-row { margin-top: 4px; }
.cal-row { display: flex; align-items: center; gap: 10px; width: 100%; height: 32px; padding: 0 8px; border: 0; border-radius: var(--r-tag); background: transparent;
  cursor: pointer; text-align: left; }
.cal-row:hover { background: var(--hover); }
.cal-row .sw { width: 16px; height: 16px; border-radius: 5px; border: 2px solid var(--c); background: var(--c); flex: none; }
.cal-row.off .sw { background: transparent; }
.cal-row.off .nm { color: var(--dim); }
.cal-row .ro { margin-left: auto; font-size: 12px; color: var(--dim); }
.note { color: var(--muted); font-size: 12.5px; margin: 10px 6px; }
.note.bad { color: var(--negative-text); }

/* ---- month ---- */
.month { flex: 1; display: grid; grid-template-rows: auto repeat(6, minmax(0, 1fr)); min-height: 0; }
.dows { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.dows div { padding: 8px 10px; font-size: 12px; color: var(--dim); font-weight: 500; }
.week-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-bottom: 1px solid var(--line); min-height: 0; }
.cell { position: relative; border-right: 1px solid var(--line); padding: 4px 4px 2px; min-width: 0; overflow: hidden; cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.cell:hover { background: rgba(255, 255, 255, .02); }
/* the signature: the now line in the month's today cell too, at the time of day */
.now-m { position: absolute; left: 0; right: 0; height: 2px; background: var(--danger); opacity: .85; pointer-events: none; }
.cell:nth-child(7n) { border-right: 0; }
.cell .num { align-self: flex-start; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 999px; display: grid; place-items: center;
  font-size: 12.5px; font-weight: 600; color: var(--muted); border: 0; background: transparent; cursor: pointer; }
.cell .num:hover { background: var(--hover); }
.cell.out .num { color: var(--dim); }
.cell.today .num { background: var(--today); color: var(--accent-text); }
.chip { display: flex; align-items: center; gap: 5px; width: 100%; min-height: 21px; padding: 1px 6px; border: 0; border-radius: 6px;
  background: transparent; font-size: 12px; text-align: left; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip:hover { background: var(--hover); }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); flex: none; }
.chip .tm { color: var(--muted); font-variant-numeric: tabular-nums; flex: none; }
.chip .tt { overflow: hidden; text-overflow: ellipsis; }
.chip.allday { background: color-mix(in srgb, var(--c) 26%, transparent); color: var(--text); box-shadow: inset 3px 0 0 var(--c); }
.chip.allday:hover { background: color-mix(in srgb, var(--c) 36%, transparent); }
.more { border: 0; background: transparent; color: var(--muted); font-size: 12px; text-align: left; padding: 0 6px; cursor: pointer; }
.more:hover { color: var(--text); text-decoration: underline; }

/* ---- week and day ---- */
.timed { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.t-head, .t-all { display: grid; grid-template-columns: 56px repeat(var(--n), minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.t-head .d { padding: 8px 8px 6px; text-align: center; cursor: pointer; }
.t-head .d .w { font-size: 12px; line-height: 16px; color: var(--dim); font-weight: 500; }
.t-head .d .n { display: inline-grid; place-items: center; min-width: 36px; height: 36px; border-radius: 50%; font-size: 20px; font-weight: 500; }
.t-head .d.today .n { background: var(--today); color: var(--accent-text); }
.t-all { min-height: 30px; }
.t-all .lab { font-size: 11px; color: var(--dim); padding: 7px 6px 0 0; text-align: right; }
.t-all .slot { border-left: 1px solid var(--line); padding: 2px 3px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.t-scroll { flex: 1; overflow-y: auto; position: relative; }
.t-grid { display: grid; grid-template-columns: 56px repeat(var(--n), minmax(0, 1fr)); position: relative; height: calc(24 * var(--hour)); }
.hours { position: relative; }
.hours span { position: absolute; right: 8px; transform: translateY(-50%); font-size: 11px; color: var(--dim); font-variant-numeric: tabular-nums; }
.col { position: relative; border-left: 1px solid var(--line);
  background: repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--hour) - 1px), var(--line) calc(var(--hour) - 1px), var(--line) var(--hour)); cursor: pointer; }
.col.today { background-color: rgba(var(--accent-rgb), .035); }
.ev { position: absolute; left: 2px; right: 2px; border: 0; border-radius: 7px; padding: 3px 6px; text-align: left; cursor: pointer; overflow: hidden;
  background: color-mix(in srgb, var(--c) 30%, #121214); color: var(--text); box-shadow: inset 3px 0 0 var(--c); font-size: 12px; line-height: 1.3; }
.ev:hover { background: color-mix(in srgb, var(--c) 42%, #121214); z-index: 3; }
.ev .tt { font-weight: 500; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev .tm { color: color-mix(in srgb, var(--text) 75%, transparent); font-variant-numeric: tabular-nums; font-size: 11px; }
.now { position: absolute; left: 0; right: 0; height: 2px; background: var(--danger); z-index: 4; pointer-events: none; }
.now::before { content: ""; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--danger); }

/* ---- the event dialog ---- */
dialog { width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow-x: hidden; padding: 0; border: 1px solid var(--line-hi); border-radius: 16px; background: var(--surface);
  color: var(--text); box-shadow: 0 24px 70px rgba(0, 0, 0, .55); }
dialog::backdrop { background: rgba(0, 0, 0, .55); }
.dlg { display: grid; gap: 14px; padding: 20px 22px 18px; min-width: 0; }
.dlg > *, .dlg .row > *, .dlg .when > * { min-width: 0; }   /* (date and time fields shrink instead of pushing the dialog wide) */
.dlg h2 { margin: 0; font-size: 17px; font-weight: 600; }
.dlg input[type=text], .dlg textarea, .dlg select, .dlg input[type=date], .dlg input[type=time] { width: 100%; font: inherit; padding: 9px 11px;
  border: 1px solid var(--line-hi); border-radius: 10px; background: var(--raised); color: var(--text); min-height: 40px; }
.dlg input.title { font-size: 18px; font-weight: 600; }
.dlg textarea { min-height: 70px; resize: vertical; }
.dlg label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); font-weight: 500; }
.dlg .row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dlg .when { display: grid; grid-template-columns: 1.3fr 1fr; gap: 8px; }
.dlg .check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text); font-weight: 500; }
.dlg .check input { width: 18px; height: 18px; }
.dlg .hint { font-size: 12.5px; color: var(--muted); margin: -4px 0 0; }
.dlg .err { color: var(--negative-text); font-size: 13px; min-height: 1em; margin: 0; }
.dlg .acts { display: flex; gap: 8px; align-items: center; margin-top: 4px; }
.dlg .acts .grow { flex: 1; }
.btn { height: 38px; padding: 0 16px; border: 1px solid var(--line-hi); border-radius: var(--r-control); background: transparent; cursor: pointer; font-weight: 500;
  color: var(--text); transition: background var(--t-quick) var(--ease); }
.btn:hover { background: var(--hover); }
.btn.danger { color: var(--negative-text); border-color: var(--line-hi); }
.dlg .primary { height: 38px; padding: 0 18px; }

/* ---- signing in ---- */
.signin { max-width: 400px; margin: 12vh auto 0; padding: 32px 28px; text-align: center; background: var(--surface); border: 1px solid var(--line);
  border-radius: 18px; }
.signin img { border-radius: 14px; }
.signin h1 { margin: 14px 0 6px; font-size: 28px; font-weight: 600; letter-spacing: -.02em; }
.signin p { color: var(--muted); margin: 0 0 22px; }
.signin .primary { width: 100%; justify-content: center; height: 46px; font-size: 15px; }
.signin .bad { color: var(--negative-text); margin-top: 16px; }

/* ---- phones ---- */
@media (max-width: 860px) {
  .views button { padding: 0 10px; }
  .nav h1 { font-size: 17px; }
  #new .txt { display: none; }
  #new { padding: 0; width: 40px; justify-content: center; }
}
@media (max-width: 720px) {
  .bar { padding: 0 12px 0 4px; gap: 4px; flex-wrap: wrap; }
  #menu { display: inline-grid; }
  .brand span { display: none; }
  .nav { margin-left: 0; order: 10; width: 100%; padding: 0 4px 8px; }
  .layout { grid-template-columns: minmax(0, 1fr); height: auto; min-height: calc(100dvh - 112px); }
  .side { position: fixed; z-index: 30; top: 0; bottom: 0; left: 0; width: 280px; background: var(--surface); transform: translateX(-102%);
    transition: transform .2s; box-shadow: 0 0 40px rgba(0, 0, 0, .5); }
  .side.open { transform: none; }
  main { height: calc(100dvh - 112px); }
  .dows div { padding: 6px 4px; text-align: center; font-size: 10.5px; }
  .chip .tm { display: none; }
  .chip { font-size: 11px; padding: 0 4px; min-height: 18px; }
  .cell .num { min-width: 22px; height: 22px; font-size: 11.5px; }
  .dlg .row { grid-template-columns: 1fr; }
  .views button { padding: 0; width: 34px; }
  .views button .long { display: none; }
  .views button .short { display: inline; }
  .dlg { padding: 16px 14px 14px; }
}

/* ---- to-dos (Merkzettel's, on their due day): a box, ticked when done ---- */
.chip.todo { color: var(--text); }
.chip .tbox { width: 12px; height: 12px; border-radius: 3px; border: 2px solid var(--c); flex: none; }
.chip.todo.done .tbox { background: var(--c); }
.chip.todo.done .tt { text-decoration: line-through; color: var(--dim); }
.dlg .todo-title { font-size: 17px; font-weight: 600; margin: 0; }
.dlg .todo-title.done { text-decoration: line-through; color: var(--dim); }
.dlg a.primary { text-decoration: none; justify-content: center; height: 38px; padding: 0 18px; }

/* 9. motion: a view change fades in over 200ms (no slide); nothing moves with reduced motion */
@keyframes mz-in { from { opacity: 0; } to { opacity: 1; } }
main > * { animation: mz-in var(--t-menu) var(--ease); }
dialog[open] { animation: mz-in var(--t-menu) var(--ease); }
