/* ── Drawer Component ─────────────────────────────────
   Panel positioning, backdrop, brand header, transitions.
   The drawer is a <dialog> element — uses native ::backdrop.
   ──────────────────────────────────────────────────── */

/* Dialog-based drawer */
dialog.drawer[open] {
  /* Reset UA dialog defaults */
  inset: 0;
  margin: 0;
  padding: 0;
  padding-top: var(--safe-top);
  border: none;
  max-width: none;
  max-height: none;
  height: 100%;
  /* Drawer positioning */
  position: fixed;
  width: 336px;
  max-width: calc(100vw - 16px);
  background: var(--color-surface);
  z-index: 100;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateX(0);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1),
              display 0.28s allow-discrete,
              overlay 0.28s allow-discrete;
  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.1);
}
/* Entry animation from left */
@starting-style {
  dialog.drawer[open] {
    transform: translateX(-100%);
  }
}
/* Entry animation: tell browser the "from" state when transitioning from display:none */
@starting-style {
  dialog.drawer[open] {
    transform: translateX(-100%);
  }
}
dialog.drawer::backdrop {
  background: rgba(0,0,0,0.3);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}


/* Brand header — high-legibility one-line strip */
.drawer-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 56px;
  padding: var(--space-2) var(--space-4);
  border-bottom: 0.5px solid var(--color-border-light);
}
.drawer-brand-logo {
  width: 32px;
  height: auto;
  flex-shrink: 0;
}
.drawer-brand-sub {
  font-size: 15px;
  line-height: 1.2;
  font-weight: var(--font-weight-bold);
  color: var(--ink-1);
  letter-spacing: 0;
}

/* Calendar toggle */
.drawer-cal-toggle {
  display: flex;
  align-items: center;
  min-height: 52px;
  padding: 0 var(--space-4);
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
  border-bottom: 0.5px solid var(--color-border-light);
  transition: background var(--duration-fast) ease;
}
.drawer-cal-toggle:active { background: var(--color-surface-hover); }
.drawer-cal-toggle-label {
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-bold);
  color: var(--ink-1);
  flex: 1;
}
.drawer-cal-toggle-count {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  color: var(--ink-2);
  margin-right: var(--space-2);
}
.drawer-cal-chevron {
  width: 16px;
  height: 16px;
  color: var(--ink-2);
  transition: transform var(--duration-fast) ease;
  flex-shrink: 0;
}
.drawer-cal-toggle.open .drawer-cal-chevron {
  transform: rotate(180deg);
}

/* <details>-based calendar collapse (replaces .mini-cal-collapsed) */
.drawer-cal-section[open] .drawer-cal-chevron {
  transform: rotate(180deg);
}

/* Section header — sticky within scroll container */
.drawer-section-header {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--color-surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  padding: var(--space-1) var(--space-4);
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-bold);
  color: var(--ink-1);
  letter-spacing: 0;
}

.drawer-new-btn {
  width: var(--touch-min);
  height: var(--touch-min);
  min-width: var(--touch-min);
  min-height: var(--touch-min);
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  color: var(--color-brand);
  font-size: 18px;
  cursor: pointer;
  touch-action: manipulation;
  transition: background var(--duration-fast) var(--easing-standard);
}

.drawer-new-btn svg {
  width: 20px;
  height: 20px;
}

.drawer-new-btn:hover {
  background: var(--color-surface-hover);
}

/* Legacy action btn (kept for compatibility) */
.drawer-action-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
