/* ============================================================
   Steve Dashboard - Complete Stylesheet
   ============================================================ */

/* ----- CSS Variables ----- */
:root {
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-card: #21262d;
  --border-color: #30363d;
  --accent: #d4a41e;
  --accent-hover: #e2b714;
  --accent-dim: rgba(212, 164, 30, 0.15);
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #484f58;
  --danger: #f85149;
  --success: #3fb950;
  --info: #58a6ff;
  --warning: #d29922;
  --channel-telegram: #58a6ff;
  --channel-sms: #3fb950;
  --channel-messenger: #bc8cff;
  --sidebar-width: 320px;
  --mobile-header-height: 56px;
  --font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'SF Mono', 'Cascadia Code', 'Fira Code', 'JetBrains Mono', Consolas, 'Courier New', monospace;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-elevated: 0 8px 24px rgba(0, 0, 0, 0.4);
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-family);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-hover);
}

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

input {
  font-family: inherit;
  font-size: inherit;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

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

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

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


/* ============================================================
   LOGIN PAGE
   ============================================================ */

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  background: var(--bg-primary);
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(212, 164, 30, 0.04) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(88, 166, 255, 0.03) 0%, transparent 50%);
}

.login-container {
  width: 100%;
  max-width: 420px;
}

.login-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  box-shadow: var(--shadow-elevated);
}

.login-header {
  text-align: center;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.login-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
}

.login-goat {
  font-size: 1.75rem;
  line-height: 1;
}

.login-subtitle {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 28px;
}

.login-error {
  display: none;
  background: rgba(248, 81, 73, 0.1);
  border: 1px solid rgba(248, 81, 73, 0.3);
  color: var(--danger);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  margin-bottom: 20px;
  text-align: center;
}

.login-error.visible {
  display: block;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-group input {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
}

.form-group input::placeholder {
  color: var(--text-muted);
}

.form-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.btn-login {
  background: var(--accent);
  color: #000;
  font-weight: 600;
  font-size: 1rem;
  padding: 12px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast), transform var(--transition-fast);
  margin-top: 4px;
}

.btn-login:hover {
  background: var(--accent-hover);
}

.btn-login:active {
  transform: scale(0.98);
}

.login-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 0.8rem;
  color: var(--text-muted);
}


/* ============================================================
   APP LAYOUT
   ============================================================ */

.app {
  display: flex;
  min-height: 100vh;
}

/* ----- Mobile Header ----- */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--mobile-header-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  z-index: 100;
  padding: 0 16px;
  align-items: center;
  justify-content: space-between;
}

.hamburger-btn {
  font-size: 1.5rem;
  color: var(--text-primary);
  padding: 8px;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

.hamburger-btn:hover {
  background: var(--bg-card);
}

.mobile-title {
  font-size: 1rem;
  font-weight: 600;
}

.mobile-header-spacer {
  width: 44px;
}

/* ----- Sidebar Overlay (mobile) ----- */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 199;
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.sidebar-overlay.visible {
  opacity: 1;
}


/* ============================================================
   SIDEBAR
   ============================================================ */

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: transform var(--transition-normal);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.sidebar-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.sidebar-title .accent {
  color: var(--accent);
}

.sidebar-close {
  display: none;
  font-size: 1.2rem;
  color: var(--text-secondary);
  padding: 6px;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast), color var(--transition-fast);
}

.sidebar-close:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

/* ----- Tab Navigation ----- */
.tab-nav {
  display: flex;
  padding: 6px;
  gap: 2px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 7px 4px;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast), color var(--transition-fast);
  min-height: 40px;
  white-space: nowrap;
  overflow: hidden;
}

.tab-btn:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

.tab-btn.active {
  background: var(--accent-dim);
  color: var(--accent);
}

.tab-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* ----- Sidebar Panels ----- */
.sidebar-panel {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.sidebar-panel.hidden {
  display: none;
}

.sidebar-panel-info {
  padding: 20px 16px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* ----- Search ----- */
.search-container {
  padding: 12px 12px 8px;
  flex-shrink: 0;
}

.search-input {
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--text-primary);
  font-size: 0.875rem;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

/* ----- Channel Filter Buttons ----- */
.filter-buttons,
.log-filters {
  display: flex;
  gap: 6px;
  padding: 4px 12px 10px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  min-height: 30px;
}

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

.filter-btn.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

.channel-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.channel-dot.telegram { background: var(--channel-telegram); }
.channel-dot.sms { background: var(--channel-sms); }
.channel-dot.messenger { background: var(--channel-messenger); }

/* ----- Conversation List ----- */
.conversation-list {
  flex: 1;
  overflow-y: auto;
}

.conversation-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-color);
  transition: background var(--transition-fast);
  position: relative;
  min-height: 64px;
}

.conversation-item:hover {
  background: var(--bg-card);
}

.conversation-item.active {
  background: var(--accent-dim);
  border-left: 3px solid var(--accent);
}

.conversation-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-primary);
  flex-shrink: 0;
  border: 1px solid var(--border-color);
}

.conversation-item.active .conversation-avatar {
  border-color: var(--accent);
}

.conversation-info {
  flex: 1;
  min-width: 0;
}

.conversation-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 2px;
}

.conversation-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conversation-time {
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.conversation-bottom-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.conversation-preview {
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.conversation-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.channel-badge {
  font-size: 0.6rem;
  line-height: 1;
}

.unread-badge {
  width: 10px;
  height: 10px;
  background: var(--accent);
  border-radius: 50%;
  flex-shrink: 0;
}

.conversation-list-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ----- Sidebar Footer (Logout) ----- */
.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
}

.logout-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  width: 100%;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast), color var(--transition-fast);
  min-height: 44px;
}

.logout-btn:hover {
  background: rgba(248, 81, 73, 0.1);
  color: var(--danger);
}

.logout-icon {
  width: 18px;
  height: 18px;
}


/* ============================================================
   MAIN CONTENT
   ============================================================ */

.content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.view {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.view.hidden {
  display: none;
}

.view-title {
  font-size: 1.3rem;
  font-weight: 700;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}


/* ============================================================
   CHAT VIEW
   ============================================================ */

.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 40px;
  color: var(--text-muted);
  text-align: center;
}

.empty-icon svg {
  stroke: var(--border-color);
}

.empty-state h3 {
  font-size: 1.1rem;
  color: var(--text-secondary);
}

.empty-state p {
  font-size: 0.9rem;
  max-width: 340px;
}

/* Chat header */
.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
  min-height: 60px;
}

.chat-header.hidden {
  display: none;
}

.back-btn {
  display: none;
  padding: 8px;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: background var(--transition-fast), color var(--transition-fast);
}

.back-btn:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

.chat-header-info {
  flex: 1;
  min-width: 0;
}

.chat-contact-name {
  font-size: 1rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-contact-details {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Messages area */
.messages-area {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  min-height: 0;
}

.messages-area.hidden {
  display: none;
}

/* Date separator */
.date-separator {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
}

.date-separator-line {
  flex: 1;
  height: 1px;
  background: var(--border-color);
}

.date-separator-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
  padding: 4px 12px;
  background: var(--bg-card);
  border-radius: 20px;
}

/* Message bubbles */
.message-wrapper {
  display: flex;
  flex-direction: column;
  max-width: 75%;
  margin-bottom: 4px;
}

.message-wrapper.outbound {
  margin-left: auto;
  align-items: flex-end;
}

.message-wrapper.inbound {
  margin-right: auto;
  align-items: flex-start;
}

.message-bubble {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  line-height: 1.45;
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: pre-wrap;
}

.message-wrapper.outbound .message-bubble {
  background: var(--accent);
  color: #000;
  border-bottom-right-radius: 4px;
}

.message-wrapper.inbound .message-bubble {
  background: var(--bg-card);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}

.message-time {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 3px;
  padding: 0 4px;
}


/* ============================================================
   STATS VIEW
   ============================================================ */

.stats-view {
  padding-bottom: 40px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  padding: 20px 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.stat-card:hover {
  border-color: var(--text-muted);
  box-shadow: var(--shadow-card);
}

.stat-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stat-icon {
  font-size: 1.2rem;
  line-height: 1;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}

.stat-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Chart container */
.chart-container {
  margin: 0 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
}

.chart-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 20px;
  color: var(--text-secondary);
}

/* CSS-only bar chart */
.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  height: 200px;
  padding-top: 10px;
  border-bottom: 1px solid var(--border-color);
}

.bar-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  height: 100%;
  justify-content: flex-end;
}

.bar {
  width: 100%;
  max-width: 60px;
  background: var(--accent);
  border-radius: 4px 4px 0 0;
  min-height: 4px;
  transition: height 0.5s ease, background 0.2s ease;
  position: relative;
}

.bar:hover {
  background: var(--accent-hover);
}

.bar-value {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.bar-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  padding-top: 8px;
  text-align: center;
}


/* ============================================================
   LOGS VIEW
   ============================================================ */

.logs-view {
  display: flex;
  flex-direction: column;
}

.logs-terminal {
  flex: 1;
  background: var(--bg-primary);
  margin: 16px 24px 24px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 400px;
  max-height: calc(100vh - 140px);
}

.logs-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.7;
}

.log-entry {
  display: flex;
  gap: 12px;
  padding: 2px 0;
  border-bottom: 1px solid rgba(48, 54, 61, 0.3);
}

.log-entry.hidden {
  display: none;
}

.log-timestamp {
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
  user-select: none;
}

.log-type-badge {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: 3px;
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 50px;
  text-align: center;
}

.log-type-badge.info {
  color: var(--info);
  background: rgba(88, 166, 255, 0.1);
}

.log-type-badge.error {
  color: var(--danger);
  background: rgba(248, 81, 73, 0.1);
}

.log-type-badge.notification {
  color: var(--accent);
  background: var(--accent-dim);
}

.log-type-badge.warn {
  color: var(--warning);
  background: rgba(210, 153, 34, 0.1);
}

.log-message {
  color: var(--text-primary);
  word-break: break-word;
}

.log-entry.error .log-message {
  color: var(--danger);
}

.log-entry.notification .log-message {
  color: var(--accent);
}

.logs-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.85rem;
}


/* ============================================================
   RESPONSIVE - Mobile (max-width: 768px)
   ============================================================ */

@media (max-width: 768px) {
  .mobile-header {
    display: flex;
  }

  .sidebar {
    transform: translateX(-100%);
    width: 100%;
    max-width: 360px;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar.open ~ .sidebar-overlay {
    display: block;
    opacity: 1;
  }

  .sidebar-overlay {
    display: none;
  }

  body.sidebar-open .sidebar-overlay {
    display: block;
    opacity: 1;
  }

  .sidebar-close {
    display: flex;
  }

  .content {
    margin-left: 0;
    padding-top: var(--mobile-header-height);
  }

  .back-btn {
    display: flex;
  }

  .stats-grid {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .chart-container {
    margin: 0 16px;
  }

  .view-title {
    padding: 16px;
  }

  .messages-area {
    padding: 12px 14px;
  }

  .message-wrapper {
    max-width: 88%;
  }

  .logs-terminal {
    margin: 12px 16px 16px;
    max-height: calc(100vh - 160px);
  }

  .bar-chart {
    gap: 6px;
    height: 160px;
  }

  .bar-value {
    font-size: 0.6rem;
  }
}

/* Tiny screens */
@media (max-width: 360px) {
  .login-card {
    padding: 28px 20px;
  }

  .filter-buttons,
  .log-filters {
    gap: 4px;
  }

  .filter-btn {
    padding: 4px 8px;
    font-size: 0.7rem;
  }

  .tab-btn {
    font-size: 0.7rem;
    gap: 4px;
  }

  .tab-icon {
    width: 14px;
    height: 14px;
  }
}


/* ============================================================
   DOCUMENTS VIEW
   ============================================================ */

.documents-view {
  overflow-y: auto;
}

.documents-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.documents-header .view-title {
  flex: 1;
  padding: 0;
  border: none;
}

.btn-upload {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--accent);
  color: #000;
  font-weight: 600;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast), transform var(--transition-fast);
  white-space: nowrap;
}

.btn-upload:hover {
  background: var(--accent-hover);
}

.btn-upload:active {
  transform: scale(0.97);
}

/* Drop zone */
.drop-zone {
  margin: 16px 24px;
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 32px;
  text-align: center;
  transition: border-color var(--transition-fast), background var(--transition-fast);
  cursor: pointer;
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.drop-zone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--text-secondary);
}

.drop-zone-content svg {
  stroke: var(--text-muted);
}

.drop-zone.drag-over .drop-zone-content svg {
  stroke: var(--accent);
}

.drop-zone-content p {
  font-size: 0.9rem;
  font-weight: 500;
}

.drop-zone-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Upload progress */
.upload-progress {
  margin: 0 24px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.upload-progress.hidden {
  display: none;
}

.upload-progress-bar {
  flex: 1;
  height: 6px;
  background: var(--bg-card);
  border-radius: 3px;
  overflow: hidden;
}

.upload-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.upload-progress-text {
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* Document list */
.documents-list {
  padding: 0 24px 24px;
}

.documents-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.document-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 10px;
  transition: border-color var(--transition-fast);
}

.document-item:hover {
  border-color: var(--text-muted);
}

.document-icon {
  flex-shrink: 0;
  padding-top: 2px;
}

.doc-type-badge {
  display: inline-block;
  padding: 4px 8px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  border-radius: 4px;
  letter-spacing: 0.03em;
  color: var(--text-primary);
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
}

.doc-type-badge.pdf {
  color: #f85149;
  border-color: rgba(248, 81, 73, 0.3);
  background: rgba(248, 81, 73, 0.1);
}

.doc-type-badge.img {
  color: var(--info);
  border-color: rgba(88, 166, 255, 0.3);
  background: rgba(88, 166, 255, 0.1);
}

.doc-type-badge.xls {
  color: var(--success);
  border-color: rgba(63, 185, 80, 0.3);
  background: rgba(63, 185, 80, 0.1);
}

.doc-type-badge.promo {
  color: var(--warning);
  border-color: rgba(210, 153, 34, 0.3);
  background: rgba(210, 153, 34, 0.1);
}

.doc-type-badge.txt {
  color: var(--text-secondary);
  border-color: var(--border-color);
  background: var(--bg-primary);
}

.document-info {
  flex: 1;
  min-width: 0;
}

.document-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  word-break: break-word;
}

.document-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.document-status {
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 0.7rem;
}

.document-status.success {
  color: var(--success);
  background: rgba(63, 185, 80, 0.1);
}

.document-status.warning {
  color: var(--warning);
  background: rgba(210, 153, 34, 0.1);
}

.document-status.error {
  color: var(--danger);
  background: rgba(248, 81, 73, 0.1);
}

.document-summary {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.document-error {
  font-size: 0.8rem;
  color: var(--danger);
  line-height: 1.4;
}

.document-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.doc-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: background var(--transition-fast), color var(--transition-fast);
}

.doc-action-btn:hover {
  background: var(--bg-primary);
  color: var(--text-primary);
}

.doc-action-btn.danger:hover {
  background: rgba(248, 81, 73, 0.1);
  color: var(--danger);
}

/* ----- Lender Filters ----- */
.lender-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border-color);
}

.lender-filters:empty {
  display: none;
}

.lender-filter-btn {
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.75rem;
  transition: all 0.15s;
}

.lender-filter-btn:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

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

/* ----- Lender Groups ----- */
.lender-group {
  margin-bottom: 24px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.lender-group .document-item {
  margin-bottom: 0;
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-top: none;
}

.lender-group .document-item:last-child {
  border-bottom: none;
}

.lender-group-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
}

.lender-group-icon {
  display: flex;
  align-items: center;
  color: var(--accent);
}

.lender-group-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.lender-group-count {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-left: auto;
}

/* ----- Badges ----- */
.badge-nouveau {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 10px;
  background: var(--success);
  color: white;
  font-size: 0.65rem;
  font-weight: 600;
  margin-left: 6px;
  vertical-align: middle;
}

.badge-promo {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 10px;
  background: var(--warning);
  color: #000;
  font-size: 0.65rem;
  font-weight: 600;
  margin-left: 6px;
  vertical-align: middle;
}

.badge-source {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 10px;
  background: var(--bg-main);
  color: var(--text-secondary);
  font-size: 0.65rem;
  margin-left: 4px;
  vertical-align: middle;
}

.document-date-validity {
  font-size: 0.7rem;
  color: var(--info);
  font-weight: 500;
}

.document-lender {
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 500;
}

/* ----- Archive Section ----- */
.archive-section {
  margin-top: 20px;
  border-top: 1px solid var(--border-color);
  padding-top: 12px;
}

.archive-toggle {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.8rem;
  margin-bottom: 8px;
}

.archive-toggle:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

.archived-item {
  opacity: 0.5;
}

.document-status.archived {
  color: var(--text-secondary);
}

/* Mobile documents */
@media (max-width: 768px) {
  .documents-header {
    padding: 16px;
  }

  .drop-zone {
    margin: 12px 16px;
    padding: 24px 16px;
  }

  .documents-list {
    padding: 0 16px 16px;
  }

  .document-item {
    flex-wrap: wrap;
  }

  .document-actions {
    width: 100%;
    justify-content: flex-end;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
    margin-top: 8px;
  }

  .lender-filters {
    padding: 8px 16px;
  }
}


/* ============================================================
   UTILITIES & ANIMATIONS
   ============================================================ */

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

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.fade-in {
  animation: fadeIn 0.3s ease forwards;
}

.notification-flash {
  animation: pulse 0.6s ease 3;
}

/* Loading skeleton */
.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--border-color) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Touch-friendly targets */
@media (pointer: coarse) {
  .conversation-item {
    min-height: 68px;
  }

  .tab-btn {
    min-height: 48px;
  }

  .filter-btn {
    min-height: 36px;
    padding: 8px 12px;
  }
}
