/* ============================================
   NIGERIAN LEGAL ASSISTANT - APP STYLES
   ============================================ */

.app-body {
  background: #F0F2F8;
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

/* ============================================
   APP SIDEBAR
   ============================================ */
.app-sidebar {
  width: 280px;
  min-height: 100vh;
  background: linear-gradient(180deg, #001540 0%, #002366 60%, #001e55 100%);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 900;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  overflow-x: hidden;
}

@media (max-width: 1024px) {
  .app-sidebar {
    transform: translateX(-100%);
  }
  .app-sidebar.open {
    transform: translateX(0);
    box-shadow: 0 0 60px rgba(0,0,0,0.4);
  }
}

.app-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,20,60,0.5);
  z-index: 850;
  backdrop-filter: blur(4px);
}

.app-sidebar-overlay.active { display: block; }

.app-sidebar-header {
  padding: 24px 20px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.app-sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 26px;
}

.app-brand-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--white);
  display: block;
  line-height: 1.2;
}

.app-brand-sub {
  font-size: 10px;
  color: rgba(255,255,255,0.45);
  letter-spacing: 0.5px;
}

.app-sidebar-close {
  display: none;
  background: rgba(255,255,255,0.08);
  border: none;
  color: rgba(255,255,255,0.6);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transition: var(--transition);
}

@media (max-width: 1024px) { .app-sidebar-close { display: flex; } }

.app-sidebar-close:hover { background: rgba(255,255,255,0.15); color: var(--white); }

/* USER PLAN CARD */
.user-plan-card {
  margin: 16px;
  background: rgba(255,255,255,0.07);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(255,255,255,0.08);
}

.user-plan-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--royal-blue-dark);
  flex-shrink: 0;
}

.user-plan-info {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.user-plan-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

.user-plan-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 50px;
  font-size: 10px;
  font-weight: 700;
  margin-top: 3px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.user-plan-badge.free { background: rgba(0,135,90,0.2); color: #7FFFD4; }
.user-plan-badge.premium { background: rgba(184,134,11,0.25); color: var(--gold-light); }
.user-plan-badge.enterprise { background: rgba(255,255,255,0.15); color: var(--white); }

.user-plan-upgrade {
  background: rgba(255,215,0,0.15);
  border: 1px solid rgba(255,215,0,0.3);
  color: var(--gold-light);
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  transition: var(--transition);
  flex-shrink: 0;
}

.user-plan-upgrade:hover { background: rgba(255,215,0,0.25); }

/* DRAFT USAGE CARD */
.draft-usage-card {
  margin: 0 16px 16px;
  background: rgba(255,255,255,0.05);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  border: 1px solid rgba(255,255,255,0.06);
}

.draft-usage-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 12px;
  color: rgba(255,255,255,0.6);
}

.draft-usage-header i { color: var(--gold-light); margin-right: 4px; }

.draft-usage-count {
  font-weight: 700;
  color: var(--white);
}

.draft-usage-reset {
  font-size: 10px;
  color: rgba(255,255,255,0.35);
  display: block;
  margin-top: 6px;
}

/* NEW CHAT BUTTON */
.btn-new-chat {
  margin: 0 16px 16px;
  width: calc(100% - 32px);
  padding: 11px 16px;
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  color: var(--royal-blue-dark);
  border: none;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font-body);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition);
  box-shadow: 0 4px 14px rgba(184,134,11,0.3);
}

.btn-new-chat:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(184,134,11,0.4);
}

/* APP NAV */
.app-nav { padding: 4px 0; }

.app-nav-section-label {
  font-size: 10px;
  color: rgba(255,255,255,0.35);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  padding: 10px 20px 4px;
  font-weight: 700;
}

.app-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: var(--transition);
  cursor: pointer;
  border-left: 3px solid transparent;
}

.app-nav-item:hover {
  background: rgba(255,255,255,0.07);
  color: var(--white);
}

.app-nav-item.active {
  background: rgba(255,255,255,0.12);
  color: var(--white);
  border-left-color: var(--gold);
  font-weight: 600;
}

.app-nav-item i {
  width: 18px;
  text-align: center;
  font-size: 15px;
  flex-shrink: 0;
}

.app-logout {
  color: rgba(255,100,100,0.7);
  margin-top: 4px;
}

.app-logout:hover {
  background: rgba(255,100,100,0.08);
  color: #ff6464;
}

/* RECENT CHATS */
.recent-chats {
  margin-top: auto;
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.recent-chats-label {
  font-size: 10px;
  color: rgba(255,255,255,0.35);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 10px;
  font-weight: 700;
}

.recent-chat-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  color: rgba(255,255,255,0.6);
  font-size: 12px;
}

.recent-chat-item:hover {
  background: rgba(255,255,255,0.07);
  color: var(--white);
}

.recent-chat-item i { color: rgba(255,255,255,0.3); font-size: 11px; }

.recent-chat-empty {
  font-size: 12px;
  color: rgba(255,255,255,0.25);
  text-align: center;
  padding: 8px 0;
}

/* ============================================
   APP MAIN
   ============================================ */
.app-main {
  flex: 1;
  margin-left: 280px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

@media (max-width: 1024px) { .app-main { margin-left: 0; } }

/* TOP BAR */
.app-topbar {
  background: var(--white);
  border-bottom: 1px solid var(--border-grey);
  padding: 0 20px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 800;
  box-shadow: var(--shadow-sm);
  gap: 12px;
}

.app-topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  overflow: hidden;
}

.app-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--charcoal-mid);
  font-size: 20px;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  flex-shrink: 0;
}

@media (max-width: 1024px) { .app-menu-btn { display: block; } }

.app-topbar-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--charcoal);
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-topbar-title i { color: var(--royal-blue); }

.app-topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.app-topbar-case {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0,35,102,0.06);
  padding: 5px 12px;
  border-radius: 50px;
  font-size: 12px;
  color: var(--royal-blue);
  font-weight: 600;
  max-width: 200px;
  overflow: hidden;
}

.app-topbar-case span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-topbar-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-grey);
  background: var(--off-white);
  color: var(--charcoal-light);
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.app-topbar-icon-btn:hover {
  background: var(--royal-blue);
  color: var(--white);
  border-color: var(--royal-blue);
}

.app-topbar-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--royal-blue), var(--royal-blue-light));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
}

/* ============================================
   APP PANELS
   ============================================ */
.app-panel {
  display: none;
  flex: 1;
  flex-direction: column;
}

.app-panel.active { display: flex; }

.app-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 24px 24px 0;
  flex-wrap: wrap;
  gap: 16px;
}

.app-panel-title {
  font-family: var(--font-display);
  font-size: clamp(20px, 3vw, 28px);
  font-weight: 700;
  color: var(--charcoal);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.app-panel-title i { color: var(--royal-blue); font-size: 24px; }

.app-panel-subtitle {
  font-size: 14px;
  color: var(--charcoal-light);
}

.btn-app-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  background: linear-gradient(135deg, var(--royal-blue), var(--royal-blue-light));
  color: var(--white);
  border: none;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 14px rgba(0,35,102,0.25);
  white-space: nowrap;
}

.btn-app-action:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,35,102,0.35);
}

/* ============================================
   CHAT INTERFACE
   ============================================ */
#apppanel-chat {
  height: calc(100vh - 60px);
  overflow: hidden;
}

.chat-header-card {
  background: linear-gradient(160deg, var(--royal-blue-dark), var(--royal-blue));
  padding: 32px 24px 24px;
  text-align: center;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.chat-header-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 20% 50%, rgba(184,134,11,0.15) 0%, transparent 60%);
  pointer-events: none;
}

.chat-header-icon {
  font-size: 32px;
  margin-bottom: 8px;
}

.chat-header-title {
  font-family: var(--font-display);
  font-size: clamp(16px, 3vw, 22px);
  font-weight: 900;
  color: var(--white);
  letter-spacing: 1px;
  margin-bottom: 6px;
}

.chat-header-sub {
  font-size: 13px;
  color: rgba(255,255,255,0.7);
  max-width: 500px;
  margin: 0 auto 16px;
  line-height: 1.6;
}

/* ACTIVE CASE BADGE */
.active-case-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,215,0,0.15);
  border: 1px solid rgba(255,215,0,0.3);
  color: var(--gold-light);
  padding: 6px 14px;
  border-radius: 50px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 16px;
}

.clear-case-btn {
  background: none;
  border: none;
  color: var(--gold-light);
  cursor: pointer;
  font-size: 12px;
  padding: 2px;
  opacity: 0.7;
  transition: var(--transition);
}

.clear-case-btn:hover { opacity: 1; }

/* QUICK ACTIONS */
.chat-quick-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  position: relative;
  z-index: 1;
}

.chat-quick-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.18);
  color: rgba(255,255,255,0.9);
  border-radius: 50px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font-body);
  backdrop-filter: blur(10px);
}

.chat-quick-btn:hover {
  background: rgba(255,255,255,0.2);
  border-color: rgba(255,255,255,0.35);
  transform: translateY(-1px);
  color: var(--white);
}

.chat-quick-btn i { color: var(--gold-light); font-size: 11px; }

/* CHAT MESSAGES */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border-grey); border-radius: 2px; }

/* MESSAGE BUBBLES */
.message {
  display: flex;
  gap: 12px;
  max-width: 100%;
}

.message.user-message {
  flex-direction: row-reverse;
}

.message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  align-self: flex-start;
  margin-top: 2px;
}

.message.user-message .message-avatar {
  background: linear-gradient(135deg, var(--royal-blue), var(--royal-blue-light));
  font-size: 12px;
  font-weight: 700;
  color: var(--white);
}

.message.ai-message .message-avatar {
  background: linear-gradient(135deg, var(--charcoal), #444);
  font-size: 18px;
}

.message-content {
  flex: 1;
  max-width: 85%;
}

.message.user-message .message-content {
  display: flex;
  justify-content: flex-end;
}

.message-bubble {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 14px;
  line-height: 1.7;
  word-break: break-word;
}

.message.user-message .message-bubble {
  background: linear-gradient(135deg, var(--royal-blue), var(--royal-blue-light));
  color: var(--white);
  border-radius: var(--radius-md) var(--radius-md) 4px var(--radius-md);
  max-width: 75%;
}

.message.ai-message .message-bubble {
  background: var(--white);
  color: var(--charcoal-mid);
  border: 1px solid var(--border-grey);
  border-radius: var(--radius-md) var(--radius-md) var(--radius-md) 4px;
  box-shadow: var(--shadow-sm);
  width: 100%;
}

/* INTELLIGENCE CARD (AI Output) */
.intelligence-card {
  background: var(--white);
  border: 1px solid var(--border-grey);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  width: 100%;
}

.intelligence-card-header {
  background: linear-gradient(135deg, var(--royal-blue-dark), var(--royal-blue));
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.intelligence-card-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--white);
  display: flex;
  align-items: center;
  gap: 8px;
}

.intelligence-card-title span { color: var(--gold-light); }

.intelligence-card-actions {
  display: flex;
  gap: 6px;
}

.card-action-btn {
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.1);
  color: var(--white);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: var(--transition);
  font-family: var(--font-body);
}

.card-action-btn:hover {
  background: rgba(255,255,255,0.2);
}

.card-action-btn.btn-download {
  background: rgba(184,134,11,0.3);
  border-color: rgba(255,215,0,0.4);
  color: var(--gold-light);
}

.card-action-btn.btn-download:hover {
  background: var(--gold);
  color: var(--royal-blue-dark);
}

.intelligence-card-body {
  padding: 24px;
}

/* LEGAL DOCUMENT RENDERING */
.legal-document {
  font-family: 'Times New Roman', Times, serif;
  color: var(--charcoal);
  line-height: 1.8;
}

.legal-document h1 {
  font-size: 17px;
  font-weight: 700;
  color: var(--royal-blue);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--royal-blue);
}

.legal-document h2 {
  font-size: 15px;
  font-weight: 700;
  color: var(--royal-blue);
  margin: 20px 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.legal-document h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--charcoal);
  margin: 16px 0 8px;
}

.legal-document p {
  margin-bottom: 12px;
  font-size: 14px;
  text-align: justify;
}

.legal-document strong { color: var(--charcoal); }

.legal-document ul, .legal-document ol {
  margin: 10px 0 10px 24px;
}

.legal-document li {
  margin-bottom: 6px;
  font-size: 14px;
}

.legal-document hr {
  border: none;
  border-top: 1px solid var(--border-grey);
  margin: 20px 0;
}

.legal-document blockquote {
  border-left: 3px solid var(--gold);
  padding-left: 16px;
  margin: 12px 0;
  color: var(--charcoal-light);
  font-style: italic;
}

/* CHECKLIST SECTION */
.checklist-section {
  background: rgba(0,35,102,0.04);
  border: 1px solid rgba(0,35,102,0.1);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-top: 16px;
}

.checklist-section h4 {
  font-size: 13px;
  font-weight: 700;
  color: var(--royal-blue);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  color: var(--charcoal-mid);
  padding: 5px 0;
}

.checklist-item i { color: var(--success); margin-top: 2px; flex-shrink: 0; }

/* STATUS RECAP */
.status-recap {
  background: rgba(184,134,11,0.08);
  border-left: 3px solid var(--gold);
  padding: 10px 14px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 13px;
  color: var(--charcoal-mid);
  margin-bottom: 16px;
  font-style: italic;
}

/* DOWNLOAD BUTTON IN CARD */
.download-section {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border-grey);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.download-btn-main {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 28px;
  background: linear-gradient(135deg, var(--royal-blue), var(--royal-blue-light));
  color: var(--white);
  border: none;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font-body);
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 14px rgba(0,35,102,0.3);
}

.download-btn-main:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,35,102,0.4);
}

.download-btn-main i { color: var(--gold-light); }

.save-draft-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  background: transparent;
  border: 2px solid var(--royal-blue);
  color: var(--royal-blue);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  transition: var(--transition);
}

.save-draft-btn:hover {
  background: var(--royal-blue);
  color: var(--white);
}

/* TYPING INDICATOR */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 12px;
}

.typing-dots {
  display: flex;
  gap: 4px;
  padding: 14px 18px;
  background: var(--white);
  border-radius: var(--radius-md) var(--radius-md) var(--radius-md) 4px;
  border: 1px solid var(--border-grey);
  box-shadow: var(--shadow-sm);
}

.typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--royal-blue);
  animation: typingBounce 1.4s ease infinite;
}

.typing-dot:nth-child(1) { animation-delay: 0s; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-8px); opacity: 1; }
}

/* CHAT INPUT AREA */
.chat-input-area {
  background: var(--white);
  border-top: 1px solid var(--border-grey);
  padding: 16px 24px;
  flex-shrink: 0;
}

.attached-files {
  margin-bottom: 12px;
}

.attached-files-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.attached-file-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: rgba(0,35,102,0.06);
  border: 1px solid rgba(0,35,102,0.15);
  border-radius: 50px;
  font-size: 12px;
  color: var(--royal-blue);
}

.attached-file-chip .remove-file {
  background: none;
  border: none;
  color: var(--charcoal-light);
  cursor: pointer;
  font-size: 11px;
  padding: 1px;
  transition: var(--transition);
}

.attached-file-chip .remove-file:hover { color: var(--error); }

.chat-context-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 10px;
}

.context-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.context-selector i { color: var(--royal-blue); font-size: 13px; }

.context-selector select {
  font-size: 12px;
  border: 1px solid var(--border-grey);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  color: var(--charcoal-mid);
  background: var(--off-white);
  outline: none;
  font-family: var(--font-body);
  max-width: 220px;
  cursor: pointer;
  transition: var(--transition);
}

.context-selector select:focus { border-color: var(--royal-blue); }

.context-actions { display: flex; gap: 6px; }

.context-btn {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-grey);
  background: var(--off-white);
  color: var(--charcoal-light);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.context-btn:hover {
  background: var(--royal-blue);
  color: var(--white);
  border-color: var(--royal-blue);
}

.chat-input-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.chat-textarea-wrap {
  flex: 1;
  position: relative;
}

.chat-textarea-wrap textarea {
  width: 100%;
  padding: 12px 16px;
  padding-bottom: 24px;
  border: 2px solid var(--border-grey);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: var(--font-body);
  color: var(--charcoal);
  background: var(--off-white);
  resize: none;
  outline: none;
  transition: var(--transition);
  max-height: 160px;
  overflow-y: auto;
  line-height: 1.5;
}

.chat-textarea-wrap textarea:focus {
  border-color: var(--royal-blue);
  background: var(--white);
  box-shadow: 0 0 0 4px rgba(0,35,102,0.06);
}

.chat-input-counter {
  position: absolute;
  bottom: 6px;
  right: 10px;
  font-size: 10px;
  color: var(--charcoal-light);
}

.chat-send-btn {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  border: none;
  background: linear-gradient(135deg, var(--royal-blue), var(--royal-blue-light));
  color: var(--white);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(0,35,102,0.3);
}

.chat-send-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,35,102,0.4);
}

.chat-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.chat-input-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  flex-wrap: wrap;
  gap: 6px;
}

.chat-disclaimer {
  font-size: 11px;
  color: var(--charcoal-light);
  display: flex;
  align-items: center;
  gap: 5px;
}

.chat-disclaimer i { color: var(--warning); }

.chat-model-badge {
  font-size: 11px;
  color: var(--charcoal-light);
  background: var(--off-white);
  padding: 3px 10px;
  border-radius: 50px;
  border: 1px solid var(--border-grey);
  display: flex;
  align-items: center;
  gap: 5px;
}

.chat-model-badge i { color: var(--royal-blue); }

/* ============================================
   CASES GRID
   ============================================ */
.cases-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  padding: 24px;
}

@media (min-width: 640px) { .cases-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .cases-grid { grid-template-columns: repeat(3, 1fr); } }

.cases-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 24px;
  color: var(--charcoal-light);
}

.cases-empty i { font-size: 56px; color: var(--border-grey); margin-bottom: 16px; display: block; }
.cases-empty h3 { font-size: 18px; color: var(--charcoal); margin-bottom: 8px; }
.cases-empty p { font-size: 14px; max-width: 360px; margin: 0 auto 24px; line-height: 1.7; }

.case-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 24px;
  border: 1px solid var(--border-grey);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.case-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(to bottom, var(--royal-blue), var(--gold));
}

.case-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--royal-blue);
}

.case-card.active-case {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(184,134,11,0.2), var(--shadow-md);
}

.case-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-left: 12px;
}

.case-card-type {
  display: inline-block;
  padding: 3px 10px;
  background: rgba(0,35,102,0.08);
  color: var(--royal-blue);
  border-radius: 50px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.case-card-actions {
  display: flex;
  gap: 4px;
}

.case-card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--charcoal);
  margin-bottom: 8px;
  padding-left: 12px;
  line-height: 1.4;
}

.case-card-meta {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding-left: 12px;
  margin-bottom: 16px;
}

.case-card-meta-item {
  font-size: 12px;
  color: var(--charcoal-light);
  display: flex;
  align-items: center;
  gap: 6px;
}

.case-card-meta-item i { color: var(--royal-blue); width: 12px; }

.case-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-left: 12px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-grey);
}

.case-card-date { font-size: 11px; color: var(--charcoal-light); }

.btn-use-case {
  padding: 6px 14px;
  background: var(--royal-blue);
  color: var(--white);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-body);
  transition: var(--transition);
}

.btn-use-case:hover { background: var(--royal-blue-dark); }

.btn-use-case.active { background: var(--gold); color: var(--royal-blue-dark); }

/* ============================================
   DRAFTS LIST
   ============================================ */
.drafts-list {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.draft-item {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  border: 1px solid var(--border-grey);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  transition: var(--transition);
  cursor: pointer;
  flex-wrap: wrap;
}

.draft-item:hover {
  border-color: var(--royal-blue);
  box-shadow: var(--shadow-sm);
}

.draft-item-info { flex: 1; min-width: 200px; }

.draft-item-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--charcoal);
  margin-bottom: 6px;
}

.draft-item-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.draft-item-meta span {
  font-size: 12px;
  color: var(--charcoal-light);
  display: flex;
  align-items: center;
  gap: 4px;
}

.draft-item-meta i { color: var(--royal-blue); }

.draft-item-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* ============================================
   TEMPLATES GRID
   ============================================ */
.templates-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  padding: 24px;
}

@media (min-width: 480px) { .templates-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .templates-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1200px) { .templates-grid { grid-template-columns: repeat(4, 1fr); } }

.template-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  border: 1px solid var(--border-grey);
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.template-card:hover {
  border-color: var(--royal-blue);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.template-card.premium-only {
  opacity: 0.75;
}

.template-card.premium-only::after {
  content: '👑 Premium';
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 10px;
  font-weight: 700;
  color: var(--gold);
  background: rgba(184,134,11,0.1);
  padding: 2px 8px;
  border-radius: 50px;
}

.template-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
  font-size: 22px;
}

.template-card h4 {
  font-size: 13px;
  font-weight: 700;
  color: var(--charcoal);
  margin-bottom: 6px;
}

.template-card p {
  font-size: 12px;
  color: var(--charcoal-light);
  line-height: 1.5;
}

/* ============================================
   PRE-TRIAL CHECKLIST
   ============================================ */
.checklist-container {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.checklist-group {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-grey);
  overflow: hidden;
}

.checklist-group-header {
  padding: 16px 20px;
  background: rgba(0,35,102,0.03);
  border-bottom: 1px solid var(--border-grey);
  font-size: 14px;
  font-weight: 700;
  color: var(--royal-blue);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.checklist-progress {
  font-size: 12px;
  color: var(--charcoal-light);
  font-weight: 500;
}

.checklist-items {
  padding: 8px 0;
}

.checklist-task {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 20px;
  cursor: pointer;
  transition: var(--transition);
  border-bottom: 1px solid rgba(0,0,0,0.03);
}

.checklist-task:last-child { border-bottom: none; }

.checklist-task:hover { background: rgba(0,35,102,0.02); }

.checklist-task input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--royal-blue);
  margin-top: 2px;
  flex-shrink: 0;
  cursor: pointer;
}

.checklist-task-label {
  flex: 1;
}

.checklist-task-text {
  font-size: 14px;
  color: var(--charcoal-mid);
  line-height: 1.5;
  transition: var(--transition);
}

.checklist-task.done .checklist-task-text {
  text-decoration: line-through;
  color: var(--charcoal-light);
}

.checklist-task-note {
  font-size: 12px;
  color: var(--charcoal-light);
  margin-top: 3px;
  font-style: italic;
}

/* ============================================
   PROFILE
   ============================================ */
.profile-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  padding: 24px;
}

@media (min-width: 768px) {
  .profile-grid { grid-template-columns: 220px 1fr; }
}

@media (min-width: 1024px) {
  .profile-grid { grid-template-columns: 220px 1fr 280px; }
}

.profile-card {
  background: linear-gradient(160deg, var(--royal-blue-dark), var(--royal-blue));
  border-radius: var(--radius-xl);
  padding: 32px 24px;
  text-align: center;
  color: var(--white);
}

.profile-avatar-large {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  color: var(--royal-blue-dark);
  margin: 0 auto 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

.profile-card h2 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 6px;
}

.profile-details-card {
  background: var(--white);
  border-radius: var(--radius-xl);
  padding: 32px;
  border: 1px solid var(--border-grey);
}

.profile-details-card h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--charcoal);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-grey);
}

.profile-details-card h3 i { color: var(--royal-blue); }

.profile-plan-card {
  background: var(--white);
  border-radius: var(--radius-xl);
  padding: 32px;
  border: 1px solid var(--border-grey);
}

.profile-plan-card h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--charcoal);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-grey);
}

.profile-plan-card h3 i { color: var(--gold); }

.profile-plan-name {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--charcoal);
  margin-bottom: 8px;
}

.profile-plan-drafts {
  font-size: 14px;
  color: var(--charcoal-light);
}

.btn-upgrade-full {
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  color: var(--royal-blue-dark);
  border: none;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font-body);
  cursor: pointer;
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition);
  box-shadow: 0 4px 14px rgba(184,134,11,0.3);
}

.btn-upgrade-full:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(184,134,11,0.4);
}

/* ============================================
   UPGRADE MODAL
   ============================================ */
.upgrade-features {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 28px;
}

.upgrade-feature-item {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: var(--charcoal-mid);
}

.upgrade-feature-item i {
  color: var(--success);
  font-size: 16px;
  flex-shrink: 0;
}

.upgrade-price {
  text-align: center;
  margin-bottom: 20px;
}

.upgrade-price-amount {
  font-family: var(--font-display);
  font-size: 44px;
  font-weight: 700;
  color: var(--royal-blue);
}

.upgrade-price-period {
  font-size: 16px;
  color: var(--charcoal-light);
}

.upgrade-note {
  text-align: center;
  font-size: 12px;
  color: var(--charcoal-light);
  margin-top: 16px;
  line-height: 1.6;
}

.upgrade-note a { color: var(--royal-blue); }
.upgrade-note i { color: var(--success); }

/* PREMIUM BADGE */
.premium-badge-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: rgba(184,134,11,0.1);
  color: var(--gold);
  border-radius: 50px;
  font-size: 13px;
  font-weight: 600;
}

.premium-badge-inline i { color: var(--gold); }

/* DOCUMENTS GRID */
.documents-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  padding: 24px;
}

@media (min-width: 640px) { .documents-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .documents-grid { grid-template-columns: repeat(3, 1fr); } }

.document-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 20px;
  border: 1px solid var(--border-grey);
  transition: var(--transition);
}

.document-card:hover {
  border-color: var(--royal-blue);
  box-shadow: var(--shadow-sm);
}

/* MOBILE RESPONSIVENESS */
@media (max-width: 600px) {
  .chat-header-card { padding: 20px 16px 16px; }
  .chat-messages { padding: 16px; }
  .chat-input-area { padding: 12px 16px; }
  .chat-quick-actions { gap: 6px; }
  .chat-quick-btn { padding: 6px 10px; font-size: 11px; }
  .chat-quick-btn span { display: none; }
  .intelligence-card-actions { flex-direction: column; gap: 4px; }
  .download-section { flex-direction: column; }
  .download-btn-main, .save-draft-btn { width: 100%; justify-content: center; }
  .profile-details-card, .profile-plan-card { padding: 24px 20px; }
}