/* Reset & Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #0a0a0b;
  color: #e8e8e8;
  line-height: 1.6;
  min-height: 100vh;
}

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

/* Navigation */
.nav {
  background: #141416;
  border-bottom: 1px solid #232326;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.nav-brand {
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #6ee7b7;
  z-index: 101;
}

.nav-links {
  display: flex;
  gap: 0.5rem;
}

.nav-link {
  text-decoration: none;
  color: #8a8a8f;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.9375rem;
  font-weight: 500;
  transition: all 150ms ease;
}

.nav-link:hover {
  color: #e8e8e8;
  background: #1a1a1c;
}

.nav-link.active {
  color: #6ee7b7;
  background: rgba(110, 231, 183, 0.1);
}

/* Mobile menu toggle button */
.nav-toggle {
  display: none;
  background: none;
  border: 1px solid #232326;
  border-radius: 6px;
  padding: 0.5rem;
  cursor: pointer;
  color: #8a8a8f;
  font-size: 1.25rem;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  transition: all 150ms ease;
  z-index: 101;
}

.nav-toggle:hover {
  background: #1a1a1c;
  border-color: #6ee7b7;
  color: #6ee7b7;
}

/* Container */
.container {
  max-width: 100%;
  width: 100%;
  margin: 0 auto;
  padding: 0;
}

/* Page System */
.page {
  display: none;
  min-height: calc(100vh - 60px);
}

.page.active {
  display: block;
}

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

/* Split Layout for Today Page */
.split-layout {
  display: grid;
  grid-template-columns: 60% 40%;
  gap: 0;
  min-height: calc(100vh - 60px);
}

.todos-panel {
  padding: 2rem 2rem 4rem 2rem;
  border-right: 1px solid #232326;
  overflow-y: auto;
  max-height: calc(100vh - 60px);
}

.details-panel {
  background: #0a0a0b;
  padding: 2rem;
  overflow-y: auto;
  max-height: calc(100vh - 60px);
  position: sticky;
  top: 60px;
}

/* Timeline Page Wrapper */
.timeline-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 2rem 4rem 2rem;
}

/* Header */
.header {
  margin-bottom: 2.5rem;
}

.header h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.375rem;
  letter-spacing: -0.02em;
}

.date {
  font-size: 0.9375rem;
  color: #6a6a6f;
  font-weight: 400;
}

/* Today Page Specific */
#page-today .card {
  max-width: 100%;
}

/* Details Panel */
.details-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 6rem 3rem;
  min-height: 500px;
}

.details-empty-icon {
  font-size: 5rem;
  margin-bottom: 2rem;
  opacity: 0.5;
  animation: float 3s ease-in-out infinite;
}

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

.details-empty-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #e8e8e8;
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
}

.details-empty-text {
  font-size: 1rem;
  color: #8a8a8f;
  line-height: 1.8;
  max-width: 360px;
  margin-bottom: 2rem;
}

.details-empty-hint {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  background: rgba(110, 231, 183, 0.08);
  border: 1px solid rgba(110, 231, 183, 0.2);
  border-radius: 8px;
  font-size: 0.875rem;
  color: #6ee7b7;
}

.details-empty-hint-icon {
  font-size: 1.25rem;
}

.details-content {
  animation: slideInRight 300ms ease;
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.details-header {
  margin-bottom: 2rem;
  position: relative;
}

.details-back-btn {
  position: absolute;
  top: 0;
  right: 0;
  background: transparent;
  border: 1px solid #2a2a2d;
  border-radius: 6px;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  color: #8a8a8f;
  cursor: pointer;
  transition: all 150ms ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.details-back-btn:hover {
  background: #1a1a1c;
  border-color: #6ee7b7;
  color: #6ee7b7;
}

.details-back-btn:active {
  transform: translateY(1px);
}

.details-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.details-label-icon {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.details-todo-text {
  font-size: 1rem;
  color: #b8b8bd;
  line-height: 1.6;
  padding: 1rem;
  background: #141416;
  border-radius: 8px;
  border-left: 3px solid var(--label-color, #6ee7b7);
}

.details-section {
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid #232326;
}

.details-section:last-child {
  border-bottom: none;
}

.details-section-title {
  font-size: 0.8125rem;
  font-weight: 700;
  color: #8a8a8f;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 1rem;
}

.details-why,
.details-protocol {
  font-size: 0.9375rem;
  color: #e8e8e8;
  line-height: 1.8;
}

.details-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.details-actions .btn-modal {
  flex: 1;
  min-width: 140px;
}

.manual-override {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 200px;
}

.details-meta {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid #232326;
  font-size: 0.8125rem;
  color: #5a5a5f;
}

/* Classification Loading State */
.details-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  min-height: 400px;
}

.details-loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #232326;
  border-top-color: #6ee7b7;
  border-radius: 50%;
  animation: spin 800ms linear infinite;
  margin-bottom: 1.5rem;
}

.details-loading-text {
  font-size: 1rem;
  color: #8a8a8f;
  margin-bottom: 0.5rem;
}

.details-loading-subtext {
  font-size: 0.875rem;
  color: #5a5a5f;
}

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

/* Typing Animation */
@keyframes typing {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

.typing-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6ee7b7;
  margin: 0 2px;
  animation: typing 1.4s infinite;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

/* Card */
.card {
  background: #141416;
  border: 1px solid #232326;
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
}

/* Input Row */
.input-row {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.75rem;
}

.todo-input {
  flex: 1;
  background: #0a0a0b;
  border: 2px solid #232326;
  border-radius: 8px;
  padding: 0.875rem 1.125rem;
  font-size: 0.9375rem;
  color: #e8e8e8;
  font-family: inherit;
  transition: all 150ms ease;
}

.todo-input::placeholder {
  color: #5a5a5f;
}

.todo-input:hover {
  border-color: #2a2a2d;
}

.todo-input:focus {
  outline: none;
  border-color: #6ee7b7;
  background: #0f0f11;
  box-shadow: 0 0 0 4px rgba(110, 231, 183, 0.08);
}

.btn-add {
  background: #1a1a1c;
  border: 2px solid #232326;
  border-radius: 8px;
  padding: 0.875rem 2rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: #e8e8e8;
  font-family: inherit;
  cursor: pointer;
  transition: all 150ms ease;
  white-space: nowrap;
}

.btn-add:hover {
  background: #202022;
  border-color: #6ee7b7;
  color: #6ee7b7;
}

.btn-add:active {
  transform: translateY(1px);
}

.btn-add:focus {
  outline: none;
  border-color: #6ee7b7;
  box-shadow: 0 0 0 4px rgba(110, 231, 183, 0.08);
}

/* Empty State */
.empty-state {
  padding: 4rem 1.5rem;
  color: #5a5a5f;
  display: none;
  font-size: 0.9375rem;
}

.empty-state.visible {
  display: block;
}

#page-timeline .empty-state {
  text-align: center;
}

/* Todo List */
.todo-list {
  list-style: none;
  display: none;
}

.todo-list.visible {
  display: block;
}

.todo-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem;
  border-radius: 8px;
  transition: all 150ms ease;
  border: 1px solid transparent;
}

.todo-item:hover {
  background: #1a1a1c;
  border-color: #232326;
}

.todo-item:not(:last-child) {
  margin-bottom: 0.5rem;
}

/* Custom Checkbox */
.todo-checkbox {
  appearance: none;
  width: 22px;
  height: 22px;
  min-width: 22px;
  border: 2px solid #3a3a3d;
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  margin-top: 0.125rem;
  transition: all 150ms ease;
  background: #0a0a0b;
}

.todo-checkbox:hover {
  border-color: #6ee7b7;
  background: #0f0f11;
}

.todo-checkbox:focus {
  outline: none;
  border-color: #6ee7b7;
  box-shadow: 0 0 0 4px rgba(110, 231, 183, 0.08);
}

.todo-checkbox:checked {
  background: #6ee7b7;
  border-color: #6ee7b7;
}

.todo-checkbox:checked::after {
  content: '';
  position: absolute;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid #0a0a0b;
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
}

/* Todo Text */
.todo-text {
  flex: 1;
  word-wrap: break-word;
  word-break: break-word;
  transition: all 150ms ease;
  font-size: 0.9375rem;
  line-height: 1.5;
}

.todo-item.done .todo-text {
  text-decoration: line-through;
  color: #5a5a5f;
}

/* Delete Button */
.btn-delete {
  background: none;
  border: none;
  color: #5a5a5f;
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 150ms ease;
  opacity: 1;
  font-weight: 300;
}

.btn-delete:hover {
  color: #ff6b6b;
  background: rgba(255, 107, 107, 0.1);
}

.btn-delete:focus {
  outline: none;
  box-shadow: 0 0 0 4px rgba(110, 231, 183, 0.08);
}

.btn-delete:active {
  transform: scale(0.95);
}

/* Desktop: show delete on row hover */
@media (hover: hover) and (pointer: fine) {
  .btn-delete {
    opacity: 0;
  }
  
  .todo-item:hover .btn-delete {
    opacity: 1;
  }
  
  .btn-delete:focus {
    opacity: 1;
  }
}

/* Footer */
.footer {
  display: none;
  align-items: center;
  justify-content: space-between;
  margin-top: 1.75rem;
  padding-top: 1.75rem;
  border-top: 1px solid #232326;
  gap: 1rem;
  flex-wrap: wrap;
}

.footer.visible {
  display: flex;
}

.counter {
  font-size: 0.875rem;
  color: #6a6a6f;
  font-weight: 500;
}

.btn-clear {
  background: none;
  border: 1px solid #2a2a2d;
  border-radius: 6px;
  padding: 0.5rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #e8e8e8;
  font-family: inherit;
  cursor: pointer;
  transition: all 150ms ease;
}

.btn-clear:hover:not(:disabled) {
  background: #1a1a1c;
  border-color: #ff6b6b;
  color: #ff6b6b;
}

.btn-clear:focus {
  outline: none;
  border-color: #6ee7b7;
  box-shadow: 0 0 0 4px rgba(110, 231, 183, 0.08);
}

.btn-clear:active:not(:disabled) {
  transform: translateY(1px);
}

.btn-clear:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* Mobile Adjustments */
@media (max-width: 1024px) {
  .split-layout {
    grid-template-columns: 1fr;
  }

  .todos-panel {
    border-right: none;
    border-bottom: 1px solid #232326;
    max-height: none;
    padding: 1.5rem 1.5rem 2rem 1.5rem;
  }

  .details-panel {
    position: relative;
    top: 0;
    max-height: none;
    padding: 2rem 1.5rem;
  }
}

@media (max-width: 768px) {
  .nav-container {
    padding: 0 1rem;
  }

  /* Show hamburger menu button */
  .nav-toggle {
    display: flex;
  }

  /* Hide nav links by default on mobile */
  .nav-links {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    background: #141416;
    border-bottom: 1px solid #232326;
    flex-direction: column;
    gap: 0;
    padding: 0.5rem;
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
    transition: all 250ms ease;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
  }

  /* Show nav links when menu is open */
  .nav-links.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .nav-link {
    padding: 0.875rem 1rem;
    font-size: 1rem;
    border-radius: 6px;
    width: 100%;
    text-align: left;
  }

  .todos-panel {
    padding: 1.25rem 1rem 2rem 1rem;
  }

  .details-panel {
    padding: 1.5rem 1rem;
  }
  
  .header h1 {
    font-size: 1.75rem;
  }
  
  .card {
    padding: 1.25rem;
  }
  
  .input-row {
    gap: 0.5rem;
    flex-direction: column;
  }
  
  .btn-add {
    width: 100%;
    padding: 0.875rem 1rem;
  }
  
  .footer {
    gap: 0.75rem;
    flex-direction: column;
    align-items: stretch;
  }

  .footer-actions {
    flex-direction: column;
    width: 100%;
  }

  .btn-classify-all,
  .btn-clear {
    width: 100%;
  }

  .todo-item {
    padding: 0.875rem 0.75rem;
  }

  .todo-text {
    font-size: 0.875rem;
  }

  .details-empty {
    padding: 3rem 1.5rem;
    min-height: 300px;
  }

  .details-empty-icon {
    font-size: 3.5rem;
  }

  .details-empty-title {
    font-size: 1.25rem;
  }

  .details-empty-text {
    font-size: 0.9375rem;
  }
}

@media (max-width: 480px) {
  .nav-brand {
    font-size: 1rem;
  }

  .nav-toggle {
    width: 36px;
    height: 36px;
    font-size: 1.125rem;
  }

  .nav-link {
    padding: 0.75rem 0.875rem;
    font-size: 0.9375rem;
  }

  .todos-panel {
    padding: 1rem 0.75rem 1.5rem 0.75rem;
  }

  .details-panel {
    padding: 1.25rem 0.75rem;
  }

  .header h1 {
    font-size: 1.5rem;
  }

  .card {
    padding: 1rem;
  }

  .input-row {
    flex-direction: column;
  }
  
  .btn-add {
    width: 100%;
  }
  
  .footer {
    flex-direction: column;
    align-items: stretch;
  }
  
  .btn-clear {
    width: 100%;
  }

  .details-actions {
    flex-direction: column;
  }

  .details-actions .btn-modal,
  .manual-override {
    width: 100%;
    min-width: 0;
  }

  .todo-checkbox {
    width: 20px;
    height: 20px;
    min-width: 20px;
  }

  .btn-delete {
    width: 24px;
    height: 24px;
    font-size: 1.5rem;
  }

  .label-badge,
  .btn-classify,
  .btn-classify-retry {
    font-size: 0.6875rem;
    padding: 0.25rem 0.5rem;
  }

  .details-empty {
    padding: 2rem 1rem;
  }
}

/* Timeline Controls */
.timeline-controls {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.btn-filter {
  background: transparent;
  border: 1px solid #232326;
  border-radius: 6px;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #8a8a8f;
  font-family: inherit;
  cursor: pointer;
  transition: all 150ms ease;
}

.btn-filter:hover {
  background: #1a1a1c;
  border-color: #2a2a2d;
  color: #e8e8e8;
}

.btn-filter.active {
  background: #6ee7b7;
  border-color: #6ee7b7;
  color: #0a0a0b;
}

.btn-filter:focus {
  outline: none;
  box-shadow: 0 0 0 4px rgba(110, 231, 183, 0.08);
}

/* Timeline */
.timeline {
  display: none;
}

.timeline.visible {
  display: block;
}

.timeline-day {
  margin-bottom: 3rem;
}

.timeline-day:last-child {
  margin-bottom: 0;
}

.timeline-date {
  font-size: 0.8125rem;
  font-weight: 700;
  color: #8a8a8f;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 1.25rem;
  padding-left: 0.25rem;
  position: sticky;
  top: 76px;
  background: #0a0a0b;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  z-index: 10;
}

.timeline-events {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  position: relative;
  padding-left: 2.5rem;
}

/* Timeline vertical line */
.timeline-events::before {
  content: '';
  position: absolute;
  left: 1rem;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #232326;
}

.timeline-item {
  display: flex;
  gap: 1.25rem;
  padding: 1.25rem 1.5rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  transition: all 200ms ease;
  position: relative;
  margin-left: -2.5rem;
}

.timeline-item:hover {
  background: #141416;
  border-color: #232326;
}

.timeline-icon {
  width: 36px;
  height: 36px;
  min-width: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 1rem;
  font-weight: 600;
  position: relative;
  z-index: 2;
  border: 3px solid #0a0a0b;
}

.timeline-created .timeline-icon {
  background: #6ee7b7;
  color: #0a0a0b;
}

.timeline-completed .timeline-icon {
  background: #60a5fa;
  color: #0a0a0b;
}

.timeline-uncompleted .timeline-icon {
  background: #fbbf24;
  color: #0a0a0b;
}

.timeline-deleted .timeline-icon,
.timeline-cleared .timeline-icon {
  background: #ff6b6b;
  color: #0a0a0b;
}

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

.timeline-action {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #6a6a6f;
  margin-bottom: 0.375rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.timeline-text {
  font-size: 1rem;
  color: #e8e8e8;
  word-wrap: break-word;
  word-break: break-word;
  margin-bottom: 0.5rem;
  line-height: 1.5;
}

.timeline-time {
  font-size: 0.8125rem;
  color: #5a5a5f;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.timeline-time::before {
  content: '•';
  color: #3a3a3d;
}

/* Timeline Page Card */
#page-timeline .card {
  background: transparent;
  border: none;
  padding: 0;
  box-shadow: none;
}

/* Mobile Timeline Adjustments */
@media (max-width: 768px) {
  .timeline-events {
    padding-left: 2rem;
  }

  .timeline-events::before {
    left: 0.75rem;
  }

  .timeline-item {
    gap: 1rem;
    padding: 1rem 1.25rem;
    margin-left: -2rem;
  }

  .timeline-date {
    font-size: 0.75rem;
    top: 66px;
  }

  .timeline-icon {
    width: 32px;
    height: 32px;
    min-width: 32px;
    font-size: 0.875rem;
  }

  .timeline-text {
    font-size: 0.9375rem;
  }
}

/* V2 - Classification Styles */

/* Todo Actions Container */
.todo-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Classify Button */
.btn-classify,
.btn-classify-retry {
  background: transparent;
  border: 1px solid #3a3a3d;
  border-radius: 5px;
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: #8a8a8f;
  font-family: inherit;
  cursor: pointer;
  transition: all 150ms ease;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.btn-classify:hover {
  background: #1a1a1c;
  border-color: #6ee7b7;
  color: #6ee7b7;
}

.btn-classify-retry {
  border-color: #ff6b6b;
  color: #ff6b6b;
}

.btn-classify-retry:hover {
  background: rgba(255, 107, 107, 0.1);
}

/* Classify Loading Spinner */
.classify-loading {
  width: 14px;
  height: 14px;
  border: 2px solid #2a2a2d;
  border-top-color: #6ee7b7;
  border-radius: 50%;
  animation: spin 600ms linear infinite;
}

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

/* Label Badge */
.label-badge {
  background: color-mix(in srgb, var(--badge-color) 15%, transparent);
  border: 1px solid color-mix(in srgb, var(--badge-color) 30%, transparent);
  border-radius: 4px;
  padding: 0.25rem 0.625rem;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--badge-color);
  font-family: inherit;
  cursor: pointer;
  transition: all 150ms ease;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.label-badge:hover {
  background: color-mix(in srgb, var(--badge-color) 25%, transparent);
  border-color: var(--badge-color);
}

/* Footer Actions */
.footer-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.btn-classify-all {
  background: transparent;
  border: 1px solid #2a2a2d;
  border-radius: 6px;
  padding: 0.5rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #e8e8e8;
  font-family: inherit;
  cursor: pointer;
  transition: all 150ms ease;
}

.btn-classify-all:hover:not(:disabled) {
  background: #1a1a1c;
  border-color: #6ee7b7;
  color: #6ee7b7;
}

.btn-classify-all:active:not(:disabled) {
  transform: translateY(1px);
}

.btn-classify-all:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
  animation: fadeIn 200ms ease;
}

.modal {
  background: #141416;
  border: 1px solid #232326;
  border-radius: 12px;
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
  animation: slideUp 200ms ease;
}

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

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem;
  border-bottom: 1px solid #232326;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  color: #8a8a8f;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 150ms ease;
}

.modal-close:hover {
  background: #1a1a1c;
  color: #e8e8e8;
}

.modal-body {
  padding: 1.5rem;
}

.modal-section {
  margin-bottom: 1.5rem;
}

.modal-section:last-child {
  margin-bottom: 0;
}

.modal-section-title {
  font-size: 0.8125rem;
  font-weight: 700;
  color: #8a8a8f;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.75rem;
}

.modal-todo-text {
  font-size: 1rem;
  color: #e8e8e8;
  line-height: 1.6;
}

.modal-why,
.modal-protocol {
  font-size: 0.9375rem;
  color: #b8b8bd;
  line-height: 1.7;
}

.modal-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.btn-modal {
  background: #1a1a1c;
  border: 1px solid #2a2a2d;
  border-radius: 6px;
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #e8e8e8;
  font-family: inherit;
  cursor: pointer;
  transition: all 150ms ease;
}

.btn-modal:hover {
  background: #202022;
  border-color: #6ee7b7;
  color: #6ee7b7;
}

.btn-modal:active {
  transform: translateY(1px);
}

.manual-override {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.manual-override-label {
  font-size: 0.875rem;
  color: #8a8a8f;
}

.manual-override-select {
  background: #0a0a0b;
  border: 1px solid #2a2a2d;
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: #e8e8e8;
  font-family: inherit;
  cursor: pointer;
  transition: all 150ms ease;
}

.manual-override-select:hover {
  border-color: #3a3a3d;
}

.manual-override-select:focus {
  outline: none;
  border-color: #6ee7b7;
  box-shadow: 0 0 0 4px rgba(110, 231, 183, 0.08);
}

.modal-meta {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid #232326;
  color: #5a5a5f;
  font-size: 0.8125rem;
}

/* Mobile Modal */
@media (max-width: 768px) {
  .modal {
    max-height: 95vh;
  }

  .modal-header {
    padding: 1.25rem;
  }

  .modal-body {
    padding: 1.25rem;
  }

  .modal-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .btn-modal {
    width: 100%;
  }

  .manual-override {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  .manual-override-select {
    width: 100%;
  }

  .footer-actions {
    flex-direction: column;
    width: 100%;
  }

  .btn-classify-all,
  .btn-clear {
    width: 100%;
  }
}

/* Dashboard Page */
.dashboard-wrapper {
  max-width: 1600px;
  margin: 0 auto;
  padding: 3rem 3rem 4rem 3rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2rem;
  animation: fadeIn 600ms ease;
}

/* Stat Cards */
.stat-card {
  background: #141416;
  border: 1px solid #232326;
  border-radius: 16px;
  padding: 2.5rem;
  transition: all 250ms ease;
  position: relative;
  overflow: hidden;
  animation: slideUpFade 500ms ease backwards;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--card-accent, #6ee7b7), transparent);
  opacity: 0;
  transition: opacity 250ms ease;
}

.stat-card:hover {
  border-color: #3a3a3d;
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.stat-card:hover::before {
  opacity: 1;
}

.stat-card-wide {
  grid-column: span 2;
}

.stat-card-primary {
  --card-accent: #6ee7b7;
  background: linear-gradient(135deg, rgba(110, 231, 183, 0.08) 0%, #141416 100%);
  border-color: rgba(110, 231, 183, 0.2);
}

.stat-card-success {
  --card-accent: #60a5fa;
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.08) 0%, #141416 100%);
  border-color: rgba(96, 165, 250, 0.2);
}

.stat-card-info {
  --card-accent: #fbbf24;
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.08) 0%, #141416 100%);
  border-color: rgba(251, 191, 36, 0.2);
}

.stat-card-timeline {
  --card-accent: #f87171;
  background: linear-gradient(135deg, rgba(248, 113, 113, 0.08) 0%, #141416 100%);
  border-color: rgba(248, 113, 113, 0.2);
}

.stat-card-insight {
  grid-column: span 2;
  --card-accent: #6ee7b7;
  background: linear-gradient(135deg, rgba(110, 231, 183, 0.05) 0%, rgba(110, 231, 183, 0.02) 100%);
}

.stat-icon {
  font-size: 3.5rem;
  margin-bottom: 1.5rem;
  opacity: 0.95;
  display: inline-block;
  animation: float 4s ease-in-out infinite;
  filter: drop-shadow(0 4px 12px rgba(110, 231, 183, 0.2));
}

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

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

.stat-card:nth-child(1) { animation-delay: 0ms; }
.stat-card:nth-child(2) { animation-delay: 80ms; }
.stat-card:nth-child(3) { animation-delay: 160ms; }
.stat-card:nth-child(4) { animation-delay: 240ms; }
.stat-card:nth-child(5) { animation-delay: 320ms; }
.stat-card:nth-child(6) { animation-delay: 400ms; }
.stat-card:nth-child(7) { animation-delay: 480ms; }
.stat-card:nth-child(8) { animation-delay: 560ms; }

.stat-content {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.stat-label {
  font-size: 0.8125rem;
  color: #6a6a6f;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
}

.stat-value {
  font-size: 4rem;
  font-weight: 900;
  background: linear-gradient(135deg, #e8e8e8 0%, #b8b8bd 100%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1;
  letter-spacing: -0.03em;
}

.stat-sub {
  font-size: 0.9375rem;
  color: #8a8a8f;
  font-weight: 500;
}

.stat-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #232326;
}

.stat-card-header h3 {
  font-size: 1.25rem;
  font-weight: 800;
  color: #e8e8e8;
  letter-spacing: -0.02em;
}

.stat-card-badge {
  font-size: 0.75rem;
  padding: 0.375rem 0.875rem;
  background: rgba(110, 231, 183, 0.1);
  border: 1px solid rgba(110, 231, 183, 0.3);
  border-radius: 16px;
  color: #6ee7b7;
  font-weight: 600;
}

/* System Distribution */
.system-distribution {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.distribution-item {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

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

.distribution-label {
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.distribution-label::before {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: currentColor;
}

.distribution-value {
  font-size: 2rem;
  font-weight: 900;
  color: #e8e8e8;
  letter-spacing: -0.02em;
}

.distribution-bar {
  height: 12px;
  background: #1a1a1c;
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}

.distribution-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.distribution-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 800ms cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.distribution-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
}

.distribution-percentage {
  font-size: 0.875rem;
  color: #8a8a8f;
  text-align: right;
  font-weight: 600;
}

/* Completion Grid */
.completion-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
}

.completion-item {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.5rem;
  background: #1a1a1c;
  border: 1px solid #232326;
  border-radius: 12px;
  transition: all 200ms ease;
}

.completion-item:hover {
  background: #1f1f21;
  border-color: #2a2a2d;
  transform: translateY(-2px);
}

.completion-icon {
  width: 48px;
  height: 48px;
  min-width: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: #0a0a0b;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

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

.completion-label {
  font-size: 0.9375rem;
  font-weight: 700;
  color: #e8e8e8;
  margin-bottom: 0.375rem;
}

.completion-rate {
  font-size: 0.8125rem;
  color: #6a6a6f;
  font-weight: 500;
}

.completion-percent {
  font-size: 2.5rem;
  font-weight: 900;
  background: linear-gradient(135deg, #6ee7b7 0%, #60a5fa 100%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.03em;
}

/* Source Stats */
.source-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.source-item {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.5rem;
  background: #1a1a1c;
  border: 1px solid #232326;
  border-radius: 12px;
  transition: all 200ms ease;
}

.source-item:hover {
  border-color: #2a2a2d;
  transform: translateY(-2px);
}

.source-label {
  font-size: 0.875rem;
  color: #8a8a8f;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.source-value {
  font-size: 3rem;
  font-weight: 900;
  background: linear-gradient(135deg, #6ee7b7 0%, #34d399 100%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.03em;
}

/* Insights */
.insights-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.insight-item {
  padding: 1.75rem 2rem;
  background: linear-gradient(90deg, rgba(110, 231, 183, 0.04) 0%, #1a1a1c 100%);
  border-left: 4px solid #2a2a2d;
  border-radius: 10px;
  font-size: 1.0625rem;
  color: #d8d8dd;
  line-height: 1.75;
  transition: all 200ms ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.insight-item:hover {
  background: linear-gradient(90deg, rgba(110, 231, 183, 0.08) 0%, #1f1f21 100%);
  transform: translateX(6px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.insight-positive {
  border-left-color: #6ee7b7;
  background: rgba(110, 231, 183, 0.08);
}

.insight-warning {
  border-left-color: #fbbf24;
  background: rgba(251, 191, 36, 0.08);
}

.empty-state-small {
  padding: 4rem 3rem;
  text-align: center;
  color: #6a6a6f;
  font-size: 1.0625rem;
  line-height: 1.7;
  font-weight: 500;
}

.empty-state-small::before {
  content: '💤';
  display: block;
  font-size: 3rem;
  margin-bottom: 1.5rem;
  opacity: 0.4;
}

/* Dashboard Mobile */
@media (max-width: 1400px) {
  .dashboard-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .stat-card-wide {
    grid-column: span 2;
  }

  .stat-card-insight {
    grid-column: span 2;
  }
}

/* V3: Journey Switcher Styles (Today Page) */
.journey-switcher {
  margin-bottom: 1.5rem;
}

.journey-prompt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: rgba(110, 231, 183, 0.08);
  border: 1px solid rgba(110, 231, 183, 0.2);
  border-radius: 8px;
}

.journey-prompt-text {
  font-size: 0.875rem;
  color: #8a8a8f;
}

.journey-manage-link {
  font-size: 0.875rem;
  color: #6ee7b7;
  text-decoration: none;
  font-weight: 600;
  transition: all 150ms ease;
  white-space: nowrap;
}

.journey-manage-link:hover {
  color: #5dd9a7;
  text-decoration: underline;
}

.journey-switcher-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: #141416;
  border: 1px solid #232326;
  border-radius: 8px;
}

.journey-switcher-pills {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  flex: 1;
}

.journey-pill {
  background: #1a1a1c;
  border: 1px solid #2a2a2d;
  border-radius: 20px;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #8a8a8f;
  font-family: inherit;
  cursor: pointer;
  transition: all 150ms ease;
  white-space: nowrap;
}

.journey-pill:hover {
  background: #202022;
  border-color: #3a3a3d;
  color: #e8e8e8;
}

.journey-pill.active {
  background: rgba(110, 231, 183, 0.15);
  border-color: #6ee7b7;
  color: #6ee7b7;
}

/* V3: Journeys Page Styles */
.journeys-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: 3rem 2rem 4rem 2rem;
}

.journeys-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8rem 2rem;
  min-height: calc(100vh - 200px);
}

.journeys-empty-icon {
  font-size: 6rem;
  margin-bottom: 2rem;
  opacity: 0.5;
  animation: float 4s ease-in-out infinite;
}

.journeys-empty-title {
  font-size: 2rem;
  font-weight: 700;
  color: #e8e8e8;
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
}

.journeys-empty-text {
  font-size: 1.125rem;
  color: #8a8a8f;
  line-height: 1.7;
  max-width: 480px;
  margin-bottom: 2.5rem;
}

.btn-new-journey {
  background: #6ee7b7;
  border: none;
  border-radius: 8px;
  padding: 1rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  color: #0a0a0b;
  font-family: inherit;
  cursor: pointer;
  transition: all 150ms ease;
}

.btn-new-journey:hover {
  background: #5dd9a7;
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(110, 231, 183, 0.3);
}

.btn-new-journey:active {
  transform: translateY(0);
}

.journeys-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2.5rem;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.journeys-title {
  font-size: 2rem;
  font-weight: 700;
  color: #e8e8e8;
  margin-bottom: 0.25rem;
  letter-spacing: -0.02em;
}

.journeys-subtitle {
  font-size: 0.9375rem;
  color: #6a6a6f;
}

.journeys-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.5rem;
}

.journey-card {
  background: #141416;
  border: 1px solid #232326;
  border-radius: 12px;
  padding: 1.75rem;
  transition: all 200ms ease;
  animation: slideUpFade 400ms ease backwards;
}

.journey-card:nth-child(1) { animation-delay: 0ms; }
.journey-card:nth-child(2) { animation-delay: 60ms; }
.journey-card:nth-child(3) { animation-delay: 120ms; }
.journey-card:nth-child(4) { animation-delay: 180ms; }
.journey-card:nth-child(5) { animation-delay: 240ms; }
.journey-card:nth-child(6) { animation-delay: 300ms; }

.journey-card:hover {
  border-color: #3a3a3d;
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.journey-card.active {
  border-color: rgba(110, 231, 183, 0.4);
  background: linear-gradient(135deg, rgba(110, 231, 183, 0.08) 0%, #141416 100%);
}

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

.journey-card-name {
  font-size: 1.25rem;
  font-weight: 700;
  color: #e8e8e8;
  letter-spacing: -0.01em;
  flex: 1;
  word-break: break-word;
}

.journey-card-badge {
  background: rgba(110, 231, 183, 0.2);
  border: 1px solid rgba(110, 231, 183, 0.4);
  border-radius: 12px;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: #6ee7b7;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.journey-card-description {
  font-size: 0.9375rem;
  color: #b8b8bd;
  line-height: 1.7;
  margin-bottom: 1.5rem;
  min-height: 3.4rem;
}

.journey-card-description em {
  color: #6a6a6f;
  font-style: italic;
}

.journey-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1.25rem;
  border-top: 1px solid #232326;
  flex-wrap: wrap;
}

.journey-card-date {
  font-size: 0.8125rem;
  color: #5a5a5f;
}

.journey-card-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn-journey-action {
  background: transparent;
  border: 1px solid #2a2a2d;
  border-radius: 6px;
  padding: 0.375rem 0.875rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #8a8a8f;
  font-family: inherit;
  cursor: pointer;
  transition: all 150ms ease;
}

.btn-journey-action:hover {
  background: #1a1a1c;
  border-color: #6ee7b7;
  color: #6ee7b7;
}

.btn-journey-danger:hover {
  border-color: #f87171;
  color: #f87171;
  background: rgba(248, 113, 113, 0.08);
}

/* Journey Modal */
.journey-modal {
  max-width: 560px;
}

.form-field {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: #e8e8e8;
  margin-bottom: 0.5rem;
}

.form-required {
  color: #f87171;
}

.form-input,
.form-textarea {
  width: 100%;
  background: #0a0a0b;
  border: 2px solid #2a2a2d;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 0.9375rem;
  color: #e8e8e8;
  font-family: inherit;
  transition: all 150ms ease;
}

.form-input:focus,
.form-textarea:focus {
  outline: none;
  border-color: #6ee7b7;
  background: #0f0f11;
  box-shadow: 0 0 0 4px rgba(110, 231, 183, 0.08);
}

.form-textarea {
  resize: vertical;
  line-height: 1.6;
}

.form-hint {
  font-size: 0.8125rem;
  color: #6a6a6f;
  margin-top: 0.375rem;
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid #232326;
}

.btn-modal-primary {
  background: #6ee7b7;
  border-color: #6ee7b7;
  color: #0a0a0b;
  font-weight: 600;
}

.btn-modal-primary:hover {
  background: #5dd9a7;
  border-color: #5dd9a7;
  color: #0a0a0b;
}

.btn-modal-danger {
  background: transparent;
  border-color: #f87171;
  color: #f87171;
  margin-left: auto;
}

.btn-modal-danger:hover {
  background: rgba(248, 113, 113, 0.1);
  border-color: #f87171;
  color: #f87171;
}

/* Todo journey label (for cross-journey todos) */
.todo-journey-label {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.125rem 0.5rem;
  background: rgba(96, 165, 250, 0.15);
  border: 1px solid rgba(96, 165, 250, 0.3);
  border-radius: 4px;
  font-size: 0.6875rem;
  color: #60a5fa;
  font-weight: 600;
}

/* V3 Mobile adjustments */
@media (max-width: 768px) {
  .journey-switcher-header {
    flex-direction: column;
    align-items: stretch;
  }

  .journey-switcher-pills {
    gap: 0.375rem;
  }

  .journey-pill {
    font-size: 0.8125rem;
    padding: 0.4rem 0.875rem;
  }

  .journey-prompt {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .journeys-wrapper {
    padding: 2rem 1rem 3rem 1rem;
  }

  .journeys-empty {
    padding: 4rem 1rem;
  }

  .journeys-empty-title {
    font-size: 1.5rem;
  }

  .journeys-list {
    grid-template-columns: 1fr;
  }

  .journey-card-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .journey-card-actions {
    width: 100%;
  }

  .btn-journey-action {
    flex: 1;
  }

  .modal-actions {
    flex-direction: column;
  }

  .modal-actions .btn-modal {
    width: 100%;
  }

  .btn-modal-danger {
    margin-left: 0;
    order: -1;
  }
}

@media (max-width: 1400px) {
  .dashboard-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .stat-card-wide {
    grid-column: span 2;
  }

  .stat-card-insight {
    grid-column: span 2;
  }
}

@media (max-width: 1024px) {
  .dashboard-wrapper {
    padding: 2rem 1.5rem 3rem 1.5rem;
  }

  .dashboard-grid {
    gap: 1.5rem;
  }

  .stat-value {
    font-size: 3rem;
  }
}

@media (max-width: 768px) {
  .dashboard-wrapper {
    padding: 1.5rem 1rem 2rem 1rem;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .stat-card-wide,
  .stat-card-insight {
    grid-column: span 1;
  }

  .stat-value {
    font-size: 2.5rem;
  }

  .stat-card {
    padding: 1.5rem;
  }

  .source-stats {
    grid-template-columns: 1fr;
  }

  .completion-grid {
    grid-template-columns: 1fr;
  }
}

/* Additional Mobile Optimizations for Dashboard & Timeline */
@media (max-width: 480px) {
  /* Timeline Mobile */
  .timeline-wrapper {
    padding: 1rem 0.75rem 2rem 0.75rem;
  }

  .timeline-controls {
    gap: 0.375rem;
  }

  .btn-filter {
    font-size: 0.8125rem;
    padding: 0.375rem 0.75rem;
  }

  .timeline-events {
    padding-left: 1.5rem;
  }

  .timeline-events::before {
    left: 0.5rem;
  }

  .timeline-item {
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    margin-left: -1.5rem;
  }

  .timeline-icon {
    width: 28px;
    height: 28px;
    min-width: 28px;
    font-size: 0.75rem;
    border-width: 2px;
  }

  .timeline-action {
    font-size: 0.6875rem;
  }

  .timeline-text {
    font-size: 0.875rem;
  }

  .timeline-time {
    font-size: 0.75rem;
  }

  /* Dashboard Mobile */
  .dashboard-wrapper {
    padding: 1rem 0.75rem 1.5rem 0.75rem;
  }

  .dashboard-grid {
    gap: 1rem;
  }

  .stat-card {
    padding: 1.25rem;
  }

  .stat-value {
    font-size: 2rem;
  }

  .stat-icon {
    font-size: 2rem;
    margin-bottom: 0.75rem;
  }

  .stat-label {
    font-size: 0.6875rem;
  }

  .stat-sub {
    font-size: 0.8125rem;
  }

  .stat-card-header {
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
  }

  .stat-card-header h3 {
    font-size: 1rem;
  }

  .distribution-value {
    font-size: 1.5rem;
  }

  .completion-percent {
    font-size: 1.75rem;
  }

  .completion-icon {
    width: 40px;
    height: 40px;
    min-width: 40px;
    font-size: 1.25rem;
  }

  .source-value {
    font-size: 2.25rem;
  }

  .insight-item {
    padding: 1rem 1.25rem;
    font-size: 0.875rem;
  }

  .empty-state-small {
    padding: 3rem 1.5rem;
    font-size: 0.9375rem;
  }

  /* Journeys Mobile */
  .journeys-empty {
    padding: 3rem 1rem;
    min-height: auto;
  }

  .journeys-empty-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
  }

  .journeys-empty-title {
    font-size: 1.25rem;
  }

  .journeys-empty-text {
    font-size: 0.9375rem;
  }

  .btn-new-journey {
    font-size: 0.9375rem;
    padding: 0.875rem 1.5rem;
  }

  .journeys-list {
    gap: 1rem;
  }

  .journey-card {
    padding: 1.25rem;
  }

  .journey-card-name {
    font-size: 1.125rem;
  }

  .journey-card-description {
    font-size: 0.875rem;
    min-height: auto;
  }

  .journey-card-footer {
    padding-top: 1rem;
  }

  .journey-card-date {
    width: 100%;
  }

  .journey-card-actions {
    width: 100%;
  }

  .btn-journey-action {
    font-size: 0.75rem;
    padding: 0.375rem 0.75rem;
  }

  /* Navigation Mobile */
  .nav-container {
    height: 56px;
  }

  .nav-links {
    gap: 0.125rem;
  }

  /* Modal Mobile */
  .modal {
    margin: 0.5rem;
    max-height: 96vh;
  }

  .modal-header {
    padding: 1rem;
  }

  .modal-title {
    font-size: 1.125rem;
  }

  .modal-body {
    padding: 1rem;
  }

  .form-field {
    margin-bottom: 1.25rem;
  }

  .form-input,
  .form-textarea {
    font-size: 0.875rem;
    padding: 0.625rem 0.875rem;
  }

  .modal-actions {
    gap: 0.5rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
  }
}

/* Extra Small Screens (320px width) */
@media (max-width: 360px) {
  .nav-brand {
    font-size: 0.875rem;
  }

  .nav-link {
    padding: 0.375rem 0.375rem;
    font-size: 0.75rem;
  }

  .todos-panel,
  .details-panel {
    padding: 0.875rem 0.625rem 1.25rem 0.625rem;
  }

  .header h1 {
    font-size: 1.375rem;
  }

  .card {
    padding: 0.875rem;
  }

  .stat-value {
    font-size: 1.75rem;
  }

  .journey-pill {
    font-size: 0.75rem;
    padding: 0.375rem 0.625rem;
  }
}

/* Landscape Mobile Adjustments */
@media (max-width: 768px) and (orientation: landscape) {
  .split-layout {
    grid-template-columns: 50% 50%;
  }

  .todos-panel,
  .details-panel {
    max-height: calc(100vh - 60px);
    overflow-y: auto;
  }

  .details-empty {
    padding: 2rem 1.5rem;
    min-height: 200px;
  }

  .details-empty-icon {
    font-size: 2.5rem;
  }

  .journeys-empty {
    padding: 2rem 1rem;
    min-height: 200px;
  }

  .journeys-empty-icon {
    font-size: 3rem;
  }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
  /* Always show delete button on touch devices */
  .btn-delete {
    opacity: 1;
  }

  /* Larger touch targets */
  .todo-checkbox {
    width: 24px;
    height: 24px;
    min-width: 24px;
  }

  .btn-delete {
    width: 32px;
    height: 32px;
  }

  .label-badge,
  .btn-classify,
  .btn-classify-retry {
    padding: 0.375rem 0.625rem;
    min-height: 32px;
  }

  /* Prevent double-tap zoom */
  button, a {
    touch-action: manipulation;
  }
}

/* Safe Area Insets for Notched Devices */
@supports (padding: max(0px)) {
  .nav-container {
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
  }

  .todos-panel,
  .details-panel,
  .timeline-wrapper,
  .dashboard-wrapper,
  .journeys-wrapper {
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
    padding-bottom: max(2rem, env(safe-area-inset-bottom));
  }
}
