:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface2: #242836;
  --border: #2e3348;
  --text: #e8eaef;
  --text-muted: #8b92a8;
  --primary: #6366f1;
  --primary-hover: #818cf8;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  --radius: 10px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Segoe UI', Tahoma, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

.hidden { display: none !important; }

/* Auth */
#auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #0f1117 0%, #1a1040 100%);
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow);
}

.auth-card h1 { font-size: 1.8rem; text-align: center; margin-bottom: 0.25rem; }
.subtitle { text-align: center; color: var(--text-muted); margin-bottom: 1.5rem; }

.tabs { display: flex; gap: 0.5rem; margin-bottom: 1.5rem; }
.tab {
  flex: 1;
  padding: 0.6rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.95rem;
}
.tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.auth-form { display: flex; flex-direction: column; gap: 0.75rem; }
.auth-form input {
  padding: 0.75rem 1rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.95rem;
}
.auth-form input:focus { outline: none; border-color: var(--primary); }

/* Buttons */
.btn {
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }

.auth-form button, .form-actions button[type="submit"] {
  padding: 0.75rem;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 1rem;
  margin-top: 0.5rem;
}
.auth-form button:hover { background: var(--primary-hover); }

.error-msg {
  margin-top: 1rem;
  padding: 0.75rem;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  color: #fca5a5;
  font-size: 0.9rem;
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.header h1 { font-size: 1.3rem; }
.header-left { display: flex; align-items: center; gap: 1rem; }
#user-name { color: var(--text-muted); font-size: 0.9rem; }

/* Layout */
.layout { display: flex; min-height: calc(100vh - 65px); }

.sidebar {
  width: 220px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  padding: 1.5rem 1rem;
  flex-shrink: 0;
}

.nav-item {
  display: block;
  width: 100%;
  text-align: right;
  padding: 0.75rem 1rem;
  background: none;
  border: none;
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
}
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active { background: rgba(99, 102, 241, 0.15); color: var(--primary); }

.content { flex: 1; padding: 2rem; overflow-y: auto; }

.view-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}
.view-header h2 { font-size: 1.5rem; }

/* Filters */
.filters {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.filters select {
  padding: 0.5rem 0.75rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.9rem;
}

/* Cards */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  transition: border-color 0.2s;
}
.card:hover { border-color: var(--primary); }
.card h3 { font-size: 1.05rem; margin-bottom: 0.5rem; }
.card p { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 0.75rem; }
.card-meta { font-size: 0.8rem; color: var(--text-muted); }
.card-actions { display: flex; gap: 0.5rem; margin-top: 1rem; }

/* Status badges */
.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}
.badge-open { background: rgba(59, 130, 246, 0.2); color: #93c5fd; }
.badge-inprogress { background: rgba(245, 158, 11, 0.2); color: #fcd34d; }
.badge-close { background: rgba(34, 197, 94, 0.2); color: #86efac; }
.badge-reopen { background: rgba(239, 68, 68, 0.2); color: #fca5a5; }
.badge-type-bug { background: rgba(239, 68, 68, 0.2); color: #fca5a5; }
.badge-type-feature { background: rgba(168, 85, 247, 0.2); color: #d8b4fe; }

/* Issues table */
.issues-table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

th, td {
  padding: 0.85rem 1rem;
  text-align: right;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
th { background: var(--surface2); color: var(--text-muted); font-weight: 600; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(99, 102, 241, 0.05); }
.issue-title-link {
  color: var(--primary);
  cursor: pointer;
  text-decoration: none;
}
.issue-title-link:hover { text-decoration: underline; }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.6); }
.modal-content {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 1.1rem; }
.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}
.modal-close:hover { color: var(--text); }
#modal-body { padding: 1.5rem; }

/* Forms in modal */
.form-group { margin-bottom: 1rem; }
.form-group label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
}
.form-group textarea { min-height: 100px; resize: vertical; }
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus { outline: none; border-color: var(--primary); }

.form-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-start;
  margin-top: 1.5rem;
}

/* Attachments */
.attachments-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.75rem;
}
.attachment-item {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}
.attachment-item img,
.attachment-item video {
  display: block;
  max-width: 150px;
  max-height: 120px;
  object-fit: cover;
}
.attachment-name {
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 0.25rem 0.5rem;
  background: var(--surface2);
}

/* Comments */
.comments-section { margin-top: 1.5rem; border-top: 1px solid var(--border); padding-top: 1rem; }
.comment {
  background: var(--surface2);
  border-radius: var(--radius);
  padding: 0.85rem;
  margin-bottom: 0.75rem;
}
.comment-author { font-size: 0.8rem; color: var(--primary); margin-bottom: 0.25rem; }
.comment-text { font-size: 0.9rem; }
.comment-date { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.35rem; }

.status-buttons { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 1rem; }
.status-btn { font-size: 0.8rem; }

/* Toast */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.85rem 1.5rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 2000;
  font-size: 0.9rem;
}
.toast.success { border-color: var(--success); color: #86efac; }
.toast.error { border-color: var(--danger); color: #fca5a5; }

.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
}

@media (max-width: 768px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; border-left: none; border-bottom: 1px solid var(--border); }
  .sidebar nav { display: flex; gap: 0.5rem; }
  .nav-item { flex: 1; text-align: center; }
  .content { padding: 1rem; }
}
