/* ==========================================================================
   B2 Beruf Planner - Premium Design System & Mobile Styles
   ========================================================================== */

:root {
  --font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  
  /* Primary & Accent Palettes */
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #e0e7ff;
  --primary-glow: rgba(79, 70, 229, 0.15);
  
  --secondary: #06b6d4;
  --secondary-light: #cffafe;
  
  --success: #10b981;
  --success-light: #d1fae5;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  
  /* Neutral Slates */
  --slate-900: #0f172a;
  --slate-850: #172033;
  --slate-800: #1e293b;
  --slate-700: #334155;
  --slate-600: #475569;
  --slate-500: #64748b;
  --slate-400: #94a3b8;
  --slate-300: #cbd5e1;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --slate-50: #f8fafc;
  --white: #ffffff;
  
  /* Shadows & Glass */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(255, 255, 255, 0.4);
  
  /* Layout */
  --nav-height: 64px;
  --bottom-nav-height: 64px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;
  
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html, body {
  height: 100%;
  width: 100%;
  font-family: var(--font-family);
  background-color: #f1f5f9;
  color: var(--slate-800);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}

/* App Container */
#app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  overflow: hidden;
}

/* Top Navigation Bar */
.navbar {
  height: var(--nav-height);
  background: var(--slate-900);
  color: var(--white);
  box-shadow: var(--shadow-lg);
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.nav-content {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  cursor: pointer;
  text-decoration: none;
  color: var(--white);
  user-select: none;
}

.brand-icon {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: var(--radius-md);
  color: var(--white);
  box-shadow: 0 0 12px rgba(79, 70, 229, 0.4);
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0;
  white-space: nowrap;
}

.brand-subtitle {
  font-weight: 300;
  color: var(--slate-400);
  font-size: 0.95rem;
}

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

.nav-btn {
  background: transparent;
  border: none;
  color: var(--slate-300);
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-btn:hover {
  background: var(--slate-800);
  color: var(--white);
}

.nav-btn.active {
  background: var(--primary);
  color: var(--white);
  box-shadow: 0 0 12px var(--primary-glow);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.language-select {
  min-height: 36px;
  padding: 6px 30px 6px 10px;
  border: 1px solid var(--slate-300);
  border-radius: var(--radius-md);
  background: var(--white);
  color: var(--slate-700);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.language-select:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.language-select.compact {
  width: 58px;
  min-height: 34px;
  padding: 5px 8px;
  border-color: var(--slate-700);
  background: var(--slate-800);
  color: var(--white);
}

/* Status Badges */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--slate-800);
  border: 1px solid var(--slate-700);
  color: var(--slate-300);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
}

.status-dot.offline {
  background: var(--danger);
  animation: pulse 1.5s infinite;
}

.status-dot.syncing {
  background: var(--warning);
  animation: pulse 0.8s infinite;
}

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

/* Main View Area */
.main-wrapper {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 16px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  position: relative;
  -webkit-overflow-scrolling: touch;
}

.container-boxed {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

.planner-panel {
  min-height: 0;
}

.quick-date-row,
.preset-row {
  min-width: 0;
}

/* Glass & Card Surfaces */
.card {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  box-shadow: var(--shadow-md);
}

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

.card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--slate-800);
}

.card-subtitle {
  font-size: 0.825rem;
  color: var(--slate-500);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 44px;
  touch-action: manipulation;
  user-select: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: var(--white);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.35);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--slate-100);
  color: var(--slate-700);
  border-color: var(--slate-200);
}

.btn-secondary:hover {
  background: var(--slate-200);
  color: var(--slate-900);
}

.btn-outline {
  background: transparent;
  border-color: var(--slate-300);
  color: var(--slate-700);
}

.btn-outline:hover {
  background: var(--slate-50);
  border-color: var(--slate-400);
}

.btn-danger {
  background: var(--danger-light);
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
  background: var(--danger);
  color: var(--white);
}

.btn-success {
  background: var(--success-light);
  color: var(--success);
  border-color: rgba(16, 185, 129, 0.2);
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-block {
  width: 100%;
}

/* Inputs & Form Controls */
.form-group {
  margin-bottom: 16px;
  text-align: left;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--slate-700);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 12px 14px;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--slate-800);
  background: var(--white);
  border: 1.5px solid var(--slate-200);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  min-height: 44px;
}

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

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.main-content-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
}

/* Progress Rings & Bars */
.progress-bar-bg {
  width: 100%;
  height: 8px;
  background: var(--slate-100);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: 8px;
}

.progress-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: var(--radius-full);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-bar-fill.success { background: var(--success); }
.progress-bar-fill.warning { background: var(--warning); }
.progress-bar-fill.danger { background: var(--danger); }

/* Task Items in Daily Plan */
.task-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--slate-200);
  background: var(--white);
  margin-bottom: 12px;
  position: relative;
  transition: all 0.2s ease;
}

.task-item .btn {
  flex-shrink: 0;
}

.task-item.done {
  background: var(--slate-50);
  border-color: var(--slate-200);
  opacity: 0.75;
}

.task-item.done .task-title {
  text-decoration: line-through;
  color: var(--slate-400);
}

.task-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.task-icon.grammar { background: #f3e8ff; color: #9333ea; }
.task-icon.lesen { background: #ecfdf5; color: #059669; }
.task-icon.hören { background: #fef3c7; color: #d97706; }
.task-icon.schreiben { background: #e0e7ff; color: #4338ca; }
.task-icon.sprechen { background: #ffe4e6; color: #e11d48; }
.task-icon.mock { background: #334155; color: #f8fafc; }
.task-icon.custom { background: #fef9c3; color: #ca8a04; }
.task-icon.vocab { background: #e0f2fe; color: #0284c7; }

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

.task-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--slate-800);
  margin-bottom: 2px;
  word-break: break-word;
}

.task-meta {
  font-size: 0.75rem;
  color: var(--slate-500);
  overflow-wrap: anywhere;
}

.task-badge {
  position: absolute;
  top: 0;
  right: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 8px;
  border-bottom-left-radius: var(--radius-md);
  border-top-right-radius: var(--radius-lg);
  background: var(--slate-100);
  color: var(--slate-600);
  border-left: 1px solid var(--slate-200);
  border-bottom: 1px solid var(--slate-200);
}

/* Syllabus Reorder Item */
.syllabus-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  transition: all 0.2s ease;
  user-select: none;
}

.syllabus-item.dragging {
  opacity: 0.4;
  transform: scale(0.98);
}

.syllabus-item.done {
  opacity: 0.6;
  background: var(--slate-50);
}

.reorder-btns {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.reorder-btn {
  background: var(--slate-100);
  border: none;
  border-radius: 4px;
  color: var(--slate-600);
  width: 28px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.7rem;
}

.reorder-btn:hover {
  background: var(--slate-200);
  color: var(--slate-900);
}

.drag-handle {
  cursor: grab;
  color: var(--slate-300);
  font-size: 1.1rem;
  padding: 4px;
}

.drag-handle:active {
  cursor: grabbing;
}

/* Mobile Bottom Navigation */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--bottom-nav-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--slate-900);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 50;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.2);
}

.mobile-nav-items {
  display: flex;
  height: var(--bottom-nav-height);
  align-items: center;
  justify-content: space-around;
}

.mobile-nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 100%;
  color: var(--slate-400);
  background: transparent;
  border: none;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 0;
}

.mobile-nav-btn.active {
  color: var(--white);
}

.mobile-nav-btn.active .mobile-nav-icon {
  color: var(--secondary);
  transform: translateY(-2px);
}

.mobile-nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
}

.inline-meta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: 6px;
}

.hidden {
  display: none !important;
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
  animation: fadeIn 0.2s ease-out;
}

.modal-content {
  background: var(--white);
  border-radius: var(--radius-xl);
  max-width: 460px;
  width: 100%;
  padding: 32px;
  box-shadow: var(--shadow-xl);
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}

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

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

/* Manual Today Plan */
.today-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.today-edit-btn {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 0.78rem;
}

.dashboard-manual-planner {
  margin: 0 0 12px;
  padding-top: 14px;
  border-bottom: 0;
}

.manual-planner {
  flex-shrink: 0;
  padding: 16px 0;
  margin-bottom: 12px;
  border-top: 1px solid var(--slate-200);
  border-bottom: 1px solid var(--slate-200);
}

.manual-planner-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.manual-planner-header h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  color: var(--slate-800);
}

.manual-planner-header p {
  margin-top: 3px;
  font-size: 0.75rem;
  color: var(--slate-500);
  text-transform: capitalize;
}

.manual-add-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 170px auto;
  gap: 8px;
  align-items: center;
}

.manual-add-row .form-input {
  min-width: 0;
}

.manual-task-list {
  max-height: 184px;
  margin-top: 12px;
  overflow-y: auto;
}

.manual-task-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 76px auto;
  gap: 10px;
  align-items: center;
  padding: 9px 0;
  border-top: 1px solid var(--slate-100);
}

.manual-task-row .task-icon {
  width: 36px;
  height: 36px;
}

.manual-task-copy {
  min-width: 0;
}

.manual-task-copy strong,
.manual-task-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.manual-task-copy strong {
  font-size: 0.84rem;
  color: var(--slate-800);
}

.manual-task-copy span,
.manual-row-duration span {
  margin-top: 2px;
  font-size: 0.7rem;
  color: var(--slate-500);
}

.manual-row-duration span {
  display: block;
  margin: 0 0 2px;
}

.manual-row-duration .form-input {
  min-height: 32px;
  padding: 4px 7px;
  font-size: 0.8rem;
}

.manual-task-actions {
  display: flex;
  gap: 4px;
}

.manual-task-actions .btn {
  width: 30px;
  height: 30px;
  min-height: 30px;
}

.manual-empty {
  padding: 12px 0 4px;
  color: var(--slate-400);
  font-size: 0.8rem;
}

.manual-clear {
  min-height: 32px;
  margin-top: 10px;
  padding: 5px 10px;
  font-size: 0.75rem;
}

/* Timeline & Roadmap */
.timeline {
  position: relative;
  padding-left: 24px;
  border-left: 2px solid var(--slate-200);
  margin-left: 8px;
}

.timeline-item {
  position: relative;
  margin-bottom: 24px;
}

.timeline-dot {
  position: absolute;
  left: -31px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--slate-300);
  border: 2px solid var(--white);
}

.timeline-item.today .timeline-dot {
  background: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-light);
}

/* Custom Scrollbar */
.custom-scrollbar::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
.custom-scrollbar::-webkit-scrollbar-track {
  background: transparent;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
  background: var(--slate-300);
  border-radius: 4px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: var(--slate-400);
}

/* Toast Notifications */
#toast-container {
  position: fixed;
  top: 76px;
  right: 16px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--white);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: slideInRight 0.3s ease;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 320px;
}

.toast span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.toast-info { background: var(--slate-800); }
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-warning { background: var(--warning); color: var(--slate-900); }

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

/* ==========================================================================
   Responsive & Mobile Breakpoints
   ========================================================================== */

@media (max-width: 900px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .main-content-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  :root {
    --nav-height: 56px;
    --bottom-nav-height: 62px;
  }

  html, body {
    overflow: hidden;
  }

  #app-root {
    display: block !important;
  }

  .navbar {
    box-shadow: var(--shadow-md);
  }

  .nav-content {
    padding: 0 10px;
    gap: 8px;
  }

  .nav-links {
    display: none; /* Replaced by bottom nav */
  }

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

  .main-wrapper {
    padding: 10px 8px calc(var(--bottom-nav-height) + var(--safe-bottom) + 18px) 8px;
    display: block;
  }

  .card {
    padding: 14px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
  }

  .container-boxed {
    max-width: 100%;
  }

  .planner-panel {
    max-height: none !important;
    min-height: calc(100dvh - var(--nav-height) - var(--bottom-nav-height) - var(--safe-bottom) - 28px);
  }

  .quick-date-row,
  .preset-row {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px !important;
  }

  .quick-date-row .btn,
  .preset-row .btn {
    width: 100%;
    min-height: 38px;
    padding-left: 6px !important;
    padding-right: 6px !important;
    white-space: normal;
    line-height: 1.15;
  }

  .quick-add-card {
    padding: 12px !important;
    border-radius: var(--radius-md) !important;
  }

  .quick-add-grid {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 88px;
    gap: 8px !important;
  }

  .quick-add-grid > div {
    min-width: 0 !important;
    width: auto !important;
  }

  .quick-add-grid > div:first-child,
  .quick-add-grid > div:nth-child(3),
  .quick-add-grid > .btn {
    grid-column: 1 / -1;
  }

  .quick-add-grid .btn {
    width: 100%;
  }

  .card:hover {
    box-shadow: var(--shadow-sm);
  }

  .card-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .card-header > .btn,
  .card-header > .status-pill {
    align-self: stretch;
  }

  .today-plan-header {
    flex-direction: row;
    align-items: flex-start;
  }

  .today-header-actions {
    align-items: flex-end;
    flex-direction: column;
  }

  .today-edit-btn {
    min-height: 34px;
    white-space: nowrap;
  }

  .card-title {
    font-size: 1.05rem;
    line-height: 1.25;
  }

  .card-subtitle {
    line-height: 1.35;
  }

  .btn {
    min-height: 42px;
    padding: 9px 13px;
    font-size: 0.86rem;
  }

  .btn-icon {
    width: 38px;
    height: 38px;
    min-width: 38px;
  }

  .form-input {
    min-height: 42px;
    font-size: 16px;
  }

  .brand {
    gap: 8px;
    flex: 1 1 auto;
  }

  .brand-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
  }

  .brand-title {
    display: block;
    max-width: 42vw;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.98rem;
    line-height: 1.05;
  }

  .brand-subtitle {
    display: none;
  }

  .nav-actions {
    gap: 6px;
    flex-shrink: 0;
  }

  #user-nav-btn {
    display: flex;
    align-items: center;
    min-width: 0;
  }

  #user-nav-btn > span {
    display: none;
  }

  #user-nav-btn .btn {
    min-height: 34px;
    padding: 6px 10px !important;
    font-size: 0.78rem !important;
    margin-left: 0 !important;
  }

  .status-pill span:not(.status-dot) {
    display: none;
  }

  .status-pill {
    padding: 6px;
  }

  .dashboard-grid {
    gap: 10px;
    margin-bottom: 10px;
  }

  .dashboard-side {
    gap: 12px !important;
  }

  .dashboard-grid .card {
    padding: 12px 14px;
  }

  .main-content-grid {
    gap: 12px;
  }

  .task-item {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 10px 12px;
    align-items: start;
    padding: 38px 12px 12px;
    border-radius: var(--radius-md);
  }

  .task-icon {
    width: 38px;
    height: 38px;
  }

  .task-title {
    font-size: 0.9rem;
    line-height: 1.3;
  }

  .task-meta {
    line-height: 1.35;
  }

  .task-item .btn {
    grid-column: 1 / -1;
    width: 100%;
  }

  .task-badge {
    left: 0;
    right: auto;
    max-width: 100%;
    border-left: none;
    border-bottom-left-radius: 0;
    border-top-right-radius: 0;
    border-bottom-right-radius: var(--radius-md);
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .syllabus-item {
    display: grid;
    grid-template-columns: 30px 24px minmax(0, 1fr) 38px;
    gap: 8px;
    align-items: center;
    padding: 10px;
  }

  .syllabus-item .drag-handle {
    display: none;
  }

  .reorder-btn {
    width: 28px;
    height: 24px;
  }

  .window-row {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) 38px;
    gap: 6px !important;
  }

  .window-row .form-input {
    width: 100% !important;
    min-width: 0;
  }

  .timeline {
    padding-left: 16px;
    margin-left: 2px;
  }

  .manual-add-row {
    grid-template-columns: minmax(0, 1fr) 108px;
  }

  .manual-add-row .btn {
    grid-column: 1 / -1;
    width: 100%;
  }

  .manual-task-list {
    max-height: 260px;
  }

  .dashboard-manual-planner .manual-task-list {
    max-height: none;
  }

  .manual-task-row {
    grid-template-columns: 34px minmax(0, 1fr) 66px;
    gap: 8px;
  }

  .manual-task-row .task-icon {
    width: 32px;
    height: 32px;
  }

  .manual-task-actions {
    grid-column: 2 / -1;
    justify-content: flex-end;
  }

  .timeline-dot {
    left: -23px;
  }

  .timeline-item li {
    align-items: flex-start !important;
  }

  .timeline-item li > span:first-child {
    min-width: 68px !important;
    max-width: 84px;
    overflow-wrap: anywhere;
  }

  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .modal-content {
    max-width: none;
    width: 100%;
    max-height: min(92vh, 620px);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 22px 18px calc(22px + var(--safe-bottom));
  }

  #toast-container {
    top: auto;
    left: 8px;
    right: 8px;
    bottom: calc(var(--bottom-nav-height) + var(--safe-bottom) + 10px);
  }

  .toast {
    width: 100%;
    max-width: none;
  }
}

@media (max-width: 420px) {
  .today-plan-header {
    flex-direction: column;
  }

  .today-header-actions {
    width: 100%;
    align-items: center;
    flex-direction: row;
    justify-content: space-between;
  }

  .brand-title {
    max-width: 34vw;
  }

  .mobile-nav-btn {
    font-size: 0.68rem;
  }

  .mobile-nav-icon {
    font-size: 1.1rem;
  }

  .syllabus-item {
    grid-template-columns: 28px 22px minmax(0, 1fr) 36px;
    padding: 9px 8px;
  }
}
