* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: #0f0f10;
  --surface: #1a1a1e;
  --surface-2: #232329;
  --border: #2e2e35;
  --text: #ededef;
  --text-muted: #8b8b97;
  --text-dim: #5c5c66;
  --accent: #6366f1;
  --accent-hover: #5558e6;
  --green: #22c55e;
  --yellow: #eab308;
  --red: #ef4444;
  --orange: #f97316;
  --blue: #3b82f6;
  --purple: #a855f7;
  --radius: 8px;
  --radius-sm: 4px;
}
body { font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); line-height: 1.5; font-size: 14px; }
a { color: var(--accent); text-decoration: none; }
button { font-family: inherit; }

/* Layout */
.layout { display: flex; height: 100vh; }
.sidebar { width: 240px; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; flex-shrink: 0; }
.sidebar-header { padding: 16px 16px 12px; border-bottom: 1px solid var(--border); }
.sidebar-header h1 { font-size: 1.1rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.sidebar-header h1 .logo { width: 20px; height: 20px; background: var(--accent); border-radius: 4px; }
.sidebar-nav { flex: 1; padding: 8px; overflow-y: auto; }
.nav-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 6px; cursor: pointer; color: var(--text-muted); font-size: 0.85rem; transition: all 0.15s; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--surface-2); color: var(--text); font-weight: 500; }
.nav-item .icon { width: 16px; text-align: center; }
.nav-section { padding: 12px 10px 4px; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-dim); font-weight: 600; }
.sidebar-footer { padding: 12px 16px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 8px; }
.sidebar-footer .avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--accent); display: flex; align-items: center; justify-content: center; font-size: 0.7rem; font-weight: 700; color: white; }
.sidebar-footer .user-name { font-size: 0.8rem; color: var(--text-muted); }

.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar { padding: 12px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; background: var(--surface); }
.topbar h2 { font-size: 1rem; font-weight: 600; }
.topbar .actions { display: flex; gap: 8px; }

.content { flex: 1; overflow-y: auto; padding: 24px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 6px; border: none; font-size: 0.8rem; font-weight: 500; cursor: pointer; transition: all 0.15s; }
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--red); color: white; }
.btn-sm { padding: 4px 8px; font-size: 0.75rem; }

/* Inputs */
input, textarea, select { background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 8px 12px; color: var(--text); font-size: 0.85rem; font-family: inherit; outline: none; width: 100%; transition: border-color 0.15s; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
textarea { min-height: 100px; resize: vertical; }
select { cursor: pointer; }

/* Auth */
.auth-container { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--bg); }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 40px; width: 380px; }
.auth-card h1 { font-size: 1.4rem; margin-bottom: 4px; display: flex; align-items: center; gap: 8px; }
.auth-card .subtitle { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 24px; }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 0.75rem; font-weight: 500; color: var(--text-muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.3px; }
.error { color: var(--red); font-size: 0.8rem; margin-top: 8px; }
.toggle-link { color: var(--accent); font-size: 0.85rem; cursor: pointer; display: inline-block; margin-top: 16px; }

/* Project Card */
.projects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.project-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; cursor: pointer; transition: all 0.15s; }
.project-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.project-card h3 { font-size: 0.95rem; margin-bottom: 4px; }
.project-card .key { font-size: 0.75rem; color: var(--accent); font-weight: 600; margin-bottom: 8px; }
.project-card .desc { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 12px; }
.project-card .stats { display: flex; gap: 16px; font-size: 0.75rem; color: var(--text-dim); }
.project-card .stats span { display: flex; align-items: center; gap: 4px; }

/* Issue List */
.issue-list { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.issue-row { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background 0.1s; }
.issue-row:last-child { border-bottom: none; }
.issue-row:hover { background: var(--surface-2); }
.issue-id { font-size: 0.75rem; color: var(--text-muted); font-family: 'SF Mono', monospace; min-width: 60px; }
.issue-title { flex: 1; font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.issue-meta { display: flex; align-items: center; gap: 8px; }

/* Priority/Status Badges */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 10px; font-size: 0.7rem; font-weight: 500; }
.priority-urgent { background: rgba(239,68,68,0.15); color: var(--red); }
.priority-high { background: rgba(249,115,22,0.15); color: var(--orange); }
.priority-medium { background: rgba(234,179,8,0.15); color: var(--yellow); }
.priority-low { background: rgba(34,197,94,0.15); color: var(--green); }
.priority-none { background: rgba(139,139,151,0.15); color: var(--text-muted); }
.status-open { background: rgba(59,130,246,0.15); color: var(--blue); }
.status-in_progress { background: rgba(234,179,8,0.15); color: var(--yellow); }
.status-in_review { background: rgba(168,85,247,0.15); color: var(--purple); }
.status-done { background: rgba(34,197,94,0.15); color: var(--green); }
.status-backlog { background: rgba(139,139,151,0.15); color: var(--text-muted); }
.status-cancelled { background: rgba(239,68,68,0.1); color: var(--text-dim); }

.label-tag { display: inline-block; padding: 1px 6px; border-radius: 10px; font-size: 0.65rem; font-weight: 500; margin-left: 4px; }

/* Kanban */
.kanban { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; height: calc(100vh - 130px); }
.kanban-col { min-width: 280px; width: 280px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; }
.kanban-col-header { padding: 12px 14px; font-size: 0.8rem; font-weight: 600; color: var(--text-muted); display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border); }
.kanban-col-header .count { background: var(--surface-2); padding: 1px 6px; border-radius: 8px; font-size: 0.7rem; }
.kanban-col-body { flex: 1; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.kanban-card { background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px; cursor: pointer; transition: border-color 0.15s; }
.kanban-card:hover { border-color: var(--accent); }
.kanban-card .card-id { font-size: 0.7rem; color: var(--text-muted); font-family: 'SF Mono', monospace; }
.kanban-card .card-title { font-size: 0.8rem; margin: 4px 0; }
.kanban-card .card-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }
.kanban-card .card-labels { display: flex; gap: 3px; flex-wrap: wrap; }

/* Issue Detail */
.issue-detail { max-width: 800px; }
.issue-detail .back { font-size: 0.8rem; color: var(--text-muted); cursor: pointer; margin-bottom: 16px; display: inline-block; }
.issue-detail .detail-header { margin-bottom: 20px; }
.issue-detail .detail-header h1 { font-size: 1.3rem; margin-bottom: 8px; }
.issue-detail .detail-meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.issue-detail .detail-body { margin: 20px 0; padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); font-size: 0.85rem; line-height: 1.7; color: var(--text-muted); white-space: pre-wrap; }
.issue-detail .detail-sidebar { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; }
.issue-detail .detail-main { }
.issue-detail .detail-props { }
.issue-detail .prop-group { margin-bottom: 16px; }
.issue-detail .prop-label { font-size: 0.7rem; text-transform: uppercase; color: var(--text-dim); font-weight: 600; margin-bottom: 4px; }
.issue-detail .prop-value { font-size: 0.85rem; }

/* Comments */
.comments-section { margin-top: 24px; }
.comments-section h3 { font-size: 0.9rem; margin-bottom: 12px; }
.comment { padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 8px; }
.comment .comment-header { display: flex; justify-content: space-between; margin-bottom: 6px; }
.comment .comment-author { font-size: 0.8rem; font-weight: 600; }
.comment .comment-time { font-size: 0.7rem; color: var(--text-dim); }
.comment .comment-body { font-size: 0.8rem; color: var(--text-muted); line-height: 1.6; }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 24px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.stat-card .stat-value { font-size: 1.8rem; font-weight: 700; }
.stat-card .stat-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 24px; width: 480px; max-height: 80vh; overflow-y: auto; }
.modal h3 { margin-bottom: 16px; font-size: 1rem; }

/* Filter bar */
.filter-bar { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.filter-bar select, .filter-bar input { width: auto; min-width: 120px; }

/* Empty state */
.empty { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty h3 { color: var(--text); margin-bottom: 8px; font-size: 1rem; }
.empty p { font-size: 0.85rem; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

@media (max-width: 768px) {
  .sidebar { display: none; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .issue-detail .detail-sidebar { grid-template-columns: 1fr; }
}