/* ===== CSS VARIABLES & RESET ===== */
:root {
  --bg-primary: #0f0f14;
  --bg-secondary: #16161d;
  --bg-card: #1c1c27;
  --bg-elevated: #22222f;
  --bg-hover: #2a2a3a;
  --bg-glass: rgba(28, 28, 39, 0.85);

  --text-primary: #f0f0f5;
  --text-secondary: #9395a5;
  --text-muted: #5f6178;

  --border: #2e2e3e;
  --border-hover: #3e3e52;
  --border-focus: #6366f1;

  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-glow: rgba(99, 102, 241, 0.25);

  --danger: #f43f5e;
  --danger-hover: #fb7185;

  --success: #22c55e;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 30px var(--accent-glow);

  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  --topbar-h: 60px;
  --controls-h: 56px;
  --hour-h: 64px;
  --bottom-nav-h: 0px;
}

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

html,
body {
  height: 100%;
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  overflow: hidden;
}

.view {
  height: 100%;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-hover);
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

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

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 20px var(--accent-glow);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border);
}

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

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

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

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

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

.btn-icon {
  padding: 8px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

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

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8125rem;
}

.btn-full {
  width: 100%;
  justify-content: center;
}

.btn-link {
  background: none;
  border: none;
  color: var(--accent);
  font-family: var(--font);
  font-size: 0.875rem;
  cursor: pointer;
  padding: 0;
}

.btn-link:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* ===== FORM ELEMENTS ===== */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-group .optional {
  font-weight: 400;
  color: var(--text-muted);
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.875rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-group textarea {
  resize: vertical;
  min-height: 60px;
}

.form-group select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239395a5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.error-message {
  background: rgba(244, 63, 94, 0.1);
  border: 1px solid rgba(244, 63, 94, 0.3);
  color: var(--danger);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  margin-bottom: 12px;
}

/* ===== AUTH VIEW ===== */
.auth-container {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(139, 92, 246, 0.06) 0%, transparent 50%);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  padding: 40px;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
}

.auth-header {
  text-align: center;
  margin-bottom: 32px;
}

.auth-logo {
  margin-bottom: 16px;
  display: inline-block;
}

.auth-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 6px;
  background: linear-gradient(135deg, var(--text-primary), var(--accent-hover));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-subtitle {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.auth-toggle {
  text-align: center;
  margin-top: 20px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* ===== TOP BAR ===== */
.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
}

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

.topbar-left h2 {
  font-size: 1.125rem;
  font-weight: 600;
  background: linear-gradient(135deg, var(--text-primary), var(--accent-hover));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

.user-greeting {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

/* ===== CALENDAR CONTROLS ===== */
.calendar-controls {
  height: var(--controls-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
}

.controls-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-group {
  display: flex;
  gap: 2px;
}

.current-period {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.controls-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ===== VIEW TOGGLE ===== */
.view-toggle {
  display: flex;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 2px;
}

.view-toggle-btn {
  padding: 5px 14px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.view-toggle-btn:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.view-toggle-btn.active {
  background: var(--accent);
  color: white;
  box-shadow: 0 2px 8px var(--accent-glow);
}

/* ===== CALENDAR GRID ===== */
.calendar-wrapper {
  height: calc(100vh - var(--topbar-h) - var(--controls-h));
  overflow-y: auto;
  overflow-x: hidden;
}

.calendar-grid {
  display: grid;
  grid-template-columns: 60px repeat(7, 1fr);
  min-height: calc(24 * var(--hour-h));
  position: relative;
}

/* Time column */
.time-column {
  position: relative;
}

.day-header-spacer {
  height: 48px;
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg-primary);
}

.time-label {
  height: var(--hour-h);
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding-right: 10px;
  font-size: 0.6875rem;
  color: var(--text-muted);
  transform: translateY(-8px);
}

/* Day columns */
.day-column {
  border-left: 1px solid var(--border);
  position: relative;
}

.day-header {
  height: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
}

.day-name {
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.day-number {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  line-height: 1;
}

.day-header.is-today .day-number {
  background: var(--accent);
  color: white;
}

.day-header.is-today .day-name {
  color: var(--accent);
}

.day-slots {
  position: relative;
}

.hour-slot {
  height: var(--hour-h);
  border-bottom: 1px solid rgba(46, 46, 62, 0.5);
  cursor: pointer;
  transition: background 0.15s;
}

.hour-slot:hover {
  background: rgba(99, 102, 241, 0.04);
}

/* Current time indicator */
.current-time-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--danger);
  z-index: 4;
  pointer-events: none;
}

.current-time-line::before {
  content: '';
  position: absolute;
  left: -4px;
  top: -4px;
  width: 10px;
  height: 10px;
  background: var(--danger);
  border-radius: 50%;
}

/* Activity blocks */
.activity-block {
  position: absolute;
  min-height: 22px;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 0.75rem;
  cursor: pointer;
  overflow: hidden;
  z-index: 3;
  transition: transform 0.15s, box-shadow 0.15s;
  border-left: 3px solid transparent;
}

.activity-block:hover {
  transform: scale(1.02);
  box-shadow: var(--shadow-md);
  z-index: 10;
}

/* Continuation block (event spanning midnight) */
.activity-continuation {
  border-top: 2px dashed rgba(255, 255, 255, 0.4);
  border-radius: 0 0 6px 6px;
}

.activity-title {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.activity-time {
  font-size: 0.6875rem;
  opacity: 0.85;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.activity-recurrence-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 0.625rem;
  opacity: 0.7;
  margin-left: 4px;
}

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 0.2s ease;
}

.modal-overlay:not([hidden]) {
  display: flex;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.25s ease;
}

.modal-sm {
  max-width: 380px;
}

@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;
  margin-bottom: 20px;
}

.modal-header h3 {
  font-size: 1.125rem;
  font-weight: 600;
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.modal-actions-right {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.confirm-text {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-bottom: 20px;
  line-height: 1.5;
}

/* ===== COLOR PICKER ===== */
.color-picker {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.color-swatch {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.color-swatch:hover {
  transform: scale(1.15);
}

.color-swatch.active {
  border-color: white;
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.color-swatch.active::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* ===== LOADING SPINNER ===== */
.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* ===== HAMBURGER BUTTON (hidden on desktop) ===== */
.hamburger-btn {
  display: none;
}

/* ===== MOBILE MENU (hidden on desktop) ===== */
.mobile-menu {
  display: none;
}

/* ===== MOBILE BOTTOM NAV (hidden on desktop) ===== */
.mobile-bottom-nav {
  display: none;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  :root {
    --topbar-h: 52px;
    --controls-h: auto;
    --hour-h: 56px;
    --bottom-nav-h: 64px;
  }

  body {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: var(--bottom-nav-h);
  }

  /* -- Topbar -- */
  .topbar {
    padding: 0 12px;
    height: var(--topbar-h);
    position: sticky;
    top: 0;
    z-index: 50;
  }

  .topbar-nav {
    display: none !important;
  }

  .topbar-right #logout-btn {
    display: none;
  }

  .user-greeting {
    display: none;
  }

  .hamburger-btn {
    display: inline-flex;
  }

  /* -- Mobile dropdown menu -- */
  .mobile-menu {
    position: absolute;
    top: var(--topbar-h);
    right: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    box-shadow: var(--shadow-lg);
    z-index: 60;
    min-width: 200px;
    display: none;
    flex-direction: column;
    gap: 12px;
  }

  .mobile-menu:not([hidden]) {
    display: flex;
  }

  .mobile-menu-greeting {
    font-size: 0.875rem;
    color: var(--text-secondary);
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
  }

  /* -- Mobile bottom nav -- */
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-nav-h);
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border);
    z-index: 50;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .mobile-nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-family: var(--font);
    font-size: 0.6875rem;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s;
    padding: 8px 0;
    min-height: 44px;
  }

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

  .mobile-nav-btn.active svg {
    filter: drop-shadow(0 0 6px var(--accent-glow));
  }

  /* -- Calendar Controls -- */
  .calendar-controls {
    flex-wrap: wrap;
    height: auto;
    padding: 10px 12px;
    gap: 8px;
  }

  .controls-left {
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
    justify-content: space-between;
  }

  .controls-right {
    width: 100%;
    justify-content: space-between;
  }

  .current-period {
    font-size: 0.875rem;
    width: 100%;
    order: -1;
  }

  /* Hide text in add activity button on mobile */
  #add-activity-btn span {
    display: none;
  }

  #add-activity-btn {
    padding: 8px 12px;
  }

  /* -- Calendar Grid -- */
  .calendar-wrapper {
    height: calc(100vh - var(--topbar-h) - var(--controls-h) - var(--bottom-nav-h));
    min-height: 400px;
  }

  .calendar-grid {
    grid-template-columns: 40px 1fr;
  }

  .time-label {
    font-size: 0.625rem;
    padding-right: 4px;
  }

  .day-header {
    height: 40px;
  }

  .day-header-spacer {
    height: 40px;
  }

  .activity-block {
    font-size: 0.6875rem;
    padding: 3px 6px;
    min-height: 20px;
  }

  .activity-title {
    font-size: 0.6875rem;
  }

  .activity-time {
    font-size: 0.625rem;
  }

  /* -- Auth -- */
  .auth-card {
    margin: 0 16px;
    padding: 24px;
  }

  /* -- Modals: slide up from bottom as bottom sheet -- */
  .modal-overlay {
    align-items: flex-end;
  }

  .modal {
    margin: 0;
    max-width: 100%;
    width: 100%;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    max-height: 90vh;
    padding: 20px 16px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    animation: slideUpMobile 0.3s ease;
  }

  .modal-sm {
    max-width: 100%;
  }

  @keyframes slideUpMobile {
    from {
      opacity: 0;
      transform: translateY(100%);
    }

    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  /* Touch-friendly targets */
  .btn {
    min-height: 44px;
    padding: 10px 16px;
  }

  .btn-sm {
    min-height: 40px;
    padding: 8px 14px;
  }

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

  .form-group input,
  .form-group textarea,
  .form-group select {
    min-height: 44px;
    padding: 10px 14px;
    font-size: 1rem;
    /* prevent iOS zoom on focus */
  }

  .color-swatch {
    width: 36px;
    height: 36px;
  }

  /* -- Goals View -- */
  #goals-section {
    height: auto;
    min-height: calc(100vh - var(--topbar-h) - var(--bottom-nav-h));
    overflow: visible;
  }

  .goals-toolbar {
    flex-direction: column;
    align-items: stretch;
    padding: 10px 12px;
    gap: 10px;
  }

  .goals-domain-filters {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .goals-domain-filters::-webkit-scrollbar {
    display: none;
  }

  .domain-filter-btn,
  .status-filter-btn {
    min-height: 36px;
    padding: 6px 14px;
    font-size: 0.75rem;
    flex-shrink: 0;
  }

  .goals-layout {
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .goals-panel {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .goals-panel-header {
    padding: 12px;
  }

  .goals-status-filters {
    flex-wrap: wrap;
    gap: 4px;
  }

  .goal-card {
    padding: 12px 14px;
  }

  .goal-card-top {
    flex-direction: column;
    gap: 6px;
  }

  .goal-badges {
    align-self: flex-start;
  }
}

/* ===== TOPBAR NAV ===== */
.topbar-nav {
  display: flex;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 2px;
}

.topbar-nav-btn {
  padding: 5px 14px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

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

.topbar-nav-btn.active {
  background: var(--accent);
  color: white;
  box-shadow: 0 2px 8px var(--accent-glow);
}

/* ===== GOALS VIEW ===== */
#goals-section {
  height: calc(100vh - var(--topbar-h) - var(--controls-h));
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.goals-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  flex-shrink: 0;
}

.goals-domain-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.domain-filter-btn,
.status-filter-btn {
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.domain-filter-btn:hover,
.status-filter-btn:hover {
  border-color: var(--border-hover);
  color: var(--text-primary);
}

.domain-filter-btn.active,
.status-filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.goals-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  flex: 1;
  overflow: hidden;
}

.goals-panel {
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.goals-panel-wide {
  border-right: none;
}

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

.goals-panel-header h4 {
  font-size: 0.9rem;
  font-weight: 600;
}

.goals-active-counter {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.goals-active-counter.over-limit {
  background: rgba(244, 63, 94, 0.1);
  border-color: var(--danger);
  color: var(--danger);
}

.goals-status-filters {
  display: flex;
  gap: 4px;
}

.goals-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.goals-empty {
  color: var(--text-muted);
  font-size: 0.8125rem;
  text-align: center;
  padding: 32px 16px;
}

/* Goal card */
.goal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

.goal-card:hover {
  border-color: var(--border-hover);
  background: var(--bg-elevated);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.goal-card[data-domain="work"] {
  border-left-color: #6366f1;
}

.goal-card[data-domain="personal"] {
  border-left-color: #ec4899;
}

.goal-card[data-domain="health"] {
  border-left-color: #22c55e;
}

.goal-card[data-domain="daily"] {
  border-left-color: #f97316;
}

.goal-card[data-status="done"] {
  opacity: 0.5;
}

.goal-card[data-status="done"] .goal-title {
  text-decoration: line-through;
}

.goal-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.goal-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
}

.goal-badges {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  align-items: center;
  flex-shrink: 0;
}

.goal-badge {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  white-space: nowrap;
}

.goal-badge-level-vision {
  background: rgba(139, 92, 246, 0.2);
  color: #a78bfa;
}

.goal-badge-level-annual {
  background: rgba(99, 102, 241, 0.2);
  color: #818cf8;
}

.goal-badge-level-action {
  background: rgba(34, 197, 94, 0.2);
  color: #4ade80;
}

.goal-badge-matrix-p1 {
  background: rgba(244, 63, 94, 0.2);
  color: #fb7185;
}

.goal-badge-matrix-p2 {
  background: rgba(99, 102, 241, 0.2);
  color: #818cf8;
}

.goal-badge-matrix-p3 {
  background: rgba(234, 179, 8, 0.2);
  color: #facc15;
}

.goal-description {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-top: 4px;
}

/* Matrix checkboxes in modal */
.matrix-grid {
  display: flex;
  gap: 20px;
}

.matrix-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--text-secondary);
  cursor: pointer;
}

.matrix-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--accent);
}