/* ============================================
   Pi-Office – Complete Stylesheet v2
   ============================================ */

/* --- CSS Variables / Theming --- */
:root, [data-theme="dark"] {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --bg-card: #1e293b;
  --bg-hover: #334155;
  --bg-input: #0f172a;
  --bg-modal: #1e293b;

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-inverse: #0f172a;

  --accent: #22d3ee;
  --accent-hover: #06b6d4;
  --accent-bg: rgba(34, 211, 238, 0.1);
  --success: #22c55e;
  --success-bg: rgba(34, 197, 94, 0.1);
  --warning: #eab308;
  --warning-bg: rgba(234, 179, 8, 0.1);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.1);
  --info: #3b82f6;

  --border: #334155;
  --border-light: #475569;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);

  --sidebar-bg: #0c1222;
  --sidebar-hover: #1e293b;

  --proposed: #8b5cf6;
  --approved: #22c55e;
  --in_progress: #3b82f6;
  --review: #eab308;
  --done: #22c55e;
  --rejected: #ef4444;

  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 16px;
  --transition: 0.2s ease;
}

[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #e2e8f0;
  --bg-card: #ffffff;
  --bg-hover: #f1f5f9;
  --bg-input: #f8fafc;
  --bg-modal: #ffffff;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-inverse: #f1f5f9;

  --border: #e2e8f0;
  --border-light: #cbd5e1;

  --sidebar-bg: #0f172a;
  --sidebar-hover: #1e293b;

  --shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
}

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

html {
  font-size: 15px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

.screen { display: none; }
.screen.active { display: flex; }

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ============================================
   Login Screen
   ============================================ */
#login-screen {
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  width: 100vw;
  background: var(--bg-primary);
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(34, 211, 238, 0.05) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(139, 92, 246, 0.05) 0%, transparent 50%);
}

.login-container {
  width: 100%;
  max-width: 380px;
  margin: 20px;
  padding: 40px 32px;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.login-logo { text-align: center; margin-bottom: 32px; }
.logo-icon { width: 64px; height: 64px; margin: 0 auto 16px; }
.logo-icon svg { width: 100%; height: 100%; }

.login-logo h1 {
  font-size: 1.8rem; font-weight: 700;
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.login-subtitle { color: var(--text-muted); font-size: 0.85rem; margin-top: 4px; }

/* --- Forms --- */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block; font-size: 0.8rem; font-weight: 500;
  color: var(--text-secondary); margin-bottom: 6px;
  text-transform: uppercase; letter-spacing: 0.05em;
}

input[type="text"], input[type="password"], input[type="email"],
textarea, .select-input {
  width: 100%; padding: 10px 14px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-primary);
  font-family: inherit; font-size: 0.95rem;
  transition: border-color var(--transition); outline: none;
}
input:focus, textarea:focus, .select-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}
textarea { resize: vertical; min-height: 60px; }

.select-input {
  cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px;
}
.select-sm { padding: 6px 10px; font-size: 0.85rem; }

.password-wrapper { position: relative; }
.password-wrapper input { padding-right: 44px; }
.toggle-password {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 4px;
  display: flex; align-items: center;
}
.toggle-password svg { width: 18px; height: 18px; }

/* --- Checkbox --- */
.checkbox-group { margin-top: -4px; }
.checkbox-label {
  display: flex; align-items: center; gap: 10px;
  cursor: pointer; font-size: 0.9rem; color: var(--text-secondary); user-select: none;
}
.checkbox-label input[type="checkbox"] { display: none; }
.checkmark {
  width: 18px; height: 18px; border: 2px solid var(--border);
  border-radius: 4px; transition: all var(--transition); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.checkbox-label input:checked + .checkmark { background: var(--accent); border-color: var(--accent); }
.checkbox-label input:checked + .checkmark::after {
  content: ''; display: block; width: 5px; height: 9px;
  border: solid var(--text-inverse); border-width: 0 2px 2px 0;
  transform: rotate(45deg) translateY(-1px);
}

/* --- Buttons --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px; border: none; border-radius: var(--radius-sm);
  font-family: inherit; font-size: 0.9rem; font-weight: 500;
  cursor: pointer; transition: all var(--transition); text-decoration: none; white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--text-inverse); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-secondary { background: var(--bg-tertiary); color: var(--text-primary); }
.btn-secondary:hover:not(:disabled) { background: var(--border-light); }
.btn-accent { background: linear-gradient(135deg, #8b5cf6, #a78bfa); color: white; }
.btn-accent:hover:not(:disabled) { filter: brightness(1.1); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover:not(:disabled) { filter: brightness(1.1); }
.btn-full { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-send { width: 42px; height: 42px; padding: 0; border-radius: 50%; flex-shrink: 0; }
.btn-send svg { width: 18px; height: 18px; }

.icon-btn {
  background: none; border: none; color: var(--text-secondary);
  cursor: pointer; padding: 6px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center; transition: all var(--transition);
}
.icon-btn:hover { color: var(--text-primary); background: var(--sidebar-hover); }
.icon-btn svg { width: 18px; height: 18px; }

/* --- Error --- */
.error-msg {
  background: var(--danger-bg); color: var(--danger);
  padding: 10px 14px; border-radius: var(--radius-sm);
  font-size: 0.85rem; margin-top: 12px; border: 1px solid rgba(239,68,68,0.2);
}

.btn-loader {
  width: 16px; height: 16px; border: 2px solid rgba(15,23,42,0.3);
  border-top-color: var(--text-inverse); border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================
   App Layout
   ============================================ */
#app-screen {
  flex-direction: row;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  position: relative;
}

/* --- Sidebar --- */
#sidebar {
  width: 240px;
  min-width: 240px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-header { padding: 20px 16px; border-bottom: 1px solid var(--border); }
.logo-small { display: flex; align-items: center; gap: 10px; }
.logo-small svg { width: 32px; height: 32px; }
.logo-small span {
  font-size: 1.1rem; font-weight: 700;
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}

.sidebar-nav {
  flex: 1; padding: 12px 8px;
  display: flex; flex-direction: column; gap: 4px;
}

.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  background: none; border: none; color: var(--text-secondary);
  font-family: inherit; font-size: 0.9rem; cursor: pointer;
  transition: all var(--transition); width: 100%; text-align: left; position: relative;
}
.nav-item:hover { background: var(--sidebar-hover); color: var(--text-primary); }
.nav-item.active { background: var(--accent-bg); color: var(--accent); }
.nav-item svg { width: 20px; height: 20px; flex-shrink: 0; }

.badge {
  background: var(--danger); color: white; font-size: 0.7rem;
  padding: 1px 6px; border-radius: 10px; margin-left: auto; font-weight: 600;
}

.sidebar-footer {
  padding: 12px 12px; border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.user-info { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; font-weight: 700; color: var(--text-inverse); flex-shrink: 0;
}
.user-details { display: flex; flex-direction: column; min-width: 0; }
.user-details span:first-child {
  font-size: 0.85rem; font-weight: 600; color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-role { font-size: 0.7rem; color: var(--text-muted); }

/* --- Mobile hamburger --- */
.mobile-toggle {
  display: none; position: fixed; top: 12px; left: 12px; z-index: 200;
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px; cursor: pointer;
  color: var(--text-primary); box-shadow: var(--shadow-sm);
}
.mobile-toggle svg { width: 22px; height: 22px; }
.sidebar-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 99;
}

/* --- Main Content --- */
#content {
  flex: 1; display: flex; flex-direction: column;
  overflow: hidden; min-width: 0; position: relative;
}

.view { display: none; flex-direction: column; height: 100%; overflow: hidden; }
.view.active { display: flex; }

.view-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px; border-bottom: 1px solid var(--border);
  background: var(--bg-secondary); flex-shrink: 0; flex-wrap: wrap; gap: 12px;
}
.view-header h2 { font-size: 1.2rem; font-weight: 600; white-space: nowrap; }
.view-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ============================================
   Kanban Board – Responsive
   ============================================ */
.kanban-board {
  display: flex;
  gap: 16px;
  padding: 20px;
  overflow-x: auto;
  overflow-y: hidden;
  flex: 1;
  align-items: flex-start;
  /* Smooth horizontal scroll */
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}

.kanban-column {
  min-width: 260px;
  width: 260px;
  flex-shrink: 0;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  max-height: 100%;
  scroll-snap-align: start;
}

.column-header {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.column-header h3 { font-size: 0.85rem; font-weight: 600; flex: 1; white-space: nowrap; }
.column-count {
  background: var(--bg-tertiary); padding: 2px 8px; border-radius: 10px;
  font-size: 0.75rem; font-weight: 600; color: var(--text-muted); flex-shrink: 0;
}
.column-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.column-dot.proposed { background: var(--proposed); }
.column-dot.approved { background: var(--approved); }
.column-dot.in_progress { background: var(--in_progress); }
.column-dot.review { background: var(--review); }
.column-dot.done { background: var(--done); }

.column-cards {
  padding: 8px; flex: 1; overflow-y: auto; min-height: 80px;
}

/* --- Task Card --- */
.task-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 14px;
  margin-bottom: 8px; cursor: pointer;
  transition: all var(--transition); position: relative;
}
.task-card:hover {
  border-color: var(--accent); box-shadow: var(--shadow-sm); transform: translateY(-1px);
}
.task-card.dragging { opacity: 0.5; transform: rotate(2deg); }
.task-card-title { font-size: 0.88rem; font-weight: 600; margin-bottom: 6px; line-height: 1.4; }
.task-card-desc {
  font-size: 0.8rem; color: var(--text-secondary);
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 8px;
}
.task-card-footer { display: flex; align-items: center; justify-content: space-between; }
.task-priority {
  font-size: 0.7rem; padding: 2px 8px; border-radius: 4px;
  font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
}
.task-priority.low { background: var(--success-bg); color: var(--success); }
.task-priority.medium { background: var(--warning-bg); color: var(--warning); }
.task-priority.high { background: rgba(249,115,22,0.1); color: #f97316; }
.task-priority.critical { background: var(--danger-bg); color: var(--danger); }
.task-proposed-by { font-size: 0.7rem; color: var(--text-muted); display: flex; align-items: center; gap: 4px; }

.column-cards.drag-over {
  background: var(--accent-bg); border: 2px dashed var(--accent); border-radius: var(--radius-sm);
}

/* ============================================
   Chat View (Full page)
   ============================================ */
.chat-messages {
  flex: 1; overflow-y: auto; padding: 20px 24px;
  display: flex; flex-direction: column; gap: 12px;
}

.chat-msg {
  display: flex; gap: 10px; max-width: 85%;
  animation: fadeIn 0.3s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.chat-msg.publisher { align-self: flex-end; flex-direction: row-reverse; }
.chat-msg.ceo { align-self: flex-start; }

.chat-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700; flex-shrink: 0;
}
.chat-msg.ceo .chat-avatar { background: linear-gradient(135deg, #8b5cf6, #a78bfa); color: white; }
.chat-msg.publisher .chat-avatar { background: linear-gradient(135deg, var(--accent), #06b6d4); color: var(--text-inverse); }

.chat-bubble {
  padding: 10px 14px; border-radius: var(--radius);
  font-size: 0.9rem; line-height: 1.5; word-break: break-word;
}
.chat-msg.ceo .chat-bubble { background: var(--bg-tertiary); border-bottom-left-radius: 2px; }
.chat-msg.publisher .chat-bubble { background: var(--accent); color: var(--text-inverse); border-bottom-right-radius: 2px; }
.chat-bubble strong { font-weight: 600; }
.chat-bubble code {
  background: rgba(0,0,0,0.15); padding: 1px 5px; border-radius: 3px;
  font-family: 'JetBrains Mono', monospace; font-size: 0.85em;
}
.chat-bubble pre {
  background: rgba(0,0,0,0.2); padding: 8px 10px; border-radius: 6px;
  overflow-x: auto; margin: 6px 0; font-size: 0.85em;
}
.chat-bubble pre code { background: none; padding: 0; }
.chat-time { font-size: 0.65rem; color: var(--text-muted); margin-top: 4px; }
.chat-msg.ceo .chat-time { text-align: left; }
.chat-msg.publisher .chat-time { text-align: right; }

/* Typing indicator */
.typing-indicator {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 24px; color: var(--text-muted); font-size: 0.8rem;
}
.typing-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); animation: typingBounce 1.4s infinite;
}
.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(-4px); opacity: 1; }
}

/* Chat input */
.chat-input-area {
  display: flex; align-items: flex-end; gap: 10px;
  padding: 16px 24px; border-top: 1px solid var(--border); background: var(--bg-secondary);
  flex-shrink: 0;
}
.chat-input-area textarea {
  flex: 1; resize: none; max-height: 120px;
  padding: 10px 14px; border-radius: 20px; background: var(--bg-input);
}

/* ============================================
   Floating Chat Widget (AI Assistant)
   ============================================ */
.chat-fab {
  position: fixed; bottom: 24px; right: 24px; z-index: 500;
  width: 56px; height: 56px; border-radius: 50%;
  background: linear-gradient(135deg, #8b5cf6, #a78bfa);
  border: none; cursor: pointer; box-shadow: 0 4px 20px rgba(139,92,246,0.4);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.3s ease; color: white;
}
.chat-fab:hover { transform: scale(1.08); box-shadow: 0 6px 28px rgba(139,92,246,0.5); }
.chat-fab svg { width: 26px; height: 26px; }
.chat-fab.hidden { display: none; }
.chat-fab .fab-badge {
  position: absolute; top: -2px; right: -2px;
  background: var(--danger); color: white; font-size: 0.65rem;
  width: 20px; height: 20px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; border: 2px solid var(--bg-primary);
}
.chat-fab .fab-badge.hidden { display: none; }

/* Chat panel */
.chat-panel {
  position: fixed; bottom: 90px; right: 24px; z-index: 500;
  width: 380px; height: 520px;
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
  display: none; flex-direction: column; overflow: hidden;
  animation: slideUp 0.3s ease;
}
.chat-panel.open { display: flex; }
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

.chat-panel-header {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(139,92,246,0.1), rgba(34,211,238,0.05));
  flex-shrink: 0;
}
.chat-panel-header .panel-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, #8b5cf6, #a78bfa);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; flex-shrink: 0;
}
.chat-panel-header .panel-info { flex: 1; min-width: 0; }
.chat-panel-header .panel-info strong { font-size: 0.9rem; display: block; }
.chat-panel-header .panel-info small { font-size: 0.7rem; color: var(--text-muted); }
.chat-panel-header .panel-actions { display: flex; gap: 4px; }
.chat-panel-header .panel-actions button {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; padding: 4px; border-radius: 4px;
  display: flex; align-items: center; transition: all var(--transition);
}
.chat-panel-header .panel-actions button:hover { color: var(--text-primary); background: var(--bg-hover); }
.chat-panel-header .panel-actions button svg { width: 16px; height: 16px; }

.chat-panel-context {
  padding: 8px 16px; border-bottom: 1px solid var(--border);
  background: var(--bg-primary); flex-shrink: 0;
  display: flex; align-items: center; gap: 8px;
}
.chat-panel-context select {
  flex: 1; padding: 5px 8px; font-size: 0.8rem;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-primary);
  appearance: none; cursor: pointer;
}
.chat-panel-context label { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; }

.chat-panel-messages {
  flex: 1; overflow-y: auto; padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
}

.chat-panel-messages .chat-msg { max-width: 92%; }
.chat-panel-messages .chat-avatar { width: 26px; height: 26px; font-size: 0.65rem; }
.chat-panel-messages .chat-bubble { padding: 8px 12px; font-size: 0.85rem; }
.chat-panel-messages .chat-time { font-size: 0.6rem; }

.chat-panel-typing {
  padding: 6px 14px; display: none; align-items: center; gap: 6px;
  color: var(--text-muted); font-size: 0.75rem; flex-shrink: 0;
}
.chat-panel-typing.visible { display: flex; }

.chat-panel-input {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 12px 14px; border-top: 1px solid var(--border);
  background: var(--bg-secondary); flex-shrink: 0;
}
.chat-panel-input textarea {
  flex: 1; resize: none; max-height: 80px;
  padding: 8px 12px; border-radius: 18px;
  background: var(--bg-input); font-size: 0.85rem;
}
.chat-panel-input button {
  width: 36px; height: 36px; border-radius: 50%; border: none;
  background: var(--accent); color: var(--text-inverse);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: all var(--transition);
}
.chat-panel-input button:hover { background: var(--accent-hover); }
.chat-panel-input button svg { width: 16px; height: 16px; }

/* ============================================
   Activity Log
   ============================================ */
.activity-list { padding: 20px 24px; overflow-y: auto; flex: 1; }
.activity-item {
  display: flex; gap: 12px; padding: 12px 0;
  border-bottom: 1px solid var(--border); animation: fadeIn 0.2s ease;
}
.activity-icon {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; flex-shrink: 0; background: var(--bg-tertiary);
}
.activity-icon.login { background: var(--success-bg); }
.activity-icon.task { background: var(--accent-bg); }
.activity-icon.veto { background: var(--danger-bg); }
.activity-content { flex: 1; min-width: 0; }
.activity-text { font-size: 0.88rem; }
.activity-time { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }

/* ============================================
   Settings
   ============================================ */
.settings-container {
  padding: 24px; overflow-y: auto; flex: 1;
  display: flex; flex-direction: column; gap: 20px; max-width: 600px;
}
.settings-card {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
}
.settings-card h3 {
  font-size: 1rem; font-weight: 600; margin-bottom: 16px;
  padding-bottom: 10px; border-bottom: 1px solid var(--border);
}
.theme-selector { display: flex; gap: 10px; }
.theme-option {
  flex: 1; padding: 10px 16px; border: 2px solid var(--border);
  border-radius: var(--radius-sm); background: var(--bg-input);
  color: var(--text-primary); font-family: inherit; font-size: 0.9rem;
  cursor: pointer; transition: all var(--transition); text-align: center;
}
.theme-option.active { border-color: var(--accent); background: var(--accent-bg); }
.theme-option:hover:not(.active) { border-color: var(--border-light); }

/* ============================================
   Modals
   ============================================ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px); display: flex;
  align-items: center; justify-content: center;
  z-index: 1000; animation: fadeIn 0.2s ease; padding: 20px;
}
.modal {
  background: var(--bg-modal); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
  width: 100%; max-width: 480px; max-height: 90vh;
  display: flex; flex-direction: column;
}
.modal-wide { max-width: 700px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.modal-header h3 { font-size: 1.1rem; font-weight: 600; }
.modal-close {
  background: none; border: none; color: var(--text-muted);
  font-size: 1.5rem; cursor: pointer; padding: 0 4px;
  line-height: 1; transition: color var(--transition);
}
.modal-close:hover { color: var(--text-primary); }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 16px 20px; border-top: 1px solid var(--border); flex-shrink: 0;
}

/* --- Task Detail --- */
.task-detail-content { display: grid; grid-template-columns: 1fr; gap: 20px; }
@media (min-width: 640px) { .task-detail-content { grid-template-columns: 1fr 1fr; } }
.detail-row {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 10px; font-size: 0.9rem;
}
.detail-label { color: var(--text-muted); min-width: 120px; font-weight: 500; }
.detail-description {
  margin-top: 12px; padding: 12px;
  background: var(--bg-input); border-radius: var(--radius-sm);
  font-size: 0.88rem; line-height: 1.6; white-space: pre-wrap;
}
.task-detail-chat { display: flex; flex-direction: column; }
.task-detail-chat h4 { font-size: 0.9rem; margin-bottom: 10px; }
.detail-messages {
  flex: 1; overflow-y: auto; max-height: 300px;
  display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px;
}
.detail-chat-input { display: flex; gap: 8px; }
.detail-chat-input input { flex: 1; }

.ai-thinking { padding: 16px 0; }
.ai-result {
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px;
  font-size: 0.9rem; line-height: 1.6; white-space: pre-wrap;
  max-height: 300px; overflow-y: auto;
}

/* ============================================
   Responsive Breakpoints
   ============================================ */

/* Tablet */
@media (max-width: 1024px) {
  .kanban-column { min-width: 230px; width: 230px; }
  .chat-panel { width: 340px; height: 460px; }
}

/* Mobile */
@media (max-width: 768px) {
  .mobile-toggle { display: flex; }
  .sidebar-overlay.active { display: block; }

  #sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    transform: translateX(-100%); z-index: 200;
  }
  #sidebar.open { transform: translateX(0); }

  .view-header { padding: 12px 16px; padding-left: 56px; }
  .view-header h2 { font-size: 1rem; }
  .kanban-board { padding: 12px; gap: 12px; }
  .kanban-column { min-width: 220px; width: 220px; }
  .chat-messages { padding: 12px 16px; }
  .chat-input-area { padding: 12px 16px; }
  .activity-list { padding: 12px 16px; }
  .settings-container { padding: 16px; }

  .chat-panel {
    right: 8px; bottom: 80px; left: 8px;
    width: auto; height: 60vh;
  }
  .chat-fab { bottom: 16px; right: 16px; }
}

/* Small mobile */
@media (max-width: 480px) {
  .kanban-column { min-width: 85vw; width: 85vw; }
  .view-actions { width: 100%; }
  .view-actions .btn { flex: 1; font-size: 0.8rem; padding: 8px 12px; }
}

/* ============================================
   Toast Notifications
   ============================================ */
.toast {
  position: fixed; bottom: 20px; right: 20px;
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 20px;
  box-shadow: var(--shadow); z-index: 2000;
  display: flex; align-items: center; gap: 10px;
  font-size: 0.9rem; animation: slideUp 0.3s ease; max-width: 360px;
}
.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.info { border-left: 4px solid var(--info); }

/* When chat panel is open, move toast up */
.chat-panel.open ~ .toast { bottom: 620px; }
