:root {
  color-scheme: light;
  font-family: Inter, system-ui, sans-serif;
  color: #211e32;
  background: #f6f6fb;

  --surface: #fff;
  --ink: #211e32;
  --muted: #635f76;
  --line: #e8e6f0;
  --accent: #5b43cb;
  --accent-soft: #efebff;
  --danger: #a92142;
  --danger-soft: #fff2f5;
  --sidebar-width: 15.25rem;
  --topbar-height: 4.5rem;
  --page-padding: clamp(0.625rem, 0.85vw, 1rem);
  --page-gap: 1rem;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 16rem;
}

h1,
h2,
h3,
p {
  margin: 0;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

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

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.skip-link {
  position: fixed;
  z-index: 5;
  inset: 0.75rem auto auto 0.75rem;
  padding: 0.65rem 0.95rem;
  border-radius: 0.5rem;
  color: var(--surface);
  background: var(--accent);
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

.portal {
  --sidebar-space: var(--sidebar-width);
  --sidebar-in: cubic-bezier(0.22, 1, 0.36, 1);
  --sidebar-out: cubic-bezier(0.55, 0.05, 0.88, 0.4);
  --sidebar-close: 320ms;
  display: grid;
  grid-template-columns: var(--sidebar-space) minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  min-height: 100vh;
  transition: grid-template-columns var(--sidebar-close) var(--sidebar-out);
}

.portal[data-sidebar="open"] {
  transition: grid-template-columns 650ms var(--sidebar-in) 150ms;
}

.portal[data-sidebar="closed"] {
  --sidebar-space: 0rem;
}

.topbar {
  position: sticky;
  z-index: 3;
  top: 0;
  grid-area: 1 / 2;
  display: flex;
  align-items: center;
  gap: 0.875rem;
  min-height: var(--topbar-height);
  padding-inline: var(--page-padding);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  transition: padding-inline-start var(--sidebar-close) var(--sidebar-out);
}

.portal[data-sidebar="closed"] .topbar {
  padding-inline-start: 7.375rem;
}

.topbar-title {
  flex: 1;
  min-width: 0;
}

.topbar-label,
.topbar-path {
  color: var(--ink);
  font-size: 0.9375rem;
  font-weight: 730;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.topbar-path ol,
.topbar-path li {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  min-width: 0;
}

.topbar-path ol {
  margin: 0;
  padding: 0;
  overflow: hidden;
  list-style: none;
}

.topbar-path li:first-child {
  flex-shrink: 0;
}

.topbar-path-label {
  min-width: 0;
  overflow: hidden;
  font: inherit;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-path a,
.topbar-path-separator {
  color: var(--muted);
}

.topbar-path a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.topbar-path a:focus-visible {
  outline-offset: -2px;
}

.topbar-path-separator {
  flex: none;
  font-weight: 500;
}

.topbar-create {
  white-space: nowrap;
}

.profile {
  display: flex;
  flex: none;
  align-items: center;
  gap: 0.625rem;
  padding: 0;
  border: 0;
  border-radius: 0.5rem;
  background: transparent;
  color: var(--ink);
  text-align: start;
}

.profile-menu[popover] {
  inset: calc(var(--topbar-height) + 0.375rem) var(--page-padding) auto auto;
  width: min(16rem, calc(100vw - 2 * var(--page-padding)));
  margin: 0;
  padding: 0.75rem;
  color: var(--ink);
}

.profile-menu:popover-open {
  display: grid;
  gap: 0.5rem;
}

.profile-menu p { overflow-wrap: anywhere; }
.account-error { color: var(--danger); overflow-wrap: anywhere; }

.profile-copy {
  display: grid;
  gap: 0.125rem;
  line-height: 1.25;
}

.profile-copy span {
  color: var(--muted);
  font-size: 0.8125rem;
}

.profile-copy strong {
  max-width: 20ch;
  overflow: hidden;
  font-size: 0.9375rem;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar {
  --sidebar-padding: 0.875rem;
  --sidebar-button-width: 6rem;
  --sidebar-header-inset: calc((var(--topbar-height) - 2.75rem) / 2);
  position: sticky;
  z-index: 4;
  top: 0;
  grid-area: 1 / 1 / 3 / 2;
  align-self: start;
  width: var(--sidebar-width);
  height: 100vh;
  height: 100dvh;
  isolation: isolate;
  pointer-events: none;
}

.sidebar::before,
.sidebar::after,
.sidebar-panel {
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  transition: transform var(--sidebar-close) var(--sidebar-out);
}

.sidebar::before,
.sidebar::after {
  content: "";
}

.sidebar::before {
  background: #ccbaf4;
}

.sidebar::after {
  background: #7556cf;
}

.sidebar-panel {
  z-index: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--sidebar-header-inset) var(--sidebar-padding) 1.25rem;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.portal[data-sidebar="open"] .sidebar::before,
.portal[data-sidebar="open"] .sidebar::after,
.portal[data-sidebar="open"] .sidebar-panel {
  transform: translateX(0);
  transition: transform 500ms var(--sidebar-in);
}

.portal[data-sidebar="open"] .sidebar::after {
  transition-delay: 70ms;
}

.portal[data-sidebar="open"] .sidebar-panel {
  transition: transform 650ms var(--sidebar-in) 150ms;
  pointer-events: auto;
}

.sidebar-toggle {
  position: absolute;
  z-index: 2;
  inset-block-start: var(--sidebar-header-inset);
  inset-inline-end: calc(100% - var(--sidebar-button-width) - var(--sidebar-padding));
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  width: var(--sidebar-button-width);
  min-height: 2.75rem;
  padding: 0.375rem;
  border: 1px solid #e8e0fb;
  border-radius: 0.625rem;
  color: #5037b4;
  background: #f8f5ff;
  font-size: 0.875rem;
  font-weight: 650;
  pointer-events: auto;
  transition: inset-inline-end var(--sidebar-close) var(--sidebar-out), background-color 180ms ease;
}

.sidebar-toggle[aria-expanded="true"] {
  inset-inline-end: var(--sidebar-padding);
  width: 2.75rem;
  border-color: transparent;
  background: transparent;
  transition: inset-inline-end 650ms var(--sidebar-in) 150ms, background-color 180ms ease;
}

.sidebar-toggle:hover {
  background: #eee7ff;
}

.sidebar-toggle[aria-expanded="true"] .sidebar-toggle-label {
  display: none;
}

.sidebar-toggle-mark {
  position: relative;
  flex: none;
  width: 0.875rem;
  height: 0.875rem;
  transition: transform 350ms ease-in-out;
}

.sidebar-toggle-mark::before,
.sidebar-toggle-mark::after {
  position: absolute;
  inset: calc(50% - 1px) 0 auto;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  content: "";
}

.sidebar-toggle-mark::after {
  transform: rotate(90deg);
}

.portal[data-sidebar="open"] .sidebar-toggle-mark {
  transform: rotate(225deg);
  transition: transform 800ms var(--sidebar-in);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6875rem;
  width: fit-content;
  min-height: 2.75rem;
  margin: 0 0 1rem 0.125rem;
  border-radius: 0.5rem;
}

.brand strong {
  font-size: 1.0625rem;
  font-weight: 750;
}

.brand-mark {
  position: relative;
  flex: none;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.75rem;
  background: linear-gradient(145deg, #7963ef, #5940ca 76%);
  box-shadow: 0 4px 10px #4935a438;
}

.brand-mark::before,
.brand-mark::after {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  width: 1rem;
  height: 0.75rem;
  border: 1.5px solid white;
  border-radius: 3px;
  content: "";
  transform: rotate(-28deg) skewX(18deg);
}

.brand-mark::after {
  top: 0.9375rem;
  border-top: 0;
  border-left-color: #dcd2ff;
}

.navigation {
  position: relative;
  display: grid;
  gap: 0.1875rem;
  isolation: isolate;
}

.nav-highlight {
  position: absolute;
  z-index: -1;
  inset: 0 0 auto;
  display: none;
  border-radius: 0.625rem;
  background: var(--accent-soft);
  pointer-events: none;
}

.navigation.is-switching .nav-highlight {
  display: block;
}

.nav-item {
  overflow: hidden;
  border-radius: 0.625rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.5625rem;
  min-height: 2.375rem;
  padding: 0.3125rem 0.5625rem;
  border-radius: 0.625rem;
  color: var(--muted);
  font-size: 0.9375rem;
  font-weight: 570;
  opacity: 0;
  transform: translateY(130%) rotate(9deg);
  transform-origin: left center;
  transition: transform 0s var(--sidebar-close), opacity 0s var(--sidebar-close);
}

.portal[data-sidebar="open"] .nav-link {
  --nav-delay: calc(245ms + var(--nav-order) * 100ms);
  opacity: 1;
  transform: translateY(0) rotate(0);
  transition:
    transform 1s var(--sidebar-in) var(--nav-delay),
    opacity 300ms ease-out var(--nav-delay);
}

.portal[data-sidebar="open"] .nav-link:focus-visible {
  outline-offset: -2px;
  transition: none;
}

.nav-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 1.625rem;
  height: 1.625rem;
  border-radius: 0.4375rem;
  color: var(--tone-ink, var(--accent));
  background: var(--tone-bg, var(--accent-soft));
}

.nav-icon svg {
  display: block;
  width: 1.125rem;
  height: 1.125rem;
}

.nav-icon.tone-gold {
  --tone-ink: #935510;
  --tone-bg: #fff2cc;
}

.nav-icon.tone-teal {
  --tone-ink: #176e72;
  --tone-bg: #e2f6f6;
}

.nav-link[href]:hover {
  color: var(--ink);
  background: #f6f4fb;
}

.nav-link[aria-current="page"],
.nav-link[aria-current="page"]:hover {
  color: #4e35bb;
  background: var(--accent-soft);
  font-weight: 700;
}

.navigation.is-switching .nav-link {
  background: transparent;
}

.sidebar-scrim {
  display: none;
}

.workspace {
  grid-area: 2 / 2;
  min-width: 0;
  padding: var(--page-padding) var(--page-padding) 1.25rem;
  scroll-margin-top: var(--topbar-height);
}

.workspace:focus {
  outline: none;
}

.welcome {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  min-height: 13.25rem;
  overflow: hidden;
  padding: 1.25rem clamp(1rem, 2vw, 1.75rem);
  border-radius: 1.25rem;
  color: #fff;
  background: linear-gradient(105deg, #251e48 12%, #39295e 100%);
  box-shadow: 0 12px 24px #30245d1a;
}

.welcome::before {
  position: absolute;
  z-index: -1;
  inset: 0 0 0 32%;
  background: url("assets/workspace-hero.jpg") right center / cover no-repeat;
  mask-image: linear-gradient(to right, transparent, #000 36%);
  content: "";
}

.welcome-copy {
  position: relative;
  display: grid;
  gap: 0.5rem;
}

.welcome-date {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #e0d7ff;
  font-size: 0.9375rem;
  font-weight: 570;
}

.welcome-summary {
  color: #f0eaff;
  line-height: 1.5;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.12fr);
  gap: var(--page-gap);
  margin-top: var(--page-gap);
}

.panel {
  min-width: 0;
  padding: 1.125rem;
  border: 1px solid var(--line);
  border-radius: 1.125rem;
  background: var(--surface);
  box-shadow: 0 4px 16px #251e4808;
}

.panel-header,
.calendar-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.panel-header {
  min-height: 2.375rem;
  margin-bottom: 1rem;
}

.panel-header h2 {
  font-size: 1.3125rem;
  font-weight: 730;
  line-height: 1.25;
  letter-spacing: -0.025em;
}

.calendar-toolbar {
  margin-bottom: 0.5rem;
}

.calendar-toolbar h3 {
  font-size: 1rem;
  font-weight: 680;
}

.icon-button,
.soft-button {
  display: inline-grid;
  flex: none;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 0.625rem;
  color: var(--muted);
  background: var(--surface);
}

.icon-button {
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
}

.icon-button:hover,
.soft-button:hover {
  border-color: #d5caf9;
  color: var(--accent);
  background: #f4f0ff;
}

.soft-button {
  min-height: 2.25rem;
  padding: 0.375rem 0.75rem;
  border-color: #e8e0ff;
  color: #5136ba;
  background: #f3efff;
  font-size: 0.875rem;
  font-weight: 660;
}

.month-controls {
  display: flex;
  gap: 0.375rem;
}

.month-button {
  width: 2.125rem;
  height: 2.125rem;
  border-radius: 0.5rem;
}

.calendar {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  text-align: center;
}

.calendar th {
  height: 2rem;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 620;
}

.calendar abbr {
  text-decoration: none;
}

.calendar td {
  height: 2.5rem;
  padding: 0;
}

.calendar-day {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: min(100% - 4px, 2.625rem);
  height: 2.25rem;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 0.625rem;
  color: var(--ink);
  background: transparent;
  font-size: 0.9375rem;
  font-weight: 590;
  font-variant-numeric: tabular-nums;
}

.calendar-day:hover {
  background: var(--accent-soft);
}

.calendar-day.is-outside-month {
  color: #777189;
}

.calendar-day[aria-current="date"] {
  border-color: #9d8ae8;
  color: #4a31b2;
  font-weight: 740;
}

.calendar-day[aria-pressed="true"] {
  border-color: var(--accent);
  color: white;
  background: var(--accent);
  font-weight: 740;
}

.calendar-day.has-markers {
  padding-bottom: 0.3125rem;
}

.day-markers {
  position: absolute;
  bottom: 0.1875rem;
  display: flex;
  gap: 0.15rem;
}

.legend-dot {
  width: 0.375rem;
  height: 0.375rem;
  border-radius: 50%;
  background: #795fdd;
}

.marker-deadline {
  background: #c93759;
}

.marker-event {
  background: #157b6c;
}

.calendar-day[aria-pressed="true"] .marker-task {
  background: #e7dfff;
}

.calendar-day[aria-pressed="true"] .marker-deadline {
  background: #ffc4d4;
}

.calendar-day[aria-pressed="true"] .marker-event {
  background: #a4eed3;
}

.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  margin-top: 0.875rem;
  padding-top: 0.875rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.875rem;
}

.calendar-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.4375rem;
}

.tasks-panel {
  display: flex;
  flex-direction: column;
  scroll-margin-top: calc(var(--topbar-height) + 1rem);
}

.task-list {
  display: grid;
  gap: 0.625rem;
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
}

.task-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  min-height: 4.5rem;
  padding: 0.875rem;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: #faf9fd;
}

.task-card:hover {
  border-color: #cfc3f4;
}

.task-card.is-urgent {
  border-color: #f4bac8;
  background: var(--danger-soft);
}

.task-card.is-urgent:hover {
  border-color: #e38aa1;
}

.task-check {
  flex: none;
  width: 1.125rem;
  height: 1.125rem;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.task-copy {
  display: grid;
  flex: 1 1 10rem;
  gap: 0.1875rem;
  min-width: 0;
  overflow-wrap: anywhere;
}

.task-name {
  font-size: 1rem;
  font-weight: 660;
  line-height: 1.35;
  cursor: pointer;
}

.task-project {
  width: fit-content;
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.35;
}

.task-project:hover {
  color: var(--accent);
  text-decoration: underline;
}

.task-card.is-urgent .task-name {
  color: #791d34;
}

.task-check:checked + .task-copy .task-name {
  color: var(--muted);
  text-decoration: line-through;
}

.task-deadline {
  margin-inline-start: 1.875rem;
  padding: 0.3125rem 0.5625rem;
  border-radius: 0.4375rem;
  color: #5136ba;
  background: var(--accent-soft);
  font-size: 0.875rem;
  font-weight: 670;
  line-height: 1.3;
}

.task-card.is-urgent .task-deadline {
  color: var(--danger);
  background: #ffe0e8;
}

.task-progress {
  margin-top: auto;
  padding-top: 0.875rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.875rem;
}

.task-progress progress {
  display: block;
  width: 100%;
  height: 0.375rem;
  margin-top: 0.5625rem;
  overflow: hidden;
  border: 0;
  border-radius: 1rem;
  color: var(--accent);
  background: #eeebf7;
  appearance: none;
}

.task-progress progress::-webkit-progress-bar {
  background: #eeebf7;
}

.task-progress progress::-webkit-progress-value {
  border-radius: 1rem;
  background: var(--accent);
}

.task-progress progress::-moz-progress-bar {
  border-radius: 1rem;
  background: var(--accent);
}

.empty-state {
  padding: 1.75rem 1rem;
  border: 1px dashed #dcd5ed;
  border-radius: 0.75rem;
  color: var(--muted);
  background: #faf9fd;
  text-align: center;
}

.icon {
  position: relative;
  display: inline-block;
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
}

.icon::before,
.icon::after {
  position: absolute;
}

.icon-book::before,
.icon-task::before,
.icon-calendar::before,
.icon-folder::before {
  inset: 3px 2px;
  border: 1.5px solid currentColor;
  border-radius: 4px;
  content: "";
}

.icon-book::before {
  inset-inline: 1px;
  background: linear-gradient(currentColor, currentColor) center / 1.5px 100% no-repeat;
}

.icon-workspace::before {
  inset: 3px auto auto 3px;
  width: 6px;
  height: 6px;
  border-radius: 1.5px;
  background: currentColor;
  box-shadow: 8px 0, 0 8px, 8px 8px;
  content: "";
}

.icon-task::before {
  inset: 3px;
}

.icon-task::after {
  inset: 7px auto auto 7px;
  width: 6px;
  height: 4px;
  border: solid currentColor;
  border-width: 0 0 1.5px 1.5px;
  content: "";
  transform: rotate(-45deg);
}

.icon-calendar::before {
  inset: 4px 2px 2px;
  background: linear-gradient(currentColor, currentColor) center 4px / 100% 1.5px no-repeat;
}

.icon-calendar::after {
  inset: 2px auto auto 6px;
  width: 1.5px;
  height: 5px;
  border-radius: 1px;
  background: currentColor;
  box-shadow: 6px 0;
  content: "";
}

.icon-folder::before {
  inset: 6px 2px 3px;
}

.icon-folder::after {
  inset: 3px auto auto 3px;
  width: 7px;
  height: 4px;
  border: 1.5px solid currentColor;
  border-bottom: 0;
  border-radius: 2px 2px 0 0;
  content: "";
}

.icon-previous::before,
.icon-next::before {
  inset: 6px auto auto 6px;
  width: 7px;
  height: 7px;
  border: solid currentColor;
  border-width: 1.5px 1.5px 0 0;
  content: "";
}

.icon-previous::before {
  left: 8px;
  transform: rotate(-135deg);
}

.icon-next::before {
  transform: rotate(45deg);
}

@media (max-width: 65rem) {
  .workspace-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 52rem) {
  :root {
    --topbar-height: 4rem;
  }

  .portal {
    --sidebar-space: 0rem;
  }

  .topbar {
    padding-inline-start: 7.375rem;
  }

  body:has(.portal[data-sidebar="open"]) {
    overflow: hidden;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto auto 0;
    width: min(18rem, calc(100vw - 1.25rem));
  }

  .nav-link {
    min-height: 2.75rem;
  }

  .sidebar-scrim {
    position: fixed;
    z-index: 3;
    inset: 0;
    display: block;
    background: #211e3266;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity var(--sidebar-close) ease, visibility 0s var(--sidebar-close);
  }

  .portal[data-sidebar="open"] .sidebar-scrim {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition-delay: 0s;
  }

}

@media (prefers-reduced-motion: reduce) {
  .portal,
  .topbar,
  .sidebar::before,
  .sidebar::after,
  .sidebar-panel,
  .sidebar-scrim,
  .sidebar-toggle,
  .sidebar-toggle-mark,
  .nav-link {
    transition: none !important;
  }
}

@media (max-width: 35rem) {
  .topbar {
    gap: 0.5rem;
  }

  .welcome {
    min-height: 11.5rem;
  }

  .welcome::before {
    inset-inline-start: 18%;
    opacity: 0.45;
  }

  .panel {
    padding: 0.875rem;
  }
}

@media (max-width: 30rem) {
  .topbar-create {
    min-width: 2.75rem;
  }

  .topbar-create span {
    display: none;
  }

  .topbar-create::before {
    content: "+";
    font-size: 1.375rem;
    line-height: 1;
  }
}

@media (max-width: 25rem) {
  .profile-copy {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

@media (forced-colors: active) {
  .calendar-day[aria-pressed="true"],
  .task-card.is-urgent {
    border: 2px solid Highlight;
  }

  .legend-dot {
    background: CanvasText;
  }
}
