/* ── Session drawer ───────────────────────────────────────────────────────── */

.drawer-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay-bg);
  z-index: 199;
}

.drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(280px, 85vw);
  background: var(--bg-drawer);
  border-right: 1px solid oklch(var(--b3));
  box-shadow: var(--shadow-drawer);
  z-index: 200;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.25s ease;
  overflow: hidden;
}

.drawer:not(.hidden) {
  transform: translateX(0);
}

.drawer-top {
  padding: 1rem;
  border-bottom: 1px solid oklch(var(--b3));
  flex-shrink: 0;
  padding-top: calc(1rem + var(--safe-top));
}

.drawer-footer {
  padding: 0.5rem;
  border-top: 1px solid oklch(var(--b3));
  flex-shrink: 0;
  padding-bottom: calc(0.5rem + var(--safe-bottom));
}

.session-list {
  list-style: none;
  overflow-y: auto;
  flex: 1;
  -webkit-overflow-scrolling: touch;
}

.session-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid oklch(var(--b3));
  cursor: pointer;
  transition: background 0.1s;
  user-select: none;
  -webkit-user-select: none;
}

.session-item:hover { background: oklch(var(--b1)); }

.session-item.active {
  background: oklch(var(--p) / 8%);
  border-left: 3px solid oklch(var(--p));
  padding-left: calc(1rem - 3px);
}

.session-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.session-title {
  font-size: 0.85rem;
  color: oklch(var(--bc));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-time {
  font-size: 0.72rem;
  color: oklch(var(--bc) / 50%);
}

/* Ellipsis trigger (fine-pointer only) */
.session-ellipsis {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 3px;
  border-radius: 4px;
  color: oklch(var(--bc));
  opacity: 0;
  line-height: 1;
  transition: opacity 0.15s, background 0.1s;
}

@media (pointer: fine) {
  .session-item:hover .session-ellipsis,
  .session-ellipsis:focus { opacity: 0.55; }
  .session-ellipsis:hover  { opacity: 1; background: oklch(var(--b3)); }
}

/* Session context menu popover */
.sess-ctx-menu {
  position: fixed;
  z-index: 600;
  min-width: 140px;
  background: oklch(var(--b2));
  border: 1px solid oklch(var(--b3));
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-tooltip);
  padding: 4px 0;
  display: flex;
  flex-direction: column;
}

.sess-ctx-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-size: 0.85rem;
  color: oklch(var(--bc));
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background 0.1s;
}

.sess-ctx-item:hover { background: oklch(var(--b3)); }

.sess-ctx-delete { color: oklch(var(--er)); }
.sess-ctx-delete:hover { background: oklch(var(--er) / 12%); }

/* Toggle pill badge inside mic context menu items */
.mic-ctx-badge {
  margin-left: auto;
  padding: 1px 7px;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}
.mic-ctx-badge.on  { background: oklch(var(--su) / 20%); color: oklch(var(--su)); }
.mic-ctx-badge.off { background: oklch(var(--bc) / 12%); color: oklch(var(--bc) / 55%); }

/* Rename modal */
.rename-modal-overlay {
  border: none;
  background: transparent;
  padding: 0;
  /* Center in viewport — <dialog> defaults to top-of-page on some browsers */
  position: fixed;
  inset: 0;
  margin: auto;
  width: fit-content;
  height: fit-content;
}

.rename-modal-overlay::backdrop {
  background: var(--overlay-modal-bg);
}

.rename-modal-box {
  background: oklch(var(--b2));
  border: 1px solid oklch(var(--b3));
  border-radius: var(--radius);
  padding: 1.25rem 1.25rem 1rem;
  width: min(360px, 90vw);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.rename-modal-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: oklch(var(--bc));
  margin: 0;
}

.rename-modal-input {
  font-size: 0.9rem;
  background: oklch(var(--b1));
  border: 1px solid oklch(var(--b3));
  border-radius: var(--radius-sm);
  color: oklch(var(--bc));
  padding: 0.45rem 0.65rem;
  width: 100%;
  outline: none;
  transition: border-color 0.15s;
}

.rename-modal-input:focus { border-color: oklch(var(--p) / 70%); }

/* Confirm-mode message paragraph (shown instead of the input) */
.rename-modal-message {
  font-size: 0.9rem;
  color: oklch(var(--bc));
  margin: 0 0 0.75rem;
  line-height: 1.4;
}

.rename-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.session-empty {
  padding: 1.5rem 1rem;
  color: oklch(var(--bc) / 50%);
  font-size: 0.85rem;
  text-align: center;
}

/* ── Project section ──────────────────────────────────────────────────────── */

/* ── Drawer section collapse (shared by Projects and Modules) ─────────────── */

.drawer-section-header {
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

.drawer-section-chevron {
  width: 14px;
  height: 14px;
  color: oklch(var(--bc) / 40%);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.drawer-collapsible {
  overflow: hidden;
  max-height: 600px;
  transition: max-height 0.25s ease;
}

.drawer-collapsible.is-collapsed {
  max-height: 0 !important;
}

.drawer-section-header[aria-expanded="false"] .drawer-section-chevron {
  transform: rotate(-90deg);
}

/* ── Footer ───────────────────────────────────────────────────────────────── */

footer {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0 0.75rem 0.6rem;
  padding-bottom: calc(0.6rem + var(--safe-bottom));
  background: oklch(var(--b2));
  border-top: 1px solid oklch(var(--bc) / 7%);
  box-shadow: var(--shadow-footer);
  flex-shrink: 0;
  z-index: 10;
  position: relative;
  width: 100%;
  box-sizing: border-box;
}

.input-row {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  width: 100%;
  min-width: 0;
  margin-top: 4px;
  position: relative;
}
