:root {
  color-scheme: dark;
  --paper: #0c0e13;
  --surface: #12151c;
  --surface-soft: #171a22;
  --surface-raised: #1d212b;
  --surface-hover: #242936;
  --ink: #f2f3f7;
  --ink-soft: #c7cad3;
  --muted: #9298a6;
  --line: #292e39;
  --line-strong: #3a414f;
  --accent: #887cff;
  --accent-dark: #7768ee;
  --accent-soft: #292544;
  --danger: #ff738a;
  --danger-soft: #382129;
  --shadow-sm: 0 4px 18px rgb(0 0 0 / 28%);
  --shadow-md: 0 24px 70px rgb(0 0 0 / 48%);
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --sidebar-width: 276px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

html { scrollbar-color: var(--line-strong) transparent; }

::selection { background: rgb(136 124 255 / 32%); }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }

button, a { -webkit-tap-highlight-color: transparent; }

button { color: inherit; }

a { color: inherit; text-decoration: none; }

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgb(136 124 255 / 34%);
  outline-offset: 2px;
}

.muted { color: var(--muted); }

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-size: 19px;
  font-weight: 760;
  letter-spacing: -.03em;
}

.brand--large { font-size: 22px; }

.brand__mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 11px;
  background: var(--accent);
  color: white;
  box-shadow: 0 7px 20px rgb(136 124 255 / 28%);
  font-size: 16px;
  font-weight: 850;
}

.button,
.icon-button {
  border: 0;
  cursor: pointer;
  transition: background .18s ease, color .18s ease, transform .18s ease, box-shadow .18s ease;
}

.button:active,
.icon-button:active { transform: scale(.97); }

.button {
  min-height: 40px;
  padding: 0 16px;
  border-radius: 12px;
  font-weight: 700;
}

.button--primary {
  background: var(--accent);
  color: white;
  box-shadow: 0 7px 20px rgb(136 124 255 / 24%);
}

.button--primary:hover { background: var(--accent-dark); }

.button--quiet { background: var(--surface-raised); color: var(--ink-soft); }

.button--quiet:hover { background: var(--surface-hover); }

.button--danger-text { background: transparent; color: var(--danger); }

.button--danger-text:hover { background: var(--danger-soft); }

.button--large { min-height: 51px; font-size: 16px; }

.icon-button {
  display: grid;
  width: 38px;
  height: 38px;
  padding: 0;
  place-items: center;
  border-radius: 11px;
  background: transparent;
  font-size: 23px;
}

.icon-button:hover { background: var(--surface-hover); }

/* Login */
.login-page { overflow-x: hidden; }

.login-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(420px, 1.05fr) minmax(420px, .95fr);
}

.login-copy {
  position: relative;
  display: flex;
  min-height: 100vh;
  padding: 48px clamp(44px, 7vw, 112px);
  flex-direction: column;
  overflow: hidden;
  background: #0f1218;
}

.login-copy::before,
.login-copy::after {
  position: absolute;
  content: "";
  border-radius: 999px;
  filter: blur(2px);
}

.login-copy::before {
  width: 480px;
  height: 480px;
  right: -230px;
  top: 15%;
  background: rgb(136 124 255 / 16%);
}

.login-copy::after {
  width: 340px;
  height: 340px;
  left: -200px;
  bottom: -70px;
  background: rgb(36 198 148 / 10%);
}

.login-copy__content {
  position: relative;
  z-index: 1;
  max-width: 600px;
  margin: auto 0;
  padding: 70px 0 30px;
}

.login-copy h1 {
  margin: 0 0 22px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(42px, 5vw, 69px);
  font-weight: 500;
  letter-spacing: -.05em;
  line-height: 1.02;
}

.login-copy__content > p:not(.eyebrow) {
  max-width: 500px;
  margin: 0;
  color: var(--ink-soft);
  font-size: 18px;
  line-height: 1.65;
}

.login-preview {
  width: min(430px, 90%);
  margin-top: 46px;
  padding: 22px;
  border: 1px solid rgb(255 255 255 / 9%);
  border-radius: 24px;
  background: rgb(23 26 34 / 72%);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(15px);
}

.login-preview__date {
  display: flex;
  margin-bottom: 16px;
  justify-content: space-between;
  color: var(--muted);
}

.login-preview__date b { color: var(--ink); }

.login-preview__event {
  display: grid;
  margin: 8px 0;
  padding: 12px 14px;
  grid-template-columns: 57px 1fr;
  border-left: 4px solid;
  border-radius: 9px;
  background: var(--surface-raised);
  box-shadow: 0 3px 14px rgb(0 0 0 / 18%);
}

.login-preview__event time { color: var(--muted); font-variant-numeric: tabular-nums; }
.login-preview__event--purple { border-color: #6d5dfb; }
.login-preview__event--blue { border-color: #147dff; }
.login-preview__event--green { border-color: #12a67d; }

.login-panel {
  display: grid;
  min-height: 100vh;
  padding: 32px;
  place-items: center;
  background: var(--surface);
}

.login-card {
  display: grid;
  width: min(420px, 100%);
  gap: 21px;
}

.login-card h2 { margin: 0 0 9px; font-size: 31px; letter-spacing: -.04em; }
.login-card p { margin: 0; line-height: 1.5; }
.login-card__mobile-brand { display: none; align-items: center; gap: 11px; font-size: 20px; font-weight: 750; }
.login-card__hint { color: var(--muted); font-size: 12px; text-align: center; }
.link-required { display: grid; width: min(520px, calc(100% - 40px)); min-height: 100vh; margin: auto; place-content: center; justify-items: center; text-align: center; }
.link-required .brand__mark { width: 48px; height: 48px; margin-bottom: 25px; border-radius: 15px; font-size: 20px; }
.link-required h1 { margin: 0 0 13px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(32px, 6vw, 48px); font-weight: 500; letter-spacing: -.04em; }
.link-required > p:last-child { max-width: 470px; margin: 0; color: var(--muted); line-height: 1.65; }

/* App shell */
.app-page { overflow: hidden; }

.app-shell { display: flex; height: 100vh; min-height: 520px; }

.sidebar {
  z-index: 30;
  display: flex;
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  height: 100vh;
  padding: 25px 20px 18px;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--surface-soft);
  overflow-y: auto;
}

.sidebar__top { display: flex; align-items: center; justify-content: space-between; }
.sidebar__close, .menu-button { display: none; }
.new-event-button { display: flex; width: 100%; margin: 27px 0 24px; align-items: center; justify-content: center; gap: 8px; }
.new-event-button span { font-size: 20px; font-weight: 400; }

.mini-calendar { padding: 3px 2px 22px; border-bottom: 1px solid var(--line); }
.mini-calendar__header { display: flex; height: 38px; align-items: center; justify-content: space-between; }
.mini-calendar__header strong { font-size: 13px; text-transform: capitalize; }
.mini-calendar__header .icon-button { width: 30px; height: 30px; font-size: 20px; }
.mini-calendar__weekdays,
.mini-calendar__grid { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; }
.mini-calendar__weekdays { padding: 6px 0; color: var(--muted); font-size: 9px; font-weight: 750; text-transform: uppercase; }
.mini-day {
  display: grid;
  width: 27px;
  height: 27px;
  margin: 1px auto;
  place-items: center;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 11px;
}
.mini-day:hover { background: var(--surface-hover); }
.mini-day--outside { color: #5f6674; }
.mini-day--today { color: var(--accent); font-weight: 800; box-shadow: inset 0 0 0 1px var(--accent); }
.mini-day--selected { background: var(--accent); color: white; font-weight: 800; box-shadow: none; }

.calendar-list-section { padding: 20px 2px 8px; }
.section-heading { display: flex; margin-bottom: 10px; align-items: center; justify-content: space-between; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.section-heading .icon-button { width: 27px; height: 27px; color: var(--muted); font-size: 18px; }
.calendar-list { display: grid; gap: 2px; }
.calendar-toggle { display: flex; min-height: 37px; padding: 0 7px; align-items: center; gap: 10px; border-radius: 9px; cursor: pointer; }
.calendar-toggle:hover { background: var(--surface-hover); }
.calendar-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.calendar-toggle__dot { width: 10px; height: 10px; border-radius: 4px; background: var(--calendar-color); box-shadow: 0 0 0 3px color-mix(in srgb, var(--calendar-color) 15%, transparent); }
.calendar-toggle span:last-child { flex: 1; font-size: 13px; }
.calendar-toggle input:not(:checked) + .calendar-toggle__dot { background: transparent; box-shadow: inset 0 0 0 1.5px #626978; }
.calendar-toggle:has(input:not(:checked)) span:last-child { color: #6f7684; }

.sidebar__links { display: grid; margin-top: auto; padding: 17px 3px; gap: 3px; border-top: 1px solid var(--line); }
.sidebar__links a, .sidebar__links button { display: flex; min-height: 36px; padding: 0 8px; align-items: center; gap: 10px; border: 0; border-radius: 9px; background: transparent; color: var(--ink-soft); cursor: pointer; font-size: 12px; text-align: left; }
.sidebar__links a:hover, .sidebar__links button:hover { background: var(--surface-hover); }
.sidebar__links span { width: 16px; color: var(--muted); font-size: 16px; }
.sidebar__footer { display: flex; padding: 15px 1px 0; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); }
.user-chip { display: flex; min-width: 0; align-items: center; gap: 9px; }
.user-chip__avatar { display: grid; width: 31px; height: 31px; place-items: center; border-radius: 50%; background: var(--accent-soft); color: #d9d4ff; font-size: 12px; font-weight: 750; }
.user-chip div { display: grid; min-width: 0; }
.user-chip strong { max-width: 135px; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.user-chip small { color: var(--muted); font-size: 9px; }
.sidebar__footer .icon-button { width: 31px; height: 31px; color: var(--muted); font-size: 16px; }
.sidebar-backdrop { display: none; }

.calendar-main { position: relative; display: flex; min-width: 0; flex: 1; flex-direction: column; background: var(--surface); }
.topbar { z-index: 5; padding: 18px 26px 13px; border-bottom: 1px solid var(--line); background: rgb(18 21 28 / 94%); backdrop-filter: blur(16px); }
.topbar__primary { display: flex; min-height: 43px; align-items: center; justify-content: space-between; gap: 22px; }
.date-navigation { display: flex; min-width: 0; align-items: center; gap: 10px; }
.date-navigation h1 { margin: 0 0 0 9px; overflow: hidden; font-size: 20px; font-weight: 760; letter-spacing: -.035em; text-overflow: ellipsis; text-transform: capitalize; white-space: nowrap; }
.nav-arrows { display: flex; }
.nav-arrows .icon-button { width: 31px; height: 34px; color: var(--ink-soft); font-size: 20px; }
.topbar__actions { display: flex; align-items: center; gap: 10px; }
.search-button { width: 36px; height: 36px; background: var(--surface-raised); font-size: 21px; }
.view-switcher { display: flex; padding: 3px; border-radius: 12px; background: var(--surface-raised); }
.view-switcher button { min-height: 31px; padding: 0 11px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer; font-size: 11px; font-weight: 700; }
.view-switcher button:hover { color: var(--ink); }
.view-switcher button.is-active { background: var(--surface-hover); color: var(--ink); box-shadow: 0 2px 8px rgb(0 0 0 / 20%); }

.quick-capture { display: flex; max-width: 680px; height: 38px; margin-top: 12px; padding: 0 6px 0 13px; align-items: center; gap: 9px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); transition: border .2s, box-shadow .2s; }
.quick-capture:focus-within { border-color: rgb(136 124 255 / 55%); box-shadow: 0 0 0 3px rgb(136 124 255 / 12%); }
.quick-capture > span { color: var(--accent); }
.quick-capture input { min-width: 0; height: 100%; flex: 1; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 12px; }
.quick-capture input::placeholder { color: #6f7684; }
.quick-capture button { padding: 6px 9px; border: 0; border-radius: 8px; background: transparent; color: var(--accent); cursor: pointer; font-size: 11px; font-weight: 750; }
.quick-capture.is-loading button { color: var(--muted); pointer-events: none; }

.calendar-workspace { position: relative; min-height: 0; flex: 1; overflow: auto; overscroll-behavior: contain; }
#calendar-view { min-height: 100%; }
.loading-state { position: absolute; inset: 0; z-index: 4; display: grid; place-content: center; justify-items: center; background: rgb(18 21 28 / 86%); color: var(--muted); }
.loading-state[hidden] { display: none; }
.spinner { width: 27px; height: 27px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
.loading-state p { margin: 11px 0; font-size: 12px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Month */
.month-view { display: grid; min-width: 780px; min-height: 100%; grid-template-rows: 34px minmax(680px, 1fr); }
.month-weekdays, .month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.month-weekdays { position: sticky; top: 0; z-index: 3; border-bottom: 1px solid var(--line); background: var(--surface); color: var(--muted); }
.month-weekdays span { display: flex; padding: 0 10px; align-items: center; justify-content: flex-end; font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.month-grid { grid-template-rows: repeat(6, minmax(110px, 1fr)); }
.month-day { position: relative; min-width: 0; padding: 7px 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--surface); }
.month-day:nth-child(7n) { border-right: 0; }
.month-day:hover { background: var(--surface-soft); }
.month-day.is-outside { background: #0f1218; }
.month-day.is-outside .month-day__number { color: #565d6a; }
.month-day.is-today::after { position: absolute; inset: 3px; border: 1px solid rgb(136 124 255 / 33%); border-radius: 11px; content: ""; pointer-events: none; }
.month-day__number { display: grid; width: 25px; height: 25px; margin: 0 0 5px auto; place-items: center; border-radius: 9px; color: var(--ink-soft); font-size: 11px; }
.month-day.is-today .month-day__number { background: var(--accent); color: white; font-weight: 800; }
.month-day__events { position: relative; z-index: 1; display: grid; gap: 3px; }
.month-event { display: flex; width: 100%; min-height: 25px; padding: 4px 7px; align-items: center; gap: 5px; overflow: hidden; border: 0; border-left: 3px solid var(--event-color); border-radius: 6px; background: color-mix(in srgb, var(--event-color) 22%, var(--surface-raised)); color: var(--ink); cursor: pointer; font-size: 10px; text-align: left; }
.month-event:hover { background: color-mix(in srgb, var(--event-color) 31%, var(--surface-raised)); }
.month-event.is-done { opacity: .58; text-decoration: line-through; }
.month-event time { color: color-mix(in srgb, var(--event-color) 72%, #f4f2ff); font-size: 9px; font-weight: 750; font-variant-numeric: tabular-nums; }
.month-event span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.month-more { padding: 2px 7px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 9px; text-align: left; }

/* Week and day */
.time-view { min-width: 760px; min-height: 100%; }
.time-header { position: sticky; top: 0; z-index: 4; display: grid; grid-template-columns: 58px repeat(var(--day-count), minmax(120px, 1fr)); height: 63px; border-bottom: 1px solid var(--line); background: rgb(18 21 28 / 96%); backdrop-filter: blur(12px); }
.time-header__zone { display: grid; place-items: end center; padding-bottom: 8px; color: var(--muted); font-size: 8px; }
.time-header__day { display: flex; align-items: center; justify-content: center; gap: 8px; border-left: 1px solid var(--line); }
.time-header__day span { color: var(--muted); font-size: 10px; font-weight: 750; text-transform: uppercase; }
.time-header__day b { display: grid; width: 30px; height: 30px; place-items: center; border-radius: 10px; font-size: 12px; }
.time-header__day.is-today b { background: var(--accent); color: white; }
.time-grid { position: relative; display: grid; grid-template-columns: 58px repeat(var(--day-count), minmax(120px, 1fr)); height: 1152px; background: repeating-linear-gradient(to bottom, transparent 0, transparent 47px, var(--line) 47px, var(--line) 48px); }
.time-labels { position: relative; }
.time-label { position: absolute; right: 10px; transform: translateY(-50%); color: var(--muted); font-size: 9px; font-variant-numeric: tabular-nums; }
.time-column { position: relative; border-left: 1px solid var(--line); }
.time-column::after { position: absolute; inset: 0; background: repeating-linear-gradient(to bottom, transparent 0, transparent 23px, rgb(58 65 79 / 42%) 23px, rgb(58 65 79 / 42%) 24px); content: ""; pointer-events: none; }
.time-column.is-today { background: rgb(136 124 255 / 4%); }
.time-event { position: absolute; z-index: 2; left: 4px; right: 4px; min-height: 23px; padding: 6px 7px; overflow: hidden; border: 0; border-left: 3px solid var(--event-color); border-radius: 7px; background: color-mix(in srgb, var(--event-color) 24%, var(--surface-raised)); color: var(--ink); cursor: pointer; text-align: left; box-shadow: 0 2px 8px rgb(0 0 0 / 15%); }
.time-event:hover { z-index: 3; background: color-mix(in srgb, var(--event-color) 33%, var(--surface-raised)); box-shadow: var(--shadow-sm); }
.time-event.is-done { opacity: .55; }
.time-event b { display: block; overflow: hidden; font-size: 10px; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.time-event span { display: block; margin-top: 2px; color: var(--ink-soft); font-size: 8px; font-variant-numeric: tabular-nums; }
.now-line { position: absolute; z-index: 3; left: 0; right: 0; height: 1px; background: #e64263; pointer-events: none; }
.now-line::before { position: absolute; left: -4px; top: -4px; width: 8px; height: 8px; border-radius: 50%; background: #e64263; content: ""; }

/* Agenda */
.agenda-view { max-width: 940px; min-height: 100%; margin: 0 auto; padding: 24px clamp(18px, 4vw, 52px) 80px; }
.agenda-day { display: grid; grid-template-columns: 115px 1fr; padding: 15px 0 25px; border-bottom: 1px solid var(--line); }
.agenda-day__date { position: sticky; top: 20px; align-self: start; }
.agenda-day__date b { display: block; font-size: 13px; text-transform: capitalize; }
.agenda-day__date span { color: var(--muted); font-size: 10px; }
.agenda-day__events { display: grid; gap: 8px; }
.agenda-event { display: grid; min-height: 58px; padding: 11px 14px; grid-template-columns: 62px 5px 1fr auto; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-raised); cursor: pointer; text-align: left; box-shadow: 0 2px 8px rgb(0 0 0 / 14%); }
.agenda-event:hover { border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.agenda-event.is-done { opacity: .55; }
.agenda-event__time { color: var(--ink-soft); font-size: 11px; font-weight: 750; font-variant-numeric: tabular-nums; }
.agenda-event__bar { width: 4px; height: 29px; border-radius: 8px; background: var(--event-color); }
.agenda-event__content { min-width: 0; }
.agenda-event__content b { display: block; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.agenda-event__content span { display: block; margin-top: 3px; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.agenda-event__calendar { padding: 5px 8px; border-radius: 8px; background: color-mix(in srgb, var(--event-color) 22%, var(--surface-raised)); color: color-mix(in srgb, var(--event-color) 72%, #f4f2ff); font-size: 9px; font-weight: 700; }
.empty-state { display: grid; min-height: 420px; place-content: center; justify-items: center; color: var(--muted); text-align: center; }
.empty-state__icon { display: grid; width: 60px; height: 60px; margin-bottom: 14px; place-items: center; border-radius: 20px; background: var(--accent-soft); color: var(--accent); font-size: 27px; }
.empty-state h2 { margin: 0 0 7px; color: var(--ink); font-size: 18px; }
.empty-state p { max-width: 310px; margin: 0 0 18px; font-size: 12px; line-height: 1.6; }

.fab { position: fixed; z-index: 20; right: 22px; bottom: 82px; display: none; width: 54px; height: 54px; border: 0; border-radius: 18px; background: var(--accent); color: white; cursor: pointer; box-shadow: 0 13px 30px rgb(136 124 255 / 34%); font-size: 28px; }
.mobile-nav { display: none; }

/* Forms and dialogs */
.field { display: grid; gap: 7px; }
.field > span { color: var(--ink-soft); font-size: 11px; font-weight: 700; }
.field input, .field select, .field textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  outline: 0;
  background: var(--surface-raised);
  color: var(--ink);
  transition: border .15s, box-shadow .15s;
}
.field textarea { min-height: 78px; resize: vertical; line-height: 1.5; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: rgb(136 124 255 / 60%); box-shadow: 0 0 0 3px rgb(136 124 255 / 12%); }
.field--title input { min-height: 49px; font-size: 16px; font-weight: 700; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.form-grid--date { grid-template-columns: 1.25fr .8fr .8fr; }
.check-field { display: flex; align-items: center; gap: 9px; color: var(--ink-soft); font-size: 12px; cursor: pointer; }
.check-field input { width: 16px; height: 16px; accent-color: var(--accent); }
.form-error { padding: 10px 12px; border: 1px solid #703645; border-radius: 10px; background: var(--danger-soft); color: #ff9bad; font-size: 12px; line-height: 1.45; }

.modal {
  width: auto;
  max-width: none;
  height: auto;
  max-height: none;
  padding: 0;
  border: 0;
  background: transparent;
}
.modal::backdrop { background: rgb(3 5 9 / 72%); backdrop-filter: blur(5px); }
.modal[open] { animation: dialog-in .18s ease-out; }
@keyframes dialog-in { from { opacity: 0; transform: translateY(10px) scale(.985); } }
.modal-card { display: grid; width: min(620px, calc(100vw - 30px)); max-height: calc(100vh - 34px); padding: 24px; gap: 17px; overflow-y: auto; border: 1px solid var(--line-strong); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-md); }
.modal-card__header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.modal-card__header h2 { margin: 0; font-size: 22px; letter-spacing: -.035em; }
.modal-card__header .icon-button { margin: -5px -5px 0 0; color: var(--muted); }
.modal-card__footer { display: flex; padding-top: 4px; align-items: center; justify-content: space-between; gap: 12px; }
.modal-card__danger-actions, .modal-card__primary-actions { display: flex; align-items: center; gap: 7px; }
.small-form { width: min(430px, calc(100vw - 30px)); }
.quick-preview { width: min(620px, calc(100vw - 30px)); }
.quick-preview-list { display: grid; gap: 8px; }
.quick-preview-event { display: grid; padding: 13px 14px; grid-template-columns: 43px 1fr; gap: 11px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); }
.quick-preview-event__index { display: grid; width: 35px; height: 35px; place-items: center; border-radius: 11px; background: var(--accent-soft); color: var(--accent); font-weight: 800; }
.quick-preview-event b { display: block; font-size: 13px; }
.quick-preview-event span { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.search-modal { width: min(680px, calc(100vw - 30px)); padding: 0; gap: 0; overflow: hidden; }
.search-modal__header { display: grid; height: 66px; padding: 0 15px 0 21px; grid-template-columns: 24px 1fr 38px; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); }
.search-modal__header > span { color: var(--accent); font-size: 23px; }
.search-modal__header input { height: 100%; border: 0; outline: 0; background: transparent; font-size: 17px; }
.search-results { min-height: 190px; max-height: min(570px, calc(100vh - 150px)); padding: 10px; overflow-y: auto; }
.search-result { display: grid; width: 100%; padding: 12px; grid-template-columns: 5px 1fr auto; align-items: center; gap: 12px; border: 0; border-radius: 11px; background: transparent; cursor: pointer; text-align: left; }
.search-result:hover { background: var(--surface-soft); }
.search-result__bar { width: 4px; height: 32px; border-radius: 8px; background: var(--event-color); }
.search-result b { display: block; font-size: 13px; }
.search-result span { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.search-result time { color: var(--muted); font-size: 10px; }
.empty-copy { margin: 55px 15px; color: var(--muted); font-size: 12px; text-align: center; }

.toast-region { position: fixed; z-index: 100; right: 20px; bottom: 20px; display: grid; width: min(350px, calc(100vw - 30px)); gap: 8px; pointer-events: none; }
.toast { padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: 12px; background: #242936; color: white; box-shadow: var(--shadow-md); font-size: 12px; line-height: 1.45; animation: toast-in .2s ease-out; }
.toast--error { background: #6f2c3a; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 980px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-102%); box-shadow: var(--shadow-md); transition: transform .23s ease; }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar__close, .menu-button { display: grid; }
  .sidebar-backdrop { position: fixed; inset: 0; z-index: 25; border: 0; background: rgb(3 5 9 / 62%); }
  .sidebar-backdrop.is-open { display: block; }
  .topbar { padding-left: 17px; padding-right: 17px; }
  .topbar__primary { justify-content: flex-start; }
  .date-navigation { flex: 1; }
  .topbar__actions { margin-left: auto; }
  .view-switcher { display: none; }
}

@media (max-width: 700px) {
  .login-shell { display: block; min-height: 100dvh; background: var(--surface); }
  .login-copy { display: none; }
  .login-panel { min-height: 100dvh; padding: 24px; }
  .login-card__mobile-brand { display: flex; margin-bottom: 32px; }
  .login-card h2 { font-size: 27px; }
  .app-shell { height: 100dvh; min-height: 0; }
  .topbar { padding: 10px 12px 9px; }
  .topbar__primary { min-height: 38px; gap: 5px; }
  .menu-button { width: 35px; height: 35px; font-size: 18px; }
  .date-navigation { gap: 3px; }
  .date-navigation .button--quiet { display: none; }
  .nav-arrows .icon-button { width: 29px; }
  .date-navigation h1 { margin-left: 5px; font-size: 16px; }
  .topbar__actions { gap: 2px; }
  .search-button { width: 35px; height: 35px; }
  .quick-capture { height: 39px; margin-top: 8px; }
  .quick-capture input { font-size: 11px; }
  .quick-capture button { display: none; }
  .calendar-workspace { padding-bottom: 66px; }
  .month-view { min-width: 630px; }
  .month-grid { grid-template-rows: repeat(6, minmax(92px, 1fr)); }
  .month-day { padding: 5px 4px; }
  .month-event { min-height: 22px; padding: 3px 5px; }
  .time-view { min-width: 600px; }
  .agenda-view { padding: 10px 14px 110px; }
  .agenda-day { grid-template-columns: 1fr; gap: 10px; padding: 14px 0 20px; }
  .agenda-day__date { position: static; display: flex; align-items: baseline; gap: 8px; }
  .agenda-event { grid-template-columns: 51px 4px 1fr; gap: 9px; padding: 10px; }
  .agenda-event__calendar { display: none; }
  .fab { display: block; }
  .mobile-nav { position: fixed; z-index: 15; left: 0; right: 0; bottom: 0; display: grid; height: calc(66px + env(safe-area-inset-bottom)); padding: 6px 11px env(safe-area-inset-bottom); grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); background: rgb(18 21 28 / 96%); backdrop-filter: blur(18px); }
  .mobile-nav button { display: grid; padding: 3px 0; place-content: center; justify-items: center; gap: 2px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-size: 9px; font-weight: 700; }
  .mobile-nav button span { font-size: 17px; }
  .mobile-nav button.is-active { color: var(--accent); }
  .modal { margin: auto auto 0; }
  .modal-card { width: 100vw; max-height: 92dvh; padding: 20px 17px calc(18px + env(safe-area-inset-bottom)); border-radius: 24px 24px 0 0; }
  .form-grid, .form-grid--date { grid-template-columns: 1fr 1fr; }
  .form-grid--date .field:first-child { grid-column: 1 / -1; }
  .modal-card__footer { align-items: stretch; flex-direction: column-reverse; }
  .modal-card__danger-actions, .modal-card__primary-actions { justify-content: stretch; }
  .modal-card__danger-actions .button, .modal-card__primary-actions .button { flex: 1; }
  .search-modal { width: 100vw; height: min(88dvh, 700px); border-radius: 24px 24px 0 0; }
  .search-results { max-height: none; flex: 1; }
  .toast-region { right: 15px; bottom: calc(77px + env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
