/* ==========================================================================
   AI Assistant — Professional Chat UI
   ========================================================================== */

:root {
  --sidebar-bg: #1a1a2e;
  --sidebar-hover: #16213e;
  --sidebar-active: #0f3460;
  --sidebar-text: #a8b2c1;
  --sidebar-text-bright: #e2e8f0;
  --sidebar-border: rgba(255, 255, 255, 0.06);
  --accent: #6c63ff;
  --accent-hover: #5a52d5;
  --accent-light: rgba(108, 99, 255, 0.1);
  --chat-bg: #f7f8fc;
  --user-bubble: #6c63ff;
  --assistant-bubble: #ffffff;
  --input-bg: #ffffff;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.12);
  --radius-sm: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1.25rem;
  --radius-xl: 1.5rem;
}

* {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ==========================================================================
   Layout
   ========================================================================== */

.chat-app {
  height: 100vh;
  overflow: hidden;
  background: var(--chat-bg);
}

/* ==========================================================================
   Sidebar
   ========================================================================== */

.chat-sidebar {
  width: 300px;
  min-width: 300px;
  background: var(--sidebar-bg);
  border-right: none;
  transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 2px 0 20px rgba(0, 0, 0, 0.15);
}

.sidebar-header {
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--sidebar-border) !important;
}

.sidebar-header h6 {
  color: var(--sidebar-text-bright);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
}

.sidebar-header h6 i {
  color: var(--accent);
}

.sidebar-header .btn-outline-secondary {
  color: var(--sidebar-text);
  border-color: var(--sidebar-border);
}

/* New chat button */
#btn-new-chat {
  background: var(--accent);
  border: none;
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 0.8125rem;
  padding: 0.5rem 1rem;
  transition: all 0.2s ease;
  letter-spacing: 0.01em;
}

#btn-new-chat:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(108, 99, 255, 0.35);
}

/* Sidebar nav items */
.sidebar-nav {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--sidebar-border) !important;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  color: var(--sidebar-text);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  border-left: 3px solid transparent;
}

.sidebar-nav-item:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-text-bright);
}

.sidebar-nav-item.active {
  background: var(--sidebar-active);
  color: var(--sidebar-text-bright);
  border-left-color: var(--accent);
}

.sidebar-nav-item i {
  font-size: 0.875rem;
  width: 1.25rem;
  text-align: center;
  color: var(--accent);
}

/* Section title */
.sidebar-section-title {
  padding: 0.625rem 1rem 0.375rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--sidebar-text);
  opacity: 0.5;
}

/* User widget */
.sidebar-user-widget {
  color: var(--sidebar-text);
  font-size: 0.8125rem;
  cursor: pointer;
  transition: color 0.15s ease;
  padding: 0.125rem 0;
}

.sidebar-user-widget:hover {
  color: var(--sidebar-text-bright);
}

.sidebar-user-widget i {
  color: var(--accent);
}

/* Session list */
.sidebar-sessions {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.sidebar-sessions::-webkit-scrollbar {
  width: 4px;
}

.sidebar-sessions::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-sessions::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.session-item {
  cursor: pointer;
  transition: all 0.15s ease;
  border-bottom: 1px solid var(--sidebar-border) !important;
  border-left: 3px solid transparent;
}

.session-item:hover {
  background-color: var(--sidebar-hover);
}

.session-item.active {
  background-color: var(--sidebar-active);
  border-left-color: var(--accent);
}

.session-item .fw-semibold {
  color: var(--sidebar-text-bright);
  font-size: 0.8125rem !important;
  font-weight: 500;
}

.session-item .text-muted {
  color: var(--sidebar-text) !important;
}

/* Session delete button */
.btn-delete-session {
  opacity: 0;
  transition: all 0.15s ease;
  padding: 0.25rem 0.375rem;
  color: var(--sidebar-text);
  border: none;
  background: none;
  font-size: 0.75rem;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
}

.session-item:hover .btn-delete-session {
  opacity: 0.7;
}

.btn-delete-session:hover {
  opacity: 1 !important;
  color: #f87171;
  background: rgba(248, 113, 113, 0.1);
}

/* Sidebar footer */
.sidebar-footer {
  background: rgba(0, 0, 0, 0.15);
  border-top: 1px solid var(--sidebar-border) !important;
}

.sidebar-footer .text-muted {
  color: var(--sidebar-text) !important;
  font-size: 0.8125rem;
}

.sidebar-footer .text-muted i {
  color: var(--accent);
}

.sidebar-footer .btn-outline-danger {
  color: var(--sidebar-text);
  border-color: rgba(255, 255, 255, 0.1);
  font-size: 0.75rem;
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.5rem;
}

.sidebar-footer .btn-outline-danger:hover {
  color: #fff;
  background: #ef4444;
  border-color: #ef4444;
}

/* ==========================================================================
   Chat Area
   ========================================================================== */

.chat-main {
  background: var(--chat-bg);
}

.chat-header {
  background: var(--input-bg);
  border-bottom: 1px solid var(--border-color) !important;
}

/* Messages container */
.chat-messages {
  background: var(--chat-bg);
  scroll-behavior: smooth;
  padding: 1.5rem !important;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.1) transparent;
}

.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 6px;
}

/* ==========================================================================
   Message Bubbles
   ========================================================================== */

.message-bubble {
  max-width: 75%;
  animation: fadeInUp 0.3s ease;
}

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

.message-user {
  margin-left: auto;
}

.message-assistant {
  margin-right: auto;
}

.message-content {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.message-user .message-content {
  flex-direction: row-reverse;
}

/* Avatar */
.message-role {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  box-shadow: var(--shadow-sm);
}

.message-user .message-role {
  background: var(--user-bubble);
  color: white;
}

.message-assistant .message-role {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

/* Bubble text */
.message-text {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-lg);
  font-size: 0.875rem;
  line-height: 1.6;
  word-wrap: break-word;
  box-shadow: var(--shadow-sm);
}

.message-user .message-text {
  background: var(--user-bubble);
  color: white;
  border-bottom-right-radius: var(--radius-sm);
}

.message-assistant .message-text {
  background: var(--assistant-bubble);
  color: var(--text-primary);
  border-bottom-left-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

/* Message timestamp */
.message-time {
  font-size: 0.6875rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
  padding: 0 0.5rem;
}

/* ==========================================================================
   Chat Input
   ========================================================================== */

.chat-input {
  background: var(--input-bg);
  border-top: 1px solid var(--border-color) !important;
  padding: 1rem 1.5rem !important;
}

.chat-input .input-group {
  background: var(--chat-bg);
  border-radius: var(--radius-xl);
  border: 2px solid var(--border-color);
  padding: 0.25rem 0.25rem 0.25rem 0.75rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.chat-input .input-group:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.1);
}

.chat-input textarea {
  resize: none;
  max-height: 120px;
  border: none;
  background: transparent;
  padding: 0.5rem 0.5rem;
  font-size: 0.875rem;
  color: var(--text-primary);
  line-height: 1.5;
}

.chat-input textarea:focus {
  box-shadow: none;
  outline: none;
}

.chat-input textarea::placeholder {
  color: #94a3b8;
}

.chat-input .btn {
  border-radius: 50%;
  width: 36px;
  height: 36px;
  min-width: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  border: none;
  transition: all 0.2s ease;
}

.chat-input .btn:hover {
  background: var(--accent-hover);
  transform: scale(1.05);
}

.chat-input .btn:disabled {
  background: #cbd5e1;
  transform: none;
}

.chat-input .btn i {
  font-size: 0.875rem;
}

/* ==========================================================================
   Typing Indicator
   ========================================================================== */

.typing-indicator {
  display: flex;
  gap: 5px;
  padding: 0.75rem 1rem;
  align-items: center;
}

.typing-indicator span {
  width: 7px;
  height: 7px;
  background: var(--accent);
  border-radius: 50%;
  animation: typing 1.4s infinite ease-in-out;
  opacity: 0.6;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-8px); opacity: 1; }
}

/* ==========================================================================
   Empty State
   ========================================================================== */

.empty-state {
  color: #94a3b8;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 2rem;
}

.empty-state i {
  font-size: 4rem !important;
  color: #cbd5e1;
  margin-bottom: 1rem;
}

.empty-state p {
  font-size: 0.9375rem;
  max-width: 320px;
  line-height: 1.6;
}

/* ==========================================================================
   Login Page
   ========================================================================== */

.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.login-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 400px;
  padding: 2.5rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.login-card .logo {
  text-align: center;
  margin-bottom: 2rem;
}

.login-card .logo-icon {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--accent) 0%, #764ba2 100%);
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: white;
  margin-bottom: 0.75rem;
  box-shadow: 0 4px 15px rgba(108, 99, 255, 0.3);
}

.login-card .logo h4 {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 1.25rem;
  margin: 0;
  letter-spacing: -0.02em;
}

.login-card .logo p {
  color: var(--text-secondary);
  font-size: 0.8125rem;
  margin: 0.25rem 0 0;
}

.login-card .form-label {
  font-weight: 500;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.login-card .form-control {
  border-radius: var(--radius-md);
  border-color: var(--border-color);
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.login-card .form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.1);
}

.login-card .btn-primary {
  background: var(--accent);
  border: none;
  border-radius: var(--radius-md);
  padding: 0.625rem;
  font-weight: 600;
  font-size: 0.875rem;
  transition: all 0.2s ease;
}

.login-card .btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(108, 99, 255, 0.35);
}

/* ==========================================================================
   Markdown Content (inside assistant bubbles)
   ========================================================================== */

.markdown-body {
  font-size: 0.875rem;
  line-height: 1.7;
}

.markdown-body p {
  margin-bottom: 0.5rem;
}

.markdown-body p:last-child {
  margin-bottom: 0;
}

.markdown-body strong {
  font-weight: 600;
  color: var(--text-primary);
}

.message-user .markdown-body strong {
  color: inherit;
}

.markdown-body ul,
.markdown-body ol {
  padding-left: 1.25rem;
  margin-bottom: 0.5rem;
}

.markdown-body li {
  margin-bottom: 0.25rem;
}

.markdown-body li::marker {
  color: var(--accent);
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
  font-weight: 600;
  margin-top: 0.75rem;
  margin-bottom: 0.375rem;
  line-height: 1.3;
}

.markdown-body h1 { font-size: 1.1rem; }
.markdown-body h2 { font-size: 1rem; }
.markdown-body h3 { font-size: 0.9375rem; }
.markdown-body h4 { font-size: 0.875rem; }

.markdown-body code {
  background: rgba(108, 99, 255, 0.08);
  color: var(--accent);
  padding: 0.125rem 0.375rem;
  border-radius: 4px;
  font-size: 0.8125rem;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

.markdown-body pre {
  background: #1e293b;
  color: #e2e8f0;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin: 0.5rem 0;
  font-size: 0.8125rem;
  line-height: 1.5;
}

.markdown-body pre code {
  background: none;
  color: inherit;
  padding: 0;
  font-size: inherit;
}

.markdown-body blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 0.75rem;
  margin: 0.5rem 0;
  color: var(--text-secondary);
  font-style: italic;
}

.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.5rem 0;
  font-size: 0.8125rem;
}

.markdown-body th,
.markdown-body td {
  border: 1px solid var(--border-color);
  padding: 0.375rem 0.625rem;
  text-align: left;
}

.markdown-body th {
  background: var(--chat-bg);
  font-weight: 600;
}

.markdown-body hr {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 0.75rem 0;
}

/* ==========================================================================
   Chart.js Container
   ========================================================================== */

.ui-panel {
  background: white;
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-top: 0.75rem;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.ui-panel .chart-title {
  color: var(--text-primary);
  font-size: 0.8125rem;
  font-weight: 600;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 0.75rem;
}

.chartjs-canvas {
  width: 100% !important;
}

/* ==========================================================================
   Mobile Responsive
   ========================================================================== */

@media (max-width: 767.98px) {
  .chat-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 1050;
    margin-left: -300px;
    box-shadow: none;
  }
  .chat-sidebar.show {
    margin-left: 0;
    box-shadow: 4px 0 25px rgba(0, 0, 0, 0.3);
  }
  .message-bubble {
    max-width: 90%;
  }
  .chat-input {
    padding: 0.75rem 1rem !important;
  }
}

/* ==========================================================================
   Toast Notifications
   ========================================================================== */

#toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.app-toast {
  display: flex;
  align-items: center;
  padding: 0.625rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  animation: toastSlideIn 0.3s ease;
  pointer-events: auto;
  max-width: 380px;
  backdrop-filter: blur(8px);
}

.app-toast .btn-close {
  filter: brightness(0) invert(1);
  opacity: 0.7;
  font-size: 0.625rem;
  padding: 0.25rem;
}

.app-toast .btn-close:hover {
  opacity: 1;
}

.app-toast-error {
  background: rgba(239, 68, 68, 0.95);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.app-toast-warning {
  background: rgba(245, 158, 11, 0.95);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.app-toast-info {
  background: rgba(59, 130, 246, 0.95);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.app-toast-fade {
  opacity: 0;
  transform: translateX(20px);
  transition: all 0.3s ease;
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ==========================================================================
   Offline Banner
   ========================================================================== */

.offline-banner {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
  text-align: center;
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  animation: fadeInDown 0.3s ease;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.25);
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-100%);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================================================
   Error Bubble & Retry
   ========================================================================== */

.error-bubble {
  background: #fef2f2 !important;
  border: 1px solid #fecaca !important;
  color: #991b1b;
}

.error-bubble strong {
  color: #dc2626;
}

.error-detail {
  font-size: 0.8125rem;
  color: #7f1d1d;
  opacity: 0.85;
  line-height: 1.5;
}

.btn-retry {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.3rem 0.75rem;
  transition: all 0.2s ease;
  cursor: pointer;
}

.btn-retry:hover {
  background: #dc2626;
  color: white;
  border-color: #dc2626;
}

/* ==========================================================================
   KPI Cards
   ========================================================================== */

.kpi-card {
  background: var(--chat-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  min-width: 120px;
  flex: 1;
  text-align: center;
  transition: all 0.2s ease;
}

.kpi-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(108, 99, 255, 0.1);
}

.kpi-label {
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.kpi-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.kpi-unit {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-secondary);
}

/* ==========================================================================
   UI Table
   ========================================================================== */

.ui-table {
  font-size: 0.8125rem;
}

.ui-table thead th {
  background: var(--chat-bg);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 2px solid var(--border-color);
  padding: 0.5rem 0.75rem;
  white-space: nowrap;
}

.ui-table tbody td {
  padding: 0.5rem 0.75rem;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.ui-table tbody tr:hover {
  background: var(--accent-light);
}

.ui-table tbody tr:last-child td {
  border-bottom: none;
}

/* ==========================================================================
   JSON Viewer
   ========================================================================== */

.json-viewer {
  background: #1e293b;
  color: #a5f3fc;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  line-height: 1.6;
  overflow-x: auto;
  max-height: 300px;
  overflow-y: auto;
  margin: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.json-viewer::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

.json-viewer::-webkit-scrollbar-track {
  background: transparent;
}

.json-viewer::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

/* UI panel details/summary */
.ui-panel details summary {
  cursor: pointer;
  user-select: none;
  padding: 0.25rem 0;
}

.ui-panel details summary:hover {
  color: var(--accent) !important;
}

/* ==========================================================================
   Panel Area (Profile, Summaries, Actions)
   ========================================================================== */

.panel-area {
  padding: 2rem;
  background: var(--chat-bg);
}

/* Placeholder panels (AI Ozetler, Aksiyon Takip) */
.placeholder-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 50vh;
  color: var(--text-secondary);
}

.placeholder-panel-icon {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  background: var(--accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  color: var(--accent);
  margin-bottom: 1.25rem;
}

.placeholder-panel h5 {
  color: var(--text-primary);
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.placeholder-panel p {
  max-width: 360px;
  font-size: 0.875rem;
  line-height: 1.6;
}

/* Panel page (Reports, Actions) */
.panel-page {
  max-width: 800px;
  margin: 0 auto;
}

.panel-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.panel-page-header h5 {
  color: var(--text-primary);
  font-weight: 600;
  font-size: 1.0625rem;
  margin: 0;
}

.panel-page-header h5 i {
  color: var(--accent);
}

/* Panel filters (action status tabs) */
.panel-filters {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.panel-filter {
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-secondary);
  background: white;
  border: 1px solid var(--border-color);
  transition: all 0.15s ease;
}

.panel-filter:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.panel-filter.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

/* Panel card list */
.panel-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.panel-card {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  transition: all 0.15s ease;
  box-shadow: var(--shadow-sm);
}

.panel-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

.panel-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.panel-card-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.badge-info { background: rgba(59, 130, 246, 0.1); color: #3b82f6; }
.badge-warning { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }
.badge-danger { background: rgba(239, 68, 68, 0.1); color: #ef4444; }
.badge-secondary { background: rgba(100, 116, 139, 0.1); color: #64748b; }

.panel-card-date {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.panel-card-body {
  font-size: 0.8125rem;
  line-height: 1.6;
  color: var(--text-primary);
}

.action-text {
  margin-bottom: 0.375rem;
}

.action-finding {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-bottom: 0.375rem;
}

.action-meta {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 0.125rem;
}

.action-meta i {
  color: var(--accent);
  width: 1rem;
  text-align: center;
}

.action-notes {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-style: italic;
  margin-top: 0.375rem;
  padding-top: 0.375rem;
  border-top: 1px dashed var(--border-color);
}

/* Action table */
.action-table {
  font-size: 0.8125rem;
  background: white;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}

.action-table thead th {
  background: var(--chat-bg);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  border-bottom: 2px solid var(--border-color);
  padding: 0.625rem 0.75rem;
  white-space: nowrap;
  vertical-align: middle;
}

.action-table tbody td {
  padding: 0.625rem 0.75rem;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
  font-size: 0.8125rem;
}

.action-table tbody tr:last-child td {
  border-bottom: none;
}

.action-table tbody tr:hover {
  background: var(--accent-light);
}

.action-text-cell {
  font-weight: 500;
  line-height: 1.4;
}

.action-notes-cell {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-style: italic;
  margin-top: 0.25rem;
}

.action-date-cell {
  position: relative;
  display: inline-block;
}

.action-date-text {
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  padding: 0.15rem 0.25rem;
  border-radius: var(--radius-sm);
  transition: background 0.15s ease;
}

.action-date-text:hover {
  background: var(--accent-light);
  color: var(--accent);
}

.action-date-edit-icon {
  font-size: 0.7rem;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.action-date-text:hover .action-date-edit-icon {
  opacity: 0.7;
}

.action-date-hidden {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}

.btn-action-menu {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.375rem;
  line-height: 1;
  transition: all 0.15s ease;
}

.btn-action-menu:hover {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
}

/* Reject modal */
#rejectModal .modal-content {
  border-radius: var(--radius-md);
  border: none;
  box-shadow: var(--shadow-lg);
}

#rejectModal .modal-header {
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 1.25rem;
}

#rejectModal .modal-title {
  font-weight: 600;
  font-size: 0.9375rem;
}

#rejectModal .modal-body .form-label {
  font-weight: 500;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

#rejectModal .modal-body .form-control {
  border-radius: var(--radius-sm);
  border-color: var(--border-color);
  font-size: 0.875rem;
}

#rejectModal .modal-body .form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.1);
}

#rejectModal .modal-footer {
  border-top: 1px solid var(--border-color);
  padding: 0.75rem 1.25rem;
}

/* Badge success for ASSIGNED */
.badge-success { background: rgba(34, 197, 94, 0.1); color: #16a34a; }

/* Report accordion */
.report-card {
  cursor: pointer;
}

.report-chevron {
  font-size: 0.75rem;
  color: var(--text-secondary);
  transition: transform 0.2s ease;
}

.report-card.open .report-chevron {
  transform: rotate(90deg);
}

.report-detail {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.report-card.open .report-detail {
  max-height: 2000px;
}

.report-detail-content {
  padding: 0.75rem 0 0 1.5rem;
  border-top: 1px solid var(--border-color);
  margin-top: 0.5rem;
  font-size: 0.8125rem;
  line-height: 1.7;
}

/* Profile panel */
.profile-panel {
  max-width: 480px;
  margin: 0 auto;
}

.profile-panel-header {
  text-align: center;
  padding-bottom: 1.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--accent) 0%, #764ba2 100%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: white;
  margin-bottom: 0.75rem;
  box-shadow: 0 4px 15px rgba(108, 99, 255, 0.3);
}

.profile-panel-header h5 {
  color: var(--text-primary);
  font-weight: 600;
  font-size: 1.125rem;
}

.profile-section {
  margin-bottom: 1.5rem;
}

.profile-section h6 {
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 0.75rem;
}

.profile-section h6 i {
  color: var(--accent);
}

.profile-value {
  color: var(--text-secondary);
  font-size: 0.875rem;
  background: white;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.profile-section .form-label {
  font-weight: 500;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.profile-section .form-control {
  border-radius: var(--radius-sm);
  border-color: var(--border-color);
  font-size: 0.875rem;
}

.profile-section .form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.1);
}

.profile-section .btn-primary {
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 0.8125rem;
}

.profile-section .btn-primary:hover {
  background: var(--accent-hover);
}

/* ==========================================================================
   Selection & Scrollbar
   ========================================================================== */

::selection {
  background: rgba(108, 99, 255, 0.2);
  color: inherit;
}
