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

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

:root {
  /* Brand */
  --brand:      #7C3AED;
  --brand-l:    #EDE9FE;
  --brand-d:    #5B21B6;
  --accent:     #0EA5E9;
  --success:    #10B981;
  --warning:    #F59E0B;
  --danger:     #EF4444;
  --info:       #0EA5E9;

  /* Sidebar (dark) */
  --sb-bg:      #1A1A2E;
  --sb-hover:   rgba(255,255,255,.06);
  --sb-active:  rgba(124,58,237,.25);
  --sb-text:    rgba(255,255,255,.7);
  --sb-text-hi: #ffffff;
  --sb-border:  rgba(255,255,255,.08);

  /* Content */
  --bg:         #F7F8FA;
  --surface:    #FFFFFF;
  --surface-2:  #F1F3F8;
  --border:     #E5E7EB;
  --border-2:   #D1D5DB;
  --text:       #111827;
  --text-2:     #4B5563;
  --text-3:     #9CA3AF;

  /* Sizes */
  --sb-w:       240px;
  --header-h:   56px;
  --r:          8px;
  --r-lg:       12px;
  --r-xl:       16px;
  --shadow:     0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:  0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
  --shadow-lg:  0 10px 25px -5px rgba(0,0,0,.1);
}

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { opacity: .85; }

/* ── Layout ─────────────────────────────────────────────────────────────────── */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sb-w);
  background: var(--sb-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  border-right: 1px solid var(--sb-border);
  transition: transform .25s;
}

.sb-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--sb-border);
}
.sb-logo-mark {
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; color: #fff; flex-shrink: 0;
}
.sb-logo-text { font-size: 16px; font-weight: 700; color: var(--sb-text-hi); }
.sb-logo-ver  { font-size: 10px; color: var(--sb-text); }

.sb-section  { padding: 8px 0; }
.sb-label    { font-size: 10px; font-weight: 600; color: var(--sb-text); letter-spacing: .08em; text-transform: uppercase; padding: 6px 16px 3px; }
.sb-link     {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 16px; margin: 1px 8px; border-radius: 6px;
  color: var(--sb-text); font-size: 13px; font-weight: 500;
  transition: all .12s; cursor: pointer;
}
.sb-link:hover  { background: var(--sb-hover); color: var(--sb-text-hi); }
.sb-link.active { background: var(--sb-active); color: var(--sb-text-hi); }
.sb-link .ico   { width: 16px; height: 16px; flex-shrink: 0; opacity: .7; }
.sb-link.active .ico { opacity: 1; }
.sb-badge {
  margin-left: auto; font-size: 10px; font-weight: 600;
  background: var(--brand); color: #fff;
  padding: 1px 6px; border-radius: 10px; min-width: 18px; text-align: center;
}

.sb-projects { flex: 1; overflow-y: auto; padding: 8px 0; }
.sb-project-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 16px; margin: 1px 8px; border-radius: 6px;
  color: var(--sb-text); font-size: 12px; cursor: pointer;
  transition: background .12s;
}
.sb-project-item:hover { background: var(--sb-hover); color: var(--sb-text-hi); }
.sb-project-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

.sb-user {
  padding: 12px 16px; border-top: 1px solid var(--sb-border);
  display: flex; align-items: center; gap: 10px;
}
.sb-user-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.sb-user-name   { font-size: 13px; font-weight: 600; color: var(--sb-text-hi); }
.sb-user-role   { font-size: 11px; color: var(--sb-text); }
.sb-user-logout { margin-left: auto; color: var(--sb-text); font-size: 12px; cursor: pointer; }
.sb-user-logout:hover { color: var(--danger); }

.main-content { margin-left: var(--sb-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 24px; gap: 12px;
  position: sticky; top: 0; z-index: 100;
}
.topbar-title { font-size: 16px; font-weight: 700; }
.topbar-sub   { font-size: 12px; color: var(--text-3); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.page-body { padding: 24px; flex: 1; }

/* ── Cards ─────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
}
.card-body { padding: 20px; }
.card-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-title { font-size: 14px; font-weight: 600; }

/* ── Stats grid ─────────────────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card  { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 18px 20px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.stat-card::before { content: ''; position: absolute; top: 0; left: 0; width: 3px; height: 100%; }
.stat-card.blue::before   { background: var(--accent); }
.stat-card.purple::before { background: var(--brand); }
.stat-card.green::before  { background: var(--success); }
.stat-card.amber::before  { background: var(--warning); }
.stat-card.red::before    { background: var(--danger); }
.stat-label { font-size: 11px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; }
.stat-value { font-size: 28px; font-weight: 700; line-height: 1; }
.stat-card.blue .stat-value   { color: var(--accent); }
.stat-card.purple .stat-value { color: var(--brand); }
.stat-card.green .stat-value  { color: var(--success); }
.stat-card.amber .stat-value  { color: var(--warning); }
.stat-card.red .stat-value    { color: var(--danger); }
.stat-sub { font-size: 11px; color: var(--text-3); margin-top: 4px; }

/* ── Tables ─────────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table  { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  padding: 10px 14px; text-align: left;
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-3); border-bottom: 1px solid var(--border);
  background: var(--surface-2); white-space: nowrap;
}
tbody td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }

/* ── Badges ─────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 20px;
  white-space: nowrap;
}
.badge-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }

/* ── Priority icons ─────────────────────────────────────────────────────────── */
.priority-icon { font-size: 12px; margin-right: 3px; }

/* ── Forms ─────────────────────────────────────────────────────────────────── */
.form-group   { margin-bottom: 16px; }
.form-label   { display: block; font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 5px; }
.form-control {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--border-2); border-radius: var(--r);
  font-size: 13px; font-family: inherit; background: var(--surface);
  color: var(--text); outline: none; transition: border-color .15s, box-shadow .15s;
}
.form-control:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(124,58,237,.12); }
textarea.form-control { resize: vertical; min-height: 88px; }
select.form-control {
  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='%236B7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px;
}
.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.form-hint  { font-size: 11px; color: var(--text-3); margin-top: 3px; }
.required   { color: var(--danger); }

/* ── Buttons ─────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--r);
  font-size: 13px; font-weight: 600; font-family: inherit;
  border: 1px solid transparent; cursor: pointer;
  transition: all .15s; text-decoration: none; white-space: nowrap;
}
.btn:hover { opacity: .9; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary   { background: var(--brand);   color: #fff; border-color: var(--brand); }
.btn-success   { background: var(--success); color: #fff; }
.btn-danger    { background: var(--danger);  color: #fff; }
.btn-warning   { background: var(--warning); color: #fff; }
.btn-info      { background: var(--accent);  color: #fff; }
.btn-outline   { background: transparent; color: var(--brand); border-color: var(--brand); }
.btn-ghost     { background: transparent; color: var(--text-2); border-color: var(--border); }
.btn-sm        { padding: 5px 12px; font-size: 12px; }
.btn-xs        { padding: 3px 8px; font-size: 11px; border-radius: 5px; }
.btn-group     { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn-icon      { padding: 7px; border-radius: var(--r); background: transparent; border: 1px solid var(--border); cursor: pointer; color: var(--text-2); display: inline-flex; align-items: center; }
.btn-icon:hover { background: var(--surface-2); }
.btn svg       { width: 14px; height: 14px; }

/* ── Alerts ─────────────────────────────────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: var(--r); margin-bottom: 16px; font-size: 13px; display: flex; align-items: center; gap: 8px; }
.alert-success { background: #D1FAE5; color: #065F46; border: 1px solid #A7F3D0; }
.alert-danger  { background: #FEE2E2; color: #991B1B; border: 1px solid #FECACA; }
.alert-info    { background: #E0F2FE; color: #0369A1; border: 1px solid #BAE6FD; }
.alert-warning { background: #FEF3C7; color: #92400E; border: 1px solid #FDE68A; }

/* ── Progress ───────────────────────────────────────────────────────────────── */
.progress-wrap { background: #E5E7EB; border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 99px; background: var(--brand); transition: width .4s; }

/* ── Tabs ───────────────────────────────────────────────────────────────────── */
.tabs       { display: flex; border-bottom: 1px solid var(--border); gap: 0; margin-bottom: 20px; }
.tab-item   { padding: 10px 18px; font-size: 13px; font-weight: 500; cursor: pointer; color: var(--text-3); border-bottom: 2px solid transparent; transition: all .15s; }
.tab-item:hover  { color: var(--text); }
.tab-item.active { color: var(--brand); border-bottom-color: var(--brand); }

/* ── Filters bar ─────────────────────────────────────────────────────────────── */
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; padding: 14px 16px; background: var(--surface-2); border-radius: var(--r-lg); margin-bottom: 16px; border: 1px solid var(--border); }
.filter-bar .form-group { margin: 0; min-width: 130px; }

/* ── Gantt ─────────────────────────────────────────────────────────────────── */
.gantt-wrap { overflow-x: auto; }
.gantt-row  { display: grid; align-items: center; padding: 5px 0; border-bottom: 1px solid var(--border); }
.gantt-bar  { position: absolute; height: 20px; top: 4px; border-radius: 4px; }
.gantt-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--danger); z-index: 5; }

/* ── Avatar group ────────────────────────────────────────────────────────────── */
.avatar-group { display: flex; }
.avatar-group .av { width: 24px; height: 24px; border-radius: 50%; border: 2px solid #fff; margin-left: -6px; object-fit: cover; }
.avatar-group .av:first-child { margin-left: 0; }
.avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.avatar-sm { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }

/* ── Status pill ────────────────────────────────────────────────────────────── */
.status-pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 20px; }

/* ── Empty state ─────────────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 48px 24px; color: var(--text-3); }
.empty-state svg { width: 48px; height: 48px; opacity: .3; margin-bottom: 12px; }
.empty-state h3 { font-size: 15px; color: var(--text-2); margin-bottom: 6px; }

/* ── Modal ───────────────────────────────────────────────────────────────────── */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 999; align-items: center; justify-content: center; padding: 16px; }
.modal-overlay.open { display: flex; }
.modal-box { background: var(--surface); border-radius: var(--r-xl); padding: 24px; width: 100%; max-width: 520px; box-shadow: var(--shadow-lg); max-height: 90vh; overflow-y: auto; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-title { font-size: 16px; font-weight: 700; }

/* ── Search input ─────────────────────────────────────────────────────────────── */
.search-wrap { position: relative; }
.search-wrap svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; color: var(--text-3); pointer-events: none; }
.search-input { padding-left: 32px; }

/* ── Task card (kanban) ───────────────────────────────────────────────────────── */
.task-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 14px;
  margin-bottom: 10px; cursor: pointer;
  transition: box-shadow .15s, transform .15s;
}
.task-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

/* ── Project color dot ───────────────────────────────────────────────────────── */
.proj-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex-shrink: 0; }

/* ── Breadcrumb ──────────────────────────────────────────────────────────────── */
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-3); margin-bottom: 16px; }
.breadcrumb a { color: var(--text-3); }
.breadcrumb a:hover { color: var(--text); }
.breadcrumb span { color: var(--text); font-weight: 500; }

/* ── Login page ──────────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1A1A2E 0%, #16213E 50%, #0F3460 100%);
}
.login-card { background: var(--surface); border-radius: var(--r-xl); padding: 40px; width: 100%; max-width: 400px; box-shadow: var(--shadow-lg); }
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo-mark { width: 52px; height: 52px; border-radius: 14px; background: linear-gradient(135deg, var(--brand), var(--accent)); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 22px; color: #fff; margin-bottom: 10px; }
.login-title { font-size: 22px; font-weight: 700; text-align: center; margin-bottom: 6px; }
.login-sub   { font-size: 13px; color: var(--text-3); text-align: center; margin-bottom: 28px; }

/* ── Utils ───────────────────────────────────────────────────────────────────── */
.text-muted  { color: var(--text-3) !important; }
.text-sm     { font-size: 12px; }
.text-xs     { font-size: 11px; }
.fw-600      { font-weight: 600; }
.fw-700      { font-weight: 700; }
.mt-4        { margin-top: 4px; }
.mt-8        { margin-top: 8px; }
.mt-16       { margin-top: 16px; }
.mb-0        { margin-bottom: 0 !important; }
.mb-16       { margin-bottom: 16px; }
.d-flex      { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8       { gap: 8px; }
.gap-12      { gap: 12px; }
.w-100       { width: 100%; }
.mono        { font-family: 'JetBrains Mono', monospace; }

@media print {
  .sidebar, .topbar, .btn, .filter-bar, .no-print { display: none !important; }
  .main-content { margin-left: 0 !important; }
}

/* ── Sprint status badges ────────────────────────────────────────────────────── */
.sprint-card { border-radius: var(--r-lg); border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow); margin-bottom: 16px; }

/* ── Workflow step chain ─────────────────────────────────────────────────────── */
.wf-step-chain { display: flex; gap: 0; overflow-x: auto; padding: 8px 0; }
.wf-step-node  { flex: 1; min-width: 120px; text-align: center; position: relative; }
.wf-step-node::before { content: ''; position: absolute; top: 18px; left: 0; right: 50%; height: 2px; background: var(--border); z-index: 0; }
.wf-step-node:first-child::before { display: none; }

/* ── Bug severity / priority strip ──────────────────────────────────────────── */
.severity-blocker { border-left: 3px solid #991B1B !important; }
.severity-critical { border-left: 3px solid #EF4444 !important; }
.severity-major    { border-left: 3px solid #F59E0B !important; }
.severity-minor    { border-left: 3px solid #6B7280 !important; }

/* ── Attendance calendar cell ────────────────────────────────────────────────── */
.att-cell { transition: transform .1s; }
.att-cell:hover { transform: scale(1.15); z-index: 2; }

/* ── Print styles ────────────────────────────────────────────────────────────── */
@media print {
  .sidebar, .topbar, .btn, .filter-bar, .no-print, .modal-overlay { display: none !important; }
  .main-content { margin-left: 0 !important; }
  .page-body { padding: 0 !important; }
  .card { box-shadow: none !important; border: 1px solid #ddd !important; page-break-inside: avoid; }
  table { font-size: 11px; }
  thead th { background: #f5f5f5 !important; }
}

/* ── Notification dot ────────────────────────────────────────────────────────── */
.notif-unread { background: rgba(124,58,237,0.04); }

/* ── Step action forms ───────────────────────────────────────────────────────── */
.step-actions { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
