@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=DM+Sans:wght@300;400;500&display=swap');

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary: #00B4D8;
  --primary-light: rgba(0,180,216,0.12);
  --danger: #FF4D6D;
  --success: #22C55E;
  --warning: #F59E0B;
  --info: #3B82F6;
  --bg: #0F0E17;
  --surface: #1A1930;
  --surface2: #232240;
  --surface3: #2C2A50;
  --border: rgba(0, 180, 216, 0.18);
  --border2: rgba(255,255,255,0.06);
  --text: #FFFFFE;
  --muted: #A7A9BE;
}

body { background: var(--bg); font-family: 'DM Sans', sans-serif; color: var(--text); min-height: 100vh; font-size: 14px; }
h1,h2,h3,.stat-num { font-family: 'Syne', sans-serif; }
a { color: var(--primary); text-decoration: none; }

/* ── App Shell ── */
.app-shell { display: flex; height: 100vh; overflow: hidden; }
#app { height: 100vh; overflow: hidden; }

/* ── Sidebar ── */
.sidebar {
  width: 236px; min-width: 236px; background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 20px 12px; overflow-y: auto; scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }
.sidebar-top { flex: 1; }
.logo { font-family: 'Syne', sans-serif; font-size: 22px; font-weight: 800; color: var(--primary); padding: 4px 10px 20px; letter-spacing: -0.5px; }
.logo span { color: var(--text); }
.sidebar-section { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 1.5px; padding: 14px 10px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 9px; padding: 9px 10px;
  border-radius: 10px; cursor: pointer; font-size: 13px; color: var(--muted);
  transition: all 0.18s; border: none; background: none; width: 100%; text-align: left;
}
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active { background: var(--primary-light); color: var(--primary); font-weight: 500; }
.ni { font-size: 15px; width: 18px; flex-shrink: 0; }
.sidebar-bottom { padding-top: 12px; border-top: 1px solid var(--border2); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; cursor: pointer; transition: background 0.18s; }
.user-chip:hover { background: var(--surface2); }
.user-name { font-size: 13px; font-weight: 500; }
.user-role { font-size: 11px; color: var(--muted); text-transform: capitalize; }

/* ── Main Area ── */
.main-area { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.page-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 24px; border-bottom: 1px solid var(--border2); flex-shrink: 0; }
.page-title { font-size: 20px; font-weight: 700; }
.page-content { flex: 1; overflow-y: auto; padding: 20px 24px; scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
.page-content::-webkit-scrollbar { width: 4px; }
.page-content::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.page-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; margin-top: 4px; }
.section-title { font-size: 15px; font-weight: 600; }

/* ── Login ── */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); padding: 20px; }
.login-card { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 36px; width: 100%; max-width: 400px; }
.login-logo { font-family: 'Syne', sans-serif; font-size: 28px; font-weight: 800; color: var(--primary); text-align: center; margin-bottom: 6px; }
.login-logo span { color: var(--text); }
.login-sub { text-align: center; color: var(--muted); font-size: 14px; margin-bottom: 24px; }
.login-demo { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border2); }
.demo-title { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.demo-accounts { display: flex; gap: 8px; }
.demo-btn { flex: 1; padding: 7px; border-radius: 8px; background: var(--surface2); border: 1px solid var(--border); color: var(--muted); font-size: 12px; cursor: pointer; transition: all 0.18s; }
.demo-btn:hover { color: var(--text); border-color: var(--primary); }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 10px; border: none; cursor: pointer; font-size: 14px; font-weight: 500; font-family: 'DM Sans', sans-serif; transition: all 0.18s; white-space: nowrap; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: #0096B4; transform: translateY(-1px); }
.btn-ghost { background: var(--surface); color: var(--muted); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); background: var(--surface2); }
.btn-danger { background: rgba(255,77,109,0.15); color: var(--danger); border: 1px solid rgba(255,77,109,0.25); }
.btn-danger:hover { background: rgba(255,77,109,0.25); }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 8px; }
.btn.recording { background: var(--danger) !important; border-color: var(--danger) !important; color: #fff !important; animation: pulse 1s infinite; }
.icon-btn { background: none; border: none; cursor: pointer; font-size: 15px; padding: 4px 6px; border-radius: 6px; transition: background 0.15s; color: var(--muted); }
.icon-btn:hover { background: var(--surface2); }

/* ── Forms ── */
.form-group { margin-bottom: 14px; }
.form-label { font-size: 11px; color: var(--muted); margin-bottom: 5px; display: block; text-transform: uppercase; letter-spacing: 0.6px; }
.form-input, .form-select, .form-textarea {
  width: 100%; background: var(--surface2); border: 1px solid var(--border); border-radius: 10px;
  color: var(--text); font-family: 'DM Sans', sans-serif; font-size: 14px; padding: 9px 13px; outline: none; transition: border 0.18s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--primary); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-select option { background: var(--surface2); }
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; min-width: 0; }

/* ── Cards ── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; cursor: pointer; transition: all 0.2s; }
.card:hover { border-color: var(--primary); transform: translateY(-2px); }
.card-accent { height: 4px; }
.card-body { padding: 14px 16px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.panel-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; margin-bottom: 10px; }
.project-mini, .team-mini { cursor: pointer; transition: all 0.18s; }
.project-mini:hover, .team-mini:hover { border-color: var(--primary); }

/* ── Stats ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.stat-num { font-size: 24px; font-weight: 700; }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 2px; }
.s-purple .stat-num { color: var(--primary); }
.s-green .stat-num { color: var(--success); }
.s-blue .stat-num { color: var(--info); }
.s-red .stat-num { color: var(--danger); }
.s-amber .stat-num { color: var(--warning); }

/* ── Dashboard ── */
.dash-grid { display: flex; gap: 20px; }
.dash-col-wide { flex: 1; min-width: 0; }
.dash-col-narrow { width: 260px; min-width: 260px; }

/* ── Task Rows ── */
.task-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; cursor: pointer; transition: all 0.18s;
}
.task-row:hover { border-color: var(--primary); }
.task-row-left { display: flex; align-items: flex-start; gap: 10px; flex: 1; min-width: 0; }
.task-row-info { flex: 1; min-width: 0; }
.task-row-title { font-size: 14px; font-weight: 500; margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-row-meta { display: flex; gap: 6px; flex-wrap: wrap; }
.task-row-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.striked { text-decoration: line-through; color: var(--muted) !important; }
.meta-chip { font-size: 11px; padding: 2px 8px; border-radius: 20px; background: var(--surface2); color: var(--muted); }
.check-btn { width: 18px; height: 18px; border-radius: 5px; border: 2px solid var(--border); cursor: pointer; flex-shrink: 0; margin-top: 2px; display: flex; align-items: center; justify-content: center; background: none; color: #fff; font-size: 10px; transition: all 0.18s; }
.check-btn.checked { background: var(--success); border-color: var(--success); }

/* ── Kanban ── */
.kanban-board { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 12px; min-height: 400px; }
.kanban-col { min-width: 230px; flex: 1; background: var(--surface2); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.kanban-col-header { display: flex; align-items: center; justify-content: space-between; font-size: 13px; font-weight: 600; padding-bottom: 8px; border-bottom: 1px solid var(--border2); margin-bottom: 4px; }
.col-count { background: var(--surface3); color: var(--muted); font-size: 11px; padding: 2px 8px; border-radius: 20px; }
.kanban-tasks { display: flex; flex-direction: column; gap: 8px; flex: 1; }
.kanban-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; cursor: pointer; transition: all 0.18s; position: relative; }
.kanban-card:hover { border-color: var(--primary); transform: translateY(-1px); }
.kc-priority { position: absolute; left: 0; top: 0; bottom: 0; width: 3px; border-radius: 3px 0 0 3px; }
.kc-priority.p-high { background: var(--danger); }
.kc-priority.p-med { background: var(--warning); }
.kc-priority.p-low { background: var(--success); }
.kc-title { font-size: 13px; font-weight: 500; margin-bottom: 6px; line-height: 1.4; padding-left: 6px; }

/* ── Members ── */
.member-grid { display: flex; flex-direction: column; gap: 8px; }
.member-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }

/* ── Table ── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { padding: 12px 16px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.8px; color: var(--muted); text-align: left; border-bottom: 1px solid var(--border); font-weight: 500; }
.data-table td { padding: 12px 16px; border-bottom: 1px solid var(--border2); font-size: 14px; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--surface2); }

/* ── Modal ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.75); display: none; align-items: center; justify-content: center; z-index: 300; backdrop-filter: blur(6px); padding: 20px; }
.modal-overlay.open { display: flex; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; width: 520px; max-width: 100%; padding: 24px; max-height: 90vh; overflow-y: auto; scrollbar-width: thin; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-header h3 { font-family: 'Syne', sans-serif; font-size: 17px; font-weight: 700; }
.close-btn { background: var(--surface2); border: none; color: var(--muted); width: 30px; height: 30px; border-radius: 7px; cursor: pointer; font-size: 14px; transition: all 0.15s; }
.close-btn:hover { background: rgba(255,77,109,0.15); color: var(--danger); }

/* ── Toast ── */
.toast { position: fixed; bottom: 24px; right: 24px; padding: 12px 18px; border-radius: 12px; font-size: 14px; font-weight: 500; background: var(--surface); border: 1px solid var(--border); color: var(--text); z-index: 9999; transform: translateY(20px); opacity: 0; transition: all 0.3s; max-width: 320px; box-shadow: 0 8px 32px rgba(0,0,0,0.4); }
.toast.show { transform: translateY(0); opacity: 1; }
.toast-success { border-color: rgba(34,197,94,0.4); }
.toast-error { border-color: rgba(255,77,109,0.4); }
.toast-info { border-color: rgba(108,99,255,0.4); }

/* ── Confirm ── */
.confirm-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.7); display: flex; align-items: center; justify-content: center; z-index: 500; backdrop-filter: blur(4px); }
.confirm-box { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 24px; width: 320px; font-size: 14px; line-height: 1.6; }

/* ── Empty State ── */
.empty-state { text-align: center; padding: 40px 20px; color: var(--muted); font-size: 14px; }

/* ── Animations ── */
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.7} }
@keyframes fadeIn { from{opacity:0;transform:translateY(6px)} to{opacity:1;transform:translateY(0)} }
.task-row, .card, .panel-card { animation: fadeIn 0.25s ease; }

/* ══════════════════════════════════════
   RESPONSIVE — Tablet (≤900px)
══════════════════════════════════════ */
@media (max-width: 900px) {
  /* Sidebar collapses to icon-only */
  .sidebar { width: 56px; min-width: 56px; padding: 16px 8px; }
  .sidebar .logo, .sidebar .sidebar-section,
  .nav-item span:last-child, .user-name, .user-role { display: none; }
  .nav-item { justify-content: center; padding: 10px 0; border-radius: 10px; }
  .sidebar-bottom .user-chip { justify-content: center; padding: 6px; }
  /* Grid layouts */
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .card-grid  { grid-template-columns: repeat(2, 1fr); }
  /* Dashboard 2-col → 1-col */
  .page-content > div[style*="grid-template-columns:1fr 1fr"] { grid-template-columns: 1fr !important; }
}

/* ══════════════════════════════════════
   RESPONSIVE — Mobile (≤600px)
══════════════════════════════════════ */
@media (max-width: 600px) {
  /* Sidebar becomes bottom nav on mobile */
  .app-shell   { flex-direction: column-reverse; }
  .sidebar     {
    width: 100% !important; min-width: 100% !important;
    height: 60px; flex-direction: row;
    padding: 0 8px; border-right: none;
    border-top: 1px solid var(--border2);
    overflow: hidden;
  }
  .sidebar-top { display: flex; flex-direction: row; align-items: center; gap: 4px; flex: 1; padding: 0; }
  .sidebar .logo, .sidebar .sidebar-section,
  .nav-item span:last-child { display: none !important; }
  .sidebar-bottom { display: flex !important; align-items: center; padding: 0 4px; }
  .sidebar-bottom .nav-item { display: flex !important; }
  .sidebar-bottom .user-chip { display: none !important; }
  .nav-item { padding: 8px 12px; border-radius: 8px; flex-direction: column; font-size: 10px; min-width: 44px; }
  .ni { font-size: 18px !important; width: auto !important; }
  /* Scrollable main area */
  .main-area   { height: calc(100vh - 60px); overflow: hidden; }
  .page-content { padding: 12px 14px; }
  .page-header  { padding: 12px 14px; }
  .page-title   { font-size: 16px; }
  /* Cards */
  .card-grid    { grid-template-columns: 1fr; gap: 10px; }
  .stats-grid   { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stat-card    { padding: 12px; }
  .stat-num     { font-size: 24px; }
  /* Task rows */
  .task-row     { flex-wrap: wrap; gap: 8px; padding: 10px 12px; }
  .task-row-right { flex-wrap: wrap; gap: 4px; }
  /* Kanban — vertical scroll */
  .kanban-board { flex-direction: row; overflow-x: auto; padding-bottom: 12px; gap: 12px; }
  .kanban-col   { min-width: 240px; }
  /* Toolbar wraps */
  .page-toolbar { flex-wrap: wrap; gap: 8px; }
  .page-toolbar .form-select,
  .page-toolbar .form-input { flex: 1; min-width: 120px; }
  /* Modal full-screen on mobile */
  .modal-overlay { align-items: flex-end; }
  .modal {
    border-radius: 20px 20px 0 0 !important;
    max-height: 90vh; overflow-y: auto;
    width: 100% !important; max-width: 100% !important;
    margin: 0 !important;
  }
  /* Login card */
  .login-card { padding: 24px 18px; border-radius: 16px; }
  .login-logo { font-size: 22px; }
  /* Forms */
  .form-row { flex-direction: column; gap: 0; }
  /* Table overflow */
  .data-table { font-size: 12px; }
  .data-table th:nth-child(4),
  .data-table td:nth-child(4) { display: none; }
  /* Member grid */
  .member-grid { grid-template-columns: 1fr; }
  /* Breadcrumb wrap */
  .page-content > div[style*="display:flex;align-items:center;gap:8px"] { flex-wrap: wrap; }
}

/* ── Project Chat Panel ── */
#project-chat-messages::-webkit-scrollbar { width: 3px; }
#project-chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
#task-chat-messages::-webkit-scrollbar { width: 3px; }
#task-chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Hover to show delete button on chat messages */
.del-msg-btn { opacity: 0; transition: opacity 0.15s; }
div:hover > .del-msg-btn { opacity: 1; display: block !important; }

@media (max-width: 900px) {
  /* Project detail: stack chat below kanban on tablet */
  .page-content > div[style*="grid-template-columns:1fr 320px"] {
    grid-template-columns: 1fr !important;
  }
  #project-chat-wrap { height: 360px; position: static; }
}

@media (max-width: 600px) {
  #project-chat-wrap { height: 300px; }
}

/* ── Stat card clickable hover ── */
.stat-card[onclick] { transition: transform 0.15s, box-shadow 0.15s; }
.stat-card[onclick]:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,0.3); }
.stat-card[onclick]:active { transform: translateY(-1px); }

/* ══════════════════════════════════════
   LIGHT THEME
══════════════════════════════════════ */
:root.light-theme {
  --bg:       #F0F2F8;
  --surface:  #FFFFFF;
  --surface2: #E8ECF4;
  --surface3: #DDE1ED;
  --border:   rgba(0,0,0,0.10);
  --border2:  rgba(0,0,0,0.07);
  --text:     #1A1A2E;
  --muted:    #6B7280;
  --primary:  #00B4D8;
  --success:  #16A34A;
  --warning:  #D97706;
  --danger:   #DC2626;
}

/* Sidebar light */
:root.light-theme .sidebar {
  background: #FFFFFF;
  border-right: 1px solid rgba(0,0,0,0.08);
}
:root.light-theme .nav-item:hover,
:root.light-theme .nav-item.active { background: rgba(0,180,216,0.10); }
:root.light-theme .logo span       { color: #00B4D8; }

/* Cards light */
:root.light-theme .card,
:root.light-theme .panel-card,
:root.light-theme .stat-card      { box-shadow: 0 1px 6px rgba(0,0,0,0.08); }
:root.light-theme .kanban-col      { background: #E8ECF4; }
:root.light-theme .kanban-card     { background: #FFFFFF; box-shadow: 0 1px 4px rgba(0,0,0,0.08); }

/* Input light */
:root.light-theme .form-input,
:root.light-theme .form-select,
:root.light-theme .form-textarea   { background: #F0F2F8; border-color: rgba(0,0,0,0.12); color: #1A1A2E; }
:root.light-theme .form-input:focus{ border-color: #00B4D8; background: #fff; }

/* Modal light */
:root.light-theme .modal-overlay   { background: rgba(0,0,0,0.35); }
:root.light-theme .modal           { background: #FFFFFF; }

/* Task row light */
:root.light-theme .task-row        { background: #FFFFFF; border-color: rgba(0,0,0,0.06); }
:root.light-theme .task-row:hover  { background: #F5F7FC; }

/* Page header light */
:root.light-theme .page-header     { background: #F0F2F8; border-bottom: 1px solid rgba(0,0,0,0.07); }
:root.light-theme .main-area       { background: #F0F2F8; }

/* Notification panel light */
:root.light-theme #notif-panel     { background: #FFFFFF; }

/* Data table light */
:root.light-theme .data-table th   { background: #E8ECF4; }
:root.light-theme .data-table tr:hover td { background: #F0F2F8; }

/* Login light */
:root.light-theme .login-page      { background: #F0F2F8; }
:root.light-theme .login-card      { background: #FFFFFF; box-shadow: 0 8px 32px rgba(0,0,0,0.10); }

/* Scrollbar light */
:root.light-theme ::-webkit-scrollbar-track { background: #E8ECF4; }
:root.light-theme ::-webkit-scrollbar-thumb { background: #C4C9D8; }