/* ═══════════════════════════════════════════════════════════════
   FreeShard WebCalendar — Daylight Instrument
   Design system: freeshard-design-guide / "Daylight Instrument"
   Light-first, warm-paper ground. Dark = warm dusk.
   ═══════════════════════════════════════════════════════════════ */

/* ── 1. Design Tokens (light — primary) ───────────────────────────────────── */
:root {
  /* Color */
  --bg:          #f6f4ef;
  --surface:     #fffefb;
  --surface-hover: rgba(0, 0, 0, 0.04);
  --surface-bg-alt: #f0f0f5;
  --border:      #d8d2c6;
  --border-cool: #b7c7cd;
  --ink:         #1d3a45;
  --ink-muted:   #6b7d82;
  --text:        #1d3a45;
  --text-muted:  #6b7d82;
  --line:        #006070;
  --data:        #007080;
  --accent:      #c8761f;
  --danger:      #b04a3a;
  --warning:     #f59e0b;
  --success:     #2e7d32;

  /* Typography */
  --font-ui:   'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;
  --fs-display: 34px; --fw-display: 600;
  --fs-h1: 26px; --fs-h2: 20px; --fs-h3: 16px;
  --fs-body: 15px; --fs-small: 13px;
  --fs-label: 10px; --ls-label: 0.14em;
  --fs-mono: 13px; --ls-mono: 0.06em;

  /* Spacing */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
  --sp-5: 24px; --sp-6: 32px; --sp-7: 48px;

  /* Radius (design guide exact values) */
  --radius-sheet:   14px;
  --radius-card:    12px;
  --radius-tile:    10px;
  --radius-control: 8px;
  --radius-glyph:   7px;
  --radius-sm:      6px;
  --radius-pill:    999px;

  /* Border widths */
  --border-w:       1px;
  --border-w-glyph: 1.5px;

  /* Elevation: NONE. Depth = border + surface tone. */
  --shadow: none;

  /* Sidebar */
  --sidebar-w: 268px;

  /* Transitions */
  --t: 0.15s ease;
  --t-slow: 0.25s ease;
}

/* Dark mode — "warm dusk" */
[data-theme="dark"], .theme-dark {
  color-scheme: dark;
  --bg:          #16140f;
  --surface:     #211d16;
  --surface-hover: rgba(255, 255, 255, 0.06);
  --surface-bg-alt: #29241c;
  --border:      #3a342a;
  --border-cool: #473f31;
  --ink:         #ece4d6;
  --ink-muted:   #a89a82;
  --text:        #ece4d6;
  --text-muted:  #a89a82;
  --line:        #9fd8e6;
  --data:        #9fd8e6;
  --accent:      #f0b35e;
  --danger:      #d8665a;
  --warning:     #fbbf24;
  --success:     #5bb974;
  --glow-live:   0 0 7px var(--data);
}

/* ── 2. Reset & Base ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { height: 100%; font-size: var(--fs-body); }

body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--ink);
  height: 100%;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button {
  font-family: inherit; font-size: inherit;
  cursor: pointer; border: none; background: none; color: inherit;
}
input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
ul { list-style: none; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }

/* #571: a newly deployed version took over the page */
.update-banner {
  position: sticky; top: 0; z-index: 99999;
  display: flex; align-items: center; justify-content: center; gap: var(--sp-3);
  padding: 4px 12px; font-size: 13px;
  background: var(--surface); color: var(--ink); border-bottom: 1px solid var(--border);
}

/* ── 3. Scrollbars ────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-cool); }

/* ── 4. Typography utilities ─────────────────────────────────────────────── */
.fs-label {
  font: 600 var(--fs-label)/1 var(--font-ui);
  text-transform: uppercase; letter-spacing: var(--ls-label);
  color: var(--ink-muted);
}

/* ── 5. Loading Screen ────────────────────────────────────────────────────── */
.loading-screen {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: var(--sp-4);
}
.loading-logo { display: flex; flex-direction: column; align-items: center; gap: var(--sp-3); }
.loading-icon svg { width: 40px; height: 40px; }
.loading-title { font: 600 var(--fs-h3)/1 var(--font-ui); color: var(--ink); }
.loading-spinner {
  width: 20px; height: 20px; border-radius: 50%;
  border: 1.5px solid var(--border-cool);
  border-top-color: var(--data);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── 6. Onboarding ────────────────────────────────────────────────────────── */

/* ── 7. App Shell ─────────────────────────────────────────────────────────── */
.app {
  display: flex; height: 100%;
  background: var(--bg);
}

/* ── 8. Sidebar ───────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: var(--border-w) solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden; /* .sidebar-content scrolls; the footer stays put */
  height: 100%;
  position: relative;
}

.sidebar-header {
  display: flex; align-items: center;
  padding: var(--sp-4) var(--sp-4);
  border-bottom: var(--border-w) solid var(--border);
  gap: var(--sp-3);
}
.sidebar-logo {
  display: flex; align-items: center; gap: var(--sp-2); flex: 1;
}
.sidebar-logo svg { width: 22px; height: 22px; }
.sidebar-logo-name {
  font: 600 var(--fs-h3)/1 var(--font-ui);
  color: var(--line);
}

.sidebar-toggle {
  display: none;
  color: var(--ink-muted); padding: var(--sp-1);
  border-radius: var(--radius-control); transition: color var(--t);
}
.sidebar-toggle:hover { color: var(--ink); }
.sidebar-toggle svg { width: 18px; height: 18px; display: block; }

/* Sidebar sections */
.sidebar-section { padding: var(--sp-4) var(--sp-3); }
.sidebar-section + .sidebar-section { border-top: var(--border-w) solid var(--border); }

.sidebar-section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--sp-2);
}
.sidebar-section-title {
  font: 600 var(--fs-label)/1 var(--font-ui);
  text-transform: uppercase; letter-spacing: var(--ls-label);
  color: var(--ink-muted);
}

/* Mini add button */
.icon-btn {
  display: flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
  border-radius: var(--radius-control);
  color: var(--ink-muted); transition: all var(--t);
  border: var(--border-w) solid transparent;
}
.icon-btn:hover {
  color: var(--line);
  border-color: var(--border-cool);
  background: var(--bg);
}
.icon-btn svg { width: 13px; height: 13px; display: block; }

/* Mini calendar */
#mini-calendar { padding: 0 var(--sp-1); }

.mini-cal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--sp-2);
}
.mini-cal-title {
  font: 500 var(--fs-small)/1 var(--font-ui);
  color: var(--ink);
}
.mini-cal-nav {
  display: flex; align-items: center; gap: 4px;
}
.mini-cal-nav button {
  display: flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: var(--radius-control);
  color: var(--ink-muted); transition: all var(--t);
  cursor: pointer; font-size: 14px;
}
.mini-cal-nav button:hover {
  color: var(--ink); background: var(--bg);
}

.mini-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; }
.mini-cal-dow {
  font: 600 9px/1 var(--font-ui);
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--ink-muted); text-align: center;
  padding: var(--sp-1) 0;
}
.mini-cal-day {
  aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center;
  font: 400 11px/1 var(--font-ui);
  color: var(--ink-muted);
  border-radius: var(--radius-control);
  cursor: pointer; transition: all var(--t);
  position: relative;
}
.mini-cal-day:hover { background: var(--bg); color: var(--ink); }
.mini-cal-day:focus-visible,
.sidebar-task-info:focus-visible { outline: 2px solid var(--line); outline-offset: 1px; }
.mini-cal-day.today {
  font-weight: 600; color: var(--data);
}
.mini-cal-day.selected {
  background: var(--data); color: var(--surface); font-weight: 600;
}
.mini-cal-day.has-events::after {
  content: '';
  position: absolute; bottom: 2px; left: 50%; transform: translateX(-50%);
  width: 3px; height: 3px; border-radius: 50%;
  background: var(--accent);
}
.mini-cal-day.other-month { color: var(--ink-muted); opacity: 0.75; }
/* #517: the days the main view shows, and the ISO week column */
.mini-cal-day.in-range:not(.selected) { background: color-mix(in srgb, var(--data) 12%, var(--surface)); color: var(--ink); }
.mini-cal-grid.with-weeks { grid-template-columns: auto repeat(7, 1fr); }
.mini-cal-week {
  display: flex; align-items: center; justify-content: center;
  padding-right: var(--sp-1);
  font: 400 9px/1 var(--font-mono);
  color: var(--ink-muted);
}

/* Calendar list */
#calendar-list { display: flex; flex-direction: column; gap: 1px; }

/* #496: a linked account's calendars are grouped under the account's name */
.calendar-group-label {
  font-size: 0.7rem; font-weight: 600; color: var(--ink-muted);
  padding: var(--sp-2) var(--sp-2) 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.calendar-item {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: 5px var(--sp-2);
  border-radius: var(--radius-control);
  cursor: pointer; transition: all var(--t);
  user-select: none;
}
.calendar-item:hover { background: var(--bg); }
/* #504: reordering by a pointer drag */
.calendar-item.dragging { opacity: 0.5; position: relative; z-index: 1; }
.calendar-item.drop-before { box-shadow: inset 0 2px 0 var(--accent); }
.calendar-item.drop-after { box-shadow: inset 0 -2px 0 var(--accent); }
/* #573: the grip drags the entry by touch (only there, so the rest of it still scrolls the
   sidebar) and opens the "Nach oben" / "Nach unten" menu when tapped. Shown on hover with a
   mouse, always on a phone, where it is a 44 px target. */
.sidebar-order-handle {
  width: 24px; min-height: 24px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-muted); border-radius: var(--radius-glyph);
  cursor: grab; touch-action: none;
  opacity: 0; transition: opacity var(--t);
}
.calendar-item:hover .sidebar-order-handle,
.sidebar-order-handle:focus-visible,
.sidebar-order-handle[aria-expanded="true"] { opacity: 1; }
@media (max-width: 768px), (pointer: coarse) {
  .sidebar-order-handle { width: 44px; height: 44px; margin: -5px 0; opacity: 1; }
}

/* Action buttons that appear on hover */
.cal-item-actions {
  display: flex; gap: 2px;
  margin-left: auto;
  opacity: 0; transition: opacity var(--t);
  flex-shrink: 0;
}
.calendar-item:hover .cal-item-actions { opacity: 1; }

.cal-action-btn {
  width: 24px; height: 24px; min-width: 24px; min-height: 24px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-glyph); color: var(--ink-muted);
  transition: all var(--t); flex-shrink: 0;
}
.cal-action-btn:hover { background: var(--border); color: var(--ink); }
.cal-action-btn.cal-action-delete:hover { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.cal-action-btn svg { width: 11px; height: 11px; display: block; }
/* #518: a task list whose due tasks are kept out of the calendar says so without a hover */
.cal-action-btn[data-tasks-in-cal][aria-pressed="false"] { color: var(--ink-faint, var(--ink-muted)); }
.calendar-item:has(.cal-action-btn[data-tasks-in-cal][aria-pressed="false"]) .cal-item-actions { opacity: 1; }
.cal-action-btn[data-tasks-in-cal][aria-pressed="false"] svg { opacity: 0.45; }

.calendar-dot { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }
.calendar-name { font-size: var(--fs-small); color: var(--ink); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* #614: a disconnected mirror says where it came from. */
.calendar-former-link { font-size: 0.65rem; color: var(--ink-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.calendar-check {
  width: 14px; height: 14px; flex-shrink: 0;
  border: var(--border-w-glyph) solid var(--border-cool);
  border-radius: 4px; background: transparent;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--t); margin-left: auto;
}
.calendar-item.checked .calendar-check { border-color: transparent; }
.calendar-check-icon { display: none; }
.calendar-item.checked .calendar-check-icon { display: block; }

/* Account list */
#account-list { display: flex; flex-direction: column; gap: 1px; }


/* Sidebar new-event button */
.sidebar-new-btn {
  margin: 0 var(--sp-3) var(--sp-4);
  display: flex; align-items: center; justify-content: center; gap: var(--sp-2);
  padding: 9px var(--sp-4);
  border: var(--border-w) solid var(--accent);
  border-radius: var(--radius-control);
  font: 500 var(--fs-small)/1 var(--font-ui);
  color: var(--accent);
  background: transparent;
  cursor: pointer; transition: all var(--t);
  width: calc(100% - var(--sp-6));
}
.sidebar-new-btn:hover {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}
.sidebar-new-btn svg { width: 14px; height: 14px; display: block; }
.sidebar-secondary-btn {
  display: flex; align-items: center; justify-content: center; gap: var(--sp-2);
  padding: 9px var(--sp-4);
  border: var(--border-w) solid var(--border-cool);
  border-radius: var(--radius-control);
  font: 500 var(--fs-small)/1 var(--font-ui);
  color: var(--ink);
  background: var(--surface-hover);
  cursor: pointer; transition: all var(--t);
}
.sidebar-secondary-btn:hover {
  background: var(--bg);
  border-color: var(--ink-muted);
}
.sidebar-secondary-btn svg { width: 14px; height: 14px; display: block; }

/* ── 9. Toolbar ───────────────────────────────────────────────────────────── */
.toolbar {
  display: flex; align-items: center;
  padding: 0 var(--sp-5);
  height: 52px;
  background: var(--surface);
  border-bottom: var(--border-w) solid var(--border);
  gap: var(--sp-3);
  flex-shrink: 0;
}

.toolbar-nav { display: flex; align-items: center; gap: var(--sp-1); }

.toolbar-btn {
  display: flex; align-items: center; justify-content: center;
  height: 30px; min-width: 30px; padding: 0 10px;
  border: var(--border-w) solid var(--border-cool);
  border-radius: var(--radius-control);
  font: 400 var(--fs-small)/1 var(--font-ui);
  color: var(--ink-muted);
  background: transparent; cursor: pointer;
  transition: all var(--t);
}
.toolbar-btn:hover { color: var(--ink); border-color: var(--line); background: var(--bg); }
.toolbar-btn.active { color: var(--line); border-color: var(--line); font-weight: 500; }
.toolbar-btn svg { width: 14px; height: 14px; display: block; }

.toolbar-title {
  font: 600 var(--fs-h3)/1 var(--font-ui);
  color: var(--ink); min-width: 140px;
}

.toolbar-today-btn {
  height: 30px; padding: 0 12px;
  border: var(--border-w) solid var(--border-cool);
  border-radius: var(--radius-control);
  font: 400 var(--fs-small)/1 var(--font-ui);
  color: var(--ink-muted); background: transparent; cursor: pointer;
  transition: all var(--t);
}
.toolbar-today-btn:hover { color: var(--ink); border-color: var(--line); background: var(--bg); }

/* Search */
.search-wrapper {
  position: relative; flex: 1; max-width: 280px; margin-left: auto;
}
.search-icon {
  position: absolute; left: 9px; top: 50%; transform: translateY(-50%);
  color: var(--ink-muted); pointer-events: none;
}
.search-icon svg { width: 13px; height: 13px; display: block; }
.search-input {
  width: 100%; height: 30px; padding: 0 var(--sp-3) 0 30px;
  border: var(--border-w) solid var(--border-cool);
  border-radius: var(--radius-control);
  background: var(--bg); color: var(--ink);
  font: 400 var(--fs-small)/1 var(--font-ui);
  transition: border-color var(--t);
}
.search-input::placeholder { color: var(--ink-muted); }
.search-input:focus { outline: none; border-color: var(--line); }

/* #349: hits from every calendar, grouped by day, under the toolbar search */
.search-results {
  position: absolute; top: calc(100% + 4px); right: 0; z-index: 300;
  width: min(380px, 90vw); max-height: 60vh; overflow-y: auto;
  background: var(--bg); color: var(--ink);
  border: var(--border-w) solid var(--border-cool); border-radius: var(--radius-control);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .15);
  font: 400 var(--fs-small)/1.4 var(--font-ui);
}
.search-results-status { padding: var(--sp-2) var(--sp-3); color: var(--ink-muted); }
.search-results-day { margin: 0; padding: var(--sp-2) var(--sp-3) 2px; font-size: var(--fs-small); font-weight: 600; color: var(--ink-muted); }
.search-results ul { list-style: none; margin: 0; padding: 0; }
.search-result {
  display: flex; gap: var(--sp-2); width: 100%; padding: 6px var(--sp-3);
  border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.search-result:hover, .search-result:focus-visible { background: var(--bg-hover, rgba(0, 0, 0, .05)); outline: none; }
.search-result-dot { flex: none; width: 8px; height: 8px; margin-top: 5px; border-radius: 50%; }
.search-result-time { flex: none; min-width: 72px; color: var(--ink-muted); }
.search-result-text { min-width: 0; overflow-wrap: anywhere; }
.search-result-location { display: block; color: var(--ink-muted); }

/* View tabs */
.view-tabs { display: flex; align-items: center; border: var(--border-w) solid var(--border-cool); border-radius: var(--radius-control); overflow: hidden; }
.view-tab {
  height: 30px; padding: 0 12px;
  font: 400 var(--fs-small)/30px var(--font-ui);
  color: var(--ink-muted);
  background: transparent; cursor: pointer;
  border: none; transition: all var(--t);
}
.view-tab + .view-tab { border-left: var(--border-w) solid var(--border-cool); }
.view-tab:hover { color: var(--ink); background: var(--bg); }
.view-tab.active { color: var(--line); background: var(--bg); font-weight: 500; }

/* Menu button (mobile) */
.menu-btn {
  display: none;
  color: var(--ink-muted); padding: var(--sp-1);
  border-radius: var(--radius-control); transition: color var(--t);
}
.menu-btn:hover { color: var(--ink); }
.menu-btn svg { width: 18px; height: 18px; display: block; }

/* #351: the floating "new event" button exists only in the phone layout (section 20) */
.fab { display: none; }

/* ── 10. Main Content ─────────────────────────────────────────────────────── */
.main {
  flex: 1; display: flex; flex-direction: column;
  overflow: hidden; min-width: 0;
}

.calendar-container {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  background: var(--bg);
}

/* ── 11. Month View ───────────────────────────────────────────────────────── */
.month-view {
  height: 100%; display: flex; flex-direction: column;
}
.month-dow-header {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
  border-bottom: var(--border-w) solid var(--border);
  background: var(--surface);
}
.month-dow {
  padding: var(--sp-2) var(--sp-3);
  font: 600 var(--fs-label)/1 var(--font-ui);
  text-transform: uppercase; letter-spacing: var(--ls-label);
  color: var(--ink-muted);
}
.month-grid {
  /* minmax(0, …): a long chip must not widen its day past the screen on a phone (#575). */
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
  flex: 1; border-left: var(--border-w) solid var(--border);
  background: var(--border);
  gap: 1px;
}
.month-row {
  display: contents;
}
.month-day {
  padding: var(--sp-2);
  cursor: pointer; transition: background var(--t);
  min-height: 96px; position: relative;
  background: var(--surface);
  display: flex; flex-direction: column;
}
.month-day:hover { background: var(--bg); }
.month-day.other-month { background: var(--bg); }
.month-day.today { background: color-mix(in srgb, var(--data) 4%, var(--surface)); }
.month-day.today .month-day-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--data); color: var(--surface); font-weight: 600;
}
.month-day.selected {
  outline: 1px solid var(--line);
  z-index: 2;
}
.month-day-num {
  font: 400 var(--fs-small)/1 var(--font-ui);
  color: var(--ink); margin-bottom: var(--sp-2);
  display: inline-block;
}
/* #517: ISO week number beside the day number of a row's first day */
.month-day-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-1); }
.month-week-num, .week-num {
  font: 400 10px/1 var(--font-mono);
  color: var(--ink-muted);
}
.week-num { padding: var(--sp-2) var(--sp-1) 0; text-align: center; }
/* Events: a tinted fill with a coloured left edge (CONCEPTS.md). The calendar colour is
   user-chosen and unbounded, so it never colours text: titles stay --ink, and the tint is at
   most 30 % over --surface, which keeps --ink above 4.5:1 for any colour in both themes (#112). */
.event-chip, .event-block {
  --event-color: var(--data); /* calendar.js sets each event's calendar colour inline */
  color: var(--ink);
  background: color-mix(in srgb, var(--event-color) 18%, var(--surface));
  border-left: 4px solid var(--event-color);
}
.event-chip:hover, .event-block:hover {
  background: color-mix(in srgb, var(--event-color) 30%, var(--surface));
}
.event-chip {
  display: flex; align-items: center;
  padding: 2px 6px;
  min-height: 24px;
  border-radius: 4px;
  font: 500 11px/1.4 var(--font-ui);
  margin-bottom: 2px;
  cursor: pointer;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  transition: background var(--t);
}
.event-chip-time {
  font: 400 10px var(--font-mono);
  margin-right: 4px;
}
.event-chip-title {
  overflow: hidden; text-overflow: ellipsis;
}
.recur-icon {
  margin-left: 4px; flex-shrink: 0;
  display: inline-block; vertical-align: middle;
}
.month-more {
  font: 600 10px/1 var(--font-ui);
  color: var(--ink-muted); margin-top: 2px; cursor: pointer;
  padding: 2px 4px;
}
.month-more:hover { color: var(--line); }

/* ── 12. Week View & Day View ─────────────────────────────────────────────── */
.week-view, .day-view {
  display: flex; flex-direction: column; height: 100%;
}
.week-header-row, .day-header-row {
  display: grid;
  background: var(--surface);
  border-bottom: var(--border-w) solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.week-header-row { grid-template-columns: 60px repeat(7, 1fr); }
.day-header-row  { grid-template-columns: 60px 1fr; }

.week-time-gutter, .day-time-gutter {
  border-right: var(--border-w) solid var(--border);
}
.week-day-header {
  padding: var(--sp-2) var(--sp-1);
  text-align: center;
  border-right: var(--border-w) solid var(--border);
}
.week-day-header:last-child { border-right: none; }
.week-day-label {
  font: 600 var(--fs-label)/1 var(--font-ui);
  text-transform: uppercase; letter-spacing: var(--ls-label);
  color: var(--ink-muted);
}
.week-day-num {
  font: 400 var(--fs-h2)/1 var(--font-ui);
  color: var(--ink); margin-top: var(--sp-1);
  display: inline-block; width: 32px; height: 32px;
  line-height: 32px; text-align: center; border-radius: 50%;
}
.week-day-header.today { background: color-mix(in srgb, var(--data) 3%, var(--surface)); }
.week-day-header.today .week-day-num {
  background: var(--data); color: var(--surface); font-weight: 600;
}
/* #513: the forecast under the day number; quiet, like the label above it. */
.weather-badge {
  display: flex; align-items: center; justify-content: center; gap: var(--sp-1);
  margin-top: var(--sp-1);
  font: 400 var(--fs-label)/1 var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--ink-muted);
  white-space: nowrap;
}
.weather-icon { font-family: var(--font-ui); font-size: var(--fs-small); }
.all-day-events {
  margin-top: var(--sp-1);
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
  max-height: 80px;
  overflow-y: auto;
}
.week-grid-body, .day-grid-body {
  display: grid; flex: 1; overflow-y: auto; overflow-x: hidden;
  background: var(--bg);
}
.week-grid-body { grid-template-columns: 60px repeat(7, 1fr); }
.day-grid-body  { grid-template-columns: 60px 1fr; }

.week-time-col, .day-time-col {
  grid-column: 1;
  border-right: var(--border-w) solid var(--border);
  background: var(--surface);
  position: relative;
}
.week-hour-label, .day-hour-label {
  position: absolute; left: 0; right: 0;
  text-align: right; padding-right: var(--sp-2);
  font: 400 10px var(--font-mono);
  color: var(--ink-muted); letter-spacing: var(--ls-mono);
  transform: translateY(-50%);
}
.week-hour-label.dual-tz, .day-hour-label.dual-tz {
  display: flex; justify-content: space-between; padding: 0 6px;
}
.week-hour-label.dual-tz .pri-time {
  font-weight: 500; color: var(--ink);
}
.week-hour-label.dual-tz .sec-time {
  color: var(--ink-muted); opacity: 0.75;
}
.dual-tz-gutter {
  display: flex; align-items: center; justify-content: space-around; padding: 0 4px;
}
.tz-badge {
  font: 500 9px var(--font-mono); padding: 2px 4px; border-radius: 3px; background: var(--surface-hover); color: var(--ink-muted);
}
.tz-badge.pri {
  font-weight: 600; color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.tz-badge { display: flex; flex-direction: column; align-items: center; line-height: 1.2; }
.tz-results { list-style: none; margin: 4px 0 0; padding: 0; max-height: 180px; overflow-y: auto; }
.tz-results button {
  display: flex; justify-content: space-between; gap: 8px; width: 100%;
  padding: 4px 6px; border: 0; background: none; color: var(--ink); font-size: 12px; text-align: left; cursor: pointer;
}
.tz-results button:hover, .tz-results button:focus-visible { background: var(--surface-hover); }
.tz-results .tz-result-offset { font-family: var(--font-mono); color: var(--ink-muted); }
.week-columns, .day-columns {
  position: relative;
  grid-column: 2 / span 7;
  display: flex;
}
.day-columns { grid-column: 2 / span 1; }

.week-day-col {
  flex: 1;
  border-right: var(--border-w) solid var(--border);
  position: relative;
  background: var(--surface);
}
.week-day-col:last-child { border-right: none; }

.hour-line {
  position: absolute; left: 0; right: 0;
  border-bottom: var(--border-w) solid var(--border);
  pointer-events: none;
}
.half-hour-line {
  position: absolute; left: 0; right: 0;
  border-bottom: var(--border-w) dashed color-mix(in srgb, var(--border) 40%, transparent);
  pointer-events: none;
}
.time-slot-click-area {
  position: absolute; left: 0; right: 0;
  cursor: pointer;
}
.time-slot-click-area:hover {
  background: color-mix(in srgb, var(--line) 4%, transparent);
}
.event-block {
  position: absolute;
  padding: 4px 8px;
  border-radius: var(--radius-control);
  border: 1px solid transparent;
  border-left: 4px solid var(--event-color);
  font: 400 11px/1.3 var(--font-ui);
  cursor: pointer; overflow: hidden;
  transition: background var(--t);
  z-index: 1;
  display: flex; flex-direction: column; gap: 2px;
}
.event-block:hover { z-index: 2; }
.event-block.short-event {
  padding: 1px 6px;
  flex-direction: row;
  align-items: center;
  gap: 4px;
  line-height: 1.1;
}
.event-block.short-event .event-block-time {
  font-size: 10px;
  white-space: nowrap;
  flex-shrink: 0;
}
.event-block.short-event .event-block-title {
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.event-block-time {
  font: 400 10px var(--font-mono);
}
.event-block-title {
  font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.event-block-loc {
  font-size: 10px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Current time indicator */
.current-time-line {
  position: absolute; z-index: 5;
  display: flex; align-items: center;
  pointer-events: none;
  background: var(--danger);
  height: 1px;
}
.current-time-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--danger); flex-shrink: 0; margin-left: -4px;
}

/* ── 13. Agenda View ──────────────────────────────────────────────────────── */
/* #510: list view — a flat, sortable table over a chosen range */
.list-view { padding: var(--sp-5); display: flex; flex-direction: column; gap: var(--sp-3); }
.list-controls, .list-bulk { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3); font-size: var(--fs-small); }
.list-bulk[hidden], #list-more[hidden] { display: none; }
.list-table { width: 100%; border-collapse: collapse; font-size: var(--fs-small); }
.list-table th, .list-table td { text-align: left; padding: var(--sp-2); border-bottom: var(--border-w) solid var(--border); }
.list-sort-btn, .list-title { background: none; border: none; padding: 0; font: inherit; color: var(--ink); cursor: pointer; text-align: left; }
.list-sort-btn { font-weight: 500; }
.list-title:hover, .list-title:focus-visible { color: var(--line); text-decoration: underline; }
.list-status { color: var(--ink-muted); font-size: var(--fs-small); margin: 0; }
#list-more { align-self: flex-start; }
.agenda-view { padding: var(--sp-5); max-width: 720px; margin: 0 auto; }
.agenda-day { margin-bottom: var(--sp-5); }
.agenda-day-header {
  display: flex; align-items: baseline; gap: var(--sp-3);
  padding-bottom: var(--sp-2);
  border-bottom: var(--border-w) solid var(--border);
  margin-bottom: var(--sp-3);
}
.agenda-day-name {
  font: 600 var(--fs-label)/1 var(--font-ui);
  text-transform: uppercase; letter-spacing: var(--ls-label);
  color: var(--ink-muted);
}
.agenda-day-date {
  font: 600 var(--fs-h3)/1 var(--font-ui); color: var(--ink);
}
.agenda-day.today .agenda-day-date { color: var(--data); }

.agenda-event {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  padding: var(--sp-3) 0;
  border-bottom: var(--border-w) solid var(--border);
  cursor: pointer; transition: background var(--t);
  border-radius: var(--radius-control);
}
.agenda-event:last-child { border-bottom: none; }
.agenda-event:hover { background: var(--bg); padding: var(--sp-3); margin: 0 calc(-1 * var(--sp-3)); }
.agenda-event-color {
  width: 4px; height: 100%; min-height: 36px;
  border-radius: var(--radius-pill); flex-shrink: 0;
  align-self: stretch;
}
.agenda-event-time {
  font: 400 var(--fs-small)/1 var(--font-mono);
  letter-spacing: var(--ls-mono);
  color: var(--ink-muted); min-width: 80px; flex-shrink: 0;
  padding-top: 2px;
}
.agenda-event-body { flex: 1; min-width: 0; }
.agenda-event-title { font: 500 var(--fs-body)/1.3 var(--font-ui); color: var(--ink); }
.agenda-event-meta {
  font-size: 12px;
  color: var(--ink-muted);
  margin-top: 3px;
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  align-items: center;
}
.agenda-event-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.agenda-event-meta svg {
  width: 12px;
  height: 12px;
  display: block;
  flex-shrink: 0;
  color: var(--ink-muted);
}
.agenda-empty { padding: var(--sp-7) 0; text-align: center; color: var(--ink-muted); font-size: var(--fs-small); }

/* ── 13.5 Sharing Dialog ──────────────────────────────────────────────────── */
.share-section {
  border-top: 1px solid var(--border);
  padding-top: var(--sp-4);
  margin-top: var(--sp-4);
}
.share-section-title {
  font: 600 var(--fs-body)/1.2 var(--font-ui);
  color: var(--ink);
  margin-bottom: var(--sp-2);
}
.share-section-desc {
  font-size: var(--fs-small);
  color: var(--ink-muted);
  margin-bottom: var(--sp-3);
}
.share-input-row {
  display: flex;
  gap: var(--sp-2);
  align-items: center;
  margin-bottom: var(--sp-3);
}
.share-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  max-height: 180px;
  overflow-y: auto;
  margin-top: var(--sp-3);
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius-control);
  padding: var(--sp-2);
  background: var(--bg);
}
.share-list:empty {
  display: none;
}
.share-user-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--sp-2) var(--sp-3);
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius-control);
  background: var(--surface);
  font-size: var(--fs-small);
}
.share-user-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.share-user-name {
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.share-user-email {
  font-size: 11px;
  color: var(--ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.share-user-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-shrink: 0;
}
.share-badge {
  padding: 2px var(--sp-2);
  border: var(--border-w) solid currentColor;
  border-radius: var(--radius-pill);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
}
.share-badge.accepted { color: var(--success); }
.share-badge.pending  { color: var(--data); }
.share-badge.declined { color: var(--danger); }
.public-link-container {
  display: flex;
  gap: var(--sp-2);
  margin-top: var(--sp-2);
}
.autocomplete-container {
  position: relative;
  flex: 1;
}
.autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--surface);
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius-control);
  max-height: 150px;
  overflow-y: auto;
  box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}
.autocomplete-item {
  padding: var(--sp-2) var(--sp-3);
  cursor: pointer;
  font-size: var(--fs-small);
  color: var(--ink);
}
.autocomplete-item:hover,
.autocomplete-item.active,
.autocomplete-item[aria-selected="true"] {
  background: var(--bg);
}

/* ── 14. Forms ────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: var(--sp-4); }

.form-label {
  display: block;
  font: 600 var(--fs-label)/1 var(--font-ui);
  text-transform: uppercase; letter-spacing: var(--ls-label);
  color: var(--ink-muted);
  margin-bottom: var(--sp-2);
}

.form-input, .form-select {
  width: 100%; height: 38px;
  padding: 0 var(--sp-3);
  border: var(--border-w) solid var(--border-cool);
  border-radius: var(--radius-control);
  background: var(--surface); color: var(--ink);
  font: 400 var(--fs-body)/1 var(--font-ui);
  transition: border-color var(--t);
}
.form-input:focus, .form-select:focus {
  outline: none; border-color: var(--line);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--line) 15%, transparent);
}
.form-input::placeholder { color: var(--ink-muted); }
.form-input[aria-invalid="true"], .form-input.error { border-color: var(--danger); }

textarea.form-input { height: auto; padding: var(--sp-3); resize: vertical; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }

/* Collapsible form section (#506): rarely used fields of a dialog. */
.form-section { border-top: var(--border-w) solid var(--border); }
.form-section:last-of-type { border-bottom: var(--border-w) solid var(--border); margin-bottom: var(--sp-4); }
.form-section-summary {
  display: flex; align-items: center; gap: var(--sp-2);
  min-height: 44px;
  cursor: pointer; list-style: none;
  font: 600 var(--fs-label)/1 var(--font-ui);
  text-transform: uppercase; letter-spacing: var(--ls-label);
  color: var(--ink-muted);
  transition: color var(--t);
}
.form-section-summary::-webkit-details-marker { display: none; }
.form-section-summary::before {
  content: ''; width: 6px; height: 6px;
  border-right: var(--border-w-glyph) solid currentColor;
  border-bottom: var(--border-w-glyph) solid currentColor;
  transform: rotate(-45deg);
  transition: transform var(--t);
}
.form-section[open] > .form-section-summary::before { transform: rotate(45deg); }
.form-section-summary:hover { color: var(--ink); }
.form-section-summary:focus-visible { outline: 2px solid var(--line); outline-offset: 2px; border-radius: var(--radius-sm); }
.form-section-body { padding: var(--sp-1) 0 var(--sp-2); }

.form-error {
  font-size: 11px; color: var(--danger);
  margin-top: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  border: var(--border-w) solid color-mix(in srgb, var(--danger) 40%, transparent);
  border-radius: var(--radius-control);
  background: color-mix(in srgb, var(--danger) 6%, transparent);
}

/* Attendees */
.attendee-list { display: flex; flex-direction: column; gap: var(--sp-2); }
/* #508: one row per reminder */
.reminder-list { list-style: none; margin: 0 0 var(--sp-2); padding: 0; display: flex; flex-direction: column; gap: var(--sp-2); }
.reminder-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.reminder-row .inline-select,
.reminder-row .inline-input { width: auto !important; padding: 2px 8px; height: 28px; font-size: 13px; margin: 0; }
.reminder-row .reminder-amount { width: 70px !important; }
.reminder-row [hidden] { display: none !important; }
.reminder-fixed { font-size: 13px; color: var(--ink-muted); }
.attendee-item {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius-control);
  background: var(--bg);
}
.attendee-name  { font-size: var(--fs-small); color: var(--ink); }
.attendee-email { font-size: 11px; color: var(--ink-muted); font-family: var(--font-mono); }
/* PARTSTAT pill; the second class is the RFC 5545 value */
.attendee-status {
  margin-left: auto;
  padding: 1px var(--sp-2);
  border: var(--border-w) solid currentColor;
  border-radius: var(--radius-pill);
  font-size: 11px; white-space: nowrap;
  color: var(--ink-muted);
}
.attendee-status.ACCEPTED  { color: var(--success); }
.attendee-status.TENTATIVE { color: var(--warning); }
.attendee-status.DECLINED  { color: var(--danger); }
.attendee-remove { color: var(--ink-muted); transition: color var(--t); padding: 2px; border-radius: 4px; }
.attendee-remove:hover { color: var(--danger); }
.attendee-remove svg { width: 13px; height: 13px; display: block; }


/* ── 15. Buttons ──────────────────────────────────────────────────────────── */
/* Outline style — transparent fill, equal visual weight on opposing choices */
.btn {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  height: 36px; padding: 0 var(--sp-4);
  border: var(--border-w) solid var(--border-cool);
  border-radius: var(--radius-control);
  font: 400 var(--fs-small)/1 var(--font-ui);
  color: var(--ink); background: transparent;
  cursor: pointer; transition: all var(--t);
  white-space: nowrap;
}
.btn:hover { border-color: var(--ink-muted); background: var(--bg); }
.btn:disabled { opacity: 0.5; cursor: default; }

/* Primary = amber — the ONE forward action per view */
.btn-primary {
  border-color: var(--accent); color: var(--accent);
}
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); }

/* Danger */
.btn-danger {
  border-color: var(--danger); color: var(--danger);
}
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 8%, transparent); }

/* Success */
.btn-success {
  border-color: var(--success); color: var(--success);
}
.btn-success:hover { background: color-mix(in srgb, var(--success) 8%, transparent); }

/* Ghost = no border */
.btn-ghost { border-color: transparent; color: var(--ink-muted); }
.btn-ghost:hover { color: var(--ink); border-color: var(--border); background: var(--bg); }

.btn svg { width: 14px; height: 14px; display: block; }

.btn-spinner {
  width: 14px; height: 14px;
  border: 1.5px solid var(--border-cool); border-top-color: var(--line);
  border-radius: 50%; animation: spin 0.7s linear infinite;
}

/* ── 16. Modals ───────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 200;
  /* Page recedes to paper ground with mild desaturation (DECISIONS.md) */
  background: color-mix(in srgb, var(--bg) 55%, transparent);
  backdrop-filter: grayscale(0.5);
  display: flex; align-items: center; justify-content: center;
  padding: var(--sp-4);
  animation: fadeIn var(--t) ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
/* A confirmation is asked from inside other modals (share, settings) and must sit above them. */
#confirm-dialog-backdrop { z-index: 250; }

.modal {
  width: 100%; max-width: 560px;
  background: var(--surface);
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius-sheet);
  animation: slideUp 0.2s ease;
  max-height: 90vh;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.modal-sm { max-width: 400px; }

/* #511: PDF export — settings beside a preview of the first page */
.pdf-export-modal { max-width: 960px; }
.pdf-export-body { display: grid; grid-template-columns: minmax(220px, 280px) 1fr; gap: var(--sp-5); align-items: start; }
.pdf-export-calendars { border: 0; padding: 0; margin: 0 0 var(--sp-4); }
.pdf-export-check { display: flex; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-2); font-size: 0.85rem; }
.pdf-export-preview { margin: 0; display: flex; flex-direction: column; align-items: center; gap: var(--sp-2); }
.pdf-export-preview img { max-width: 100%; max-height: 62vh; border: var(--border-w) solid var(--border); background: #fff; }
.pdf-export-preview figcaption { font-size: 0.8rem; color: var(--text-muted); }
.pdf-export-preview figcaption.error { color: var(--danger); }
@media (max-width: 720px) { .pdf-export-body { grid-template-columns: 1fr; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.modal form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-4) var(--sp-5);
  border-bottom: var(--border-w) solid var(--border);
  flex-shrink: 0;
}
.modal-title { font: 600 var(--fs-h3)/1 var(--font-ui); color: var(--ink); }
.modal-close { color: var(--ink-muted); }
.modal-close:hover { color: var(--ink); }
.modal-close svg { width: 16px; height: 16px; display: block; }

.modal-body { padding: var(--sp-5); overflow-y: auto; flex: 1; }

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-2);
  padding: var(--sp-4) var(--sp-5);
  border-top: var(--border-w) solid var(--border);
  flex-shrink: 0;
}

.modal-actions {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: var(--sp-5); padding-top: var(--sp-4);
  border-top: var(--border-w) solid var(--border);
}
.modal-actions-right { display: flex; gap: var(--sp-2); margin-left: auto; }
.modal-actions-left { display: flex; flex-wrap: wrap; gap: var(--sp-2); }

/* #515: "Neu aus Vorlage" at the top of the event and task dialogs. */
.template-picker { align-items: flex-end; gap: var(--sp-2); }
.template-picker .form-group { flex: 1; }

/* #515: right-click menu on events and tasks. */
.context-menu {
  position: fixed; z-index: 400;
  display: flex; flex-direction: column;
  min-width: 160px;
  padding: var(--sp-1);
  background: var(--surface);
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius-sheet);
}
.context-menu-item {
  min-height: 32px;
  padding: var(--sp-1) var(--sp-3);
  text-align: left;
  font: 400 var(--fs-body)/1.3 var(--font-ui);
  color: var(--ink);
  background: none; border: none; border-radius: var(--radius-sheet);
  cursor: pointer;
}
.context-menu-item:hover, .context-menu-item:focus { background: var(--surface-hover); }
.context-menu-item:disabled { color: var(--ink-muted); background: none; cursor: default; }

/* ── 17. Event Popover ────────────────────────────────────────────────────── */
.event-popover {
  position: fixed; z-index: 300;
  background: var(--surface);
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius-sheet);
  padding: var(--sp-4);
  width: 280px;
  animation: fadeIn 0.12s ease;
}

.popover-title { font: 500 var(--fs-body)/1.3 var(--font-ui); color: var(--ink); flex: 1; }

.popover-row {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  font-size: 12px; color: var(--ink-muted);
  margin-bottom: var(--sp-2);
}
.popover-row svg { width: 13px; height: 13px; flex-shrink: 0; margin-top: 1px; color: var(--ink-muted); }



/* ── 18. Toast Notifications ─────────────────────────────────────────────── */
.toast-container {
  position: fixed; bottom: var(--sp-5); right: var(--sp-5); z-index: 400;
  display: flex; flex-direction: column; gap: var(--sp-2);
}
.toast {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface);
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius-control);
  font-size: var(--fs-small); color: var(--ink);
  min-width: 240px; max-width: 360px;
  animation: slideRight 0.2s ease;
}
@keyframes slideRight { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: none; } }
.toast.success { border-left: 3px solid var(--data); }
.toast.error   { border-left: 3px solid var(--danger); }
.toast.info    { border-left: 3px solid var(--line); }
.toast.warning { border-left: 3px solid var(--warning); }

/* Drag and drop of events (#574) */
.event-resize-handle { position: absolute; z-index: 3; touch-action: none; }
.event-block .event-resize-handle { left: 0; right: 0; height: 6px; cursor: ns-resize; }
.event-block .event-resize-handle.top { top: 0; }
.event-block .event-resize-handle.bottom { bottom: 0; }
.event-chip { position: relative; }
.event-chip .event-resize-handle { top: 0; bottom: 0; width: 6px; cursor: ew-resize; }
.event-chip .event-resize-handle.start { left: 0; }
.event-chip .event-resize-handle.end { right: 0; }
.event-resize-handle::after {
  content: ''; position: absolute; inset: 2px; border-radius: 2px;
  background: var(--event-color); opacity: 0; transition: opacity var(--t);
}
.event-block:hover .event-resize-handle::after, .event-chip:hover .event-resize-handle::after,
.drag-armed .event-resize-handle::after { opacity: .6; }
.drag-source { opacity: .35; }
.drag-ghost { pointer-events: none; z-index: 5; opacity: .85; border-style: dashed; }
.week-day-header.drop-target, .month-day.drop-target { outline: 2px dashed var(--accent); outline-offset: -2px; }
/* A task shown by its due date (#577): a checkbox mark in front of its title. */
.calendar-task .event-chip-title::before, .calendar-task .event-block-title::before { content: "☐ "; }
.drag-cancel-zone {
  position: fixed; top: 0; left: 0; right: 0; z-index: 450;
  padding: var(--sp-4); text-align: center;
  background: var(--surface); border-bottom: var(--border-w) solid var(--danger);
  color: var(--danger); font-size: var(--fs-small); font-weight: 600;
}
.drag-cancel-zone.over { background: var(--danger); color: var(--surface); }
.undo-bar {
  position: fixed; bottom: var(--sp-5); left: 50%; transform: translateX(-50%); z-index: 410;
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  background: var(--surface); border: var(--border-w) solid var(--border);
  border-radius: var(--radius-control); font-size: var(--fs-small);
}
body.event-dragging { user-select: none; -webkit-user-select: none; }

/* ── 19. Keyboard focus chrome ────────────────────────────────────────────── */
/* Teal outline + slight scale on keyboard nav only (DECISIONS.md) */
/* Buttons & tiles get mild scale; full-width rows do not */
.toolbar-btn:focus-visible,
.btn:focus-visible {
  transform: scale(1.05);
  outline: 2px solid var(--line);
  outline-offset: 2px;
}

/* Alt-hold key-hint layer (design guide, #126): each shortcut target shows its letter */
.key-hints-visible [data-key-hint] { position: relative; }
.key-hints-visible [data-key-hint]::after {
  content: attr(data-key-hint);
  position: absolute; top: -6px; right: -6px; z-index: 5;
  min-width: 16px; padding: 0 4px;
  font-size: 10px; font-weight: 600; line-height: 16px; text-align: center;
  color: var(--surface); background: var(--line);
  border-radius: var(--radius-control);
  pointer-events: none;
}

/* ── 20. Mobile / Responsive ─────────────────────────────────────────────── */
/* #351: the phone layout. The view tabs become a bottom navigation (month, three days, day,
   agenda, tasks; the seven-column weeks and the list need a wider screen), a floating button
   creates an event, dialogs fill the screen, the event popover is a sheet along the bottom edge,
   and every control is at least 44 px. app.js opens a phone in the three-day view and turns a
   horizontal swipe over the calendar into the previous or next period. */
@media (max-width: 768px) {
  :root { --bottom-nav-h: calc(56px + env(safe-area-inset-bottom, 0px)); }
  .menu-btn { display: flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; }
  .sidebar-toggle { display: block; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    z-index: 50; transform: translateX(-100%);
    visibility: hidden;
    transition: transform var(--t-slow), visibility 0s linear var(--t-slow);
  }
  .sidebar.open { transform: translateX(0); visibility: visible; transition: transform var(--t-slow); }
  .app { flex-direction: column; }

  /* Responsive Grid-based Toolbar Layout */
  .toolbar {
    height: auto;
    padding: var(--sp-2) var(--sp-3);
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-rows: auto auto auto;
    gap: 8px 4px;
  }
  .toolbar .menu-btn {
    grid-column: 1;
    grid-row: 1;
    align-self: center;
  }
  .toolbar-title {
    grid-column: 2;
    grid-row: 1;
    align-self: center;
    min-width: 0;
    font-size: 14px;
    line-height: 1.25;
    margin: 0;
    /* #351: a range like "25. – 27. September 2026" wraps rather than being cut */
    white-space: normal;
    overflow: hidden;
    padding-left: var(--sp-2);
  }
  .toolbar-nav {
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
    align-self: center;
  }
  .toolbar-btn, .toolbar-today-btn { min-width: 44px; height: 44px; }
  .main { padding-bottom: var(--bottom-nav-h); }
  .toolbar .view-tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    display: flex;
    height: var(--bottom-nav-h);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    margin-left: 0 !important;
    border: 0; border-top: var(--border-w) solid var(--border-cool); border-radius: 0;
    background: var(--surface);
  }
  .toolbar #view-week, .toolbar #view-workweek, .toolbar #view-list { display: none; }
  .toolbar .view-tab {
    flex: 1;
    height: 100%; min-height: 44px;
    text-align: center;
    padding: 0 2px;
    font-size: 12px; line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .toolbar .view-tab + .view-tab { border-left: 0; }
  .toolbar .search-wrapper {
    grid-column: 1 / span 3;
    grid-row: 2;
    max-width: none;
    margin: 0;
    width: 100%;
  }
  /* 16 px keeps iOS from zooming into the field */
  .toolbar .search-input { height: 44px; font-size: 16px; }
  .fab {
    display: flex; align-items: center; justify-content: center;
    position: fixed; z-index: 45;
    right: var(--sp-4); bottom: calc(var(--bottom-nav-h) + var(--sp-4));
    width: 56px; height: 56px;
    border: var(--border-w) solid var(--accent); border-radius: 50%;
    color: var(--accent); background: var(--surface);
    cursor: pointer;
  }
  .fab svg { width: 24px; height: 24px; display: block; }

  /* Dialogs fill the screen; confirmations stay small. */
  .modal-backdrop { padding: 0; }
  .modal:not(.modal-sm) {
    max-width: none; width: 100%; height: 100%; max-height: none;
    border: 0; border-radius: 0;
  }
  .modal-close { display: flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; }
  .modal-footer .btn, .modal-actions .btn, .popover-actions .btn { min-height: 44px; height: auto; }
  /* The dialog's actions stay in reach at the bottom while its form scrolls. */
  .modal-body form { overflow: visible; }
  .modal .modal-actions {
    position: sticky; bottom: 0; z-index: 1;
    padding: var(--sp-3) 0 calc(var(--sp-3) + env(safe-area-inset-bottom, 0px));
    background: var(--surface);
  }
  /* The event popover is a sheet along the bottom edge, whatever position app.js computed. */
  .event-popover {
    top: auto !important; left: 0 !important; right: 0; bottom: 0;
    width: auto; max-height: 70vh; overflow-y: auto;
    border-radius: var(--radius-sheet) var(--radius-sheet) 0 0;
    padding-bottom: calc(var(--sp-4) + env(safe-area-inset-bottom, 0px));
  }
  .toolbar #invitations-btn,
  .toolbar #export-pdf-btn,
  .toolbar #availability-btn {
    display: none !important;
  }
}

/* ── ICS Import Dropzone ─────────────────────────────────────────────────── */
#ics-dropzone {
  display: flex; align-items: center; justify-content: center; gap: var(--sp-2);
  margin-top: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border: var(--border-w) dashed var(--border-cool);
  border-radius: var(--radius-control);
  color: var(--ink-muted);
  font-size: 11px;
  cursor: pointer;
  transition: color var(--t), border-color var(--t), background var(--t);
}
#ics-dropzone:hover, #ics-dropzone.dragover {
  color: var(--line);
  border-color: var(--line);
  background: var(--bg);
}
#ics-dropzone svg { flex-shrink: 0; }

/* ── 21. Utility classes ──────────────────────────────────────────────────── */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ── 22. Missing component styles ────────────────────────────────────────── */

/* Buttons — size variants */
.btn-full { width: 100%; justify-content: center; height: 40px; }
.btn-sm   { min-height: 44px; min-width: 44px; padding: 0 var(--sp-3); font-size: 12px; display: inline-flex; align-items: center; justify-content: center; }

/* Form extras */
.form-hint {
  display: block; margin-top: var(--sp-1);
  font-size: 11px; color: var(--ink-muted);
}
.optional { font-weight: 400; color: var(--ink-muted); }

/* Password toggle wrapper */
.input-with-action {
  display: flex; align-items: center; gap: var(--sp-2);
}
.input-with-action .form-input { flex: 1; }
.toggle-password {
  flex-shrink: 0; width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border: var(--border-w) solid var(--border-cool);
  border-radius: var(--radius-control);
  color: var(--ink-muted); background: var(--surface);
  cursor: pointer; transition: all var(--t);
}
.toggle-password:hover { color: var(--ink); border-color: var(--line); }
.toggle-password svg { width: 15px; height: 15px; display: block; }

/* Checkbox */
.form-checkbox {
  width: 14px; height: 14px;
  accent-color: var(--data);
  border: var(--border-w-glyph) solid var(--border-cool);
  border-radius: 4px; cursor: pointer;
  vertical-align: middle; margin-right: var(--sp-1);
}

/* Textarea */
textarea.form-input, .form-textarea {
  height: auto; padding: var(--sp-3); resize: vertical; line-height: 1.5;
}

/* Title input — larger, borderless top */
.form-input-title {
  font: 500 18px/1 var(--font-ui);
  border-left: none; border-right: none; border-top: none;
  border-radius: 0;
  padding-left: 0; padding-right: 0;
}
.form-input-title:focus {
  box-shadow: none;
  border-color: var(--line);
}
.form-input-title::placeholder { color: var(--ink-muted); font-weight: 400; }

/* Attendees */
.attendee-input-row {
  display: flex; gap: var(--sp-2); margin-bottom: var(--sp-3);
  flex-wrap: wrap;
}
.attendee-input-row .form-input { flex: 1; min-width: 120px; }

/* Status bar */
.status-bar {
  padding: var(--sp-1) var(--sp-5);
  font: 400 11px/1 var(--font-mono);
  color: var(--ink-muted); letter-spacing: var(--ls-mono);
  border-top: var(--border-w) solid var(--border);
  background: var(--surface);
  min-height: 22px;
}

/* Onboarding layout — centered on the paper ground */
.onboarding {
  position: fixed; inset: 0; z-index: 100;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  padding: var(--sp-4);
}
.onboarding-card {
  width: 100%; max-width: 400px;
  background: var(--surface);
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius-sheet);
  padding: var(--sp-6);
}
.onboarding-header { margin-bottom: var(--sp-5); }
.onboarding-logo {
  display: flex; align-items: center; gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}
.onboarding-logo-text {
  font: 600 var(--fs-h3)/1 var(--font-ui); color: var(--ink);
}
.onboarding-title {
  font: 600 var(--fs-h2)/1.2 var(--font-ui); color: var(--ink);
  margin-bottom: var(--sp-2);
}
.onboarding-subtitle {
  font-size: var(--fs-small); color: var(--ink-muted); line-height: 1.5;
}
/* #353: provider tiles of the first run (onboarding and welcome dialog) */
.provider-tiles {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: var(--sp-2);
}
.provider-tile {
  padding: 10px 8px;
  font: 500 var(--fs-small)/1.2 var(--font-ui);
  color: var(--ink);
  background: var(--surface);
  border: var(--border-w) solid var(--border);
  border-radius: 6px;
  cursor: pointer;
}
.provider-tile:hover { border-color: var(--ink-muted); }

.mini-calendar { padding: 0 var(--sp-1); }



/* Advanced Recurrence Styling */
.weekdays-checkgrid {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.weekday-check {
  font-family: var(--font-mono);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 4px;
  user-select: none;
}
.weekday-check:has(input:checked) {
  border-color: var(--line);
  background: rgba(0, 96, 112, 0.08);
}
.weekday-check input {
  margin: 0;
}
.radio-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}
.radio-option {
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}
.radio-option input {
  margin: 0;
}
.radio-option-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}
.radio-option-row .inline-select {
  width: auto !important;
  display: inline-block;
  padding: 2px 8px;
  height: 28px;
  font-size: 13px;
}
.radio-option-row .inline-input {
  width: auto !important;
  display: inline-block;
  padding: 2px 8px;
  height: 28px;
  font-size: 13px;
  margin: 0;
}

/* OAuth Styles */
.oauth-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}
.btn-oauth {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink);
}
.btn-google:hover {
  background: rgba(0, 0, 0, 0.02);
  border-color: #ccc;
}
[data-theme="dark"] .btn-google:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: #555;
}
.btn-msgraph {
  margin-top: 8px;
  background: #0078D4; /* Microsoft brand blue */
  border-color: #0078D4;
  color: #ffffff;
}
.oauth-icon,
.google-badge-icon {
  flex-shrink: 0;
}
.modal-divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  margin: 16px 0;
}
.modal-divider::before,
.modal-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--border);
}
.modal-divider:not(:empty)::before {
  margin-right: .75em;
}
.modal-divider:not(:empty)::after {
  margin-left: .75em;
}

/* Sidebar Restructuring & Drawer */
.sidebar-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 8px var(--sp-3);
  border-top: var(--border-w) solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
}
.sidebar-settings-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  cursor: pointer;
  transition: background var(--t), border-color var(--t);
  text-align: left;
}
.sidebar-settings-btn:hover {
  background: var(--surface-bg-alt, rgba(0, 0, 0, 0.03));
  border-color: var(--border);
}
[data-theme="dark"] .sidebar-settings-btn:hover {
  background: rgba(255, 255, 255, 0.04);
}

/* Settings (#628): a dialog with a topic list beside one section per topic */
.settings-dialog {
  position: fixed; inset: 0; z-index: 150;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--ink) 35%, transparent);
}
.settings-panel {
  display: flex; flex-direction: column; overflow: hidden;
  width: min(880px, calc(100vw - 2 * var(--sp-4)));
  height: min(760px, calc(100vh - 2 * var(--sp-4)));
  background: var(--surface);
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius-sheet);
}
.settings-drawer-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-4) var(--sp-5);
  border-bottom: var(--border-w) solid var(--border);
}
.settings-drawer-header h2 { margin: 0; font: 600 var(--fs-h3)/1.2 var(--font-ui); color: var(--ink); }
.settings-layout { flex: 1; min-height: 0; display: grid; grid-template-columns: 220px 1fr; }
.settings-nav { padding: var(--sp-3); border-right: var(--border-w) solid var(--border); overflow-y: auto; }
.settings-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-1); }
.settings-nav-btn {
  width: 100%; padding: var(--sp-2) var(--sp-3); text-align: left;
  font: 500 var(--fs-small)/1.3 var(--font-ui); color: var(--ink);
  background: transparent; border: var(--border-w) solid transparent; border-radius: var(--radius-control);
  cursor: pointer; transition: background var(--t);
}
.settings-nav-btn:hover { background: var(--surface-hover); }
.settings-nav-btn[aria-current="true"] { background: var(--surface-bg-alt); border-color: var(--border); font-weight: 600; }
.settings-drawer-body { overflow-y: auto; padding: var(--sp-4) var(--sp-5) var(--sp-7); display: flex; flex-direction: column; gap: var(--sp-6); }
.settings-topic { display: flex; flex-direction: column; gap: var(--sp-4); }
.settings-topic-title { margin: 0; font: 600 var(--fs-h3)/1.2 var(--font-ui); color: var(--ink); scroll-margin-top: var(--sp-4); }
.settings-topic-title:focus-visible { outline: 2px solid var(--line); outline-offset: 2px; }
.settings-section + .settings-section { border-top: var(--border-w) solid var(--border); padding-top: var(--sp-4); }
.settings-section-title {
  margin: 0 0 var(--sp-2);
  font: 600 var(--fs-label)/1.2 var(--font-ui); letter-spacing: var(--ls-label);
  text-transform: uppercase; color: var(--ink-muted);
}
.settings-section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--sp-2); }
.settings-section-head .settings-section-title { margin: 0; }
.settings-section-head .icon-btn { padding: 2px; }
.settings-section .form-group { margin-bottom: var(--sp-2); }
.settings-section .form-label { font-size: var(--fs-small); }
.settings-section .form-select,
.settings-section .form-input { width: 100%; font-size: var(--fs-small); padding: var(--sp-1) var(--sp-2); }
.settings-check { display: flex; align-items: center; gap: var(--sp-2); cursor: pointer; font-size: var(--fs-small); color: var(--ink); }
.settings-check-strong { font-weight: 600; }
.settings-subgroup { border-top: var(--border-w) dashed var(--border); padding-top: var(--sp-2); }
.settings-row { display: flex; gap: var(--sp-2); margin-bottom: var(--sp-2); }
.settings-row-item { flex: 1; }
.settings-days { display: flex; flex-wrap: wrap; gap: var(--sp-2); font-size: var(--fs-small); }
.settings-actions { display: flex; justify-content: space-between; align-items: center; margin-top: var(--sp-2); }
.settings-note { margin: var(--sp-1) 0 var(--sp-2); font-size: var(--fs-small); color: var(--ink-muted); }
.settings-error { margin: 0 0 var(--sp-2); font-size: var(--fs-small); color: var(--danger); }
@media (max-width: 640px) {
  .settings-panel { width: 100vw; height: 100vh; border-radius: 0; border: none; }
  .settings-layout { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .settings-nav { border-right: none; border-bottom: var(--border-w) solid var(--border); overflow-x: auto; }
  .settings-nav ul { flex-direction: row; }
  .settings-nav-btn { white-space: nowrap; }
  .settings-drawer-body { padding: var(--sp-4) var(--sp-3) var(--sp-7); }
}
.settings-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.settings-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: var(--surface-bg-alt, rgba(0, 0, 0, 0.02));
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  font-size: 13px;
  gap: 8px;
}
[data-theme="dark"] .settings-item {
  background: rgba(255, 255, 255, 0.02);
}
.settings-item-info {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}
.settings-item-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}
.settings-item-type {
  font-size: 0.7rem;
  color: var(--ink-muted);
  white-space: nowrap;
}
.settings-item-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}
.settings-action-btn {
  padding: 4px;
  border-radius: 4px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--ink-muted);
  transition: color var(--t), background var(--t);
  display: flex;
  align-items: center;
  justify-content: center;
}
.settings-action-btn:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--ink);
}
[data-theme="dark"] .settings-action-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}
.settings-action-btn.btn-danger:hover {
  background: color-mix(in srgb, var(--danger) 10%, transparent);
  color: var(--danger);
}
.settings-action-btn svg {
  width: 14px;
  height: 14px;
}

/* ── Task area: "Liste | Kanban" (#498) ────────────────────────────────────── */
.task-area { display: flex; flex-direction: column; height: 100%; }
.task-view-switch {
  display: flex; align-self: flex-start; margin: var(--sp-4) var(--sp-4) 0;
  border: var(--border-w) solid var(--border-cool); border-radius: var(--radius-control); overflow: hidden;
}
.task-view-btn {
  height: 30px; padding: 0 12px;
  font: 400 var(--fs-small)/30px var(--font-ui);
  color: var(--ink-muted); background: transparent; border: none; cursor: pointer;
}
.task-view-btn + .task-view-btn { border-left: var(--border-w) solid var(--border-cool); }
.task-view-btn:hover { color: var(--ink); background: var(--bg); }
.task-view-btn[aria-pressed="true"] { color: var(--line); background: var(--bg); font-weight: 500; }
.task-view-body { flex: 1; min-height: 0; overflow: auto; }

.task-list-controls {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-4);
  padding: var(--sp-3) var(--sp-4); font-size: var(--fs-small); color: var(--ink-muted);
}
.task-list-control { display: inline-flex; align-items: center; gap: var(--sp-2); }
.task-list-control .form-select { width: auto; }
/* #518: the task dialog's checklist of subtasks */
.task-subtask-list { list-style: none; margin: 0 0 var(--sp-2); padding: 0; display: flex; flex-direction: column; gap: var(--sp-1); }
.task-subtask-item { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-small); }
.task-subtask-item.is-done .task-subtask-title { text-decoration: line-through; color: var(--ink-muted); }
.task-subtask-empty { font-size: var(--fs-small); color: var(--ink-muted); }
.task-subtask-add { display: flex; gap: var(--sp-2); }
.task-list-empty { padding: var(--sp-4); font-size: var(--fs-small); color: var(--ink-muted); }
.task-list-table { width: calc(100% - 2 * var(--sp-4)); margin: 0 var(--sp-4) var(--sp-4); border-collapse: collapse; font-size: var(--fs-small); }
.task-list-table th,
.task-list-table td { padding: var(--sp-2); text-align: left; border-bottom: var(--border-w) solid var(--border); color: var(--ink); }
.task-list-table thead th { color: var(--ink-muted); font-weight: 500; }
.task-list-col-check { width: 32px; }
.task-list-group-header th { padding-top: var(--sp-4); font-weight: 600; }
.task-list-group-count { color: var(--ink-muted); font-weight: 400; }
.task-list-title {
  background: none; border: none; padding: 0; cursor: pointer;
  font: inherit; color: var(--ink); text-align: left;
}
.task-list-title:hover { text-decoration: underline; }
.task-list-row.is-done .task-list-title { text-decoration: line-through; color: var(--ink-muted); }

/* ── Kanban Board View ─────────────────────────────────────────────────────── */
.kanban-board {
  display: flex;
  gap: 16px;
  height: 100%;
  padding: 16px;
  box-sizing: border-box;
  overflow-x: auto;
}
.kanban-column {
  flex: 1;
  min-width: 220px;
  background: var(--surface-bg-alt, rgba(240, 240, 245, 0.5));
  border: 1px solid var(--border);
  border-radius: var(--radius-card, 12px);
  display: flex;
  flex-direction: column;
  max-height: 100%;
}
[data-theme="dark"] .kanban-column {
  background: rgba(255, 255, 255, 0.03);
}
.kanban-column-header {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}
.kanban-column-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--line);
}
.kanban-badge {
  background: var(--surface-hover, rgba(0,0,0,0.06));
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-muted);
}
.kanban-cards-container {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-3);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}
/* Elevation by border + surface tone: the card keeps --surface under the pointer, so its
   badges keep their contrast; hover only cools the border. */
.kanban-card {
  background: var(--surface);
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius-control);
  padding: var(--sp-3);
  transition: border-color var(--t);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--sp-2);
}
.kanban-card:hover {
  border-color: var(--border-cool);
}
.kanban-card-body { min-width: 0; }
.kanban-card-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--line);
  margin-bottom: var(--sp-1);
}
.kanban-card-desc {
  font-size: 12px;
  color: var(--ink-muted);
  line-height: 1.4;
  margin-bottom: var(--sp-2);
}
.kanban-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1);
  align-items: center;
  font-size: 11px;
}
/* Badges are outline pills (design guide): token text and border on the card's --surface.
   Amber is reserved for the view's one forward action, so the middle grade is plain ink. */
.kanban-due-date,
.kanban-prio,
.kanban-recurrence-badge {
  padding: 2px var(--sp-2);
  border: var(--border-w) solid currentColor;
  border-radius: var(--radius-pill);
}
.kanban-due-date { color: var(--data); font-weight: 500; }
.kanban-prio { font-weight: 600; }
.prio-high { color: var(--danger); }
.prio-med  { color: var(--ink); }
.prio-low  { color: var(--success); }
.kanban-recurrence-badge { color: var(--line); font-weight: 500; }
.kanban-card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 4px;
  border-top: 1px solid var(--border-cool, rgba(0,0,0,0.05));
  padding-top: 6px;
}
.kanban-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px 10px;
  min-height: 44px;
  min-width: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  font-size: 12px;
  transition: background 0.15s;
}
.kanban-btn:hover {
  background: var(--surface-hover, rgba(0,0,0,0.06));
}

/* Moving a card between lanes (#499): the grip takes touch drags, the whole card mouse drags.
   The dragged card follows the pointer flat, marked by its border like a hovered one. */
.kanban-card-movable {
  position: relative;
  cursor: grab;
  user-select: none;
}
.kanban-card-movable .kanban-card-body { padding-right: 36px; }
.kanban-drag-handle {
  position: absolute;
  top: 0;
  right: 0;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-muted);
  touch-action: none;
}
.kanban-card-dragging {
  z-index: 10;
  cursor: grabbing;
  border-color: var(--line);
}
.kanban-column-drop-target {
  outline: 2px dashed var(--line);
  outline-offset: -2px;
}
.kanban-card-pending { opacity: 0.7; }
.kanban-card-rolled-back {
  border-color: var(--danger);
  outline: 1px solid var(--danger);
}
.kanban-status-select {
  margin-right: auto;
  min-height: 44px;
  max-width: 100%;
  padding: 0 var(--sp-2);
  border: var(--border-w) solid var(--border-cool);
  border-radius: var(--radius-control);
  background: var(--surface);
  color: var(--ink);
  font: 400 12px/1 var(--font-ui);
}
.kanban-status-select:focus-visible {
  outline: 2px solid var(--line);
  outline-offset: 1px;
}

/* ── Empty State Styles ─────────────────────────────────────────────────── */
.empty-state {
  padding: var(--sp-4) var(--sp-3);
  text-align: center;
  font-size: var(--fs-small);
  color: var(--ink-muted);
}
.kanban-empty-state {
  margin: 12px 0 16px 0;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 8px;
  text-align: center;
}
.kanban-empty-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink);
  margin-bottom: 4px;
}
.kanban-empty-subtitle {
  font-size: 0.85rem;
  color: var(--ink-muted);
}
.kanban-column-empty {
  font-size: 0.8rem;
  color: var(--ink-muted);
  text-align: center;
  padding: 16px 8px;
  font-style: italic;
}
.search-empty-banner {
  margin: 12px 16px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--ink);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Sidebar Task List ─────────────────────────────────────────────────────── */
.sidebar-task-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}
.sidebar-task-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  background: var(--surface-hover, rgba(0,0,0,0.02));
  transition: background 0.15s ease;
}
.sidebar-task-item:hover {
  background: var(--surface-bg-alt, rgba(0,0,0,0.05));
}
.sidebar-task-checkbox {
  margin-top: 3px;
  cursor: pointer;
}
.sidebar-task-info { flex: 1; min-width: 0; cursor: pointer; }
.sidebar-task-meta { font-size: 0.75rem; color: var(--ink-muted); }
.sidebar-tasks-empty { font-size: 0.78rem; color: var(--ink-muted); padding: 4px 8px; }
.sidebar-task-title {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--line);
  line-height: 1.3;
}

/* ── Invitations & RSVP Styles ────────────────────────────────────────── */
.invitation-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.invitation-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.invitation-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--line);
}
.invitation-date {
  font-size: 12px;
  color: var(--ink-muted);
}
.invitation-organizer {
  font-size: 12px;
  color: var(--ink-muted);
}
.invitation-desc {
  font-size: 13px;
  color: var(--ink);
  background: var(--bg);
  padding: 6px 8px;
  border-radius: 4px;
}
.invitation-attendees {
  font-size: 12px;
  margin-top: 4px;
}
.inv-attendee-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2px 0;
}
.status-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px var(--sp-2);
  border: var(--border-w) solid currentColor;
  border-radius: var(--radius-pill);
  color: var(--ink);
}
.status-accepted { color: var(--success); }
.status-declined { color: var(--danger); }
.status-tentative { color: var(--ink); }
.status-pending { color: var(--data); }

.invitation-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

/* OAuth Warning Banner (Issue #7) */
.oauth-warning-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffeeba;
  border-radius: var(--radius-control);
  padding: 10px 16px;
  margin: 12px 16px 0 16px;
  gap: 12px;
  font-size: 13px;
  font-weight: 500;
}
[data-theme="dark"] .oauth-warning-banner {
  background: #3a2e10;
  color: #ffda6a;
  border-color: #5c4819;
}

/* Background sync failure banner (Issue #203) */
.sync-error-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
  border-radius: var(--radius-control);
  padding: 10px 16px;
  margin: 12px 16px 0 16px;
  gap: 12px;
  font-size: 13px;
  font-weight: 500;
}
[data-theme="dark"] .sync-error-banner {
  background: #3b1519;
  color: #f1aeb5;
  border-color: #5c2329;
}
.sync-error-banner .icon-btn { color: inherit; }
/* Issue #174: long import / sync progress — calm, border + surface, no colour alarm */
.progress-banner {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  background: var(--surface);
  color: var(--ink);
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius-control);
  padding: 10px 16px;
  margin: 12px 16px 0 16px;
  font-size: var(--fs-small);
}
.progress-banner-text { flex: 1; }
.progress-banner-bar { width: 140px; height: 6px; accent-color: var(--line); }
/* An event whose save is still running (optimistic save) */
.event-chip.event-pending,
.event-block.event-pending { opacity: 0.6; border-style: dashed; }
.oauth-warning-content {
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn-warning-reauth {
  background: #e0a800;
  color: #212529;
  border: none;
  padding: 5px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.btn-warning-reauth:hover {
  background: #c69500;
}

/* ── Print & Vector PDF Export Styles ─────────────────────────────────────── */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }
  .sidebar,
  .toolbar-nav,
  .view-tabs,
  .search-wrapper,
  #export-pdf-btn,
  #invitations-btn,
  #availability-btn,
  #sidebar-toggle,
  #sidebar-settings-btn,
  .status-bar,
  .modal-backdrop,
  .popover,
  #kanban-side-drawer,
  .shortcuts-modal-backdrop {
    display: none !important;
  }
  .app {
    display: block !important;
    overflow: visible !important;
  }
  .main {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    overflow: visible !important;
  }
  .toolbar {
    border-bottom: 2px solid #000 !important;
    padding: 10px 0 !important;
    margin-bottom: 15px !important;
  }
  .toolbar-title {
    font-size: 22px !important;
    font-weight: bold !important;
    color: #000 !important;
  }
  .calendar-container,
  .month-grid,
  .week-grid-body,
  .day-grid-body,
  .agenda-view,
  .kanban-board {
    width: 100% !important;
    height: auto !important;
    border: 1px solid #000 !important;
    overflow: visible !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }
  .month-day,
  .week-day-col,
  .event-chip,
  .kanban-card,
  .agenda-event {
    border: 1px solid #000 !important;
    color: #000 !important;
    background: #ffffff !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }
}


/* ── Working Hours Grid Shading Styles ───────────────────────────────────────── */
.time-slot-click-area.non-working-hour {
  background-color: rgba(241, 245, 249, 0.45);
}
.week-day-col.non-working-day {
  background-color: rgba(243, 244, 246, 0.4);
}
.time-slot-click-area.non-working-hour:hover {
  background-color: rgba(226, 232, 240, 0.55);
}
[data-theme="dark"] .time-slot-click-area.non-working-hour {
  background-color: rgba(15, 23, 42, 0.4);
}
[data-theme="dark"] .week-day-col.non-working-day {
  background-color: rgba(30, 41, 59, 0.35);
}

/* ── Keyboard Shortcuts Modal Styles ─────────────────────────────────────────── */
.shortcut-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 6px);
}
.shortcut-desc {
  font-size: 13px;
  color: var(--ink);
}
.shortcut-key {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}
.shortcut-badge {
  font-family: var(--font-mono, monospace);
  font-size: 12px;
  font-weight: 600;
  padding: 2px 7px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--ink);
}

/* ── Component Classes (Issue #110 alignment) ──────────────────────────────── */
.btn-secondary {
  border: var(--border-w) solid var(--border);
  color: var(--ink);
  background: transparent;
  padding: 6px 12px;
  border-radius: var(--radius-control);
  font-size: var(--fs-small);
  cursor: pointer;
  transition: background var(--t);
}
.btn-secondary:hover {
  background: var(--surface-hover);
}

.popover-attachments {
  margin-top: var(--sp-2);
  padding-top: var(--sp-2);
  border-top: var(--border-w) solid var(--border);
}
.attachment-drive-link {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  font-size: var(--fs-small);
  color: var(--line);
}

.popover-color-bar {
  height: 4px;
  width: 100%;
  border-radius: var(--radius-pill);
  margin-bottom: var(--sp-2);
}
.popover-meta {
  font-size: var(--fs-small);
  color: var(--ink-muted);
  margin-bottom: var(--sp-2);
}
.popover-actions {
  display: flex;
  gap: var(--sp-2);
  justify-content: flex-end;
  margin-top: var(--sp-3);
}

.toast-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.toast-msg {
  flex: 1;
  font-size: var(--fs-small);
  color: var(--ink);
}
.toast-action {
  cursor: pointer;
  color: var(--ink);
  font-size: var(--fs-small);
  background: transparent;
  border: var(--border-w) solid var(--line);
  padding: 2px 8px;
}
#typed-confirm-input { width: 100%; margin: 8px 0 16px; }
.typed-confirm-actions { display: flex; gap: 10px; justify-content: flex-end; }
.trash-hint { font-size: var(--fs-small); color: var(--ink-muted); margin: 0 0 8px; }
.toast-close {
  cursor: pointer;
  color: var(--ink-muted);
  opacity: 0.7;
  border: none;
  background: transparent;
}

.btn-revoke-share {
  color: var(--danger);
  font-size: var(--fs-small);
  border: 1px solid var(--danger);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
}
.share-role-toggle {
  font-size: var(--fs-small);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
}

.agenda-events {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.agenda-event-loc {
  font-size: var(--fs-small);
  color: var(--ink-muted);
}

/* prefers-reduced-motion accessibility support */
@media (prefers-reduced-motion: reduce) {
  :root {
    --t: 0s !important;
    --t-slow: 0s !important;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}










/* #512: address suggestions under the location field and the map preview of the chosen place */
.location-field { position: relative; }
.location-suggestions {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 20;
  list-style: none; margin: 2px 0 0; padding: 0; max-height: 200px; overflow-y: auto;
  background: var(--surface); border: var(--border-w) solid var(--border); border-radius: var(--radius-sm, 4px);
}
.location-option { padding: 6px 8px; font-size: 12px; color: var(--ink); cursor: pointer; }
.location-option:hover, .location-option.active { background: var(--surface-hover); }
.location-status { font-size: 11px; color: var(--ink-muted); }
.location-status:empty { display: none; }
.location-map {
  position: relative; height: 160px; margin-top: 6px; overflow: hidden;
  border: var(--border-w) solid var(--border); border-radius: var(--radius-sm, 4px); background: var(--surface-hover);
}
.location-map-tiles { position: absolute; width: 512px; height: 512px; display: grid; grid-template-columns: 256px 256px; }
.location-map-tiles img { width: 256px; height: 256px; display: block; }
.location-map-pin {
  position: absolute; left: 50%; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px;
  border-radius: 50%; border: 3px solid #fff; background: #d64545; box-sizing: border-box;
}
/* #521: video conference link in the event dialog */
.conference-field:has(> .hidden + .hidden) { display: none; }
.conference-link { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.conference-link .form-label { margin: 0; }
.conference-link a { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.location-map-credit {
  position: absolute; right: 0; bottom: 0; padding: 1px 4px; font-size: 10px;
  background: rgba(255, 255, 255, 0.8); color: #333;
}
