:root {
  --bg: #f8fafc;
  --panel: #ffffff;
  --panel-soft: #f1f5f9;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --brand: #6366f1;
  --timer-run: #ea580c;
}

body.dark {
  --bg: #09090b;
  --panel: #111113;
  --panel-soft: #18181b;
  --text: #e4e4e7;
  --muted: #a1a1aa;
  --border: #27272a;
  --timer-run: #fb923c;
}

html {
  overflow-x: clip;
}
body { margin: 0; font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); overflow-x: clip; }
.seo-hero {
  padding: 1rem 1rem 0.5rem;
  background: linear-gradient(180deg, color-mix(in srgb, var(--brand) 10%, var(--bg)), var(--bg));
  border-bottom: 1px solid var(--border);
}
.seo-hero__nav { display: flex; gap: 1rem; flex-wrap: wrap; font-size: 0.85rem; margin-bottom: 0.6rem; }
.seo-hero__nav a { color: var(--brand); text-decoration: none; font-weight: 600; }
.seo-hero__content h1 { margin: 0; font-size: 1.5rem; }
.seo-hero__content p { margin: 0.45rem 0 0; max-width: 78ch; color: var(--muted); }
.seo-hero__details { margin-top: 0.75rem; }
.seo-hero__details summary { cursor: pointer; font-weight: 600; }
.seo-hero__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.8rem; margin-top: 0.7rem; }
.seo-hero__grid section { border: 1px solid var(--border); border-radius: 10px; background: var(--panel); padding: 0.8rem; }
.seo-hero__grid h2 { margin: 0 0 0.45rem; font-size: 1rem; }
.seo-hero__grid p, .seo-hero__grid li { color: var(--muted); line-height: 1.45; }
.seo-footer { border-top: 1px solid var(--border); padding: 0.9rem 1rem 1.5rem; color: var(--muted); font-size: 0.82rem; }

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--brand) 80%, white);
  outline-offset: 2px;
}

/* Desktop Grid */
.dashboard-shell {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  min-height: 100vh;
  overflow-x: clip;
}

/* Viewport-bound row so sidebar flex children get a real max height (sticky editor scrolls inside) */
@media (min-width: 901px) {
  .dashboard-shell {
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    grid-template-rows: minmax(0, 1fr);
  }
  .dashboard-shell > .sidebar {
    min-height: 0;
    overflow-y: auto;
    overflow-x: clip;
    align-self: stretch;
  }
  .dashboard-shell > .main-pane {
    min-height: 0;
    overflow-y: auto;
    overflow-x: clip;
  }
}

.sidebar { border-right: 1px solid var(--border); padding: 1.5rem 1rem; background: var(--panel); }

/* Session sticky: let the timer stack grow so the note editor can fill the peach card (desktop sidebar). */
@media (min-width: 901px) {
  .sidebar {
    display: flex;
    flex-direction: column;
    align-self: stretch;
    min-height: 0;
  }
  .sidebar > .brand-row,
  .sidebar > .sidebar-card--mastery,
  .sidebar > .sidebar-general-notes-wrap {
    flex-shrink: 0;
  }
  #timerDock.timer-dock {
    flex: 1 1 0%;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }
  .sidebar #timerDock > .timer-panel.sidebar-card {
    flex-shrink: 0;
  }
  .sidebar #timerDock > .timer-sticky-dock.sidebar-card {
    flex: 1 1 0%;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
  }
  .sidebar #timerDock > .timer-sticky-dock .timer-sticky-card {
    flex: 1 1 0%;
    min-height: 0;
    max-height: 100%;
  }
}
.main-pane {
  min-width: 0;
  max-width: 100%;
  overflow-x: clip;
}
.brand-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.brand-row > div:first-child {
  flex: 1;
  min-width: 0;
}
.brand-row h1 { font-size: 1.1rem; margin: 0; }
.brand-row p { font-size: 0.75rem; color: var(--muted); margin: 0; }
.logout-btn {
  flex-shrink: 0;
  align-self: center;
  padding: 0.35rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--muted);
  cursor: pointer;
}
.logout-btn:hover {
  color: var(--text); 
  border-color: var(--muted);
}

.toolbar-sync {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
  min-width: 0;
  flex: 1 1 auto;
}
.toolbar-sync__main {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.toolbar-sync__label {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
}
.toolbar-sync__activity {
  font-size: 0.65rem;
  color: var(--muted);
  white-space: nowrap;
}
.toolbar-sync__error {
  width: 100%;
  margin: 0;
  text-align: left;
  max-width: 100%;
}
.sync-status {
  font-size: 0.68rem;
  color: var(--muted);
  line-height: 1.35;
  white-space: pre-line;
}
.sync-status--fullwidth {
  width: 100%;
}
.sync-status--error {
  color: #dc2626;
  font-weight: 600;
}
body.dark .sync-status--error {
  color: #f87171;
}
.google-signin-host {
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
}
.google-signin-host[hidden] {
  display: none !important;
}
/* Same chip surface as Random / Advanced filters; height includes border (box-sizing) */
.google-signin-host--toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  height: var(--filter-rail-h, 2.75rem);
  min-height: var(--filter-rail-h, 2.75rem);
  max-height: var(--filter-rail-h, 2.75rem);
  padding: 0 0.2rem;
  border: 1px solid color-mix(in srgb, var(--brand) 40%, var(--border));
  background: color-mix(in srgb, var(--panel) 80%, var(--brand) 20%);
  box-shadow: 0 6px 14px color-mix(in srgb, var(--brand) 15%, transparent);
  border-radius: 12px;
  overflow: visible;
  transition: none;
}

body.dark .google-signin-host--toolbar {
  border-color: color-mix(in srgb, var(--brand) 48%, var(--border));
  background: color-mix(in srgb, var(--panel) 58%, var(--brand) 42%);
  box-shadow:
    0 6px 16px rgba(0, 0, 0, 0.4),
    0 0 0 1px color-mix(in srgb, var(--brand) 12%, transparent);
}

.google-signed-in {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
  min-height: 0;
  min-width: 0;
}
/* Author `display: flex` above overrides the UA [hidden] rule; keep hidden actually hidden */
.google-signed-in[hidden] {
  display: none !important;
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  max-width: min(200px, 42vw);
}
.user-chip__avatar {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), #6366f1);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  display: grid;
  place-items: center;
  line-height: 1;
}
.user-chip__name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
body.dark .user-chip__avatar {
  background: linear-gradient(135deg, #818cf8, var(--brand));
}
.sync-signout-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.4rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel-soft);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}
.sync-signout-btn__icon {
  flex-shrink: 0;
  opacity: 0.85;
} 
 .sync-signout-btn:hover {
  background: var(--panel);
  border-color: var(--muted);
}
.sync-signout-btn:active {
  transform: translateY(0.5px);
}
.sidebar-card { border: 1px solid var(--border); border-radius: 12px; padding: 1rem; margin-top: 1.5rem; }

/* --- Mastery Progress — dashboard typography --- */
.sidebar-card--mastery {
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-feature-settings: "tnum" 1;
  background: var(--panel);
  border-color: var(--muted);
}

.sidebar-card--mastery .mastery-progress__title {
  margin: 0 0 1rem;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.25;
}

.sidebar-card--mastery .mastery-progress__stat {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  padding-bottom: 0.875rem;
  margin: 0 0 0.125rem;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 88%, transparent);
}

.sidebar-card--mastery .mastery-progress__stat-label {
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: -0.015em;
  color: var(--muted);
}

.sidebar-card--mastery .mastery-progress__stat-value {
  font-size: 1.125rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  color: var(--text);
}

.sidebar-card--mastery .mastery-progress__rings {
  margin: 1rem 0 0;
  gap: 0.35rem;
}

.sidebar-card--mastery .ring-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  text-align: center;
}

.sidebar-card--mastery .ring-wrap > span {
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.2;
}

.sidebar-card--mastery .ring {
  font-size: 0.6875rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
}

.sidebar-card--mastery .sidebar-breakdown {
  font-size: 0.8125rem;
  line-height: 1.45;
  letter-spacing: -0.01em;
  border-top-color: color-mix(in srgb, var(--border) 88%, transparent);
  padding-top: 0.875rem;
  margin-top: 0.875rem;
}

.sidebar-card--mastery .breakdown-item {
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: -0.012em;
  margin-bottom: 0.35rem;
}

.sidebar-card--mastery .breakdown-item:last-child {
  margin-bottom: 0;
}

.difficulty-rings { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; margin: 1rem 0; }
.ring { width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; font-size: 0.75rem; font-weight: bold; border: 1px solid var(--border); }
.ring-easy { --ring-color: #10b981; }
.ring-medium { --ring-color: #f59e0b; }
.ring-hard { --ring-color: #f43f5e; }

.sidebar-breakdown { font-size: 0.8rem; border-top: 1px solid var(--border); padding-top: 1rem; }
.breakdown-item { display: flex; justify-content: space-between; margin-bottom: 0.4rem; font-weight: 500; }

/* Minimal countdown timer — type MM:SS or H:MM:SS */
.timer-dock {
  display: block;
  margin-top: 1.5rem; /* aligns with .sidebar-card spacing after General notes */
}
.timer-drag-handle {
  display: none;
  width: 100%;
  padding: 0.3rem 0.5rem;
  margin: 0 0 0.4rem;
  border: none;
  border-radius: 8px 8px 0 0;
  background: var(--panel-soft);
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.35em;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.timer-drag-handle:active { cursor: grabbing; }
.timer-compact-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}
.timer-display-wrap { flex: 1; min-width: 0; }
.timer-time-input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-align: left;
  padding: 0.15rem 0.25rem;
  line-height: 1.25;
  color: var(--text);
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.timer-time-input:focus {
  outline: none;
  border-color: var(--border);
  background: var(--panel-soft);
}
.timer-time-input:read-only {
  cursor: default;
  border-color: transparent;
  background: transparent;
}
.timer-time-input.timer-expired { color: #ef4444; animation: timer-pulse 1s ease-in-out infinite; }
@keyframes timer-pulse {
  50% { opacity: 0.65; }
}
.timer-progress-track {
  height: 3px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
  margin-top: 0.35rem;
}
.timer-progress-fill {
  height: 100%;
  width: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--timer-run), #fb923c);
  transition: width 0.35s linear;
}
.session-timer-running .timer-time-input { color: var(--timer-run); }
.timer-inline-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
  padding-top: 0.1rem;
}
.timer-primary-icon {
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: var(--brand);
  color: white;
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.timer-primary-icon:disabled { opacity: 0.45; cursor: not-allowed; }
.timer-primary-icon:not(:disabled):hover { filter: brightness(1.06); }
.timer-pip-icon {
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.timer-pip-icon:hover { color: var(--text); border-color: var(--muted); }
.timer-pip-icon[aria-pressed="true"] {
  color: var(--brand);
  border-color: color-mix(in srgb, var(--brand) 55%, var(--border));
  background: color-mix(in srgb, var(--brand) 14%, var(--panel-soft));
}
.timer-reset-icon {
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.timer-reset-icon:hover { color: var(--text); border-color: var(--muted); }
.timer-panel.sidebar-card { padding: 0.75rem 0.85rem; }

/* --- Session sticky notes (under timer) --- */
/* .timer-sticky-dock.sidebar-card {
  margin-top: 0.5rem;
  padding: 0.65rem 0.75rem 0.75rem;
} */

.timer-sticky-pip-banner {
  display: none;
}

.timer-sticky-card {
  --timer-sticky-paper: #fffbeb;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0;
  min-height: 0;
  border-radius: 54px;
  border: 1px solid color-mix(in srgb, var(--border) 88%, transparent);
  background: var(--timer-sticky-paper);
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.06),
    0 10px 28px rgba(15, 23, 42, 0.09);
  overflow: hidden;
}

body.dark .timer-sticky-card {
  border-color: color-mix(in srgb, var(--border) 65%, transparent);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.35),
    0 10px 28px rgba(0, 0, 0, 0.28);
}

.timer-sticky-carousel {
  display: flex;
  flex-flow: row nowrap;
  scroll-snap-type: x mandatory;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  flex: 0 0 auto;
  max-height: 2rem;
  min-height: 1.75rem;
  border-bottom: 1px solid color-mix(in srgb, var(--text) 7%, transparent);
  background: color-mix(in srgb, var(--timer-sticky-paper) 88%, #0f172a);
}

.timer-sticky-carousel::-webkit-scrollbar {
  display: none;
}

.timer-sticky-carousel-slide {
  scroll-snap-align: start;
  scroll-snap-stop: always;
  padding: 0.35rem 0.55rem;
  font-size: 0.68rem;
  line-height: 1.25;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-sizing: border-box;
}

.timer-sticky-carousel-slide--active {
  color: var(--text);
  font-weight: 600;
}

.timer-sticky-carousel-dots {
  display: none;
}

.timer-sticky-header {
  position: absolute;
  top: 0.35rem;
  right: 0.45rem;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
  min-height: 0;
  pointer-events: none;
}

.timer-sticky-active-label {
  display: none !important;
}

.timer-sticky-meta {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  pointer-events: auto;
}

.timer-sticky-card-icon-btn,
.timer-sticky-card-pip-btn {
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border-radius: 10px;

  border: 1px solid color-mix(in srgb, var(--border) 40%, transparent);
  background: color-mix(in srgb, var(--panel) 85%, transparent);
  color: var(--muted);

  font-size: 0.9rem;
  line-height: 1;

  cursor: pointer;
  display: grid;
  place-items: center;

  box-shadow:
    0 1px 1px rgba(0,0,0,0.04),
    0 2px 6px rgba(0,0,0,0.06);

  transition:
    background 0.12s ease,
    border-color 0.12s ease,
    color 0.12s ease,
    transform 0.08s ease;
}

.timer-sticky-card-icon-btn:hover,
.timer-sticky-card-pip-btn:hover {
  background: color-mix(in srgb, var(--panel) 95%, white 5%);
  border-color: color-mix(in srgb, var(--border) 70%, transparent);
  color: var(--foreground);
}

.timer-sticky-card-icon-btn:active,
.timer-sticky-card-pip-btn:active {
  transform: scale(0.96);
}

.timer-sticky-card-icon-btn:focus-visible,
.timer-sticky-card-pip-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 40%, transparent);
}

.timer-sticky-card-icon-btn:hover,
.timer-sticky-card-pip-btn:hover {
  color: var(--text);
  background: var(--panel);
  border-color: var(--muted);
}

.timer-sticky-card-icon-btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.timer-sticky-card-pip-btn[aria-pressed="true"] {
  color: var(--brand);
  border-color: color-mix(in srgb, var(--brand) 45%, var(--border));
}

.timer-sticky-card-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 25;
  width: 1.85rem;
  height: 1.85rem;
  padding: 0;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--border) 85%, transparent);
  background: color-mix(in srgb, var(--panel) 70%, transparent);
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.08),
    0 0 0 1px rgba(255, 255, 255, 0.35) inset;
  transition:
    background 0.12s ease,
    border-color 0.12s ease,
    color 0.12s ease;
}

.timer-sticky-card-nav-btn:hover:not(:disabled) {
  color: var(--text);
  background: var(--panel);
  border-color: var(--muted);
}

.timer-sticky-card-nav-btn:disabled {
  opacity: 0.32;
  cursor: not-allowed;
}

.timer-sticky-card-nav-btn--prev {
  left: 0.35rem;
}

.timer-sticky-card-nav-btn--next {
  right: 0.35rem;
}

.timer-sticky-colors {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.5rem 0.25rem;
}

.timer-sticky-color-swatch {
  width: 1.35rem;
  height: 1.35rem;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 999px;
  background: var(--swatch, #e2e8f0);
  cursor: pointer;
  box-sizing: border-box;
  transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}

.timer-sticky-color-swatch:hover {
  transform: scale(1.06);
}

.timer-sticky-color-swatch--active {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--panel) 80%, transparent);
}

.timer-sticky-editor-host {
  flex: 1 1 0%;
  align-self: stretch;
  min-height: 0;
  margin: 0 2.35rem 0.45rem;
  z-index: 0;
  border-radius: 11px;
  background: color-mix(in srgb, #fff 22%, var(--timer-sticky-paper));
  border: 1px solid color-mix(in srgb, var(--border) 65%, transparent);
  overflow: hidden;
}

.timer-sticky-editor-host.notes-rich-body-host {
  flex: 1 1 0%;
  min-height: 0;
  justify-content: flex-start;
}

/* Same flex chain as .notes-editor-host .notes-rich-prose-host — without this, PM stays block layout and the sticky grows on every Enter instead of scrolling */
.timer-sticky-editor-host > .timer-sticky-prose-mount,
.timer-sticky-editor-host > .notes-rich-prose-host {
  flex: 1 1 0%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.timer-sticky-editor-host .notes-rich-prose-host {
  align-items: stretch;
  justify-content: flex-start;
}
#timerStickyColorRow {
  padding: 0.25rem 0.5rem 0.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.8rem;
  justify-content: center;
}
body.dark .timer-sticky-editor-host {
  background: color-mix(in srgb, var(--panel) 18%, var(--timer-sticky-paper));
}

.timer-sticky-toolbar-host {
  margin: 0 2.35rem;
  border-radius: 0 0 10px 10px;
}

.timer-sticky-prose-mount {
  min-height: 3.5rem;
}

.timer-sticky-dock .notes-rich-prose-host {
  min-height: 3.5rem;
}

/* flex item min-height:auto prevents shrinking below content; 0 + overflow yields inner scroll */
.timer-sticky-editor-host .notes-rich-prosemirror {
  flex: 1 1 auto;
  align-self: stretch;
  min-height: 0;
  overflow-y: auto;
  padding: 0.4rem 0.5rem 0.65rem;
  font-size: 0.9rem;
  line-height: 1.5;
  -webkit-overflow-scrolling: touch;
}

/* TipTap load failure: still show an editor so session stickies are not a blank box */
.timer-sticky-editor-host .timer-sticky-fallback-wrap {
  flex: 1 1 0%;
  min-height: 0;
  overflow: hidden;
}
.timer-sticky-fallback-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
}
.timer-sticky-fallback-hint {
  margin: 0;
  font-size: 0.65rem;
  line-height: 1.35;
  color: var(--muted);
}
.timer-sticky-fallback-ta {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 0.45rem 0.5rem;
  border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, #fff 30%, var(--timer-sticky-paper));
  color: var(--text);
  font: inherit;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, monospace;
  font-size: 0.78rem;
  line-height: 1.4;
  overflow-y: auto;
  resize: none;
}
body.dark .timer-sticky-fallback-ta {
  background: color-mix(in srgb, var(--panel) 25%, var(--timer-sticky-paper));
}

@media (max-width: 850px) {
  .timer-sticky-card-pip-btn {
    display: none;
  }
}

.timer-dock.timer-dock--pip {
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: min(320px, calc(100vw - 16px));
  z-index: 50000;
  padding: 0;
}
.timer-dock.timer-dock--pip .timer-panel {
  margin-top: 0;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow:
    0 4px 6px rgba(15, 23, 42, 0.06),
    0 16px 40px rgba(15, 23, 42, 0.14),
    0 0 0 1px rgba(15, 23, 42, 0.04);
  isolation: isolate;
  overflow: hidden;
}
body.dark .timer-dock.timer-dock--pip .timer-panel {
  box-shadow:
    0 4px 6px rgba(0, 0, 0, 0.35),
    0 16px 48px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(255, 255, 255, 0.06);
}
@media (min-width: 851px) {
  .timer-dock.timer-dock--pip .timer-drag-handle {
    display: flex !important;
    align-items: center;
    justify-content: center;
    background: var(--panel-soft);
    border-bottom: 1px solid var(--border);
  }
  .timer-dock.timer-dock--pip .timer-compact-top {
    padding: 0.5rem 0.65rem 0.65rem;
  }
}

@media (min-width: 851px) {
  .timer-drag-handle { display: none !important; }
}

.timer-mobile-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}
.timer-mobile-toggle[aria-expanded="true"] {
  border-color: var(--brand);
  background: var(--panel-soft);
}

/* Filter Bar — base; desktop grid overridden in design-token block */
.filter-bar {
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 30;
  flex-wrap: wrap;
  min-width: 0;
}
.filter-bar-split {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
  justify-content: flex-end;
}
.filter-bar-split .timer-mobile-toggle { flex: 0 0 2.75rem; }
.filter-bar-split .toolbar-sync {
  flex: 1 1 auto;
  min-width: 0;
}
.search-wrap {
  flex: 1 1 420px;
  min-width: 0;
  border: 1px solid color-mix(in srgb, var(--border) 78%, var(--text));
  background: var(--panel-soft);
  padding: 0.6rem 0.9rem;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.search-wrap input { border: none; background: transparent; width: 100%; outline: none; }
.search-wrap:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
select, .random-btn, .secondary-btn, .save-btn { border: 1px solid var(--border); background: var(--panel); padding: 0.5rem; border-radius: 8px; font-size: 0.85rem; cursor: pointer; }
.random-btn { background: var(--brand); color: white; border: none; font-weight: 600; padding: 0.6rem 1.1rem; border-radius: 12px; box-shadow: 0 8px 16px color-mix(in srgb, var(--brand) 28%, transparent); }

/* Table Shell */
.table-shell { margin: 1.5rem; border: 1px solid var(--border); border-radius: 12px; overflow: auto; background: var(--panel); height: calc(100vh - 120px); }
table { width: 100%; border-collapse: collapse; min-width: 900px; }
th { background: var(--panel-soft); padding: 1rem; font-size: 0.7rem; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--border); text-align: left; position: sticky; top: 0; z-index: 10; }
td { padding: 1rem; border-bottom: 1px solid var(--border); }

.pagination-bar {
  margin: 0 1.5rem 1.5rem;
  padding: 0.65rem 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1rem 1.75rem;
  background: var(--panel-soft);
}

.pagination-group {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.pagination-group--page {
  gap: 0.45rem;
  flex-wrap: wrap;
}

.pagination-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.pagination-num-input {
  box-sizing: border-box;
  min-width: 4.5rem;
  width: 4.75rem;
  padding: 0.45rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
  text-align: center;
  line-height: 1.35;
}

.pagination-num-input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 22%, transparent);
}

.pagination-num-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pagination-page-field {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}

.pagination-num-input--page {
  width: 3.5rem;
  min-width: 3rem;
}

.pagination-page-of {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.pagination-nav-btn {
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  line-height: 1.35;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.pagination-nav-btn:hover:not(:disabled) {
  background: var(--panel-soft);
  border-color: color-mix(in srgb, var(--border) 70%, var(--text));
}

.pagination-nav-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Optional login (auth.js) */
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: color-mix(in srgb, var(--bg) 88%, #0f172a);
  backdrop-filter: blur(6px);
}
.login-overlay[hidden] {
  display: none !important;
}
.login-card {
  width: 100%;
  max-width: 400px;
  padding: 1.75rem 1.5rem;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: 0 18px 50px color-mix(in srgb, #0f172a 12%, transparent);
}
.login-title {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
  font-weight: 700;
}
.login-hint {
  margin: 0 0 1.25rem;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.45;
}
.login-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.login-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
}
.login-field input {
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--text);
  font-size: 0.9rem;
}
.login-field input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 22%, transparent);
}
.login-error {
  margin: 0;
  font-size: 0.8rem;
  color: #dc2626;
  font-weight: 600;
}
body.dark .login-error {
  color: #f87171;
}
.login-submit {
  margin-top: 0.25rem;
  padding: 0.65rem 1rem;
  border: none;
  border-radius: 10px;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
}
.login-submit:hover:not(:disabled) {
  filter: brightness(1.05);
}
.login-submit:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}
.app-root[hidden] {
  display: none !important;
}

tr.is-mastered { opacity: 0.5; background: var(--panel-soft); }
tr.is-mastered .problem-link { text-decoration: line-through; color: var(--muted); }

.problem-link {
  font-family: "Poppins", system-ui, -apple-system, sans-serif;
  text-decoration: none;
}

/* Elements */
.freq-container { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.freq-num { font-size: 0.85rem; font-weight: 600; min-width: 30px; }
.freq-label { font-size: 0.65rem; text-transform: uppercase; color: var(--muted); letter-spacing: 0.04em; }
.freq-interview-block { margin-top: 0.5rem; padding-top: 0.5rem; border-top: 1px dashed var(--border); }
.interview-freq { font-size: 0.75rem; color: var(--muted); line-height: 1.35; margin-bottom: 0.25rem; }
.interview-freq--empty { opacity: 0.65; font-style: italic; }
.interview-pct { font-weight: 700; color: var(--brand); }
.interview-meta { font-size: 0.7rem; }
.interview-heat { margin-top: 0.2rem; opacity: 0.9; }
.heat-bar-fill--interview { background: linear-gradient(90deg, #6366f1, var(--brand)); }
.heat-bar-bg { width: 40px; height: 6px; background: var(--border); border-radius: 10px; overflow: hidden; }
.heat-bar-fill { height: 100%; background: var(--brand); }
.concept-stack { display: flex; flex-direction: column; gap: 0.35rem; }
.sub-pattern { font-size: 0.75rem; color: var(--muted); }
.idea-row { display: flex; align-items: center; }
.idea-icon { font-size: 0.85rem; }
.explore-link {
  font-size: 0.75rem;
  color: var(--brand);
  opacity: 0.7;
  margin-left: 0.5rem;
  text-decoration: none;
}
.explore-link:hover { opacity: 1; }
.core-idea { font-size: 0.78rem; line-height: 1.35; color: var(--text); }
.badge { padding: 0.2rem 0.6rem; border-radius: 6px; font-size: 0.7rem; font-weight: 700; border: 1px solid transparent; width: fit-content; }
.difficulty-easy { background: #d1fae5; color: #065f46; }
.difficulty-medium { background: #fef3c7; color: #92400e; }
.difficulty-hard { background: #fee2e2; color: #991b1b; }
.complexity-cell { font-family: monospace; color: var(--brand); font-weight: 600; }
.accordion-toggle { display: none; }

.problem-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  min-width: 0;
  width: 100%;
}
.problem-title-row .problem-link {
  flex: 1;
  min-width: 0;
}

.note-btn {
  cursor: pointer;
  font: inherit;
  border: 1px solid var(--border);
  background: var(--panel-soft);
  color: var(--text);
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
  font-size: 0.8rem;
  touch-action: manipulation;
  position: relative;
  z-index: 2;
}

.note-btn.note-btn--flag--blue { background: #dbeafe; border-color: #93c5fd; color: #1e3a8a; }
.note-btn.note-btn--flag--green { background: #d1fae5; border-color: #6ee7b7; color: #065f46; }
.note-btn.note-btn--flag--grey { background: #e5e7eb; border-color: #d1d5db; color: #374151; }
.note-btn.note-btn--flag--orange { background: #ffedd5; border-color: #fdba74; color: #9a3412; }
.note-btn.note-btn--flag--purple { background: #ede9fe; border-color: #c4b5fd; color: #5b21b6; }
.note-btn.note-btn--flag--red { background: #fee2e2; border-color: #fca5a5; color: #991b1b; }
.note-btn.note-btn--flag--yellow { background: #fef9c3; border-color: #fde047; color: #854d0e; }

body.dark .note-btn.note-btn--flag--blue { background: #1e3a5f; border-color: #3b82f6; color: #bfdbfe; }
body.dark .note-btn.note-btn--flag--green { background: #064e3b; border-color: #34d399; color: #a7f3d0; }
body.dark .note-btn.note-btn--flag--grey { background: #374151; border-color: #6b7280; color: #e5e7eb; }
body.dark .note-btn.note-btn--flag--orange { background: #7c2d12; border-color: #fb923c; color: #ffedd5; }
body.dark .note-btn.note-btn--flag--purple { background: #4c1d95; border-color: #a78bfa; color: #ede9fe; }
body.dark .note-btn.note-btn--flag--red { background: #7f1d1d; border-color: #f87171; color: #fecaca; }
body.dark .note-btn.note-btn--flag--yellow { background: #713f12; border-color: #facc15; color: #fef9c3; }

.icon-btn { border: none; background: transparent; cursor: pointer; font-size: 1.1rem; line-height: 1; padding: 0.35rem; color: var(--muted); border-radius: 8px; }
.icon-btn:hover { color: var(--text); background: var(--panel-soft); }

/* Notes Drawer */
.notes-sheet {
  --notes-sheet-w: 400px;
  position: fixed;
  top: 0;
  right: calc(-1 * (var(--notes-sheet-w) + 20px));
  width: var(--notes-sheet-w);
  height: 100vh;
  max-height: 100dvh;
  background: var(--panel);
  border-left: 1px solid var(--border);
  padding: 1.5rem;
  padding-left: calc(1.5rem + 10px);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: right 0.3s ease;
  z-index: 100000;
  box-shadow: -10px 0 30px rgba(0,0,0,0.05);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}
.notes-sheet.notes-sheet--dragging {
  transition: none;
}
body.notes-sheet-resizing {
  cursor: ew-resize !important;
  user-select: none;
}
/* Left-edge hit target: drag toward viewport center to widen the panel */
.notes-sheet-resize {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 10px;
  z-index: 3;
  cursor: ew-resize;
  touch-action: none;
  background: transparent;
}
.notes-sheet-resize::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 0;
  bottom: 0;
  width: 3px;
  border-radius: 2px;
  background: transparent;
  transition: background 0.15s ease;
}
.notes-sheet-resize:hover::after,
.notes-sheet-resize:focus-visible::after {
  background: rgba(99, 102, 241, 0.35);
}
/* Closed drawer must not intercept taps meant for the page (helps touch browsers) */
.notes-sheet:not(.open) { pointer-events: none; }
.notes-sheet.open {
  right: 0;
  pointer-events: auto;
  touch-action: pan-y;
}
body.notes-sheet-open,
body.general-notes-modal-open {
  overflow: hidden;
}
.notes-container {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.75rem;
  overflow: hidden;
}
.notes-editor-host {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-soft);
  color: var(--text);
  overflow: hidden;
}
.notes-editor-host .cm-editor {
  flex: 1;
  min-height: 0;
  border-radius: 10px;
  display: flex !important;
  flex-direction: column;
}
.notes-editor-host .cm-scroller {
  flex: 1;
  min-height: 0 !important;
  overflow: auto !important;
}
.notes-editor-host .cm-content {
  min-height: auto !important;
}
.notes-editor-host .cm-focused {
  outline: none;
}
.notes-editor-fallback {
  margin: 0;
  padding: 0.75rem;
  color: var(--muted);
  font-size: 0.9rem;
}
.notes-plain-editor-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.notes-plain-editor {
  flex: 1;
  min-height: 8rem;
  resize: none;
  box-sizing: border-box;
  width: 100%;
  margin: 0;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-soft);
  color: var(--text);
  font: inherit;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, monospace;
  font-size: 0.85rem;
  line-height: 1.45;
  overflow-y: auto;
}
.notes-preview {
  flex: 1;
  min-height: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--panel-soft);
  color: var(--text);
  line-height: 1.55;
}
.notes-preview pre {
  margin: 0.75rem 0;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, monospace;
  font-size: 0.82rem;
  line-height: 1.45;
  background: var(--panel);
}
.notes-preview pre code {
  font-family: inherit;
  font-size: inherit;
  background: transparent;
  padding: 0;
}
.notes-preview :not(pre) > code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, monospace;
  font-size: 0.88em;
  padding: 0.12rem 0.35rem;
  border-radius: 4px;
  background: var(--panel);
  border: 1px solid var(--border);
}
.notes-preview p { margin: 0.5rem 0; }
.notes-preview p:first-child { margin-top: 0; }
.notes-preview p:last-child { margin-bottom: 0; }
.notes-preview ul,
.notes-preview ol { margin: 0.5rem 0; padding-left: 1.35rem; }
.notes-preview a { color: var(--brand); }
.preview-placeholder { color: var(--muted); font-style: italic; }
.sheet-footer {
  flex-shrink: 0;
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 0.8rem;
}
.sheet-header {
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}
.sheet-meta {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-top: 0.35rem;
}
.notes-flag-field {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.notes-flag-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}
.notes-flag-field select {
  font: inherit;
  font-size: 0.85rem;
  padding: 0.35rem 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel-soft);
  color: var(--text);
  min-width: 8rem;
}
.hidden { display: none !important; }

/* --- MOBILE STACKED ACCORDION --- */
@media (max-width: 850px) {
    .timer-pip-icon {
        display: none !important;
    }
    /* Timer hidden until ⏱ — opens as top floating panel (draggable) */
    .timer-dock:not(.timer-dock--open) {
        display: none !important;
    }
    .timer-dock.timer-dock--open {
        display: block !important;
        position: fixed;
        left: max(8px, env(safe-area-inset-left));
        top: max(10px, env(safe-area-inset-top));
        right: auto;
        bottom: auto;
        width: min(300px, calc(100vw - 16px));
        z-index: 50000;
        padding: 0;
    }
    .timer-dock.timer-dock--open .timer-panel {
        margin-top: 0;
        padding: 0;
        border-radius: 14px;
        /* Opaque card so timer text doesn’t blend with the page behind */
        background: var(--panel);
        background-color: var(--panel);
        border: 1px solid var(--border);
        box-shadow:
            0 4px 6px rgba(15, 23, 42, 0.06),
            0 16px 40px rgba(15, 23, 42, 0.14),
            0 0 0 1px rgba(15, 23, 42, 0.04);
        isolation: isolate;
        overflow: hidden;
    }
    body.dark .timer-dock.timer-dock--open .timer-panel {
        box-shadow:
            0 4px 6px rgba(0, 0, 0, 0.35),
            0 16px 48px rgba(0, 0, 0, 0.45),
            0 0 0 1px rgba(255, 255, 255, 0.06);
    }
    .timer-dock.timer-dock--open .timer-drag-handle {
        display: flex !important;
        align-items: center;
        justify-content: center;
        background: var(--panel-soft);
        border-bottom: 1px solid var(--border);
    }
    .timer-dock.timer-dock--open .timer-time-input {
        background: var(--panel-soft) !important;
        border: 1px solid var(--border) !important;
        border-radius: 8px;
        padding: 0.35rem 0.45rem;
    }
    .timer-dock.timer-dock--open .timer-time-input:read-only {
        background: var(--panel-soft) !important;
        border-color: var(--border) !important;
    }
    .timer-dock.timer-dock--open .timer-time-input:focus {
        background: var(--panel) !important;
        border-color: var(--brand) !important;
    }
    .timer-dock.timer-dock--open .timer-progress-track {
        background: var(--border);
    }
    .timer-dock.timer-dock--open .timer-compact-top {
        padding: 0.5rem 0.65rem 0.65rem;
    }
    .timer-mobile-toggle {
        display: inline-flex !important;
    }
    .timer-dock.timer-dock--open.timer-dock--mobile-timer .timer-sticky-dock {
        display: none !important;
    }
    .timer-dock.timer-dock--open.timer-dock--mobile-sticky .timer-panel {
        display: none !important;
    }

    .table-shell { height: auto; margin: 0; border: none; border-radius: 0; overflow: visible; }
    table { min-width: 0; }
    
    table, tbody, tr, td { display: block; width: 100%; box-sizing: border-box; }
    thead { display: none; }

    tbody {
      padding: 0 max(1rem, env(safe-area-inset-right)) 0.65rem max(1rem, env(safe-area-inset-left));
    }

    /* Card row (Option B): rounded surface + shadow; flag tint on tr */
    tr {
      border: 1px solid var(--border);
      border-radius: 12px;
      padding: 0.75rem 1rem;
      margin-bottom: 0.75rem;
      background: var(--panel);
      box-shadow:
        0 1px 3px rgba(15, 23, 42, 0.06),
        0 1px 2px rgba(15, 23, 42, 0.04);
      position: relative;
      overflow: visible;
      cursor: default;
    }
    body.dark tr {
      box-shadow:
        0 1px 3px rgba(0, 0, 0, 0.35),
        0 1px 2px rgba(0, 0, 0, 0.25);
    }

    tr.problem-row--flag--blue { background: #eff6ff; }
    tr.problem-row--flag--green { background: #ecfdf5; }
    tr.problem-row--flag--grey { background: #f3f4f6; }
    tr.problem-row--flag--orange { background: #fff7ed; }
    tr.problem-row--flag--purple { background: #f5f3ff; }
    tr.problem-row--flag--red { background: #fef2f2; }
    tr.problem-row--flag--yellow { background: #fefce8; }

    body.dark tr.problem-row--flag--blue { background: rgba(30, 58, 138, 0.45); }
    body.dark tr.problem-row--flag--green { background: rgba(6, 78, 59, 0.45); }
    body.dark tr.problem-row--flag--grey { background: rgba(55, 65, 81, 0.55); }
    body.dark tr.problem-row--flag--orange { background: rgba(124, 45, 18, 0.45); }
    body.dark tr.problem-row--flag--purple { background: rgba(76, 29, 149, 0.45); }
    body.dark tr.problem-row--flag--red { background: rgba(127, 29, 29, 0.45); }
    body.dark tr.problem-row--flag--yellow { background: rgba(113, 63, 18, 0.45); }

    /* Readable mastered cards on mobile (global opacity 0.5 is too faint on tinted rows) */
    tr.is-mastered {
      opacity: 1;
      background: var(--panel-soft);
    }
    tr.is-mastered.problem-row--flag--blue { background: #e0e7ff; }
    tr.is-mastered.problem-row--flag--green { background: #d1fae5; }
    tr.is-mastered.problem-row--flag--grey { background: #e5e7eb; }
    tr.is-mastered.problem-row--flag--orange { background: #ffedd5; }
    tr.is-mastered.problem-row--flag--purple { background: #ede9fe; }
    tr.is-mastered.problem-row--flag--red { background: #fee2e2; }
    tr.is-mastered.problem-row--flag--yellow { background: #fef9c3; }
    body.dark tr.is-mastered:not([class*="problem-row--flag--"]) {
      background: var(--panel-soft);
    }
    body.dark tr.is-mastered.problem-row--flag--blue { background: rgba(30, 58, 138, 0.55); }
    body.dark tr.is-mastered.problem-row--flag--green { background: rgba(6, 78, 59, 0.55); }
    body.dark tr.is-mastered.problem-row--flag--grey { background: rgba(55, 65, 81, 0.65); }
    body.dark tr.is-mastered.problem-row--flag--orange { background: rgba(124, 45, 18, 0.55); }
    body.dark tr.is-mastered.problem-row--flag--purple { background: rgba(76, 29, 149, 0.55); }
    body.dark tr.is-mastered.problem-row--flag--red { background: rgba(127, 29, 29, 0.55); }
    body.dark tr.is-mastered.problem-row--flag--yellow { background: rgba(113, 63, 18, 0.55); }

    /* Header Line: Checkbox + Problem Title — top-align so multi-line titles don’t vertically center controls */
    .check-cell {
      display: inline-block !important;
      width: 32px !important;
      border: none !important;
      padding: 0 !important;
      padding-top: 0.2rem !important;
      vertical-align: top !important;
    }
    .check-cell .mastered-check {
      display: block;
      margin: 0;
    }
    .problem-cell {
      display: inline-block !important;
      width: calc(100% - 44px) !important;
      border: none !important;
      padding: 0 !important;
      vertical-align: top !important;
      position: relative;
    }
    /* Checkbox + title are self-explanatory — hide repeating column labels */
    .check-cell::before,
    .problem-cell::before {
        content: none !important;
        display: none !important;
        margin: 0 !important;
    }
    .problem-link {
        font-size: 1.06rem;
        font-weight: 600;
        letter-spacing: -0.025em;
        line-height: 1.35;
        color: var(--brand);
        text-decoration: none;
        overflow-wrap: anywhere;
    }
    .problem-link:active { opacity: 0.85; }
    .problem-link:focus-visible {
        outline: 2px solid var(--brand);
        outline-offset: 3px;
        border-radius: 4px;
    }

    /* The Details (Stacked) — hidden until .is-expanded (includes Notes / Actions) */
    td:not(.check-cell):not(.problem-cell) {
        display: none !important; /* Managed by .is-expanded */
        flex-direction: column;
        align-items: flex-start;
        padding: 0.8rem 0;
        border-bottom: 1px solid var(--border);
    }

    tr.is-expanded td:not(.check-cell):not(.problem-cell) { display: flex !important; }

    tr.is-expanded .frequency-cell {
      border-top: 1px solid var(--border);
      margin-top: 0.35rem;
      padding-top: 0.9rem;
    }

    /* Label on Top, Content Below */
    td::before {
        content: attr(data-label);
        font-weight: 800;
        font-size: 0.65rem;
        text-transform: uppercase;
        color: var(--muted);
        margin-bottom: 0.4rem;
        pointer-events: none;
    }

    td > div, td > span { width: 100%; text-align: left; }
    .freq-container, .concept-stack { justify-content: flex-start !important; }
    
    .actions-cell { border-bottom: none !important; padding-top: 1rem !important; position: relative; z-index: 5; isolation: isolate; }
    .note-btn { width: 100%; justify-content: center !important; background: var(--brand); color: white; padding: 0.8rem; border: none; font-weight: 700; cursor: pointer; -webkit-tap-highlight-color: transparent; }
    .note-btn.note-btn--flag { border: 1px solid var(--border) !important; }
    .note-btn.note-btn--flag--blue { background: #dbeafe !important; color: #1e3a8a !important; }
    .note-btn.note-btn--flag--green { background: #d1fae5 !important; color: #065f46 !important; }
    .note-btn.note-btn--flag--grey { background: #e5e7eb !important; color: #374151 !important; }
    .note-btn.note-btn--flag--orange { background: #ffedd5 !important; color: #9a3412 !important; }
    .note-btn.note-btn--flag--purple { background: #ede9fe !important; color: #5b21b6 !important; }
    .note-btn.note-btn--flag--red { background: #fee2e2 !important; color: #991b1b !important; }
    .note-btn.note-btn--flag--yellow { background: #fef9c3 !important; color: #854d0e !important; }
    body.dark .note-btn.note-btn--flag--blue { background: #1e3a5f !important; color: #bfdbfe !important; }
    body.dark .note-btn.note-btn--flag--green { background: #064e3b !important; color: #a7f3d0 !important; }
    body.dark .note-btn.note-btn--flag--grey { background: #374151 !important; color: #e5e7eb !important; }
    body.dark .note-btn.note-btn--flag--orange { background: #7c2d12 !important; color: #ffedd5 !important; }
    body.dark .note-btn.note-btn--flag--purple { background: #4c1d95 !important; color: #ede9fe !important; }
    body.dark .note-btn.note-btn--flag--red { background: #7f1d1d !important; color: #fecaca !important; }
    body.dark .note-btn.note-btn--flag--yellow { background: #713f12 !important; color: #fef9c3 !important; }

    /* Accordion: inline with title (flex row); rounded like desktop .note-btn */
    .problem-title-row .accordion-toggle {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      align-self: flex-start;
      position: static;
      flex-shrink: 0;
      width: auto;
      min-width: 2.25rem;
      min-height: 2.25rem;
      padding: 0 0.35rem;
      border: 1px solid var(--border);
      border-radius: 8px;
      background: var(--panel-soft);
      color: var(--muted);
      font-size: 0.65rem;
      line-height: 1;
      cursor: pointer;
      transition: transform 0.2s ease;
      z-index: 2;
      -webkit-tap-highlight-color: transparent;
    }

    tr.is-expanded .problem-title-row .accordion-toggle { transform: rotate(180deg); }

    .pagination-bar {
      margin: 1rem;
      padding: 0.65rem 0.75rem;
      gap: 0.75rem;
      justify-content: center;
    }

    .pagination-group--page {
      justify-content: center;
    }

    /*
     * Mobile / iOS / in-app WebViews: negative viewport widths (e.g. right: -100vw) often break
     * position:fixed. Use a full-viewport layer + translate3d slide instead of animating "right".
     */
    .notes-sheet-resize {
      display: none;
    }
    .notes-sheet {
      left: 0 !important;
      right: 0 !important;
      width: 100% !important;
      max-width: 100% !important;
      height: 100% !important;
      min-height: 100dvh !important;
      max-height: none !important;
      border-left: none;
      border-top: 1px solid var(--border);
      padding: max(0.75rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
      padding-left: max(1rem, env(safe-area-inset-left));
      overflow-x: hidden;
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
      overscroll-behavior: contain;
      transition: transform 0.3s ease;
      transform: translate3d(100%, 0, 0);
      box-shadow: none;
    }
    .notes-sheet.open {
      transform: translate3d(0, 0, 0) !important;
    }
}

/* --- Rich notes (TipTap) + general notes modal --- */
.sidebar-general-notes-wrap {
  margin-top: 1.5rem; /* same rhythm as .sidebar-card */
  margin-bottom: 0.75rem;
  padding: 0;
  flex-shrink: 0;
}

/* Match vertical gap after button to the timer stack with mastery/card spacing (1.5rem), not margin + padding */
.timer-dock > .sidebar-card:first-child {
  margin-top: 0;
}

/* Same visual language as .filter-bar__advanced summary — reads as a secondary action, not a ghost panel */
.sidebar-general-notes-btn {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.62rem 0.9rem;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--brand) 40%, var(--border));
  background: color-mix(in srgb, var(--panel) 80%, var(--brand) 20%);
  box-shadow: 0 6px 14px color-mix(in srgb, var(--brand) 15%, transparent);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.12s ease;
}

.sidebar-general-notes-btn:hover {
  border-color: color-mix(in srgb, var(--brand) 52%, var(--border));
  background: color-mix(in srgb, var(--panel) 72%, var(--brand) 28%);
  box-shadow: 0 8px 20px color-mix(in srgb, var(--brand) 22%, transparent);
}

.sidebar-general-notes-btn:active {
  transform: scale(0.992);
}

body.dark .sidebar-general-notes-btn {
  border-color: color-mix(in srgb, var(--brand) 48%, var(--border));
  background: color-mix(in srgb, var(--panel) 58%, var(--brand) 42%);
  box-shadow:
    0 6px 16px rgba(0, 0, 0, 0.4),
    0 0 0 1px color-mix(in srgb, var(--brand) 12%, transparent);
}

body.dark .sidebar-general-notes-btn:hover {
  border-color: color-mix(in srgb, var(--brand) 58%, var(--border));
  background: color-mix(in srgb, var(--panel) 50%, var(--brand) 50%);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.5);
}

.notes-rich-toolbar-host {
  flex-shrink: 0;
  padding: 0.35rem 0.75rem 0.25rem;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  background: var(--panel-soft);
}

.notes-rich-toolbar-host--body {
  border-bottom: none;
  padding-top: 0.5rem;
  background: transparent;
}

/* General notes: body grows, format bar stays visible at bottom of the scroll column */
.notes-rich-body-host {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.general-notes-scroll .general-notes-format-bar {
  flex-shrink: 0;
  margin-top: auto;
  padding-top: 0.5rem;
  padding-bottom: 0.35rem;
  border-top: 1px solid var(--border);
  background: var(--panel-soft);
  border-bottom: none;
  position: relative;
  z-index: 1;
}

/* Bubble-only mode: no bottom strip (toolbar host stays empty) */
.general-notes-modal .general-notes-format-bar {
  display: none !important;
}

.notes-rich-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.notes-rich-toolbar__pill {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 0.2rem 0.5rem;
  font-size: 0.72rem;
  cursor: pointer;
  line-height: 1.2;
}

.notes-rich-toolbar__pill:hover {
  color: var(--text);
  border-color: var(--muted);
}

.notes-rich-toolbar__select {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.2rem 0.45rem;
  font-size: 0.72rem;
  background: var(--panel);
  color: var(--text);
}

.notes-rich-toolbar__color {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.72rem;
  color: var(--muted);
}

.notes-rich-toolbar__color-input {
  width: 1.75rem;
  height: 1.35rem;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
}

.notes-rich-prose-host {
  min-height: 12rem;
  flex: 1;
  min-width: 0;
}

.notes-editor-host .notes-rich-prose-host {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.notes-rich-prosemirror {
  outline: none;
  flex: 1;
  min-height: min(12rem, 30vh);
  padding: 0.5rem 0.75rem 1rem;
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--text);
  user-select: text;
  -webkit-user-select: text;
}

.notes-editor-host .notes-rich-prosemirror {
  min-height: 0;
  max-height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.notes-rich-prosemirror p {
  margin: 0.35rem 0;
}

.notes-rich-prosemirror p.is-editor-empty:first-child::before {
  color: var(--muted);
}

.notes-rich-prosemirror pre.notes-rich-codeblock {
  margin: 0.5rem 0;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  background: var(--panel);
  border: 1px solid var(--border);
  overflow-x: auto;
  font-size: 0.8rem;
}

.notes-rich-prosemirror pre.notes-rich-codeblock code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, monospace;
  background: none;
  padding: 0;
}

/* Highlight.js token colors (light theme) */
.notes-rich-prosemirror .hljs-comment,
.notes-rich-prosemirror .hljs-quote {
  color: #6b7280;
  font-style: italic;
}
.notes-rich-prosemirror .hljs-keyword,
.notes-rich-prosemirror .hljs-selector-tag,
.notes-rich-prosemirror .hljs-meta .hljs-keyword {
  color: #7c3aed;
}
.notes-rich-prosemirror .hljs-title,
.notes-rich-prosemirror .hljs-title.function_,
.notes-rich-prosemirror .hljs-section,
.notes-rich-prosemirror .hljs-selector-id {
  color: #1d4ed8;
}
.notes-rich-prosemirror .hljs-string,
.notes-rich-prosemirror .hljs-attr,
.notes-rich-prosemirror .hljs-selector-class,
.notes-rich-prosemirror .hljs-selector-attr,
.notes-rich-prosemirror .hljs-template-tag {
  color: #15803d;
}
.notes-rich-prosemirror .hljs-number,
.notes-rich-prosemirror .hljs-literal,
.notes-rich-prosemirror .hljs-built_in,
.notes-rich-prosemirror .hljs-type {
  color: #b45309;
}
.notes-rich-prosemirror .hljs-variable,
.notes-rich-prosemirror .hljs-params,
.notes-rich-prosemirror .hljs-property {
  color: #be123c;
}

/* Highlight.js token colors (dark theme) */
body.dark .notes-rich-prosemirror .hljs-comment,
body.dark .notes-rich-prosemirror .hljs-quote,
.notes-rich-editor--dark .notes-rich-prosemirror .hljs-comment,
.notes-rich-editor--dark .notes-rich-prosemirror .hljs-quote {
  color: #9ca3af;
}
body.dark .notes-rich-prosemirror .hljs-keyword,
body.dark .notes-rich-prosemirror .hljs-selector-tag,
body.dark .notes-rich-prosemirror .hljs-meta .hljs-keyword,
.notes-rich-editor--dark .notes-rich-prosemirror .hljs-keyword,
.notes-rich-editor--dark .notes-rich-prosemirror .hljs-selector-tag,
.notes-rich-editor--dark .notes-rich-prosemirror .hljs-meta .hljs-keyword {
  color: #c4b5fd;
}
body.dark .notes-rich-prosemirror .hljs-title,
body.dark .notes-rich-prosemirror .hljs-title.function_,
body.dark .notes-rich-prosemirror .hljs-section,
.notes-rich-editor--dark .notes-rich-prosemirror .hljs-title,
.notes-rich-editor--dark .notes-rich-prosemirror .hljs-title.function_,
.notes-rich-editor--dark .notes-rich-prosemirror .hljs-section {
  color: #93c5fd;
}
body.dark .notes-rich-prosemirror .hljs-string,
body.dark .notes-rich-prosemirror .hljs-attr,
body.dark .notes-rich-prosemirror .hljs-selector-class,
body.dark .notes-rich-prosemirror .hljs-selector-attr,
.notes-rich-editor--dark .notes-rich-prosemirror .hljs-string,
.notes-rich-editor--dark .notes-rich-prosemirror .hljs-attr,
.notes-rich-editor--dark .notes-rich-prosemirror .hljs-selector-class,
.notes-rich-editor--dark .notes-rich-prosemirror .hljs-selector-attr {
  color: #86efac;
}
body.dark .notes-rich-prosemirror .hljs-number,
body.dark .notes-rich-prosemirror .hljs-literal,
body.dark .notes-rich-prosemirror .hljs-built_in,
body.dark .notes-rich-prosemirror .hljs-type,
.notes-rich-editor--dark .notes-rich-prosemirror .hljs-number,
.notes-rich-editor--dark .notes-rich-prosemirror .hljs-literal,
.notes-rich-editor--dark .notes-rich-prosemirror .hljs-built_in,
.notes-rich-editor--dark .notes-rich-prosemirror .hljs-type {
  color: #fcd34d;
}
body.dark .notes-rich-prosemirror .hljs-variable,
body.dark .notes-rich-prosemirror .hljs-params,
body.dark .notes-rich-prosemirror .hljs-property,
.notes-rich-editor--dark .notes-rich-prosemirror .hljs-variable,
.notes-rich-editor--dark .notes-rich-prosemirror .hljs-params,
.notes-rich-editor--dark .notes-rich-prosemirror .hljs-property {
  color: #fda4af;
}

.notes-rich-prosemirror table {
  border-collapse: collapse;
  width: 100%;
  table-layout: fixed;
  margin: 0.6rem 0;
}

.notes-rich-prosemirror th,
.notes-rich-prosemirror td {
  border: 1px solid var(--border);
  padding: 0.4rem 0.55rem;
  vertical-align: top;
}

.notes-rich-prosemirror th {
  font-weight: 600;
  background: var(--panel-soft);
}

.notes-rich-prosemirror .selectedCell {
  position: relative;
}

.notes-rich-prosemirror .selectedCell::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: color-mix(in srgb, var(--brand) 14%, transparent);
}

.notes-rich-editor--dark .notes-rich-prosemirror {
  color: var(--text);
}

.general-notes-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.general-notes-modal {
  position: fixed;
  inset: 0;
  /* Above `.notes-sheet` (100000) so this dialog is never underneath the problem-notes panel. */
  z-index: 110000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(0.75rem, env(safe-area-inset-top)) max(0.75rem, env(safe-area-inset-right))
    max(0.75rem, env(safe-area-inset-bottom)) max(0.75rem, env(safe-area-inset-left));
}

.general-notes-modal[hidden] {
  display: none !important;
}

.general-notes-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  cursor: pointer;
}

body.dark .general-notes-backdrop {
  background: rgba(0, 0, 0, 0.55);
}

.general-notes-card {
  position: relative;
  z-index: 1;
  width: min(80vw, 960px);
  height: min(80vh, 900px);
  max-height: calc(100dvh - 1.5rem);
  display: flex;
  flex-direction: column;
  background: var(--panel);
  color: var(--text);
  border-radius: 14px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.general-notes-card.general-notes-card--max {
  width: min(96vw, 1400px);
  height: min(94vh, 1200px);
}

.general-notes-chrome {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0.85rem;
  flex-shrink: 0;
}

.general-notes-chrome-left,
.general-notes-chrome-right {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

.general-notes-context {
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
}

.general-notes-icon-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
  width: 2rem;
  height: 2rem;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.general-notes-icon-btn:hover {
  color: var(--text);
  background: var(--panel-soft);
}

.general-notes-picker-wrap {
  position: relative;
  min-width: 0;
}

.general-notes-picker-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  max-width: 12rem;
  padding: 0.25rem 0.45rem;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  min-width: 0;
}

.general-notes-picker-btn:hover {
  border-color: var(--border);
  background: var(--panel-soft);
}

.general-notes-chevron {
  font-size: 0.65rem;
  color: var(--muted);
}

.general-notes-picker-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 12rem;
  max-height: 14rem;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  z-index: 2;
}

.general-notes-picker-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.45rem 0.65rem;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 0.82rem;
  cursor: pointer;
}

.general-notes-picker-item:hover {
  background: var(--panel-soft);
}

.general-notes-picker-item--new {
  font-weight: 600;
  color: var(--brand);
}

.general-notes-overflow-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 10rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  z-index: 3;
}

.general-notes-overflow-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.45rem 0.65rem;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 0.82rem;
  cursor: pointer;
}

.general-notes-overflow-item:hover {
  background: var(--panel-soft);
}

.general-notes-chrome-right {
  position: relative;
}

.general-notes-title-strip {
  flex-shrink: 0;
  padding: 0 max(1.25rem, env(safe-area-inset-right)) 0 max(1.25rem, env(safe-area-inset-left));
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}

.general-notes-editor-column {
  /* Size to note content so the outer `.general-notes-scroll` scrolls (not clipped inner flex). */
  flex: 0 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.general-notes-modal #generalNotesEditorHost.notes-rich-body-host {
  flex: 0 1 auto;
  min-height: 0;
  overflow: visible;
}

.general-notes-modal #generalNotesEditorMount.general-notes-prose-mount {
  flex: 0 1 auto;
  display: flex;
  flex-direction: column;
}

.general-notes-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 0.25rem max(1.25rem, env(safe-area-inset-right)) 1rem max(1.25rem, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
}

.general-notes-title-input {
  width: 100%;
  border: none;
  background: transparent;
  font-size: 1.65rem;
  font-weight: 600;
  color: #0052cc;
  padding: 0.35rem 0.35rem 0.75rem 1.5rem;
  margin-bottom: 0.25rem;
  outline: none;
}

.general-notes-title-input::placeholder {
  color: var(--muted);
  opacity: 0.85;
}

.general-notes-modal .notes-rich-prosemirror p {
  margin: 0.4rem 0;
}

/* Confluence-style heading color system for notes content. */
.notes-rich-prosemirror h1,
.notes-rich-prosemirror h2,
.notes-rich-prosemirror h3,
.notes-rich-prosemirror h4,
.notes-rich-prosemirror h5,
.notes-rich-prosemirror h6,
.notes-preview h1,
.notes-preview h2,
.notes-preview h3,
.notes-preview h4,
.notes-preview h5,
.notes-preview h6 {
  color: #0052cc;
}

body.dark .general-notes-title-input,
body.dark .notes-rich-prosemirror h1,
body.dark .notes-rich-prosemirror h2,
body.dark .notes-rich-prosemirror h3,
body.dark .notes-rich-prosemirror h4,
body.dark .notes-rich-prosemirror h5,
body.dark .notes-rich-prosemirror h6,
body.dark .notes-preview h1,
body.dark .notes-preview h2,
body.dark .notes-preview h3,
body.dark .notes-preview h4,
body.dark .notes-preview h5,
body.dark .notes-preview h6 {
  color: #4c9aff;
}

.general-notes-modal .notes-rich-prosemirror:focus-visible {
  outline: none !important;
  box-shadow: none !important;
}

/*
 * TipTap BubbleMenu mounts on `document.body` — styles must not rely on
 * `.general-notes-modal` ancestry. Opaque shell is `.notes-rich-bubble`.
 */
.tippy-box[data-theme="dsa-gn-bubble"],
.tippy-box[data-theme="dsa-gn-bubble"] > .tippy-content {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  overflow: visible !important;
  max-width: none !important;
}

.notes-rich-bubble {
  pointer-events: auto;
  width: max-content;
  max-width: min(96vw, 22rem);
  box-sizing: border-box;
  background: #ffffff !important;
  color: #111827;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 10px;
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.04),
    0 8px 24px rgba(15, 23, 42, 0.1),
    0 20px 48px -16px rgba(15, 23, 42, 0.14);
  overflow: hidden;
  transform-origin: top center;
  isolation: isolate;
}

body.dark .notes-rich-bubble,
.notes-rich-bubble.notes-rich-bubble--dark {
  background: #27272a !important;
  color: #f4f4f5;
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.35),
    0 16px 40px rgba(0, 0, 0, 0.45);
}

.notes-rich-bubble__panel--notion {
  display: flex;
  flex-direction: column;
  width: max-content;
  min-width: min(96vw, 18.5rem);
  max-width: min(96vw, 22rem);
  box-sizing: border-box;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

.notes-rich-bubble__grip {
  flex-shrink: 0;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

body.dark .notes-rich-bubble__grip,
.notes-rich-bubble.notes-rich-bubble--dark .notes-rich-bubble__grip {
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

.notes-rich-bubble__notion-body {
  padding: 0.45rem 0.55rem 0.55rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.notes-rich-bubble__drag {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.28rem 0.45rem;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  background: linear-gradient(180deg, #fafafa 0%, #f3f4f6 100%);
  color: #6b7280;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

body.dark .notes-rich-bubble__drag,
.notes-rich-bubble.notes-rich-bubble--dark .notes-rich-bubble__drag {
  background: linear-gradient(180deg, #303034 0%, #27272a 100%);
  color: #a1a1aa;
}

.notes-rich-bubble__drag:active,
.notes-rich-bubble__drag--dragging {
  cursor: grabbing;
}

.notes-rich-bubble__drag-grip {
  font-size: 0.85rem;
  line-height: 1;
  letter-spacing: 0.02em;
  opacity: 0.7;
}

.notes-rich-bubble__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.2rem;
}

.notes-rich-bubble__row--notion-main {
  gap: 0.12rem;
  row-gap: 0.28rem;
}

.notes-rich-bubble__row--notion-link {
  gap: 0.35rem;
}

.notes-rich-bubble__row--swatches {
  gap: 0.35rem;
}

.notes-rich-bubble__row--swatches-tight {
  gap: 0.28rem;
}

.notes-rich-bubble__vsep {
  width: 1px;
  height: 1.35rem;
  margin: 0 0.22rem;
  align-self: center;
  flex: 0 0 auto;
  background: rgba(15, 23, 42, 0.1);
}

body.dark .notes-rich-bubble__vsep,
.notes-rich-bubble.notes-rich-bubble--dark .notes-rich-bubble__vsep {
  background: rgba(255, 255, 255, 0.12);
}

.notes-rich-bubble__sep {
  height: 1px;
  background: rgba(15, 23, 42, 0.07);
  border-radius: 1px;
}

body.dark .notes-rich-bubble__sep,
.notes-rich-bubble.notes-rich-bubble--dark .notes-rich-bubble__sep {
  background: rgba(255, 255, 255, 0.08);
}

.notes-rich-bubble__select,
.notes-rich-bubble__select--notion {
  flex: 0 0 auto;
  min-width: 3.4rem;
  border-radius: 6px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  background: #fff !important;
  color: #111827;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.22rem 0.35rem;
  cursor: pointer;
}

body.dark .notes-rich-bubble__select,
body.dark .notes-rich-bubble__select--notion,
.notes-rich-bubble.notes-rich-bubble--dark .notes-rich-bubble__select {
  border-color: rgba(255, 255, 255, 0.12);
  background: #18181b !important;
  color: #f4f4f5;
}

.notes-rich-bubble__btn {
  border: none;
  border-radius: 6px;
  padding: 0.26rem 0.4rem;
  font-size: 0.78rem;
  font-weight: 700;
  background: transparent;
  color: #4b5563;
  cursor: pointer;
  line-height: 1.2;
}

body.dark .notes-rich-bubble__btn,
.notes-rich-bubble.notes-rich-bubble--dark .notes-rich-bubble__btn {
  color: #d4d4d8;
}

.notes-rich-bubble__btn:hover {
  background: rgba(15, 23, 42, 0.06);
}

body.dark .notes-rich-bubble__btn:hover,
.notes-rich-bubble.notes-rich-bubble--dark .notes-rich-bubble__btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.notes-rich-bubble__btn--active {
  background: rgba(59, 130, 246, 0.12);
  color: #1d4ed8;
}

body.dark .notes-rich-bubble__btn--active,
.notes-rich-bubble.notes-rich-bubble--dark .notes-rich-bubble__btn--active {
  background: rgba(96, 165, 250, 0.18);
  color: #93c5fd;
}

.notes-rich-bubble__btn--compact {
  padding: 0.2rem 0.32rem;
  font-size: 0.72rem;
}

.notes-rich-bubble__btn--wide {
  flex: 1 1 auto;
  min-width: 0;
}

.notes-rich-bubble__swatch {
  width: 1.35rem;
  height: 1.35rem;
  padding: 0;
  border-radius: 6px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: var(--swatch, #e5e7eb);
  cursor: pointer;
}

body.dark .notes-rich-bubble__swatch,
.notes-rich-bubble.notes-rich-bubble--dark .notes-rich-bubble__swatch {
  border-color: rgba(255, 255, 255, 0.14);
}

.notes-rich-bubble__swatch--text {
  border-radius: 999px;
}

.pip-root {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  border-radius: 1px;
}

.timer-pip-root {
  width: 100%;
  height: 100%;
  display: flex;
}

.timer-pip-root > * {
  width: 100%;
  height: 100%;
}

/* PiP document only — global height:100% breaks sidebar flex (card grows with every Enter; no inner scroll) */
.timer-pip-root .timer-sticky-card {
  width: 100%;
  height: 100%;
  border-radius: 0;
}

/* === 2026 UI polish pass: consistency, hierarchy, micro-interactions === */
:root {
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-sm: 0 4px 14px rgba(15, 23, 42, 0.08), 0 1px 0 rgba(15, 23, 42, 0.04);
  --shadow-md: 0 10px 30px rgba(15, 23, 42, 0.12), 0 2px 8px rgba(15, 23, 42, 0.08);
  --ease-standard: cubic-bezier(0.2, 0, 0, 1);
  --dur-fast: 140ms;
}

body {
  font-size: 15px;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 { letter-spacing: -0.02em; line-height: 1.25; }
.brand-row h1 { font-size: clamp(1.35rem, 1.1rem + 0.8vw, 1.8rem); }
.seo-hero__eyebrow {
  margin: 0 0 var(--space-2);
  font-size: 0.74rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--brand);
  font-weight: 700;
}
.seo-hero__content h1 {
  font-size: clamp(1.45rem, 1.1rem + 1.2vw, 2rem);
  max-width: 24ch;
  line-height: 1.22;
}
.seo-hero__content p { max-width: 74ch; }
.seo-hero__grid section { padding: var(--space-4); }
.seo-hero__grid h2 { font-size: 0.95rem; }

.sidebar,
.filter-bar,
.sidebar-card,
.table-shell,
.notes-sheet,
.general-notes-card,
.timer-panel,
.timer-sticky-card {
  border-radius: var(--radius-md);
}

.sidebar { padding: var(--space-6) var(--space-4); }
.sidebar-card { margin-top: var(--space-6); padding: var(--space-4); box-shadow: var(--shadow-xs); }
.main-pane {
  background: color-mix(in srgb, var(--bg) 94%, var(--panel));
}

.filter-bar {
  padding: var(--space-3) var(--space-6);
  gap: var(--space-3);
  background: color-mix(in srgb, var(--panel) 92%, var(--bg));
  backdrop-filter: blur(8px);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.05);
}

@media (min-width: 901px) {
  /* One shared rail height so search, Random, Advanced, and sign-in share a baseline row */
  .filter-bar {
    --filter-rail-h: 2.75rem;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-rows: minmax(var(--filter-rail-h), auto) auto;
    align-items: start;
    column-gap: var(--space-3);
    row-gap: 0.35rem;
  }

  .filter-bar__primary {
    grid-column: 1;
    grid-row: 1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: minmax(var(--filter-rail-h), auto);
    column-gap: var(--space-3);
    row-gap: 0;
    min-width: 0;
    align-items: center;
    align-self: center;
  }

  .filter-bar__primary .search-wrap {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
    flex: none;
    min-height: var(--filter-rail-h);
    box-sizing: border-box;
    align-self: stretch;
    display: flex;
    align-items: center;
  }

  .filter-bar__primary .random-btn {
    grid-column: 2;
    grid-row: 1;
    align-self: center;
    flex-shrink: 0;
  }

  .filter-bar > .workflow-hint {
    grid-column: 1 / -1;
    grid-row: 2;
    max-width: none;
    margin-top: 0.2rem;
  }

  .filter-bar__advanced {
    grid-column: 2;
    grid-row: 1;
    align-self: center;
    display: flex;
    align-items: center;
  }

  .filter-bar__advanced > summary {
    min-height: var(--filter-rail-h);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
  }

  .filter-bar-split {
    grid-column: 3;
    grid-row: 1;
    align-self: center;
    justify-self: end;
    flex: unset;
    min-width: 0;
    min-height: var(--filter-rail-h);
    width: auto;
    display: flex;
    align-items: center;
  }

  .filter-bar-split .toolbar-sync {
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    gap: 0.25rem;
    min-height: var(--filter-rail-h);
  }

  .filter-bar-split .toolbar-sync__main {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    min-height: var(--filter-rail-h);
  }

  .filter-bar-split .google-signin-host--toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-width: 280px;
    width: auto;
  }
}

.workflow-hint {
  margin: 0;
  font-size: 0.75rem;
  color: var(--muted);
}
.filter-bar__advanced {
  position: relative;
}
.filter-bar__advanced summary {
  list-style: none;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  border: 1px solid color-mix(in srgb, var(--brand) 40%, var(--border));
  background: color-mix(in srgb, var(--panel) 80%, var(--brand) 20%);
  border-radius: 12px;
  padding: 0.62rem 1rem;
  box-shadow: 0 6px 14px color-mix(in srgb, var(--brand) 15%, transparent);
}
.filter-bar__advanced summary::-webkit-details-marker { display: none; }
.filter-bar__advanced[open] summary { color: var(--text); }

/* Random: same rail geometry + surface as General notes / Advanced filters */
.filter-bar .random-btn {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--filter-rail-h, 2.75rem);
  padding: 0.62rem 1rem;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.25;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--brand) 40%, var(--border));
  background: color-mix(in srgb, var(--panel) 80%, var(--brand) 20%);
  box-shadow: 0 6px 14px color-mix(in srgb, var(--brand) 15%, transparent);
  color: var(--text);
}
.filter-bar .random-btn:hover {
  border-color: color-mix(in srgb, var(--brand) 52%, var(--border));
  background: color-mix(in srgb, var(--panel) 72%, var(--brand) 28%);
  box-shadow: 0 8px 20px color-mix(in srgb, var(--brand) 22%, transparent);
}
body.dark .filter-bar .random-btn {
  border-color: color-mix(in srgb, var(--brand) 48%, var(--border));
  background: color-mix(in srgb, var(--panel) 58%, var(--brand) 42%);
  box-shadow:
    0 6px 16px rgba(0, 0, 0, 0.4),
    0 0 0 1px color-mix(in srgb, var(--brand) 12%, transparent);
}
body.dark .filter-bar .random-btn:hover {
  border-color: color-mix(in srgb, var(--brand) 58%, var(--border));
  background: color-mix(in srgb, var(--panel) 50%, var(--brand) 50%);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.5);
}
.filter-bar__advanced-grid {
  position: absolute;
  right: 0;
  margin-top: var(--space-2);
  z-index: 35;
  display: grid;
  grid-template-columns: repeat(4, minmax(145px, 1fr));
  gap: var(--space-2);
  width: min(860px, 92vw);
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--panel);
  box-shadow: 0 20px 40px color-mix(in srgb, #0f172a 14%, transparent);
}
.filter-bar__advanced-grid select {
  appearance: none;
  -webkit-appearance: none;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--border) 70%, var(--text));
  background: color-mix(in srgb, var(--panel-soft) 82%, var(--panel));
  font-weight: 500;
  color: var(--text);
  padding: 0.62rem 2rem 0.62rem 0.85rem;
  background-image:
    linear-gradient(45deg, transparent 50%, color-mix(in srgb, var(--muted) 80%, var(--text)) 50%),
    linear-gradient(135deg, color-mix(in srgb, var(--muted) 80%, var(--text)) 50%, transparent 50%);
  background-position:
    calc(100% - 16px) calc(50% - 3px),
    calc(100% - 10px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}
.filter-bar__advanced-grid select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent);
}
.filter-bar select,
.filter-bar button,
.filter-bar input { min-height: 36px; }
.filter-bar select,
.filter-bar .timer-mobile-toggle {
  opacity: 0.88;
}
.filter-bar select:hover,
.filter-bar .timer-mobile-toggle:hover {
  opacity: 1;
}

.table-shell {
  margin: var(--space-6);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border-color: color-mix(in srgb, var(--border) 86%, transparent);
}
th {
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  background: color-mix(in srgb, var(--panel-soft) 88%, var(--panel));
  position: sticky;
  top: 0;
  z-index: 2;
}
td {
  padding: 0.78rem 1rem;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 72%, transparent);
}
tr:hover td {
  background: color-mix(in srgb, var(--brand) 6%, var(--panel));
  transform: translateY(-0.5px);
}
tr.selected td,
tr[aria-selected="true"] td {
  background: color-mix(in srgb, var(--brand) 12%, var(--panel));
}

.notes-sheet {
  box-shadow: var(--shadow-md);
  border-left: 1px solid color-mix(in srgb, var(--border) 88%, transparent);
}
.notes-container {
  max-width: 76ch;
  margin-inline: auto;
  width: 100%;
}
.notes-editor-host,
.notes-preview,
.notes-rich-prosemirror {
  line-height: 1.65;
  font-size: 0.95rem;
}
.notes-rich-toolbar,
.notes-rich-bubble {
  box-shadow: var(--shadow-sm);
  border-radius: var(--radius-md);
}
.notes-rich-toolbar {
  background: color-mix(in srgb, var(--panel-soft) 68%, var(--panel));
  border-color: color-mix(in srgb, var(--border) 76%, transparent);
}

.timer-dock.timer-dock--pip .timer-panel,
.pip-root,
.timer-pip-root {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}
.timer-dock.timer-dock--pip .timer-panel {
  padding: var(--space-3);
  gap: var(--space-2);
}
.timer-dock.timer-dock--pip .timer-time-input {
  font-size: 0.92rem;
}
.timer-dock.timer-dock--pip .timer-inline-actions {
  gap: var(--space-1);
}

button,
select,
input,
.theme-toggle,
.icon-btn,
.notes-rich-bubble__btn,
.general-notes-icon-btn,
.sync-signout-btn,
.logout-btn {
  transition: background-color var(--dur-fast) var(--ease-standard),
    color var(--dur-fast) var(--ease-standard),
    border-color var(--dur-fast) var(--ease-standard),
    box-shadow var(--dur-fast) var(--ease-standard),
    transform 120ms var(--ease-standard);
}
button:hover,
.theme-toggle:hover,
.icon-btn:hover,
.general-notes-icon-btn:hover { box-shadow: var(--shadow-xs); }
button:active,
.icon-btn:active,
.theme-toggle:active,
.general-notes-icon-btn:active {
  transform: scale(0.98);
}

:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--brand) 78%, white);
  outline-offset: 2px;
}

@media (max-width: 1200px) {
  .dashboard-shell { grid-template-columns: minmax(200px, 240px) minmax(0, 1fr); }
  .filter-bar { padding-inline: var(--space-4); }
  .table-shell { margin: var(--space-4); }
}

@media (max-width: 900px) {
  .dashboard-shell {
    display: grid;
    grid-template-columns: 1fr;
  }
  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .filter-bar {
    position: static;
    top: auto;
    z-index: auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    padding: 0.65rem max(0.85rem, env(safe-area-inset-right)) 0.65rem max(0.85rem, env(safe-area-inset-left));
  }
  .filter-bar > * {
    min-width: 0;
    max-width: 100%;
    width: 100%;
    margin: 0;
  }
  .filter-bar__primary {
    order: 1;
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
    min-width: 0;
    width: 100%;
  }
  .search-wrap {
    min-width: 0;
    max-width: 100%;
    width: 100%;
    flex: none;
    padding: 0.45rem 0.75rem;
    min-height: 2.5rem;
    box-sizing: border-box;
  }
  .random-btn,
  .filter-bar__advanced,
  .filter-bar__advanced summary,
  .filter-bar-split,
  .toolbar-sync {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  .filter-bar__advanced summary {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .workflow-hint {
    order: 2;
    margin-top: 0.35rem;
    font-size: 0.88rem;
    line-height: 1.35;
  }
  .filter-bar__advanced {
    order: 3;
  }
  .filter-bar-split {
    order: 4;
    justify-content: flex-start;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 0.55rem;
  }
  .filter-bar-split .timer-mobile-toggle {
    flex: 0 0 2.75rem;
  }
  .filter-bar-split .toolbar-sync {
    flex: 1 1 100%;
    align-items: stretch;
    align-self: stretch;
  }
  .filter-bar-split .toolbar-sync__main {
    justify-content: center;
    width: 100%;
    gap: 0.5rem;
  }
  .filter-bar__advanced-grid {
    position: static;
    width: 100%;
    grid-template-columns: 1fr;
    margin-top: 0.45rem;
    padding: 0.55rem;
    box-shadow: none;
  }
  .filter-bar__advanced-grid select { min-height: 42px; }
  .table-shell {
    margin: 0.75rem max(0.65rem, env(safe-area-inset-left)) 0.9rem max(0.65rem, env(safe-area-inset-right));
    border: 1px solid var(--border);
    border-radius: 12px;
  }
  .notes-sheet {
    width: min(100%, 440px);
    max-width: 100%;
  }

  .sidebar {
    padding: var(--space-4) var(--space-3);
  }
  .sidebar-card {
    margin-top: var(--space-4);
  }
  .sidebar > section.sidebar-card:first-of-type {
    margin-top: var(--space-3);
  }

  .toolbar-sync,
  .filter-bar-split .toolbar-sync {
    min-width: 0;
  }
  .toolbar-sync__main {
    flex-wrap: wrap;
    min-width: 0;
    max-width: 100%;
    gap: 0.5rem;
  }
  .google-signin-host--toolbar {
    min-width: 0;
    max-width: 100%;
    width: 100%;
    justify-content: center;
    height: 2.75rem;
    min-height: 2.75rem;
    max-height: 2.75rem;
  }
}

@media (max-width: 560px) {
  .seo-hero {
    padding: 0.65rem 0.7rem 0.9rem;
  }
  .seo-hero__nav {
    gap: 0.75rem;
    font-size: 0.78rem;
    flex-wrap: wrap;
  }
  .seo-hero__content h1 {
    font-size: clamp(1.55rem, 7vw, 2.05rem);
    line-height: 1.18;
  }
  .sidebar {
    padding: 1rem 0.75rem;
  }
}
