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

:root {
  --bg: #0a0a0f;
  --bg-card: #12121a;
  --bg-input: #1a1a25;
  --bg-hover: #22222e;
  --text: #e5e5e5;
  --text-dim: #666;
  --accent: #6366f1;
  --accent-glow: rgba(99, 102, 241, 0.3);
  --purple: #8b5cf6;
  --green: #10b981;
  --red: #ef4444;
  --yellow: #f59e0b;
  --blue: #3b82f6;
  --radius: 14px;
  --nav-height: 70px;
  --topbar-height: 52px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: radial-gradient(ellipse at top, #0f0f1a 0%, #0a0a0f 70%);
  color: var(--text);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
  line-height: 1.5;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-width: 500px;
  margin: 0 auto;
}

/* ===== DAY PROGRESS BAR ===== */
#day-progress {
  height: 3px;
  background: rgba(255,255,255,0.03);
  width: 100%;
  flex-shrink: 0;
}

#day-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--purple), var(--accent));
  background-size: 200% 100%;
  border-radius: 0 2px 2px 0;
  transition: width 0.8s ease;
}

/* ===== TOP BAR ===== */
#topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  height: var(--topbar-height);
  background: rgba(10, 10, 15, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 10;
}

#level-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

#level-badge {
  background: linear-gradient(135deg, var(--accent) 0%, var(--purple) 50%, var(--accent) 100%);
  background-size: 200% 200%;
  color: white;
  padding: 4px 12px;
  border-radius: 8px;
  font-weight: 800;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.xp-bar-mini {
  flex: 1;
  height: 6px;
  background: #1a1a25;
  border-radius: 3px;
  overflow: hidden;
}

.xp-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--purple));
  border-radius: 3px;
  transition: width 0.6s ease;
  position: relative;
  overflow: hidden;
}

.xp-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: xpShine 3s ease infinite;
}

.xp-fill.near-level::after {
  animation: xpShine 1.2s ease infinite;
}

@keyframes xpShine {
  0% { left: -100%; }
  100% { left: 200%; }
}

#xp-label { font-size: 0.65rem; color: var(--text-dim); }

#streak-badge {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--yellow);
  margin-left: 10px;
  transition: all 0.3s ease;
}

#streak-badge.on-fire {
  text-shadow: 0 0 8px rgba(245, 158, 11, 0.6), 0 0 16px rgba(245, 158, 11, 0.3);
  animation: fireGlow 1.5s ease-in-out infinite;
}

@keyframes fireGlow {
  0%, 100% { text-shadow: 0 0 8px rgba(245, 158, 11, 0.6), 0 0 16px rgba(245, 158, 11, 0.3); }
  50% { text-shadow: 0 0 12px rgba(245, 158, 11, 0.8), 0 0 24px rgba(245, 158, 11, 0.5), 0 0 32px rgba(239, 68, 68, 0.3); }
}

/* ===== CONTENT ===== */
#content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 8px;
}

.view { display: none; padding: 0 16px; opacity: 0; }
.view.active { display: flex; flex-direction: column; opacity: 1; animation: viewSlideIn 0.35s cubic-bezier(0.22, 1, 0.36, 1); }

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

/* ===== HOME VIEW ===== */
#view-home {
  height: calc(100vh - var(--topbar-height) - var(--nav-height) - 3px);
  height: calc(100dvh - var(--topbar-height) - var(--nav-height) - 3px);
  justify-content: flex-start;
  gap: 14px;
  overflow-y: auto;
  padding-top: 4px;
}

/* Space cards */
.space-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.space-card {
  background: linear-gradient(145deg, var(--bg-card) 0%, rgba(99, 102, 241, 0.04) 100%);
  border: 1px solid rgba(99, 102, 241, 0.1);
  border-radius: var(--radius);
  padding: 18px 16px;
  cursor: pointer;
  transition: border-color 0.3s, transform 0.2s ease, box-shadow 0.3s;
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.space-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.4;
}

.space-card:hover {
  border-color: rgba(99, 102, 241, 0.3);
  transform: scale(1.01);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.space-card:active {
  border-color: var(--accent);
  transform: scale(0.98);
  box-shadow: 0 0 16px var(--accent-glow);
}

.space-icon { font-size: 1.8rem; margin-bottom: 6px; }
.space-title { font-weight: 700; font-size: 0.95rem; margin-bottom: 4px; }
.space-stats { font-size: 0.7rem; color: var(--text-dim); line-height: 1.5; }

/* Home events */
.home-events { margin-bottom: 8px; }

.home-event-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-card);
  border-radius: 8px;
  margin-bottom: 4px;
  font-size: 0.85rem;
}

.home-event-time {
  color: var(--accent);
  font-weight: 700;
  font-size: 0.8rem;
  min-width: 40px;
}

.home-event-title { flex: 1; }

/* Day bar */
#day-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  font-size: 0.7rem;
  color: var(--text-dim);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.04), transparent);
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.03);
  letter-spacing: 0.3px;
}

/* Tabs */
.tab-bar {
  display: flex;
  gap: 4px;
  padding: 8px 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.tab-bar::-webkit-scrollbar { display: none; }

.tab {
  padding: 8px 14px;
  background: var(--bg-card);
  border: 1px solid #1a1a25;
  border-radius: 20px;
  color: var(--text-dim);
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.25s ease;
}

.tab:hover:not(.active) {
  border-color: rgba(99, 102, 241, 0.2);
  color: var(--text);
  background: var(--bg-hover);
}

.tab.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(99, 102, 241, 0.1);
}

.tab-content { display: none; padding-top: 8px; }
.tab-content.active { display: block; animation: tabFadeIn 0.25s ease; }

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

/* Character alert */
#char-alert {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 22px;
  height: 22px;
  background: var(--red);
  color: white;
  border-radius: 50%;
  font-size: 0.8rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: bounce 1s infinite;
}

#char-alert.hidden { display: none; }

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

/* Missions area */
#missions-area { flex: 1; min-height: 0; overflow: hidden; }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  padding-top: 8px;
}

.section-header h3 {
  font-size: 0.75rem;
  color: var(--text-dim);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  font-weight: 500;
}

.counter-badge {
  background: var(--bg-input);
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 700;
}

.missions-scroll {
  overflow-y: auto;
  max-height: calc(100% - 36px);
  padding-right: 4px;
}

.mission-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1px solid #1a1a25;
  border-radius: 10px;
  margin-bottom: 6px;
  transition: all 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  animation: missionSlideIn 0.3s ease backwards;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.mission-item:hover {
  border-color: rgba(99, 102, 241, 0.2);
}

.mission-item:nth-child(1) { animation-delay: 0s; }
.mission-item:nth-child(2) { animation-delay: 0.05s; }
.mission-item:nth-child(3) { animation-delay: 0.1s; }
.mission-item:nth-child(4) { animation-delay: 0.15s; }
.mission-item:nth-child(5) { animation-delay: 0.2s; }

@keyframes missionSlideIn {
  from { opacity: 0; transform: translateX(-8px); }
  to { opacity: 1; transform: translateX(0); }
}

.mission-item.completed {
  opacity: 0.35;
  border-color: var(--green);
  transform: scale(0.98);
}

.mission-item.completing {
  animation: missionComplete 0.5s ease forwards;
}

@keyframes missionComplete {
  0% { transform: scale(1); opacity: 1; }
  30% { transform: scale(1.02); border-color: var(--green); box-shadow: 0 0 12px rgba(16, 185, 129, 0.3); }
  100% { transform: scale(0.98); opacity: 0.35; }
}

.mission-item.completed .mission-title { text-decoration: line-through; }

.mission-check {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  color: white;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

.mission-check.checked {
  background: var(--green);
  border-color: var(--green);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
  animation: checkPop 0.3s ease;
}

@keyframes checkPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.25); }
  100% { transform: scale(1); }
}

.mission-check:active { transform: scale(0.85); }

.mission-info { flex: 1; min-width: 0; }
.mission-title { display: block; font-size: 0.9rem; font-weight: 500; }
.mission-cat { font-size: 0.7rem; color: var(--text-dim); }

.mission-xp {
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 800;
  white-space: nowrap;
}

/* Character area */
#character-area {
  text-align: center;
  padding: 12px 0 8px;
  flex-shrink: 0;
}

#character {
  position: relative;
  display: inline-block;
  margin-bottom: 10px;
}

#char-canvas {
  width: 160px;
  height: 160px;
  image-rendering: pixelated;
  animation: float 3s ease-in-out infinite;
  filter: drop-shadow(0 4px 12px var(--accent-glow));
}

#char-glow {
  position: absolute;
  bottom: -14px;
  left: 50%;
  transform: translateX(-50%);
  width: 90px;
  height: 18px;
  background: var(--accent);
  border-radius: 50%;
  filter: blur(14px);
  opacity: 0.4;
  animation: glow-pulse 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@keyframes glow-pulse {
  0%, 100% { opacity: 0.3; transform: translateX(-50%) scaleX(1); }
  50% { opacity: 0.6; transform: translateX(-50%) scaleX(1.15); }
}

#char-message {
  font-size: 0.85rem;
  color: var(--accent);
  font-style: italic;
  margin-bottom: 6px;
  opacity: 0.9;
  letter-spacing: 0.2px;
}

#day-info { display: flex; justify-content: center; gap: 12px; }
#day-info span { font-size: 0.75rem; color: var(--text-dim); }

/* ===== BOTTOM NAV ===== */
#bottom-nav {
  display: flex;
  align-items: center;
  justify-content: space-around;
  min-height: var(--nav-height);
  background: rgba(18, 18, 26, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: env(safe-area-inset-bottom, 8px);
  z-index: 10;
}

.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 12px;
  transition: all 0.25s ease;
  position: relative;
}

.nav-btn.active { color: var(--accent); }
.nav-btn.active::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--accent), 0 0 12px var(--accent-glow);
}
.nav-btn.active .nav-icon {
  filter: drop-shadow(0 0 6px var(--accent-glow));
}
.nav-btn:active { transform: scale(0.9); }

.nav-icon { font-size: 1.4rem; transition: transform 0.2s ease; }
.nav-btn.active .nav-icon { transform: translateY(-1px); }
.nav-label { font-size: 0.6rem; font-weight: 600; transition: opacity 0.2s; }
.nav-btn.active .nav-label { opacity: 1; }

.nav-btn.home-btn {
  background: linear-gradient(135deg, var(--accent), var(--purple));
  width: 52px;
  height: 52px;
  border-radius: 50%;
  margin-top: -22px;
  box-shadow: 0 4px 16px var(--accent-glow);
}

.nav-btn.home-btn::after { display: none; }

.nav-btn.home-btn .nav-icon { font-size: 1.8rem; color: white; }
.nav-btn.home-btn:active { transform: scale(0.85); }

.nav-dot {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 8px;
  height: 8px;
  background: var(--red);
  border-radius: 50%;
}

.nav-dot.hidden { display: none; }

/* ===== CHAT ===== */
.chat-layout { display: flex; height: calc(100vh - var(--topbar-height) - var(--nav-height)); height: calc(100dvh - var(--topbar-height) - var(--nav-height)); }
#chat-sidebar { width: 52px; background: var(--bg-card); border-right: 1px solid #1a1a25; overflow-y: auto; padding: 8px 0; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.sidebar-item { width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; cursor: pointer; position: relative; transition: all 0.2s; }
.sidebar-item:hover { background: var(--bg-hover); }
.sidebar-item.active { background: rgba(99,102,241,0.15); border: 1px solid var(--accent); }
.sidebar-divider { width: 24px; height: 1px; background: #2a2a3a; margin: 4px 0; }
.sidebar-avatar { width: 34px; height: 34px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 0.7rem; font-weight: 700; color: white; }
.sidebar-badge { position: absolute; top: -2px; right: -2px; width: 8px; height: 8px; background: var(--red); border-radius: 50%; }
#chat-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
#chat-header { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid #1a1a25; }
#chat-header-name { flex: 1; font-weight: 600; font-size: 0.9rem; }

#chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.chat-msg {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 16px;
  margin-bottom: 6px;
  font-size: 0.9rem;
  line-height: 1.4;
  word-wrap: break-word;
}

.chat-msg.user {
  background: linear-gradient(135deg, var(--accent), var(--purple));
  color: white;
  margin-left: auto;
  border-bottom-right-radius: 4px;
}

.chat-msg.zyro {
  background: var(--bg-card);
  border: 1px solid #1a1a25;
  margin-right: auto;
  border-bottom-left-radius: 4px;
}

.chat-badge { font-size: 0.65rem; margin-left: 6px; opacity: 0.5; }

.chat-msg.thinking { opacity: 0.5; font-style: italic; }

.thinking-dots span { animation: blink 1.4s infinite both; font-weight: bold; }
.thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0; } 40% { opacity: 1; } }

#chat-input-area {
  display: flex;
  gap: 8px;
  padding: 8px;
}

#chat-input {
  flex: 1;
  padding: 12px 16px;
  border-radius: 24px;
  border: 1px solid #1a1a25;
  background: var(--bg-input);
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
}

#chat-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12); }
#chat-input::placeholder { color: rgba(102, 102, 102, 0.6); }

#chat-send {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: white;
}

/* ===== ADD VIEW ===== */
.add-form { padding-top: 12px; }

.input-big {
  width: 100%;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid #1a1a25;
  border-radius: var(--radius);
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 10px;
  outline: none;
}

.input-big:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12); }
.input-big::placeholder { color: rgba(102, 102, 102, 0.6); }

.input {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1px solid #1a1a25;
  border-radius: 10px;
  color: var(--text);
  font-size: 0.9rem;
  margin-bottom: 10px;
  outline: none;
  font-family: inherit;
}

.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12); }
.input::placeholder { color: rgba(102, 102, 102, 0.6); }
textarea.input { min-height: 70px; resize: vertical; }
select.input { cursor: pointer; }

.type-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.type-btn {
  padding: 8px 14px;
  background: var(--bg-card);
  border: 1px solid #1a1a25;
  border-radius: 20px;
  color: var(--text-dim);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}

.type-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(99, 102, 241, 0.1);
}

/* ===== BUTTONS ===== */
.btn-primary {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 8px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease, background 0.2s ease;
  box-shadow: 0 2px 12px rgba(99, 102, 241, 0.2);
  letter-spacing: 0.2px;
}

.btn-primary:hover {
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.35);
  background: linear-gradient(135deg, #7577f5, #9d7bf8);
}

.btn-primary:active {
  transform: scale(0.97);
  opacity: 0.9;
  box-shadow: 0 1px 6px rgba(99, 102, 241, 0.3);
}

.btn-secondary {
  width: 100%;
  padding: 12px;
  background: transparent;
  color: var(--accent);
  border: 1px dashed rgba(99, 102, 241, 0.4);
  border-radius: var(--radius);
  font-size: 0.9rem;
  cursor: pointer;
  margin-top: 12px;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  border-style: solid;
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.06);
}

.icon-btn {
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 8px;
}

.back-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.9rem;
  cursor: pointer;
  padding: 12px 0 8px;
  text-align: left;
}

/* ===== CARDS ===== */
.entry-card {
  background: var(--bg-card);
  border: 1px solid #1a1a25;
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: border-color 0.25s, box-shadow 0.25s, transform 0.15s;
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.entry-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.3;
}

.entry-card:hover {
  border-color: rgba(99, 102, 241, 0.3);
  transform: scale(1.01);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.entry-card:active {
  border-color: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
  transform: scale(0.98);
}
.entry-card .entry-title { font-weight: 600; margin-bottom: 3px; font-size: 0.9rem; }
.entry-card .entry-meta { font-size: 0.75rem; color: var(--text-dim); }
.entry-card .entry-type {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  background: var(--bg-input);
}

/* ===== CATEGORY ===== */
.category-item {
  background: var(--bg-card);
  border: 1px solid #1a1a25;
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
}

.category-item:active { border-color: var(--accent); }
.category-icon { font-size: 1.4rem; }
.category-info { flex: 1; }
.category-info .name { font-weight: 600; font-size: 0.9rem; }
.category-info .count { font-size: 0.75rem; color: var(--text-dim); }
.category-arrow { color: var(--text-dim); }

#category-breadcrumb {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  font-size: 0.8rem;
  color: var(--text-dim);
  flex-wrap: wrap;
}

#category-breadcrumb span { cursor: pointer; }
#category-breadcrumb span:active { color: var(--accent); }
#category-breadcrumb span.current { color: var(--text); font-weight: 600; }

/* ===== ROUTINES ===== */
.routine-card {
  background: var(--bg-card);
  border: 1px solid #1a1a25;
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 8px;
}

.routine-card h4 { margin-bottom: 10px; font-size: 0.95rem; }

.routine-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #1a1a15;
}

.routine-item:last-child { border-bottom: none; }

.routine-checkbox {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.routine-checkbox.checked { background: var(--green); border-color: var(--green); }
.routine-checkbox.checked::after { content: '✓'; color: white; font-size: 0.8rem; }

/* ===== MORE GRID ===== */
.more-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding-top: 12px;
}

.more-item {
  background: var(--bg-card);
  border: 1px solid #1a1a25;
  border-radius: var(--radius);
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  font-size: 2rem;
  transition: border-color 0.2s;
}

.more-item:active { border-color: var(--accent); }
.more-item span { display: block; font-size: 0.8rem; margin-top: 6px; color: var(--text-dim); }

/* ===== ACHIEVEMENTS ===== */
#achievements-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.ach-card {
  background: var(--bg-card);
  border: 1px solid #1a1a25;
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}

.ach-card.unlocked { border-color: var(--accent); }
.ach-card.locked { opacity: 0.3; }
.ach-card .ach-icon { font-size: 2rem; margin-bottom: 4px; }
.ach-card .ach-name { font-size: 0.8rem; font-weight: 700; }
.ach-card .ach-desc { font-size: 0.7rem; color: var(--text-dim); margin-top: 2px; }

/* ===== MODAL ===== */
#modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 200;
}

#modal-overlay.hidden { display: none; }

#modal {
  background: rgba(18, 18, 26, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 16px 16px 0 0;
  border-top: 1px solid rgba(99, 102, 241, 0.15);
  width: 100%;
  max-width: 500px;
  padding: 20px;
  max-height: 80dvh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

/* ===== LEVEL UP ===== */
#levelup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

#levelup-overlay.hidden { display: none; }

.levelup-box { text-align: center; animation: scaleIn 0.5s ease; }
.levelup-icon { font-size: 4rem; margin-bottom: 8px; }

.levelup-text {
  font-size: 2.2rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--accent), var(--purple), var(--yellow));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

@keyframes scaleIn { from { transform: scale(0.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ===== AUDIO FLOAT ===== */
.audio-float {
  position: fixed;
  bottom: calc(var(--nav-height) + 16px);
  right: 16px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  box-shadow: 0 4px 16px var(--accent-glow);
  z-index: 50;
  transition: transform 0.2s;
}

.audio-float:active { transform: scale(0.9); }
.audio-float.recording {
  background: linear-gradient(135deg, var(--red), #f87171);
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  50% { box-shadow: 0 0 0 12px rgba(239, 68, 68, 0); }
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-dim);
  font-size: 0.85rem;
  line-height: 1.6;
}

.empty-state::before {
  content: attr(data-icon);
  display: block;
  font-size: 2.5rem;
  margin-bottom: 12px;
  opacity: 0.4;
  filter: grayscale(0.3);
}

/* ===== ERROR STATE ===== */
.error-state {
  text-align: center;
  padding: 24px 16px;
  color: var(--red);
  font-size: 0.85rem;
}
.error-state p {
  margin-bottom: 10px;
}
.error-state .btn-secondary {
  font-size: 0.8rem;
  padding: 6px 16px;
}

/* ===== LOADING SPINNER ===== */
.section-loading {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 30px 16px;
}
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--bg-input);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ===== NAV BADGES ===== */
.nav-badge {
  position: absolute;
  top: 2px;
  right: 8px;
  background: var(--red);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  line-height: 16px;
  text-align: center;
  border-radius: 8px;
  padding: 0 4px;
  pointer-events: none;
}

/* ===== PULL TO REFRESH ===== */
.pull-indicator {
  text-align: center;
  padding: 10px;
  font-size: 0.8rem;
  color: var(--text-dim);
  opacity: 0;
  transition: opacity 0.15s ease;
}

/* ===== CONTENT PIPELINE ===== */
.pipeline-column { margin-bottom: 12px; }

.pipeline-header {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 6px 0;
  margin-bottom: 6px;
  border-bottom: 2px solid;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pipeline-card {
  background: var(--bg-card);
  border: 1px solid #1a1a25;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 4px;
  cursor: pointer;
}

.pipeline-card:active { border-color: var(--accent); }
.pipeline-card .entry-title { font-size: 0.85rem; }
.pipeline-card .entry-meta { font-size: 0.7rem; color: var(--text-dim); margin-top: 2px; }

/* ===== CALENDAR TOOLBAR ===== */
.cal-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.cal-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cal-nav .icon-btn { font-size: 1.4rem; padding: 4px 8px; }

#cal-title { font-weight: 700; font-size: 0.95rem; min-width: 120px; text-align: center; }

.cal-today-btn {
  background: var(--bg-input);
  border: 1px solid #1a1a25;
  color: var(--accent);
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 0.75rem;
  cursor: pointer;
}

.view-switcher { display: flex; gap: 4px; }

.vs-btn {
  width: 32px;
  height: 32px;
  background: var(--bg-input);
  border: 1px solid #1a1a25;
  border-radius: 6px;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.vs-btn.active { border-color: var(--accent); color: var(--accent); }

/* ===== CALENDAR GRID VIEW ===== */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.cal-grid-header {
  text-align: center;
  font-size: 0.65rem;
  color: var(--text-dim);
  padding: 4px 0;
  font-weight: 700;
}

.cal-grid-cell {
  aspect-ratio: 1;
  background: var(--bg-card);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 4px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s;
  position: relative;
}

.cal-grid-cell:active { border-color: var(--accent); }
.cal-grid-cell.empty { background: transparent; cursor: default; }
.cal-grid-cell.today { border-color: var(--accent); background: rgba(99, 102, 241, 0.1); }
.cal-grid-cell.weekend .cal-grid-num { color: var(--text-dim); }

.cal-grid-num { font-size: 0.8rem; font-weight: 600; }
.cal-grid-cell.today .cal-grid-num { color: var(--accent); }

.cal-grid-dots {
  display: flex;
  gap: 2px;
  margin-top: 2px;
}

.cal-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
}

/* ===== CALENDAR LIST VIEW ===== */
.cal-list-day {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #1a1a15;
}

.cal-list-day.today { background: rgba(99, 102, 241, 0.05); border-radius: 8px; padding: 10px; }

.cal-list-header {
  min-width: 44px;
  text-align: center;
  flex-shrink: 0;
}

.cal-list-dayname { display: block; font-size: 0.65rem; color: var(--text-dim); }
.cal-list-daynum { display: block; font-size: 1.1rem; font-weight: 800; }
.cal-list-day.today .cal-list-daynum { color: var(--accent); }

.cal-list-events { flex: 1; }

.cal-list-event {
  padding: 6px 10px;
  margin-bottom: 4px;
  border-radius: 6px;
  background: var(--bg-card);
  font-size: 0.85rem;
  cursor: pointer;
}

.cal-list-event:active { opacity: 0.7; }
.cal-list-time { color: var(--accent); font-weight: 700; margin-right: 6px; font-size: 0.8rem; }
.cal-list-empty { color: var(--text-dim); font-size: 0.75rem; padding: 6px 0; }

/* ===== CALENDAR POST-IT VIEW ===== */
.cal-postit-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.cal-postit {
  background: var(--bg-card);
  border: 1px solid #1a1a25;
  border-radius: 10px;
  padding: 12px;
  min-height: 80px;
}

.cal-postit.today { border-color: var(--accent); }

.postit-date {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-dim);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.postit-event { margin-bottom: 6px; cursor: pointer; }
.postit-time { font-size: 0.7rem; color: var(--accent); font-weight: 600; }
.postit-title { font-size: 0.85rem; }

/* ===== CONFIG / PERSONALIZACIÓN ===== */
.config-section {
  margin-bottom: 20px;
}

.config-section h3 {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.theme-swatch {
  border: 2px solid #2a2a2a;
  border-radius: 10px;
  padding: 10px 8px;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.2s, transform 0.1s;
}

.theme-swatch:active { transform: scale(0.95); }
.theme-swatch.active { border-width: 2px; }

.swatch-accent {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  margin: 0 auto 4px;
}

.swatch-name { font-size: 0.65rem; color: var(--text-dim); }

.config-toggle {
  display: flex;
  gap: 6px;
}

.color-pick { transition: transform 0.1s; }
.color-pick:active { transform: scale(0.85); }
.color-pick.selected { border: 2px solid white !important; }

/* ===== FINANCE ===== */

/* Sub-tabs */
.fin-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  padding: 3px;
  background: var(--bg-input);
  border-radius: 10px;
  overflow-x: auto;
}

.fin-tab {
  flex: 1;
  padding: 8px 6px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.fin-tab.active {
  background: var(--accent);
  color: white;
}

.fin-panel { animation: fadeIn 0.2s; }

/* Cards resumen */
.finance-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
  padding-top: 8px;
}

.finance-card {
  background: var(--bg-card);
  border: 1px solid #1a1a25;
  border-radius: var(--radius);
  padding: 14px 10px;
  text-align: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.finance-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.3;
}

.fin-label { display: block; font-size: 0.7rem; color: var(--text-dim); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 500; }
.fin-amount { font-size: 1rem; font-weight: 800; font-variant-numeric: tabular-nums; }

.finance-card.income .fin-amount { color: var(--green); }
.finance-card.expense .fin-amount { color: var(--red); }
.finance-card.balance.positive .fin-amount { color: var(--green); }
.finance-card.balance.negative .fin-amount { color: var(--red); }

/* Metricas clave */
.fin-metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.fin-metric {
  background: var(--bg-card);
  border: 1px solid #1a1a25;
  border-radius: 10px;
  padding: 12px;
}

.fin-metric-label {
  font-size: 0.65rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.fin-metric-value {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.fin-metric-value.positive { color: var(--green); }
.fin-metric-value.negative { color: var(--red); }
.fin-metric-value.warning { color: var(--yellow, #f59e0b); }
.fin-metric-sub {
  font-size: 0.65rem;
  color: var(--text-dim);
  margin-top: 2px;
}

/* Comparativa mes anterior */
.fin-compare {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  margin-top: 4px;
}

.fin-compare.up { color: var(--green); }
.fin-compare.down { color: var(--red); }

/* Grafico donut SVG */
.fin-chart-section {
  background: var(--bg-card);
  border: 1px solid #1a1a25;
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}

.fin-chart-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
}

.fin-donut-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
}

.fin-donut-svg {
  width: 110px;
  height: 110px;
  flex-shrink: 0;
}

.fin-donut-legend {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.fin-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
}

.fin-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.fin-legend-label { color: var(--text-dim); flex: 1; }
.fin-legend-value { font-weight: 700; color: var(--text); }

/* Grafico de barras tendencia */
.fin-bars-wrap {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 100px;
  padding-top: 8px;
}

.fin-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  height: 100%;
  justify-content: flex-end;
}

.fin-bar {
  width: 100%;
  border-radius: 4px 4px 0 0;
  min-height: 2px;
  transition: height 0.3s;
}

.fin-bar.income-bar { background: var(--green); opacity: 0.7; }
.fin-bar.expense-bar { background: var(--red); opacity: 0.7; }

.fin-bar-label {
  font-size: 0.6rem;
  color: var(--text-dim);
  text-transform: uppercase;
}

/* Lista de movimientos mejorada */
.fin-transaction {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: var(--bg-card);
  border: 1px solid #1a1a25;
  border-radius: 10px;
  margin-bottom: 6px;
  transition: border-color 0.2s;
}

.fin-transaction:active { border-color: var(--accent); }

.fin-tx-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  background: var(--bg-input);
  flex-shrink: 0;
}

.fin-tx-info { flex: 1; min-width: 0; }
.fin-tx-desc { font-size: 0.8rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fin-tx-meta { font-size: 0.65rem; color: var(--text-dim); margin-top: 2px; }

.fin-tx-amount { font-weight: 800; font-size: 0.85rem; flex-shrink: 0; }
.fin-tx-amount.income { color: var(--green); }
.fin-tx-amount.expense { color: var(--red); }

.fin-tx-delete {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 0.9rem;
  cursor: pointer;
  padding: 4px;
  opacity: 0.5;
}

.fin-tx-delete:hover { opacity: 1; color: var(--red); }

/* Acciones */
.fin-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.fin-actions .btn-primary,
.fin-actions .btn-secondary {
  flex: 1;
  font-size: 0.8rem;
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 10px 16px;
  border-radius: var(--radius);
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:active {
  background: var(--accent);
  color: white;
}

/* Portfolio / Inversiones */
.portfolio-summary-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.portfolio-card {
  background: var(--bg-card);
  border: 1px solid #1a1a25;
  border-radius: 10px;
  padding: 12px;
  text-align: center;
}

.portfolio-card .fin-metric-value { font-size: 0.95rem; }

.asset-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: var(--bg-card);
  border: 1px solid #1a1a25;
  border-radius: 10px;
  margin-bottom: 6px;
}

.asset-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  background: var(--bg-input);
  flex-shrink: 0;
}

.asset-info { flex: 1; min-width: 0; }
.asset-name { font-size: 0.8rem; font-weight: 600; }
.asset-detail { font-size: 0.65rem; color: var(--text-dim); margin-top: 2px; }

.asset-values { text-align: right; flex-shrink: 0; }
.asset-price { font-size: 0.8rem; font-weight: 700; }
.asset-gain { font-size: 0.65rem; font-weight: 600; }
.asset-gain.positive { color: var(--green); }
.asset-gain.negative { color: var(--red); }

/* Presupuestos */
.budget-item {
  background: var(--bg-card);
  border: 1px solid #1a1a25;
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 8px;
}

.budget-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.budget-cat {
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.budget-amounts {
  font-size: 0.7rem;
  color: var(--text-dim);
}

.budget-amounts span { font-weight: 700; color: var(--text); }

.budget-bar-track {
  width: 100%;
  height: 8px;
  background: var(--bg-input);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.budget-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
  background: var(--green);
}

.budget-bar-fill.warning { background: var(--yellow, #f59e0b); }
.budget-bar-fill.over { background: var(--red); }

.budget-pct {
  font-size: 0.65rem;
  color: var(--text-dim);
  margin-top: 4px;
  text-align: right;
}

.budget-pct.warning { color: var(--yellow, #f59e0b); }
.budget-pct.over { color: var(--red); font-weight: 700; }

.budget-delete {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 2px 6px;
}

.budget-delete:hover { color: var(--red); }

/* Scan ticket */
.scan-preview {
  width: 100%;
  max-height: 200px;
  object-fit: contain;
  border-radius: 10px;
  margin-bottom: 10px;
  background: var(--bg-input);
}

.scan-result {
  background: var(--bg-input);
  border-radius: 10px;
  padding: 12px;
  margin-top: 10px;
}

.scan-result-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 0.8rem;
  border-bottom: 1px solid #1a1a25;
}

.scan-result-row:last-child { border-bottom: none; }
.scan-result-label { color: var(--text-dim); }
.scan-result-value { font-weight: 600; }

.scan-items-list {
  max-height: 150px;
  overflow-y: auto;
  margin: 8px 0;
}

.scan-item {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  padding: 3px 0;
  color: var(--text-dim);
}

.scan-loading {
  text-align: center;
  padding: 30px;
  color: var(--accent);
  font-size: 0.85rem;
}

.spin-icon {
  display: inline-block;
  animation: spin 1s linear infinite;
}

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

/* ===== MESSAGING ===== */

/* Header */
.msg-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.msg-view-select {
  flex: 1;
  padding: 8px 12px;
  background: var(--bg-card);
  border: 1px solid #1a1a25;
  border-radius: 10px;
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
  outline: none;
}
.msg-view-select:focus { border-color: var(--accent); }

.msg-config-btn {
  width: 38px;
  height: 38px;
  background: var(--bg-card);
  border: 1px solid #1a1a25;
  border-radius: 10px;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s;
}
.msg-config-btn:active { border-color: var(--accent); }

/* Config panel */
.msg-config-panel {
  background: var(--bg-card);
  border: 1px solid #1a1a25;
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 10px;
  animation: fadeIn 0.2s ease;
}
.msg-panel-title {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

/* Account rows in config panel */
.msg-account-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg-input);
  border-radius: 8px;
  margin-bottom: 4px;
}
.msg-acct-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}
.msg-acct-name {
  flex: 1;
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.msg-acct-status {
  font-size: 0.7rem;
  font-weight: 700;
}
.msg-acct-status.on { color: var(--green); }
.msg-acct-status.pending { color: var(--yellow); }
.msg-acct-status.off { color: var(--text-dim); }
.msg-acct-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 2px 6px;
  transition: color 0.2s;
}
.msg-acct-btn:active { color: var(--accent); }
.msg-no-accounts {
  font-size: 0.8rem;
  color: var(--text-dim);
  padding: 4px 0;
}

/* Add platform buttons grid */
.msg-panel-add-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.msg-add-platform-btn {
  padding: 7px 14px;
  background: var(--bg-input);
  border: 1px dashed #2a2a3a;
  border-radius: 8px;
  color: var(--plt-color, var(--accent));
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.2s, background 0.2s;
}
.msg-add-platform-btn:active {
  background: var(--bg-hover);
  border-style: solid;
  border-color: var(--plt-color, var(--accent));
}
.msg-all-connected {
  font-size: 0.75rem;
  color: var(--green);
}

/* Thread list */
.msg-thread {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: var(--bg-card);
  border: 1px solid #1a1a25;
  border-radius: 10px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.15s;
}
.msg-thread:active { border-color: var(--accent); background: var(--bg-hover); }
.msg-thread.unread { border-left: 3px solid var(--accent); }

.msg-platform-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.msg-thread-content { flex: 1; min-width: 0; }

.msg-thread-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1px;
}
.msg-thread-from { font-weight: 600; font-size: 0.8rem; color: var(--text-dim); }
.msg-thread.unread .msg-thread-from { color: var(--text); }
.msg-thread-time { font-size: 0.65rem; color: var(--text-dim); }

.msg-thread-subject {
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.msg-thread-snippet {
  font-size: 0.75rem;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.msg-unread-badge {
  background: var(--accent);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  flex-shrink: 0;
}

/* Thread detail */
.msg-subject-bar {
  font-weight: 700;
  font-size: 1rem;
  padding: 8px 0;
  border-bottom: 1px solid #1a1a25;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.msg-messages { max-height: 55vh; overflow-y: auto; margin-bottom: 12px; }

.msg-message {
  padding: 10px 12px;
  background: var(--bg-card);
  border: 1px solid #1a1a25;
  border-radius: 10px;
  margin-bottom: 6px;
}
.msg-message.from-me {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.05);
  margin-left: 16px;
}

.msg-msg-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}
.msg-msg-from { font-weight: 600; font-size: 0.8rem; }
.msg-message.from-me .msg-msg-from { color: var(--accent); }
.msg-msg-time { font-size: 0.7rem; color: var(--text-dim); }

.msg-msg-body {
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text);
  white-space: pre-wrap;
  word-wrap: break-word;
}

.msg-actions { margin-top: 8px; }
.msg-reply-area { margin-top: 10px; }

/* Summary card */
.msg-summary-card {
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: 12px;
  margin: 10px 0;
}
.msg-summary-title { font-weight: 700; font-size: 0.85rem; margin-bottom: 6px; color: var(--accent); }
.msg-summary-text { font-size: 0.85rem; line-height: 1.5; }

/* Summary bar */
.msg-summary-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid #1a1a25;
  border-radius: 10px;
  margin-bottom: 8px;
}
.msg-summary-stat { text-align: center; }
.msg-stat-num { display: block; font-size: 1.2rem; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }
.msg-stat-label { font-size: 0.65rem; color: var(--text-dim); }

.msg-summarize-all {
  margin-left: auto;
  background: var(--accent);
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}
.msg-summarize-all:active { opacity: 0.8; }

/* AI loading */
.msg-ai-loading {
  text-align: center;
  padding: 12px;
  color: var(--accent);
  font-size: 0.85rem;
  animation: blink 1.4s infinite;
}

/* Priority analysis */
.msg-analysis-header {
  background: var(--bg-card);
  border: 1px solid #1a1a25;
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
}
.msg-analysis-summary { font-size: 0.9rem; margin-bottom: 8px; line-height: 1.4; }
.msg-analysis-counts { display: flex; gap: 6px; }

.msg-count-badge {
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 700;
}
.msg-count-badge.urgent { background: rgba(239,68,68,0.15); color: var(--red); }
.msg-count-badge.important { background: rgba(245,158,11,0.15); color: var(--yellow); }
.msg-count-badge.normal { background: rgba(16,185,129,0.15); color: var(--green); }

.msg-priority-section { margin-bottom: 12px; }

.msg-priority-label {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 4px 0;
  margin-bottom: 6px;
}
.msg-priority-label.urgent { color: var(--red); }
.msg-priority-label.important { color: var(--yellow); }
.msg-priority-label.normal { color: var(--green); }

.msg-priority-card {
  background: var(--bg-card);
  border: 1px solid #1a1a25;
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 6px;
  transition: opacity 0.3s;
}

.msg-priority-header {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.msg-priority-from { font-weight: 600; font-size: 0.85rem; }

.msg-priority-subject {
  font-size: 0.85rem;
  margin: 4px 0;
  cursor: pointer;
}

.msg-priority-reason {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-style: italic;
  margin-bottom: 4px;
}

.msg-priority-suggestion {
  font-size: 0.8rem;
  color: var(--accent);
  margin-bottom: 8px;
  padding: 4px 8px;
  background: rgba(99,102,241,0.08);
  border-radius: 6px;
}

.msg-priority-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.msg-action-chip {
  padding: 5px 10px;
  background: var(--bg-input);
  border: 1px solid #2a2a3a;
  border-radius: 8px;
  color: var(--text-dim);
  font-size: 0.7rem;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.msg-action-chip:active { border-color: var(--accent); color: var(--accent); }

.hidden { display: none !important; }

/* ===== CALENDAR ENHANCEMENTS ===== */

/* Grid cells: hover effect */
.cal-grid-cell:not(.empty):hover {
  border-color: rgba(var(--accent-rgb, 99, 102, 241), 0.4);
  background: var(--bg-hover);
  transform: scale(1.05);
  z-index: 2;
}

/* Today glow */
.cal-grid-cell.today {
  box-shadow: 0 0 12px var(--accent-glow), inset 0 0 8px rgba(99, 102, 241, 0.08);
}

/* Bigger, more visible dots */
.cal-dot {
  width: 6px;
  height: 6px;
  box-shadow: 0 0 4px currentColor;
}

/* List view: elegant separators */
.cal-list-day {
  border-bottom: 1px solid rgba(255,255,255,0.04);
  position: relative;
}
.cal-list-day::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 56px;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, rgba(99,102,241,0.15), transparent);
}
.cal-list-day:last-child::after { display: none; }

/* Post-it: real note shadow */
.cal-postit {
  box-shadow: 4px 4px 12px rgba(0,0,0,0.4), 1px 1px 3px rgba(0,0,0,0.2);
  transition: transform 0.2s, box-shadow 0.2s;
}
.cal-postit:hover {
  transform: translateY(-2px) rotate(-0.5deg);
  box-shadow: 6px 6px 18px rgba(0,0,0,0.5), 2px 2px 6px rgba(0,0,0,0.3);
}

/* Toolbar buttons: more integrated */
.cal-nav .icon-btn {
  background: var(--bg-input);
  border: 1px solid #1a1a25;
  border-radius: 8px;
  transition: all 0.2s;
}
.cal-nav .icon-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.cal-today-btn {
  transition: all 0.2s;
}
.cal-today-btn:hover {
  border-color: var(--accent);
  background: rgba(99,102,241,0.1);
}
.vs-btn {
  transition: all 0.2s;
}
.vs-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Calendar month transition */
#calendar-container {
  animation: calFade 0.3s ease;
}
@keyframes calFade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== CONTENT PIPELINE KANBAN ===== */
.pipeline-column {
  background: rgba(255,255,255,0.02);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 10px;
  border: 1px solid rgba(255,255,255,0.04);
}

.pipeline-header {
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 8px;
  background: rgba(255,255,255,0.03);
}

.pipeline-card {
  border-left: 3px solid var(--pipeline-color, var(--accent));
  transition: all 0.2s;
}
.pipeline-card:hover {
  border-color: var(--pipeline-color, var(--accent));
  background: var(--bg-hover);
  transform: translateX(3px);
}

/* ===== CONTENT ACCOUNT CARDS ===== */
.account-card-enhanced {
  display: flex;
  align-items: center;
  gap: 12px;
}
.account-platform-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

/* ===== PROJECTS PROGRESS ===== */
.project-card-enhanced {
  border-left: 4px solid var(--project-color, var(--accent));
}
.project-progress-bar {
  height: 6px;
  background: var(--bg-input);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 8px;
}
.project-progress-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--project-color, var(--accent)), var(--purple));
  transform-origin: left;
  animation: progressGrow 1s ease forwards;
  will-change: transform;
}
@keyframes progressGrow {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}
.project-progress-text {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-top: 4px;
}

/* ===== CRM STATS ===== */
.crm-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}
.crm-stat-card {
  background: var(--bg-card);
  border: 1px solid #1a1a25;
  border-radius: var(--radius);
  padding: 14px 10px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.crm-stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--stat-color, var(--accent));
}
.crm-stat-icon {
  font-size: 1.3rem;
  margin-bottom: 4px;
}
.crm-stat-num {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--stat-color, var(--accent));
  font-variant-numeric: tabular-nums;
}
.crm-stat-label {
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-top: 2px;
}

/* CRM Deal Pipeline */
.deal-pipeline-card {
  background: var(--bg-card);
  border: 1px solid #1a1a25;
  border-left: 4px solid var(--deal-color, var(--accent));
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: all 0.2s;
}
.deal-pipeline-card:hover {
  border-color: var(--deal-color, var(--accent));
  background: var(--bg-hover);
}
.deal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.deal-title { font-weight: 600; font-size: 0.9rem; }
.deal-amount { font-weight: 800; font-size: 0.85rem; color: var(--green); }
.deal-meta { font-size: 0.75rem; color: var(--text-dim); }
.deal-stage-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.65rem;
  font-weight: 700;
  background: rgba(99,102,241,0.1);
  color: var(--deal-color, var(--accent));
}

/* CRM Client Avatars */
.client-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid #1a1a25;
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: border-color 0.2s;
}
.client-card:hover { border-color: var(--accent); }
.client-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 800;
  color: white;
  flex-shrink: 0;
}
.client-info { flex: 1; }
.client-name { font-weight: 600; font-size: 0.9rem; }
.client-meta { font-size: 0.75rem; color: var(--text-dim); }

/* ===== ALEJANDRIA ENHANCEMENTS ===== */
.kb-branch-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid #1a1a25;
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: all 0.2s;
}
.kb-branch-card:hover {
  border-color: var(--accent);
  background: var(--bg-hover);
}
.kb-branch-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  background: rgba(99,102,241,0.1);
  flex-shrink: 0;
}
.kb-branch-info { flex: 1; }
.kb-branch-name { font-weight: 600; font-size: 0.9rem; }
.kb-branch-count { font-size: 0.75rem; color: var(--text-dim); }
.kb-branch-arrow { color: var(--text-dim); font-size: 1.1rem; }

/* Alejandria search focus */
#kb-search {
  transition: all 0.3s;
}
#kb-search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow), 0 4px 12px rgba(0,0,0,0.2);
  background: var(--bg-card);
}

/* Search result match highlight */
.kb-match-highlight {
  background: rgba(99, 102, 241, 0.2);
  color: var(--accent);
  padding: 1px 3px;
  border-radius: 3px;
  font-weight: 600;
}

/* ===== ARTICLE ===== */
.article-body {
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--text);
  overflow-y: auto;
}

.article-body h2 { font-size: 1.1rem; margin: 16px 0 8px; color: var(--accent); }
.article-body h3 { font-size: 0.95rem; margin: 14px 0 6px; color: var(--purple); }
.article-body h4 { font-size: 0.85rem; margin: 10px 0 4px; }
.article-body strong { color: var(--text); }

.md-list-item { padding: 2px 0; }
.md-table-row { font-size: 0.75rem; font-family: monospace; padding: 2px 0; color: var(--text-dim); }

#knowledge-search { margin-bottom: 10px; }

/* ===== SKELETON LOADING ===== */
.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, #1f1f2a 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
}

.skeleton-thread {
  display: flex;
  gap: 10px;
  padding: 12px;
  background: var(--bg-card);
  border-radius: 10px;
  margin-bottom: 6px;
}

.skeleton-avatar { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; }
.skeleton-content { flex: 1; }
.skeleton-line { height: 10px; margin-bottom: 6px; border-radius: 4px; }
.skeleton-line.short { width: 40%; }
.skeleton-line.medium { width: 75%; }
.skeleton-line.long { width: 90%; }

@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #222; border-radius: 4px; transition: background 0.2s; }
::-webkit-scrollbar-thumb:hover { background: #333; }

/* ===== TOAST NOTIFICATIONS ===== */
.liv-toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-card);
  color: var(--text);
  padding: 10px 20px;
  border-radius: 12px;
  font-size: 13px;
  z-index: 9999;
  opacity: 0;
  transition: all 0.3s ease;
  border: 1px solid rgba(99, 102, 241, 0.3);
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}
.liv-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.liv-toast-error {
  border-color: var(--red);
  color: var(--red);
}
.liv-toast-success {
  border-color: var(--green);
}

/* ===== PLUGINS SYSTEM ===== */
.plugins-filter-bar {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 8px 0 12px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.plugins-filter-bar::-webkit-scrollbar { display: none; }

.plugin-filter-btn {
  background: var(--bg-card);
  border: 1px solid transparent;
  color: var(--text-dim);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s;
}
.plugin-filter-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.plugin-filter-btn:hover:not(.active) {
  border-color: var(--accent);
  color: var(--text);
}

.plugins-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 16px 0 8px;
}
.plugins-section-title:first-child { margin-top: 0; }

.plugins-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.plugin-card {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.04);
  border-radius: var(--radius);
  padding: 14px;
  transition: all 0.25s;
}
.plugin-card.plugin-active {
  border-color: rgba(99, 102, 241, 0.25);
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.06);
}
.plugin-card:hover {
  border-color: rgba(99, 102, 241, 0.3);
}

.plugin-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.plugin-icon {
  font-size: 28px;
  line-height: 1;
}

.plugin-toggle-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.plugin-core-badge {
  font-size: 10px;
  background: var(--accent);
  color: #fff;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.plugin-toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}
.plugin-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}
.plugin-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg-input);
  border-radius: 24px;
  transition: 0.3s;
}
.plugin-slider::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: var(--text-dim);
  border-radius: 50%;
  transition: 0.3s;
}
.plugin-toggle input:checked + .plugin-slider {
  background: var(--accent);
}
.plugin-toggle input:checked + .plugin-slider::before {
  transform: translateX(20px);
  background: #fff;
}
.plugin-toggle input:disabled + .plugin-slider {
  opacity: 0.5;
  cursor: not-allowed;
}

.plugin-card-body {}

.plugin-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.plugin-desc {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.4;
  margin-bottom: 10px;
}

.plugin-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.plugin-cat-tag {
  font-size: 11px;
  background: rgba(99, 102, 241, 0.1);
  color: var(--accent);
  padding: 3px 10px;
  border-radius: 12px;
}

.plugin-tables {
  font-size: 11px;
  color: var(--text-dim);
}

/* ===== HOME BLOCKS SYSTEM ===== */
#home-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  flex-shrink: 0;
}

#home-header-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

#home-day-title {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

#home-day-date {
  font-size: 0.75rem;
  color: var(--text-dim);
}

#home-edit-btn {
  font-size: 1.1rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid rgba(99, 102, 241, 0.15);
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

#home-edit-btn:active {
  background: var(--accent);
  color: white;
}

/* ===== WIDGET GRID SYSTEM ===== */
.widget-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding: 8px 0;
  position: relative;
  z-index: 2;
  transition: gap 0.3s ease;
}

@media (min-width: 769px) {
  .widget-grid { grid-template-columns: repeat(4, 1fr); }
  .widget.large { grid-column: span 4; }
}

/* Edit mode overlay — dark backdrop behind widgets */
.edit-mode-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 1;
  animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Widget base */
.widget {
  background: linear-gradient(145deg, var(--bg-card) 0%, rgba(99, 102, 241, 0.03) 100%);
  border: 1px solid #1a1a25;
  border-radius: 14px;
  transition: transform 0.3s ease, box-shadow 0.3s ease, opacity 0.3s ease, grid-column 0.3s ease, border-color 0.3s ease;
  position: relative;
  cursor: grab;
  animation: widgetAppear 0.3s ease backwards;
  -webkit-user-select: none;
  user-select: none;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.widget::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.35;
  z-index: 2;
}

.widget:hover {
  border-color: rgba(99, 102, 241, 0.25);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

/* Widget inner — wraps content, slides for swipe */
.widget-inner {
  padding: 14px;
  position: relative;
  z-index: 1;
  background: inherit;
  border-radius: inherit;
  will-change: transform;
}

.widget:nth-child(1) { animation-delay: 0s; }
.widget:nth-child(2) { animation-delay: 0.04s; }
.widget:nth-child(3) { animation-delay: 0.08s; }
.widget:nth-child(4) { animation-delay: 0.12s; }
.widget:nth-child(5) { animation-delay: 0.16s; }
.widget:nth-child(6) { animation-delay: 0.2s; }
.widget:nth-child(7) { animation-delay: 0.24s; }
.widget:nth-child(8) { animation-delay: 0.28s; }

@keyframes widgetAppear {
  from { opacity: 0; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1); }
}

/* Widget sizes */
.widget.w1h1 { grid-column: span 1; }
.widget.w2h1 { grid-column: span 2; }
.widget.w1h2 { grid-column: span 1; grid-row: span 2; }
.widget.w2h2 { grid-column: span 2; grid-row: span 2; }
/* Legacy size compat */
.widget.small { grid-column: span 1; }
.widget.medium { grid-column: span 2; }
.widget.large { grid-column: span 2; min-height: 200px; }

/* Swipe action layer (behind widget-inner) */
.widget-swipe-action {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 120px;
  background: var(--red, #ef4444);
  border-radius: 0 14px 14px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 0;
}

.swipe-hide-label {
  color: white;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Widget disabled */
.widget.disabled { opacity: 0.2; }

/* Dragging state */
.widget.dragging {
  transform: scale(1.03);
  box-shadow: 0 8px 24px var(--accent-glow);
  z-index: 100;
  cursor: grabbing;
}

/* Drag origin (dimmed original) */
.widget.drag-origin {
  opacity: 0.25;
}

/* Touch drag clone */
.widget.touch-clone {
  position: fixed;
  z-index: 200;
  pointer-events: none;
  opacity: 0.9;
  transform: scale(1.05);
  box-shadow: 0 12px 40px rgba(99, 102, 241, 0.45);
  transition: none;
  border: 2px solid var(--accent, #6366f1);
}

/* Drop placeholder — clear dashed border */
.widget-drop-placeholder {
  border: 2px dashed rgba(99, 102, 241, 0.5);
  border-radius: 14px;
  background: rgba(99, 102, 241, 0.08);
  min-height: 60px;
  transition: all 0.2s ease;
  animation: placeholderPulse 1s ease-in-out infinite alternate;
}

.widget-drop-placeholder.w1h1 { grid-column: span 1; }
.widget-drop-placeholder.w2h1 { grid-column: span 2; }
.widget-drop-placeholder.w1h2 { grid-column: span 1; grid-row: span 2; }
.widget-drop-placeholder.w2h2 { grid-column: span 2; grid-row: span 2; }
.widget-drop-placeholder.small { grid-column: span 1; }
.widget-drop-placeholder.medium { grid-column: span 2; }
.widget-drop-placeholder.large { grid-column: span 2; min-height: 200px; }

@keyframes placeholderPulse {
  from { background: rgba(99, 102, 241, 0.05); }
  to { background: rgba(99, 102, 241, 0.12); }
}

/* Widget header */
.widget-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  font-size: 0.75rem;
  color: var(--text-dim);
}

.widget-icon {
  font-size: 0.9rem;
}

.widget-title {
  font-weight: 500;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex: 1;
  color: var(--text-dim);
}

.widget-body {
  font-size: 0.85rem;
}

/* === Small widget: compact layout === */
.widget.small .widget-header {
  margin-bottom: 6px;
}

.widget.small .widget-body-compact {
  display: flex;
  align-items: center;
  gap: 8px;
}

.widget.small .widget-body-compact .compact-value {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.widget.small .widget-body-compact .compact-label {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  font-weight: 500;
}

.widget.small .widget-body-detail,
.widget.small .widget-body-full {
  display: none;
}

/* === Medium widget: detail layout === */
.widget.medium .widget-body-compact .compact-value {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text);
}

.widget.medium .widget-body-full {
  display: none;
}

/* === Large widget: full content === */
.widget.large .widget-body-compact {
  display: none;
}

.widget.large .widget-body-detail {
  display: none;
}

/* ===== EDIT MODE ===== */
.widget.editing {
  animation: wobble 0.3s ease-in-out infinite alternate;
  cursor: grab;
  z-index: 3;
}

/* Header widget (character) should NOT wobble in edit mode */
.widget.editing[data-widget-id="character"] {
  animation: none;
}

@keyframes wobble {
  from { transform: rotate(-0.5deg); }
  to { transform: rotate(0.5deg); }
}

/* Remove button (X) — larger touch target */
.widget-remove {
  position: absolute;
  top: -8px;
  left: -8px;
  width: 28px;
  height: 28px;
  background: var(--red, #ef4444);
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: white;
  font-weight: 900;
  cursor: pointer;
  z-index: 10;
  border: 2px solid var(--bg);
  line-height: 1;
  transition: transform 0.15s;
}

.widget-remove:active {
  transform: scale(1.2);
}

.widget.editing .widget-remove {
  display: flex;
}

/* Size buttons — replaces tiny resize handle */
.widget-size-btns {
  display: flex;
  gap: 4px;
  margin-top: 8px;
  justify-content: center;
}

.size-btn {
  width: 32px;
  height: 26px;
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 6px;
  background: rgba(99, 102, 241, 0.08);
  color: var(--text-dim);
  font-size: 0.65rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
  line-height: 26px;
  text-align: center;
}

.size-btn.active {
  background: var(--accent, #6366f1);
  color: white;
  border-color: var(--accent, #6366f1);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

.size-btn:active {
  transform: scale(0.92);
}

/* Widget toggle (top-left circle) */
.widget-toggle { position: absolute; top: 8px; left: 8px; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--accent); background: transparent; cursor: pointer; z-index: 5; padding: 0; }
.widget-toggle.active { background: var(--accent); }

/* Widget resize handle (bottom-right corner) */
.widget-resize-handle { position: absolute; bottom: 4px; right: 4px; font-size: 10px; color: var(--text-dim); opacity: 0.3; cursor: nwse-resize; z-index: 5; -webkit-user-select: none; user-select: none; }
.widget-resize-handle:hover { opacity: 0.8; }

/* Old resize handle — hidden */
.widget-resize {
  display: none;
}

/* "Done" button — fixed at bottom in edit mode */
.edit-done-btn {
  position: fixed;
  bottom: 72px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  background: var(--accent, #6366f1);
  color: white;
  border: none;
  border-radius: 24px;
  padding: 12px 36px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.5);
  transition: transform 0.15s, box-shadow 0.15s;
  animation: slideUp 0.3s ease;
}

.edit-done-btn:active {
  transform: translateX(-50%) scale(0.95);
}

@keyframes slideUp {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Hidden widgets panel — card style */
.hidden-widgets-panel {
  margin-top: 12px;
  padding: 14px;
  background: var(--bg-card);
  border: 1px dashed rgba(99, 102, 241, 0.25);
  border-radius: 14px;
  position: relative;
  z-index: 3;
}

.hidden-widgets-panel h4 {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.hidden-widgets-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

@media (min-width: 769px) {
  .hidden-widgets-list { grid-template-columns: repeat(4, 1fr); }
}

/* Hidden widget card (replaces chip) */
.hidden-widget-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid rgba(99, 102, 241, 0.12);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
}

.hidden-widget-card:hover {
  background: rgba(99, 102, 241, 0.15);
  border-color: var(--accent);
  transform: scale(1.02);
}

.hidden-widget-card:active {
  transform: scale(0.97);
}

.hw-card-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}

.hw-card-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  flex: 1;
}

.hw-card-add {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent, #6366f1);
  color: white;
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Widget remove animation — shrink & disappear */
.widget.removing {
  animation: widgetRemove 0.3s ease forwards;
}

@keyframes widgetRemove {
  0% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0.5); max-height: 0; padding: 0; margin: 0; overflow: hidden; }
}

/* Widget add animation — bounce in */
.widget.adding {
  animation: widgetBounceIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes widgetBounceIn {
  0% { opacity: 0; transform: scale(0.3); }
  60% { opacity: 1; transform: scale(1.08); }
  100% { opacity: 1; transform: scale(1); }
}

/* Reset button */
.home-reset-btn {
  grid-column: 1 / -1;
  margin-top: 4px;
  position: relative;
  z-index: 3;
}

/* ===== TIMELINE BLOCK ===== */
.timeline-list {
  position: relative;
  padding-left: 16px;
}

.timeline-list::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: rgba(99, 102, 241, 0.15);
  border-radius: 2px;
}

.timeline-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  position: relative;
  font-size: 0.85rem;
}

.timeline-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  position: absolute;
  left: -16px;
  box-shadow: 0 0 8px var(--accent-glow);
}

.timeline-dot-task {
  background: var(--purple);
  box-shadow: 0 0 8px rgba(139, 92, 246, 0.3);
}

.timeline-dot-task.done {
  background: var(--green);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.3);
}

.timeline-time {
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 700;
  min-width: 36px;
}

.timeline-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timeline-event .timeline-title {
  color: var(--text);
}

.timeline-task.done .timeline-title {
  text-decoration: line-through;
  opacity: 0.4;
}

.timeline-xp {
  font-size: 0.7rem;
  color: var(--purple);
  font-weight: 800;
  white-space: nowrap;
}

.timeline-check {
  width: 24px;
  height: 24px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  color: transparent;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s;
}

.timeline-check:active {
  background: var(--green);
  border-color: var(--green);
  color: white;
  transform: scale(0.85);
}

/* ===== ROUTINE INLINE BLOCK ===== */
.routine-inline-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.routine-inline-name {
  font-weight: 700;
  font-size: 0.9rem;
}

.routine-inline-progress {
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 700;
}

.routine-progress-bar {
  width: 100%;
  height: 6px;
  background: var(--bg-input);
  border-radius: 3px;
  margin-bottom: 10px;
  overflow: hidden;
}

.routine-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--green));
  border-radius: 3px;
  transition: width 0.4s ease;
}

.routine-inline-items {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.routine-inline-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 0.85rem;
  transition: all 0.2s;
}

.routine-inline-item.checked {
  opacity: 0.45;
}

.routine-inline-item.checked span {
  text-decoration: line-through;
}

.routine-inline-check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  color: white;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s;
}

.routine-inline-check.checked {
  background: var(--green);
  border-color: var(--green);
}

/* ===== MINI CALENDAR BLOCK ===== */
.mini-calendar {
  display: flex;
  justify-content: space-between;
  gap: 2px;
}

.mini-cal-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 2px;
  border-radius: 8px;
  flex: 1;
  transition: all 0.2s;
}

.mini-cal-day.today {
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.mini-cal-label {
  font-size: 0.6rem;
  color: var(--text-dim);
  font-weight: 600;
}

.mini-cal-num {
  font-size: 0.85rem;
  font-weight: 700;
}

.mini-cal-day.today .mini-cal-num {
  color: var(--accent);
}

.mini-cal-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

/* ===== MESSAGES BLOCK ===== */
.block-messages-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  cursor: pointer;
}

.msg-platform-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.msg-platform-icon {
  font-size: 1.1rem;
}

.msg-platform-count {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-dim);
}

.msg-platform-count.has-unread {
  color: var(--accent);
}

.msg-total {
  grid-column: 1 / -1;
  text-align: center;
  font-size: 0.7rem;
  color: var(--accent);
  font-weight: 600;
  margin-top: 2px;
}

.msg-total.dim {
  color: var(--text-dim);
}

/* ===== FINANCE BLOCK ===== */
.block-finance {
  text-align: center;
  cursor: pointer;
}

.finance-balance {
  font-size: 1.3rem;
  font-weight: 900;
}

.finance-balance.positive {
  color: var(--green);
}

.finance-balance.negative {
  color: var(--red);
}

.finance-label {
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-top: 2px;
}

.finance-detail {
  font-size: 0.65rem;
  color: var(--text-dim);
  margin-top: 4px;
}

/* ===== CONTENT BLOCK ===== */
.block-content-summary {
  text-align: center;
  cursor: pointer;
}

.content-count {
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--accent);
}

.content-label {
  font-size: 0.7rem;
  color: var(--text-dim);
}

.content-accounts {
  font-size: 0.65rem;
  color: var(--text-dim);
  margin-top: 4px;
}

/* ===== PROJECTS BLOCK ===== */
.block-project {
  cursor: pointer;
}

.project-name {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-progress-bar {
  width: 100%;
  height: 5px;
  background: var(--bg-input);
  border-radius: 3px;
  overflow: hidden;
}

.project-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.3s;
}

.project-pct {
  font-size: 0.7rem;
  color: var(--accent);
  font-weight: 700;
  margin-top: 4px;
  text-align: right;
}

/* ===== CRM BLOCK ===== */
.block-crm {
  cursor: pointer;
  text-align: center;
}

.crm-value {
  font-size: 0.95rem;
  font-weight: 700;
}

.crm-pipeline {
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-top: 2px;
}

/* ===== TIP BLOCK ===== */
.block-tip {
  cursor: default;
}

.tip-text {
  font-size: 0.85rem;
  font-weight: 600;
}

.tip-summary {
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-top: 4px;
  line-height: 1.4;
}

/* ===== ACHIEVEMENTS BLOCK ===== */
.block-achievement {
  display: flex;
  align-items: center;
  gap: 8px;
}

.achievement-icon {
  font-size: 1.4rem;
}

.achievement-info {
  flex: 1;
  min-width: 0;
}

.achievement-name {
  font-size: 0.8rem;
  font-weight: 700;
}

.achievement-desc {
  font-size: 0.65rem;
  color: var(--text-dim);
}

/* ===== CHARACTER BLOCK ===== */
.block-character-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
}

.block-char-info {
  flex: 1;
}

.block-char-level {
  font-size: 1rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.block-xp-bar {
  width: 100%;
  height: 5px;
  background: var(--bg-input);
  border-radius: 3px;
  margin: 4px 0;
  overflow: hidden;
}

.block-xp-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--purple));
  border-radius: 3px;
  transition: width 0.4s;
}

.block-char-xp span {
  font-size: 0.65rem;
  color: var(--text-dim);
}

.block-char-streak {
  font-size: 0.75rem;
  color: var(--yellow);
  margin-top: 2px;
}

.block-char-msg {
  font-size: 0.8rem;
  color: var(--text-dim);
  font-style: italic;
  margin-top: 4px;
}

.block-missions-counter {
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 8px;
}

.empty-state.small {
  font-size: 0.75rem;
}

/* ===== HP BAR ===== */
.hp-bar {
  margin-top: 10px;
}

.hp-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.hp-bar-bg {
  width: 100%;
  height: 8px;
  background: var(--bg-input);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.hp-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1), background 0.3s ease;
  background: var(--green);
}

.hp-bar-fill.hp-medium {
  background: var(--yellow);
}

.hp-bar-fill.hp-low {
  background: var(--red);
  animation: hpPulse 1s ease-in-out infinite;
}

@keyframes hpPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.hp-warning {
  font-size: 0.7rem;
  color: var(--red);
  margin-top: 4px;
  min-height: 16px;
}

/* ===== HP DAMAGE OVERLAY ===== */
#hp-damage-overlay {
  position: fixed;
  inset: 0;
  background: rgba(239, 68, 68, 0.25);
  z-index: 998;
  pointer-events: none;
  animation: damageFlash 0.6s ease forwards;
}

#hp-damage-overlay.hidden {
  display: none;
}

@keyframes damageFlash {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

/* ===== LEVEL DOWN OVERLAY ===== */
#leveldown-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

#leveldown-overlay.hidden {
  display: none;
}

.leveldown-box {
  text-align: center;
  animation: scaleIn 0.5s ease;
}

.leveldown-icon {
  font-size: 4rem;
  margin-bottom: 8px;
}

.leveldown-text {
  font-size: 1.6rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--red), #ff6b6b, var(--yellow));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ===== POMODORO INDICATOR (top bar) ===== */
#pomodoro-indicator {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--red);
  cursor: pointer;
  animation: pomPulse 2s ease-in-out infinite;
  white-space: nowrap;
}

#pomodoro-indicator.hidden {
  display: none;
}

@keyframes pomPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ===== POMODORO BUTTON ===== */
.pomodoro-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.5px solid var(--accent);
  background: transparent;
  color: var(--accent);
  font-size: 0.7rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
}

.pomodoro-btn:active {
  background: var(--accent);
  color: white;
  transform: scale(0.9);
}

/* ===== POMODORO MODAL ===== */
#pomodoro-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

#pomodoro-modal.hidden {
  display: none;
}

.pomodoro-modal-content {
  text-align: center;
  padding: 32px 24px;
  width: 90%;
  max-width: 340px;
}

.pomodoro-modal-title {
  font-size: 1rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-dim);
  margin-bottom: 16px;
}

.pomodoro-task-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 28px;
  min-height: 1.4em;
}

.pomodoro-timer-ring {
  margin: 0 auto 24px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  border: 3px solid var(--green);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: border-color 0.5s ease;
}

.pomodoro-timer-ring.pom-medium {
  border-color: var(--yellow);
}

.pomodoro-timer-ring.pom-low {
  border-color: var(--red);
  animation: pomRingPulse 1.5s ease-in-out infinite;
}

@keyframes pomRingPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.3); }
  50% { box-shadow: 0 0 20px 4px rgba(239, 68, 68, 0.2); }
}

.pomodoro-timer {
  font-size: 2.8rem;
  font-weight: 900;
  font-family: 'SF Mono', 'Fira Code', monospace;
  color: var(--text);
  line-height: 1;
}

.pomodoro-timer-sub {
  font-size: 0.85rem;
  color: var(--text-dim);
  font-family: 'SF Mono', 'Fira Code', monospace;
}

.pomodoro-stats-line {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 24px;
}

.pomodoro-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 16px;
}

.pomodoro-action-btn {
  padding: 10px 24px;
  border-radius: 12px;
  border: 1px solid rgba(99, 102, 241, 0.3);
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.pomodoro-action-btn:active {
  transform: scale(0.95);
  background: var(--accent);
  color: white;
}

.pomodoro-action-btn.pomodoro-cancel {
  border-color: rgba(239, 68, 68, 0.3);
  color: var(--red);
}

.pomodoro-minimize-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 0.8rem;
  cursor: pointer;
  text-decoration: underline;
}

.pomodoro-complete-anim {
  animation: pomComplete 0.6s ease;
}

@keyframes pomComplete {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* ===== POMODORO STATS BLOCK ===== */
.pomodoro-stats-home {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.04);
}

/* ===== DESKTOP (>500px) ===== */
@media (min-width: 501px) {
  #app {
    border-left: 1px solid #1a1a25;
    border-right: 1px solid #1a1a25;
  }
  .plugins-cards {
    grid-template-columns: 1fr 1fr;
  }
}

/* Auth Screen */
.auth-container {
  width: 90%;
  max-width: 360px;
  text-align: center;
}
.auth-logo {
  font-size: 2rem;
  font-weight: 900;
  color: var(--accent, #6366f1);
  margin-bottom: 2rem;
  letter-spacing: 4px;
}
.auth-form {
  background: var(--bg-card, #12121a);
  padding: 2rem;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.auth-form h2 {
  color: var(--text, #e5e5e5);
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
}
.auth-form input {
  background: var(--bg-input, #1a1a25);
  border: 1px solid var(--bg-hover, #22222e);
  color: var(--text, #e5e5e5);
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}
.auth-form input:focus {
  border-color: var(--accent, #6366f1);
}
.auth-form .btn-primary {
  background: var(--accent, #6366f1);
  color: #fff;
  border: none;
  padding: 12px;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}
.auth-form .btn-primary:hover {
  opacity: 0.9;
}
.auth-switch {
  color: var(--text-dim, #666);
  font-size: 0.85rem;
}
.auth-switch a {
  color: var(--accent, #6366f1);
  text-decoration: none;
}
.auth-error {
  color: #ef4444;
  font-size: 0.85rem;
  min-height: 1.2em;
}

/* Brain */
.brain-header {
  display: flex; gap: 0.5rem; align-items: center; margin-bottom: 0.75rem;
}
.brain-search-bar {
  display: flex; gap: 0.5rem; flex: 1;
}
.brain-search-bar input { flex: 1; }
.brain-status {
  font-size: 0.75rem; color: var(--text-dim); padding: 0.25rem 0;
}
.brain-list-header {
  display: flex; justify-content: space-between; padding: 0.5rem 0; font-size: 0.85rem; color: var(--text-dim);
}
.brain-card {
  background: var(--bg-card); border-radius: 10px; padding: 0.75rem; margin-bottom: 0.5rem; cursor: pointer;
  transition: background 0.2s;
}
.brain-card:hover { background: var(--bg-hover); }
.brain-card-header { display: flex; gap: 0.5rem; align-items: center; margin-bottom: 0.25rem; }
.brain-source-badge { font-size: 0.9rem; }
.brain-card-title { font-weight: 600; font-size: 0.95rem; color: var(--text); }
.brain-card-excerpt { font-size: 0.8rem; color: var(--text-dim); line-height: 1.4; margin-bottom: 0.25rem; }
.brain-card-meta { display: flex; gap: 0.75rem; font-size: 0.7rem; color: var(--text-dim); }
.brain-form { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1rem; background: var(--bg-card); padding: 1rem; border-radius: 10px; }
.brain-detail { padding: 0.5rem 0; }
.brain-detail h3 { color: var(--text); margin-bottom: 0.5rem; }
.brain-detail-content { color: var(--text-dim); line-height: 1.6; white-space: pre-wrap; margin: 0.5rem 0; }
.brain-tag { background: var(--bg-hover); color: var(--accent); padding: 2px 6px; border-radius: 4px; font-size: 0.75rem; }
.brain-link-item { padding: 0.4rem 0; cursor: pointer; color: var(--accent); font-size: 0.85rem; }
.brain-link-item:hover { text-decoration: underline; }
