/* ═══════════════════════════════════════════════════════════════
   DESIGN SYSTEM: Rebecca - Editorial Minimalism
   A refined, mobile-first design language
   ═══════════════════════════════════════════════════════════════ */

:root {
  /* Typography */
  --font-display: 'DM Serif Display', Georgia, serif;
  --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Colors - Warm Ivory Foundation */
  --bg-base: #f8f7f4;
  --bg-card: #ffffff;
  --bg-elevated: #ffffff;
  --bg-subtle: #f0efeb;
  --bg-muted: #e8e6e1;

  /* Text Hierarchy */
  --text-primary: #1a1a1a;
  --text-secondary: #5c5c5c;
  --text-tertiary: #8c8c8c;
  --text-muted: #ababab;

  /* Accent - Warm Terracotta */
  --accent: #c4785a;
  --accent-soft: rgba(196, 120, 90, 0.12);
  --accent-text: #a85d3f;

  /* Semantic Colors */
  --success: #4a9d6e;
  --success-soft: rgba(74, 157, 110, 0.12);
  --warning: #d4915c;
  --warning-soft: rgba(212, 145, 92, 0.12);
  --danger: #c45c5c;
  --danger-soft: rgba(196, 92, 92, 0.1);

  /* Category Colors - Sophisticated Palette */
  --cat-restaurants: #d4785c;
  --cat-restaurants-bg: rgba(212, 120, 92, 0.1);
  --cat-rezepte: #8d6e4c;
  --cat-rezepte-bg: rgba(141, 110, 76, 0.1);
  --cat-it: #5c7a9d;
  --cat-it-bg: rgba(92, 122, 157, 0.1);
  --cat-physik: #7a5c9d;
  --cat-physik-bg: rgba(122, 92, 157, 0.1);
  --cat-politik: #5c8d8d;
  --cat-politik-bg: rgba(92, 141, 141, 0.1);
  --cat-sonstiges: #8c8c8c;
  --cat-sonstiges-bg: rgba(140, 140, 140, 0.1);

  /* Borders & Shadows */
  --border-light: rgba(0, 0, 0, 0.06);
  --border-medium: rgba(0, 0, 0, 0.1);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.08);

  /* Spacing & Sizing */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-pill: 100px;
  --touch-target: 44px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --nav-height: 84px;
}

/* ═══════════════════════════════════════════════════════════════
   BASE RESET & TYPOGRAPHY
   ═══════════════════════════════════════════════════════════════ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
}

/* ═══════════════════════════════════════════════════════════════
   HEADER
   ═══════════════════════════════════════════════════════════════ */

.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--bg-base);
  padding: 16px 20px;
  padding-top: calc(16px + var(--safe-top));
  border-bottom: 1px solid var(--border-light);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 600px;
  margin: 0 auto;
}

.header-title {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.header-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--accent-soft);
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-text);
}

.header-badge .pulse {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.9); }
}

/* ═══════════════════════════════════════════════════════════════
   MAIN CONTENT
   ═══════════════════════════════════════════════════════════════ */

.main {
  padding-top: calc(80px + var(--safe-top));
  padding-bottom: calc(var(--nav-height) + 24px);
  min-height: 100vh;
  min-height: 100dvh;
}

.content-wrapper {
  max-width: 600px;
  margin: 0 auto;
}

.tab-content {
  display: none;
  animation: fadeSlideIn 0.3s ease;
}

.tab-content.active {
  display: block;
}

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

/* ═══════════════════════════════════════════════════════════════
   QUICK STATS
   ═══════════════════════════════════════════════════════════════ */

.quick-stats {
  display: flex;
  gap: 12px;
  padding: 20px;
  overflow-x: auto;
  scrollbar-width: none;
}

.quick-stats::-webkit-scrollbar { display: none; }

.quick-stat {
  flex: 1;
  min-width: 90px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  transition: transform 0.2s, box-shadow 0.2s;
}

.quick-stat:active {
  transform: scale(0.98);
}

.quick-stat.highlight {
  background: linear-gradient(135deg, var(--accent) 0%, #d4917a 100%);
  border: none;
}

.quick-stat.highlight .quick-stat-value,
.quick-stat.highlight .quick-stat-label {
  color: white;
}

.quick-stat-value {
  font-family: var(--font-display);
  font-size: 32px;
  line-height: 1;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.quick-stat-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ═══════════════════════════════════════════════════════════════
   SECTION HEADER
   ═══════════════════════════════════════════════════════════════ */

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

.section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.section-action {
  min-height: var(--touch-target);
  min-width: var(--touch-target);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: -10px;
  padding: 10px;
  color: var(--accent-text);
  font-size: 15px;
  font-weight: 600;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.2s;
}

.section-action:active { opacity: 0.6; }

/* ═══════════════════════════════════════════════════════════════
   DATE NAVIGATION (Reminders)
   ═══════════════════════════════════════════════════════════════ */

.date-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 20px 8px;
}

.date-nav-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  box-shadow: var(--shadow-sm);
}

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

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

.date-nav-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  cursor: pointer;
  min-width: 140px;
  transition: all 0.15s;
}

.date-nav-display:hover {
  border-color: var(--accent);
}

.date-nav-display #reminders-date-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.date-nav-display .date-nav-date {
  font-size: 12px;
  color: var(--text-tertiary);
}

.date-nav-today {
  padding: 8px 14px;
  background: var(--accent-soft);
  color: var(--accent-text);
  border: none;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}

.date-nav-today:hover {
  background: var(--accent);
  color: white;
}

/* Reminder Stats */
.reminder-stats {
  display: flex;
  justify-content: center;
  gap: 24px;
  padding: 12px 20px 16px;
}

.reminder-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.reminder-stat-value {
  font-family: var(--font-display);
  font-size: 24px;
  color: var(--text-primary);
  line-height: 1;
}

.reminder-stat-label {
  font-size: 11px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.reminder-stat:first-child .reminder-stat-value {
  color: var(--danger);
}

/* Add button in section header */
.add-btn {
  color: var(--accent-text);
  font-weight: 600;
}

/* ═══════════════════════════════════════════════════════════════
   FILTER CHIPS
   ═══════════════════════════════════════════════════════════════ */

.filter-row {
  display: flex;
  gap: 8px;
  padding: 0 20px 16px;
  overflow-x: auto;
  scrollbar-width: none;
}

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

.chip {
  flex-shrink: 0;
  min-height: var(--touch-target);
  padding: 0 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.chip:active {
  transform: scale(0.96);
}

.chip.active {
  background: var(--text-primary);
  border-color: var(--text-primary);
  color: white;
}

.chip .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

/* ═══════════════════════════════════════════════════════════════
   CATEGORY STATISTICS (Reading Tab)
   ═══════════════════════════════════════════════════════════════ */

.category-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 20px 16px;
}

.category-stat {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-pill);
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.category-stat:active {
  transform: scale(0.96);
}

.category-stat.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.category-stat.active .cat-count {
  color: white;
}

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

.category-stat .cat-name {
  font-weight: 500;
}

.category-stat .cat-count {
  font-weight: 600;
  color: var(--text-primary);
  margin-left: 2px;
}

/* ═══════════════════════════════════════════════════════════════
   CARD LIST & SWIPE
   ═══════════════════════════════════════════════════════════════ */

.section { padding: 0 20px; }

.card-list {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  overflow: hidden;
}

.swipe-container {
  position: relative;
  overflow: hidden;
}

.swipe-content {
  position: relative;
  z-index: 1;
  background: var(--bg-card);
  width: 100%;
  transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.swipe-content.swiping {
  transition: none;
}

.swipe-action {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 80px;
  background: var(--danger);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 13px;
  z-index: 0;
  border: none;
  cursor: pointer;
}

/* ═══════════════════════════════════════════════════════════════
   CALL CARD
   ═══════════════════════════════════════════════════════════════ */

.call-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: var(--bg-card);
  text-align: left;
  width: 100%;
  border: none;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  transition: background 0.15s;
  position: relative;
}

.call-card:not(:last-child) {
  border-bottom: 1px solid var(--border-light);
}

.call-card:active {
  background: var(--bg-subtle);
}

.call-card.unread::before {
  content: '';
  position: absolute;
  left: 0;
  top: 16px;
  bottom: 16px;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

.call-card.urgent::before {
  background: var(--danger);
}

.call-card.selected {
  background: var(--accent-soft);
}

.call-checkbox {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  accent-color: var(--accent);
  cursor: pointer;
  padding: 11px;
  margin: -11px;
  margin-right: 0;
  box-sizing: content-box;
}

.call-checkbox.hidden { display: none; }

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

.call-card-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

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

.call-card-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.call-card-summary {
  font-size: 14px;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.45;
}

.call-card-meta {
  flex-shrink: 0;
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.call-card-time {
  font-size: 13px;
  color: var(--text-tertiary);
}

.call-card.unread .call-card-time {
  color: var(--accent-text);
  font-weight: 600;
}

.call-badge-urgent,
.call-badge-positive {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.call-badge-urgent {
  background: var(--danger-soft);
  color: var(--danger);
}

.call-badge-positive {
  background: var(--success-soft);
  color: var(--success);
}

/* ═══════════════════════════════════════════════════════════════
   BATCH ACTION BAR
   ═══════════════════════════════════════════════════════════════ */

.batch-action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  margin: 0 20px 12px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}

.batch-action-bar.hidden { display: none; }

.batch-selected-count {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}

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

.batch-btn {
  min-height: 36px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  background: var(--bg-subtle);
  color: var(--text-primary);
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.batch-btn:active { opacity: 0.7; }

.batch-btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

/* ═══════════════════════════════════════════════════════════════
   READING CARD
   ═══════════════════════════════════════════════════════════════ */

.reading-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 18px;
  background: var(--bg-card);
  text-align: left;
  width: 100%;
  border: none;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  transition: background 0.15s, opacity 0.2s;
}

.reading-card:not(:last-child) {
  border-bottom: 1px solid var(--border-light);
}

.reading-card:active {
  background: var(--bg-subtle);
}

.reading-card.read {
  opacity: 0.55;
}

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

.category-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.category-badge .cat-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.pdf-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.attachment-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.attachment-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s;
}

.attachment-item:active {
  background: var(--bg-card);
}

.attachment-icon {
  width: 40px;
  height: 40px;
  background: rgba(239, 68, 68, 0.1);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.attachment-icon svg {
  width: 20px;
  height: 20px;
  fill: var(--danger);
}

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

.attachment-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attachment-size {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.attachment-action {
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
}

.reading-card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.reading-card-summary {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.reading-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-tertiary);
}

.reading-card-source {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 65%;
}

/* Desktop action buttons - appear on hover */
.reading-card-actions {
  display: none;
  gap: 4px;
  margin-left: auto;
  padding-left: 8px;
}

@media (hover: hover) and (pointer: fine) {
  .reading-card:hover .reading-card-actions {
    display: flex;
  }
  .reading-card:hover .reading-card-time {
    display: none;
  }
}

.reading-action-btn {
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.15s;
}

.reading-action-btn:hover {
  opacity: 0.8;
}

.reading-action-btn.edit {
  background: var(--warning-soft);
  color: var(--warning);
}

.reading-action-btn.delete {
  background: var(--danger-soft);
  color: var(--danger);
}

.reading-swipe-actions {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  display: flex;
  z-index: 0;
  visibility: hidden;
}

.swipe-container.swiping .reading-swipe-actions,
.swipe-container.swiped .reading-swipe-actions {
  visibility: visible;
}

.reading-swipe-edit,
.reading-swipe-delete {
  width: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 12px;
  border: none;
  cursor: pointer;
}

.reading-swipe-edit { background: var(--warning); }
.reading-swipe-delete { background: var(--danger); }

/* ═══════════════════════════════════════════════════════════════
   FAVORITES, RATINGS, NOTES
   ═══════════════════════════════════════════════════════════════ */

.reading-card-indicators {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-right: 8px;
}

.favorite-star {
  width: 18px;
  height: 18px;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.favorite-star:hover {
  color: var(--warning);
  transform: scale(1.1);
}

.favorite-star.active {
  color: var(--warning);
  fill: var(--warning);
}

.rating-stars {
  display: flex;
  gap: 1px;
}

.rating-star {
  width: 12px;
  height: 12px;
  color: var(--border-medium);
  flex-shrink: 0;
}

.rating-star.filled {
  color: var(--warning);
  fill: var(--warning);
}

.rating-selector {
  display: flex;
  gap: 4px;
  padding: 8px 0;
}

.rating-selector-star {
  width: 28px;
  height: 28px;
  color: var(--border-medium);
  cursor: pointer;
  transition: all 0.15s;
}

.rating-selector-star:hover {
  color: var(--warning);
  transform: scale(1.15);
}

.rating-selector-star.filled {
  color: var(--warning);
  fill: var(--warning);
}

.notes-field {
  width: 100%;
  min-height: 80px;
  padding: 12px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  resize: vertical;
  background: var(--bg-subtle);
  color: var(--text-primary);
  transition: border-color 0.2s;
}

.notes-field:focus {
  outline: none;
  border-color: var(--accent-muted);
}

.notes-field::placeholder {
  color: var(--text-tertiary);
}

.detail-actions-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
}

.detail-favorite-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.detail-favorite-btn:hover {
  background: var(--warning-soft);
  border-color: var(--warning);
  color: var(--warning);
}

.detail-favorite-btn.active {
  background: var(--warning-soft);
  border-color: var(--warning);
  color: var(--warning);
}

.detail-favorite-btn svg {
  width: 16px;
  height: 16px;
}

.notes-preview {
  font-size: 12px;
  color: var(--text-tertiary);
  font-style: italic;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 4px;
}

/* ═══════════════════════════════════════════════════════════════
   REMINDER CARD
   ═══════════════════════════════════════════════════════════════ */

.reminder-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 18px;
  background: var(--bg-card);
  text-align: left;
  width: 100%;
  border: none;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  transition: background 0.15s;
}

.reminder-card:not(:last-child) {
  border-bottom: 1px solid var(--border-light);
}

.reminder-card:active {
  background: var(--bg-subtle);
}

.reminder-card.overdue {
  background: var(--danger-soft);
}

.reminder-card.completed {
  opacity: 0.6;
}

.reminder-text.completed {
  text-decoration: line-through;
  color: var(--text-tertiary);
}

.reminder-checkbox.checked {
  background: var(--success);
  border-color: var(--success);
}

.reminder-checkbox.checked .reminder-check-icon {
  opacity: 1;
  transform: scale(1);
}

.reminder-checkbox {
  width: 24px;
  height: 24px;
  min-width: 24px;
  border: 2px solid var(--border-medium);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
  padding: 10px;
  margin: -10px;
  margin-right: 4px;
  box-sizing: content-box;
  transition: all 0.2s;
}

.reminder-checkbox:hover {
  border-color: var(--success);
}

.reminder-check-icon {
  width: 14px;
  height: 14px;
  fill: white;
  opacity: 0;
  transform: scale(0.5);
  transition: all 0.2s;
}

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

.reminder-text {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.4;
  margin-bottom: 4px;
}

.reminder-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.reminder-due {
  color: var(--text-tertiary);
}

.reminder-due.overdue {
  color: var(--danger);
  font-weight: 600;
}

.reminder-context {
  color: var(--text-muted);
}

/* Cross-domain linking indicator */
.linked-source {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: var(--accent-soft);
  color: var(--accent-text);
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.linked-source:hover {
  background: var(--accent-muted);
}

.linked-source svg {
  width: 12px;
  height: 12px;
}

.linked-items-section {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
}

.linked-items-header {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.linked-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s;
}

.linked-item:hover {
  background: var(--bg-card);
}

.linked-item-icon {
  width: 20px;
  height: 20px;
  color: var(--accent-text);
}

.linked-item-text {
  font-size: 13px;
  color: var(--text-primary);
  flex: 1;
}

.linked-item-arrow {
  width: 16px;
  height: 16px;
  color: var(--text-tertiary);
}

.reminder-swipe-complete {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 100px;
  background: var(--success);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 24px;
  z-index: 0;
  visibility: hidden;
}

.swipe-container.swiping .reminder-swipe-complete,
.swipe-container.swiped .reminder-swipe-complete {
  visibility: visible;
}

.reminder-swipe-actions {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  display: flex;
  z-index: 0;
  visibility: hidden;
}

.swipe-container.swiping .reminder-swipe-actions,
.swipe-container.swiped .reminder-swipe-actions {
  visibility: visible;
}

.reminder-swipe-edit,
.reminder-swipe-delete {
  width: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 12px;
  border: none;
  cursor: pointer;
}

.reminder-swipe-edit { background: var(--warning); }
.reminder-swipe-delete { background: var(--danger); }

/* ═══════════════════════════════════════════════════════════════
   SEARCH BAR
   ═══════════════════════════════════════════════════════════════ */

.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 20px;
  padding: 0 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  min-height: var(--touch-target);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-bar:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.search-icon {
  color: var(--text-tertiary);
  font-size: 16px;
}

.search-bar input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 15px;
  font-family: inherit;
  outline: none;
}

.search-bar input::placeholder {
  color: var(--text-muted);
}

/* ═══════════════════════════════════════════════════════════════
   BOTTOM NAVIGATION
   ═══════════════════════════════════════════════════════════════ */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-elevated);
  border-top: 1px solid var(--border-light);
  padding: 8px 0;
  padding-bottom: calc(8px + var(--safe-bottom));
  z-index: 100;
  display: flex;
  justify-content: space-around;
  max-width: 600px;
  margin: 0 auto;
}

@supports (backdrop-filter: blur(20px)) {
  .bottom-nav {
    background: rgba(248, 247, 244, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
  }
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-height: var(--touch-target);
  min-width: 64px;
  padding: 6px 16px;
  background: none;
  border: none;
  color: var(--text-tertiary);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: color 0.2s, transform 0.15s;
}

.nav-item:active {
  transform: scale(0.94);
}

.nav-item.active {
  color: var(--accent);
}

.nav-icon {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-icon svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

/* ═══════════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ═══════════════════════════════════════════════════════════════ */

.toast-container {
  position: fixed;
  bottom: calc(var(--nav-height) + 16px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  width: calc(100% - 32px);
  max-width: 400px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  background: var(--text-primary);
  color: var(--bg-main);
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  pointer-events: auto;
  animation: toastIn 0.3s ease;
  width: 100%;
  box-sizing: border-box;
}

.toast.toast-exit {
  animation: toastOut 0.25s ease forwards;
}

.toast-success { background: var(--success); color: #fff; }
.toast-error { background: var(--danger); color: #fff; }
.toast-warning { background: #f59e0b; color: #fff; }

.toast-message { flex: 1; }

.toast-action {
  background: rgba(255,255,255,0.2);
  border: none;
  color: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}

.toast-close {
  background: none;
  border: none;
  color: inherit;
  opacity: 0.6;
  cursor: pointer;
  padding: 2px;
  font-size: 18px;
  line-height: 1;
}

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

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

/* ═══════════════════════════════════════════════════════════════
   MODALS
   ═══════════════════════════════════════════════════════════════ */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 200;
  display: none;
  opacity: 0;
  transition: opacity 0.25s;
}

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

.modal {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 600px;
  margin: 0 auto;
  background: var(--bg-card);
  border-top-left-radius: var(--radius-xl);
  border-top-right-radius: var(--radius-xl);
  max-height: 92vh;
  max-height: 92dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
}

.modal-overlay.active .modal {
  transform: translateY(0);
}

.modal-handle {
  width: 36px;
  height: 5px;
  background: var(--bg-muted);
  border-radius: 3px;
  margin: 10px auto 0;
  flex-shrink: 0;
}

.modal-header {
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--text-primary);
}

.modal-close {
  width: 32px;
  height: 32px;
  background: var(--bg-subtle);
  border: none;
  color: var(--text-secondary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  font-weight: 300;
}

.modal-close:active {
  background: var(--bg-muted);
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 0 20px 20px;
  -webkit-overflow-scrolling: touch;
}

.modal-footer {
  padding: 16px 20px;
  padding-bottom: calc(16px + var(--safe-bottom));
  border-top: 1px solid var(--border-light);
  flex-shrink: 0;
}

.detail-block { margin-bottom: 20px; }

.detail-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.detail-value {
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-primary);
}

.detail-value.highlight {
  color: var(--accent-text);
  font-weight: 600;
}

.detail-list {
  list-style: none;
}

.detail-list li {
  position: relative;
  padding-left: 16px;
  margin-bottom: 8px;
  color: var(--text-secondary);
  font-size: 14px;
}

.detail-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  width: 5px;
  height: 5px;
  background: var(--accent);
  border-radius: 50%;
}

.transcript-box {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
  white-space: pre-wrap;
  background: var(--bg-subtle);
  padding: 14px;
  border-radius: var(--radius-md);
  max-height: 260px;
  overflow-y: auto;
  font-family: 'SF Mono', ui-monospace, monospace;
}

.btn-danger {
  width: 100%;
  background: var(--danger-soft);
  color: var(--danger);
  border: none;
  padding: 14px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.2s;
}

.btn-danger:active { opacity: 0.7; }

.btn-primary {
  background: var(--accent);
  color: white;
  border: none;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.2s;
}

.btn-primary:active { opacity: 0.7; }

.btn-secondary {
  background: var(--bg-subtle);
  color: var(--text-primary);
  border: 1px solid var(--border-medium);
  padding: 14px 20px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

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

.btn-secondary:active { opacity: 0.7; }

.btn-primary:active { opacity: 0.7; }

/* ═══════════════════════════════════════════════════════════════
   ACTION SHEET
   ═══════════════════════════════════════════════════════════════ */

.action-sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  z-index: 300;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: var(--safe-bottom);
}

.action-sheet {
  background: var(--bg-card);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: 16px;
  width: 100%;
  max-width: 400px;
  animation: sheetUp 0.25s ease-out;
}

@keyframes sheetUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.action-sheet-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: center;
  margin-bottom: 12px;
}

.action-sheet-btn {
  display: block;
  width: 100%;
  padding: 14px;
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  text-align: center;
  font-family: inherit;
  transition: background 0.15s;
}

.action-sheet-btn:active {
  background: var(--bg-subtle);
}

.action-sheet-btn.active {
  color: var(--accent);
  font-weight: 600;
}

.action-sheet-cancel {
  display: block;
  width: 100%;
  padding: 14px;
  margin-top: 8px;
  font-size: 16px;
  font-weight: 600;
  color: var(--accent);
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: center;
  font-family: inherit;
}

/* ═══════════════════════════════════════════════════════════════
   EMPTY & LOADING STATES
   ═══════════════════════════════════════════════════════════════ */

.empty-state {
  text-align: center;
  padding: 48px 24px;
}

.empty-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  background: var(--bg-subtle);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: var(--text-tertiary);
}

.empty-text {
  font-size: 15px;
  color: var(--text-tertiary);
}

.loading {
  display: flex;
  justify-content: center;
  padding: 48px;
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--bg-muted);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Pull to Refresh */
.pull-refresh-indicator {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%) translateY(-60px);
  background: var(--bg-card);
  padding: 12px 20px;
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text-secondary);
  z-index: 1000;
  opacity: 0;
  transition: transform 0.3s, opacity 0.3s;
}

.pull-refresh-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--bg-muted);
  border-top-color: var(--accent);
  border-radius: 50%;
}

.pull-refresh-indicator.refreshing .pull-refresh-spinner {
  animation: spin 0.8s linear infinite;
}

/* Action Items */
.action-items-section {
  margin: 0 20px 16px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  overflow: hidden;
}

.action-items-section .section-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
}

.action-items-list {
  max-height: 200px;
  overflow-y: auto;
}

.action-items-list.collapsed {
  display: none;
}

.action-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
}

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

.action-item-checkbox {
  width: 20px;
  height: 20px;
  min-width: 20px;
  border: 2px solid var(--border-medium);
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
  transition: all 0.15s;
}

.action-item-checkbox:hover {
  border-color: var(--success);
}

.action-item-checkbox.checked {
  background: var(--success);
  border-color: var(--success);
}

.action-item-checkbox svg {
  width: 12px;
  height: 12px;
  fill: white;
  opacity: 0;
}

.action-item-checkbox.checked svg {
  opacity: 1;
}

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

.action-item-text {
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.4;
}

.action-item-text.completed {
  text-decoration: line-through;
  color: var(--text-tertiary);
}

.action-item-meta {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

/* Stats Panel */
.stats-panel {
  margin: 0 20px 16px;
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-light);
  overflow: hidden;
  animation: slideDown 0.3s ease;
}

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

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

.stats-card {
  padding: 16px;
  border-bottom: 1px solid var(--border-light);
}

.stats-card:last-child {
  border-bottom: none;
}

.stats-card-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}

/* Trend Chart */
.trend-chart {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  height: 80px;
  gap: 8px;
}

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

.trend-bar-fill {
  width: 100%;
  background: var(--accent);
  border-radius: 4px 4px 0 0;
  min-height: 4px;
  transition: height 0.3s ease;
}

.trend-bar-label {
  font-size: 10px;
  color: var(--text-tertiary);
}

.trend-bar-value {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* Peak Hours */
.peak-hours {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.peak-hour {
  padding: 8px 12px;
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-secondary);
}

.peak-hour strong {
  color: var(--text-primary);
}

/* Top Callers */
.top-callers {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.top-caller {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
}

.top-caller-name {
  font-size: 14px;
  color: var(--text-primary);
}

.top-caller-count {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-text);
}

/* Sentiment Chart */
.sentiment-chart {
  display: flex;
  gap: 16px;
}

.sentiment-item {
  flex: 1;
  text-align: center;
}

.sentiment-bar {
  height: 8px;
  border-radius: 4px;
  margin-bottom: 8px;
}

.sentiment-bar.positive { background: var(--success); }
.sentiment-bar.neutral { background: var(--bg-muted); }
.sentiment-bar.urgent { background: var(--danger); }

.sentiment-label {
  font-size: 11px;
  color: var(--text-tertiary);
}

.sentiment-value {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

/* Form inputs in modals */
.modal-body textarea,
.modal-body input[type="date"] {
  width: 100%;
  min-height: 44px;
  padding: 12px;
  font-size: 15px;
  font-family: inherit;
  background: var(--bg-subtle);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  resize: vertical;
}

.modal-body textarea:focus,
.modal-body input[type="date"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ═══════════════════════════════════════════════════════════════
   CHAT TAB - Clawdbot Integration
   ═══════════════════════════════════════════════════════════════ */

#chat-tab {
  flex-direction: column;
  height: calc(100vh - 80px - var(--safe-top) - var(--nav-height));
  height: calc(100dvh - 80px - var(--safe-top) - var(--nav-height));
  padding: 0;
}

#chat-tab.active {
  display: flex;
}

/* Chat Login Screen */
.chat-login-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 20px;
}

.chat-login-container {
  max-width: 320px;
  width: 100%;
  text-align: center;
}

.chat-login-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.chat-login-container h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}

.chat-login-container p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}

#chat-login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#chat-login-password {
  width: 100%;
  padding: 14px 16px;
  font-size: 1rem;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

#chat-login-password:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

#chat-login-btn {
  padding: 14px 24px;
  font-size: 1rem;
  font-weight: 600;
  color: white;
  background: var(--accent);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

#chat-login-btn:hover {
  background: var(--accent-hover);
}

#chat-login-btn:active {
  transform: scale(0.98);
}

#chat-login-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.chat-login-error {
  color: var(--danger);
  font-size: 0.85rem;
  min-height: 20px;
}

/* Chat Interface (when logged in) */
.chat-interface {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}

.chat-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-avatar {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent) 0%, #d4917a 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.chat-header-text h2 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 400;
  color: var(--text-primary);
  margin: 0;
}

.chat-status {
  font-size: 12px;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.chat-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
}

.chat-status-dot.connected {
  background: var(--success);
}

.chat-status-dot.connecting {
  background: var(--warning);
  animation: pulse 1s ease-in-out infinite;
}

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

.chat-action-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--bg-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.15s;
}

.chat-action-btn:hover {
  background: var(--bg-muted);
}

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

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  -webkit-overflow-scrolling: touch;
}

.chat-message {
  display: flex;
  flex-direction: column;
  max-width: 85%;
  animation: messageIn 0.2s ease-out;
}

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

.chat-message.user {
  align-self: flex-end;
}

.chat-message.assistant {
  align-self: flex-start;
}

.chat-bubble {
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  font-size: 15px;
  line-height: 1.45;
  word-wrap: break-word;
}

.chat-message.user .chat-bubble {
  background: var(--accent);
  color: white;
  border-bottom-right-radius: 4px;
}

.chat-message.assistant .chat-bubble {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow-sm);
}

.chat-bubble p {
  margin: 0 0 8px 0;
}

.chat-bubble p:last-child {
  margin-bottom: 0;
}

.chat-bubble code {
  background: var(--bg-subtle);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'SF Mono', ui-monospace, monospace;
  font-size: 13px;
}

.chat-message.user .chat-bubble code {
  background: rgba(255,255,255,0.2);
}

.chat-bubble pre {
  background: var(--bg-subtle);
  padding: 12px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: 8px 0;
  font-family: 'SF Mono', ui-monospace, monospace;
  font-size: 13px;
}

.chat-message.user .chat-bubble pre {
  background: rgba(255,255,255,0.15);
}

.chat-message-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  padding: 0 4px;
}

.chat-message.user .chat-message-time {
  text-align: right;
}

/* Tool call cards */
.chat-tool-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-subtle);
  border-radius: var(--radius-md);
  margin: 8px 0;
  font-size: 13px;
  color: var(--text-secondary);
}

.chat-tool-card.pending {
  background: var(--warning-soft);
  color: var(--warning);
}

.chat-tool-card.success {
  background: var(--success-soft);
  color: var(--success);
}

.chat-tool-card.error {
  background: var(--danger-soft);
  color: var(--danger);
}

.chat-tool-icon {
  font-size: 16px;
}

.chat-tool-name {
  font-weight: 500;
  flex: 1;
}

.chat-tool-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Typing indicator */
.chat-typing {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  border-bottom-left-radius: 4px;
  max-width: 100px;
  align-self: flex-start;
}

.chat-typing-dots {
  display: flex;
  gap: 4px;
}

.chat-typing-dot {
  width: 6px;
  height: 6px;
  background: var(--text-tertiary);
  border-radius: 50%;
  animation: typingBounce 1.4s ease-in-out infinite;
}

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

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-4px); }
}

/* Chat input area */
.chat-input-area {
  padding: 12px 16px;
  padding-bottom: calc(12px + var(--safe-bottom));
  background: var(--bg-base);
  border-top: 1px solid var(--border-light);
  flex-shrink: 0;
}

.chat-input-container {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  padding: 8px 12px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.chat-input-container:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.chat-input {
  flex: 1;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 15px;
  color: var(--text-primary);
  resize: none;
  min-height: 24px;
  max-height: 120px;
  line-height: 1.4;
  outline: none;
}

.chat-input::placeholder {
  color: var(--text-muted);
}

.chat-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
}

.chat-send-btn:hover {
  background: var(--accent-text);
}

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

.chat-send-btn:disabled {
  background: var(--bg-muted);
  color: var(--text-muted);
  cursor: not-allowed;
}

.chat-send-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* Empty state */
.chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  color: var(--text-tertiary);
}

.chat-empty-icon {
  width: 80px;
  height: 80px;
  background: var(--bg-subtle);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  margin-bottom: 16px;
}

.chat-empty h3 {
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--text-primary);
  margin: 0 0 8px 0;
}

.chat-empty p {
  font-size: 14px;
  margin: 0;
  max-width: 280px;
}

/* Chat settings modal */
.chat-settings-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.chat-settings-field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.chat-settings-field input {
  width: 100%;
  min-height: var(--touch-target);
  padding: 12px;
  font-size: 15px;
  font-family: inherit;
  background: var(--bg-subtle);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
}

.chat-settings-field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.chat-settings-note {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 4px;
}