/* TabFlow Design System - Modern Minimalist (Raycast & Linear Inspired) */

:root {
  --bg-sidebar-left: #F8F9FA;
  --bg-canvas: #F1F3F5;
  --bg-sidebar-right: #F8F9FA;
  --bg-card: #FFFFFF;
  --bg-card-hover: #FFFFFF;
  --bg-nav-active: #E9ECEF;
  --bg-nav-hover: #F1F3F5;

  --border-subtle: rgba(0, 0, 0, 0.08);
  --border-card: rgba(0, 0, 0, 0.06);

  --text-primary: #1E293B;
  --text-secondary: #475569;
  --text-muted: #94A3B8;

  /* Primary Accent Defaults (Electric Indigo) */
  --color-primary: #6366F1;
  --color-primary-hover: #4F46E5;
  --color-primary-light: #EEF2FF;
  --color-primary-glow: rgba(99, 102, 241, 0.25);
  --toby-blue: var(--color-primary);
  --toby-blue-hover: var(--color-primary-hover);
  --toby-blue-light: var(--color-primary-light);

  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.02);
  --shadow-card-hover: 0 8px 18px -2px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --shadow-dialog: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

  --radius-xs: 5px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  --font-family: 'Plus Jakarta Sans', 'Noto Sans Thai', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  --sidebar-left-width: 220px;
  --sidebar-right-width: 250px;
}

/* Complete Dark Theme Engine */
:root[data-theme="dark"] {
  --bg-sidebar-left: #0B0F17;
  --bg-canvas: #07090E;
  --bg-sidebar-right: #0B0F17;
  --bg-card: #131B2B;
  --bg-card-hover: #1A2438;
  --bg-nav-active: #1A2438;
  --bg-nav-hover: rgba(255, 255, 255, 0.05);

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-card: rgba(255, 255, 255, 0.07);

  --text-primary: #F8FAFC;
  --text-secondary: #CBD5E1;
  --text-muted: #94A3B8;

  --color-primary-light: rgba(99, 102, 241, 0.18);
  --shadow-card: 0 2px 5px rgba(0, 0, 0, 0.4);
  --shadow-card-hover: 0 10px 24px rgba(0, 0, 0, 0.5);
}

/* 6 Palette Themes (Customizable Accent Color) */
:root[data-accent="indigo"] {
  --color-primary: #6366F1;
  --color-primary-hover: #4F46E5;
  --color-primary-light: #EEF2FF;
  --color-primary-glow: rgba(99, 102, 241, 0.25);
}
:root[data-theme="dark"][data-accent="indigo"] {
  --color-primary-light: rgba(99, 102, 241, 0.2);
}

:root[data-accent="emerald"] {
  --color-primary: #10B981;
  --color-primary-hover: #059669;
  --color-primary-light: #ECFDF5;
  --color-primary-glow: rgba(16, 185, 129, 0.25);
}
:root[data-theme="dark"][data-accent="emerald"] {
  --color-primary-light: rgba(16, 185, 129, 0.2);
}

:root[data-accent="rose"] {
  --color-primary: #F43F5E;
  --color-primary-hover: #E11D48;
  --color-primary-light: #FFF1F2;
  --color-primary-glow: rgba(244, 63, 94, 0.25);
}
:root[data-theme="dark"][data-accent="rose"] {
  --color-primary-light: rgba(244, 63, 94, 0.2);
}

:root[data-accent="amber"] {
  --color-primary: #F59E0B;
  --color-primary-hover: #D97706;
  --color-primary-light: #FFFBEB;
  --color-primary-glow: rgba(245, 158, 11, 0.25);
}
:root[data-theme="dark"][data-accent="amber"] {
  --color-primary-light: rgba(245, 158, 11, 0.2);
}

:root[data-accent="sky"] {
  --color-primary: #0EA5E9;
  --color-primary-hover: #0284C7;
  --color-primary-light: #F0F9FF;
  --color-primary-glow: rgba(14, 165, 233, 0.25);
}
:root[data-theme="dark"][data-accent="sky"] {
  --color-primary-light: rgba(14, 165, 233, 0.2);
}

:root[data-accent="purple"] {
  --color-primary: #8B5CF6;
  --color-primary-hover: #7C3AED;
  --color-primary-light: #F5F3FF;
  --color-primary-glow: rgba(139, 92, 246, 0.25);
}
:root[data-theme="dark"][data-accent="purple"] {
  --color-primary-light: rgba(139, 92, 246, 0.2);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  line-height: 1.4;
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* App 3-Pane Layout */
.toby-app-layout {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* ========================================================
   PANE 1: LEFT SIDEBAR
   ======================================================== */
.sidebar-left {
  width: var(--sidebar-left-width);
  background: var(--bg-sidebar-left);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  padding: 14px 12px;
  flex-shrink: 0;
  height: 100vh;
  box-sizing: border-box;
  overflow-y: auto;
}

/* App Brand Header (System Name: TabFlow) */
.sidebar-brand-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 4px 14px 4px;
}

.brand-logo-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-text-col {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.brand-subtitle {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

/* Search Box */
.sidebar-search {
  margin-bottom: 12px;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

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

.search-box input {
  width: 100%;
  height: 34px;
  padding: 0 28px 0 32px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 0.8rem;
  outline: none;
  font-family: inherit;
  transition: all 0.15s ease;
  box-sizing: border-box;
}

.search-box input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px var(--color-primary-glow);
}

.search-key {
  position: absolute;
  right: 8px;
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 600;
  background: rgba(0, 0, 0, 0.05);
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1;
}

[data-theme="dark"] .search-key {
  background: rgba(255, 255, 255, 0.08);
}

/* Quick Nav (Next, To/Links) */
.nav-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 32px;
  padding: 0 10px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
  user-select: none;
}

.nav-item:hover {
  background: var(--bg-nav-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--bg-nav-active);
  color: var(--text-primary);
  font-weight: 600;
}

/* Spaces Section */
.sidebar-spaces-section {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 100px;
}

.spaces-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px 6px 6px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.btn-more-dots {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 0 4px;
  border-radius: 4px;
}

.btn-more-dots:hover {
  color: var(--text-primary);
  background: var(--bg-nav-hover);
}

.spaces-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin: 0;
  padding: 0;
}

.space-item {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 6px 0 10px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
  user-select: none;
  position: relative;
}

.space-item:hover {
  background: var(--bg-nav-hover);
  color: var(--text-primary);
}

.space-item.active {
  background: var(--bg-nav-active);
  color: var(--text-primary);
  font-weight: 600;
}

.space-item-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.space-item-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.space-item-more {
  display: none;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: all 0.12s ease;
}

.space-item:hover .space-item-more,
.space-item.active .space-item-more {
  display: inline-flex;
}

.space-item-more:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-create-space {
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 500;
  height: 30px;
  padding: 0 10px;
  cursor: pointer;
  border-radius: 6px;
  margin-top: 4px;
  transition: background 0.12s ease, color 0.12s ease;
}

.btn-create-space:hover {
  background: var(--bg-nav-hover);
  color: var(--text-primary);
}

/* Sidebar Footer */
.sidebar-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 10px;
}

/* Tab Limit Card */
.tab-limit-card {
  background: #FFFFFF;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.75rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.tab-limit-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.btn-limit-close {
  background: transparent;
  border: none;
  font-size: 10px;
  color: var(--text-muted);
  cursor: pointer;
}

.tab-limit-number {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
}

.limit-progress-bar {
  height: 4px;
  background: #E5E7EB;
  border-radius: 9999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #F43F5E 0%, #A855F7 50%, #3B82F6 100%);
  border-radius: 9999px;
  transition: width 0.3s;
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.footer-link-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 30px;
  padding: 0 10px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.12s ease;
}

.footer-link-item:hover {
  background: var(--bg-nav-hover);
  color: var(--text-primary);
}

.user-profile-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  cursor: pointer;
  border-radius: 8px;
  border-top: 1px solid var(--border-subtle);
  margin-top: 6px;
  transition: background 0.12s ease;
}

.user-profile-row:hover {
  background: var(--bg-nav-hover);
}

.user-profile-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.user-profile-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ========================================================
   PANE 2: CENTER MAIN WORKSPACE
   ======================================================== */
.main-canvas {
  flex: 1;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg-canvas);
  padding: 1.25rem 2rem 1.5rem;
  display: flex;
  flex-direction: column;
}

/* Canvas Header */
.canvas-header {
  margin-bottom: 1.5rem;
  flex-shrink: 0;
}

.canvas-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.space-title-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.space-badge-circle {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.space-heading {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.015em;
}

.header-divider {
  color: rgba(0, 0, 0, 0.2);
  margin: 0 0.25rem;
  font-weight: 300;
  font-size: 0.85rem;
}

.space-stat-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.canvas-top-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.space-visibility-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-weight: 500;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
}

.avatar-stack {
  display: flex;
  align-items: center;
  margin-right: 0.25rem;
}

.avatar-pill-single {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  color: #FFFFFF;
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid #FFFFFF;
}

.avatar-blue {
  background: #2563EB;
}

.avatar-indigo {
  background: #312E81;
  margin-left: -6px;
}

.toolbar-sep {
  color: rgba(0, 0, 0, 0.15);
  margin: 0 0.4rem;
  font-size: 0.75rem;
}

.btn-more-icon {
  background: transparent;
  border: none;
  font-size: 16px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 0.3rem;
}

/* + New Collection Button */
.btn-toby-blue {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--color-primary);
  color: #FFFFFF;
  border: none;
  padding: 6px 14px;
  border-radius: 7px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 2px 6px var(--color-primary-glow);
}

.btn-toby-blue:hover {
  background: var(--color-primary-hover);
  box-shadow: 0 4px 12px var(--color-primary-glow);
  transform: translateY(-1px);
}

.btn-toby-blue:active {
  transform: translateY(0);
}

/* Toolbar */
.canvas-header-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.65rem;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.toolbar-dropdown-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: transparent;
  border: none;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.25rem 0.45rem;
  border-radius: var(--radius-xs);
  transition: background 0.1s;
}

.toolbar-dropdown-btn:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-primary);
}

/* View Segmented Control */
.view-segmented-control {
  display: inline-flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 6px;
  padding: 2px;
  gap: 2px;
  margin-left: 0.25rem;
}

.seg-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: none;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 3px 8px;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.12s ease;
}

.seg-btn:hover {
  color: var(--text-primary);
}

.seg-btn.active {
  background: #FFFFFF;
  color: var(--toby-blue);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Fast Universal Input Bar */
.quick-action-bar {
  margin-top: 0.85rem;
  margin-bottom: 0.65rem;
}

.quick-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  background: #FFFFFF;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
  transition: all 0.15s ease;
}

.quick-input-wrap:focus-within {
  border-color: var(--toby-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.quick-icon {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
}

.quick-input-wrap input {
  width: 100%;
  padding: 0.55rem 78px 0.55rem 36px;
  border: none;
  background: transparent;
  font-size: 0.8rem;
  font-family: inherit;
  color: var(--text-primary);
  outline: none;
}

.btn-quick-action {
  position: absolute;
  right: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #EFF6FF;
  color: var(--toby-blue);
  border: 1px solid rgba(37, 99, 235, 0.2);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s;
}

.btn-quick-action:hover {
  background: #DBEAFE;
}

/* 1-Click Category Filter Chips */
.category-filter-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 1.25rem;
  overflow-x: auto;
  padding-bottom: 2px;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-card, #FFFFFF);
  border: 1px solid var(--border-subtle, rgba(0, 0, 0, 0.08));
  border-radius: 9999px;
  padding: 4px 10px;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.12s ease;
  white-space: nowrap;
  user-select: none;
}

.filter-chip:hover {
  background: var(--bg-card-hover, #F3F4F6);
  color: var(--text-primary);
  border-color: rgba(0, 0, 0, 0.15);
}

.filter-chip.active {
  background: var(--color-primary, #1F2937);
  color: #FFFFFF;
  border-color: var(--color-primary, #1F2937);
  font-weight: 600;
}

.chip-count {
  font-size: 0.65rem;
  background: rgba(0, 0, 0, 0.08);
  padding: 1px 6px;
  border-radius: 10px;
}

.filter-chip.active .chip-count {
  background: rgba(255, 255, 255, 0.25);
  color: #FFFFFF;
}

.zoom-controls {
  display: inline-flex;
  align-items: center;
  margin-left: 0.5rem;
  gap: 0.2rem;
}

.btn-zoom {
  width: 22px;
  height: 22px;
  background: transparent;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 4px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-zoom:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-primary);
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-toby-light {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 7px;
  padding: 6px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: all 0.15s ease;
}

.btn-toby-light svg {
  flex-shrink: 0;
  stroke: var(--text-secondary);
  transition: stroke 0.15s ease;
}

.btn-toby-light:hover {
  background: var(--color-primary-light);
  color: var(--color-primary);
  border-color: var(--color-primary);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.btn-toby-light:hover svg {
  stroke: var(--color-primary);
}

.btn-toby-light:active {
  transform: translateY(0);
}

.lang-badge-tag {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.12);
  color: var(--color-primary);
}
[data-theme="dark"] .lang-badge-tag {
  background: rgba(16, 185, 129, 0.22);
  color: #34D399;
}

.btn-link-action {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: transparent;
  border: none;
  font-size: 0.78rem;
  color: var(--text-secondary);
  cursor: pointer;
}

.btn-link-action:hover {
  color: var(--toby-blue);
}

/* ========================================================
   COLLECTIONS SECTIONS & CARD GRID
   ======================================================== */
.collections-sections-container {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.collection-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Section Header (e.g. AI - 38 tabs) */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
  margin-bottom: 0.15rem;
}

.section-header-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  cursor: pointer;
}

.section-checkbox {
  width: 14px;
  height: 14px;
  border: 1.5px solid #CBD5E1;
  border-radius: 4px;
  cursor: pointer;
  accent-color: var(--color-primary);
}

.section-title-col {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.section-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.section-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  transition: all 0.15s ease;
  border-radius: 4px;
}

.section-title:hover, .card-title-text:hover {
  color: var(--color-primary);
}

.editing-title {
  outline: 2px solid #3B82F6 !important;
  outline-offset: 2px !important;
  background-color: #FFFFFF !important;
  color: #0F172A !important;
  border-radius: 4px !important;
  padding: 1px 6px !important;
  cursor: text !important;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15) !important;
}

.section-chevron {
  color: var(--text-muted);
  transition: transform 0.2s;
}

.section-collapsed .section-chevron {
  transform: rotate(-90deg);
}

.section-tabs-count {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
}

.section-header-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.btn-sec-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.btn-sec-action:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--text-primary);
}

.btn-sec-action.btn-bookmark-col.active {
  color: #F59E0B;
}

.btn-sec-action.btn-bookmark-col.active svg {
  fill: #F59E0B;
  stroke: #F59E0B;
}

[data-theme="dark"] .btn-sec-action:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.collection-section {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  position: relative;
}

.collection-section.col-dragging {
  opacity: 0.35;
  transform: scale(0.99);
}

.collection-section.drag-over-top {
  box-shadow: 0 -3px 0 0 var(--color-primary) !important;
}

.collection-section.drag-over-bottom {
  box-shadow: 0 3px 0 0 var(--color-primary) !important;
}

.collection-section.col-drop-active {
  background: rgba(37, 99, 235, 0.03);
  border-radius: 14px;
  outline: 2px dashed rgba(37, 99, 235, 0.4);
  outline-offset: 2px;
}

.cards-grid.drag-target-active {
  background: rgba(37, 99, 235, 0.04);
  border-radius: 12px;
  outline: 2px dashed rgba(37, 99, 235, 0.45);
  outline-offset: 4px;
}

.empty-collection-dropzone.drop-active {
  border-color: var(--color-primary) !important;
  background: rgba(37, 99, 235, 0.08) !important;
  color: var(--color-primary) !important;
  transform: scale(1.01);
}

.toby-card.drag-insert-left {
  box-shadow: -4px 0 0 0 var(--color-primary) !important;
  transform: translateX(3px);
}

.toby-card.drag-insert-right {
  box-shadow: 4px 0 0 0 var(--color-primary) !important;
  transform: translateX(-3px);
}

/* TOBY MODERN RESPONSIVE CARD GRID */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
  transition: opacity 0.2s ease;
}

@media (max-width: 1200px) {
  .cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
  }
}

.section-collapsed .cards-grid {
  display: none;
}

/* TOBY INDIVIDUAL TAB CARD (MODERN SPACIOUS DESIGN) */
.toby-card {
  background: var(--bg-card, #FFFFFF);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  padding: 12px 14px 10px 14px;
  min-height: 94px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
  user-select: none;
}

.toby-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px -3px rgba(0, 0, 0, 0.09), 0 3px 6px -2px rgba(0, 0, 0, 0.04);
  border-color: rgba(37, 99, 235, 0.3);
}

.toby-card.is-favorite {
  border-color: rgba(245, 158, 11, 0.35);
  box-shadow: 0 1px 3px rgba(245, 158, 11, 0.08);
}

.toby-card.dragging {
  opacity: 0.35;
  border: 1.5px dashed var(--color-primary);
  transform: scale(0.98);
}

/* Card Top Row: Favicon + Domain Label + Favorite Star */
.card-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 6px;
}

.card-domain-info {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  flex: 1;
}

.card-favicon-box {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.03);
  border-radius: 5px;
  padding: 2px;
}

.card-favicon {
  width: 15px;
  height: 15px;
  object-fit: contain;
  border-radius: 3px;
}

.card-domain-name {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted, #6B7280);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Favorite Star Button */
.btn-card-favorite {
  width: 25px;
  height: 25px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: #9CA3AF;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
  margin-left: 4px;
  padding: 0;
}

.btn-card-favorite:hover {
  background: rgba(245, 158, 11, 0.12);
  color: #F59E0B;
  transform: scale(1.12);
}

.btn-card-favorite.active {
  color: #F59E0B;
}

.btn-card-favorite.active svg {
  fill: #F59E0B;
  stroke: #F59E0B;
}

/* Card Title Row */
.card-title-row {
  flex: 1;
  min-width: 0;
  margin-bottom: 8px;
}

.card-title-text {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-primary, #1F2937);
  line-height: 1.38;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
  transition: color 0.15s ease;
}

.toby-card:hover .card-title-text {
  color: var(--color-primary, #2563EB);
}

/* Card Bottom Action Bar (Clear, Comfortable, No Text Occlusion!) */
.card-bottom-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  border-top: 1px solid rgba(0, 0, 0, 0.04);
  padding-top: 6px;
  margin-top: auto;
}

.card-actions-group {
  display: flex;
  align-items: center;
  gap: 4px;
  opacity: 0.75;
  transition: opacity 0.15s ease;
}

.toby-card:hover .card-actions-group {
  opacity: 1;
}

.card-action-btn {
  background: transparent;
  border: none;
  color: var(--text-muted, #6B7280);
  cursor: pointer;
  width: 25px;
  height: 25px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  transition: all 0.15s ease;
  padding: 0;
}

.card-action-btn:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--text-primary, #111827);
  transform: scale(1.08);
}

.card-action-btn.btn-open-card:hover {
  background: rgba(37, 99, 235, 0.1);
  color: var(--color-primary, #2563EB);
}

.card-action-btn.btn-copy-card:hover {
  background: rgba(16, 185, 129, 0.1);
  color: #10B981;
}

.card-action-btn.btn-edit-card:hover {
  background: rgba(245, 158, 11, 0.1);
  color: #D97706;
}

.card-action-btn.btn-del-card:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #EF4444;
}

/* Add Tab Placeholder Card */
.card-add-placeholder {
  border: 1.5px dashed rgba(0, 0, 0, 0.12);
  border-radius: 12px;
  min-height: 94px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--text-muted, #9CA3AF);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  background: rgba(0, 0, 0, 0.01);
}

.card-add-placeholder:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-primary-light, rgba(37, 99, 235, 0.04));
  transform: translateY(-1.5px);
}

.card-add-placeholder .plus-icon {
  font-size: 1.15rem;
  line-height: 1;
}

.card-domain-badge {
  display: none;
  font-size: 0.65rem;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.04);
  padding: 1px 6px;
  border-radius: 4px;
  margin-top: 2px;
  width: fit-content;
}

/* ========================================================
   CUSTOM DISPLAY FORMATS (ปรับรูปแบบการแสดงผล)
   ======================================================== */

/* FORMAT 2: COMPACT VIEW (DENSE BALANCED CARDS - ZERO OVERFLOW / ZERO CLIPPING) */
.cards-grid.view-compact {
  grid-template-columns: repeat(auto-fill, minmax(185px, 1fr)) !important;
  gap: 10px;
}

.cards-grid.view-compact .toby-card {
  min-height: 106px;
  height: auto;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 10px 12px 8px 12px;
  border-radius: 10px;
}

.cards-grid.view-compact .card-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 4px;
}

.cards-grid.view-compact .card-domain-info {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  flex: 1;
}

.cards-grid.view-compact .card-domain-name {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cards-grid.view-compact .card-favicon-box {
  width: 18px;
  height: 18px;
  padding: 1px;
}

.cards-grid.view-compact .card-favicon {
  width: 13px;
  height: 13px;
}

.cards-grid.view-compact .btn-card-favorite {
  width: 22px;
  height: 22px;
  margin-left: 2px;
}

.cards-grid.view-compact .btn-card-favorite svg {
  width: 12px;
  height: 12px;
}

.cards-grid.view-compact .card-title-row {
  flex: 1;
  min-width: 0;
  margin-bottom: 6px;
}

.cards-grid.view-compact .card-title-text {
  font-size: 0.78rem;
  line-height: 1.34;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
}

.cards-grid.view-compact .card-bottom-bar {
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  padding-top: 5px;
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

[data-theme="dark"] .cards-grid.view-compact .card-bottom-bar {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.cards-grid.view-compact .card-actions-group {
  display: flex;
  align-items: center;
  gap: 3px;
  opacity: 0.75;
}

.cards-grid.view-compact .toby-card:hover .card-actions-group {
  opacity: 1;
}

.cards-grid.view-compact .card-action-btn {
  width: 22px;
  height: 22px;
}

.cards-grid.view-compact .card-action-btn svg {
  width: 12px;
  height: 12px;
}

.cards-grid.view-compact .card-add-placeholder {
  min-height: 106px;
  height: auto;
  border-radius: 10px;
  font-size: 0.72rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

/* FORMAT 3: DETAILED LIST VIEW (ROWS / TABLE) */
.cards-grid.view-list {
  display: flex !important;
  flex-direction: column;
  gap: 6px;
}

.cards-grid.view-list .toby-card {
  min-height: 44px;
  height: 44px;
  width: 100%;
  display: flex;
  flex-direction: row;
  align-items: center;
  padding: 6px 14px;
  border-radius: 8px;
  gap: 12px;
}

.cards-grid.view-list .card-top-row {
  width: auto;
  margin-bottom: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.cards-grid.view-list .card-domain-info {
  width: 140px;
  max-width: 140px;
  flex-shrink: 0;
}

.cards-grid.view-list .card-title-row {
  flex: 1;
  margin-bottom: 0;
}

.cards-grid.view-list .card-title-text {
  font-size: 0.82rem;
  -webkit-line-clamp: 1;
  max-width: 520px;
}

.cards-grid.view-list .card-bottom-bar {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
  flex-shrink: 0;
}

.cards-grid.view-list .card-add-placeholder {
  min-height: 40px;
  height: 40px;
  border-radius: 8px;
  flex-direction: row;
  gap: 8px;
}

/* FORMAT 4: KANBAN COLUMNS (MULTI-COLUMN BOARDS) */
.collections-sections-container.view-columns {
  display: flex !important;
  flex-direction: row;
  gap: 16px;
  overflow-x: auto;
  align-items: flex-start;
  padding-bottom: 1.5rem;
}

.collections-sections-container.view-columns .collection-section {
  width: 290px;
  min-width: 290px;
  flex-shrink: 0;
  background: var(--bg-card, #F8F9FA);
  border: 1px solid var(--border-subtle, rgba(0, 0, 0, 0.06));
  border-radius: 12px;
  padding: 12px;
  max-height: calc(100vh - 220px);
  overflow-y: auto;
}

.collections-sections-container.view-columns .cards-grid {
  display: flex !important;
  flex-direction: column;
  gap: 8px;
}

.collections-sections-container.view-columns .toby-card {
  width: 100%;
}

/* ZOOM LEVELS */
.cards-grid.zoom-1 {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)) !important;
  gap: 16px;
}

.cards-grid.zoom-1 .toby-card {
  min-height: 108px;
  padding: 14px 16px 12px 16px;
}

.cards-grid.zoom-1 .card-title-text {
  font-size: 0.90rem;
}

.cards-grid.zoom--1 {
  grid-template-columns: repeat(auto-fill, minmax(185px, 1fr)) !important;
  gap: 10px;
}

.cards-grid.zoom--1 .toby-card {
  min-height: 82px;
  padding: 10px 12px 8px 12px;
}

.cards-grid.zoom--1 .card-title-text {
  font-size: 0.78rem;
}

/* ========================================================
   PANE 3: RIGHT SIDEBAR ("OPEN TABS")
   ======================================================== */
.sidebar-right {
  width: var(--sidebar-right-width);
  background: var(--bg-sidebar-right);
  border-left: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 100vh;
  padding: 1rem 0.85rem 1rem;
  overflow-y: auto;
}

.open-tabs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.25rem 0.25rem 0.75rem;
}

.open-tabs-title-group {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--text-primary);
  font-size: 0.88rem;
  font-weight: 700;
}

.btn-icon-soft {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
}

/* Window session header box */
.window-session-box {
  background: transparent;
  margin-bottom: 0.75rem;
}

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

.window-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
}

.window-actions {
  display: flex;
  align-items: center;
}

.window-sub-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.25rem;
}

.tabs-count-text {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.window-icon-btns {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.window-icon-btns button {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
}

.window-icon-btns button:hover {
  color: var(--text-primary);
}

/* List of Open Tabs */
.open-tabs-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  flex: 1;
}

.open-tab-pill {
  background: #FFFFFF;
  border: 1px solid rgba(0, 0, 0, 0.04);
  border-radius: 6px;
  padding: 0.35rem 0.65rem;
  height: 30px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
  cursor: grab;
  transition: all 0.12s ease;
  user-select: none;
}

.open-tab-pill:hover {
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.06);
  transform: translateY(-1px);
}

.open-tab-favicon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  object-fit: contain;
}

.open-tab-title {
  font-size: 0.72rem;
  font-weight: 500;
  color: #374151;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

/* Modals - Perfectly Centered in Viewport */
dialog.modal-dialog:not([open]) {
  display: none !important;
}

dialog.modal-dialog {
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  margin: 0 !important;
  border: none !important;
  border-radius: var(--radius-lg) !important;
  padding: 0 !important;
  background: transparent !important;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.08) !important;
  max-width: 92vw !important;
  max-height: 88vh !important;
  overflow: visible !important;
  outline: none !important;
  z-index: 10000 !important;
}

dialog.modal-dialog::backdrop {
  background: rgba(15, 23, 42, 0.55) !important;
  backdrop-filter: blur(5px) !important;
}

.modal-card {
  width: 460px;
  max-width: 92vw;
  max-height: 85vh;
  overflow-y: auto;
  background: #FFFFFF;
  border-radius: 16px;
  padding: 1.75rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.15), 0 1px 3px rgba(0, 0, 0, 0.05);
}

.modal-card form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin: 0;
  width: 100%;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.25rem;
  margin: 0;
}

.modal-header h3 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--text-primary);
  margin: 0;
}

.btn-icon-tiny {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.18s ease;
  padding: 0;
}

.btn-icon-tiny:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--text-primary);
}

[data-theme="dark"] .btn-icon-tiny:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  width: 100%;
}

.form-group label {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: -0.01em;
  margin: 0;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  border: 1.5px solid #E2E8F0;
  font-size: 0.92rem;
  font-family: inherit;
  outline: none;
  background: #F8FAFC;
  color: var(--text-primary);
  transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: #10B981;
  background: #FFFFFF;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 0.5rem;
  padding-top: 0.25rem;
}

.btn-secondary {
  background: #F1F5F9;
  border: 1px solid #E2E8F0;
  color: var(--text-primary);
  padding: 0.65rem 1.25rem;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-secondary:hover {
  background: #E2E8F0;
}

.btn-primary {
  background: #10B981;
  color: #FFFFFF;
  border: 1px solid transparent;
  padding: 0.65rem 1.35rem;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.25);
}

.btn-primary:hover {
  background: #059669;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.35);
}

.sync-status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #10B981;
}
  color: #10B981;
}

.status-dot-green {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: #10B981;
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 99999 !important;
}

.auth-inline-error {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #FEF2F2;
  border: 1px solid #FCA5A5;
  color: #B91C1C;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  margin-bottom: 1rem;
  font-weight: 500;
  animation: toastIn 0.2s ease forwards;
  box-shadow: 0 4px 6px -1px rgba(220, 38, 38, 0.1);
}

.toast {
  background: #1F2937;
  color: #FFFFFF;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 500;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
  animation: toastIn 0.2s ease forwards;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.12);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.2);
}

/* ========================================================
   UNLIMITED CLOUD STORAGE & SYNC CARD
   ======================================================== */
.cloud-storage-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.85rem;
  box-shadow: var(--shadow-card);
  margin-bottom: 0.5rem;
  transition: all 0.2s ease;
}

.cloud-storage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.25rem;
}

.cloud-status-badge {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.status-pulse-dot,
.status-pulse-green {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-primary);
  box-shadow: 0 0 0 2px var(--color-primary-glow);
  display: inline-block;
}

.cloud-status-title {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-primary);
}

.plan-quota-tag,
.unlimited-tag {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--color-primary);
  background: var(--color-primary-light);
  padding: 2px 7px;
  border-radius: 5px;
  letter-spacing: 0.02em;
}

.cloud-storage-stats {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}

.stats-num {
  font-weight: 700;
  color: var(--text-primary);
}

/* Tab Limit Progress Bar */
.plan-progress-track {
  width: 100%;
  height: 5px;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 9999px;
  overflow: hidden;
  margin: 6px 0 10px 0;
}

[data-theme="dark"] .plan-progress-track {
  background: rgba(255, 255, 255, 0.1);
}

.plan-progress-fill {
  height: 100%;
  background: var(--color-primary);
  border-radius: 9999px;
  transition: width 0.3s ease;
}

.plan-progress-fill.warning {
  background: #F59E0B;
}

.plan-progress-fill.danger {
  background: #EF4444;
}

/* Storage Card Action Buttons */
.storage-card-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

.btn-upgrade-sidebar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  height: 32px;
  padding: 0 10px;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: inherit;
  color: #FFFFFF !important;
  background: var(--color-primary);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 2px 6px var(--color-primary-glow);
  box-sizing: border-box;
}

.btn-upgrade-sidebar:hover {
  background: var(--color-primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--color-primary-glow);
}

.btn-upgrade-sidebar svg {
  stroke: #FFFFFF;
}

.btn-sync-quick {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 100%;
  height: 28px;
  padding: 0 8px;
  font-size: 0.7rem;
  font-weight: 500;
  font-family: inherit;
  color: var(--text-secondary);
  background: rgba(0, 0, 0, 0.025);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  box-sizing: border-box;
}

.btn-sync-quick:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--text-primary);
  border-color: var(--border-card);
}

[data-theme="dark"] .btn-upgrade-sidebar {
  color: #FFFFFF !important;
  background: var(--color-primary);
}

[data-theme="dark"] .btn-sync-quick {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border-subtle);
  color: var(--text-secondary);
}

[data-theme="dark"] .btn-sync-quick:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.btn-sync-quick.syncing svg {
  animation: spin 0.8s linear infinite;
}

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

.badge-new-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--toby-blue);
  margin-left: auto;
}

.user-profile-info {
  display: flex;
  flex-direction: column;
}

.user-profile-sub {
  font-size: 0.65rem;
  color: #10B981;
  font-weight: 600;
}

/* ========================================================
   1-CLICK FAST SAVE & ACTION BUTTONS
   ======================================================== */
.btn-save-all-pill {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  background: var(--toby-blue);
  color: #FFFFFF;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.45rem 0.75rem;
  border: none;
  border-radius: 6px;
  margin-top: 0.65rem;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.25);
}

.btn-save-all-pill:hover {
  background: var(--toby-blue-hover);
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.35);
}

/* Fast 1-click + Add button on Open Tab pills */
.btn-pill-add {
  opacity: 0;
  background: var(--toby-blue);
  color: #FFFFFF;
  border: none;
  border-radius: 4px;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.12s;
  margin-left: auto;
  flex-shrink: 0;
}

.open-tab-pill:hover .btn-pill-add {
  opacity: 1;
}

.btn-pill-add:hover {
  background: var(--toby-blue-hover);
  transform: scale(1.1);
}

/* Dashed + Add Tab Card in Grid */
.card-add-placeholder {
  background: transparent;
  border: 1.5px dashed rgba(0, 0, 0, 0.12);
  border-radius: 10px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}

.card-add-placeholder:hover {
  background: #FFFFFF;
  border-color: var(--toby-blue);
  color: var(--toby-blue);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

/* ========================================================
   FLOATING INTERACTIVE DROPDOWNS
   ======================================================== */
.floating-dropdown {
  position: fixed;
  background: #FFFFFF !important;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 8px;
  box-shadow: 0 12px 28px -4px rgba(0, 0, 0, 0.2), 0 8px 12px -6px rgba(0, 0, 0, 0.1);
  padding: 6px;
  min-width: 220px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  z-index: 9999999 !important;
  animation: dropFade 0.12s ease forwards;
}

[data-theme="dark"] .floating-dropdown {
  background: #1E293B !important;
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 12px 28px -4px rgba(0, 0, 0, 0.5);
}

@keyframes dropFade {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.65rem;
  font-size: 0.78rem;
  color: var(--text-primary);
  font-weight: 500;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.1s;
}

.dropdown-item:hover {
  background: #F3F4F6;
  color: var(--text-primary);
}

.dropdown-item.active {
  color: var(--toby-blue);
  font-weight: 600;
  background: var(--toby-blue-light);
}

.dropdown-item.disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

[data-theme="dark"] .dropdown-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.dropdown-divider {
  height: 1px;
  background: #E5E7EB;
  margin: 4px 0;
}

[data-theme="dark"] .dropdown-divider {
  background: rgba(255, 255, 255, 0.08);
}

/* ========================================================
   FLOATING BATCH ACTION TOOLBAR
   ======================================================== */
.batch-action-bar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #1F2937;
  color: #FFFFFF;
  padding: 0.5rem 1rem;
  border-radius: 30px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
  z-index: 999;
  display: flex;
  align-items: center;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.batch-action-bar.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(20px);
}

.batch-bar-content {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.batch-count-text {
  font-size: 0.8rem;
  font-weight: 600;
}

.batch-buttons {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-batch {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.12s;
}

.btn-batch-primary {
  background: var(--toby-blue);
  color: #FFFFFF;
}

.btn-batch-primary:hover {
  background: var(--toby-blue-hover);
}

.btn-batch-danger {
  background: #EF4444;
  color: #FFFFFF;
}

.btn-batch-danger:hover {
  background: #DC2626;
}

.btn-batch-ghost {
  background: transparent;
  color: #9CA3AF;
}

.btn-batch-ghost:hover {
  color: #FFFFFF;
}

/* ========================================================
   MODAL ADD TAB WITH AUTO-FETCH PREVIEW
   ======================================================== */
.modal-card-add-tab {
  width: 480px;
  max-width: 90vw;
}

.modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.modal-icon-badge {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--toby-blue-light);
  color: var(--toby-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.modal-subtitle {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

.input-with-action {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-action input {
  width: 100%;
  padding-right: 75px;
}

.btn-input-action {
  position: absolute;
  right: 6px;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: #F3F4F6;
  border: 1px solid #E5E7EB;
  border-radius: 4px;
  padding: 0.25rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
}

.btn-input-action:hover {
  background: #E5E7EB;
  color: var(--text-primary);
}

.tab-preview-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: #F9FAFB;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
  margin-bottom: 1rem;
}

.preview-favicon-box {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.preview-favicon-box img {
  width: 20px;
  height: 20px;
  object-fit: contain;
  border-radius: 4px;
}

.preview-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.preview-title-input {
  border: none;
  background: transparent;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  outline: none;
  width: 100%;
}

.preview-domain-text {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.preview-loader {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.7rem;
  color: var(--toby-blue);
  font-weight: 600;
}

.spinner-small {
  width: 12px;
  height: 12px;
  border: 2px solid rgba(37, 99, 235, 0.2);
  border-top-color: var(--toby-blue);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.custom-select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid #D1D5DB;
  border-radius: 6px;
  background: #FFFFFF;
  font-size: 0.82rem;
  color: var(--text-primary);
  outline: none;
}

.key-enter {
  background: rgba(255, 255, 255, 0.25);
  padding: 2px 5px;
  border-radius: 3px;
  font-size: 0.65rem;
  margin-left: 0.4rem;
}

/* Updates Modal */
.updates-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.update-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  background: #F9FAFB;
  border-radius: 8px;
  border: 1px solid #E5E7EB;
}

.update-badge {
  background: var(--toby-blue);
  color: #FFFFFF;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  height: fit-content;
}

.update-item h4 {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
}

.update-item p {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Settings Switch */
.setting-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0;
}

.switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 20px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #CBD5E1;
  transition: 0.2s;
  border-radius: 20px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.2s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--toby-blue);
}

input:checked + .slider:before {
  transform: translateX(18px);
}

[data-theme="dark"] .slider {
  background-color: #334155;
}

[data-theme="dark"] input:checked + .slider {
  background-color: var(--toby-blue);
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.75rem;
}

.hidden {
  display: none !important;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.12);
  border-radius: 9999px;
}

/* Sleek Compact Micro Dropzone for Empty Collection */
.empty-collection-dropzone {
  grid-column: 1 / -1;
  height: 52px;
  background: rgba(0, 0, 0, 0.015);
  border: 1.5px dashed var(--border-subtle);
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 500;
  transition: all 0.15s ease;
  user-select: none;
}

.empty-collection-dropzone:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
  color: var(--color-primary);
}

.empty-collection-dropzone svg {
  stroke: currentColor;
  transition: transform 0.15s ease;
}

.empty-collection-dropzone:hover svg {
  transform: scale(1.15);
}

[data-theme="dark"] .empty-collection-dropzone {
  background: rgba(255, 255, 255, 0.02);
  border-color: rgba(255, 255, 255, 0.1);
}

.empty-open-tabs-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1.75rem 1rem;
  background: #FFFFFF;
  border: 1px dashed rgba(0, 0, 0, 0.1);
  border-radius: 10px;
  margin: 0.5rem 0.25rem;
}

.empty-open-tabs-state .empty-icon {
  font-size: 1.8rem;
  margin-bottom: 6px;
}

.empty-open-tabs-state h4 {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
  margin: 0 0 4px 0;
}

.empty-open-tabs-state p {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin: 0 0 12px 0;
}

.pill-actions-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-pill-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.68rem;
  cursor: pointer;
  opacity: 0;
  transition: all 0.15s ease;
}

.open-tab-pill:hover .btn-pill-close {
  opacity: 1;
}

.btn-pill-close:hover {
  background: #FEE2E2;
  color: #DC2626;
}

/* Homepage & Startup Modal Styles */
.modal-card-homepage {
  width: 500px;
  max-width: 92vw;
  max-height: 88vh;
  overflow-y: auto;
  padding: 1.25rem;
  gap: 0.75rem;
}

.homepage-opt-card {
  background: #FFFFFF;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
  transition: all 0.2s ease;
}

.homepage-opt-card.active {
  border-color: #818CF8;
  background: #F8FAFC;
}

.opt-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.opt-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
}

.opt-text {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.opt-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
}

.opt-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.4;
}

.opt-desc code {
  background: rgba(0, 0, 0, 0.06);
  padding: 1px 4px;
  border-radius: 4px;
  font-family: monospace;
}

.badge-status-green {
  background: #DCFCE7;
  color: #16A34A;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  white-space: nowrap;
}

.url-copy-box {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.url-copy-input {
  flex: 1;
  font-size: 0.76rem;
  padding: 6px 10px;
  background: #F1F5F9;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 6px;
  font-family: monospace;
  color: #1E293B;
  outline: none;
}

[data-theme="dark"] .url-copy-input {
  background: #1E293B;
  border-color: rgba(255, 255, 255, 0.15);
  color: #F8FAFC;
}

.homepage-steps-list {
  margin: 10px 0 0 0;
  padding-left: 20px;
  font-size: 0.74rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.homepage-steps-list li {
  margin-bottom: 4px;
}

/* ========================================================
   MODAL: PROFILE SETTINGS (Edit Name, Avatar, Email, Plan)
   ======================================================== */
.modal-card-profile {
  width: 530px !important;
  max-width: 94vw !important;
  max-height: 88vh !important;
  overflow: hidden !important;
  padding: 1.25rem 1.4rem !important;
  border-radius: 16px !important;
  background: var(--bg-card) !important;
  border: 1px solid var(--border-subtle) !important;
  box-shadow: 0 20px 45px -10px rgba(0, 0, 0, 0.25) !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 0 !important;
}

.modal-card-profile .modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.85rem;
  margin-bottom: 0.85rem;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

#modal-profile-close {
  outline: none !important;
  border: none !important;
  background: transparent !important;
  color: var(--text-muted) !important;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  transition: all 0.15s ease;
  padding: 0;
}

#modal-profile-close:hover {
  background: rgba(0, 0, 0, 0.06) !important;
  color: var(--text-primary) !important;
}

[data-theme="dark"] #modal-profile-close:hover {
  background: rgba(255, 255, 255, 0.08) !important;
  color: var(--text-primary) !important;
}

.profile-modal-content {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  overflow-y: auto;
  max-height: calc(88vh - 75px);
  padding-right: 4px;
}

.profile-modal-content::-webkit-scrollbar {
  width: 5px;
}
.profile-modal-content::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.12);
  border-radius: 9999px;
}
[data-theme="dark"] .profile-modal-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
}

.profile-avatar-section {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.profile-avatar-wrap {
  position: relative;
  width: 62px;
  height: 62px;
  flex-shrink: 0;
}

.profile-large-avatar {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: 2px solid var(--toby-blue);
  object-fit: cover;
  background: var(--bg-canvas);
}

.avatar-edit-badge {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--toby-blue);
  color: #FFFFFF;
  border: 2px solid var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s ease;
  padding: 0;
}

.avatar-edit-badge:hover {
  transform: scale(1.15);
}

.profile-avatar-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 0;
}

.avatar-presets-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.avatar-preset-chip {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.5px solid var(--border-subtle);
  padding: 0;
  background: var(--bg-canvas);
  cursor: pointer;
  overflow: hidden;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar-preset-chip:hover {
  border-color: var(--toby-blue);
  transform: scale(1.15);
}

.avatar-preset-chip.active {
  border-color: var(--toby-blue);
  box-shadow: 0 0 0 2px var(--toby-blue);
}

.avatar-preset-chip img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-quota-box {
  background: var(--bg-canvas);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.profile-quota-bar {
  height: 6px;
  width: 100%;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 9999px;
  overflow: hidden;
}

[data-theme="dark"] .profile-quota-bar {
  background: rgba(255, 255, 255, 0.1);
}

.profile-quota-fill {
  height: 100%;
  background: var(--toby-blue);
  border-radius: 9999px;
  transition: width 0.3s ease;
}

/* Auth / User Profile Modal */
.modal-card-auth {
  width: 480px;
  max-width: 92vw;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.5rem 1.6rem;
  gap: 0.95rem;
}

.auth-guest-info-banner {
  background: rgba(99, 102, 241, 0.05);
  border: 1px solid rgba(99, 102, 241, 0.16);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.25rem;
}

[data-theme="dark"] .auth-guest-info-banner {
  background: rgba(99, 102, 241, 0.1);
  border-color: rgba(99, 102, 241, 0.28);
}

.auth-info-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.auth-info-icon {
  color: var(--toby-blue);
  flex-shrink: 0;
  margin-top: 2px;
}

.auth-info-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.auth-info-text strong {
  font-size: 0.82rem;
  color: var(--text-primary);
  font-weight: 600;
}

.auth-info-text span {
  font-size: 0.74rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Google Sign-In Button */
.btn-google-auth {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 0.75rem 1rem;
  background: #FFFFFF;
  color: #1F2937;
  border: 1px solid #D1D5DB;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  transition: all 0.15s ease;
}

.btn-google-auth:hover {
  background: #F9FAFB;
  border-color: #9CA3AF;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.btn-google-auth:active {
  background: #F3F4F6;
  transform: scale(0.99);
}

.google-icon {
  flex-shrink: 0;
}

.auth-current-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #F8FAFC;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
}

.auth-large-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2px solid #E2E8F0;
  object-fit: cover;
  flex-shrink: 0;
}

.auth-card-details {
  flex: 1;
}

.auth-preset-btn {
  font-size: 0.72rem;
  padding: 4px 8px;
}

[data-theme="dark"] .auth-current-card {
  background: #0F172A;
  border-color: rgba(255, 255, 255, 0.08);
}

/* ========================================================
   MODAL: SETTINGS & PREFERENCES (Redesigned Apple / Arc UI)
   ======================================================== */
.modal-card-settings {
  width: 550px !important;
  max-width: 94vw !important;
  max-height: 88vh !important;
  overflow: hidden !important;
  padding: 1.25rem 1.4rem !important;
  border-radius: 16px !important;
  background: var(--bg-card) !important;
  border: 1px solid var(--border-subtle) !important;
  box-shadow: 0 20px 45px -10px rgba(0, 0, 0, 0.25) !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 0 !important;
}

.modal-card-settings .modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.85rem;
  margin-bottom: 0.85rem;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

#modal-settings-close {
  outline: none !important;
  border: none !important;
  background: transparent !important;
  color: var(--text-muted) !important;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  transition: all 0.15s ease;
  padding: 0;
}

#modal-settings-close:focus,
#modal-settings-close:focus-visible {
  outline: none !important;
  box-shadow: none !important;
}

#modal-settings-close:hover {
  background: rgba(0, 0, 0, 0.06) !important;
  color: var(--text-primary) !important;
}

[data-theme="dark"] #modal-settings-close:hover {
  background: rgba(255, 255, 255, 0.08) !important;
  color: var(--text-primary) !important;
}

.modal-card-settings .modal-header-title {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.modal-card-settings .modal-header-title h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: -0.01em;
}

.settings-content {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  overflow-y: auto;
  max-height: calc(88vh - 75px);
  padding-right: 4px;
}

.modal-card-settings .settings-content::-webkit-scrollbar {
  width: 5px;
}
.modal-card-settings .settings-content::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.12);
  border-radius: 9999px;
}
[data-theme="dark"] .modal-card-settings .settings-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
}

/* Modern Card Group */
.settings-group-card {
  background: var(--bg-canvas);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 0.95rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: all 0.18s ease;
}

.settings-group-card:hover {
  border-color: rgba(99, 102, 241, 0.28);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.settings-group-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.settings-group-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(99, 102, 241, 0.1);
  color: var(--toby-blue);
  flex-shrink: 0;
}

.settings-group-header h4 {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: -0.01em;
}

.settings-group-header .settings-badge {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 20px;
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

[data-theme="dark"] .settings-group-header .settings-badge {
  background: rgba(16, 185, 129, 0.2);
  color: #34D399;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.45rem 0;
}

.settings-row:not(:last-child) {
  border-bottom: 1px solid var(--border-subtle);
}

.settings-row-info {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  flex: 1;
}

.settings-row-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
}

.settings-row-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.35;
}

/* Cloud Box Card */
.settings-cloud-box {
  background: rgba(16, 185, 129, 0.05);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

[data-theme="dark"] .settings-cloud-box {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.25);
}

.settings-cloud-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.settings-cloud-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #059669;
}

[data-theme="dark"] .settings-cloud-status {
  color: #34D399;
}

.settings-cloud-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.35;
}

/* Actions Grid (JSON Export, Import, Bookmarks) */
.settings-actions-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
  margin-top: 0.25rem;
}

.settings-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0.6rem 0.75rem;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-primary);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
  user-select: none;
}

.settings-action-btn:hover {
  background: var(--bg-sidebar-left);
  border-color: var(--toby-blue);
  color: var(--toby-blue);
  transform: translateY(-1px);
}

.settings-action-btn:active {
  transform: translateY(0);
}

.settings-action-btn svg {
  flex-shrink: 0;
}

.spin {
  animation: spin 1s linear infinite;
}

/* ========================================================
   APP LOADING SCREEN & SKELETON
   ======================================================== */
.app-loading-screen {
  position: fixed;
  inset: 0;
  background: #F8F9FA;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.app-loading-screen.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loading-spinner-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.loading-logo img {
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
  animation: logoPulse 1.5s ease-in-out infinite;
}

@keyframes logoPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

.loading-spinner {
  width: 24px;
  height: 24px;
  border: 2.5px solid #E2E8F0;
  border-top-color: #3B82F6;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.loading-text {
  font-size: 0.85rem;
  font-weight: 600;
  color: #64748B;
  letter-spacing: -0.01em;
}

[data-theme="dark"] .app-loading-screen {
  background: #0B0F19;
}

[data-theme="dark"] .loading-text {
  color: #94A3B8;
}



/* ========================================================
   UPGRADE MODAL & COMPARE PLANS (Matches Toby 1:1 Images 3, 4, 5)
   ======================================================== */
.modal-card-upgrade {
  width: 780px !important;
  max-width: 95vw !important;
  max-height: 90vh !important;
  overflow-y: auto !important;
  padding: 0 !important;
  border-radius: 14px !important;
  background: #FFFFFF !important;
  position: relative !important;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.4) !important;
}

.btn-upgrade-close-x {
  position: absolute;
  top: 16px;
  right: 18px;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #CBD5E1;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 20;
  transition: all 0.15s ease;
}

.btn-upgrade-close-x:hover {
  background: rgba(255, 255, 255, 0.3);
  color: #FFFFFF;
  transform: scale(1.05);
}

.upgrade-hero {
  background: #1E2228;
  color: #FFFFFF;
  padding: 38px 36px 30px 36px;
  text-align: center;
  position: relative;
}

.upgrade-title {
  font-size: 1.55rem;
  font-weight: 700;
  margin: 0 0 6px 0;
  color: #FFFFFF;
  letter-spacing: -0.02em;
}

.upgrade-subtitle {
  font-size: 0.92rem;
  color: #94A3B8;
  margin: 0 0 16px 0;
}

.upgrade-meta-stats {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  font-size: 0.85rem;
  color: #CBD5E1;
  margin-bottom: 24px;
}

.upgrade-meta-stats span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.upgrade-meta-stats .meta-dot {
  color: #64748B;
  font-weight: 700;
}

.billing-switcher-pill {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.08);
  padding: 6px 14px;
  border-radius: 24px;
  margin-bottom: 28px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.billing-opt {
  font-size: 0.82rem;
  font-weight: 600;
  color: #94A3B8;
  cursor: pointer;
  transition: color 0.15s ease;
}

.billing-opt.active {
  color: #FFFFFF;
}

.switch-billing {
  position: relative;
  display: inline-block;
  width: 34px;
  height: 18px;
}

.switch-billing input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider-billing {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #475569;
  border-radius: 18px;
  transition: 0.2s;
}

.slider-billing:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 2px;
  bottom: 2px;
  background: white;
  border-radius: 50%;
  transition: 0.2s;
}

.switch-billing input:checked + .slider-billing {
  background: #3B82F6;
}

.switch-billing input:checked + .slider-billing:before {
  transform: translateX(16px);
}

.discount-tag {
  background: #2563EB;
  color: #FFFFFF;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
}

/* 3 Plan Cards */
.upgrade-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  text-align: left;
  margin-bottom: 20px;
}

.plan-card {
  background: #FFFFFF;
  color: #1E293B;
  border-radius: 10px;
  padding: 22px 18px;
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  border: 1px solid #E2E8F0;
  transition: transform 0.2s, box-shadow 0.2s;
}

.plan-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
}

.plan-card.featured {
  border: 2px solid #3B82F6;
  transform: translateY(-4px);
  box-shadow: 0 10px 28px rgba(59, 130, 246, 0.22);
}

.plan-card.featured:hover {
  transform: translateY(-6px);
  box-shadow: 0 14px 32px rgba(59, 130, 246, 0.28);
}

.plan-corner-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: #EFF6FF;
  color: #2563EB;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  border: 1px solid #DBEAFE;
}

.card-plan-name {
  font-size: 1.18rem;
  font-weight: 700;
  color: #0F172A;
  margin: 0 0 4px 0;
}

.card-plan-desc {
  font-size: 0.74rem;
  color: #64748B;
  min-height: 34px;
  margin: 0 0 12px 0;
  line-height: 1.4;
}

.card-price-row {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-bottom: 14px;
  min-height: 42px;
}

.card-price-free {
  font-size: 1.85rem;
  font-weight: 800;
  color: #0F172A;
  letter-spacing: -0.02em;
}

.card-price-currency {
  font-size: 1.15rem;
  font-weight: 700;
  color: #0F172A;
}

.card-price-num {
  font-size: 1.85rem;
  font-weight: 800;
  color: #0F172A;
  letter-spacing: -0.02em;
}

.card-price-period {
  font-size: 0.68rem;
  color: #64748B;
  line-height: 1.25;
  margin-left: 2px;
}

.card-current-pill {
  background: #F1F5F9;
  color: #475569;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-align: center;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid #E2E8F0;
}

.btn-card-upgrade {
  width: 100%;
  background: #2563EB;
  color: #FFFFFF;
  border: none;
  font-size: 0.84rem;
  font-weight: 600;
  padding: 9px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.btn-card-upgrade:hover {
  background: #1D4ED8;
}

.btn-card-downgrade {
  width: 100%;
  background: #F8FAFC;
  color: #475569;
  border: 1px solid #CBD5E1;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-card-downgrade:hover {
  background: #F1F5F9;
  color: #1E293B;
}

.card-divider {
  height: 1px;
  background: #E2E8F0;
  margin: 16px 0 12px 0;
}

.card-checklist {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 9px;
  font-size: 0.74rem;
  color: #334155;
  line-height: 1.35;
}

.card-checklist li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.card-checklist .chk-green {
  color: #10B981;
  font-weight: 800;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.upgrade-footer-note {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  font-size: 0.78rem;
  color: #94A3B8;
  margin-top: 10px;
}

.upgrade-footer-note a {
  color: #60A5FA;
  text-decoration: none;
}

.upgrade-footer-note a:hover {
  text-decoration: underline;
}

.upgrade-footer-note .footer-note-sep {
  color: #64748B;
}

/* Compare Plans Matrix */
.compare-table-wrapper {
  padding: 34px 38px 44px 38px;
  background: #FFFFFF;
}

.compare-title-block {
  text-align: center;
  margin-bottom: 24px;
}

.compare-title-block h3 {
  font-size: 1.3rem;
  font-weight: 700;
  color: #0F172A;
  margin: 0 0 4px 0;
}

.compare-title-block p {
  font-size: 0.82rem;
  color: #64748B;
  margin: 0;
}

.pricing-matrix-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.pricing-matrix-table thead th {
  padding: 14px 16px;
  text-align: left;
  vertical-align: top;
  border-bottom: 2px solid #E2E8F0;
}

.pricing-matrix-table th.th-feature {
  width: 44%;
}

.pricing-matrix-table th.th-plan {
  width: 18.6%;
  text-align: center;
}

.pricing-matrix-table .th-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: #0F172A;
}

.pricing-matrix-table .th-price {
  font-size: 0.85rem;
  font-weight: 600;
  color: #334155;
  margin: 4px 0 8px 0;
}

.pricing-matrix-table .th-subbadge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  background: #F1F5F9;
  color: #64748B;
  border-radius: 4px;
}

.btn-matrix-action {
  background: #2563EB;
  color: #FFFFFF;
  border: none;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-matrix-action:hover {
  background: #1D4ED8;
}

.pricing-matrix-table tbody tr {
  border-bottom: 1px solid #F1F5F9;
}

.pricing-matrix-table tbody tr:hover {
  background: #F8FAFC;
}

.pricing-matrix-table tbody td {
  padding: 11px 16px;
  color: #334155;
}

.pricing-matrix-table tbody td:first-child {
  font-weight: 500;
}

.pricing-matrix-table tbody td.ch {
  text-align: center;
  color: #10B981;
  font-weight: 700;
  font-size: 0.95rem;
}

.pricing-matrix-table tbody td.ds {
  text-align: center;
  color: #94A3B8;
  font-weight: 500;
}

.pricing-matrix-table tr.section-heading-row td {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #475569;
  background: #F8FAFC;
  padding: 8px 16px;
  border-top: 1px solid #E2E8F0;
  border-bottom: 1px solid #E2E8F0;
}

/* ========================================================
   60-TAB LIMIT WARNING BANNER (Matches Toby 1:1)
   ======================================================== */
.banner-limit-warning {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 18px;
  margin: 12px 24px 0 24px;
  background: #FEF3C7;
  border: 1px solid #FCD34D;
  border-radius: 8px;
  color: #92400E;
  font-size: 0.82rem;
  box-shadow: 0 2px 4px rgba(245, 158, 11, 0.06);
  animation: bannerSlide 0.2s ease-out;
}

@keyframes bannerSlide {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.banner-limit-content {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
}

.banner-limit-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-banner-upgrade {
  background: transparent;
  border: 1px solid #D97706;
  color: #B45309;
  font-weight: 700;
  font-size: 0.72rem;
  padding: 3px 10px;
  border-radius: 4px;
  cursor: pointer;
  letter-spacing: 0.03em;
  transition: all 0.15s ease;
}

.btn-banner-upgrade:hover {
  background: #D97706;
  color: #FFFFFF;
}

.btn-banner-close {
  background: transparent;
  border: none;
  color: #92400E;
  font-size: 0.95rem;
  cursor: pointer;
  opacity: 0.7;
  padding: 2px 4px;
  line-height: 1;
}

.btn-banner-close:hover {
  opacity: 1;
}

/* ========================================================
   SIDEBAR PLAN TRACKER & EDIT WORKSPACE
   ======================================================== */
.plan-progress-track {
  width: 100%;
  height: 6px;
  background: #E2E8F0;
  border-radius: 3px;
  overflow: hidden;
  margin-top: 6px;
}

.plan-progress-fill {
  height: 100%;
  background: #3B82F6;
  border-radius: 3px;
  transition: width 0.3s ease;
}

.plan-progress-fill.warning {
  background: #F59E0B;
}

.plan-progress-fill.danger {
  background: #EF4444;
}

.btn-sidebar-upgrade-link {
  background: none;
  border: none;
  color: #2563EB;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  margin-top: 4px;
  display: inline-block;
}

.btn-sidebar-upgrade-link:hover {
  color: #1D4ED8;
}

.btn-edit-ws-icon {
  background: transparent;
  border: none;
  color: #94A3B8;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  opacity: 0.6;
  transition: opacity 0.15s;
}

.btn-edit-ws-icon:hover {
  opacity: 1;
  color: #3B82F6;
  background: rgba(59, 130, 246, 0.1);
}

.sidebar-header {
  cursor: pointer;
  border-radius: 6px;
  padding: 4px 6px;
  transition: background 0.15s;
}

.sidebar-header:hover {
  background: rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .sidebar-header:hover {
  background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .toby-card {
  background: var(--bg-card);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}
[data-theme="dark"] .toby-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 20px -3px rgba(0, 0, 0, 0.5);
}
[data-theme="dark"] .toby-card.is-favorite {
  border-color: rgba(245, 158, 11, 0.45);
  box-shadow: 0 1px 4px rgba(245, 158, 11, 0.15);
}
[data-theme="dark"] .card-favicon-box {
  background: rgba(255, 255, 255, 0.06);
}
[data-theme="dark"] .card-domain-name {
  color: var(--text-muted);
}
[data-theme="dark"] .card-title-text {
  color: var(--text-primary);
}
[data-theme="dark"] .card-bottom-bar {
  border-top-color: rgba(255, 255, 255, 0.06);
}
[data-theme="dark"] .card-action-btn {
  color: var(--text-muted);
}
[data-theme="dark"] .card-action-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}
[data-theme="dark"] .filter-chip {
  background: var(--bg-card);
  border-color: rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
}
[data-theme="dark"] .filter-chip:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.2);
}
[data-theme="dark"] .filter-chip.active {
  background: var(--color-primary);
  color: #FFFFFF;
  border-color: var(--color-primary);
}
[data-theme="dark"] .chip-count {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
}
[data-theme="dark"] .filter-chip.active .chip-count {
  background: rgba(255, 255, 255, 0.25);
  color: #FFFFFF;
}
[data-theme="dark"] .chip-favorites {
  border-color: rgba(245, 158, 11, 0.35);
}
[data-theme="dark"] .chip-favorites:hover {
  border-color: rgba(245, 158, 11, 0.6);
}
[data-theme="dark"] .chip-count-gold {
  background: rgba(245, 158, 11, 0.2);
  color: #FBBF24;
}
[data-theme="dark"] .section-checkbox {
  border-color: rgba(255, 255, 255, 0.25);
  background-color: var(--bg-card);
  color-scheme: dark;
}
[data-theme="dark"] .view-segmented-control {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.08);
}
[data-theme="dark"] .seg-btn.active {
  background: var(--bg-card);
  color: var(--color-primary);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}
[data-theme="dark"] .card-add-placeholder {
  background: rgba(255, 255, 255, 0.02);
  border-color: rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
}
[data-theme="dark"] .collections-sections-container.view-columns .collection-section {
  background: var(--bg-card);
  border-color: rgba(255, 255, 255, 0.08);
}
[data-theme="dark"] .card-add-placeholder:hover {
  background: var(--color-primary-light);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

[data-theme="dark"] .open-tab-pill {
  background: var(--bg-card);
  border-color: var(--border-card);
}
[data-theme="dark"] .open-tab-pill:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.15);
}
[data-theme="dark"] .open-tab-title {
  color: var(--text-primary);
}

[data-theme="dark"] .cloud-storage-card {
  background: var(--bg-card);
  border-color: var(--border-card);
}
[data-theme="dark"] .storage-plan-name,
[data-theme="dark"] .storage-count-stat {
  color: var(--text-primary);
}
[data-theme="dark"] .btn-sync-quick {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-subtle);
  color: var(--text-secondary);
}

[data-theme="dark"] .quick-input-wrap {
  background: var(--bg-card);
  border-color: var(--border-card);
}
[data-theme="dark"] #quick-input {
  color: var(--text-primary);
}
[data-theme="dark"] .btn-quick-action {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border-subtle);
  color: var(--text-secondary);
}

[data-theme="dark"] .chip {
  background: var(--bg-card);
  border-color: var(--border-card);
  color: var(--text-secondary);
}
[data-theme="dark"] .chip.active {
  background: var(--text-primary);
  color: var(--bg-sidebar-left);
}

[data-theme="dark"] .modal-card {
  background: var(--bg-card);
  border-color: var(--border-subtle);
  color: var(--text-primary);
}
[data-theme="dark"] .modal-header h3,
[data-theme="dark"] .settings-section h4 {
  color: var(--text-primary);
}
[data-theme="dark"] .form-group input,
[data-theme="dark"] .form-group textarea,
[data-theme="dark"] .form-group select {
  background: var(--bg-canvas);
  border-color: var(--border-subtle);
  color: var(--text-primary);
}
[data-theme="dark"] .btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border-subtle);
  color: var(--text-primary);
}
[data-theme="dark"] .modal-actions .btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
}
[data-theme="dark"] .modal-actions .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.14);
}

[data-theme="dark"] .plan-progress-track {
  background: #1E293B;
}


/* ========================================================
   COMMUNITY PRO REWARDS BANNER (Friendly Community Support)
   ======================================================== */
.banner-pro-rewards {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  margin: 12px 24px 0 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--color-primary);
  border-radius: 9px;
  box-shadow: var(--shadow-card);
  animation: bannerSlide 0.2s ease-out;
}

.banner-pro-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.banner-pro-gift-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--color-primary-light);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.banner-pro-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.banner-pro-text strong {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-primary);
}

.banner-pro-text span {
  font-size: 0.74rem;
  color: var(--text-secondary);
}

.banner-pro-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-banner-action {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-banner-action.primary {
  background: var(--color-primary);
  color: #FFFFFF;
  border: none;
  box-shadow: 0 1px 3px var(--color-primary-glow);
}

.btn-banner-action.primary:hover {
  background: var(--color-primary-hover);
  transform: translateY(-1px);
}

.btn-banner-action.secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}

.btn-banner-action.secondary:hover {
  background: var(--color-primary-light);
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.btn-banner-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  line-height: 1;
  transition: color 0.15s;
}

.btn-banner-close:hover {
  color: var(--text-primary);
  background: rgba(0, 0, 0, 0.05);
}

/* ========================================================
   MODAL: PRO REWARDS & KO-FI (Community Viral Growth)
   ======================================================== */
.modal-card-rewards {
  width: 620px !important;
  max-width: 95vw !important;
  max-height: 90vh !important;
  overflow-y: auto !important;
  padding: 0 !important;
  border-radius: 16px !important;
  background: var(--bg-card) !important;
  border: 1px solid var(--border-subtle) !important;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.3) !important;
}

.rewards-hero {
  background: linear-gradient(135deg, #1E1B4B 0%, #0F172A 100%);
  color: #FFFFFF;
  padding: 30px 32px 24px 32px;
  position: relative;
  text-align: center;
}

.rewards-badge-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #C7D2FE;
  margin-bottom: 12px;
  letter-spacing: 0.03em;
}

.rewards-title {
  font-size: 1.45rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: #FFFFFF;
  letter-spacing: -0.02em;
}

.rewards-subtitle {
  font-size: 0.85rem;
  color: #94A3B8;
  max-width: 480px;
  margin: 0 auto 20px auto;
  line-height: 1.45;
}

/* Modal Tab Switcher (Invite Friends vs Ko-fi) */
.rewards-tab-switcher {
  display: flex;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 3px;
  border-radius: 10px;
  max-width: 420px;
  margin: 0 auto;
}

.rewards-tab-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 14px;
  background: transparent;
  color: #CBD5E1;
  border: none;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.rewards-tab-btn.active {
  background: #FFFFFF;
  color: #0F172A;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.rewards-body {
  padding: 24px 30px 28px 30px;
}

.rewards-pane {
  display: none;
}

.rewards-pane.active {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Stats Row */
.rewards-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.reward-stat-card {
  background: var(--bg-canvas);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 12px 16px;
  text-align: left;
}

.reward-stat-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.reward-stat-val {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* Referral Link Box */
.referral-link-card {
  background: var(--color-primary-light);
  border: 1.5px solid var(--color-primary);
  border-radius: 10px;
  padding: 16px;
}

.referral-card-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.referral-card-desc {
  font-size: 0.76rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
  line-height: 1.4;
}

.referral-input-row {
  display: flex;
  gap: 8px;
}

.referral-url-input {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 7px;
  padding: 8px 12px;
  font-size: 0.8rem;
  font-family: monospace;
  color: var(--text-primary);
  outline: none;
}

.btn-copy-ref {
  background: var(--color-primary);
  color: #FFFFFF;
  border: none;
  border-radius: 7px;
  padding: 8px 16px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-copy-ref:hover {
  background: var(--color-primary-hover);
  transform: translateY(-1px);
}

/* Social Share Row */
.social-share-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.btn-share-social {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 6px;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-primary);
}

.btn-share-social:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 5px rgba(0,0,0,0.06);
}

.btn-share-line:hover { color: #00B900; border-color: #00B900; }
.btn-share-fb:hover { color: #1877F2; border-color: #1877F2; }
.btn-share-tw:hover { color: #0EA5E9; border-color: #0EA5E9; }

/* Ko-fi Box */
.kofi-donation-card {
  background: #FFFBEB;
  border: 1.5px solid #FCD34D;
  border-radius: 12px;
  padding: 22px;
  text-align: center;
}

[data-theme="dark"] .kofi-donation-card {
  background: #451A03;
  border-color: #78350F;
}

.kofi-cup-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #FEF3C7;
  color: #D97706;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px auto;
}

[data-theme="dark"] .kofi-cup-icon {
  background: #78350F;
  color: #FCD34D;
}

.kofi-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #92400E;
  margin-bottom: 6px;
}

[data-theme="dark"] .kofi-card-title {
  color: #FDE68A;
}

.kofi-card-desc {
  font-size: 0.8rem;
  color: #78350F;
  margin-bottom: 16px;
  line-height: 1.45;
}

[data-theme="dark"] .kofi-card-desc {
  color: #FDE68A;
}

.btn-open-kofi-direct {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #00b9fe;
  color: #FFFFFF;
  border: none;
  border-radius: 8px;
  padding: 10px 24px;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(0, 185, 254, 0.35);
  transition: all 0.15s ease;
}

.btn-open-kofi-direct:hover {
  background: #009fe0;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 185, 254, 0.45);
}

.kofi-activate-box {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px dashed rgba(217, 119, 6, 0.3);
  text-align: left;
}

/* Ko-fi Floating Chat Widget */
.kofi-floating-chat-container {
  position: fixed;
  bottom: 24px;
  right: 28px;
  z-index: 1000;
  display: flex;
  align-items: center;
}

.kofi-floating-donate-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background-color: #00b9fe;
  color: #ffffff;
  border: none;
  border-radius: 24px;
  padding: 10px 20px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 185, 254, 0.45);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
  user-select: none;
}

.kofi-floating-donate-btn:hover {
  background-color: #009fe0;
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 6px 20px rgba(0, 185, 254, 0.6);
}

.kofi-floating-donate-btn:active {
  transform: translateY(0) scale(0.98);
}

.kofi-floating-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Palette Swatch Selector in Settings */
.theme-palette-picker {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.swatch-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 700;
  transition: all 0.15s ease;
  padding: 0;
}

.swatch-btn:hover {
  transform: scale(1.15);
}

.swatch-btn.active {
  border-color: #FFFFFF;
  box-shadow: 0 0 0 2px var(--color-primary);
}

/* Update Available Notification Banner */
.banner-update-notification {
  background: linear-gradient(90deg, #EFF6FF 0%, #EEF2FF 100%);
  border-bottom: 1px solid #BFDBFE;
  padding: 8px 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  animation: slideDownUpdate 0.25s ease-out;
}

[data-theme="dark"] .banner-update-notification {
  background: linear-gradient(90deg, rgba(30, 58, 138, 0.6) 0%, rgba(49, 46, 129, 0.6) 100%);
  border-bottom: 1px solid rgba(99, 102, 241, 0.35);
}

.banner-update-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1400px;
  margin: 0 auto;
  font-size: 0.82rem;
  color: var(--text-primary);
}

.update-badge-pill {
  background: #3B82F6;
  color: #FFFFFF;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
}

@keyframes slideDownUpdate {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
