/* ─── Reset & Base ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #0d0d0d;
  color: #e2e2e2;
  min-height: 100vh;
  display: flex;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font: inherit; }
textarea, input, select {
  font: inherit;
  background: #1e1e1e;
  border: 1px solid #2e2e2e;
  color: #e2e2e2;
  border-radius: 6px;
  padding: 8px 12px;
  outline: none;
  transition: border .15s;
  width: 100%;
}
textarea:focus, input:focus, select:focus { border-color: #6366f1; }
textarea { resize: vertical; min-height: 80px; }
select option { background: #1e1e1e; }
label { font-size: .85rem; color: #999; display: block; margin-bottom: 4px; }

/* ─── Sidebar ───────────────────────────────────────────── */
.sidebar {
  width: 220px; min-height: 100vh;
  background: #111; border-right: 1px solid #1e1e1e;
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; z-index: 100;
}
.sidebar-logo {
  padding: 20px 18px 16px;
  font-size: 1.05rem; font-weight: 700; color: #fff;
  border-bottom: 1px solid #1e1e1e;
  display: flex; align-items: center; gap: 10px;
}
.sidebar-logo .accent { color: #6366f1; }
.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.nav-section { padding: 8px 18px 4px; font-size: .7rem; color: #555; text-transform: uppercase; letter-spacing: .08em; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 18px; color: #999; font-size: .875rem;
  transition: background .15s, color .15s; white-space: nowrap;
}
.nav-item:hover { background: #1a1a1a; color: #fff; }
.nav-item.active { color: #fff; background: #1c1c2e; border-right: 2px solid #6366f1; }
.nav-item .icon { font-size: .95rem; width: 20px; text-align: center; flex-shrink: 0; }
.sidebar-footer {
  padding: 12px 16px; border-top: 1px solid #1e1e1e;
  display: flex; align-items: center; gap: 10px;
}
.sidebar-footer .user-name { font-size: .85rem; font-weight: 500; }
.sidebar-footer .user-role { font-size: .72rem; color: #666; }

/* ─── Main ──────────────────────────────────────────────── */
.main { margin-left: 220px; flex: 1; display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
  height: 52px; border-bottom: 1px solid #1e1e1e;
  display: flex; align-items: center; padding: 0 24px; gap: 12px;
  position: sticky; top: 0; background: #0d0d0d; z-index: 50;
}
.topbar h1 { font-size: 1rem; font-weight: 600; color: #f0f0f0; flex: 1; }
.breadcrumb { font-size: .8rem; color: #666; display: flex; align-items: center; gap: 6px; }
.breadcrumb a { color: #888; }
.breadcrumb a:hover { color: #fff; }
.breadcrumb-sep { color: #333; }
.page-content { flex: 1; padding: 24px; }

/* ─── Avatar ────────────────────────────────────────────── */
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .72rem; font-weight: 700; color: #fff; flex-shrink: 0;
}
.avatar-sm { width: 22px; height: 22px; font-size: .62rem; }
.avatar-lg { width: 40px; height: 40px; font-size: .9rem; }

/* ─── Cards ─────────────────────────────────────────────── */
.card { background: #161616; border: 1px solid #222; border-radius: 10px; padding: 20px; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 12px; }
.card-title { font-size: .95rem; font-weight: 600; }

/* ─── Buttons ───────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 7px; border: none;
  font-size: .85rem; font-weight: 500; transition: all .15s; white-space: nowrap;
}
.btn-primary { background: #6366f1; color: #fff; }
.btn-primary:hover { background: #5254cc; }
.btn-secondary { background: #222; color: #ccc; border: 1px solid #2e2e2e; }
.btn-secondary:hover { background: #2a2a2a; color: #fff; }
.btn-danger { background: #3d1515; color: #ef4444; border: 1px solid #5a1e1e; }
.btn-danger:hover { background: #ef4444; color: #fff; }
.btn-ghost { background: transparent; color: #888; border: 1px solid #2a2a2a; }
.btn-ghost:hover { background: #1e1e1e; color: #fff; }
.btn-success { background: #0f2818; color: #22c55e; border: 1px solid #1a4a2a; }
.btn-success:hover { background: #22c55e; color: #fff; }
.btn-sm { padding: 4px 10px; font-size: .8rem; }
.btn-xs { padding: 2px 8px; font-size: .75rem; border-radius: 5px; }
.btn-icon { padding: 6px; border-radius: 6px; }

/* ─── Badges ────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 20px;
  font-size: .72rem; font-weight: 600; white-space: nowrap;
}
/* Priority */
.p-low    { color: #64748b; }
.p-medium { color: #3b82f6; }
.p-high   { color: #f59e0b; }
.p-critical { color: #ef4444; }
/* Status */
.s-backlog     { background: #1e2328; color: #64748b; }
.s-todo        { background: #1e1e35; color: #818cf8; }
.s-in_progress { background: #2a2010; color: #f59e0b; }
.s-in_review   { background: #231838; color: #a78bfa; }
.s-testing     { background: #0e2530; color: #22d3ee; }
.s-done        { background: #0f2818; color: #4ade80; }
/* Sprint */
.sprint-planning   { background: #1e1e35; color: #818cf8; }
.sprint-active     { background: #0f2818; color: #4ade80; }
.sprint-completed  { background: #1e2328; color: #64748b; }
/* Type */
.t-story       { color: #818cf8; }
.t-task        { color: #60a5fa; }
.t-bug         { color: #f87171; }
.t-improvement { color: #4ade80; }
/* Test result */
.r-passed  { background: #0f2818; color: #4ade80; }
.r-failed  { background: #2a0f0f; color: #f87171; }
.r-blocked { background: #2a1e0a; color: #fbbf24; }
.r-skipped { background: #1e2328; color: #64748b; }
.r-not_run { background: #1a1a1a; color: #555; }

/* ─── Flash messages ────────────────────────────────────── */
.flash-container { position: fixed; top: 60px; right: 18px; z-index: 999; display: flex; flex-direction: column; gap: 8px; }
.flash {
  padding: 10px 14px; border-radius: 8px; font-size: .85rem;
  display: flex; align-items: center; gap: 10px; min-width: 220px;
  animation: slideIn .2s ease;
}
.flash-success { background: #0f2818; border: 1px solid #22c55e40; color: #4ade80; }
.flash-error   { background: #2a0f0f; border: 1px solid #ef444440; color: #f87171; }
.flash-close { margin-left: auto; background: none; border: none; color: inherit; font-size: 1rem; cursor: pointer; padding: 0; opacity: .6; }
.flash-close:hover { opacity: 1; }
@keyframes slideIn { from { transform: translateX(16px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ─── Forms ─────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.form-actions { display: flex; gap: 10px; margin-top: 20px; }
.color-row { display: flex; align-items: center; gap: 10px; }
.color-row input[type=color] { width: 38px; height: 34px; padding: 2px; flex-shrink: 0; border-radius: 5px; }
.color-row input[type=text] { flex: 1; }
.checkbox-group { display: flex; flex-direction: column; gap: 6px; }
.checkbox-item { display: flex; align-items: center; gap: 8px; }
.checkbox-item input { width: auto; }
.checkbox-item label { margin: 0; color: #ccc; font-size: .875rem; cursor: pointer; }

/* ─── Tables ────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: 10px; border: 1px solid #1e1e1e; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 9px 14px; font-size: .72rem; font-weight: 600; color: #666; text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid #1e1e1e; background: #111; }
td { padding: 10px 14px; border-bottom: 1px solid #1a1a1a; font-size: .875rem; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #161616; }

/* ─── Stats ─────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card { background: #161616; border: 1px solid #222; border-radius: 10px; padding: 16px; }
.stat-value { font-size: 1.8rem; font-weight: 700; line-height: 1; }
.stat-label { font-size: .75rem; color: #666; margin-top: 4px; }

/* ─── Kanban Board ──────────────────────────────────────── */
.board { display: flex; gap: 12px; align-items: flex-start; overflow-x: auto; padding-bottom: 16px; }
.board-col {
  width: 252px; min-width: 252px;
  background: #111; border-radius: 10px; border: 1px solid #1e1e1e;
  display: flex; flex-direction: column; max-height: calc(100vh - 160px); overflow: hidden;
}
.board-col-header {
  padding: 10px 12px; display: flex; align-items: center; gap: 8px;
  border-bottom: 1px solid #1e1e1e; font-size: .8rem; font-weight: 600; flex-shrink: 0;
}
.board-col-dot { width: 8px; height: 8px; border-radius: 50%; }
.board-col-count { margin-left: auto; background: #1e1e1e; border-radius: 20px; padding: 1px 7px; font-size: .7rem; color: #666; }
.board-tasks { padding: 8px; min-height: 40px; flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 7px; }
.task-card {
  background: #1a1a1a; border: 1px solid #242424; border-radius: 8px;
  padding: 10px 12px; cursor: pointer; transition: border-color .15s, box-shadow .15s;
}
.task-card:hover { border-color: #3e3e3e; box-shadow: 0 2px 8px rgba(0,0,0,.3); }
.task-card.sortable-ghost { opacity: .3; }
.task-card.sortable-chosen { border-color: #6366f1; }
.task-card-title { font-size: .83rem; font-weight: 500; margin-bottom: 8px; line-height: 1.4; color: #ddd; }
.task-card-meta { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.points-badge { background: #1e1e1e; border-radius: 4px; padding: 1px 6px; font-size: .7rem; color: #777; margin-left: auto; }

/* ─── Backlog ───────────────────────────────────────────── */
.backlog-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px; border-bottom: 1px solid #1a1a1a; transition: background .1s;
}
.backlog-item:last-child { border-bottom: none; }
.backlog-item:hover { background: #161616; }
.backlog-title { flex: 1; font-size: .875rem; }
.backlog-title a { color: #ddd; }
.backlog-title a:hover { color: #818cf8; }

/* ─── Task Detail ───────────────────────────────────────── */
.task-layout { display: grid; grid-template-columns: 1fr 280px; gap: 20px; align-items: start; }
.task-main { display: flex; flex-direction: column; gap: 18px; }
.task-sidebar-section { background: #161616; border: 1px solid #1e1e1e; border-radius: 10px; padding: 14px; }
.task-sidebar-section .section-label { font-size: .7rem; color: #555; text-transform: uppercase; letter-spacing: .07em; margin-bottom: 8px; }
.task-title-edit { font-size: 1.15rem; font-weight: 600; background: transparent; border: 1px solid transparent; border-radius: 6px; padding: 5px 7px; color: #f0f0f0; }
.task-title-edit:hover { border-color: #2e2e2e; }
.task-title-edit:focus { border-color: #6366f1; background: #1a1a1a; }
.subtask-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid #1a1a1a; }
.subtask-row:last-child { border-bottom: none; }
.subtask-row input[type=checkbox] { width: auto; accent-color: #6366f1; }
.subtask-row.done .subtask-text { text-decoration: line-through; color: #555; }
.comment-item { display: flex; gap: 10px; padding: 12px 0; border-bottom: 1px solid #1a1a1a; }
.comment-item:last-child { border-bottom: none; }
.comment-body { flex: 1; }
.comment-header { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.comment-author { font-size: .82rem; font-weight: 600; }
.comment-time { font-size: .72rem; color: #555; }
.comment-text { font-size: .875rem; line-height: 1.6; white-space: pre-wrap; color: #ccc; }
.activity-row { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: .78rem; color: #666; }
.activity-row .act-time { margin-left: auto; font-size: .7rem; color: #444; white-space: nowrap; }

/* ─── Progress ──────────────────────────────────────────── */
.progress-bar { height: 5px; background: #1e1e1e; border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; background: #6366f1; border-radius: 3px; transition: width .3s; }
.progress-fill.done { background: #4ade80; }

/* ─── Sprint ────────────────────────────────────────────── */
.sprint-card { background: #161616; border: 1px solid #222; border-radius: 10px; padding: 16px 20px; margin-bottom: 10px; }
.sprint-card-header { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.sprint-dates { font-size: .78rem; color: #666; margin-top: 2px; }

/* ─── Test run ──────────────────────────────────────────── */
.test-result-item { padding: 14px 0; border-bottom: 1px solid #1a1a1a; }
.test-result-item:last-child { border-bottom: none; }
.test-case-title { font-weight: 500; margin-bottom: 4px; }
.test-steps { font-size: .8rem; color: #777; white-space: pre-wrap; margin: 6px 0; padding: 8px 12px; background: #1a1a1a; border-radius: 6px; }
.result-btns { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.result-btn {
  padding: 4px 12px; border-radius: 5px; border: 1px solid #2e2e2e;
  font-size: .78rem; font-weight: 500; background: #1a1a1a; color: #666; cursor: pointer; transition: all .15s;
}
.result-btn[data-status=passed]  { border-color: #4ade8040; color: #4ade80; }
.result-btn[data-status=failed]  { border-color: #f8717140; color: #f87171; }
.result-btn[data-status=blocked] { border-color: #fbbf2440; color: #fbbf24; }
.result-btn[data-status=skipped] { border-color: #64748b40; color: #64748b; }
.result-btn.selected { font-weight: 700; filter: brightness(1.2); }

/* ─── Reports charts ────────────────────────────────────── */
.reports-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.chart-card { background: #161616; border: 1px solid #222; border-radius: 10px; padding: 20px; }
.chart-card h3 { font-size: .875rem; font-weight: 600; margin-bottom: 16px; color: #bbb; }
.chart-wrap { position: relative; }

/* ─── Team ──────────────────────────────────────────────── */
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.team-card { background: #161616; border: 1px solid #222; border-radius: 10px; padding: 16px; }
.team-card-header { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }

/* ─── Modal ─────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.75);
  z-index: 200; display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: #161616; border: 1px solid #2a2a2a; border-radius: 12px;
  padding: 24px; width: 100%; max-width: 500px; max-height: 90vh; overflow-y: auto;
}
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-title { font-size: .95rem; font-weight: 600; }
.modal-close { background: none; border: none; color: #555; font-size: 1.2rem; cursor: pointer; }
.modal-close:hover { color: #fff; }

/* ─── PR badge ──────────────────────────────────────────── */
.pr-badge { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px; border-radius: 7px; font-size: .82rem; }
.pr-open   { background: #0f2818; border: 1px solid #4ade8040; color: #4ade80; }
.pr-closed { background: #2a0f0f; border: 1px solid #f8717140; color: #f87171; }
.pr-merged { background: #1e1035; border: 1px solid #a78bfa40; color: #a78bfa; }

/* ─── Epic chip ─────────────────────────────────────────── */
.epic-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 4px; font-size: .72rem; font-weight: 500; }

/* ─── Color dot ─────────────────────────────────────────── */
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }

/* ─── Empty state ───────────────────────────────────────── */
.empty { text-align: center; padding: 40px 16px; color: #555; }
.empty-icon { font-size: 2.2rem; margin-bottom: 10px; }
.empty p { font-size: .88rem; margin-bottom: 14px; }

/* ─── Login page ────────────────────────────────────────── */
.login-page { width: 100vw; min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-box { background: #161616; border: 1px solid #222; border-radius: 14px; padding: 36px 30px; width: 100%; max-width: 360px; }
.login-logo { text-align: center; margin-bottom: 26px; }
.login-logo h1 { font-size: 1.5rem; font-weight: 700; }
.login-logo h1 .accent { color: #6366f1; }
.login-logo p { font-size: .82rem; color: #555; margin-top: 4px; }

/* ─── Divider & Misc ────────────────────────────────────── */
.divider { height: 1px; background: #1e1e1e; margin: 16px 0; }
.text-muted { color: #666; font-size: .82rem; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.ml-auto { margin-left: auto; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.w-full { width: 100%; }
.fw-medium { font-weight: 500; }
.fs-sm { font-size: .82rem; }

/* ─── Scrollbar ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2a2a2a; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #444; }

/* ─── Media gallery ─────────────────────────────────────── */
.midia-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.midia-item {
  background: #111; border: 1px solid #222; border-radius: 8px;
  overflow: hidden; display: flex; flex-direction: column;
}
.midia-thumb {
  width: 100%; height: 120px; object-fit: cover; display: block; cursor: pointer;
}
.midia-file {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; height: 120px; text-align: center; color: #888; font-size: .75rem;
  padding: 8px; word-break: break-all;
}
.midia-file:hover { color: #fff; background: #1a1a1a; }
.midia-meta {
  display: flex; align-items: center; justify-content: space-between;
  padding: 5px 8px; font-size: .7rem; color: #555; background: #0d0d0d;
}

/* ─── Hamburger ─────────────────────────────────────────── */
.hamburger {
  display: none; flex-direction: column; justify-content: center; gap: 5px;
  width: 36px; height: 36px; background: none; border: none;
  padding: 6px; border-radius: 6px; flex-shrink: 0; cursor: pointer;
}
.hamburger span {
  display: block; height: 2px; background: #aaa; border-radius: 2px; transition: all .2s;
}
.hamburger:hover span { background: #fff; }

/* ─── Sidebar overlay ───────────────────────────────────── */
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.6); z-index: 99;
}
.sidebar-overlay.open { display: block; }

/* ─── Responsive ────────────────────────────────────────── */
@media (max-width: 1024px) {
  .task-layout { grid-template-columns: 1fr; }
  .reports-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
}

@media (max-width: 768px) {
  /* Hamburger visible */
  .hamburger { display: flex; }

  /* Sidebar becomes full-width drawer */
  .sidebar {
    transform: translateX(-100%);
    transition: transform .25s ease;
    width: 240px;
    z-index: 100;
  }
  .sidebar.open { transform: translateX(0); }

  /* Main fills full width */
  .main { margin-left: 0; }

  /* Topbar adjustments */
  .topbar { padding: 0 12px; gap: 8px; height: auto; min-height: 52px; flex-wrap: wrap; }
  .topbar h1 { font-size: .9rem; }
  .breadcrumb { display: none; }

  /* Page content */
  .page-content { padding: 14px; }

  /* Grids stack */
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .team-grid { grid-template-columns: 1fr 1fr; }
  .reports-grid { grid-template-columns: 1fr; }
  .task-layout { grid-template-columns: 1fr; }

  /* Board scrolls horizontally */
  .board { overflow-x: auto; padding-bottom: 12px; }
  .board-col { min-width: 230px; }

  /* Modal full-width on mobile */
  .modal { max-width: 96vw; margin: 0 8px; padding: 18px; }

  /* Topbar action buttons: wrap and reduce size */
  .btn-sm { padding: 4px 8px; font-size: .75rem; }

  /* Stat card smaller text */
  .stat-value { font-size: 1.4rem; }

  /* Media grid 2-col on mobile */
  .midia-grid { grid-template-columns: repeat(2, 1fr); }

  /* Flash moved below topbar */
  .flash-container { top: 60px; right: 10px; left: 10px; }
  .flash { min-width: unset; }
}

@media (max-width: 420px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .team-grid { grid-template-columns: 1fr; }
  .topbar h1 { font-size: .82rem; }
  .midia-grid { grid-template-columns: 1fr 1fr; }
}
