/* ============================================================
   FranklinWH Connect Portal — AI-first Inbox Design
   Dark theme, task-driven, 4-sidebar-item architecture
   ============================================================ */

/* === CSS Variables === */
:root {
  --primary: #EE8E25;
  --primary-glow: rgba(238, 142, 37, 0.2);
  --primary-gradient: linear-gradient(135deg, #EE8E25, #f5a623);
  --bg-dark: #0f1419;
  --bg-darker: #0a0e12;
  --bg-sidebar: #111820;
  --bg-topbar: rgba(15, 20, 25, 0.95);
  --bg-card: rgba(255, 255, 255, 0.03);
  --bg-card-hover: rgba(255, 255, 255, 0.06);
  --bg-input: rgba(255, 255, 255, 0.05);
  --border: rgba(255, 255, 255, 0.08);
  --border-active: rgba(238, 142, 37, 0.4);
  --text: #e8e8e8;
  --text-dim: rgba(255, 255, 255, 0.5);
  --text-muted: rgba(255, 255, 255, 0.3);
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.2);
  --danger: #F53F3F;
  --danger-glow: rgba(245, 63, 63, 0.2);
  --info: #0792FB;
  --info-glow: rgba(7, 146, 251, 0.2);
  --warning: #f59e0b;
  --warning-glow: rgba(245, 158, 11, 0.15);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --sidebar-width: 200px;
  --topbar-height: 56px;
  --assistant-width: 360px;
}

/* === Reset & Base === */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg-dark);
  overflow: hidden;
}

/* === Min Width Warning === */
.min-width-warning {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: var(--bg-dark);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  text-align: center;
  padding: 24px;
}

.min-width-warning__icon { font-size: 48px; }
.min-width-warning__text { font-size: 16px; color: var(--text-dim); max-width: 400px; }

@media (max-width: 1023px) {
  .min-width-warning { display: flex; }
  .app-layout { display: none !important; }
}

/* === App Layout === */
.app-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  grid-template-rows: var(--topbar-height) 1fr;
  height: 100vh;
  overflow: hidden;
}

.app-layout.assistant-open {
  grid-template-columns: var(--sidebar-width) 1fr var(--assistant-width);
}

/* === Top Bar === */
.topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: var(--bg-topbar);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  z-index: 100;
}

.topbar__left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar__logo {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--primary);
}

.topbar__divider {
  width: 1px;
  height: 20px;
  background: var(--border);
}

.topbar__title {
  font-size: 13px;
  color: var(--text-dim);
  font-weight: 500;
}

.topbar__center {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px;
}

.topbar__role-tab {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 12px;
  color: var(--text-dim);
  cursor: pointer;
  transition: var(--transition);
  border: none;
  background: transparent;
  white-space: nowrap;
}

.topbar__role-tab:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.topbar__role-tab--active {
  color: var(--bg-dark);
  background: var(--primary) !important;
  font-weight: 600;
}

.topbar__right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar__btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
}

.topbar__btn:hover {
  border-color: var(--primary);
  background: var(--primary-glow);
}

.topbar__user {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #f5a623);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
}

.topbar__username {
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
}

/* === Sidebar === */
.sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  padding: 24px 0;
  overflow-y: auto;
}

.sidebar__nav {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 12px;
}

.sidebar__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-dim);
  cursor: pointer;
  transition: var(--transition);
}

.sidebar__item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.sidebar__item--active {
  background: var(--primary-glow);
  color: var(--primary);
  font-weight: 600;
}

.sidebar__item-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

.sidebar__badge {
  margin-left: auto;
  background: var(--danger);
  color: white;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 10px;
  font-weight: 600;
}

/* === Main Content === */
.main-content {
  overflow-y: auto;
  padding: 28px 32px;
  background: var(--bg-dark);
  scroll-behavior: smooth;
}

.main-content::-webkit-scrollbar { width: 6px; }
.main-content::-webkit-scrollbar-track { background: transparent; }
.main-content::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 3px; }

/* === Section Headers === */
.section-header { margin-bottom: 24px; }

.section-header__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.section-header__title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}

.section-header__subtitle {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 4px;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 20px;
  background: var(--success-glow);
  border: 1px solid rgba(16, 185, 129, 0.3);
  font-size: 12px;
  color: var(--success);
  font-weight: 500;
}

.status-indicator__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { opacity: 1; box-shadow: 0 0 4px var(--success); }
  50% { opacity: 0.5; box-shadow: 0 0 12px var(--success); }
}


/* === Inbox Summary Bar === */
.inbox-summary {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
}

.inbox-summary__item {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: center;
  animation: card-fade-in 0.4s ease-out both;
}

.inbox-summary__item:nth-child(1) { animation-delay: 0s; }
.inbox-summary__item:nth-child(2) { animation-delay: 0.1s; }
.inbox-summary__item:nth-child(3) { animation-delay: 0.2s; }

.inbox-summary__value {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
}

.inbox-summary__label {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* === Inbox Section === */
.inbox-section { margin-bottom: 8px; }

.inbox-section__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
}

.inbox-section__toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px 0;
  color: var(--text);
}

.inbox-section__arrow {
  font-size: 12px;
  color: var(--text-dim);
  transition: var(--transition);
}

/* === Inbox Items === */
.inbox-items {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.inbox-item {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: var(--transition);
  animation: card-fade-in 0.5s ease-out both;
}

.inbox-item:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

/* Priority left border */
.inbox-item__priority {
  width: 4px;
  flex-shrink: 0;
}

.inbox-item--high .inbox-item__priority { background: var(--danger); }
.inbox-item--medium .inbox-item__priority { background: var(--warning); }
.inbox-item--low .inbox-item__priority { background: var(--info); }

.inbox-item__content {
  flex: 1;
  padding: 16px 20px;
}

.inbox-item__header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.inbox-item__icon { font-size: 16px; }

.inbox-item__client {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
}

.inbox-item__time {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-muted);
}

.inbox-item__title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.inbox-item__context {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 8px;
  line-height: 1.4;
}

.inbox-item__suggestion {
  font-size: 12px;
  color: var(--text-dim);
  background: rgba(238, 142, 37, 0.06);
  border: 1px solid rgba(238, 142, 37, 0.15);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  margin-bottom: 12px;
  line-height: 1.4;
}

.inbox-item__suggestion-label {
  font-weight: 600;
  color: var(--primary);
  margin-right: 4px;
}

.inbox-item__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.inbox-action-btn {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.inbox-action-btn:hover {
  border-color: var(--primary);
  background: var(--primary-glow);
  color: var(--primary);
  transform: translateY(-1px);
}

/* === AI Completed Section === */
.inbox-completed {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 400px;
  overflow: hidden;
  transition: max-height 0.4s ease-out;
}

.inbox-completed--collapsed {
  max-height: 0;
}

.completed-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
  transition: var(--transition);
}

.completed-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.completed-item__icon { font-size: 14px; flex-shrink: 0; }
.completed-item__text { flex: 1; font-size: 13px; color: var(--text-dim); }
.completed-item__time { font-size: 11px; color: var(--text-muted); white-space: nowrap; }


/* === Clients List === */
.clients-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.client-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  animation: card-fade-in 0.4s ease-out both;
}

.client-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateX(4px);
}

.client-card__left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.client-card__avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(238, 142, 37, 0.3), rgba(238, 142, 37, 0.1));
  border: 1px solid rgba(238, 142, 37, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 600;
  color: var(--primary);
}

.client-card__info { display: flex; flex-direction: column; gap: 2px; }
.client-card__name { font-size: 14px; font-weight: 600; color: var(--text); }
.client-card__detail { font-size: 12px; color: var(--text-dim); }

.client-card__right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.client-card__meta {
  font-size: 12px;
  color: var(--text-dim);
}

.client-card__health {
  display: flex;
  align-items: center;
  gap: 8px;
}

.health-bar {
  width: 80px;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

.health-bar__fill {
  height: 100%;
  border-radius: 3px;
  transition: width 1s ease-out;
}

.client-card__health-value {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  min-width: 32px;
}

/* === Status Badges === */
.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.status-badge--primary { background: var(--primary-glow); color: var(--primary); }
.status-badge--success { background: var(--success-glow); color: var(--success); }
.status-badge--warning { background: var(--warning-glow); color: var(--warning); }
.status-badge--danger { background: var(--danger-glow); color: var(--danger); }
.status-badge--info { background: var(--info-glow); color: var(--info); }

/* === Client Detail Page === */
.detail-page { max-width: 800px; }

.detail-page__back {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 13px;
  cursor: pointer;
  padding: 6px 0;
  margin-bottom: 16px;
  transition: var(--transition);
}

.detail-page__back:hover { color: var(--primary); }

.detail-page__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.detail-page__header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.detail-page__avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(238, 142, 37, 0.3), rgba(238, 142, 37, 0.1));
  border: 2px solid var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
}

.detail-page__name {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
}

.detail-page__health {
  text-align: right;
}

.detail-page__health-label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.detail-page__health-value {
  font-size: 28px;
  font-weight: 700;
}

/* === Detail Info Grid === */
.detail-info {
  margin-bottom: 28px;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.info-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.info-item__label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.info-item__value {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

/* === Detail Timeline === */
.detail-section {
  margin-bottom: 24px;
}

.detail-section__title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 14px;
  color: var(--text);
}

.detail-timeline {
  position: relative;
  padding-left: 28px;
}

.detail-timeline::before {
  content: '';
  position: absolute;
  left: 10px;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: var(--border);
}

.timeline-entry {
  position: relative;
  padding: 10px 0;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.timeline-entry__dot {
  position: absolute;
  left: -28px;
  top: 12px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  z-index: 1;
}

.timeline-entry__content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.timeline-entry__time {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.timeline-entry__text {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.4;
}

.timeline-entry--ai .timeline-entry__text { color: var(--primary); }
.timeline-entry--alert .timeline-entry__text { color: var(--danger); }
.timeline-entry--customer .timeline-entry__text { color: var(--info); }

/* === Detail AI Card === */
.detail-ai-card {
  background: linear-gradient(135deg, rgba(238, 142, 37, 0.08), rgba(238, 142, 37, 0.02));
  border: 1px solid rgba(238, 142, 37, 0.25);
  border-radius: var(--radius);
  padding: 20px;
}

.detail-ai-card__header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
}

.detail-ai-card__body {
  font-size: 13px;
  color: var(--text);
  line-height: 1.6;
  margin-bottom: 16px;
  white-space: pre-line;
}

.detail-ai-card__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}


/* === Insights Page === */
.insights-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 8px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: center;
  transition: var(--transition);
  animation: card-fade-in 0.5s ease-out both;
}

.stat-card:hover {
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

.stat-card:nth-child(1) { animation-delay: 0s; }
.stat-card:nth-child(2) { animation-delay: 0.1s; }
.stat-card:nth-child(3) { animation-delay: 0.2s; }
.stat-card:nth-child(4) { animation-delay: 0.3s; }

.stat-card__label {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-card__value {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
}

.stat-card__value--primary { color: var(--primary); }
.stat-card__value--success { color: var(--success); }

.insights-section { margin-bottom: 8px; }

.insights-section__title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.insights-section__subtitle {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 16px;
}

/* === Flywheel Cards === */
.flywheel-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.flywheel-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  transition: var(--transition);
  animation: card-fade-in 0.5s ease-out both;
}

.flywheel-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(238, 142, 37, 0.3);
  transform: translateY(-2px);
}

.flywheel-card__conversion {
  font-size: 20px;
  font-weight: 700;
  color: var(--success);
  margin-bottom: 6px;
}

.flywheel-card__title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
  line-height: 1.4;
}

.flywheel-card__meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
}

/* === Evolution Grid === */
.evolution-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.evo-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: var(--transition);
  animation: card-fade-in 0.5s ease-out both;
}

.evo-card--improved {
  border-color: rgba(238, 142, 37, 0.4);
  box-shadow: 0 0 12px var(--primary-glow);
}

.evo-card--best {
  border-color: rgba(16, 185, 129, 0.4);
  box-shadow: 0 0 12px var(--success-glow);
}

.evo-card__month {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.evo-card__label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
}

.evo-card__response {
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-dim);
  margin-bottom: 12px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-sm);
}

.evo-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.evo-tag {
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-dim);
}

.evo-tag--primary { background: var(--primary-glow); color: var(--primary); }
.evo-tag--success { background: var(--success-glow); color: var(--success); }

/* === Settings Page === */
.settings-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 600px;
}

.settings-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  animation: card-fade-in 0.4s ease-out both;
}

.settings-card__header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.settings-card__icon { font-size: 18px; }

.settings-card__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.settings-card__body { padding: 8px 20px; }

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.setting-row:last-child { border-bottom: none; }

.setting-row__label {
  font-size: 13px;
  color: var(--text-dim);
}

.setting-row__value {
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
}

/* Toggle Switch */
.toggle {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  cursor: pointer;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle__slider {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 11px;
  transition: var(--transition);
}

.toggle__slider::before {
  content: '';
  position: absolute;
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: var(--transition);
}

.toggle input:checked + .toggle__slider {
  background: var(--primary);
}

.toggle input:checked + .toggle__slider::before {
  transform: translateX(18px);
}


/* === AI Assistant Panel === */
.assistant-panel {
  position: fixed;
  right: -400px;
  top: var(--topbar-height);
  bottom: 0;
  width: var(--assistant-width);
  background: var(--bg-sidebar);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 200;
}

.assistant-panel.open { right: 0; }

.assistant-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.assistant-panel__title {
  font-size: 14px;
  font-weight: 600;
}

.assistant-panel__close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: var(--transition);
}

.assistant-panel__close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.assistant-panel__messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.assistant-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
  animation: msg-pop 0.3s ease-out;
}

.assistant-msg--bot {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.assistant-msg--user {
  background: var(--primary);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

@keyframes msg-pop {
  from { opacity: 0; transform: scale(0.95) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.assistant-panel__input {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

.assistant-panel__input input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 14px;
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: var(--transition);
}

.assistant-panel__input input:focus {
  border-color: var(--primary);
}

.assistant-panel__input button {
  background: var(--primary);
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  color: white;
  cursor: pointer;
  font-size: 14px;
  transition: var(--transition);
}

.assistant-panel__input button:hover {
  background: #d47b1e;
}

.assistant-panel__messages::-webkit-scrollbar { width: 4px; }
.assistant-panel__messages::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 2px; }

/* === Toast Notification === */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-sidebar);
  border: 1px solid var(--success);
  border-radius: var(--radius);
  padding: 14px 20px;
  font-size: 13px;
  color: var(--text);
  box-shadow: var(--shadow-lg), 0 0 20px var(--success-glow);
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 10px;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(12px);
  max-width: 400px;
}

.toast.toast--visible {
  transform: translateY(0);
  opacity: 1;
}

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
  white-space: nowrap;
}

.btn--primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.btn--primary:hover {
  background: #d47b1e;
  box-shadow: 0 4px 16px var(--primary-glow);
}

.btn--outline {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}

.btn--outline:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-glow);
}

/* === Animations === */
@keyframes card-fade-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slide-in-right {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes view-switch {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* === Utilities === */
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-dim { color: var(--text-dim); }
.text-sm { font-size: 12px; }
