/* ============================================
   LAYOUT & NAVIGATION
   ============================================ */

/* Main app body layout */
body {
    display: grid;
    grid-template-rows: auto 1fr;
}

/* Viewing other workspace - hide all create/delete actions */
.workspace--viewing-other .nav-new,
.workspace--viewing-other .btn--primary:not(.nav__link),
.workspace--viewing-other .lists-upload-wrapper,
.workspace--viewing-other .empty-state__action,
.workspace--viewing-other .btn--delete,
.workspace--viewing-other [data-action*="delete"],
.workspace--viewing-other [data-method="delete"] { display: none !important; }

/* Workspace switcher - show/hide based on viewing state */
.nav-workspace__tag { display: none; }
.nav-workspace__back-wrap { display: none; }
.workspace--viewing-other .nav-workspace__tag { display: inline; }
.workspace--viewing-other .nav-workspace__back-wrap { display: block; }
.workspace--viewing-other .nav-workspace__trigger { border-color: var(--primary); background: oklch(var(--lch-primary) / 0.06); }

/* Calendly-style Navigation */
.nav { position: sticky; inset-block-start: var(--space-sm); inset-inline: var(--space-lg); z-index: 100; max-inline-size: 1400px; margin-inline: auto; margin-block-end: var(--space-md); display: flex; align-items: center; justify-content: space-between; background: var(--surface); border: 1px solid var(--border-light); border-radius: var(--radius-md); padding: var(--space-xs) var(--space-md); box-shadow: var(--shadow-sm); }
.nav-brand { display: flex; align-items: center; gap: var(--space-sm); margin-right: var(--space-md); }
.nav-logo-mark { display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.nav-logo { font-size: var(--text-lg); font-weight: 600; letter-spacing: -0.02em; color: var(--ink); }
.nav-logo:hover { opacity: 0.8; }
.nav-user-dropdown { position: relative; }
.nav-user {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--ink-60);
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
  background: transparent;
  border: none;
  cursor: pointer;
}
.nav-user:hover { background: var(--surface-tinted); color: var(--ink); }
.nav-user__org { color: var(--ink); font-weight: 600; }
.nav-user__sep { color: var(--ink-30); margin: 0 2px; }
.nav-user__name { color: var(--ink-50); }
.nav-user-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 140px;
  background: var(--paper);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 4px;
  z-index: 200;
}
.nav-user-menu__item {
  display: block;
  width: 100%;
  padding: 8px 12px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--ink-70);
  text-decoration: none;
  text-align: left;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.1s ease;
}
.nav-user-menu__item:hover { background: var(--surface-tinted); color: var(--ink); }
.nav-user-menu__item--danger { color: var(--danger); }
.nav-user-menu__item--danger:hover { background: oklch(var(--lch-danger) / 0.08); }
.nav-icon { inline-size: 22px; block-size: 22px; color: var(--primary); }

/* Workspace Switcher */
.nav-workspace { position: relative; margin-left: var(--space-xs); }
.nav-workspace__trigger {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
}
.nav-workspace__trigger:hover { background: var(--surface-tinted); }
.popup--open .nav-workspace__trigger { background: var(--surface-tinted); }
.nav-workspace__name { font-size: var(--text-xs); font-weight: 500; color: var(--ink-50); }
.nav-workspace__chevron { color: var(--ink-30); transition: transform 0.2s var(--ease-out); width: 10px; height: 10px; }
.popup--open .nav-workspace__chevron { transform: rotate(180deg); }
.nav-workspace__menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 160px;
  background: var(--paper);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 6px;
  z-index: 200;
}
.popup--open .nav-workspace__menu { display: block; }
.nav-workspace__back {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--primary);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: background 0.1s ease;
}
.nav-workspace__back:hover { background: oklch(var(--lch-primary) / 0.08); }
.nav-workspace__back svg { flex-shrink: 0; }
.nav-workspace__divider { height: 1px; background: var(--border-light); margin: 6px 0; }
.nav-workspace__user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--ink-70);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: all 0.1s ease;
}
.nav-workspace__user:hover { background: var(--surface-tinted); color: var(--ink); }
.nav-workspace__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--ink-70);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: all 0.1s ease;
}
.nav-workspace__item:hover { background: var(--surface-tinted); color: var(--ink); }
.nav-workspace__item.active { color: var(--primary); }
.nav-workspace__item.active svg { color: var(--primary); }
.nav-workspace__avatar {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-3xs);
  font-weight: 600;
  color: white;
  border-radius: var(--radius-full);
}
.nav__main { display: flex; gap: 4px; flex: 1; align-items: center; justify-content: center; list-style: none; margin: 0; padding: 0; }
.nav__item { display: flex; }
.nav__link {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: 8px 14px;
    color: var(--ink-50);
    font-weight: 500;
    font-size: var(--text-base);
    border-radius: var(--radius-sm);
    transition: color 0.2s var(--ease-out);
    position: relative;
    background: transparent;
    border: none;
    cursor: pointer;
    text-decoration: none;
    font-family: inherit;
}
.nav__link svg { display: none; }
.nav__link:hover:not(.active) {
    color: var(--ink);
}
.nav__link.active {
    color: var(--ink);
    font-weight: 600;
}
.nav__link.active .nav__link-text::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
    border-radius: 1px;
}
.nav__link-text {
    position: relative;
}
.nav__badge { font-size: var(--text-2xs); font-weight: 500; color: var(--ink-40); margin-left: 1px; }
.nav__badge--highlight { color: var(--primary); }
.nav-actions { display: flex; align-items: center; gap: var(--space-xs); flex-shrink: 0; margin-left: var(--space-md); }
.nav-actions__divider { width: 1px; height: 24px; background: var(--border-light); margin: 0 var(--space-xs); }
.nav-new {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    background: var(--primary);
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s var(--ease-out);
}
.nav-new:hover {
    background: oklch(45% 0.28 250);
    transform: scale(1.05);
}
.nav-new:active { transform: scale(0.98); }
.nav-new__icon {
    font-size: var(--text-xl);
    font-weight: 500;
    color: white;
    line-height: 1;
}
.theme-toggle {
    inline-size: 32px;
    block-size: 32px;
    display: grid;
    place-items: center;
    border-radius: var(--radius-full);
    color: var(--ink-50);
    background: transparent;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s var(--ease-out);
}
.theme-toggle:hover {
    background: var(--surface-tinted);
    color: var(--ink);
}
.theme-toggle svg { inline-size: 18px; block-size: 18px; }
.nav-logout {
    inline-size: 32px;
    block-size: 32px;
    display: grid;
    place-items: center;
    border-radius: var(--radius-full);
    color: var(--ink-50);
    background: transparent;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s var(--ease-out);
}
.nav-logout:hover {
    background: oklch(var(--lch-danger) / 0.08);
    color: var(--danger);
}
.nav-logout svg { inline-size: 18px; block-size: 18px; }

/* Hamburger Menu Button (Mobile Only) */
.hamburger { display: none; flex-direction: column; justify-content: space-around; width: 28px; height: 24px; background: transparent; border: none; cursor: pointer; padding: 0; z-index: 101; margin-right: var(--space-sm); }
.hamburger span { width: 28px; height: 3px; background: var(--ink); border-radius: var(--radius-md); transition: all 0.3s ease; transform-origin: center; }
.hamburger.open span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

/* Main Regions */
main { padding-inline: var(--space-2xl); padding-block-start: var(--space-lg); padding-block-end: var(--space-3xl); width: 100%; max-width: 100vw; box-sizing: border-box; }
.container { max-inline-size: 1400px; margin-inline: auto; width: 100%; box-sizing: border-box; }
.gradient-heading { font-size: var(--text-lg); margin-block-end: var(--space-md); font-weight: 600; background: var(--gradient-brand); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; display: inline-block; letter-spacing: -0.02em; }

/* Page Layout System */
.page-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-md) var(--space-2xl) var(--space-xl);
}
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}
.page-header h1,
.page-header__left h1,
.page-title {
  margin: 0;
  font-size: var(--text-xl);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.page-header__subtitle,
.page-subtitle {
  margin: 4px 0 0 0;
  font-size: var(--text-sm);
  color: var(--ink-50);
}
.page-header__right,
.page-header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.page-actions { display: flex; gap: var(--space-sm); align-items: center; margin-block-start: var(--space-xl); }
