/* Desktop shell + collapsible sidebar (desktop app only) */

body.desktop-with-sidebar {
  padding: 0;
  min-height: 100vh;
}

.desktop-shell {
  --sidebar-w: 240px;
  --sidebar-w-collapsed: 60px;
  display: flex;
  min-height: 100vh;
  align-items: stretch;
}

.desktop-shell[data-sidebar-collapsed="true"] {
  --sidebar-w: var(--sidebar-w-collapsed);
}

.desktop-sidebar {
  flex: 0 0 var(--sidebar-w);
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--surface-1);
  border-right: 1px solid var(--border-muted);
  display: flex;
  flex-direction: column;
  transition:
    flex-basis var(--transition-base, 180ms ease),
    width var(--transition-base, 180ms ease),
    min-width var(--transition-base, 180ms ease);
  z-index: 2;
}

.desktop-sidebar-inner {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-height: 100vh;
  padding: var(--space-5, 24px) var(--space-3, 12px);
  gap: var(--space-2, 8px);
}

.desktop-sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2, 8px);
  padding: var(--space-1, 4px) var(--space-2, 8px) var(--space-4, 16px);
  border-bottom: 1px solid var(--border-muted);
  margin-bottom: var(--space-2, 8px);
}

.desktop-sidebar-brand-text {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 400;
  font-style: italic;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 1;
  transition: opacity var(--transition-fast, 150ms ease);
}

.desktop-shell[data-sidebar-collapsed="true"] .desktop-sidebar-brand-text {
  opacity: 0;
  width: 0;
  height: 0;
  overflow: hidden;
  position: absolute;
  pointer-events: none;
}

.desktop-shell[data-sidebar-collapsed="true"] .desktop-sidebar-brand {
  justify-content: center;
  padding: var(--space-1, 4px) 0 var(--space-4, 16px);
  gap: 0;
}

.desktop-sidebar-toggle {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-md, 10px);
  color: var(--text-dim);
  cursor: pointer;
  transition:
    border-color var(--transition-fast, 150ms ease),
    color var(--transition-fast, 150ms ease),
    background var(--transition-fast, 150ms ease),
    transform 120ms ease;
}

.desktop-sidebar-toggle:active {
  transform: scale(0.97);
}

.desktop-sidebar-toggle:hover {
  background: var(--surface-3);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border-muted));
  color: var(--accent);
}

.desktop-sidebar-toggle svg {
  width: 18px;
  height: 18px;
}

.desktop-nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-1, 4px);
  flex: 1;
}

.desktop-nav a {
  display: flex;
  align-items: center;
  gap: var(--space-3, 12px);
  padding: 10px var(--space-3, 12px);
  border-radius: var(--radius-md, 8px);
  text-decoration: none;
  color: var(--text-dim);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  transition:
    background var(--transition-fast, 150ms ease),
    color var(--transition-fast, 150ms ease),
    border-color var(--transition-fast, 150ms ease);
  border: 1px solid transparent;
}

.desktop-nav a:hover {
  color: var(--text);
  background: var(--surface-3);
}

.desktop-nav a.active {
  color: var(--text-on-accent);
  background: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 88%, var(--border-muted));
}

[data-theme="light"] .desktop-nav a.active {
  color: var(--text-on-accent);
}

.desktop-nav-icon {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.85;
}

.desktop-nav-icon svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.desktop-nav a[href="/"] .desktop-nav-icon svg rect {
  fill: currentColor;
  stroke: none;
}

.desktop-nav a[href="/month"] .desktop-nav-icon svg rect {
  fill: none;
}

.desktop-nav-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity var(--transition-fast, 150ms ease);
}

.desktop-shell[data-sidebar-collapsed="true"] .desktop-nav-label {
  opacity: 0;
  width: 0;
  height: 0;
  overflow: hidden;
  position: absolute;
  pointer-events: none;
}

.desktop-shell[data-sidebar-collapsed="true"] .desktop-nav a {
  justify-content: center;
  padding: 10px;
}

.desktop-main {
  flex: 1;
  min-width: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  background: var(--bg-base);
}

.desktop-topbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: 56px;
  padding: var(--space-4) var(--space-6);
  background: var(--surface-1);
  border-bottom: 1px solid var(--border-muted);
  box-shadow: var(--shadow-soft);
}

.desktop-topbar-start {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.desktop-topbar-end {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.desktop-user-email {
  max-width: 280px;
  min-height: 40px;
  padding: 0 var(--space-4);
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--text-dim);
  font-family: var(--font-ui);
  font-size: 0.75rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.desktop-content {
  flex: 1;
  min-height: 0;
  overflow-x: auto;
  overflow-y: auto;
  padding: var(--space-7) var(--space-6) var(--space-8);
  background: var(--bg-base);
}

.desktop-main .page {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
}

@media (max-width: 900px) {
  .desktop-shell {
    --sidebar-w: var(--sidebar-w-collapsed);
  }

  .desktop-sidebar-brand-text,
  .desktop-nav-label {
    opacity: 0;
    width: 0;
    height: 0;
    overflow: hidden;
    position: absolute;
    pointer-events: none;
  }

  .desktop-nav a {
    justify-content: center;
    padding: 10px;
  }

  .desktop-topbar {
    padding: var(--space-3) var(--space-4);
  }

  .desktop-content {
    padding: var(--space-5) var(--space-4) var(--space-6);
  }
}

