/*
 * Workstreams Inbox — shared application styles.
 * Layered on top of Bootstrap 5 (vendored under assets/vendor/bootstrap).
 * Ported from the original React/Tailwind app's inline styles + index.css,
 * kept as plain CSS classes since there is no build step / CSS-in-JS here.
 */

:root {
  --header-bg: #00172d;
  --brand-blue: #2E5BFF;
}

html, body {
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: #f8fafc;
}

a { text-decoration: none; }

.bg-page { background: #f8fafc; }

/* ── Header ──────────────────────────────────────────────────────────────── */

.app-header {
  position: sticky;
  top: 0;
  z-index: 1030;
  background: var(--header-bg);
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
}

.app-header .header-inner {
  max-width: 1500px;
  margin: 0 auto;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1.25rem;
}

.app-logo-box {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: var(--brand-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.app-logo-text {
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #fff;
  white-space: nowrap;
}

.header-spacer { flex: 1 1 auto; min-width: 0; }

.header-stats {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1 1 auto;
  min-width: 0;
  justify-content: center;
  flex-wrap: wrap;
}

.stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
  background: rgba(255,255,255,0.10);
  color: rgba(255,255,255,0.75);
  border: 1px solid rgba(255,255,255,0.15);
}
.stat-chip.urgent {
  background: rgba(239,68,68,0.18);
  color: #fca5a5;
  border: 1px solid rgba(239,68,68,0.3);
}
.stat-chip .label { opacity: 0.8; }
.stat-chip .value { font-weight: 700; color: #fff; }
.stat-chip.urgent .value { color: #fca5a5; }

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.header-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #fff;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.2);
  transition: background 0.15s;
  cursor: pointer;
}
.header-pill-btn:hover { background: rgba(255,255,255,0.18); color: #fff; }
.header-pill-btn:disabled { opacity: 0.6; cursor: default; }

.view-toggle-group {
  display: inline-flex;
  align-items: center;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.2);
}
.view-toggle-btn {
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  background: transparent;
  color: rgba(255,255,255,0.6);
  border: none;
  border-left: 1px solid rgba(255,255,255,0.2);
}
.view-toggle-btn:first-child { border-left: none; }
.view-toggle-btn.active { background: rgba(255,255,255,0.22); color: #fff; }
.view-toggle-btn:hover:not(.active) { color: #fff; }

.spin-slow { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.settings-menu-wrap { position: relative; }
.settings-menu {
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 0.5rem;
  width: 13rem;
  background: #fff;
  border-radius: 0.75rem;
  border: 1px solid #E8E8E8;
  box-shadow: 0 4px 24px rgba(0,0,0,0.15);
  overflow: hidden;
  z-index: 1040;
}
.settings-menu a, .settings-menu button {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  text-align: left;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  color: #374151;
  background: #fff;
  border: none;
}
.settings-menu a:hover, .settings-menu button:hover { background: #f9fafb; }
.settings-menu .danger { color: #dc2626; }
.settings-menu .danger:hover { background: #fef2f2; }
.settings-menu .divider { border-top: 1px solid #f3f3f3; }

/* ── Page shell ──────────────────────────────────────────────────────────── */

.app-body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: #f8fafc;
}
.app-body.kanban-mode {
  height: 100vh;
  overflow: hidden;
}
.app-main {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  padding: 1rem;
  gap: 0.75rem;
}
.app-main.kanban-mode { min-height: 0; }

.board-area { flex: 1 1 auto; }
.board-area.kanban-mode { min-height: 0; height: 100%; }

.banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  flex-shrink: 0;
}
.banner-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  font-weight: 500;
}
.banner-error button {
  background: none;
  border: none;
  color: #f87171;
  font-size: 1rem;
  line-height: 1;
}
.banner-error button:hover { color: #dc2626; }
.banner-unassigned {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
  justify-content: flex-start;
}

/* ── Matrix view ─────────────────────────────────────────────────────────── */

.matrix-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
@media (max-width: 900px) {
  .matrix-grid { grid-template-columns: 1fr; }
}

.quad-col {
  display: flex;
  flex-direction: column;
  border-radius: 0.75rem;
  overflow: hidden;
}
.quad-col-header {
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.quad-col-header .title { display: flex; align-items: center; gap: 0.5rem; }
.quad-col-header .title .icon { font-size: 1rem; line-height: 1; }
.quad-col-header .title .label { font-weight: 700; font-size: 0.875rem; }
.quad-col-count {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: rgba(0,0,0,0.08);
}
.quad-col-body { padding: 0.75rem; display: flex; flex-direction: column; gap: 0.75rem; }

.q-q1 .quad-col-header { background: #FEF2F2; color: #991B1B; border-bottom: 2px solid #FECACA; }
.q-q1 { border: 1px solid #FECACA; background: #FFFCFC; }
.q-q2 .quad-col-header { background: #EFF6FF; color: #1E40AF; border-bottom: 2px solid #BFDBFE; }
.q-q2 { border: 1px solid #BFDBFE; background: #FAFCFF; }
.q-q3 .quad-col-header { background: #FFFBEB; color: #92400E; border-bottom: 2px solid #FDE68A; }
.q-q3 { border: 1px solid #FDE68A; background: #FFFEF5; }
.q-q4 .quad-col-header { background: #F0FDF4; color: #166534; border-bottom: 2px solid #BBF7D0; }
.q-q4 { border: 1px solid #BBF7D0; background: #FAFFFE; }
.q-archived .quad-col-header { background: #F8FAFC; color: #475569; border-bottom: 2px solid #E2E8F0; }
.q-archived { border: 1px solid #E2E8F0; background: #F8FAFC; }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 0;
  gap: 0.75rem;
  color: #9ca3af;
  text-align: center;
}
.empty-state .icon-circle {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: center;
}
.empty-state p { font-size: 0.875rem; margin: 0; }

/* ── Kanban view ─────────────────────────────────────────────────────────── */

.kanban-row {
  display: flex;
  gap: 0.75rem;
  height: 100%;
  overflow-x: auto;
  padding-bottom: 0.5rem;
}
.kanban-col-outer {
  display: flex;
  flex-direction: column;
  flex: 1 1 220px;
  min-width: 200px;
  max-width: 340px;
  height: 100%;
}
.kanban-col-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  border-radius: 0.75rem;
  overflow: hidden;
  transition: all 0.15s;
}
.kanban-col-inner.drop-active {
  background-color: rgb(239 246 255);
  outline: 2px dashed #93c5fd;
  outline-offset: -2px;
}
.kanban-cards {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.kanban-empty.drag-active {
  background: #eff6ff;
  border: 2px dashed #93c5fd;
  border-radius: 0.5rem;
}
.kanban-empty .icon-circle { background: rgba(255,255,255,0.6); }

/* thin scrollbar */
.scrollbar-thin::-webkit-scrollbar { width: 5px; height: 5px; }
.scrollbar-thin::-webkit-scrollbar-track { background: transparent; }
.scrollbar-thin::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 99px; }
.scrollbar-thin::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ── Email card ──────────────────────────────────────────────────────────── */

.email-card {
  background: #fff;
  border-radius: 14px;
  border: 1px solid #F0F0F0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 4px 20px rgba(0,0,0,0.07);
  overflow: hidden;
  opacity: 1;
  transition: opacity 0.35s ease, box-shadow 0.2s ease;
}
.email-card.is-vip { border: 2px solid #FCD34D; }
.email-card.is-highlighted { box-shadow: 0 0 0 2px #3B82F6, 0 1px 3px rgba(0,0,0,0.08), 0 4px 20px rgba(0,0,0,0.07); }
.email-card.is-fading { opacity: 0; pointer-events: none; }
.email-card.is-draggable { cursor: grab; }

.email-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  letter-spacing: 0.03em;
}
.email-tag.kanban { padding: 3px 8px; gap: 0.25rem; }
.email-vip-star { color: #F59E0B; font-size: 13px; line-height: 1; }

.email-avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 14px; font-weight: 700;
}
.email-avatar.kanban { width: 32px; height: 32px; font-size: 13px; }

.email-sender-name {
  font-size: 13.5px; font-weight: 600; color: #1a1a1a; line-height: 1.2;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.email-sender-email {
  font-size: 11px; color: #999; margin-top: 1px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.email-subject { font-size: 12px; font-weight: 500; color: #1a1a1a; line-height: 1.35; }
.email-wait { font-size: 11px; margin-top: 2px; color: #bbb; }
.email-wait.overdue { color: #EF4444; font-weight: 600; }
.email-hint { font-size: 12px; color: #555; line-height: 1.55; font-style: italic; }
.email-hint.empty { color: #ccc; }
.email-content { font-size: 12px; color: #444; line-height: 1.5; }
.email-content.empty { color: #ccc; font-style: italic; }
.email-content-kanban {
  font-size: 11.5px; color: #666; line-height: 1.45; margin: 6px 0 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.email-hint-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0;
  background: #FEF3C7; color: #B45309; cursor: help;
  margin-left: 6px; vertical-align: middle;
}
.email-hint-badge:hover { background: #FDE68A; }

.email-actions-col {
  display: flex; flex-direction: column; gap: 7px;
}
.email-actions-row {
  display: flex; gap: 6px; flex-wrap: wrap;
}
.email-action-btn {
  display: inline-flex; align-items: center; gap: 8px;
  border-radius: 8px; padding: 7px 14px;
  font-size: 12px; font-weight: 500; white-space: nowrap;
  border: 1px solid #E4E4E4; background: #F5F5F5; color: #444;
  transition: background 0.15s;
}
.email-action-btn:hover { background: #EBEBEB; }
.email-action-btn .icon { display: inline-flex; align-items: center; }
.icon-outlook { color: #3a56c5; }
.icon-whatsapp { color: #15803D; }
.icon-website { color: #C2410C; }
.icon-plan { color: #1a7a4a; }
.icon-other { color: #6b4cba; }
.icon-archive { color: #c0392b; }

/* matrix variant: 3-column body */
.email-card-matrix-body {
  display: grid;
  grid-template-columns: 210px 1fr auto;
  gap: 0;
  padding: 14px 20px 20px;
  align-items: center;
}
.email-card-matrix-left { padding-right: 18px; border-right: 1px solid #efefef; }
.email-card-matrix-mid { padding: 0 18px; }
.email-card-matrix-right { padding-left: 18px; border-left: 1px solid #efefef; }
.email-card-matrix-tags { padding: 14px 20px 0; display: flex; align-items: center; gap: 8px; }

/* kanban variant: compact vertical card */
.email-card-kanban-tags { padding: 12px 14px 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.email-card-kanban-body { padding: 10px 14px 12px; flex: 1; position: relative; }
.email-card-kanban-actions { padding: 10px 14px 12px; border-top: 1px solid #f0f0f0; display: flex; gap: 6px; flex-wrap: wrap; }
.email-card-kanban-hint-overlay {
  position: absolute; inset: 0; background: rgba(255,255,255,0.96);
  border-radius: 8px; padding: 10px 12px; display: flex; align-items: center;
  opacity: 0; transition: opacity 0.18s ease; pointer-events: none;
}
.email-card-kanban:hover .email-card-kanban-hint-overlay { opacity: 1; }

/* ── Skeleton loader ─────────────────────────────────────────────────────── */

.skeleton-card {
  background: #fff; border-radius: 0.75rem; border: 1px solid #e5e7eb;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  padding: 1rem; display: flex; flex-direction: column; gap: 0.75rem;
  animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
.sk-bar { background: #e5e7eb; border-radius: 0.25rem; }
.sk-bar.light { background: #f3f4f6; }
.sk-circle { background: #e5e7eb; border-radius: 50%; }

/* ── Card animations ─────────────────────────────────────────────────────── */

@keyframes card-fade-out {
  0%   { opacity: 1; transform: scale(1); max-height: 400px; margin-bottom: 0.75rem; }
  60%  { opacity: 0; transform: scale(0.96) translateY(-4px); }
  100% { opacity: 0; max-height: 0; margin-bottom: 0; padding: 0; overflow: hidden; }
}
.card-fade-out { animation: card-fade-out 0.35s ease-out forwards; pointer-events: none; }

@keyframes card-highlight {
  0%   { box-shadow: 0 0 0 3px #fbbf24, 0 1px 3px rgba(0,0,0,.08); }
  60%  { box-shadow: 0 0 0 3px #fbbf24, 0 1px 3px rgba(0,0,0,.08); }
  100% { box-shadow: 0 1px 3px rgba(0,0,0,.08); }
}
.card-highlight { animation: card-highlight 2.5s ease-out forwards; }

/* ── Login page ──────────────────────────────────────────────────────────── */

.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: linear-gradient(135deg, #f8fafc 0%, #eff6ff 100%);
}
.login-card {
  width: 100%;
  max-width: 24rem;
  background: #fff;
  border-radius: 1rem;
  box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);
  padding: 2.5rem;
}
.login-logo-box {
  width: 2.5rem; height: 2.5rem; border-radius: 0.5rem;
  background: #2563eb; display: flex; align-items: center; justify-content: center;
}
.login-title { font-size: 1.5rem; font-weight: 700; color: #111827; letter-spacing: -0.01em; }
.login-sub { font-size: 0.875rem; color: #6b7280; line-height: 1.6; }
.login-error {
  padding: 0.65rem 0.85rem; background: #fef2f2; border: 1px solid #fecaca;
  color: #b91c1c; border-radius: 0.5rem; font-size: 0.875rem; font-weight: 500;
}

/* ── Settings page ───────────────────────────────────────────────────────── */

.settings-shell { min-height: 100vh; background: #f8fafc; display: flex; flex-direction: column; }
.settings-content { max-width: 64rem; margin: 0 auto; width: 100%; padding: 2rem 1.5rem; }
.settings-title { font-size: 1.75rem; font-weight: 700; color: #111827; letter-spacing: -0.01em; }
.settings-sub { font-size: 0.875rem; color: #6b7280; margin-top: 0.25rem; }

.settings-nav {
  display: flex; flex-direction: column; gap: 0.25rem;
  width: 12rem; background: #fff; border-radius: 1rem; border: 1px solid #e5e7eb;
  padding: 0.5rem; position: sticky; top: 5rem; flex-shrink: 0;
}
.settings-nav button {
  text-align: left; padding: 0.5rem 0.75rem; border-radius: 0.75rem;
  font-size: 0.875rem; font-weight: 500; color: #4b5563; background: none; border: none;
}
.settings-nav button:hover { background: #f3f4f6; }
.settings-nav button.active { background: #eff6ff; color: #1d4ed8; font-weight: 600; }

.settings-panel { flex: 1 1 auto; background: #fff; border-radius: 1rem; border: 1px solid #e5e7eb; padding: 2rem; min-width: 0; }

.settings-table { width: 100%; font-size: 0.875rem; border-collapse: collapse; }
.settings-table thead { background: #f9fafb; border-bottom: 1px solid #e5e7eb; }
.settings-table th {
  text-align: left; font-size: 0.7rem; font-weight: 600; color: #6b7280;
  text-transform: uppercase; letter-spacing: 0.04em; padding: 0.75rem 1rem;
}
.settings-table td { padding: 0.75rem 1rem; border-bottom: 1px solid #f3f4f6; vertical-align: middle; }
.settings-table tbody tr:hover { background: #f9fafb; }
.settings-table tr.inactive { opacity: 0.5; }

.settings-add-box { padding: 1rem; background: #f9fafb; border-radius: 0.75rem; border: 1px solid #e5e7eb; }

.toggle-switch {
  width: 2.5rem; height: 1.25rem; border-radius: 999px; position: relative;
  background: #e5e7eb; border: none; transition: background 0.15s;
}
.toggle-switch.on { background: #3b82f6; }
.toggle-switch .knob {
  position: absolute; top: 2px; left: 2px; width: 1rem; height: 1rem;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,0.2);
  transition: left 0.15s;
}
.toggle-switch.on .knob { left: 1.3rem; }

.toast-success {
  position: fixed; bottom: 1.25rem; right: 1.25rem; z-index: 1050;
  background: #16a34a; color: #fff; font-size: 0.875rem; font-weight: 600;
  padding: 0.65rem 1rem; border-radius: 0.75rem; box-shadow: 0 10px 15px -3px rgba(0,0,0,0.2);
}

.color-swatch {
  display: inline-block; width: 0.75rem; height: 0.75rem; border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.1); flex-shrink: 0;
}

.code-pill { background: #f3f4f6; color: #4b5563; font-size: 0.75rem; padding: 0.1rem 0.4rem; border-radius: 0.25rem; font-family: monospace; }
.system-pill { margin-left: 0.4rem; font-size: 0.625rem; background: #e5e7eb; color: #6b7280; padding: 0.1rem 0.4rem; border-radius: 999px; font-weight: 600; }
.fixed-pill { font-size: 0.75rem; background: #f3f4f6; color: #9ca3af; padding: 0.1rem 0.5rem; border-radius: 999px; }
.quadrant-pill { font-size: 0.75rem; background: #eff6ff; color: #1d4ed8; border: 1px solid #dbeafe; padding: 0.1rem 0.5rem; border-radius: 999px; font-weight: 600; }
.delete-icon-btn { background: none; border: none; color: #d1d5db; font-size: 1rem; line-height: 1; }
.delete-icon-btn:hover { color: #ef4444; }

.page-loader {
  display: flex; align-items: center; justify-content: center; height: 100vh; background: #f9fafb;
}
