:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --border: #dfe1e6;
  --text: #172b4d;
  --muted: #5e6c84;
  --primary: #0052cc;
  --primary-dark: #0747a6;
  --danger: #de350b;
  --success: #00875a;
  --radius: 6px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar { background: #0d1b2a; color: #fff; }
.topbar-inner {
  max-width: 1200px; margin: 0 auto; padding: 0 20px;
  display: flex; align-items: center; gap: 24px; height: 52px;
}
.brand { color: #fff; font-weight: 700; font-size: 18px; }
.brand:hover { text-decoration: none; }
.mainnav { display: flex; gap: 18px; flex: 1; }
.mainnav a { color: #cbd5e1; font-size: 14px; }
.mainnav a:hover { color: #fff; text-decoration: none; }
.navright { display: flex; align-items: center; gap: 14px; font-size: 14px; }
.whoami { color: #cbd5e1; }
.btn-link { color: #fff; }

.page { max-width: 1200px; margin: 0 auto; padding: 24px 20px 60px; }

.flash { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 16px; font-size: 14px; }
.flash-success { background: #e3fcef; color: var(--success); border: 1px solid #abf5d1; }
.flash-error { background: #ffebe6; color: var(--danger); border: 1px solid #ffbdad; }

.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; margin-bottom: 16px;
}
.grid { display: grid; gap: 16px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 800px) { .grid-3 { grid-template-columns: 1fr; } }

h1 { font-size: 24px; margin: 0 0 16px; }
h2 { font-size: 19px; margin: 0 0 12px; }

.btn {
  display: inline-block; background: var(--primary); color: #fff; border: none;
  padding: 8px 16px; border-radius: var(--radius); cursor: pointer; font-size: 14px;
}
.btn:hover { background: var(--primary-dark); text-decoration: none; }
.btn-secondary { background: #ebecf0; color: var(--text); }
.btn-secondary:hover { background: #dfe1e6; }
.btn-danger { background: var(--danger); }
.btn-sm { padding: 4px 10px; font-size: 12px; }

input[type=text], input[type=email], input[type=password], textarea, select {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 14px; font-family: inherit; margin-bottom: 12px; background: #fff; color: var(--text);
}
textarea { min-height: 160px; resize: vertical; }
label { font-size: 13px; font-weight: 600; color: var(--muted); display: block; margin-bottom: 4px; }
form .field { margin-bottom: 14px; }

.auth-wrap { max-width: 380px; margin: 60px auto; }
.auth-wrap .card { padding: 28px; }
.auth-wrap h1 { text-align: center; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); font-size: 14px; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.badge-low { background: #dfe1e6; color: var(--muted); }
.badge-medium { background: #deebff; color: var(--primary); }
.badge-high { background: #fff0b3; color: #974f0c; }
.badge-urgent { background: #ffebe6; color: var(--danger); }
.badge-open { background: #deebff; color: var(--primary); }
.badge-in_progress { background: #fff0b3; color: #974f0c; }
.badge-review { background: #eae6ff; color: #5243aa; }
.badge-closed { background: #e3fcef; color: var(--success); }

.list-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: none; }
.list-item a.title { font-weight: 600; }
.muted { color: var(--muted); font-size: 13px; }

/* Kanban */
.board-columns { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.kcolumn {
  background: #ebecf0; border-radius: var(--radius); width: 270px; flex: 0 0 270px;
  padding: 10px; min-height: 60px;
}
.kcolumn-title { font-weight: 700; font-size: 13px; margin-bottom: 8px; display: flex; justify-content: space-between; }
.kcard {
  background: #fff; border-radius: var(--radius); padding: 10px; margin-bottom: 8px;
  box-shadow: 0 1px 2px rgba(9,30,66,.15); cursor: grab; font-size: 13px;
}
.kcard.dragging { opacity: 0.4; }
.kcard-title { font-weight: 600; margin-bottom: 6px; }
.kcard-meta { display: flex; justify-content: space-between; align-items: center; }
.kcolumn.drag-over { outline: 2px dashed var(--primary); }
.add-card-form { margin-top: 6px; }
.add-card-form input { margin-bottom: 6px; }

.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }

.comment { border-top: 1px solid var(--border); padding: 12px 0; }
.comment-meta { font-size: 12px; color: var(--muted); margin-bottom: 4px; }

.wiki-content h1, .wiki-content h2, .wiki-content h3 { margin-top: 20px; }
.wiki-content pre { background: #172b4d; color: #e6f0ff; padding: 12px; border-radius: var(--radius); overflow-x: auto; }
.wiki-content code { background: #ebecf0; padding: 1px 5px; border-radius: 4px; font-size: 13px; }
.wiki-content pre code { background: none; padding: 0; }
.wiki-content blockquote { border-left: 3px solid var(--border); margin: 0; padding-left: 12px; color: var(--muted); }
.wiki-ref { padding: 1px 6px; border-radius: 4px; font-weight: 600; text-decoration: none; }
.wiki-ref-ticket { background: #deebff; color: var(--primary); }
.wiki-ref-board { background: #e3fcef; color: var(--success); }
.wiki-ref-sprint { background: #eae6ff; color: #5243aa; }
.wiki-ref-user { background: #fff0b3; color: #974f0c; }
.wiki-ref-wiki { background: #deebff; color: var(--primary); }
.wiki-ref-missing, a.wiki-ref-missing { background: #ffebe6; color: var(--danger); }
.backlinks-list { list-style: none; padding: 0; margin: 0; }
.backlinks-list li { padding: 4px 0; }
