/* styles.css - StudyFlow: Minimalista y Sobrio estilo Notion / Craft */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

:root {
  /* Paleta Light (Notion / Craft Default) */
  --bg-app: #F7F6F3;
  --bg-surface: #FFFFFF;
  --bg-sidebar: #F9F9F8;
  --bg-hover: #EFEFEF;
  --bg-active: #E8E7E4;
  --bg-subtle: #F4F4F2;
  
  --border-subtle: #ECECE9;
  --border-strong: #DDDCD8;
  --border-focus: #37352F;

  --text-primary: #37352F;
  --text-secondary: #787774;
  --text-muted: #9B9A97;
  --text-invert: #FFFFFF;

  --accent-primary: #2F3437;
  --accent-blue: #3B82F6;
  --accent-emerald: #10B981;
  --accent-amber: #F59E0B;
  --accent-rose: #EF4444;
  --accent-violet: #8B5CF6;

  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px rgba(15, 15, 15, 0.04);
  --shadow-md: 0 4px 12px rgba(15, 15, 15, 0.06), 0 1px 3px rgba(15, 15, 15, 0.04);
  --shadow-lg: 0 12px 32px rgba(15, 15, 15, 0.08), 0 2px 6px rgba(15, 15, 15, 0.04);
  --shadow-modal: 0 20px 40px rgba(0, 0, 0, 0.12), 0 1px 3px rgba(0, 0, 0, 0.06);

  --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 220ms cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --bg-app: #191919;
  --bg-surface: #202020;
  --bg-sidebar: #1E1E1E;
  --bg-hover: #292929;
  --bg-active: #323232;
  --bg-subtle: #242424;
  
  --border-subtle: #2F2F2F;
  --border-strong: #3D3D3D;
  --border-focus: #D4D4D4;

  --text-primary: #EAEAEA;
  --text-secondary: #A0A0A0;
  --text-muted: #707070;
  --text-invert: #191919;

  --accent-primary: #EDEDED;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);
  --shadow-modal: 0 20px 50px rgba(0, 0, 0, 0.65);
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.5;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

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

/* Banner de Notificaciones / Edge Cases */
.global-banner {
  display: none;
  align-items: center;
  justify-content: space-between;
  background-color: #FEF3C7;
  color: #92400E;
  padding: 8px 16px;
  font-size: 13px;
  border-bottom: 1px solid #FDE68A;
  z-index: 1000;
  transition: var(--transition-fast);
}

[data-theme="dark"] .global-banner {
  background-color: #382810;
  color: #FCD34D;
  border-bottom: 1px solid #543D18;
}

.global-banner.active {
  display: flex;
}

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

.banner-content svg {
  flex-shrink: 0;
}

.banner-actions {
  display: flex;
  gap: 8px;
}

.banner-btn {
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition-fast);
}

.banner-btn.primary {
  background-color: #92400E;
  color: #FFF;
}
[data-theme="dark"] .banner-btn.primary {
  background-color: #F59E0B;
  color: #000;
}

.banner-btn.secondary {
  background: transparent;
  color: inherit;
  border-color: currentColor;
}

/* Sidebar */
.sidebar {
  width: 260px;
  min-width: 260px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  height: 100vh;
  user-select: none;
  transition: width var(--transition-fast);
  z-index: 20;
}

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

.workspace-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background-color: var(--accent-primary);
  color: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

.brand-details {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.01em;
}

.brand-subtitle {
  font-size: 11px;
  color: var(--text-secondary);
}

/* User Role Switcher in Sidebar */
.role-badge-container {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-subtle);
  background-color: var(--bg-subtle);
}

.role-selector {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text-primary);
  outline: none;
  font-family: inherit;
}

.role-selector:hover {
  border-color: var(--border-focus);
}

/* Sidebar Navigation */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 8px 4px 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  text-decoration: none;
  font-weight: 500;
  font-size: 13px;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

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

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

.nav-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-item-left svg {
  width: 16px;
  height: 16px;
  stroke-width: 2;
}

.nav-badge {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  background-color: var(--bg-subtle);
  color: var(--text-muted);
  font-weight: 600;
}

/* Sidebar Subjects list */
.sidebar-subjects {
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.subject-nav-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  color: var(--text-secondary);
  cursor: pointer;
}

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

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

/* Sidebar Footer */
.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 10px;
  background-color: var(--bg-sidebar);
}

.system-status-indicator {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--text-muted);
}

.status-dot-pulse {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--accent-emerald);
  margin-right: 6px;
}

.quick-tools {
  display: flex;
  gap: 6px;
}

.btn-sidebar-tool {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 11.5px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-sidebar-tool:hover {
  background-color: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

/* Main Content Area */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background-color: var(--bg-app);
}

/* Top Navigation Bar */
.topbar {
  height: 52px;
  min-height: 52px;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 10;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.breadcrumb-active {
  color: var(--text-primary);
  font-weight: 600;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.timezone-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background-color: var(--bg-subtle);
  font-size: 11.5px;
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
}

.timezone-pill:hover {
  background-color: var(--bg-hover);
}

.btn-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  cursor: pointer;
  position: relative;
  transition: var(--transition-fast);
}

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

.notification-count {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--accent-rose);
}

.btn-quick-add {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  background-color: var(--accent-primary);
  color: var(--bg-surface);
  border: none;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity var(--transition-fast);
}

.btn-quick-add:hover {
  opacity: 0.9;
}

/* View Container */
.content-body {
  flex: 1;
  overflow-y: auto;
  padding: 28px 40px 60px 40px;
}

/* Views Management */
.view-panel {
  display: none;
  max-width: 1080px;
  margin: 0 auto;
  animation: fadeIn 0.2s ease-in-out;
}

.view-panel.active {
  display: block;
}

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

/* Page Header */
.page-header {
  margin-bottom: 24px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.page-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.page-subtitle {
  color: var(--text-secondary);
  font-size: 13.5px;
}

/* Notification Drawer */
.notification-popover {
  position: absolute;
  top: 58px;
  right: 24px;
  width: 340px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 50;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.notification-popover.active {
  display: flex;
}

.popover-header {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  font-weight: 600;
  font-size: 13px;
}

.popover-list {
  max-height: 320px;
  overflow-y: auto;
  padding: 8px 0;
}

.notification-item {
  padding: 10px 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 12.5px;
  transition: background-color var(--transition-fast);
}

.notification-item:hover {
  background-color: var(--bg-hover);
}

.notification-item.unread {
  background-color: rgba(59, 130, 246, 0.04);
}

/* Dashboard Summary Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stat-card-title {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.stat-card-val {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-family: var(--font-mono);
}

.stat-card-footer {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Two Column Layout */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 24px;
}

/* Timeline & Schedule Section */
.card-section {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}

.card-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.section-title {
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Daily Timeline UI */
.timeline-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  padding-left: 20px;
}

.timeline-list::before {
  content: "";
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 6px;
  width: 2px;
  background-color: var(--border-strong);
}

.timeline-item {
  position: relative;
  display: flex;
  gap: 14px;
  padding: 10px 14px;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.timeline-item:hover {
  border-color: var(--border-strong);
  transform: translateX(2px);
}

.timeline-node {
  position: absolute;
  left: -20px;
  top: 14px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--bg-surface);
  border: 2px solid var(--accent-primary);
}

.timeline-time {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 55px;
}

.timeline-content {
  flex: 1;
}

.timeline-item-title {
  font-size: 13.5px;
  font-weight: 600;
  margin-bottom: 4px;
}

.timeline-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-secondary);
}

/* Notion-style Task List */
.task-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.task-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
}

.task-row:hover {
  border-color: var(--border-strong);
  background-color: var(--bg-hover);
}

.task-row.completed {
  opacity: 0.6;
}

.task-row.completed .task-text {
  text-decoration: line-through;
  color: var(--text-muted);
}

.task-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.custom-checkbox {
  width: 17px;
  height: 17px;
  border-radius: 4px;
  border: 1.5px solid var(--border-strong);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-surface);
  transition: var(--transition-fast);
  flex-shrink: 0;
}

.custom-checkbox:hover {
  border-color: var(--border-focus);
}

.custom-checkbox.checked {
  background-color: var(--accent-emerald);
  border-color: var(--accent-emerald);
  color: #FFF;
}

.custom-checkbox svg {
  display: none;
}

.custom-checkbox.checked svg {
  display: block;
}

.task-text {
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Badge Tags */
.badge-tag {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.priority-badge {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.priority-Alta {
  background-color: rgba(239, 68, 68, 0.12);
  color: #DC2626;
}
.priority-Media {
  background-color: rgba(245, 158, 11, 0.12);
  color: #D97706;
}
.priority-Baja {
  background-color: rgba(107, 114, 128, 0.12);
  color: #4B5563;
}

/* Filter Bar in Tasks View */
.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-pill {
  padding: 5px 12px;
  border-radius: var(--radius-full);
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  font-size: 12.5px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
}

.filter-pill:hover, .filter-pill.active {
  background-color: var(--accent-primary);
  color: var(--bg-surface);
  border-color: var(--accent-primary);
}

.search-input {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background-color: var(--bg-surface);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  font-family: inherit;
  width: 220px;
}

.search-input:focus {
  border-color: var(--border-focus);
}

/* Subject Planner Cards Grid */
.subjects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.subject-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  overflow: hidden;
}

.subject-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.subject-header-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.subject-color-bar {
  width: 10px;
  height: 24px;
  border-radius: var(--radius-xs);
}

.subject-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.hours-progress-box {
  background-color: var(--bg-subtle);
  border-radius: var(--radius-sm);
  padding: 12px;
}

.hours-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.hours-highlight {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-primary);
}

.progress-bar-bg {
  width: 100%;
  height: 7px;
  background-color: var(--border-subtle);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}

/* Syllabus / Topics breakdown list */
.topics-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.topics-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.topic-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  padding: 6px 8px;
  border-radius: var(--radius-xs);
  background-color: var(--bg-subtle);
}

.topic-item.completed span {
  text-decoration: line-through;
  color: var(--text-muted);
}

/* Time-Blocking 24h Visual Calendar */
.timeblock-container {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 20px;
}

.unassigned-tasks-sidebar {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  height: fit-content;
}

.unassigned-tasks-sidebar h3 {
  font-size: 13.5px;
  font-weight: 600;
  margin-bottom: 12px;
}

.unassigned-draggable-item {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-subtle);
  margin-bottom: 8px;
  font-size: 12.5px;
  cursor: grab;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: var(--transition-fast);
}

.unassigned-draggable-item:hover {
  border-color: var(--border-strong);
  background-color: var(--bg-hover);
}

.schedule-canvas {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  position: relative;
}

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

.time-grid {
  display: flex;
  flex-direction: column;
  position: relative;
}

.hour-slot {
  display: flex;
  min-height: 52px;
  border-top: 1px solid var(--border-subtle);
  position: relative;
}

.hour-label {
  width: 60px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  padding-top: 4px;
  user-select: none;
}

.hour-dropzone {
  flex: 1;
  position: relative;
  border-left: 1px solid var(--border-subtle);
  transition: background-color var(--transition-fast);
}

.hour-dropzone:hover {
  background-color: rgba(0, 0, 0, 0.015);
}

/* Event block in schedule */
.schedule-block {
  position: absolute;
  left: 8px;
  right: 8px;
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  z-index: 2;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast);
}

.schedule-block:hover {
  transform: scale(1.008);
  z-index: 3;
}

.block-title {
  font-weight: 600;
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.block-time {
  font-family: var(--font-mono);
  font-size: 10.5px;
  opacity: 0.85;
}

.conflict-warning-badge {
  position: absolute;
  top: 4px;
  right: 6px;
  background-color: var(--accent-rose);
  color: #FFF;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: var(--radius-xs);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 3px;
}

/* Focus Mode / Pomodoro View */
.focus-container {
  max-width: 640px;
  margin: 0 auto;
  text-align: center;
  padding: 20px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.focus-header-tabs {
  display: inline-flex;
  padding: 4px;
  background-color: var(--bg-subtle);
  border-radius: var(--radius-full);
  margin-bottom: 28px;
  gap: 4px;
}

.focus-tab-btn {
  padding: 6px 16px;
  border-radius: var(--radius-full);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
}

.focus-tab-btn.active {
  background-color: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
  font-weight: 600;
}

.timer-display-box {
  position: relative;
  width: 260px;
  height: 260px;
  margin: 0 auto 28px auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.timer-circle-svg {
  transform: rotate(-90deg);
  width: 100%;
  height: 100%;
}

.timer-circle-bg {
  fill: none;
  stroke: var(--border-subtle);
  stroke-width: 6;
}

.timer-circle-progress {
  fill: none;
  stroke: var(--accent-primary);
  stroke-width: 6;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.8s ease;
}

.timer-text-content {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.timer-digits {
  font-family: var(--font-mono);
  font-size: 52px;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--text-primary);
  line-height: 1;
}

.timer-mode-label {
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 8px;
  font-weight: 600;
}

/* Active Task Card in Focus Mode */
.focus-task-card {
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
}

.focus-task-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.focus-task-title {
  font-size: 14px;
  font-weight: 600;
}

.focus-task-subject {
  font-size: 12px;
  color: var(--text-secondary);
}

.focus-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 24px;
}

.btn-focus-main {
  padding: 12px 32px;
  border-radius: var(--radius-full);
  background-color: var(--accent-primary);
  color: var(--bg-surface);
  border: none;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-fast);
}

.btn-focus-main:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

.btn-focus-secondary {
  padding: 10px 18px;
  border-radius: var(--radius-full);
  background-color: var(--bg-subtle);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-focus-secondary:hover {
  background-color: var(--bg-hover);
}

/* Focus Mode Edge Case Banner */
.interruption-notice {
  display: none;
  background-color: #FEF2F2;
  border: 1px solid #FCA5A5;
  color: #991B1B;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  margin-top: 16px;
  text-align: left;
}
[data-theme="dark"] .interruption-notice {
  background-color: #381515;
  border-color: #7F1D1D;
  color: #FCA5A5;
}

.interruption-notice.active {
  display: block;
}

/* Analytics View */
.analytics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

.chart-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.chart-card h3 {
  font-size: 14.5px;
  font-weight: 600;
  margin-bottom: 16px;
}

.weekly-bars-container {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  height: 180px;
  padding-top: 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.bar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.bar-fill-wrap {
  width: 28px;
  height: 140px;
  display: flex;
  align-items: flex-end;
  background-color: var(--bg-subtle);
  border-radius: var(--radius-xs);
  overflow: hidden;
}

.bar-fill {
  width: 100%;
  background-color: var(--accent-primary);
  border-radius: var(--radius-xs);
  transition: height 0.5s ease;
}

.bar-day-label {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
}

.bar-val-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

/* Sessions History Table */
.sessions-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-top: 12px;
}

.sessions-table th {
  text-align: left;
  padding: 8px 12px;
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 600;
  border-bottom: 1px solid var(--border-subtle);
}

.sessions-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
}

/* Admin View */
.admin-badge {
  background-color: rgba(139, 92, 246, 0.15);
  color: #7C3AED;
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  font-weight: 600;
  font-size: 11px;
}

.system-logs-box {
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px;
  max-height: 250px;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.log-entry {
  display: flex;
  gap: 10px;
}

.log-time {
  color: var(--text-muted);
}

.log-info { color: var(--accent-blue); }
.log-warn { color: var(--accent-amber); }
.log-error { color: var(--accent-rose); }

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 0.15s ease;
}

.modal-overlay.active {
  display: flex;
}

.modal-window {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  width: 90%;
  max-width: 520px;
  box-shadow: var(--shadow-modal);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

.modal-title {
  font-size: 16px;
  font-weight: 700;
}

.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 70vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-subtle);
  background-color: var(--bg-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

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

.form-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-input, .form-select, .form-textarea {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background-color: var(--bg-surface);
  color: var(--text-primary);
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--border-focus);
}

.btn-secondary {
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  background-color: var(--bg-surface);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

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

.btn-primary {
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  background-color: var(--accent-primary);
  border: 1px solid transparent;
  color: var(--bg-surface);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary:hover {
  opacity: 0.9;
}

/* Edge Cases Lab Floating Widget */
.edge-lab-trigger {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background-color: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-size: 12.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  z-index: 90;
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.edge-lab-trigger:hover {
  transform: translateY(-2px);
  border-color: var(--accent-violet);
}

.edge-lab-drawer {
  position: fixed;
  bottom: 65px;
  right: 20px;
  width: 320px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-modal);
  padding: 16px;
  z-index: 90;
  display: none;
  flex-direction: column;
  gap: 12px;
}

.edge-lab-drawer.active {
  display: flex;
}

.edge-lab-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 700;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.edge-btn {
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-subtle);
  color: var(--text-primary);
  font-size: 12px;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition-fast);
}

.edge-btn:hover {
  background-color: var(--bg-hover);
  border-color: var(--border-strong);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 280px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1000;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background-color: var(--accent-primary);
  color: var(--bg-surface);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideUp 0.2s ease;
}

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

/* ========================================================
   RESPONSIVE STYLING & EXPERIENCIA MÓVIL
   ======================================================== */
.mobile-menu-toggle {
  display: none;
}

.mobile-sidebar-close {
  display: none;
}

.mobile-bottom-nav {
  display: none;
}

.sidebar-backdrop {
  display: none;
}

@media (max-width: 900px) {
  .dashboard-grid, .timeblock-container, .analytics-grid {
    grid-template-columns: 1fr;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  /* Layout general con Dynamic Viewport Height (100dvh) para evitar recortes de barra de navegación móvil */
  html, body {
    height: 100dvh;
    overflow: hidden;
  }

  .app-container {
    flex-direction: column;
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
  }

  .main-wrapper {
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
  }

  /* Barra lateral off-canvas deslizante */
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(290px, 82vw);
    min-width: unset;
    height: 100dvh;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-modal);
    display: flex;
    flex-direction: column;
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  /* Botón de cierre explícito dentro del cajón de la barra lateral */
  .mobile-sidebar-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
  }

  .mobile-sidebar-close:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
  }

  /* Telón de fondo oscuro translúcido para cerrar el menú */
  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: 999;
    display: none;
    opacity: 0;
    transition: opacity 0.28s ease;
  }

  .sidebar-backdrop.active {
    display: block;
    opacity: 1;
  }

  /* Botón hamburguesa en cabecera */
  .mobile-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 6px;
  }

  /* Barra superior móvil */
  .topbar {
    height: 52px;
    min-height: 52px;
    padding: 0 12px;
  }

  .breadcrumbs .desktop-only {
    display: none;
  }

  .topbar-right {
    gap: 6px;
  }

  .timezone-pill {
    padding: 4px 8px;
    font-size: 11px;
    max-width: 110px;
  }

  .timezone-pill span {
    max-width: 65px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .btn-quick-add span {
    display: none;
  }

  .btn-quick-add {
    padding: 6px 10px;
    border-radius: var(--radius-sm);
  }

  /* Contenido principal con amplio margen inferior (115px) para que NINGÚN elemento quede tapado por la barra inferior */
  .content-body {
    height: calc(100dvh - 52px);
    padding: 16px 14px calc(115px + env(safe-area-inset-bottom, 20px)) 14px !important;
    scroll-padding-bottom: calc(115px + env(safe-area-inset-bottom, 20px));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overflow-x: hidden;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 18px;
  }

  .page-title {
    font-size: 20px;
  }

  .page-subtitle {
    font-size: 12.5px;
  }

  /* Tarjetas de métricas en 2 columnas */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 20px;
  }

  .stat-card {
    padding: 12px;
  }

  .stat-card-val {
    font-size: 20px;
  }

  /* Filtros de tareas con scroll horizontal */
  .filter-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .filter-group {
    overflow-x: auto;
    width: 100%;
    padding-bottom: 4px;
    scrollbar-width: none;
  }

  .filter-group::-webkit-scrollbar {
    display: none;
  }

  .search-input {
    width: 100%;
  }

  /* Filas de tareas */
  .task-row {
    padding: 10px 12px;
  }

  .task-text {
    max-width: 140px;
    font-size: 13px;
  }

  /* Modo Enfoque en móvil */
  .focus-container {
    padding: 20px 14px;
    border-radius: var(--radius-md);
  }

  .focus-header-tabs {
    display: flex;
    overflow-x: auto;
    width: 100%;
    justify-content: flex-start;
    white-space: nowrap;
    scrollbar-width: none;
    margin-bottom: 20px;
  }

  .focus-header-tabs::-webkit-scrollbar {
    display: none;
  }

  .focus-tab-btn {
    padding: 6px 12px;
    font-size: 11.5px;
  }

  .timer-display-box {
    width: 220px;
    height: 220px;
    margin-bottom: 20px;
  }

  .timer-digits {
    font-size: 44px;
  }

  .focus-controls {
    flex-direction: column;
    gap: 10px;
  }

  .btn-focus-main {
    width: 100%;
    padding: 12px;
  }

  .btn-focus-secondary {
    width: 100%;
    padding: 10px;
  }

  /* Time-blocking en móvil */
  .hour-slot {
    min-height: 46px;
  }

  .hour-label {
    width: 48px;
    font-size: 10px;
  }

  /* Modales móviles */
  .modal-window {
    width: 95% !important;
    max-width: 95% !important;
    max-height: 90dvh;
    border-radius: 14px;
  }

  .modal-header {
    padding: 12px 16px;
  }

  .modal-body {
    padding: 14px 16px;
    max-height: calc(90dvh - 110px);
  }

  .modal-footer {
    padding: 12px 16px;
  }

  /* Barra de navegación inferior nativa móvil con efecto translúcido suave */
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 58px;
    background-color: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border-subtle);
    z-index: 85;
    align-items: center;
    justify-content: space-around;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05);
  }

  [data-theme="dark"] .mobile-bottom-nav {
    background-color: rgba(30, 30, 30, 0.94);
  }

  .mobile-nav-btn {
    flex: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 10.5px;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.15s ease;
    user-select: none;
  }

  .mobile-nav-btn svg {
    width: 18px;
    height: 18px;
  }

  .mobile-nav-btn.active {
    color: var(--text-primary);
    font-weight: 700;
  }

  /* Ocultar widgets de depuración/simulación flotantes en móvil para no tapar la pantalla */
  .edge-lab-trigger {
    display: none !important;
  }

  .edge-lab-drawer {
    display: none !important;
  }

  /* Toast posicionado en móvil */
  .toast-container {
    left: 12px;
    right: 12px;
    bottom: 74px;
  }

  .toast {
    font-size: 12px;
    padding: 8px 12px;
  }
}
