:root {
  --blue: #0052cc;
  --blue-dark: #0747a6;
  --ink: #172b4d;
  --muted: #6b778c;
  --border: #dfe1e6;
  --bg: #f4f5f7;
  --card: #ffffff;
  --danger: #de350b;
  --success: #00875a;
  --warning: #ff991f;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 16px 0 8px; }

/* ---- Top nav ------------------------------------------------------- */
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 24px;
  height: 52px;
}
.brand { font-weight: 700; font-size: 16px; color: var(--ink); }
.mainnav { display: flex; gap: 4px; flex: 1; }
.mainnav a {
  color: var(--muted);
  padding: 8px 12px;
  border-radius: 4px;
  font-weight: 600;
}
.mainnav a:hover { background: var(--bg); text-decoration: none; }
.mainnav a.active { color: var(--blue); background: #deebff; }
.topbar-user { display: flex; align-items: center; gap: 12px; color: var(--muted); }

/* ---- Layout --------------------------------------------------------- */
.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.footer {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 24px;
}

/* ---- Cards / grid ---------------------------------------------------- */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 16px;
}
.muted { color: var(--muted); }

.plain-list { list-style: none; padding: 0; margin: 0; }
.plain-list li { padding: 8px 0; border-bottom: 1px solid var(--border); }
.plain-list li:last-child { border-bottom: none; }

/* ---- Forms ------------------------------------------------------------ */
form label {
  display: block;
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 12px;
  color: var(--ink);
}
form input[type=text], form input[type=email], form input[type=password],
form input[type=number], form input[type=date], form select {
  display: block;
  width: 100%;
  max-width: 480px;
  margin-top: 4px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
}
.inline-form { display: inline-block; margin: 0; }
.inline-form select { max-width: 200px; }
.filter-bar { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 16px; }
.filter-bar label { margin-bottom: 0; }

.btn {
  display: inline-block;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.btn:hover { background: var(--blue-dark); text-decoration: none; color: #fff; }
.link-btn {
  background: none; border: none; color: var(--blue); cursor: pointer; font-size: 14px; padding: 2px 6px;
}

/* ---- Flash / pills ------------------------------------------------------ */
.flash { padding: 10px 14px; border-radius: 4px; margin-bottom: 16px; font-size: 13px; }
.flash-success { background: #e3fcef; color: var(--success); }
.flash-error { background: #ffebe6; color: var(--danger); }

.pill {
  display: inline-block;
  background: var(--bg);
  color: var(--ink);
  border-radius: 10px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 600;
}
.pill-low { background: #e3fcef; color: var(--success); }
.pill-medium { background: #fffae6; color: #974f0c; }
.pill-high { background: #ffebe6; color: var(--danger); }
.pill-urgent { background: var(--danger); color: #fff; }

/* ---- Tables ------------------------------------------------------------- */
.table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.table th, .table td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 13px; }
.table th { background: var(--bg); color: var(--muted); font-weight: 600; }
.table tr:last-child td { border-bottom: none; }
.reorder-cell { white-space: nowrap; }

/* ---- Kanban / scrum board ------------------------------------------------ */
.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; }
.board-column {
  background: var(--bg);
  border-radius: 8px;
  padding: 10px;
  min-width: 240px;
  flex: 1 0 240px;
}
.board-column h3 { margin: 4px 8px 10px; }
.board-column-body { min-height: 80px; display: flex; flex-direction: column; gap: 8px; }
.board-column-body.drop-hover { background: #deebff; border-radius: 6px; }
.board-card {
  display: block;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px;
  color: var(--ink);
  cursor: grab;
}
.board-card:hover { border-color: var(--blue); text-decoration: none; }
.board-card.dragging { opacity: 0.4; }
.board-card-title { font-weight: 600; margin-bottom: 6px; }
.board-card-meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 12px; }

/* ---- Wiki / rich content ------------------------------------------------- */
.wiki-content, .ck-content { line-height: 1.6; }
.link-hint { margin: 16px 0; color: var(--muted); font-size: 13px; }
.link-hint code { background: var(--bg); padding: 2px 6px; border-radius: 4px; }

/* ---- Comments ------------------------------------------------------------- */
.comment { border-bottom: 1px solid var(--border); padding: 12px 0; }
.comment-meta { margin-bottom: 4px; font-size: 13px; }

/* ---- Auth / install ---------------------------------------------------------- */
.auth-card, .install-card {
  max-width: 420px;
  margin: 60px auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 28px;
}
.install-page { display: block; }
.check-list { list-style: none; padding: 0; }
.check-list li { padding: 4px 0; }
.check-list li.ok { color: var(--success); }
.check-list li.fail { color: var(--danger); font-weight: 700; }

/* ---- Burndown chart --------------------------------------------------------- */
.burndown-chart { width: 100%; max-width: 700px; height: auto; }
.chart-grid { stroke: var(--border); stroke-width: 1; }
.chart-axis-label { fill: var(--muted); font-size: 11px; }
.chart-line-ideal { fill: none; stroke: var(--muted); stroke-width: 2; stroke-dasharray: 5 4; }
.chart-line-actual { fill: none; stroke: var(--blue); stroke-width: 2.5; }
.chart-legend { display: flex; gap: 20px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.legend-swatch { display: inline-block; width: 14px; height: 3px; margin-right: 6px; vertical-align: middle; }
.legend-ideal { background: var(--muted); }
.legend-actual { background: var(--blue); }

@media (max-width: 800px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .mainnav { overflow-x: auto; }
}
