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

:root {
  --bg: #0f0f14;
  --bg2: #16161e;
  --bg3: #1e1e2a;
  --bg4: #252535;
  --border: #2e2e42;
  --text: #e8e8f0;
  --text2: #8888aa;
  --text3: #55556a;
  --accent: #7c6af7;
  --accent2: #5b4fe0;
  --green: #22c55e;
  --yellow: #eab308;
  --orange: #f97316;
  --red: #ef4444;
  --blue: #3b82f6;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
}

body {
  font-family: 'Manrope', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  height: 100vh;
  overflow: hidden;
}

.page { display: none; height: 100vh; }
.page.active { display: flex; }

.login-bg {
  position: fixed; inset: 0;
  background: radial-gradient(ellipse at 20% 50%, rgba(124,106,247,0.15) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 20%, rgba(91,79,224,0.1) 0%, transparent 50%);
}
.login-card {
  position: relative; z-index: 1;
  margin: auto;
  width: 100%; max-width: 400px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px;
  box-shadow: var(--shadow), 0 0 0 1px rgba(124,106,247,0.1);
}
.login-logo {
  width: 52px; height: 52px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Unbounded', sans-serif;
  font-size: 18px; font-weight: 700;
  margin-bottom: 20px;
}
.login-title { font-family: 'Unbounded', sans-serif; font-size: 24px; font-weight: 700; margin-bottom: 6px; }
.login-sub { color: var(--text2); margin-bottom: 32px; }

#app-page { display: none; }
#app-page.active { display: flex; }

.sidebar {
  width: 230px; min-width: 230px;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  transition: width 0.2s, transform 0.25s ease;
  overflow: hidden;
}
.sidebar.collapsed { width: 0; min-width: 0; border: none; }

.sidebar-header {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--border);
}
.logo {
  width: 34px; height: 34px; min-width: 34px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Unbounded', sans-serif; font-size: 12px; font-weight: 700;
}
.logo-text { font-family: 'Unbounded', sans-serif; font-size: 13px; font-weight: 600; }

.sidebar-nav { padding: 12px 8px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer; color: var(--text2);
  font-weight: 500; font-size: 14px;
  transition: all 0.15s; white-space: nowrap;
  text-decoration: none;
}
.nav-item:hover { background: var(--bg3); color: var(--text); }
.nav-item.active { background: rgba(124,106,247,0.15); color: var(--accent); }
.nav-icon { font-size: 14px; }

.sidebar-footer { padding: 12px 8px; border-top: 1px solid var(--border); }
.team-label { font-size: 11px; color: var(--text3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; padding: 0 8px; margin-bottom: 8px; }
#team-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.team-member { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: var(--radius-sm); }
.team-member-avatar { width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: #fff; flex-shrink: 0; }
.team-member-name { font-size: 13px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.user-info { display: flex; align-items: center; gap: 8px; padding: 8px; background: var(--bg3); border-radius: var(--radius-sm); }
.user-avatar { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: #fff; flex-shrink: 0; }
.user-details { flex: 1; min-width: 0; }
.user-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-link { font-size: 11px; color: var(--accent); cursor: pointer; text-decoration: none; }
.user-link:hover { text-decoration: underline; }
.btn-logout { background: none; border: none; color: var(--text3); cursor: pointer; font-size: 16px; padding: 2px; transition: color 0.15s; }
.btn-logout:hover { color: var(--red); }

.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
  flex-shrink: 0;
}
.sidebar-toggle { background: none; border: none; color: var(--text2); font-size: 18px; cursor: pointer; padding: 4px; }
.topbar-title { font-family: 'Unbounded', sans-serif; font-size: 15px; font-weight: 600; flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.notif-btn { position: relative; cursor: pointer; padding: 6px; }
.notif-icon { font-size: 18px; }
.notif-badge {
  position: absolute; top: 2px; right: 2px;
  background: var(--red); color: #fff;
  font-size: 10px; font-weight: 700;
  min-width: 16px; height: 16px;
  border-radius: 8px; padding: 0 4px;
  display: flex; align-items: center; justify-content: center;
}

.filters-bar { display: flex; gap: 8px; padding: 12px 20px; flex-shrink: 0; flex-wrap: wrap; }
.filter-input, .filter-select {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  padding: 7px 12px; font-family: inherit; font-size: 13px;
  outline: none; transition: border-color 0.15s;
}
.filter-input { flex: 1; min-width: 200px; }
.filter-input:focus, .filter-select:focus { border-color: var(--accent); }
.filter-select { cursor: pointer; }

.kanban-board {
  display: flex; gap: 14px;
  padding: 16px 20px;
  overflow-x: auto; overflow-y: hidden;
  flex: 1;
}
.kanban-col {
  display: flex; flex-direction: column;
  min-width: 270px; width: 270px;
  background: var(--bg2);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}
.col-header {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px;
  font-weight: 600; font-size: 13px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.col-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot-todo { background: var(--text3); }
.dot-inprogress { background: var(--blue); }
.dot-review { background: var(--yellow); }
.dot-done { background: var(--green); }
.col-count { margin-left: auto; background: var(--bg4); border-radius: 10px; padding: 1px 8px; font-size: 12px; color: var(--text2); }

.col-cards {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding: 10px; display: flex; flex-direction: column; gap: 8px;
}
.col-cards.drag-over { background: rgba(124,106,247,0.05); }

.col-add-btn {
  background: none; border: none; border-top: 1px solid var(--border);
  color: var(--text3); padding: 10px; cursor: pointer;
  font-family: inherit; font-size: 13px; transition: all 0.15s;
}
.col-add-btn:hover { background: var(--bg3); color: var(--accent); }

.task-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.task-card:hover { border-color: var(--accent); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(0,0,0,0.3); }
.task-card.dragging { opacity: 0.4; }
.task-card-title { font-weight: 600; font-size: 13px; margin-bottom: 8px; line-height: 1.4; }
.task-card-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.priority-badge {
  font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 10px;
}
.p-critical { background: rgba(239,68,68,0.15); color: var(--red); }
.p-high     { background: rgba(249,115,22,0.15); color: var(--orange); }
.p-medium   { background: rgba(234,179,8,0.15); color: var(--yellow); }
.p-low      { background: rgba(34,197,94,0.15); color: var(--green); }

.deadline-badge { font-size: 11px; color: var(--text2); }
.deadline-badge.overdue { color: var(--red); }
.deadline-badge.soon { color: var(--yellow); }
.task-card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.assignee-avatar { width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 700; color: #fff; }
.comment-count { font-size: 11px; color: var(--text3); }

.list-view { flex: 1; overflow: auto; padding: 16px 20px; }
.task-table { width: 100%; border-collapse: collapse; }
.task-table th { text-align: left; padding: 8px 12px; font-size: 12px; color: var(--text3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 1px solid var(--border); }
.task-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 13px; }
.task-table tr:hover td { background: var(--bg3); cursor: pointer; }
.status-pill { font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 10px; }
.s-todo       { background: rgba(136,136,170,0.15); color: var(--text2); }
.s-inprogress { background: rgba(59,130,246,0.15); color: var(--blue); }
.s-review     { background: rgba(234,179,8,0.15); color: var(--yellow); }
.s-done       { background: rgba(34,197,94,0.15); color: var(--green); }

.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); }
.modal-box {
  position: relative; z-index: 1;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow);
  width: 100%; max-width: 520px;
  max-height: 90vh; overflow-y: auto;
  animation: modalIn 0.2s ease;
}
.modal-box-wide { max-width: 820px; }
.modal-box-sm { max-width: 380px; }
@keyframes modalIn { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: none; } }

.modal-header { display: flex; align-items: center; gap: 12px; padding: 20px 20px 0; }
.modal-header h2 { font-family: 'Unbounded', sans-serif; font-size: 16px; font-weight: 600; flex: 1; }
.modal-close { background: none; border: none; color: var(--text3); font-size: 18px; cursor: pointer; transition: color 0.15s; }
.modal-close:hover { color: var(--text); }
.detail-header-actions { display: flex; gap: 8px; align-items: center; }

.modal-body { padding: 20px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 0 20px 20px; }

.detail-body { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.detail-desc { color: var(--text2); font-size: 14px; line-height: 1.6; margin-bottom: 16px; white-space: pre-wrap; }
.detail-meta { display: flex; flex-direction: column; gap: 10px; }
.meta-item { display: flex; flex-direction: column; gap: 3px; }
.meta-label { font-size: 11px; color: var(--text3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }

.comments-title { font-weight: 600; margin-bottom: 12px; font-size: 14px; }
.comments-list { display: flex; flex-direction: column; gap: 10px; max-height: 280px; overflow-y: auto; margin-bottom: 12px; }
.comment-item { background: var(--bg3); border-radius: var(--radius-sm); padding: 10px 12px; }
.comment-author { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.comment-name { font-weight: 600; font-size: 13px; }
.comment-date { font-size: 11px; color: var(--text3); }
.comment-del { margin-left: auto; background: none; border: none; color: var(--text3); cursor: pointer; font-size: 13px; transition: color 0.15s; }
.comment-del:hover { color: var(--red); }
.comment-text { font-size: 13px; color: var(--text2); line-height: 1.5; }
.comment-form { display: flex; flex-direction: column; gap: 8px; }
.no-comments { color: var(--text3); font-size: 13px; text-align: center; padding: 20px 0; }

.notif-panel {
  position: fixed; top: 0; right: 0;
  width: 360px; height: 100vh;
  background: var(--bg2); border-left: 1px solid var(--border);
  z-index: 200; display: flex; flex-direction: column;
  animation: slideIn 0.2s ease;
}
@keyframes slideIn { from { transform: translateX(100%); } to { transform: none; } }
.notif-header { display: flex; align-items: center; gap: 8px; padding: 16px; border-bottom: 1px solid var(--border); font-weight: 600; }
.notif-close { background: none; border: none; color: var(--text3); font-size: 18px; cursor: pointer; margin-left: auto; }
.btn-text { background: none; border: none; color: var(--accent); font-family: inherit; font-size: 12px; cursor: pointer; margin-left: auto; }
#notif-list { flex: 1; overflow-y: auto; padding: 8px; }
.notif-item { padding: 10px 12px; border-radius: var(--radius-sm); margin-bottom: 4px; font-size: 13px; line-height: 1.4; }
.notif-item.unread { background: rgba(124,106,247,0.1); border-left: 2px solid var(--accent); }
.notif-item.read { color: var(--text2); }
.notif-time { font-size: 11px; color: var(--text3); margin-top: 4px; }
.no-notifs { text-align: center; padding: 40px 20px; color: var(--text3); }
.overlay { position: fixed; inset: 0; z-index: 150; }

.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.form-group label { font-size: 12px; font-weight: 600; color: var(--text2); text-transform: uppercase; letter-spacing: 0.05em; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.req { color: var(--red); }
input[type=text], input[type=email], input[type=password], input[type=date],
select, textarea {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  padding: 9px 12px; font-family: inherit; font-size: 14px;
  outline: none; width: 100%; transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 70px; }
select { cursor: pointer; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: var(--radius-sm);
  border: none; cursor: pointer; font-family: inherit; font-size: 14px; font-weight: 600;
  transition: all 0.15s; white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent2); }
.btn-ghost { background: var(--bg3); border: 1px solid var(--border); color: var(--text2); }
.btn-ghost:hover { background: var(--bg4); color: var(--text); }
.btn-danger { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); color: var(--red); }
.btn-danger:hover { background: rgba(239,68,68,0.2); }
.btn-full { width: 100%; justify-content: center; }
.btn-sm { padding: 6px 12px; font-size: 12px; }

.error-msg { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); color: var(--red); border-radius: var(--radius-sm); padding: 8px 12px; font-size: 13px; }
.hidden { display: none !important; }

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

@media (max-width: 700px) {
  .sidebar {
    position: fixed; z-index: 300; height: 100vh;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    width: 240px !important; min-width: 240px !important;
  }
  .sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,0.6);
  }
  .sidebar-backdrop {
    display: none;
    position: fixed; inset: 0; z-index: 299;
    background: rgba(0,0,0,0.5);
  }
  .sidebar-backdrop.active { display: block; }
  #app-page { flex-direction: column; }
  .main { width: 100%; overflow-x: hidden; }
  .topbar { padding: 10px 12px; gap: 8px; }
  .topbar-title { font-size: 13px; }
  .sidebar-toggle { font-size: 20px; padding: 4px 6px; }
  .filters-bar { flex-direction: column; padding: 10px 12px; gap: 6px; }
  .filter-input, .filter-select { width: 100%; }
  .kanban-board { flex-direction: column; overflow-y: auto; overflow-x: hidden; padding: 10px 12px; gap: 10px; height: auto; }
  .kanban-col { min-width: unset; width: 100%; }
  .col-cards { max-height: 300px; }
  .list-view { padding: 10px 12px; }
  .task-table th:nth-child(4), .task-table td:nth-child(4),
  .task-table th:nth-child(6), .task-table td:nth-child(6) { display: none; }
  .modal { padding: 0; align-items: flex-end; }
  .modal-box { max-height: 95vh; border-radius: 14px 14px 0 0; }
  .modal-box-wide { max-width: 100%; }
  .detail-body { grid-template-columns: 1fr; gap: 16px; }
  .form-row { grid-template-columns: 1fr; }
  .detail-header-actions { gap: 4px; }
  .detail-header-actions .btn-sm { padding: 5px 8px; font-size: 11px; }
  .notif-panel { width: 100%; }
  .btn.btn-primary { padding: 8px 12px; font-size: 13px; }
}
