
/* CalendarIA: responsive application navigation and accessible overlays. */
:root { --nav-rail-width: 78px; --nav-dialog-bg: #fffcf9; --nav-dialog-text: #17191d; --nav-dialog-muted: #646a73; --nav-dialog-border: #e6e1da; }
html[data-calendar-theme="dark"] { --nav-dialog-bg: #202124; --nav-dialog-text: #f6f3ef; --nav-dialog-muted: #bbb9b6; --nav-dialog-border: #47474b; }
@media (min-width: 768px) {
  body { padding-left: var(--nav-rail-width); }
  .site-header, .app-shell, .site-footer { max-width: var(--max-width); }
}
.app-sidebar { position: fixed; z-index: 1400; inset: 18px auto 18px 14px; width: 64px; padding: 14px 7px; border-radius: 30px; display: flex; flex-direction: column; justify-content: space-between; align-items: center; background: #101113; color: #fff; border: 1px solid rgba(255,255,255,.12); box-shadow: 0 22px 62px rgba(0,0,0,.26); }
.nav-group { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 9px; }
.nav-divider { width: 27px; height: 1px; background: rgba(255,255,255,.17); margin: 9px 0; }
.nav-item, .nav-brand { color: inherit; border: 0; background: transparent; cursor: pointer; position: relative; width: 46px; height: 46px; border-radius: 16px; display: flex; align-items: center; justify-content: center; flex: none; transition: background .17s ease, transform .17s ease; }
.nav-item:hover, .nav-item:focus-visible, .nav-item.is-active { background: #323437; }
.nav-item:active, .nav-brand:active { transform: scale(.95); }
.nav-item svg, .nav-brand svg { width: 21px; height: 21px; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.nav-brand { width: 43px; height: 43px; background: #fff; border-radius: 15px; margin-bottom: 17px; padding: 6px; }
.nav-brand img { display: block; width: 100%; height: 100%; object-fit: contain; border-radius: 7px; }
.nav-item[data-nav="logout"] { color: #f5d3cf; }
.nav-caption { position: absolute; top: 50%; left: calc(100% + 12px); transform: translateY(-50%) translateX(-5px); white-space: nowrap; background: #1b1d20; border: 1px solid #45464a; color: #fff; padding: 8px 12px; border-radius: 9px; font-weight: 600; font-size: 12px; opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .16s, transform .16s; box-shadow: 0 10px 20px #0003; }
.nav-item:hover .nav-caption, .nav-item:focus-visible .nav-caption { opacity: 1; visibility: visible; transform: translateY(-50%) translateX(0); }
.nav-avatar { width: 28px; height: 28px; border-radius: 50%; display: block; object-fit: cover; background: #484b50; border: 2px solid #fff; }
.nav-avatar-fallback { background: #43464a; border-radius: 50%; width: 29px; height: 29px; display: grid; place-items: center; font-weight: 700; font-size: 12px; }
.mobile-nav-toggle, .nav-scrim { display: none; }
body:not(.is-categories-view) #eventCategoriesSection { display: none !important; }
body.is-categories-view .workspace { display: none !important; }
body.is-categories-view #eventCategoriesSection { display: block !important; width: 100%; margin: 0 auto 30px; }
body.is-categories-view .app-shell { display: block; }
.nav-overlay { border: 1px solid var(--nav-dialog-border); padding: 0; width: min(510px, calc(100% - 32px)); max-height: min(800px, calc(100dvh - 32px)); overflow: auto; border-radius: 25px; background: var(--nav-dialog-bg); color: var(--nav-dialog-text); box-shadow: 0 32px 100px #0007; }
.nav-overlay::backdrop { background: rgba(8,10,13,.65); backdrop-filter: blur(5px); }
.nav-modal { padding: 27px; min-width: 0; }
.nav-modal-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 24px; }
.nav-modal-eyebrow { margin: 0 0 4px; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .2em; color: var(--nav-dialog-muted); }
.nav-modal h2 { color: var(--nav-dialog-text); margin: 0; font-size: clamp(23px,4vw,29px); line-height: 1.22; letter-spacing: -.04em; }
.nav-modal-description { color: var(--nav-dialog-muted); line-height: 1.6; margin: 0 0 20px; font-size: 14px; }
.nav-close { display: grid; place-items: center; width: 39px; height: 39px; flex: none; border-radius: 12px; border: 1px solid var(--nav-dialog-border); background: transparent; cursor: pointer; color: inherit; font-size: 22px; }
.nav-profile-card { display: flex; align-items: center; gap: 16px; padding: 20px; border: 1px solid var(--nav-dialog-border); background: color-mix(in srgb, var(--nav-dialog-bg) 88%, #b7b6ba 12%); border-radius: 19px; min-width: 0; }
.nav-profile-photo { width: 70px; height: 70px; border-radius: 50%; flex: none; object-fit: cover; background: #ddd; }
.nav-profile-initials { width: 70px; height: 70px; display: grid; place-items: center; border-radius: 50%; background: #34363a; color: #fff; flex: none; font-weight: 800; font-size: 24px; }
.nav-profile-details { min-width: 0; }
.nav-profile-details strong { display: block; font-size: 17px; overflow-wrap: anywhere; }
.nav-profile-details p { color: var(--nav-dialog-muted); margin: 4px 0 0; font-size: 13px; overflow-wrap: anywhere; }
.nav-profile-hint { margin-top: 16px; color: var(--nav-dialog-muted); font-size: 12px; line-height: 1.6; }
.nav-choice-list { display: grid; gap: 10px; }
.nav-choice { display: flex; align-items: center; gap: 12px; cursor: pointer; padding: 14px 15px; border: 1px solid var(--nav-dialog-border); border-radius: 14px; font-size: 14px; font-weight: 700; }
.nav-choice:has(input:checked) { outline: 2px solid var(--nav-dialog-text); outline-offset: -2px; }
.nav-choice input { accent-color: #111316; width: 17px; height: 17px; }
.nav-choice small { color: var(--nav-dialog-muted); display: block; font-size: 12px; font-weight: 400; margin-top: 3px; }
.nav-settings-group { border-top: 1px solid var(--nav-dialog-border); padding: 20px 0; }
.nav-settings-group h3 { margin: 0 0 10px; font-size: 15px; }
.nav-settings-group p { color: var(--nav-dialog-muted); font-size: 13px; margin: 0 0 14px; line-height: 1.5; }
.nav-notifications { display: flex; flex-wrap: wrap; gap: 8px; }
.nav-notifications label { cursor: pointer; border: 1px solid var(--nav-dialog-border); border-radius: 25px; display: flex; align-items: center; gap: 7px; padding: 9px 12px; font-size: 12px; font-weight: 600; }
.nav-notifications input { accent-color: #111316; }
.nav-modal-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 18px; }
.nav-action { border: 1px solid var(--nav-dialog-border); border-radius: 12px; color: inherit; background: transparent; padding: 12px 17px; font-weight: 700; cursor: pointer; font-size: 13px; }
.nav-action-primary { background: var(--nav-dialog-text); color: var(--nav-dialog-bg); border-color: var(--nav-dialog-text); }
.nav-action-danger { color: #d1535a; }
.nav-help-list { display: grid; gap: 11px; }
.nav-help-list details { border: 1px solid var(--nav-dialog-border); border-radius: 14px; padding: 13px 15px; }
.nav-help-list summary { cursor: pointer; font-size: 14px; font-weight: 700; }
.nav-help-list p { color: var(--nav-dialog-muted); margin: 12px 0 0; font-size: 13px; line-height: 1.6; }
.nav-help-list button { margin-top: 10px; }
.nav-badge { display: inline-flex; gap: 6px; align-items: center; background: #e8f6ed; color: #236c45; border-radius: 18px; font-size: 12px; font-weight: 700; padding: 5px 10px; }
html[data-calendar-theme="dark"] .nav-badge { background: #1c3c30; color: #a1ecc0; }
html[data-calendar-theme="light"] .site-header .brand, html[data-calendar-theme="light"] .user-chip { color: #1d2027; }
@media (max-width: 767px) {
  body { padding-left: 0; }
  .app-sidebar { inset: 0 auto 0 0; width: min(314px, 86vw); padding: 32px 16px calc(25px + env(safe-area-inset-bottom)); border-radius: 0 28px 28px 0; transform: translateX(-105%); transition: transform .24s ease; overflow-y: auto; align-items: stretch; background: var(--nav-dialog-bg); color: var(--nav-dialog-text); z-index: 2100; box-shadow: 25px 0 80px #0004; }
  body.is-nav-open .app-sidebar { transform: translateX(0); }
  .nav-group { align-items: stretch; gap: 5px; }
  .nav-item { width: 100%; height: 48px; border-radius: 13px; justify-content: flex-start; padding: 0 13px; gap: 17px; font-weight: 600; }
  .nav-item:hover, .nav-item:focus-visible, .nav-item.is-active { background: color-mix(in srgb,var(--nav-dialog-bg) 84%,var(--nav-dialog-text) 16%); }
  .nav-caption { position: static; border: 0; box-shadow: none; padding: 0; opacity: 1; visibility: visible; transform: none; color: inherit; background: transparent; font-size: 14px; pointer-events: auto; }
  .nav-item:hover .nav-caption, .nav-item:focus-visible .nav-caption { transform: none; }
  .nav-brand { width: auto; height: 61px; background: transparent; border-radius: 10px; justify-content: flex-start; padding: 0 9px; gap: 13px; margin-bottom: 20px; }
  .nav-brand img { width: 43px; height: 43px; background: #fff; border-radius: 12px; padding: 3px; }
  .nav-brand::after { content: 'CalendarIA'; font-size: 17px; font-weight: 800; letter-spacing: -.04em; }
  .nav-divider { width: 100%; background: var(--nav-dialog-border); }
  .nav-item[data-nav="logout"] { color: #be454b; }
  .nav-scrim { display: block; position: fixed; inset: 0; z-index: 2000; background: rgba(10,11,14,.48); opacity: 0; pointer-events: none; transition: opacity .24s; }
  body.is-nav-open .nav-scrim { opacity: 1; pointer-events: auto; }
  body.is-nav-open { overflow: hidden; }
  .mobile-nav-toggle { display: grid; place-items: center; position: absolute; left: 0; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; color: inherit; background: transparent; border: 1px solid currentColor; border-radius: 12px; cursor: pointer; opacity: .85; }
  .mobile-nav-toggle svg { width: 22px; height: 22px; stroke: currentColor; stroke-width: 1.8; fill: none; stroke-linecap: round; }
  .site-header { position: relative; padding-left: 48px; }
  .nav-modal { padding: 20px; }
  .nav-overlay { max-height: calc(100dvh - 24px); width: calc(100% - 24px); border-radius: 21px; }
}
@media (prefers-reduced-motion: reduce) {
  .app-sidebar, .nav-scrim, .nav-item, .nav-caption { transition: none; }
}

/* Brand-consistent light appearance and compact signed-in header. */
html[data-calendar-theme="light"] { --bg:#f5f4f1; --surface:#fffcfa; --surface-strong:#fff; --surface-soft:#f3efeb; --surface-tint:#eee9e4; --accent:#1a1b1d; --accent-strong:#090a0b; --accent-soft:#e8e6e1; --border:rgba(33,35,40,.13); --text:#181a1c; --muted:#686b70; --subtle:#888b91; --shadow:0 22px 52px #30291a16; --shadow-soft:0 12px 30px #30291a10; }
html[data-calendar-theme="light"] body { background:linear-gradient(180deg,#f8f7f4 0%,#f1efec 100%); }
html[data-calendar-theme="light"] .ambient { display:none; }
.nav-action-link { display:inline-block; text-decoration:none; }
body:has(#userChip:not(.is-hidden)) #authButton { display:none; }
@media(max-width:520px){.site-header { width:calc(100% - 26px); } .user-chip #userName {display:none;} .account-area{gap:4px;} .brand {font-size:.92rem;} }

/* Final responsive polish: a white mobile drawer follows the reference design. */
@media (max-width: 767px) {
  .app-sidebar { background:#fffcf9; color:#17191d; }
  .app-sidebar .nav-item:hover, .app-sidebar .nav-item:focus-visible, .app-sidebar .nav-item.is-active {background:#ece9e5;}
  .app-sidebar .nav-divider {background:#e6e0da;}
  .app-sidebar .nav-item[data-nav="logout"] {color:#a93c44;}
}
html[data-calendar-theme="light"] .events-card { background:#fffcf9 !important; color:#191b20 !important; border-color:#e4e0db; }
html[data-calendar-theme="light"] .events-card .event-card { background:#f8f6f2; border-color:#e3ddd6; color:#191b20; }
html[data-calendar-theme="light"] .footer-panel {background:#fffcf9;border-color:#e5dfd9;}
.event-category-color-picker {z-index:2700 !important;}
#eventCategoriesRetryButton {margin:10px 0 14px;}

/* ===== UI alignment & theme parity (2026-09-22) =====
   Geometry is intentionally theme-independent. Theme selection only changes
   appearance, never the size or placement of the application. */
.site-header {
  width: min(calc(100% - 64px), var(--max-width));
  min-height: 86px;
}
.app-shell {
  width: min(calc(100% - 64px), var(--max-width));
  padding-top: 4px;
  padding-bottom: 28px;
}
.workspace {
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, .75fr);
  gap: 14px;
  align-items: stretch;
}
.tabs {
  gap: 0;
  padding: 0;
  overflow: hidden;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}
.tab {
  min-height: 58px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border-radius: 0;
  border-right: 1px solid rgba(18,19,22,.08);
  font-size: .78rem;
  font-weight: 700;
}
.tab:last-child { border-right: 0; }
.panel-wrap { padding: 28px 30px 30px; }
.panel { min-height: 500px; }

/* Light mode keeps exactly the same shell geometry as dark mode. */
html[data-calendar-theme="light"] body {
  color: #17191d;
}
html[data-calendar-theme="light"] .composer-card {
  background: linear-gradient(145deg,#f6f2ed,#eae5df);
  border-color: rgba(20,21,24,.12);
  box-shadow: 0 28px 72px rgba(31,28,24,.14);
  backdrop-filter: none;
}
html[data-calendar-theme="light"] .tab {
  color: #575960;
  background: rgba(255,255,255,.12);
}
html[data-calendar-theme="light"] .tab:hover {
  color: #111316;
  background: rgba(17,19,22,.05);
}
html[data-calendar-theme="light"] .tab.is-active {
  color: #f7f3ed;
  background: linear-gradient(135deg,#181a1e,#0f1114);
  box-shadow: none;
}
html[data-calendar-theme="light"] .panel-wrap,
html[data-calendar-theme="light"] .panel,
html[data-calendar-theme="light"] .field,
html[data-calendar-theme="light"] .field-grid,
html[data-calendar-theme="light"] form,
html[data-calendar-theme="light"] fieldset {
  min-width: 0;
}

/* Desktop rail: optical centering, uniform icon boxes and cleaner spacing. */
@media (min-width: 768px) {
  .app-sidebar {
    width: 66px;
    padding-inline: 9px;
  }
  .nav-group { align-items: center; }
  .nav-item,
  .nav-brand {
    display: grid;
    place-items: center;
    padding: 0;
    margin-inline: auto;
  }
  .nav-item { width: 46px; height: 46px; }
  .nav-item > svg {
    display: block;
    width: 23px;
    height: 23px;
    margin: 0;
    flex: none;
    overflow: visible;
    vector-effect: non-scaling-stroke;
  }
  .nav-item[data-nav="settings"] > svg { width: 24px; height: 24px; }
  .nav-item[data-nav="categories"] > svg { width: 22px; height: 22px; }
  .nav-avatar,
  .nav-avatar-fallback {
    width: 30px;
    height: 30px;
    margin: 0;
    flex: none;
  }
  .nav-divider { margin-inline: auto; }
}

/* Events panel always mirrors the creator card's measured height.
   Its header remains fixed while the content below scrolls. */
.events-card {
  height: var(--workspace-card-height, auto) !important;
  min-height: 0 !important;
  max-height: var(--workspace-card-height, none) !important;
  overflow: hidden !important;
  position: sticky;
  display: flex;
  flex-direction: column;
}
.events-heading {
  flex: 0 0 auto;
  position: relative;
  z-index: 2;
}
.events-list,
.events-calendar-view {
  min-height: 0;
  overflow-y: auto !important;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
}
.events-list { flex: 1 1 auto; }
.events-calendar-view { flex: 1 1 auto; }

/* Mobile header: only the hamburger + account affordance.
   The CalendarIA identity remains available inside the opened drawer. */
.mobile-drawer-close { display: none; }
@media (max-width: 767px) {
  .site-header {
    min-height: 64px !important;
    padding: 0 !important;
    width: calc(100% - 24px) !important;
  }
  .site-header > .brand { display: none !important; }
  .mobile-nav-toggle {
    display: grid;
    place-items: center;
    position: static;
    transform: none;
    width: 46px;
    height: 46px;
    padding: 0;
    border: 0 !important;
    border-radius: 0;
    background: transparent !important;
    box-shadow: none !important;
    opacity: 1;
    color: currentColor;
    cursor: pointer;
  }
  .mobile-nav-toggle:hover,
  .mobile-nav-toggle:focus-visible,
  .mobile-nav-toggle:active {
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    transform: none;
  }
  .mobile-nav-toggle svg {
    width: 34px;
    height: 34px;
    stroke-width: 2.15;
  }
  .account-area { margin-left: auto !important; }

  .app-sidebar {
    padding-top: 24px;
    padding-right: 16px;
    transform: translate3d(-105%,0,0);
    transition: transform .3s cubic-bezier(.22,.72,.2,1), box-shadow .3s ease;
    will-change: transform;
  }
  body.is-nav-open .app-sidebar { transform: translate3d(0,0,0); }
  .app-sidebar .nav-brand {
    width: calc(100% - 58px);
    margin: 0 0 20px;
  }
  .mobile-drawer-close {
    display: grid;
    place-items: center;
    position: absolute;
    top: 22px;
    right: 18px;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #17191d;
    cursor: pointer;
    opacity: 0;
    transform: rotate(-35deg) scale(.84);
    transition: opacity .2s ease .08s, transform .28s cubic-bezier(.22,.72,.2,1) .06s, background .16s ease;
  }
  body.is-nav-open .mobile-drawer-close {
    opacity: 1;
    transform: rotate(0) scale(1);
  }
  .mobile-drawer-close:hover,
  .mobile-drawer-close:focus-visible { background: #efebe7; }
  .mobile-drawer-close svg {
    width: 30px;
    height: 30px;
    stroke: currentColor;
    stroke-width: 1.9;
    fill: none;
    stroke-linecap: round;
  }
  .app-sidebar .nav-item {
    opacity: .7;
    transform: translateX(-8px);
    transition: opacity .2s ease, transform .26s ease, background .16s ease;
  }
  body.is-nav-open .app-sidebar .nav-item {
    opacity: 1;
    transform: translateX(0);
  }
  body.is-nav-open .app-sidebar .nav-group:first-child .nav-item:nth-of-type(2) { transition-delay: .035s; }
  body.is-nav-open .app-sidebar .nav-group:first-child .nav-item:nth-of-type(3) { transition-delay: .055s; }
  body.is-nav-open .app-sidebar .nav-group:first-child .nav-item:nth-of-type(4) { transition-delay: .075s; }

  .events-card {
    position: static !important;
    height: var(--workspace-card-height, 560px) !important;
    min-height: 0 !important;
    max-height: var(--workspace-card-height, 560px) !important;
  }
  .events-list,
  .events-calendar-view {
    overflow-y: auto !important;
    max-height: none !important;
  }
}
@media (prefers-reduced-motion: reduce) {
  .mobile-drawer-close,
  .app-sidebar .nav-item { transition: none !important; }
}

/* Icon sizing must not depend on dark-theme.css being enabled. */
.brand-logo,
.footer-brand-logo {
  display: block;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 12px;
  object-fit: contain;
}
.empty-logo {
  width: 58px;
  height: 58px;
  margin-bottom: 2px;
  border-radius: 16px;
  object-fit: contain;
}
.tab-icon {
  display: block;
  width: 18px;
  height: 18px;
  flex: none;
}
