/* ── Theme Variables ─────────────────────────────────────────────────────────── */
:root, [data-theme="dark"] {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-card: #1e293b;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-color: #e2e8f0;
  --border-color: #334155;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --danger: #ef4444;
  --danger-text: #f87171;
  --white: #fff;
  --overlay-bg: rgba(0,0,0,0.6);
  --btn-secondary-hover: #334155;
  --cheatsheet-row-border: #1e293b;
  --search-hover-bg: #0f172a;
  --repeat-options-bg: #0f172a;
  --weekday-label-hover: #1e293b;
  --context-hover-bg: #334155;
  --kbd-bg: #0f172a;
  --kbd-border: #475569;
  --kbd-color: #cbd5e1;
  --list-hover-bg: #1e293b;
}

[data-theme="light"] {
  --bg-primary: #ffffff;
  --bg-secondary: #f1f5f9;
  --bg-card: #ffffff;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-color: #1e293b;
  --border-color: #e2e8f0;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --danger: #ef4444;
  --danger-text: #ef4444;
  --white: #fff;
  --overlay-bg: rgba(0,0,0,0.4);
  --btn-secondary-hover: #e2e8f0;
  --cheatsheet-row-border: #f1f5f9;
  --search-hover-bg: #f1f5f9;
  --repeat-options-bg: #f8fafc;
  --weekday-label-hover: #f1f5f9;
  --context-hover-bg: #f1f5f9;
  --modal-transform: translateY(12px);
  --kbd-bg: #f1f5f9;
  --kbd-border: #cbd5e1;
  --kbd-color: #475569;
  --list-hover-bg: #f1f5f9;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-color);
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Login ─────────────────────────────────────────────────────────────────── */
#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
}
.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 360px;
}
.login-card h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  color: var(--text-primary);
}
.login-card p { color: var(--text-secondary); font-size: 0.875rem; margin-bottom: 1.75rem; }
.field { margin-bottom: 1rem; }
.field label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.field input {
  width: 100%;
  padding: 0.6rem 0.85rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 0.9rem;
  outline: none;
}
.field input:focus { border-color: var(--accent); }
.field-password { position: relative; display: flex; align-items: center; }
.field-password input { padding-right: 2.5rem; }
.toggle-password {
  position: absolute; right: 0.5rem;
  background: none; border: none;
  cursor: pointer; font-size: 1.2rem;
  padding: 0.25rem; color: var(--text-secondary);
  line-height: 1;
}
.toggle-password:hover { color: var(--text-primary); }
.btn-primary {
  width: 100%;
  padding: 0.7rem;
  background: var(--accent);
  color: var(--white);
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 0.5rem;
}
.btn-primary:hover { background: var(--accent-hover); }
.login-error {
  color: var(--danger-text);
  font-size: 0.82rem;
  margin-top: 0.75rem;
  text-align: center;
  display: none;
}

/* ── App Shell ─────────────────────────────────────────────────────────────── */
#app { display: none; flex-direction: column; flex: 1; overflow: hidden; }
.app-shell { display: flex; flex: 1; overflow: hidden; }
.content-area { flex: 1; display: flex; flex-direction: column; min-width: 0; overflow: hidden; }

/* ── Mobile Top Bar ────────────────────────────────────────────────────────── */
.mobile-topbar {
  display: none;
  height: 52px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  align-items: center;
  padding: 0 0.75rem;
  gap: 0.75rem;
  flex-shrink: 0;
}
.mobile-topbar .hamburger-btn {
  background: none; border: none; color: var(--text-primary);
  font-size: 1.25rem; cursor: pointer; padding: 0.4rem;
  border-radius: 6px; display: flex; align-items: center; justify-content: center;
}
.mobile-topbar .hamburger-btn:hover { background: var(--btn-secondary-hover); }
.mobile-topbar .mobile-logo { font-size: 1.1rem; font-weight: 700; flex: 1; }
.mobile-topbar .mobile-logo span { color: var(--accent); }

/* ── Main Sidebar ──────────────────────────────────────────────────────────── */
.main-sidebar {
  width: 260px;
  min-width: 260px;
  height: 100vh;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow: visible;
  flex-shrink: 0;
  transition: width 0.25s ease, min-width 0.25s ease;
  z-index: 100;
}
.main-sidebar.collapsed {
  width: 64px;
  min-width: 64px;
}
.main-sidebar.collapsed .sidebar-label,
.main-sidebar.collapsed .sidebar-section-title,
.main-sidebar.collapsed .sidebar-user-name,
.main-sidebar.collapsed .search-input,
.main-sidebar.collapsed .calendar-list,
.main-sidebar.collapsed .ecosystem-list,
.main-sidebar.collapsed #btn-add-calendar,
.main-sidebar.collapsed .ecosystem-header,
.main-sidebar.collapsed .sidebar-logo,
.main-sidebar.collapsed .sidebar-user,
.main-sidebar.collapsed .sidebar-collapse-btn .fa-angles-left { display: none; }
.main-sidebar.collapsed .sidebar-header { justify-content: center; padding: 1rem 0; }
.main-sidebar.collapsed .sidebar-collapse-btn { width: 100%; display: flex; align-items: center; justify-content: center; }
.main-sidebar.collapsed .sidebar-collapse-btn::after { content: '\f105'; font-family: 'Font Awesome 6 Free'; font-weight: 900; font-size: 1.2rem; }
.main-sidebar.collapsed .sidebar-nav-item,
.main-sidebar.collapsed .sidebar-view-btn,
.main-sidebar.collapsed .sidebar-action-btn,
.main-sidebar.collapsed .sidebar-footer-btn { justify-content: center; padding: 0.55rem 0; }
.main-sidebar.collapsed .lang-btn-content { display: none; }
.main-sidebar.collapsed .lang-toggle-btn { padding: 0.35rem; }

/* ── Sidebar Header ────────────────────────────────────────────────────────── */
.sidebar-header { 
  display: flex; align-items: center; justify-content: space-between; 
  padding: 1rem 0.85rem; border-bottom: 1px solid var(--border-color); 
  flex-shrink: 0; min-height: 56px;
}
.sidebar-logo { font-size: 1.15rem; font-weight: 700; color: var(--text-primary); }
.sidebar-logo span { color: var(--accent); }
.sidebar-collapse-btn {
  background: none; border: none; color: var(--text-secondary);
  cursor: pointer; font-size: 1rem; padding: 0.35rem;
  border-radius: 6px; display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
}
.sidebar-collapse-btn:hover { background: var(--btn-secondary-hover); color: var(--text-primary); }

/* ── Sidebar User ──────────────────────────────────────────────────────────── */
.sidebar-user {
  display: flex; align-items: center; gap: 0.65rem;
  padding: 0.75rem 0.85rem; border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}
.sidebar-user-avatar,
.sidebar-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; font-weight: 700; color: white; flex-shrink: 0;
}
.sidebar-user-name { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.username-badge {
  font-size: 0.8rem; color: var(--text-secondary);
  background: var(--bg-primary); padding: 0.3rem 0.7rem;
  border-radius: 6px; border: 1px solid var(--border-color);
}

/* ── Sidebar Sections ──────────────────────────────────────────────────────── */
.sidebar-section {
  flex-shrink: 0;
}
.sidebar-section + .sidebar-section {
  border-top: 1px solid var(--border-color);
  padding-top: 0.35rem;
  margin-top: 0.2rem;
}
.sidebar-section-title,
.sidebar-section-label {
  font-size: 0.68rem; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.08em;
  padding: 0.35rem 0.35rem 0.25rem;
}
.sidebar-section-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.25rem 0.35rem;
}
.sidebar-section-header h3 {
  font-size: 0.68rem; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.08em; margin: 0;
}
.sidebar-calendars-section,
.sidebar-ecosystem-section {
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.sidebar-calendars-section {
  flex: 2 1 auto;
}
.sidebar-ecosystem-section {
  flex: 0 1 auto;
  max-height: 35%;
  min-height: 60px;
}
.sidebar-calendars-section .calendar-list,
.sidebar-ecosystem-section .ecosystem-list {
  padding: 0 0.35rem;
}
.sidebar-view-btns {
  display: flex; flex-direction: column; gap: 0.1rem;
  padding: 0.1rem 0.35rem 0.35rem;
}
.sidebar-actions {
  display: flex; flex-direction: column; gap: 0.1rem;
  padding: 0.1rem 0.35rem 0.35rem;
}
.sidebar-search {
  padding: 0.35rem 0;
}
.sidebar-nav-item {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.5rem 0.35rem; border-radius: 8px;
  color: var(--text-secondary); cursor: pointer;
  font-size: 0.82rem; border: none; background: none;
  width: 100%; text-align: left; transition: background 0.12s, color 0.12s;
}
.sidebar-nav-item:hover { background: var(--btn-secondary-hover); color: var(--text-primary); }
.sidebar-nav-item.active { background: rgba(59,130,246,0.12); color: var(--accent); }
.sidebar-nav-item i, .sidebar-nav-item .nav-icon { font-size: 1rem; width: 20px; text-align: center; flex-shrink: 0; }
.sidebar-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Shared button styles for sidebar items */
.sidebar-view-btn,
.sidebar-action-btn,
.sidebar-footer-btn {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.5rem 0.35rem; border-radius: 8px;
  color: var(--text-secondary); cursor: pointer;
  font-size: 0.82rem; border: none; background: none;
  width: 100%; text-align: left; transition: background 0.12s, color 0.12s;
}
.sidebar-view-btn:hover,
.sidebar-action-btn:hover,
.sidebar-footer-btn:hover { background: var(--btn-secondary-hover); color: var(--text-primary); }
.sidebar-view-btn.active { background: rgba(59,130,246,0.12); color: var(--accent); }
.sidebar-view-btn i,
.sidebar-action-btn i,
.sidebar-footer-btn i { font-size: 1rem; width: 20px; text-align: center; flex-shrink: 0; }
.sidebar-footer-btn { font-size: 0.78rem; }

/* ── Sidebar Footer ────────────────────────────────────────────────────────── */
.sidebar-footer {
  border-top: 1px solid var(--border-color); padding: 0.5rem;
  flex-shrink: 0; display: flex; flex-direction: column; gap: 0.15rem;
}
.sidebar-footer .sidebar-nav-item,
.sidebar-footer .sidebar-footer-btn { font-size: 0.78rem; }

.sidebar-footer-row {
  display: flex; align-items: center; gap: 0.25rem;
  flex-wrap: wrap; padding: 0.15rem 0;
}
.sidebar-footer-row .io-dropdown { position: relative; flex: 1; }
.sidebar-footer-row .io-dropdown .sidebar-footer-btn { width: 100%; }
.sidebar-footer-row .invitations-dropdown { position: relative; flex: 1; }
.sidebar-footer-row .invitations-dropdown .sidebar-footer-btn { width: 100%; }

/* ── Sidebar Search ────────────────────────────────────────────────────────── */
.sidebar-section .search-wrapper { position: relative; padding: 0 0.35rem; margin-bottom: 0.25rem; }
.sidebar-section .search-wrapper .search-input {
  width: 100%; padding: 0.45rem 0.6rem 0.45rem 2rem;
  background: var(--bg-primary); border: 1px solid var(--border-color);
  border-radius: 8px; color: var(--text-primary); font-size: 0.8rem; outline: none;
}
.sidebar-section .search-wrapper .search-input:focus { border-color: var(--accent); }
.sidebar-section .search-wrapper .search-icon {
  position: absolute; left: 0.65rem; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-size: 0.75rem;
}
.sidebar-search-wrapper { position: relative; margin: 0 0.5rem; }
.sidebar-search-wrapper .search-icon {
  position: absolute; left: 0.5rem; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-size: 0.8rem; pointer-events: none;
}

/* ── Sidebar Overlay ───────────────────────────────────────────────────────── */
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.5); z-index: 90;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.open { display: block; }

.btn-icon-io {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0.3rem 0.65rem;
  border-radius: 6px;
  transition: background 0.15s;
}
.btn-icon-io:hover { background: var(--btn-secondary-hover); color: var(--text-primary); }
.io-dropdown { position: relative; }
.io-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  min-width: 140px;
  z-index: 150;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  overflow: hidden;
}
.io-dropdown-menu.open { display: block; }
.io-item {
  padding: 0.5rem 0.85rem;
  font-size: 0.82rem;
  color: var(--text-color);
  cursor: pointer;
  transition: background 0.12s;
}
.io-item:hover { background: var(--btn-secondary-hover); }
.io-item + .io-item { border-top: 1px solid var(--border-color); }
.btn-new {
  background: var(--accent);
  color: var(--white);
  border: none;
  border-radius: 8px;
  padding: 0.45rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
.btn-new:hover { background: var(--accent-hover); }

/* ── Quick Add Bar ─────────────────────────────────────────────────────────── */
.quick-add-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
}
.quick-add-bar input {
  flex: 1;
  min-width: 200px;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 0.9rem;
}
.quick-add-preview {
  width: 100%;
  font-size: 0.8rem;
  color: var(--text-secondary);
  padding: 0.25rem 0;
}

/* ── Quick Add & Small Button ─────────────────────────────────────────────────── */
.btn-primary.btn-sm {
  width: auto;
  padding: 0.45rem 1rem;
  margin-top: 0;
  font-size: 0.85rem;
}

/* ── Quick Date Pills ─────────────────────────────────────────────────────── */
.quick-date-pills {
  display: flex;
  gap: 0.3rem;
  margin-top: 0.4rem;
}
.quick-date-pill {
  padding: 0.2rem 0.55rem;
  font-size: 0.72rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  white-space: nowrap;
}
.quick-date-pill:hover {
  background: rgba(59,130,246,0.1);
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Video Call Button ────────────────────────────────────────────────────── */
.popover-video-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--accent);
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}
.popover-video-btn:hover {
  background: var(--accent);
  color: var(--white);
}

/* ── Popover Video Link ─────────────────────────────────────────────────── */
.popover-video-link {
  font-size: 0.8rem;
  padding: 0 1rem;
  margin-bottom: 0.5rem;
}
.popover-location {
  font-size: 0.78rem;
  color: #38bdf8;
  padding: 0 1rem;
  margin-bottom: 0.5rem;
  line-height: 1.3;
  word-break: break-word;
}
.popover-source {
  padding: 0.35rem 1rem 0.5rem;
  border-top: 1px solid var(--border-color);
  margin: 0 1rem 0.5rem;
}
.popover-source-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
}
.popover-ooo {
  font-size: 0.78rem;
  color: #94a3b8;
  font-style: italic;
  padding: 0 1rem;
  margin-bottom: 0.5rem;
}

/* ── Theme / Week toggle buttons ────────────────────────────────────────────── */
.btn-theme-toggle,
.btn-week-toggle {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.75rem;
  padding: 0.25rem 0.45rem;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.btn-theme-toggle:hover,
.btn-week-toggle:hover { background: var(--btn-secondary-hover); color: var(--text-primary); }
.btn-week-toggle.active { background: var(--accent); border-color: var(--accent); color: var(--white); }

.btn-density-toggle {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.75rem;
  padding: 0.25rem 0.45rem;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.btn-density-toggle:hover { background: var(--btn-secondary-hover); color: var(--text-primary); }
.btn-density-toggle.active { background: var(--accent); border-color: var(--accent); color: var(--white); }

/* ── Search ────────────────────────────────────────────────────────────────── */
.search-wrapper {
  position: relative;
  width: 100%;
  max-width: 420px;
}
.search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.8rem;
  pointer-events: none;
}
.search-input {
  width: 100%;
  padding: 0.45rem 0.75rem 0.45rem 2.25rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.15s;
}
.search-input::placeholder { color: var(--text-muted); }
.search-input:focus { border-color: var(--accent); }

.search-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  max-height: 320px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.search-dropdown.open { display: block; }

.search-result {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.6rem 0.75rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border-color);
  transition: background 0.12s;
}
.search-result:hover { background: var(--search-hover-bg); }
.search-result:last-child { border-bottom: none; }
.search-result-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 0.3rem;
}
.search-result-info { overflow: hidden; }
.search-result-title {
  font-size: 0.85rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.search-result-date {
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin-top: 0.15rem;
}
.search-result-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.search-empty,
.search-loading {
  padding: 1.25rem 0.75rem;
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* ── Sidebar Content ────────────────────────────────────────────────────────── */
.sidebar-content {
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}
.sidebar-header h3 {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.calendar-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 0.75rem;
}
.calendar-list-placeholder {
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 0.5rem 0;
}
.calendar-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s;
}
.calendar-item:hover { background: rgba(255,255,255,0.05); }
.calendar-item-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.calendar-item-name {
  flex: 1;
  font-size: 0.82rem;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
}
.calendar-item-check {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--accent);
  flex-shrink: 0;
}
.calendar-item.hidden .calendar-item-name {
  color: var(--text-muted);
  text-decoration: line-through;
}
.btn-add-calendar {
  width: 100%;
  padding: 0.5rem;
  background: none;
  border: 1px dashed var(--border-color);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  flex-shrink: 0;
}
.btn-add-calendar:hover {
  background: rgba(59,130,246,0.1);
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Calendar ───────────────────────────────────────────────────────────────── */
.calendar-wrapper {
  flex: 1; padding: 0.75rem; overflow: hidden;
  display: flex; flex-direction: column;
}
#calendar { height: 100%; }

/* ── FullCalendar Overrides (Dark Theme) ────────────────────────────────────── */
[data-theme="dark"] .fc { height: 100% !important; }
[data-theme="dark"] .fc-theme-standard td,
[data-theme="dark"] .fc-theme-standard th { border-color: #334155; }
[data-theme="dark"] .fc-theme-standard .fc-scrollgrid { border-color: #334155; }
[data-theme="dark"] .fc .fc-toolbar-title { font-size: 1.1rem; color: #f1f5f9; }
[data-theme="dark"] .fc .fc-button-primary {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #94a3b8 !important;
  font-size: 0.8rem !important;
}
[data-theme="dark"] .fc .fc-button-primary:hover { background: #334155 !important; color: #f1f5f9 !important; }
[data-theme="dark"] .fc .fc-button-primary:not(:disabled).fc-button-active,
[data-theme="dark"] .fc .fc-button-primary:not(:disabled):active {
  background: #3b82f6 !important;
  border-color: #3b82f6 !important;
  color: #fff !important;
}
[data-theme="dark"] .fc .fc-col-header-cell-cushion { color: #94a3b8; font-size: 0.8rem; }
[data-theme="dark"] .fc .fc-daygrid-day-number { color: #94a3b8; font-size: 0.8rem; }
[data-theme="dark"] .fc .fc-daygrid-day.fc-day-today { background: rgba(59,130,246,0.08) !important; }
[data-theme="dark"] .fc .fc-daygrid-day-frame { background: #0f172a; }
[data-theme="dark"] .fc-daygrid-event { border-radius: 4px; font-size: 0.78rem; }
[data-theme="dark"] .fc .fc-timegrid-slot { background: #0f172a; }
[data-theme="dark"] .fc .fc-timegrid-axis { color: #475569; font-size: 0.75rem; }
[data-theme="dark"] .fc-timegrid-event { border-radius: 4px; }
[data-theme="dark"] .fc .fc-list-event:hover td { background: #1e293b; }
[data-theme="dark"] .fc .fc-list-day-cushion { background: #1e293b; }
[data-theme="dark"] .fc-list-event-title a { color: #e2e8f0 !important; }

/* ── FullCalendar Overrides (Light Theme) ───────────────────────────────────── */
[data-theme="light"] .fc { height: 100% !important; }
[data-theme="light"] .fc .fc-toolbar-title { font-size: 1.1rem; }
[data-theme="light"] .fc .fc-button-primary { font-size: 0.8rem !important; }
[data-theme="light"] .fc-daygrid-event { border-radius: 4px; font-size: 0.78rem; }
[data-theme="light"] .fc-timegrid-event { border-radius: 4px; }
[data-theme="light"] .fc .fc-col-header-cell-cushion { font-size: 0.8rem; }
[data-theme="light"] .fc .fc-daygrid-day-number { font-size: 0.8rem; }

/* ── FC event highlight ────────────────────────────────────────────────────── */
.fc-event-highlight {
  animation: event-pulse 0.6s ease-in-out 3;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.5) !important;
  z-index: 10 !important;
}
@keyframes event-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(59,130,246,0.5); }
  50% { box-shadow: 0 0 0 8px rgba(59,130,246,0.2); }
}
.fc-timegrid-event.fc-event-highlight { box-shadow: 0 0 0 3px rgba(59,130,246,0.5) !important; }

/* ── Modal ─────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 0;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  transform: scale(0.95);
  opacity: 0;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.modal-overlay.open .modal { transform: scale(1); opacity: 1; }
.modal h2 { font-size: 1.05rem; font-weight: 700; color: var(--text-primary); margin: 0; }

/* ── Modal Header ──────────────────────────────────────────────────────────── */
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 5;
  border-radius: 14px 14px 0 0;
}
.modal-header-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.modal-header-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(59,130,246,0.12);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
}
.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1.25rem;
  padding: 0.25rem;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background 0.15s, color 0.15s;
}
.modal-close-btn:hover { background: var(--btn-secondary-hover); color: var(--text-primary); }

/* ── Modal Body ────────────────────────────────────────────────────────────── */
.modal-body {
  padding: 1.25rem 1.5rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  overflow-y: auto;
  flex: 1;
}
.modal-body-left,
.modal-body-right {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.modal-body-full { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 0.5rem; }
.modal-field-grid { padding: 1.25rem 1.5rem; display: flex; flex-direction: column; gap: 0.75rem; }

/* ── Modal Footer ──────────────────────────────────────────────────────────── */
.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  border-radius: 0 0 14px 14px;
}

/* ── Field Styling ─────────────────────────────────────────────────────────── */
.field { margin-bottom: 0; }
.field label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}
.modal input,
.modal textarea,
.modal select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.15s;
}
.modal input:focus,
.modal textarea:focus,
.modal select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}
.modal .field input,
.modal .field textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 0.875rem;
  outline: none;
  resize: vertical;
  transition: border-color 0.15s;
}
.modal .field input:focus,
.modal .field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}
.modal .field textarea { min-height: 72px; }
.modal-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.color-row { display: flex; align-items: center; gap: 0.75rem; }
.color-row input[type="color"] {
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: none;
  cursor: pointer;
}
.color-presets { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.color-preset {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid transparent;
  transition: border-color 0.15s, transform 0.12s;
}
.color-preset:hover { transform: scale(1.15); }
.color-preset.active,
.color-preset:hover { border-color: var(--white); }
.allday-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
}
.allday-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--accent);
}
.modal-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.25rem;
  justify-content: flex-end;
}

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn-secondary {
  padding: 0.55rem 1rem;
  background: none;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 0.85rem;
  cursor: pointer;
}
.btn-secondary:hover { background: var(--btn-secondary-hover); color: var(--text-primary); }
.btn-danger {
  padding: 0.55rem 1rem;
  background: none;
  border: 1px solid var(--danger);
  border-radius: 8px;
  color: var(--danger);
  font-size: 0.85rem;
  cursor: pointer;
  margin-right: auto;
}
.btn-danger:hover { background: var(--danger); color: var(--white); }
.btn-save {
  padding: 0.55rem 1.1rem;
  background: var(--accent);
  border: none;
  border-radius: 8px;
  color: var(--white);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
.btn-save:hover { background: var(--accent-hover); }

/* ── Collapsible Sections ──────────────────────────────────────────────────── */
.modal-section {
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 0;
  margin-bottom: 0;
  overflow: hidden;
}
.modal-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
  padding: 0.65rem 1rem;
  transition: background 0.12s;
  user-select: none;
}
.modal-section-header:hover { background: var(--btn-secondary-hover); }
.modal-section-count {
  color: var(--accent);
  font-weight: 600;
}
.modal-section-chevron {
  font-size: 0.7rem;
  transition: transform 0.2s ease;
}
.modal-section.open .modal-section-chevron {
  transform: rotate(180deg);
}
.modal-section-body {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border-color);
  display: none;
}
.modal-section.open .modal-section-body { display: block; }

/* ── Recurrence UI ──────────────────────────────────────────────────────────── */
#event-repeat {
  width: 100%;
  padding: 0.55rem 0.85rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 0.875rem;
  outline: none;
  cursor: pointer;
}
#event-repeat:focus { border-color: var(--accent); }

#event-calendar {
  width: 100%;
  padding: 0.55rem 0.85rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 0.875rem;
  outline: none;
  cursor: pointer;
}
#event-calendar:focus { border-color: var(--accent); }

#repeat-options {
  background: var(--repeat-options-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.75rem;
  margin-bottom: 0;
}

.repeat-sub { margin-bottom: 0.5rem; }

#repeat-options input[type="number"],
#repeat-options input[type="date"] {
  width: 60px;
  padding: 0.35rem 0.5rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 0.8rem;
  margin: 0 0.35rem;
}
#repeat-options select {
  width: 100%;
  padding: 0.45rem 0.75rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 0.8rem;
}
#repeat-options select:focus { border-color: var(--accent); }
#repeat-count { width: 80px; }
#repeat-end-date { width: 140px; }

.weekday-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  margin-top: 0.45rem;
}

.weekday-label {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.72rem;
  padding: 0.25rem 0.45rem;
  border-radius: 4px;
  cursor: pointer;
  user-select: none;
  color: var(--text-secondary);
}
.weekday-label:hover { background: var(--btn-secondary-hover); }
.weekday-label input[type="checkbox"] {
  width: 13px;
  height: 13px;
  cursor: pointer;
  accent-color: var(--accent);
}

#repeat-ends {
  outline: none;
  cursor: pointer;
}

/* ── Event Popover ─────────────────────────────────────────────────────────── */
.event-popover {
  position: fixed;
  z-index: 999;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 0;
  width: 360px;
  max-width: calc(100vw - 24px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
  opacity: 0;
  transform: translateY(6px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.event-popover.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}
.popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem 0.25rem 1rem;
}
.popover-color-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
}
.popover-close-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1.15rem;
  padding: 0.15rem;
  border-radius: 50%;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background 0.12s, color 0.12s;
}
.popover-close-btn:hover { background: var(--btn-secondary-hover); color: var(--text-primary); }
.popover-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  padding: 0 1rem;
  margin-bottom: 0.2rem;
  line-height: 1.3;
}
.popover-time {
  font-size: 0.8rem;
  color: var(--text-secondary);
  padding: 0 1rem;
  margin-bottom: 0.5rem;
}
.popover-ooo {
  font-size: 0.78rem;
  color: #94a3b8;
  font-style: italic;
  padding: 0 1rem;
  margin-bottom: 0.5rem;
}
.popover-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
  padding: 0 1rem;
  margin-bottom: 0.75rem;
  word-break: break-word;
}
.popover-location {
  font-size: 0.78rem;
  color: #38bdf8;
  padding: 0 1rem;
  margin-bottom: 0.5rem;
  line-height: 1.3;
  word-break: break-word;
}
.popover-video-link {
  font-size: 0.8rem;
  padding: 0 1rem;
  margin-bottom: 0.5rem;
}
.popover-source {
  padding: 0.35rem 1rem 0.5rem;
  border-top: 1px solid var(--border-color);
  margin: 0 1rem 0.5rem;
}
.popover-source-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
}
.popover-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  padding: 0.65rem 1rem;
  border-top: 1px solid var(--border-color);
}
.popover-btn {
  padding: 0.4rem 0.85rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background 0.15s, color 0.15s;
}
.popover-btn-primary {
  background: var(--accent);
  color: var(--white);
}
.popover-btn-primary:hover { background: var(--accent-hover); }
.popover-btn-danger {
  background: none;
  border: 1px solid var(--danger);
  color: var(--danger);
}
.popover-btn-danger:hover { background: var(--danger); color: var(--white); }

.popover-video-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--accent);
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}
.popover-video-btn:hover {
  background: var(--accent);
  color: var(--white);
}

/* ── Toast ──────────────────────────────────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  font-size: 0.85rem;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s, transform 0.25s;
  z-index: 2000;
}
#toast.show { opacity: 1; transform: translateY(0); }
#toast.error { border-color: var(--danger); color: var(--danger-text); }

/* ── Drag & Drop Feedback ──────────────────────────────────────────────────── */
.fc-event-dragging {
  animation: event-pulse 0.8s ease-in-out infinite;
}
@keyframes event-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.drag-time-indicator {
  position: fixed;
  z-index: 10000;
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 0.25rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 600;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: none;
}

/* ── Event location icon ───────────────────────────────────────────────────── */
.event-loc-icon {
  margin-right: 2px;
  font-size: 0.75em;
  vertical-align: middle;
}

/* ── Location link in modal ────────────────────────────────────────────────── */
.location-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
  color: var(--accent);
  text-decoration: none;
  margin-top: 0.3rem;
}
.location-link:hover { text-decoration: underline; }
#map-link-anchor {
  color: var(--accent);
  text-decoration: none;
}
#map-link-anchor:hover { text-decoration: underline; }

/* ── OAuth Provider Button ──────────────────────────────────────────────────── */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.2rem 0 1rem;
  color: var(--text-secondary);
  font-size: 0.75rem;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255,255,255,0.1);
}
.btn-provider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  background: rgba(255,255,255,0.05);
  color: #f8fafc;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  box-sizing: border-box;
  transition: background 0.2s, border-color 0.2s;
}
.btn-provider:hover { background: rgba(255,255,255,0.12); }
.btn-projecthub:hover { border-color: #38bdf8; }

/* ── Context Menu ──────────────────────────────────────────────────────────── */
.context-menu {
  position: fixed;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.35rem 0;
  min-width: 180px;
  z-index: 3000;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.ctx-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.85rem;
  font-size: 0.82rem;
  color: var(--text-color);
  cursor: pointer;
  position: relative;
  transition: background 0.12s;
}
.ctx-item:hover { background: var(--context-hover-bg); }
.ctx-item i { width: 16px; text-align: center; color: var(--text-secondary); font-size: 0.75rem; }
.ctx-item[data-action="delete"] { color: var(--danger); }
.ctx-item[data-action="delete"] i { color: var(--danger); }
[data-theme="dark"] .ctx-item[data-action="delete"]:hover { background: rgba(239,68,68,0.12); }
[data-theme="light"] .ctx-item[data-action="delete"]:hover { background: rgba(239,68,68,0.08); }
.ctx-arrow { margin-left: auto; color: var(--text-muted); font-size: 0.75rem; }
.ctx-has-sub { justify-content: space-between; }
.ctx-color-label { display: flex; align-items: center; gap: 0.6rem; }
.ctx-submenu {
  display: none;
  position: absolute;
  top: 0;
  left: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.35rem;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.ctx-has-sub:hover .ctx-submenu,
.ctx-has-sub.open .ctx-submenu { display: flex; gap: 0.3rem; }
.ctx-color-item {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.12s;
}
.ctx-color-item:hover { border-color: var(--white); }

/* ── Attachments ──────────────────────────────────────────────────────────── */
.attachments-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}
.attachment-empty {
  font-size: 0.78rem;
  color: var(--text-muted);
}
.attachment-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.6rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 0.78rem;
}
.attachment-name {
  flex: 1;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.attachment-size {
  color: var(--text-muted);
  white-space: nowrap;
}
.attachment-delete-btn {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0 0.2rem;
}
.attachment-delete-btn:hover { color: var(--danger-text); }
.attachment-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  background: var(--bg-primary);
  border: 1px dashed var(--border-color);
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 0.78rem;
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s;
}
.attachment-upload-btn:hover { border-color: var(--accent); color: var(--accent); }
.attachment-progress {
  height: 3px;
  background: var(--accent);
  border-radius: 2px;
  margin-top: 0.35rem;
  transition: width 0.3s;
}

/* ── Cheatsheet ────────────────────────────────────────────────────────────── */
.cheatsheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.cheatsheet-overlay.open { opacity: 1; pointer-events: all; }
.cheatsheet {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
  width: 100%;
  max-width: 380px;
}
.cheatsheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.cheatsheet-header h3 { font-size: 1rem; font-weight: 700; color: var(--text-primary); }
.cheatsheet-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.3rem;
  cursor: pointer;
  line-height: 1;
}
.cheatsheet-close:hover { color: var(--text-primary); }
.cheatsheet-table { width: 100%; border-collapse: collapse; }
.cheatsheet-table td {
  padding: 0.45rem 0;
  font-size: 0.82rem;
  color: var(--text-color);
  border-bottom: 1px solid var(--cheatsheet-row-border);
}
.cheatsheet-table td:first-child { width: 90px; color: var(--text-secondary); }
kbd {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  font-size: 0.72rem;
  font-family: monospace;
  background: var(--kbd-bg);
  border: 1px solid var(--kbd-border);
  border-radius: 4px;
  color: var(--kbd-color);
}

/* ── Sidebar Calendar Item ─────────────────────────────────────────────────── */
.cal-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
  transition: background 0.12s;
}
.cal-item:hover { background: var(--search-hover-bg); }
.cal-item.active { background: var(--accent); color: var(--white); }
.cal-item-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.cal-item-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-item-toggle {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid var(--border-color);
  cursor: pointer;
  flex-shrink: 0;
}

/* ── IO Dropdown ───────────────────────────────────────────────────────────── */
.btn-icon-io {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.75rem;
  padding: 0.25rem 0.45rem;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}
.btn-icon-io:hover { background: var(--btn-secondary-hover); color: var(--text-primary); }
.io-dropdown { position: relative; }
.io-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  min-width: 150px;
  z-index: 200;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  padding: 0.25rem 0;
}
.io-dropdown-menu.open { display: block; }
.io-item {
  padding: 0.45rem 0.85rem;
  font-size: 0.82rem;
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.12s;
}
.io-item:hover { background: var(--search-hover-bg); }

/* ── Markdown Toolbar ───────────────────────────────────────────────────────── */
.md-toolbar {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 0.35rem;
}
.md-btn {
  padding: 0.2rem 0.4rem;
  font-size: 0.7rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-secondary);
  cursor: pointer;
}
.md-btn:hover { border-color: var(--accent); color: var(--text-primary); }
.md-btn-preview {
  margin-left: auto;
}
.md-preview {
  margin-top: 0.35rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 0.82rem;
  color: var(--text-primary);
  min-height: 48px;
  line-height: 1.4;
  word-break: break-word;
}
.md-preview strong { color: var(--text-primary); }
.md-preview em { color: var(--text-secondary); }
.md-preview a { color: var(--accent); text-decoration: underline; }
.md-preview ul { margin: 0.25rem 0 0.25rem 1.2rem; }
.md-preview li { margin-bottom: 0.15rem; }

.popover-desc strong { color: var(--text-primary); }
.popover-desc em { color: var(--text-secondary); }
.popover-desc a { color: var(--accent); text-decoration: underline; }
.popover-desc ul { margin: 0.15rem 0 0.15rem 1rem; }
.popover-desc li { margin-bottom: 0.1rem; font-size: 0.78rem; }

/* ── Undo Toast ───────────────────────────────────────────────────────────────── */
#toast.has-undo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.toast-undo-btn {
  background: var(--accent);
  color: var(--white);
  border: none;
  border-radius: 4px;
  padding: 0.2rem 0.55rem;
  font-size: 0.78rem;
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
}
.toast-undo-btn:hover { background: var(--accent-hover); }

/* ── Reminders ────────────────────────────────────────────────────────────────── */
.reminder-select {
  width: 100%;
  padding: 0.55rem 0.85rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 0.875rem;
  outline: none;
  cursor: pointer;
  margin-top: 0.4rem;
}
.reminder-select:focus { border-color: var(--accent); }
.reminders-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.25rem;
  min-height: 0;
}
.reminder-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.6rem;
  background: rgba(59,130,246,0.15);
  border: 1px solid rgba(59,130,246,0.3);
  border-radius: 16px;
  font-size: 0.75rem;
  color: var(--accent);
}
.reminder-pill-delete {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 0.75rem;
  line-height: 1;
  padding: 0;
  margin-left: 0.15rem;
}
.reminder-pill-delete:hover { color: var(--danger-text); }

/* ── Public Link Modal ────────────────────────────────────────────────────────── */
.public-link-info { margin-bottom: 0.5rem; }
.public-link-cal-name {
  font-size: 0.9rem;
  color: var(--text-primary);
  font-weight: 600;
  margin-bottom: 1rem;
}
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0;
  font-size: 0.85rem;
  color: var(--text-color);
}
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--border-color);
  border-radius: 24px;
  transition: 0.2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: var(--text-secondary);
  border-radius: 50%;
  transition: 0.2s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--accent); }
.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
  background: var(--white);
}
.copy-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.copy-row input {
  flex: 1;
  padding: 0.55rem 0.75rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 0.8rem;
  outline: none;
  cursor: text;
}
.btn-copy {
  padding: 0.55rem 0.65rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.12s, color 0.12s;
}
.btn-copy:hover { background: var(--accent); color: var(--white); border-color: var(--accent); }
.public-link-warning {
  margin-top: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: rgba(245,158,11,0.1);
  border: 1px solid rgba(245,158,11,0.3);
  border-radius: 8px;
  font-size: 0.78rem;
  color: #f59e0b;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* ── Calendar item public link button ─────────────────────────────────────────── */
.cal-item-public-link {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.72rem;
  padding: 0.15rem 0.3rem;
  border-radius: 4px;
  transition: color 0.12s, background 0.12s;
  flex-shrink: 0;
}
.cal-item-public-link:hover { color: var(--accent); background: rgba(59,130,246,0.1); }

.btn-biz-toggle {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.75rem;
  padding: 0.25rem 0.45rem;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}
.btn-biz-toggle:hover { background: var(--btn-secondary-hover); color: var(--text-primary); }
.btn-biz-toggle.active { background: var(--accent); border-color: var(--accent); color: var(--white); }

/* ── Invitations Dropdown ───────────────────────────────────────────────── */
.invitations-dropdown { position: relative; }
.btn-invitations {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.75rem;
  padding: 0.25rem 0.45rem;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  position: relative;
}
.btn-invitations:hover { background: var(--btn-secondary-hover); color: var(--text-primary); }
.invitation-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: var(--danger);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
}
.invitations-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  min-width: 320px;
  max-height: 360px;
  overflow-y: auto;
  z-index: 200;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  padding: 0.35rem 0;
}
.invitations-dropdown-menu.open { display: block; }
.invitation-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.85rem;
  border-bottom: 1px solid var(--border-color);
}
.invitation-item:last-child { border-bottom: none; }
.invitation-item-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.invitation-item-info { flex: 1; overflow: hidden; }
.invitation-item-title {
  font-size: 0.82rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.invitation-item-date {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}
.invitation-item-status {
  font-size: 0.68rem;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
  flex-shrink: 0;
}
.invitation-item-status.pending { background: rgba(245,158,11,0.2); color: #f59e0b; }
.invitation-item-status.accepted { background: rgba(16,185,129,0.2); color: #10b981; }
.invitation-item-actions {
  display: flex;
  gap: 0.3rem;
  flex-shrink: 0;
}
.btn-inv-accept, .btn-inv-decline {
  padding: 0.2rem 0.4rem;
  font-size: 0.65rem;
  border-radius: 4px;
  cursor: pointer;
  border: none;
  font-weight: 600;
}
.btn-inv-accept { background: #10b981; color: #fff; }
.btn-inv-accept:hover { background: #059669; }
.btn-inv-decline { background: #ef4444; color: #fff; }
.btn-inv-decline:hover { background: #dc2626; }
.invitation-empty {
  padding: 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* ── Attendees ──────────────────────────────────────────────────────────── */
.attendees-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 0.5rem;
}
.attendee-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.5rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 0.8rem;
}
.attendee-item-name { flex: 1; color: var(--text-primary); }
.attendee-status-badge {
  font-size: 0.65rem;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
}
.attendee-status-badge.accepted { background: rgba(16,185,129,0.2); color: #10b981; }
.attendee-status-badge.pending { background: rgba(245,158,11,0.2); color: #f59e0b; }
.attendee-status-badge.declined { background: rgba(239,68,68,0.2); color: #ef4444; }
.attendee-status-badge.tentative { background: rgba(59,130,246,0.2); color: #3b82f6; }
.attendee-add-row { position: relative; }
.attendee-add-row input {
  width: 100%;
  padding: 0.4rem 0.6rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 0.78rem;
  outline: none;
}
.attendee-add-row input:focus { border-color: var(--accent); }
.attendee-autocomplete {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  max-height: 160px;
  overflow-y: auto;
  z-index: 50;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.attendee-autocomplete.open { display: block; }
.attendee-autocomplete-item {
  padding: 0.4rem 0.6rem;
  font-size: 0.78rem;
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.12s;
}
.attendee-autocomplete-item:hover { background: var(--search-hover-bg); }

/* ── RSVP Buttons ───────────────────────────────────────────────────────── */
.rsvp-buttons {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.btn-rsvp {
  flex: 1;
  padding: 0.4rem 0.6rem;
  border: none;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn-rsvp:hover { opacity: 0.85; }
.btn-rsvp-accept { background: #10b981; color: #fff; }
.btn-rsvp-decline { background: #ef4444; color: #fff; }
.btn-rsvp-tentative { background: #3b82f6; color: #fff; }
.btn-rsvp.active { box-shadow: 0 0 0 2px var(--white); }

/* ── Notify Row ─────────────────────────────────────────────────────────── */
.notify-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.notify-row input[type="checkbox"] {
  width: 15px;
  height: 15px;
  cursor: pointer;
  accent-color: var(--accent);
}
.notify-row label { margin-bottom: 0 !important; letter-spacing: 0 !important; text-transform: none !important; font-size: 0.8rem !important; }

/* ── Tablet ≤ 1024px ──────────────────────────────── */
@media (max-width: 1024px) {
  .main-sidebar .btn-new { font-size: 1rem; padding: 0.45rem; min-width: 40px; }
}

/* ── Mobile ≤ 768px ───────────────────────────────── */
@media (max-width: 767px) {
  .mobile-topbar { display: flex; }
  .main-sidebar {
    position: fixed; top: 0; left: 0; width: 280px; min-width: 280px;
    height: 100vh; z-index: 110; transform: translateX(-100%);
    transition: transform 0.3s ease; box-shadow: none;
  }
  .main-sidebar.open { transform: translateX(0); box-shadow: 4px 0 24px rgba(0,0,0,0.5); }
  .main-sidebar.open .sidebar-label,
  .main-sidebar.open .sidebar-section-title,
  .main-sidebar.open .sidebar-user-name,
  .main-sidebar.open .sidebar-logo,
  .main-sidebar.open .sidebar-user,
  .main-sidebar.open .calendar-list,
  .main-sidebar.open .ecosystem-list,
  .main-sidebar.open #btn-add-calendar,
  .main-sidebar.open .ecosystem-header { display: block !important; }
  .main-sidebar.open .sidebar-collapse-btn .fa-angles-left { display: inline-block !important; }
  .main-sidebar.open .sidebar-collapse-btn::after { content: none; }
  .main-sidebar.open .sidebar-nav-item,
  .main-sidebar.open .sidebar-view-btn,
  .main-sidebar.open .sidebar-action-btn,
  .main-sidebar.open .sidebar-footer-btn { justify-content: flex-start; padding: 0.5rem 0.35rem; }
  .main-sidebar.collapsed { width: auto; min-width: auto; }
  .calendar-wrapper { padding: 0.5rem; }
  .modal-overlay {
    align-items: flex-end;
  }
  .modal {
    max-width: 100% !important;
    max-height: 100vh;
    margin: 0;
    border-radius: 16px 16px 0 0;
  }
  .modal-header {
    padding: 0.75rem 1rem;
    border-radius: 16px 16px 0 0;
  }
  .modal-body {
    grid-template-columns: 1fr;
    padding: 1rem;
    gap: 0.75rem;
  }
  .modal-body-left,
  .modal-body-right { gap: 0.75rem; }
  .modal-body-full { gap: 0.5rem; }
  .modal-footer {
    padding: 0.75rem 1rem;
    flex-wrap: wrap;
  }
  .modal-footer .btn { flex: 1; }
  .modal input,
  .modal textarea,
  .modal select { font-size: 16px; }
  .modal .field input,
  .modal .field textarea { font-size: 16px; }
  .modal .field label { font-size: 0.82rem; }
  .modal-row { grid-template-columns: 1fr; gap: 0.5rem; }
  .modal-field-grid { padding: 1rem; }
  .modal-header-left { gap: 0.45rem; }
  .modal-header-icon { width: 28px; height: 28px; font-size: 0.8rem; }

  /* Event popover slides up from bottom */
  .event-popover {
    width: 100%;
    max-width: 100%;
    left: 0 !important;
    top: auto !important;
    bottom: 0;
    border-radius: 16px 16px 0 0;
    padding: 0;
    transform: translateY(100%) scale(1);
  }
  .event-popover.open {
    transform: translateY(0) scale(1);
  }

  /* Touch-friendly sizing */
  .fc .fc-button {
    padding: 0.4rem 0.55rem !important;
    font-size: 0.72rem !important;
  }

  .fc .fc-toolbar-title {
    font-size: 0.9rem !important;
  }

  /* Hide toolbar text labels on mobile, keep icons */
  .fc .fc-button .fc-icon {
    font-size: 1rem;
  }

  .fc-toolbar-chunk {
    display: flex;
    flex-wrap: wrap;
    gap: 0.2rem;
  }

  /* Touch-friendly bigger buttons in modal */
  .modal-footer .btn-save,
  .modal-footer .btn-secondary,
  .modal-footer .btn-danger {
    padding: 0.65rem 1rem;
    font-size: 0.9rem;
  }
  .btn-save,
  .btn-secondary,
  .btn-danger {
    padding: 0.65rem 1rem;
    font-size: 0.9rem;
  }

  .search-input {
    font-size: 0.9rem;
    padding: 0.55rem 0.75rem 0.55rem 2.25rem;
  }

  .cheatsheet {
    max-width: 100%;
    margin: 0 1rem;
    padding: 1rem;
  }

  .popover-btn {
    padding: 0.45rem 0.85rem;
    font-size: 0.82rem;
  }

  .ctx-item {
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
  }
}

/* ── Calendar Share Badge ─────────────────────────────────────────────── */
.cal-item-badge {
  font-size: 0.65rem;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
  margin-left: auto;
  margin-right: 0.3rem;
  white-space: nowrap;
}
.cal-item-badge.shared {
  background: rgba(59,130,246,0.15);
  color: var(--accent);
}
.cal-item-badge.view-only {
  background: rgba(245,158,11,0.15);
  color: #f59e0b;
}

/* ── Calendar Share Button ──────────────────────────────────────────────── */
.cal-item-share-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.75rem;
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
  flex-shrink: 0;
  display: none;
}
.cal-item:hover .cal-item-share-btn,
.cal-item:focus-within .cal-item-share-btn {
  display: inline-flex;
}
.cal-item-share-btn:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.08);
}
.cal-item-share-btn.shared {
  display: inline-flex;
  color: var(--accent);
}

/* ── Share List ─────────────────────────────────────────────────────────── */
.share-list {
  max-height: 160px;
  overflow-y: auto;
  margin-bottom: 0.5rem;
}
.share-list-placeholder {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 0.5rem 0;
}
.share-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.5rem;
  background: var(--bg-primary);
  border-radius: 6px;
  margin-bottom: 0.25rem;
  font-size: 0.82rem;
  color: var(--text-primary);
}
.share-item-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.share-item-perm {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: capitalize;
}
.share-item-perm.edit { color: #f59e0b; }
.share-revoke-btn {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0 0.2rem;
  transition: color 0.15s;
}
.share-revoke-btn:hover { color: #f87171; }

/* ── Share modal dropdown ───────────────────────────────────────────────── */
#share-user-select,
#share-permission {
  width: 100%;
  padding: 0.55rem 0.85rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 0.875rem;
  outline: none;
  cursor: pointer;
}
#share-user-select:focus,
#share-permission:focus {
  border-color: var(--accent);
}

/* ── Cal item icon for shared calendars ─────────────────────────────────── */
.cal-item-shared-icon {
  font-size: 0.7rem;
  margin-right: 0.2rem;
  opacity: 0.7;
}

/* ── Cal item row container ────────────────────────────────────────────── */
.cal-item-row {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex: 1;
  min-width: 0;
}

/* ── External Events ────────────────────────────────────────────────────── */
.fc-event-external {
    opacity: 0.85;
    border-left: 3px solid currentColor !important;
}
.event-src-icon {
    font-size: 0.75em;
    margin-right: 1px;
    vertical-align: middle;
}

/* ── Ecosystem Sidebar ───────────────────────────────────────────────────── */
.ecosystem-header {
    padding-top: 0.5rem;
}
.ecosystem-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 0.75rem;
}
.ecosystem-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.12s;
}
.ecosystem-item:hover { background: rgba(255,255,255,0.05); }
.ecosystem-item-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.ecosystem-item-icon {
    font-size: 0.85rem;
    flex-shrink: 0;
}
.ecosystem-item-name {
    flex: 1;
    font-size: 0.82rem;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
}
.ecosystem-item-check {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--accent);
    flex-shrink: 0;
}
.ecosystem-item.hidden .ecosystem-item-name {
    color: var(--text-muted);
    text-decoration: line-through;
}
.ecosystem-item.hidden .ecosystem-item-icon {
    opacity: 0.4;
}
.external-source-badge {
    font-size: 0.65rem;
    opacity: 0.7;
    margin-left: 0.25rem;
    color: var(--text-muted);
    font-style: italic;
    white-space: nowrap;
}
.external-source-badge.coming-soon {
    color: #f59e0b;
    background: rgba(245,158,11,0.1);
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
}
.ecosystem-item-disabled-check {
    opacity: 0.3;
    pointer-events: none;
}

/* ── Mini Calendar ─────────────────────────────────────────────────────── */
.mini-calendar { margin-bottom: 1rem; user-select: none; }
.mini-cal-header { display: flex; align-items: center; justify-content: space-between; padding: 0.25rem 0; }
.mini-cal-title { font-weight: 600; font-size: 0.85rem; cursor: pointer; }
.mini-cal-nav { background: none; border: none; color: var(--text-secondary); cursor: pointer; padding: 0.25rem; border-radius: 50%; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; }
.mini-cal-nav:hover { background: rgba(255,255,255,0.1); }
.mini-cal-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; font-size: 0.65rem; color: var(--text-secondary); padding: 0.25rem 0; }
.mini-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; font-size: 0.75rem; }
.mini-cal-day { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; cursor: pointer; border-radius: 50%; color: var(--text-primary); margin: auto; position: relative; }
.mini-cal-day:hover { background: rgba(255,255,255,0.1); }
.mini-cal-day.today { background: var(--accent); color: white; font-weight: 700; }
.mini-cal-day.selected { background: rgba(59,130,246,0.3); }
.mini-cal-day.other-month { color: var(--text-secondary); opacity: 0.4; }
.mini-cal-day.has-events::after { content: ''; position: absolute; bottom: 2px; width: 4px; height: 4px; border-radius: 50%; background: var(--accent); }
.mini-cal-day.today.has-events::after { background: white; }

/* ── Availability Panel ─────────────────────────────────────────────────── */
.availability-panel {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.75rem;
  margin-top: 0.5rem;
  max-height: 200px;
  overflow-y: auto;
}
.availability-panel h4 {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  color: var(--text-primary);
}
.availability-panel div {
  font-size: 0.8rem;
  padding: 0.25rem 0;
  color: var(--text-secondary);
}
.availability-panel .avail-free-slot {
  display: inline-block;
  background: rgba(16,185,129,0.2);
  color: #10b981;
  border: 1px solid rgba(16,185,129,0.3);
  border-radius: 4px;
  padding: 0.15rem 0.45rem;
  margin: 0.15rem 0.25rem 0.15rem 0;
  cursor: pointer;
  font-size: 0.72rem;
  transition: background 0.12s;
}
.availability-panel .avail-free-slot:hover {
  background: rgba(16,185,129,0.35);
}
.availability-panel .avail-busy-tag {
  display: inline-block;
  background: rgba(239,68,68,0.15);
  color: #ef4444;
  border: 1px solid rgba(239,68,68,0.25);
  border-radius: 4px;
  padding: 0.15rem 0.45rem;
  margin: 0.15rem 0.25rem 0.15rem 0;
  font-size: 0.72rem;
}

/* ── World Clock ────────────────────────────────────────────────────────── */
.tz-world-clock {
  cursor: pointer;
  transition: background 0.15s;
}
.tz-world-clock:hover {
  background: var(--accent);
  color: var(--white);
  border-color: var(--accent);
}
.tz-world-clock::before {
  content: '🌍 ';
}

/* ── Calendar Layout ────────────────────────────────────────────────────────── */
.calendar-layout {
  display: flex; flex: 1; position: relative; overflow: hidden;
  height: 100%;
}
.calendar-main {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
  overflow: hidden;
}

/* ── View Density: Compact ─────────────────────────────────────────────────── */
.density-compact .fc-event { font-size: 0.7rem; padding: 1px 3px; }
.density-compact .fc-daygrid-event { margin-bottom: 1px; }
.density-compact .fc-timegrid-slot { height: 2em; }

/* ── Holiday Events ─────────────────────────────────────────────────────────── */
.holiday-event { font-size: 0.65rem !important; opacity: 0.7; }

/* ── Calendar Settings Menu ─────────────────────────────────────────────────── */
.calendar-settings-menu { position: fixed; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 8px; padding: 0.25rem; z-index: 200; min-width: 160px; box-shadow: 0 4px 12px rgba(0,0,0,0.3); }
.calendar-settings-menu .cs-item { display: block; width: 100%; text-align: left; padding: 0.5rem 0.75rem; border: none; background: none; color: var(--text-primary); cursor: pointer; border-radius: 4px; font-size: 0.85rem; }
.calendar-settings-menu .cs-item:hover { background: rgba(255,255,255,0.05); }
.calendar-gear { background: none; border: none; color: var(--text-secondary); cursor: pointer; padding: 0.25rem; border-radius: 4px; opacity: 0; transition: opacity 0.2s; font-size: 0.75rem; margin-left: auto; flex-shrink: 0; }
.calendar-item:hover .calendar-gear { opacity: 1; }

/* ── OOO Events ─────────────────────────────────────────────────────────────── */
.fc-event-ooo { opacity: 0.7; border-left: 3px solid #94a3b8 !important; font-style: italic; }

/* ── Event Label Tag ─────────────────────────────────────────────────────── */
.fc-event-label-tag {
    font-size: 0.65rem;
    background: rgba(255,255,255,0.15);
    padding: 0 4px;
    border-radius: 3px;
    margin-top: 2px;
    display: inline-block;
}

/* ── Form Row / Checkbox Label ──────────────────────────────────────────────── */
.form-row { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.75rem; }
.checkbox-label { display: flex; align-items: center; gap: 0.5rem; color: var(--text-secondary); font-size: 0.875rem; cursor: pointer; }
.checkbox-label input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; accent-color: var(--accent); }
.checkbox-label span { color: var(--text-secondary); }

/* ── Schedule View ───────────────────────────────────────────────────────── */
.schedule-view { padding: 1rem; background: var(--bg-primary); min-height: 100%; }
.schedule-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.schedule-header h3 { margin: 0; font-size: 1.2rem; }
.schedule-date-header { font-size: 0.9rem; font-weight: 600; color: var(--text-primary); padding: 0.75rem 0 0.5rem; border-bottom: 1px solid var(--border-color); margin-top: 1rem; }
.schedule-item { padding: 0.75rem 1rem; margin-bottom: 0.5rem; background: var(--bg-card); border-radius: 8px; display: grid; grid-template-columns: 80px 1fr; gap: 0.75rem; align-items: start; }
.schedule-item-time { font-size: 0.8rem; color: var(--text-secondary); }
.schedule-item-title { font-weight: 600; font-size: 0.9rem; }
.schedule-item-desc { font-size: 0.8rem; color: var(--text-secondary); grid-column: 2; margin-top: 0.25rem; }
.schedule-empty { text-align: center; color: var(--text-secondary); padding: 3rem 1rem; }

/* ── Schedule Toggle Button ──────────────────────────────────────────────── */
.btn-schedule-toggle {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.75rem;
  padding: 0.25rem 0.55rem;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}
.btn-schedule-toggle:hover { background: var(--btn-secondary-hover); color: var(--text-primary); }
.btn-schedule-toggle.active { background: var(--accent); border-color: var(--accent); color: var(--white); }

/* ── Declined Events ─────────────────────────────────────────────────────────── */
.fc-event-declined { opacity: 0.4; text-decoration: line-through; }

/* ── Declined / Weather Toggle Buttons ───────────────────────────────────────── */
.btn-toggle {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.75rem;
  padding: 0.25rem 0.45rem;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}
.btn-toggle:hover { background: var(--btn-secondary-hover); color: var(--text-primary); }
.btn-toggle.active { background: var(--accent); border-color: var(--accent); color: var(--white); }

/* ── Weather Icons in Day Cells ──────────────────────────────────────────────── */
.weather-icon { font-size: 0.7rem; margin-left: auto; opacity: 0.8; }
.fc-daygrid-day-top { display: flex; align-items: center; justify-content: space-between; }

/* ── Profile Panel ──────────────────────────────────────────────────────── */
.profile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1500;
    backdrop-filter: blur(2px);
}
.profile-overlay.open { display: block; }
.profile-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 400px;
    max-width: 100vw;
    height: 100vh;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    z-index: 1501;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
}
.profile-panel.open { transform: translateX(0); }

.profile-panel-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    background: var(--bg-secondary);
    z-index: 5;
}
.profile-avatar {
    width: 48px; height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple, #8b5cf6));
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem; font-weight: 700; color: white;
    flex-shrink: 0;
}
.profile-name { font-size: 1.05rem; font-weight: 600; color: var(--text-primary); }
.profile-role { font-size: 0.75rem; color: var(--text-secondary); }
.profile-close-btn {
    margin-left: auto;
    background: none; border: none; color: var(--text-secondary);
    cursor: pointer; font-size: 1.2rem; padding: 0.5rem;
    border-radius: 50%; width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
}
.profile-close-btn:hover { background: rgba(255,255,255,0.1); color: var(--text-primary); }

.profile-tabs {
    display: flex;
    overflow-x: auto;
    padding: 0.5rem 1rem;
    gap: 0.25rem;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 97px;
    background: var(--bg-secondary);
    z-index: 4;
}
.profile-tab {
    padding: 0.5rem 0.85rem;
    border: none;
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 8px;
    font-size: 0.8rem;
    white-space: nowrap;
    font-weight: 500;
    transition: all 0.2s;
}
.profile-tab:hover { background: rgba(255,255,255,0.05); color: var(--text-primary); }
.profile-tab.active { background: var(--accent); color: white; }

.profile-tab-content { display: none; padding: 1.25rem; flex: 1; overflow-y: auto; }
.profile-tab-content.active { display: block; }

.profile-section { margin-bottom: 1.5rem; }
.profile-section h4 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}
.pf-field { margin-bottom: 0.85rem; }
.pf-field label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.pf-field input, .pf-field select {
    width: 100%;
    padding: 0.55rem 0.75rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.85rem;
    outline: none;
}
.pf-field input:focus, .pf-field select:focus { border-color: var(--accent); }
.pf-field input:disabled { opacity: 0.5; cursor: not-allowed; }
.pf-hint { font-size: 0.75rem; color: var(--text-secondary); margin-bottom: 0.5rem; }

.danger-zone {
    border: 1px solid var(--danger);
    border-radius: 10px;
    padding: 1rem;
    background: rgba(239,68,68,0.05);
}

.profile-actions { margin-top: 1rem; }
.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.8rem; }

/* API key items */
.api-key-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.6rem 0.75rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
}
.api-key-name { font-weight: 500; color: var(--text-primary); }
.api-key-prefix { font-family: monospace; color: var(--text-secondary); margin: 0 0.5rem; }
.api-key-actions { display: flex; gap: 0.25rem; }
.api-key-actions button {
    background: none; border: none; color: var(--text-secondary);
    cursor: pointer; padding: 0.25rem; border-radius: 4px;
    font-size: 0.75rem;
}
.api-key-actions button:hover { color: var(--text-primary); background: rgba(255,255,255,0.05); }
.api-key-actions button.danger:hover { color: var(--danger); }

/* Activity items */
.activity-item {
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.8rem;
    color: var(--text-secondary);
}
.activity-item:last-child { border-bottom: none; }
.activity-action { color: var(--text-primary); font-weight: 500; }
.activity-time { font-size: 0.7rem; color: var(--text-muted); margin-top: 0.15rem; }

/* Mobile profile panel */
@media (max-width: 640px) {
    .profile-panel { width: 100%; max-width: 100%; }
    .profile-panel-header { padding: 1rem; }
    .profile-tabs { padding: 0.5rem 0.75rem; }
    .profile-tab-content { padding: 0.75rem; }
    .pf-field input, .pf-field select { font-size: 16px; }
}

/* ── Lang Switcher ──────────────────────────────────────────────────── */
.lang-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.lang-toggle-btn {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.75rem;
  padding: 0.25rem 0.55rem;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  white-space: nowrap;
}
.lang-toggle-btn:hover { background: var(--btn-secondary-hover); color: var(--text-primary); }
.lang-code { font-size: 0.7rem; }
.lang-toggle-btn .arrow { font-size: 0.55rem; margin-left: 0.1rem; }
.lang-toggle-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  min-width: 170px;
  z-index: 250;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  overflow: hidden;
  padding: 0.25rem 0;
}
.lang-toggle.open .lang-toggle-dropdown { display: block; }
.lang-toggle-option {
  padding: 0.5rem 0.85rem;
  font-size: 0.82rem;
  color: var(--text-color);
  cursor: pointer;
  transition: background 0.12s;
  white-space: nowrap;
}
.lang-toggle-option:hover { background: var(--search-hover-bg); }
.lang-toggle-option.active { background: var(--accent); color: var(--white); }

/* ── PH Account Picker ───────────────────────────────────────────────── */
.ph-login-wrapper { position: relative; }
.ph-account-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  z-index: 200;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  overflow: hidden;
  padding: 0.25rem 0;
}
.ph-account-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.85rem;
  font-size: 0.85rem;
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.12s;
}
.ph-account-item:hover { background: var(--search-hover-bg); }
.ph-account-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700; color: white;
  flex-shrink: 0;
}
.ph-account-name { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.ph-account-remove {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; font-size: 1rem; padding: 0 0.2rem;
  opacity: 0; transition: opacity 0.12s; line-height: 1;
}
.ph-account-item:hover .ph-account-remove { opacity: 1; }
.ph-account-remove:hover { color: var(--danger); }
.ph-account-divider {
  height: 1px;
  background: var(--border-color);
  margin: 0.25rem 0.5rem;
}
.ph-account-add {
  cursor: pointer;
}
.ph-account-add:hover {
  background: rgba(59,130,246,0.08);
}

/* ── Small Mobile ≤ 480px ────────────────────────── */
@media (max-width: 480px) {
  .main-sidebar.open { width: 100%; min-width: 100%; }
  .mobile-topbar { height: 48px; padding: 0 0.5rem; }
  .mobile-topbar .mobile-logo { font-size: 1rem; }
  .main-sidebar .sidebar-nav-item,
  .main-sidebar .sidebar-view-btn,
  .main-sidebar .sidebar-action-btn,
  .main-sidebar .sidebar-footer-btn { min-height: 44px; }
  .login-card { padding: 1.5rem 1rem; }
  .login-card .btn-primary, .login-card .btn-provider { min-height: 44px; }
  .calendar-wrapper { padding: 0.35rem; }
  .fc .fc-toolbar { flex-wrap: wrap; gap: 0.35rem; }
  .fc .fc-toolbar-title { font-size: 0.8rem !important; }
  .fc .fc-button { padding: 0.35rem 0.45rem !important; font-size: 0.7rem !important; min-height: 36px; min-width: 36px; }
  .sidebar-footer-row { gap: 0.15rem; }
  .sidebar-footer-btn { padding: 0.45rem 0.3rem; }
  .event-popover .popover-actions { flex-wrap: wrap; }
  .event-popover .popover-btn { flex: 1; min-height: 40px; }
}

/* ── AI Agent Chat ──────────────────────────────────────────────────── */
.agent-fab {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  border: none;
  color: white;
  font-size: 1.4rem;
  cursor: pointer;
  z-index: 1400;
  box-shadow: 0 4px 16px rgba(59,130,246,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s;
}
.agent-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 24px rgba(59,130,246,0.5);
}
.agent-panel {
  position: fixed;
  bottom: 5rem;
  right: 1.5rem;
  width: 380px;
  max-width: calc(100vw - 2rem);
  height: 520px;
  max-height: calc(100vh - 7rem);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  z-index: 1400;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
  transform: translateY(12px) scale(0.95);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.22s ease, opacity 0.22s ease;
}
.agent-panel.open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: all;
}
.agent-header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}
.agent-header-icon {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.agent-header-title {
  font-size: 0.9rem; font-weight: 700; color: var(--text-primary);
}
.agent-header-sub {
  font-size: 0.7rem; color: var(--text-muted);
}
.agent-close {
  margin-left: auto;
  background: none; border: none; color: var(--text-secondary);
  cursor: pointer; font-size: 1.1rem; padding: 0.25rem;
  border-radius: 50%; width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
}
.agent-close:hover { background: var(--btn-secondary-hover); }
.agent-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.agent-msg {
  max-width: 85%;
  padding: 0.55rem 0.75rem;
  border-radius: 12px;
  font-size: 0.82rem;
  line-height: 1.4;
  word-break: break-word;
}
.agent-msg.user {
  align-self: flex-end;
  background: var(--accent);
  color: white;
  border-bottom-right-radius: 4px;
}
.agent-msg.assistant {
  align-self: flex-start;
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-bottom-left-radius: 4px;
}
.agent-msg.assistant strong { color: var(--text-primary); }
.agent-msg.assistant em { color: var(--text-secondary); }
.agent-msg.assistant ul, .agent-msg.assistant ol { margin: 0.3rem 0 0.3rem 1.2rem; }
.agent-msg.assistant code {
  background: var(--bg-primary);
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  font-size: 0.78rem;
}
.agent-typing {
  align-self: flex-start;
  display: flex;
  gap: 0.3rem;
  padding: 0.5rem 0.75rem;
}
.agent-typing span {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: agent-bounce 1.4s infinite ease-in-out;
}
.agent-typing span:nth-child(1) { animation-delay: 0s; }
.agent-typing span:nth-child(2) { animation-delay: 0.2s; }
.agent-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes agent-bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}
.agent-input-row {
  display: flex;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
}
.agent-input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 0.85rem;
  outline: none;
  resize: none;
  min-height: 38px;
  max-height: 100px;
}
.agent-input:focus { border-color: var(--accent); }
.agent-send {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  color: white;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}
.agent-send:hover { background: var(--accent-hover); }
.agent-send:disabled { opacity: 0.5; cursor: not-allowed; }

@media (max-width: 500px) {
  .agent-panel {
    width: 100%;
    max-width: 100%;
    right: 0;
    bottom: 0;
    height: 70vh;
    max-height: 70vh;
    border-radius: 16px 16px 0 0;
  }
}
