/* ============================================
   CSS Variables & Reset
   ============================================ */
:root {
  --sidebar-bg: #2d3a2e;
  --sidebar-width: 56px;
  --primary-green: #4a7c59;
  --primary-green-light: #5a9a6a;
  --primary-green-dark: #3a6248;
  --bg-main: #f5f5f0;
  --bg-white: #ffffff;
  --bg-card: #ffffff;
  --text-primary: #1a1a1a;
  --text-secondary: #666666;
  --text-muted: #999999;
  --border-color: #e5e5e0;
  --border-light: #f0f0eb;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --tag-owner: #e74c3c;
  --tag-assignee: #e67e22;
  --tag-list: #27ae60;
  --tag-schedule: #3498db;
  --tag-high: #e74c3c;
  --status-pending: #e67e22;
  --status-outgoing: #27ae60;
}

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

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-main);
  overflow: hidden;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  outline: none;
  color: var(--text-primary);
  background: var(--bg-white);
  transition: border-color 0.2s;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--primary-green);
}

.hidden { display: none !important; }

/* ============================================
   App Container
   ============================================ */
.app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
}

/* ============================================
   Sidebar
   ============================================ */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  z-index: 100;
}

.sidebar-top,
.sidebar-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-green);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 16px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #a8b5a9;
  font-size: 17px;
  transition: all 0.2s;
  position: relative;
}

.nav-btn:hover {
  background: rgba(255,255,255,0.1);
  color: #ffffff;
}

.nav-btn.active {
  background: rgba(255,255,255,0.15);
  color: #ffffff;
}

.nav-btn.active::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: white;
  border-radius: 0 3px 3px 0;
}

/* ============================================
   Main Content
   ============================================ */
.main-content {
  flex: 1;
  overflow-y: auto;
  background: var(--bg-main);
}

.page {
  display: none;
  padding: 24px 32px;
  min-height: 100vh;
}

.page.active {
  display: block;
}

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

.greeting {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary-green);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.btn-text {
  color: var(--text-secondary);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color 0.2s;
}

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

.lang-selector {
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}

.theme-toggle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: background 0.2s;
}

.theme-toggle:hover {
  background: var(--border-color);
}

/* ============================================
   Widgets Row (Dashboard)
   ============================================ */
.widgets-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
  transition: all 0.3s;
}

.widgets-row.collapsed {
  max-height: 0;
  overflow: hidden;
  margin-bottom: 0;
  opacity: 0;
}

.widget {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  border: 1px solid var(--border-color);
}

.widget-header {
  margin-bottom: 12px;
}

.widget-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  font-size: 13px;
  color: var(--text-secondary);
}

.widget-nav-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 11px;
}

.widget-nav-btn:hover {
  background: var(--border-light);
}

.widget-icon-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.widget-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.widget-icon.green {
  background: #e8f5e9;
  color: var(--primary-green);
}

.widget-title {
  font-weight: 600;
  font-size: 15px;
}

.widget-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

.widget-percent {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary-green);
  margin-left: auto;
}

.widget-refresh {
  color: var(--text-muted);
  font-size: 14px;
  margin-left: 8px;
}

.progress-bar {
  height: 8px;
  background: #e8f5e9;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 10px;
}

.progress-fill {
  height: 100%;
  background: var(--primary-green);
  border-radius: 4px;
  transition: width 0.5s ease;
}

.widget-footer {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}

.meeting-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  font-size: 13px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 10px;
}

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

.dot.grey { background: #ccc; }
.dot.green { background: var(--primary-green); }
.dot.red { background: #e74c3c; }
.dot.orange { background: #e67e22; }

.meeting-actions {
  margin-left: auto;
  color: var(--text-muted);
}

/* ============================================
   Chat Area
   ============================================ */
.chat-area {
  position: relative;
}

.clear-chat-btn {
  position: absolute;
  top: 0;
  right: 0;
  color: var(--tag-owner);
  font-size: 13px;
  cursor: pointer;
  transition: opacity 0.2s;
}

.clear-chat-btn:hover {
  opacity: 0.7;
}

.chat-messages {
  max-height: calc(100vh - 400px);
  overflow-y: auto;
  padding: 20px 0 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-message {
  display: flex;
  gap: 12px;
  max-width: 80%;
}

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

.chat-avatar {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.bot-avatar {
  background: #e8f5e9;
  color: var(--primary-green);
}

.chat-bubble {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  font-size: 14px;
  line-height: 1.5;
}

.user-bubble {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
}

.chat-actions {
  display: flex;
  gap: 12px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border-light);
}

.chat-action-btn {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}

.chat-action-btn:hover {
  background: var(--border-light);
  color: var(--text-secondary);
}

.chat-input-area {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 2px solid var(--primary-green);
  border-radius: var(--radius-lg);
  padding: 10px 16px;
  margin-top: 8px;
}

.chat-add-btn {
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 50%;
  background: var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 13px;
}

.chat-input {
  flex: 1;
  border: none;
  padding: 4px 0;
  font-size: 14px;
  background: transparent;
}

.chat-input:focus {
  border: none;
}

.chat-send-btn {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 50%;
  background: var(--primary-green);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  transition: background 0.2s;
}

.chat-send-btn:hover {
  background: var(--primary-green-dark);
}

.chat-disclaimer {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 8px;
}

/* ============================================
   Page Title Row
   ============================================ */
.page-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

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

.page-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.page-icon.green {
  background: var(--primary-green);
  color: white;
}

.page-title-left h2 {
  font-size: 22px;
  font-weight: 700;
}

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

/* ============================================
   View Switcher
   ============================================ */
.view-switcher {
  display: flex;
  background: var(--border-light);
  border-radius: var(--radius-md);
  padding: 3px;
}

.view-btn {
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.view-btn.active {
  background: var(--primary-green);
  color: white;
}

.view-btn:hover:not(.active) {
  background: var(--border-color);
}

/* ============================================
   Buttons
   ============================================ */
.btn-primary {
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
  white-space: nowrap;
}

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

.btn-primary.green:hover {
  background: var(--primary-green-dark);
}

.btn-primary:not(.green) {
  background: var(--primary-green);
  color: white;
}

.btn-primary:not(.green):hover {
  background: var(--primary-green-dark);
}

.btn-outline {
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 13px;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  transition: all 0.2s;
}

.btn-outline:hover {
  border-color: var(--text-secondary);
  background: var(--border-light);
}

.btn-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.btn-icon:hover {
  background: var(--border-light);
}

/* ============================================
   Search & Filters
   ============================================ */
.search-filter-row {
  margin-bottom: 16px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  max-width: 320px;
}

.search-box i {
  color: var(--text-muted);
}

.search-box input {
  border: none;
  padding: 0;
  flex: 1;
  background: transparent;
}

.search-box input:focus {
  border: none;
}

.filter-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  font-size: 13px;
  color: var(--text-secondary);
}

.filter-left,
.filter-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.filter-dropdown {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: background 0.2s;
}

.filter-dropdown:hover {
  background: var(--border-light);
}

.badge-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 600;
  color: white;
}

.badge-count.green {
  background: var(--primary-green);
}

.period-tabs {
  display: flex;
  gap: 4px;
  background: var(--border-light);
  border-radius: var(--radius-md);
  padding: 3px;
}

.period-tab {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s;
}

.period-tab.active {
  background: var(--primary-green);
  color: white;
}

.period-tab:hover:not(.active) {
  background: var(--border-color);
}

/* ============================================
   Cards Grid (Tasks & Meetings)
   ============================================ */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

/* ---------- Task Card ---------- */
.task-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: box-shadow 0.2s;
  cursor: pointer;
  position: relative;
}

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

.task-card-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.task-checkbox {
  width: 18px;
  height: 18px;
  min-width: 18px;
  border: 2px solid var(--border-color);
  border-radius: 4px;
  margin-top: 2px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.task-checkbox.checked {
  background: var(--primary-green);
  border-color: var(--primary-green);
  color: white;
  font-size: 11px;
}

.task-card-title {
  font-weight: 600;
  font-size: 15px;
  flex: 1;
}

.task-card-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s;
}

.task-card:hover .task-card-actions {
  opacity: 1;
}

.task-card-action {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 13px;
}

.task-card-action:hover {
  background: var(--border-light);
  color: var(--text-primary);
}

.task-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.tag {
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  color: white;
}

.tag.owner { background: var(--tag-owner); }
.tag.assignee { background: var(--tag-assignee); }
.tag.list { background: var(--tag-list); }
.tag.schedule { background: var(--tag-schedule); }
.tag.high { background: transparent; color: var(--tag-high); border: 1px solid var(--tag-high); }
.tag.high::before { content: '●'; margin-right: 4px; }

.task-progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.task-progress-label {
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.task-progress-label .dot {
  width: 8px;
  height: 8px;
}

.task-progress-count {
  margin-left: auto;
  font-size: 13px;
  color: var(--text-muted);
}

.task-progress-bar {
  height: 6px;
  background: #e8f5e9;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 14px;
}

.task-progress-fill {
  height: 100%;
  background: var(--primary-green);
  border-radius: 3px;
  transition: width 0.5s ease;
}

.task-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.task-meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.task-category {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

.task-category i {
  color: var(--text-muted);
}

.task-subtasks-btn {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
  margin-bottom: 14px;
}

.task-subtasks-btn:hover {
  background: var(--border-light);
  border-color: var(--text-muted);
}

.task-visibility {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
}

.task-visibility-label {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.visibility-btn {
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 500;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  transition: all 0.2s;
}

.visibility-btn.active {
  background: var(--tag-owner);
  color: white;
  border-color: var(--tag-owner);
}

.visibility-btn:last-child.active {
  background: var(--bg-card);
  color: var(--text-secondary);
  border-color: var(--border-color);
}

.task-visibility-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ---------- Meeting Card ---------- */
.meeting-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: box-shadow 0.2s;
  cursor: pointer;
  position: relative;
}

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

.meeting-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 10px;
}

.meeting-card-title {
  font-weight: 600;
  font-size: 15px;
}

.meeting-card-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s;
}

.meeting-card:hover .meeting-card-actions {
  opacity: 1;
}

.meeting-card-action {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 13px;
}

.meeting-card-action:hover {
  background: var(--border-light);
}

.meeting-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.badge {
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
}

.badge.pending { background: #fef3e2; color: var(--status-pending); }
.badge.outgoing { background: #e8f5e9; color: var(--status-outgoing); }
.badge.confirmed { background: #e3f2fd; color: #1976d2; }

.meeting-priority {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

.meeting-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.meeting-meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ============================================
   Notes Page
   ============================================ */
.notes-container {
  display: flex;
  gap: 0;
  height: calc(100vh - 100px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-card);
}

.notes-sidebar {
  width: 280px;
  min-width: 280px;
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
}

.notes-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 12px;
}

.notes-sidebar-header h2 {
  font-size: 18px;
  font-weight: 700;
}

.notes-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px 12px;
}

.notes-search i {
  color: var(--text-muted);
  font-size: 13px;
}

.notes-search input {
  border: none;
  padding: 6px 0;
  font-size: 13px;
  flex: 1;
  background: transparent;
}

.notes-list {
  flex: 1;
  overflow-y: auto;
}

.note-item {
  padding: 12px 16px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: all 0.2s;
}

.note-item:hover {
  background: var(--border-light);
}

.note-item.active {
  background: #e8f5e9;
  border-left-color: var(--primary-green);
}

.note-item-title {
  font-weight: 500;
  font-size: 13px;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.note-item-badge {
  padding: 2px 8px;
  border-radius: 8px;
  font-size: 10px;
  background: #e8f5e9;
  color: var(--primary-green);
  font-weight: 500;
}

.note-item-date {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.note-item-preview {
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-item-icons {
  display: flex;
  gap: 6px;
  margin-top: 4px;
  opacity: 0;
  transition: opacity 0.2s;
}

.note-item:hover .note-item-icons {
  opacity: 1;
}

.note-item-icon-btn {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 12px;
}

.note-item-icon-btn:hover {
  background: var(--border-color);
}

/* Notes Editor */
.notes-editor {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.notes-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border-light);
}

.note-last-edited {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.note-editor-actions {
  display: flex;
  gap: 10px;
}

.note-title-area {
  display: flex;
  align-items: center;
  padding: 20px 24px 8px;
}

.note-title-input {
  border: none;
  font-size: 24px;
  font-weight: 700;
  flex: 1;
  padding: 0;
}

.note-title-input:focus {
  border: none;
}

.note-menu {
  cursor: pointer;
  color: var(--text-muted);
  font-size: 16px;
}

.note-content-area {
  flex: 1;
  padding: 8px 24px 24px;
  position: relative;
}

.note-saved-indicator {
  position: absolute;
  top: 0;
  right: 24px;
  font-size: 12px;
  color: var(--text-muted);
}

.note-editor-textarea {
  width: 100%;
  height: 100%;
  border: none;
  resize: none;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-primary);
  padding-top: 16px;
}

.note-editor-textarea:focus {
  border: none;
}

/* ============================================
   AI Agents Page
   ============================================ */
.agents-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 28px;
}

.agents-title {
  font-size: 22px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.agents-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.agents-search {
  max-width: 240px;
}

.agents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}

.agent-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  text-align: center;
  position: relative;
  transition: box-shadow 0.2s;
}

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

.agent-card.create-new {
  border: 2px dashed var(--border-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  cursor: pointer;
  min-height: 180px;
}

.agent-card.create-new:hover {
  border-color: var(--primary-green);
}

.create-plus {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: var(--text-muted);
}

.agent-card.create-new:hover .create-plus {
  background: #e8f5e9;
  color: var(--primary-green);
}

.agent-card-actions {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 4px;
}

.agent-card-action-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 13px;
  transition: all 0.2s;
}

.agent-card-action-btn:hover {
  background: var(--border-light);
  color: var(--text-primary);
}

.agent-card-action-btn.delete:hover {
  color: var(--tag-owner);
}

.agent-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  color: var(--text-muted);
  margin: 0 auto 12px;
}

.agent-card-name {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
}

.agent-card-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-card-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--border-color);
  border-radius: 22px;
  transition: 0.3s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.3s;
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--primary-green);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(18px);
}

/* ============================================
   Agent Edit View
   ============================================ */
.agent-edit-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 28px;
}

.agent-edit-header h2 {
  font-size: 22px;
  font-weight: 700;
}

.agent-edit-header p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.agent-edit-actions {
  display: flex;
  gap: 10px;
}

.agent-edit-form {
  max-width: 900px;
}

.form-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
}

.form-label {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 4px;
}

.form-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.agent-name-input {
  display: flex;
  align-items: center;
  gap: 12px;
}

.agent-avatar-small {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 50%;
  background: var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--text-muted);
}

.agent-name-input input {
  flex: 1;
  padding: 10px 14px;
  font-size: 14px;
}

.form-textarea {
  width: 100%;
  min-height: 120px;
  padding: 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  resize: vertical;
  font-size: 14px;
  line-height: 1.5;
}

.response-behavior-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 24px;
  margin-top: 16px;
}

.behavior-item {
  padding: 0;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.toggle-label {
  font-weight: 500;
  font-size: 13px;
}

.behavior-info {
  display: flex;
  gap: 8px;
  padding: 12px;
  background: var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 12px;
}

.behavior-info i {
  color: var(--text-muted);
  margin-top: 2px;
}

.behavior-info-title {
  font-weight: 500;
  margin-bottom: 2px;
}

.behavior-info-desc {
  color: var(--text-muted);
  font-size: 11px;
}

.slider-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
  font-weight: 500;
  font-size: 13px;
}

.slider-value {
  color: var(--primary-green);
  font-weight: 600;
}

.slider-container {
  margin-top: 8px;
}

.slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--border-color);
  outline: none;
  border: none;
  padding: 0;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary-green);
  cursor: pointer;
  border: 3px solid white;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary-green);
  cursor: pointer;
  border: 3px solid white;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* ============================================
   Settings Page
   ============================================ */
.settings-content {
  max-width: 700px;
}

.settings-content h2 {
  font-size: 22px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.settings-desc {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 28px;
}

.settings-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.settings-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
}

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

.settings-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
}

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

.settings-item span {
  font-size: 13px;
  color: var(--text-secondary);
}

.settings-input {
  width: 240px;
  padding: 8px 12px;
}

/* ============================================
   Modals
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s;
}

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  width: 480px;
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.2s;
}

.modal.modal-lg {
  width: 600px;
}

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

.modal-header h3 {
  font-size: 18px;
  font-weight: 600;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.modal-close:hover {
  background: var(--border-light);
}

.modal-body {
  padding: 20px 24px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px 20px;
  border-top: 1px solid var(--border-light);
}

.form-group {
  margin-bottom: 16px;
}

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

.form-group input,
.form-group select {
  width: 100%;
  padding: 9px 12px;
}

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

.tag-input-area {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
}

.tag-text-input {
  border: none !important;
  padding: 4px 0 !important;
  flex: 1;
  min-width: 80px;
}

/* Subtasks Panel */
.subtasks-panel {
  margin-top: 10px;
  display: none;
}

.subtasks-panel.open {
  display: block;
}

.subtask-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--border-light);
}

.subtask-check {
  width: 16px;
  height: 16px;
  min-width: 16px;
  border: 2px solid var(--border-color);
  border-radius: 3px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  transition: all 0.2s;
}

.subtask-check.checked {
  background: var(--primary-green);
  border-color: var(--primary-green);
  color: white;
}

.subtask-text {
  flex: 1;
}

.subtask-text.done {
  text-decoration: line-through;
  color: var(--text-muted);
}

/* ============================================
   Animations
   ============================================ */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

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

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

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

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

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 1024px) {
  .response-behavior-grid {
    grid-template-columns: 1fr;
  }

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

  .notes-container {
    flex-direction: column;
  }

  .notes-sidebar {
    width: 100%;
    min-width: unset;
    max-height: 200px;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }
}

@media (max-width: 768px) {
  .page {
    padding: 16px;
  }

  .filter-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

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

  .agents-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }
}
