/* ============================================================================
   Email Sticky Notes for Outlook - Fluent 2 High-Readability Stylesheet (v2.2)
   ============================================================================ */

:root {
  --font-sans: "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
  --bg-app: #f3f5f8;
  --bg-surface: #ffffff;
  --bg-subtle: #eef2f6;
  --bg-hover: #e5ebf1;
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --border-color: #dbe2ea;
  --border-strong: #cbd5e1;
  --brand-primary: #0f6cbd;
  --brand-primary-hover: #115ea3;
  --brand-light: #e8f3fc;
  --accent-amber: #d97706;
  --accent-amber-bg: #fffbeb;
  --accent-amber-border: #fcd34d;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --danger-border: #fecaca;
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-sm: 0 2px 6px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 6px 16px rgba(15, 23, 42, 0.1);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --radius-pill: 999px;
}

[data-theme="dark"] {
  --bg-app: #111318;
  --bg-surface: #1b1f27;
  --bg-subtle: #252a35;
  --bg-hover: #303746;
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --border-color: #2e3543;
  --border-strong: #3e4759;
  --brand-primary: #38bdf8;
  --brand-primary-hover: #7dd3fc;
  --brand-light: rgba(56, 189, 248, 0.14);
  --accent-amber: #fbbf24;
  --accent-amber-bg: rgba(251, 191, 36, 0.12);
  --accent-amber-border: rgba(251, 191, 36, 0.35);
  --danger: #f87171;
  --danger-bg: rgba(248, 113, 113, 0.12);
  --danger-border: rgba(248, 113, 113, 0.35);
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.5);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  font-family: var(--font-sans);
  font-size: 13.5px;
  line-height: 1.45;
  background-color: var(--bg-app);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
}

button svg,
button span {
  pointer-events: none;
}

button {
  touch-action: manipulation;
  user-select: none;
}

.addin-shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* ============================================================================
   Header (3 Clean Rows: Brand + Utility Icons, Primary CTAs, Segmented Scope)
   ============================================================================ */
.app-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 12px 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
  box-shadow: var(--shadow-xs);
}

.header-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-icon-img {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  flex-shrink: 0;
  box-shadow: var(--shadow-xs);
}

.brand-title {
  margin: 0;
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  line-height: 1.2;
}

.storage-pill-row {
  display: flex;
  align-items: center;
  margin-top: 2px;
}

.status-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 1px 8px;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
}

.status-office {
  background: rgba(16, 185, 129, 0.14);
  color: #059669;
}

[data-theme="dark"] .status-office {
  color: #34d399;
}

.status-preview {
  background: var(--brand-light);
  color: var(--brand-primary);
}

/* Utility Icon Buttons (Refresh, Theme, Settings) */
.header-utility-btns {
  display: flex;
  align-items: center;
  gap: 5px;
}

.icon-btn,
.icon-toggle-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.14s ease;
  padding: 0;
}

.icon-btn:hover,
.icon-toggle-btn:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.icon-btn:active {
  filter: brightness(0.95);
}

/* Primary CTA Row: Spacious 2-Button Action Bar */
.header-cta-row {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 8px;
}

.btn-cta-new {
  height: 38px;
  border-radius: 8px;
  border: none;
  background: #0f6cbd;
  color: #ffffff;
  font-size: 13.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(15, 108, 189, 0.28);
  transition: background 0.15s ease;
  padding: 0 12px;
  white-space: nowrap;
}

.btn-cta-new:hover {
  background: #115ea3;
}

.btn-cta-new:active {
  background: #0c4f8c;
}

.btn-cta-quick {
  height: 38px;
  border-radius: 8px;
  border: 1px solid var(--accent-amber-border);
  background: var(--accent-amber-bg);
  color: var(--accent-amber);
  font-size: 13.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0 12px;
  white-space: nowrap;
}

.btn-cta-quick:hover {
  filter: brightness(0.97);
  border-color: var(--accent-amber);
}

.btn-cta-quick:active {
  filter: brightness(0.93);
}

/* Segmented Scope Pill Tabs */
.scope-segmented-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bg-subtle);
  padding: 3px;
  border-radius: 9px;
  border: 1px solid var(--border-color);
  gap: 4px;
}

.scope-tab {
  height: 32px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.scope-tab:hover {
  color: var(--text-primary);
}

.scope-tab.active {
  background: var(--bg-surface);
  color: var(--brand-primary);
  box-shadow: var(--shadow-xs);
}

.tab-badge {
  font-size: 11.5px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  background: var(--bg-hover);
  color: var(--text-secondary);
}

.scope-tab.active .tab-badge {
  background: var(--brand-light);
  color: var(--brand-primary);
}

/* ============================================================================
   Email Context Card & Banner Controls
   ============================================================================ */
.email-context-banner {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.demo-switcher-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding-bottom: 6px;
  border-bottom: 1px dashed var(--border-color);
  flex-wrap: wrap;
}

.demo-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
}

.demo-pills {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.demo-pill {
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.14s ease;
}

.demo-pill:hover {
  border-color: var(--brand-primary);
  color: var(--text-primary);
}

.demo-pill.active {
  background: #0f6cbd;
  border-color: #0f6cbd;
  color: #ffffff;
}

.email-meta-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  min-width: 0;
}

.email-meta-icon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--brand-light);
  color: var(--brand-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.email-meta-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.email-subject-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
}

.email-subject {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.email-sender {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.email-category-markers {
  display: inline-flex;
  gap: 4px;
  flex-shrink: 0;
}

.outlook-category-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 5px;
}

.cat-yellow {
  background: #fef08a;
  color: #713f12;
  border: 1px solid #facc15;
}

.cat-red {
  background: #fecaca;
  color: #7f1d1d;
  border: 1px solid #f87171;
}

/* Clean Pill Banner Controls */
.banner-control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 6px 10px;
  flex-wrap: wrap;
}

.banner-status-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.banner-actions-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.banner-pill-btn {
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.14s ease;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.banner-pill-btn svg {
  width: 12px;
  height: 12px;
}

.banner-pill-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.banner-pill-btn.danger {
  background: var(--danger-bg);
  border-color: var(--danger-border);
  color: var(--danger);
}

.banner-pill-btn.danger:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: #ffffff;
}

.banner-pill-btn.primary {
  background: var(--brand-light);
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}

.banner-pill-btn.primary:hover {
  background: #0f6cbd;
  border-color: #0f6cbd;
  color: #ffffff;
}

/* ============================================================================
   Search & Collapsible Filter Drawer
   ============================================================================ */
.search-filter-container {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 9px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.search-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-input-wrapper {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 10px;
  color: var(--text-muted);
  display: inline-flex;
  pointer-events: none;
}

.search-input {
  width: 100%;
  height: 34px;
  padding: 0 30px 0 32px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  color: var(--text-primary);
  font-size: 13px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--brand-primary);
  background: var(--bg-surface);
}

.clear-search-btn {
  position: absolute;
  right: 6px;
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.clear-search-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.filter-drawer-toggle {
  height: 34px;
  padding: 0 11px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.14s ease;
}

.filter-drawer-toggle:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

.filter-drawer-toggle.active {
  background: var(--brand-light);
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}

.filter-drawer-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--border-color);
}

.filter-controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.color-filter-dots {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.color-dot-all {
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  cursor: pointer;
}

.color-dot-all.selected {
  background: var(--text-primary);
  color: var(--bg-surface);
  border-color: var(--text-primary);
}

.color-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.15);
  cursor: pointer;
  padding: 0;
  transition: transform 0.12s ease;
}

.color-dot:hover {
  transform: scale(1.12);
}

.color-dot.selected {
  outline: 2px solid var(--brand-primary);
  outline-offset: 2px;
}

.filter-select-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.pin-filter-btn {
  height: 28px;
  padding: 0 9px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.pin-filter-btn.active {
  background: var(--brand-light);
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}

.compact-select {
  height: 28px;
  padding: 0 8px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

.tag-filter-strip {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.tag-chip-filter {
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  cursor: pointer;
}

.tag-chip-filter.active {
  background: #0f6cbd;
  border-color: #0f6cbd;
  color: #ffffff;
}

.reset-filters-link {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--danger);
  background: transparent;
  border: none;
  cursor: pointer;
  margin-left: auto;
  text-decoration: underline;
}

/* ============================================================================
   Main Scroll Area & Sticky Note Cards
   ============================================================================ */
.notes-scroll-area {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sticky-notes-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

@media (min-width: 680px) {
  .addin-shell {
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
  }
  .sticky-notes-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
    align-items: start;
  }
}

.sticky-note-card {
  border: 1.5px solid;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow 0.15s ease, transform 0.12s ease;
}

.sticky-note-card:hover {
  box-shadow: var(--shadow-md);
}

.sticky-note-top-strip {
  padding: 7px 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.07);
}

.sticky-badges-left {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pinned-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  background: rgba(0, 0, 0, 0.1);
}

.priority-badge {
  font-size: 11px;
  font-weight: 700;
  color: #ffffff;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.01em;
}

.sticky-card-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.card-action-pill {
  height: 26px;
  padding: 0 8px;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  background: rgba(255, 255, 255, 0.72);
  color: #1e293b;
  font-size: 11.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.12s ease;
}

[data-theme="dark"] .card-action-pill {
  background: rgba(15, 23, 42, 0.55);
  border-color: rgba(255, 255, 255, 0.16);
  color: #f1f5f9;
}

.card-action-pill:hover {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.28);
}

[data-theme="dark"] .card-action-pill:hover {
  background: rgba(15, 23, 42, 0.85);
}

.card-action-pill.active {
  background: #0f6cbd;
  border-color: #0f6cbd;
  color: #ffffff;
}

.card-action-pill.delete-btn:hover {
  background: #dc2626;
  border-color: #dc2626;
  color: #ffffff;
}

.sticky-note-body {
  padding: 12px 13px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.cross-email-ref {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.06);
}

.cross-email-subject {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sticky-note-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
}

.sticky-note-content {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Checklist Box */
.sticky-checklist-box {
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: rgba(255, 255, 255, 0.52);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  padding: 8px 10px;
}

[data-theme="dark"] .sticky-checklist-box {
  background: rgba(0, 0, 0, 0.22);
  border-color: rgba(255, 255, 255, 0.1);
}

.sticky-checklist-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
  line-height: 1.35;
}

.sticky-checklist-row input[type="checkbox"] {
  width: 15px;
  height: 15px;
  margin-top: 2px;
  accent-color: #0f6cbd;
  cursor: pointer;
}

.sticky-checklist-row.completed span {
  text-decoration: line-through;
  opacity: 0.65;
}

/* Tags Row */
.sticky-tags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.sticky-tag-chip {
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(0, 0, 0, 0.14);
  background: rgba(255, 255, 255, 0.55);
  color: inherit;
  cursor: pointer;
}

[data-theme="dark"] .sticky-tag-chip {
  background: rgba(0, 0, 0, 0.28);
  border-color: rgba(255, 255, 255, 0.16);
}

.sticky-tag-chip:hover {
  background: rgba(255, 255, 255, 0.9);
}

.sticky-note-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  opacity: 0.8;
  padding-top: 6px;
  border-top: 1px dashed rgba(0, 0, 0, 0.12);
}

.timestamp-meta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.author-meta {
  font-weight: 600;
}

/* ============================================================================
   Note Editor Card
   ============================================================================ */
.note-editor-card {
  background: var(--bg-surface);
  border: 2px solid var(--brand-primary);
  border-radius: var(--radius-lg);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  box-shadow: var(--shadow-md);
}

.editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.editor-heading {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text-primary);
}

.editor-header-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pill-action-btn {
  height: 30px;
  padding: 0 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}

.pill-action-btn.active {
  background: var(--brand-light);
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}

.editor-title-input {
  width: 100%;
  height: 36px;
  padding: 0 11px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
}

.editor-body-textarea {
  width: 100%;
  padding: 9px 11px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  color: var(--text-primary);
  font-size: 13.5px;
  line-height: 1.45;
  resize: vertical;
}

.editor-title-input:focus,
.editor-body-textarea:focus,
.compact-text-input:focus {
  outline: none;
  border-color: var(--brand-primary);
  background: var(--bg-surface);
}

.editor-options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
  align-items: start;
}

.editor-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.editor-field label,
.editor-section-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.editor-color-swatches {
  display: flex;
  gap: 7px;
}

.swatch-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.15);
  cursor: pointer;
  padding: 0;
}

.swatch-btn.selected {
  outline: 2.5px solid var(--brand-primary);
  outline-offset: 2px;
}

.editor-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.editor-checklist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.editor-checklist-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  padding: 4px 8px;
  background: var(--bg-subtle);
  border-radius: 6px;
}

.editor-checklist-item span {
  flex: 1;
}

.remove-chk-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
  display: inline-flex;
}

.remove-chk-btn:hover {
  color: var(--danger);
}

.inline-add-row {
  display: flex;
  gap: 6px;
  min-width: 0;
}

.compact-text-input {
  flex: 1;
  min-width: 0;
  height: 32px;
  padding: 0 10px;
  border-radius: 7px;
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  color: var(--text-primary);
  font-size: 12.5px;
}

.preset-tags-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.tag-pill-selectable {
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  cursor: pointer;
}

.tag-pill-selectable.selected {
  background: #0f6cbd;
  border-color: #0f6cbd;
  color: #ffffff;
}

.editor-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-color);
}

/* ============================================================================
   Buttons, Empty States, Toast, & Settings Modal
   ============================================================================ */
.btn-primary {
  height: 36px;
  padding: 0 16px;
  border-radius: 8px;
  border: none;
  background: #0f6cbd;
  color: #ffffff;
  font-size: 13.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
}

.btn-primary:hover {
  background: #115ea3;
}

.btn-secondary-sm {
  height: 32px;
  padding: 0 11px;
  border-radius: 7px;
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 12.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  white-space: nowrap;
}

.btn-secondary-sm:hover {
  background: var(--bg-subtle);
}

.btn-ghost {
  height: 36px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.btn-ghost:hover {
  background: var(--bg-subtle);
}

.empty-state-box {
  background: var(--bg-surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 28px 18px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.empty-state-box h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.empty-state-box p {
  margin: 0 0 6px;
  font-size: 13px;
  color: var(--text-muted);
  max-width: 280px;
}

.toast-bar {
  position: fixed;
  bottom: 14px;
  left: 14px;
  right: 14px;
  background: #0f172a;
  color: #ffffff;
  padding: 10px 14px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-md);
  z-index: 100;
}

.undo-toast-btn {
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.12);
  color: #38bdf8;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 200;
}

.settings-modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.modal-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h2 {
  margin: 0;
  font-size: 15.5px;
  font-weight: 700;
}

.modal-body {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.settings-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.settings-group-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.radio-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  cursor: pointer;
}

.radio-card.selected {
  border-color: var(--brand-primary);
  background: var(--brand-light);
}

.radio-card p {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--text-secondary);
}

.backup-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.settings-hint {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-color);
}

/* ============================================================================
   Thread Scope Badge, Reminder Pill, Quick Templates, & React Class Aliases
   ============================================================================ */
.scope-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  background: rgba(0, 0, 0, 0.1);
}

.sticky-reminder-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(0, 0, 0, 0.14);
}

[data-theme="dark"] .sticky-reminder-pill {
  background: rgba(0, 0, 0, 0.3);
  border-color: rgba(255, 255, 255, 0.16);
}

.quick-templates-section {
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px dashed var(--border-color);
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.quick-templates-title {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.quick-template-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.template-chip {
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  background: var(--bg-subtle);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.14s ease;
}

.template-chip:hover {
  background: var(--brand-light);
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}

/* React source component class aliases */
.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-primary-compact {
  height: 34px;
  padding: 0 11px;
  border-radius: 8px;
  border: none;
  background: #0f6cbd;
  color: #ffffff;
  font-size: 12.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}

.btn-primary-compact:hover {
  background: #115ea3;
}

.scope-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bg-subtle);
  padding: 3px;
  border-radius: 9px;
  border: 1px solid var(--border-color);
  gap: 4px;
}

.link-btn {
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
}

.link-btn.danger-link {
  background: var(--danger-bg);
  border-color: var(--danger-border);
  color: var(--danger);
}

.card-icon-btn {
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  background: rgba(255, 255, 255, 0.72);
  color: #1e293b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

[data-theme="dark"] .card-icon-btn {
  background: rgba(15, 23, 42, 0.55);
  border-color: rgba(255, 255, 255, 0.16);
  color: #f1f5f9;
}

.card-icon-btn.pinned {
  background: #0f6cbd;
  border-color: #0f6cbd;
  color: #ffffff;
}

.card-icon-btn.delete-btn:hover {
  background: #dc2626;
  border-color: #dc2626;
  color: #ffffff;
}

.radio-cards {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.settings-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.settings-field label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

.settings-row-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.auth-test-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.auth-status-banner {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--brand-light);
  color: var(--brand-primary);
  font-size: 12px;
  font-weight: 600;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.spin-anim {
  animation: spin 0.9s linear infinite;
}
