.brand-wordmark {
  min-width: 170px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  text-decoration: none;
}

.brand-wordmark-logo {
  display: inline-flex;
  align-items: baseline;
  flex: 0 0 auto;
  color: #08090b;
  font-family: "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  font-size: 40px;
  font-weight: 900;
  letter-spacing: -0.075em;
  line-height: 0.92;
  white-space: nowrap;
}

.brand-wordmark-logo > span { color: var(--coral); }

.brand-context {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.calendar-switcher svg,
.calendar-destination svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.calendar-switcher {
  position: relative;
  width: min(50vw, 620px);
  min-width: 330px;
  z-index: 60;
}

.calendar-switcher-button {
  width: 100%;
  min-height: 58px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 11px;
  border: 1px solid var(--border-strong);
  border-radius: 15px;
  color: var(--ink);
  background: rgba(244, 240, 232, 0.94);
  box-shadow: 0 8px 24px rgba(11, 19, 37, 0.07);
  text-align: left;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.calendar-switcher-button:hover,
.calendar-switcher-button[aria-expanded="true"] {
  border-color: var(--deep-blue);
  background: var(--periwinkle);
  box-shadow: 4px 4px 0 var(--ink);
  transform: translateY(-1px);
}

.calendar-switcher-symbol {
  width: 39px;
  height: 39px;
  display: grid;
  place-items: center;
  flex: 0 0 39px;
  border: 1px solid var(--ink);
  border-radius: 11px;
  color: var(--paper);
  background: var(--deep-blue);
}

.calendar-switcher-symbol svg { width: 18px; }
.calendar-switcher-copy { min-width: 0; display: grid; gap: 2px; }
.calendar-switcher-copy small { color: var(--subtle); font-size: 8px; font-weight: 850; letter-spacing: 0.11em; text-transform: uppercase; }
.calendar-switcher-copy strong { overflow: hidden; font-size: 13px; font-weight: 850; text-overflow: ellipsis; white-space: nowrap; }
.calendar-switcher-chevron { width: 17px; margin-left: auto; flex: 0 0 17px; transition: transform 160ms ease; }
.calendar-switcher-button[aria-expanded="true"] .calendar-switcher-chevron { transform: rotate(180deg); }

.calendar-switcher-menu {
  position: absolute;
  z-index: 70;
  top: calc(100% + 10px);
  left: 50%;
  width: min(680px, calc(100vw - 32px));
  padding: 18px;
  border: 1px solid var(--ink);
  border-radius: 20px;
  background: var(--paper);
  box-shadow: 9px 9px 0 var(--ink), 0 28px 70px rgba(11, 19, 37, 0.2);
  transform: translateX(-50%);
}

.calendar-switcher-menu[hidden] { display: none !important; }
.calendar-switcher-menu-header { margin-bottom: 14px; display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.calendar-switcher-menu-header > div { display: grid; gap: 3px; }
.calendar-switcher-menu-header span { color: var(--coral); font-size: 9px; font-weight: 850; letter-spacing: 0.12em; text-transform: uppercase; }
.calendar-switcher-menu-header strong { font-size: 20px; letter-spacing: -0.035em; }
.calendar-switcher-menu-header small { max-width: 245px; color: var(--muted); font-size: 9px; line-height: 1.45; text-align: right; }
.calendar-switcher-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }

.calendar-destination {
  min-height: 118px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  background: rgba(220, 232, 255, 0.38);
  text-decoration: none;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.calendar-destination:hover { border-color: var(--deep-blue); background: var(--periwinkle); transform: translateY(-2px); }
.calendar-destination[aria-current="page"] { border-color: var(--ink); background: var(--lime); box-shadow: 4px 4px 0 var(--ink); }
.calendar-destination-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; color: var(--paper); background: var(--deep-blue); }
.calendar-destination[data-calendar-key="client"] .calendar-destination-icon { color: var(--ink); background: var(--sky); }
.calendar-destination[data-calendar-key="person"] .calendar-destination-icon { color: var(--ink); background: var(--violet); }
.calendar-destination-icon svg { width: 17px; }
.calendar-destination strong { font-size: 12px; font-weight: 850; }
.calendar-destination small { color: var(--muted); font-size: 9px; line-height: 1.4; }

.app-header,
.content-header { position: relative; }

.content-header > .calendar-switcher {
  position: absolute;
  left: 50%;
  margin: 0;
  transform: translateX(-50%);
}

.content-header .brand-wordmark { min-width: 0; }
.app-header > .calendar-switcher { position: static; width: min(34vw, 420px); min-width: 300px; transform: none; }

.content-header > .theme-toggle { margin-left: auto; }

.theme-toggle {
  min-height: 42px;
  padding: 0 10px 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  flex: 0 0 auto;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  color: var(--ink);
  background: rgba(244, 240, 232, 0.9);
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.theme-toggle:hover { border-color: var(--deep-blue); background: var(--periwinkle); transform: translateY(-1px); }
.theme-toggle-label { pointer-events: none; }
.theme-toggle-track { position: relative; width: 42px; height: 24px; flex: 0 0 42px; border: 1px solid var(--ink); border-radius: 999px; background: var(--periwinkle); transition: background 180ms ease; }
.theme-toggle-thumb { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--deep-blue); box-shadow: 0 1px 3px rgba(8, 9, 11, 0.28); transition: transform 180ms ease, background 180ms ease; }
.theme-toggle[aria-checked="true"] .theme-toggle-track { background: var(--lime); }
.theme-toggle[aria-checked="true"] .theme-toggle-thumb { background: #08090b; transform: translateX(18px); }

html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f4f0e8;
  --paper: #111a2d;
  --work-ink: #08090b;
  --canvas: #08090b;
  --midnight: #3158df;
  --teal: #78dcff;
  --incoming: #78dcff;
  --mint: #173d35;
  --peach: #5b2b26;
  --periwinkle: #1b2b50;
  --muted: rgba(244, 240, 232, 0.72);
  --subtle: rgba(244, 240, 232, 0.52);
  --line: transparent;
  --border-strong: transparent;
  --shadow: 0 18px 46px rgba(0, 0, 0, 0.36);
  color: var(--ink);
  background: var(--canvas);
}

html[data-theme="dark"] body {
  background:
    radial-gradient(circle at 7% -10%, rgba(49, 88, 223, 0.25), transparent 31rem),
    radial-gradient(circle at 92% 3%, rgba(181, 140, 255, 0.14), transparent 27rem),
    var(--canvas);
}

html[data-theme="dark"] .brand-wordmark-logo { color: #f4f0e8; }
html[data-theme="dark"] .calendar-switcher-symbol,
html[data-theme="dark"] .calendar-switcher-menu,
html[data-theme="dark"] .calendar-destination[aria-current="page"],
html[data-theme="dark"] .theme-toggle-track,
html[data-theme="dark"] .content-primary-button,
html[data-theme="dark"] .content-secondary-button,
html[data-theme="dark"] .content-delete-button,
html[data-theme="dark"] .hero-client-card,
html[data-theme="dark"] .person-workspace-header,
html[data-theme="dark"] .workboard-date,
html[data-theme="dark"] .schedule-panel,
html[data-theme="dark"] .schedule-goal-tab,
html[data-theme="dark"] .content-filter-menu,
html[data-theme="dark"] .filter-swatch,
html[data-theme="dark"] .content-event,
html[data-theme="dark"] .content-dialog,
html[data-theme="dark"] .color-options span,
html[data-theme="dark"] .content-offline-banner,
html[data-theme="dark"] .content-toast { border-color: transparent; }
html[data-theme="dark"] .client-calendar-chip[aria-pressed="true"],
html[data-theme="dark"] .workboard-range-tab.active,
html[data-theme="dark"] .content-view-tab.active { border-color: transparent; }
html[data-theme="dark"] .campaign-card,
html[data-theme="dark"] .team-assignment-card { border-color: transparent; border-top-color: var(--event-color); }
html[data-theme="dark"] .workboard-task { border-color: transparent; border-left-color: var(--event-color); }
html[data-theme="dark"] .calendar-switcher-button,
html[data-theme="dark"] .theme-toggle,
html[data-theme="dark"] .header-icon-button,
html[data-theme="dark"] .install-button,
html[data-theme="dark"] .workspace-button,
html[data-theme="dark"] .tool-button,
html[data-theme="dark"] .calendar-section-control,
html[data-theme="dark"] .view-switcher,
html[data-theme="dark"] .summary-card,
html[data-theme="dark"] .utility-bar,
html[data-theme="dark"] .insight-card,
html[data-theme="dark"] .content-secondary-button,
html[data-theme="dark"] .client-picker,
html[data-theme="dark"] .content-view-bar,
html[data-theme="dark"] .content-summary-card,
html[data-theme="dark"] .campaign-section,
html[data-theme="dark"] .workboard-section { background: rgba(244, 240, 232, 0.055); }

html[data-theme="dark"] .client-picker-button { background: rgba(244, 240, 232, 0.055); }

html[data-theme="dark"] .calendar-switcher-menu,
html[data-theme="dark"] .content-filter-menu { box-shadow: 8px 8px 0 #05070d, 0 28px 70px rgba(0, 0, 0, 0.3); }
html[data-theme="dark"] .client-picker-menu { box-shadow: 0 18px 42px rgba(0, 0, 0, 0.4); }
html[data-theme="dark"] .calendar-destination,
html[data-theme="dark"] .upcoming-item,
html[data-theme="dark"] .campaign-goal-button,
html[data-theme="dark"] .content-day.outside,
html[data-theme="dark"] .calendar-day.outside-month,
html[data-theme="dark"] .goal-builder,
html[data-theme="dark"] .team-member-row,
html[data-theme="dark"] .content-dialog-footer,
html[data-theme="dark"] .recurrence-panel,
html[data-theme="dark"] .custom-repeat-setting,
html[data-theme="dark"] .attachment-picker,
html[data-theme="dark"] .workspace-status-card,
html[data-theme="dark"] .cloud-connect-panel,
html[data-theme="dark"] .dialog-footer { background: rgba(120, 220, 255, 0.075); }

html[data-theme="dark"] .primary-button,
html[data-theme="dark"] .content-primary-button,
html[data-theme="dark"] .view-tab.active,
html[data-theme="dark"] .calendar-destination[aria-current="page"],
html[data-theme="dark"] .summary-symbol.lime,
html[data-theme="dark"] .summary-symbol.coral,
html[data-theme="dark"] .schedule-goal-tab.active,
html[data-theme="dark"] .content-event.complete,
html[data-theme="dark"] .hero-client-card,
html[data-theme="dark"] .schedule-panel,
html[data-theme="dark"] .toast,
html[data-theme="dark"] .content-toast,
html[data-theme="dark"] .offline-banner,
html[data-theme="dark"] .content-offline-banner { color: #08090b; }

html[data-theme="dark"] .calendar-switcher-symbol,
html[data-theme="dark"] .summary-symbol.blue,
html[data-theme="dark"] .calendar-day.today .day-number,
html[data-theme="dark"] .content-day.today .content-day-number { color: #f4f0e8; }
html[data-theme="dark"] .color-violet,
html[data-theme="dark"] .color-coral,
html[data-theme="dark"] .color-sky { --event-text: #08090b; }
html[data-theme="dark"] .color-blue { --event-text: #f4f0e8; }
html[data-theme="dark"] .upcoming-date,
html[data-theme="dark"] .net-summary .summary-icon,
html[data-theme="dark"] .repeat-option-icon { color: #08090b; }
html[data-theme="dark"] .calendar-day.outside-month .day-number { color: rgba(244, 240, 232, 0.42); }
html[data-theme="dark"] .goal-ready,
html[data-theme="dark"] .campaign-goal-button .goal-assignee-label,
html[data-theme="dark"] .summary-card strong.positive,
html[data-theme="dark"] .incoming-summary .summary-icon { color: var(--sky); }
html[data-theme="dark"] .workboard-status:not(.overdue):not(.complete) { color: var(--sky); }
html[data-theme="dark"] .primary-button,
html[data-theme="dark"] .content-primary-button,
html[data-theme="dark"] .calendar-destination[aria-current="page"],
html[data-theme="dark"] .hero-client-card,
html[data-theme="dark"] .schedule-panel { box-shadow: 5px 5px 0 #05070d; }

html[data-auth="signed-out"] .app-shell,
html[data-auth="signed-out"] .content-app-shell,
html[data-auth="signed-out"] .offline-banner,
html[data-auth="signed-out"] .content-offline-banner { visibility: hidden; }

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 12% 0%, rgba(49, 88, 223, 0.16), transparent 30rem),
    radial-gradient(circle at 90% 100%, rgba(242, 255, 90, 0.35), transparent 26rem),
    var(--paper);
}

.auth-gate[hidden] { display: none; }

.auth-gate-card {
  width: min(430px, 100%);
  padding: 32px 30px 26px;
  display: grid;
  gap: 14px;
  border: 1px solid var(--ink);
  border-radius: 22px;
  background: var(--paper);
  box-shadow: 9px 9px 0 var(--ink);
}

.auth-gate-card .brand-wordmark-logo { margin-bottom: 4px; font-size: 36px; }
.auth-gate-kicker { margin: 0; color: var(--coral); font-size: 10px; font-weight: 850; letter-spacing: 0.12em; text-transform: uppercase; }
.auth-gate-card h1 { margin: 0; font-size: 27px; font-weight: 850; letter-spacing: -0.035em; line-height: 1.08; }
.auth-gate-card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }

.google-button {
  min-height: 50px;
  margin-top: 6px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  border: 1px solid var(--ink);
  border-radius: 13px;
  color: #08090b;
  background: #ffffff;
  font: inherit;
  font-size: 14px;
  font-weight: 750;
  cursor: pointer;
  transition: background 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.google-button:hover { background: var(--periwinkle); box-shadow: 4px 4px 0 var(--ink); transform: translateY(-1px); }
.google-button:disabled { cursor: progress; opacity: 0.6; box-shadow: none; transform: none; }
.google-button svg { width: 19px; height: 19px; flex: 0 0 19px; }

.auth-gate-error { padding: 10px 12px; border-radius: 10px; color: #6d1a0b; background: var(--peach); font-size: 12px; }
.auth-gate-error[hidden] { display: none; }
.auth-gate-footnote { color: var(--subtle); font-size: 11px; }

.account-slot { position: relative; display: inline-flex; flex: 0 0 auto; }
.content-header > .account-slot { margin-left: 12px; }

.account-button {
  width: 42px;
  height: 42px;
  padding: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  color: var(--ink);
  background: var(--periwinkle);
  cursor: pointer;
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.account-button:hover,
.account-button[aria-expanded="true"] { border-color: var(--deep-blue); box-shadow: 3px 3px 0 var(--ink); transform: translateY(-1px); }
.account-avatar { width: 100%; height: 100%; object-fit: cover; }
.account-initial { font-size: 15px; font-weight: 850; }

.account-popover {
  position: absolute;
  z-index: 90;
  top: calc(100% + 8px);
  right: 0;
  min-width: 232px;
  padding: 12px;
  display: grid;
  gap: 10px;
  border: 1px solid var(--ink);
  border-radius: 14px;
  background: var(--paper);
  box-shadow: 6px 6px 0 var(--ink), 0 24px 50px rgba(11, 19, 37, 0.2);
}

.account-popover[hidden] { display: none; }
.account-identity { min-width: 0; display: grid; gap: 2px; }
.account-identity strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.account-identity small { overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }

.account-sign-out {
  min-height: 36px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  color: var(--ink);
  background: transparent;
  font: inherit;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  transition: border-color 160ms ease, color 160ms ease;
}

.account-sign-out:hover { border-color: var(--coral); color: var(--coral); }
.account-sign-out:disabled { cursor: progress; opacity: 0.6; }

.cloud-invite-note { margin: 12px 0 0; color: var(--subtle); font-size: 10px; line-height: 1.5; }
.status-pill { color: var(--work-ink); }
.status-pill.error { color: #6d1a0b; background: var(--peach); }

html[data-theme="dark"] .auth-gate {
  background:
    radial-gradient(circle at 12% 0%, rgba(49, 88, 223, 0.3), transparent 30rem),
    radial-gradient(circle at 90% 100%, rgba(181, 140, 255, 0.16), transparent 26rem),
    var(--canvas);
}
html[data-theme="dark"] .auth-gate-card,
html[data-theme="dark"] .account-popover { border-color: var(--border-strong); box-shadow: 9px 9px 0 #05070d; }
html[data-theme="dark"] .google-button { background: #f4f0e8; }
html[data-theme="dark"] .google-button:hover { background: #ffffff; box-shadow: 4px 4px 0 #05070d; }
html[data-theme="dark"] .account-button { background: rgba(244, 240, 232, 0.08); }
html[data-theme="dark"] .account-button:hover,
html[data-theme="dark"] .account-button[aria-expanded="true"] { box-shadow: 3px 3px 0 #05070d; }
html[data-theme="dark"] .auth-gate-error { color: #08090b; }

@media (max-width: 1120px) {
  .brand-wordmark { min-width: 150px; }
  .brand-wordmark-logo { font-size: 35px; }
  .brand-context { display: none; }
  .calendar-switcher { width: min(44vw, 520px); min-width: 280px; }
}

@media (max-width: 1180px) {
  .app-header { flex-wrap: wrap; gap: 12px; padding: 14px 0; }
  .app-header > .calendar-switcher { position: static; width: 100%; min-width: 0; order: 3; transform: none; }
}

@media (max-width: 820px) {
  .app-header > .calendar-switcher,
  .content-header > .calendar-switcher { position: static; width: 100%; min-width: 0; order: 3; transform: none; }
  .calendar-switcher-menu { left: 0; transform: none; }
}

@media (max-width: 560px) {
  .brand-wordmark { min-width: 118px; }
  .brand-wordmark-logo { font-size: 32px; }
  .theme-toggle { width: 52px; min-height: 38px; padding: 0 5px; }
  .theme-toggle-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
  .calendar-switcher-button { min-height: 52px; }
  .calendar-switcher-menu { padding: 14px; border-radius: 17px; }
  .calendar-switcher-menu-header { align-items: flex-start; flex-direction: column; gap: 4px; }
  .calendar-switcher-menu-header small { max-width: none; text-align: left; }
  .calendar-switcher-grid { grid-template-columns: 1fr; }
  .calendar-destination { min-height: 82px; display: grid; grid-template-columns: 36px 1fr; grid-template-rows: auto auto; align-items: center; gap: 2px 10px; }
  .calendar-destination-icon { grid-row: 1 / 3; }
}
