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

:root {
  --bg: #292930;
  --surface: #111118;
  --surface2: #16161f;
  --border: #1e1e2e;
  --border2: #2a2a3e;
  --accent: #6c63ff;
  --accent2: #a78bfa;
  --accent-glow: rgba(108,99,255,0.2);
  --text: #e8e8f0;
  --text2: #9090a8;
  --text3: #5a5a72;
  --danger: #ff4757;
  --success: #00d68f;
  --warn: #ffaa00;
  --info: #00b4d8;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --transition: 0.2s cubic-bezier(0.4,0,0.2,1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
}
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

/* AUTH */
.auth-wrapper {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 30% 50%, rgba(108,99,255,0.15) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 20%, rgba(167,139,250,0.1) 0%, transparent 50%), var(--bg);
}
.auth-card {
  width: 100%; max-width: 420px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 20px; padding: 48px 40px;
  box-shadow: var(--shadow);
}
.auth-logo { text-align: center; margin-bottom: 32px; }
.auth-logo .logo-icon {
  width: 52px; height: 52px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 14px; display: inline-flex; align-items: center; justify-content: center;
  font-size: 24px; margin-bottom: 12px;
}
.auth-logo h1 {
  font-family: 'Syne', sans-serif; font-size: 26px; font-weight: 800;
  background: linear-gradient(135deg, #fff, var(--accent2));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.auth-logo p { color: var(--text2); font-size: 13px; margin-top: 4px; }
.auth-tabs {
  display: flex; gap: 4px; background: var(--surface2);
  border-radius: var(--radius-sm); padding: 4px; margin-bottom: 28px;
}
.auth-tab {
  flex: 1; padding: 8px; text-align: center; font-size: 13px; font-weight: 500;
  border-radius: 6px; cursor: pointer; color: var(--text2); transition: var(--transition);
  border: none; background: none;
}
.auth-tab.active { background: var(--accent); color: #fff; }

/* FORMS */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block; font-size: 12px; font-weight: 500; color: var(--text2);
  margin-bottom: 6px; letter-spacing: 0.5px; text-transform: uppercase;
}
.form-control {
  width: 100%; padding: 11px 14px; background: var(--surface2);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); font-family: 'DM Sans', sans-serif; font-size: 14px;
  transition: var(--transition); outline: none;
}
.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.form-control::placeholder { color: var(--text3); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px; border-radius: var(--radius-sm); font-size: 14px;
  font-weight: 500; cursor: pointer; transition: var(--transition);
  border: none; font-family: 'DM Sans', sans-serif; white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #5a52e0; transform: translateY(-1px); box-shadow: 0 4px 16px var(--accent-glow); }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--border2); background: var(--border); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #e63946; }
.btn-ghost { background: transparent; color: var(--text2); }
.btn-ghost:hover { background: var(--surface2); color: var(--text); }
.btn-full { width: 100%; }
.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* LAYOUT */
#app { display: none; min-height: 100vh; }
.layout { display: flex; min-height: 100vh; }

/* SIDEBAR */
.sidebar {
  width: 240px; flex-shrink: 0; background: var(--surface);
  border-right: 1px solid var(--border); display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 100;
}
.sidebar-logo {
  padding: 20px 20px 16px; display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--border);
}
.logo-mark {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 9px; display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}
.sidebar-logo span {
  font-family: 'Syne', sans-serif; font-size: 17px; font-weight: 800;
  background: linear-gradient(135deg, #fff, var(--accent2));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.sidebar-nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.nav-section { margin-bottom: 20px; }
.nav-label { font-size: 10px; font-weight: 600; color: var(--text3); letter-spacing: 1px; text-transform: uppercase; padding: 0 10px; margin-bottom: 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px;
  border-radius: var(--radius-sm); color: var(--text2); cursor: pointer;
  transition: var(--transition); font-size: 13.5px; font-weight: 400;
  border: none; background: none; width: 100%; text-align: left;
}
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active { background: var(--accent-glow); color: var(--accent2); font-weight: 500; }
.nav-item .nav-icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }
.nav-badge {
  margin-left: auto; background: var(--accent); color: #fff;
  font-size: 10px; font-weight: 600; padding: 2px 6px; border-radius: 10px; min-width: 20px; text-align: center;
}
.sidebar-footer { padding: 12px 10px; border-top: 1px solid var(--border); }
.user-card {
  display: flex; align-items: center; gap: 10px; padding: 10px;
  border-radius: var(--radius-sm); background: var(--surface2); cursor: pointer; transition: var(--transition);
}
.user-card:hover { background: var(--border); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff; flex-shrink: 0; text-transform: uppercase;
}
.avatar.lg { width: 44px; height: 44px; font-size: 18px; }
.user-info { flex: 1; overflow: hidden; }
.user-name { font-size: 13px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: var(--text2); }
.logout-btn { color: var(--text3); font-size: 14px; cursor: pointer; padding: 4px; border-radius: 4px; transition: var(--transition); border: none; background: none; }
.logout-btn:hover { color: var(--danger); }

/* MAIN */
.main { flex: 1; margin-left: 240px; display: flex; flex-direction: column; }
.topbar {
  height: 60px; padding: 0 28px; background: var(--surface);
  border-bottom: 1px solid var(--border); display: flex; align-items: center;
  justify-content: space-between; position: sticky; top: 0; z-index: 50;
}
.topbar-title { font-family: 'Syne', sans-serif; font-size: 18px; font-weight: 700; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.page { padding: 28px; flex: 1; }
.page-hidden { display: none !important; }

/* CARDS */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-title { font-family: 'Syne', sans-serif; font-size: 15px; font-weight: 700; }

/* STATS */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; position: relative; overflow: hidden; transition: var(--transition);
}
.stat-card:hover { border-color: var(--border2); transform: translateY(-2px); }
.stat-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--c, var(--accent)); }
.stat-num { font-family: 'Syne', sans-serif; font-size: 32px; font-weight: 800; line-height: 1; margin-bottom: 4px; }
.stat-label { font-size: 12px; color: var(--text2); }
.stat-icon { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-size: 26px; opacity: 0.1; }
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* BADGE */
.badge {
  display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 20px;
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px;
}
.badge-todo { background: rgba(108,99,255,0.15); color: #6c63ff; }
.badge-in_progress { background: rgba(255,170,0,0.15); color: #ffaa00; }
.badge-review { background: rgba(0,180,216,0.15); color: #00b4d8; }
.badge-done { background: rgba(0,214,143,0.15); color: #00d68f; }
.badge-low { background: rgba(0,214,143,0.15); color: #00d68f; }
.badge-medium { background: rgba(0,180,216,0.15); color: #00b4d8; }
.badge-high { background: rgba(255,170,0,0.15); color: #ffaa00; }
.badge-urgent { background: rgba(255,71,87,0.15); color: #ff4757; }
.badge-admin { background: rgba(108,99,255,0.15); color: var(--accent2); }
.badge-member { background: rgba(144,144,168,0.1); color: var(--text2); }

/* TASK LIST */
.task-list { display: flex; flex-direction: column; gap: 8px; }
.task-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer; transition: var(--transition);
}
.task-item:hover { border-color: var(--border2); background: var(--border); }
.task-status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.task-item-title { flex: 1; font-size: 13.5px; font-weight: 500; }
.task-item-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.overdue-tag { color: var(--danger); font-size: 11px; font-weight: 600; }

/* PROJECTS GRID */
.projects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.project-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; cursor: pointer; transition: var(--transition);
}
.project-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 8px 32px var(--accent-glow); }
.project-card-name { font-family: 'Syne', sans-serif; font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.project-card-desc { font-size: 13px; color: var(--text2); margin-bottom: 14px; min-height: 36px; }
.project-progress { height: 4px; background: var(--border); border-radius: 2px; margin-bottom: 12px; overflow: hidden; }
.project-progress-bar { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); border-radius: 2px; transition: width 0.6s ease; }
.project-card-footer { display: flex; align-items: center; justify-content: space-between; }
.project-stats { display: flex; gap: 12px; font-size: 12px; color: var(--text2); }

/* KANBAN */
.kanban { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; align-items: start; }
.kanban-col { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.kanban-col-header {
  padding: 12px 14px; display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border); border-top: 3px solid var(--c, var(--accent));
}
.kanban-col-title { font-size: 13px; font-weight: 600; }
.kanban-count { background: var(--surface2); color: var(--text2); font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 10px; }
.kanban-tasks { padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.kanban-task {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px; cursor: pointer; transition: var(--transition);
}
.kanban-task:hover { border-color: var(--accent); }
.kanban-task-title { font-size: 13px; font-weight: 500; margin-bottom: 8px; }
.kanban-task-footer { display: flex; align-items: center; justify-content: space-between; }
.mini-avatar {
  width: 22px; height: 22px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700; color: #fff; text-transform: uppercase;
}

/* FILTERS */
.filters { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }
.filter-select {
  background: var(--surface2); border: 1px solid var(--border); color: var(--text);
  padding: 7px 12px; border-radius: var(--radius-sm); font-size: 13px; cursor: pointer;
  outline: none; transition: var(--transition); font-family: 'DM Sans', sans-serif;
}
.filter-select:focus { border-color: var(--accent); }
.search-input {
  flex: 1; max-width: 280px; padding: 7px 12px; background: var(--surface2);
  border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text);
  font-size: 13px; outline: none; font-family: 'DM Sans', sans-serif; transition: var(--transition);
}
.search-input:focus { border-color: var(--accent); }
.search-input::placeholder { color: var(--text3); }

/* MODAL */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 20px;
  animation: fadeIn 0.15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface); border: 1px solid var(--border2); border-radius: 16px;
  width: 100%; max-width: 500px; max-height: 90vh; overflow-y: auto;
  box-shadow: 0 24px 64px rgba(0,0,0,0.6); animation: slideUp 0.2s ease;
}
.modal.modal-lg { max-width: 720px; }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--border); }
.modal-title { font-family: 'Syne', sans-serif; font-size: 17px; font-weight: 700; }
.modal-close { color: var(--text3); cursor: pointer; font-size: 20px; border: none; background: none; transition: var(--transition); padding: 4px; }
.modal-close:hover { color: var(--danger); }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* TASK DETAIL */
.task-detail-grid { display: grid; grid-template-columns: 1fr 220px; gap: 20px; }
.task-meta-block { background: var(--surface2); border-radius: var(--radius-sm); padding: 14px; }
.task-meta-item { margin-bottom: 14px; }
.task-meta-item:last-child { margin-bottom: 0; }
.task-meta-label { font-size: 11px; color: var(--text3); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.task-meta-value { font-size: 13px; }
.comments-section { margin-top: 20px; }
.comment-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.comment-item { display: flex; gap: 10px; }
.comment-body { flex: 1; background: var(--surface2); border-radius: var(--radius-sm); padding: 10px 14px; }
.comment-user { font-size: 12px; font-weight: 600; color: var(--accent2); margin-bottom: 3px; }
.comment-text { font-size: 13px; }
.comment-time { font-size: 11px; color: var(--text3); margin-top: 4px; }
.comment-input-row { display: flex; gap: 8px; }

/* MEMBERS TABLE */
.members-table { width: 100%; border-collapse: collapse; }
.members-table th, .members-table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); }
.members-table th { font-size: 11px; color: var(--text3); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }
.members-table td { font-size: 13.5px; }
.members-table tr:last-child td { border-bottom: none; }

/* EMPTY */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text2); }
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.4; }
.empty-state h3 { font-family: 'Syne', sans-serif; font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.empty-state p { font-size: 13px; }

/* TOAST */
#toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--surface2); border: 1px solid var(--border2); border-radius: var(--radius-sm);
  padding: 12px 18px; display: flex; align-items: center; gap: 10px;
  box-shadow: var(--shadow); font-size: 13.5px; max-width: 320px;
  animation: slideInRight 0.3s ease; border-left: 3px solid var(--accent);
}
.toast.success { border-left-color: #00d68f; }
.toast.error { border-left-color: var(--danger); }
.toast.warn { border-left-color: var(--warn); }
@keyframes slideInRight { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* MISC */
.spinner { width: 20px; height: 20px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-screen { display: flex; align-items: center; justify-content: min-height: 200px; }
.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.flex { display: flex; } .flex-center { display: flex; align-items: center; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mb-16 { margin-bottom: 16px; }
.fw-600 { font-weight: 600; }
.back-btn { display: inline-flex; align-items: center; gap: 6px; color: var(--text2); cursor: pointer; font-size: 13px; margin-bottom: 12px; background: none; border: none; padding: 0; transition: var(--transition); }
.back-btn:hover { color: var(--accent2); }
.tab-bar { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.tab-btn { padding: 10px 18px; font-size: 13px; font-weight: 500; color: var(--text2); cursor: pointer; border-bottom: 2px solid transparent; transition: var(--transition); background: none; border-top: none; border-left: none; border-right: none; }
.tab-btn.active { color: var(--accent2); border-bottom-color: var(--accent); }
.tab-btn:hover:not(.active) { color: var(--text); }
.view-toggle { display: flex; background: var(--surface2); border-radius: var(--radius-sm); padding: 3px; }
.view-btn { padding: 5px 12px; border-radius: 5px; font-size: 12px; cursor: pointer; color: var(--text2); border: none; background: none; transition: var(--transition); }
.view-btn.active { background: var(--accent); color: #fff; }
.project-detail-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
