:root {
  --bg: #f4f4f5;
  --surface: #ffffff;
  --border: #e2e2e2;
  --text: #1a1a1a;
  --text-muted: #6b6b6b;
  --accent: #1f6feb;
  --danger: #d1363f;
  --radius: 8px;
}
* { box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
}
main { padding: 1.5rem; max-width: 1400px; margin: 0 auto; }
h1 { font-size: 18px; font-weight: 600; margin: 0 0 1rem; }

.topnav {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 10px 1.5rem;
}
.topnav .brand { font-weight: 600; color: var(--text); text-decoration: none; }
.topnav a { color: var(--text-muted); text-decoration: none; margin-left: 16px; font-size: 13px; }
.topnav a:hover { color: var(--text); }
.nav-user { font-size: 13px; color: var(--text-muted); margin-left: 16px; }
.link-button { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 13px; padding: 0; margin-left: 16px; }
.link-button:hover { color: var(--text); }

.messages { padding: 0 1.5rem; }
.message { padding: 8px 12px; border-radius: 6px; font-size: 13px; margin: 8px 0; }
.message.success { background: #e8f4ea; color: #256029; }
.message.error { background: #fde8e8; color: var(--danger); }

.login-card, .settings-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.5rem; max-width: 420px; margin: 3rem auto;
}
.field { margin-bottom: 12px; display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 12px; color: var(--text-muted); }
input[type="text"], input[type="password"], input[type="url"] {
  border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; font-size: 13px;
}
button {
  background: var(--accent); color: #fff; border: none; border-radius: 6px;
  padding: 8px 14px; font-size: 13px; cursor: pointer; font-weight: 500;
}
button:hover { opacity: 0.9; }
.hint { font-size: 12px; color: var(--text-muted); }

.project-bar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 1.25rem; }
.project-chip {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 8px 12px; display: flex; align-items: center; gap: 10px; font-size: 13px;
  cursor: pointer;
}
.project-chip.active { border-color: var(--accent); background: #eef4ff; }
.project-chip .project-name { font-weight: 500; }
.project-chip .sync-time { color: var(--text-muted); font-size: 11px; }
.project-chip button { padding: 4px 10px; font-size: 12px; }

.tabs { display: flex; gap: 4px; margin-bottom: 1rem; }
.tabs button { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.tabs button.active { background: var(--text); color: #fff; border-color: var(--text); }

#kanban { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.column { flex: 0 0 260px; background: #eceef1; border-radius: var(--radius); padding: 10px; }
.column h3 { font-size: 13px; margin: 0 0 8px; display: flex; justify-content: space-between; color: var(--text-muted); font-weight: 600; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 6px;
  padding: 10px; margin-bottom: 8px; font-size: 13px;
}
.card a { color: var(--text); text-decoration: none; font-weight: 500; }
.card a:hover { text-decoration: underline; }
.card .meta { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.badge { font-size: 11px; padding: 2px 7px; border-radius: 10px; background: #eee; color: #444; }
.badge.due { background: #fde8e8; color: var(--danger); }
.badge.due.ok { background: #e8f4ea; color: #256029; }
.badge.project { background: #e8edf7; color: var(--accent); }

.timeline-controls { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; flex-wrap: wrap; gap: 8px; }
.timeline-hint { font-size: 12px; color: var(--text-muted); margin: 0; }
.timeline-controls-right { display: flex; align-items: center; gap: 8px; }
.zoom-controls { display: flex; gap: 4px; }
.zoom-btn {
  background: var(--surface); color: var(--text-muted); border: 1px solid var(--border);
  padding: 4px 10px; font-size: 12px; font-weight: 500;
}
.zoom-btn.active { background: var(--text); color: #fff; border-color: var(--text); }
.zoom-select {
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  padding: 4px 8px; font-size: 12px; border-radius: 6px; height: auto;
}
#timeline-viewport {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden;
}
.gantt { display: flex; }
.gantt-labels { flex: 0 0 320px; border-right: 1px solid var(--border); background: var(--surface); }
.gantt-label-header {
  height: 28px; display: flex; align-items: center; padding: 0 10px;
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.gantt-label-row {
  display: flex; align-items: center; padding: 4px 10px; font-size: 13px;
  border-bottom: 1px solid var(--border); overflow: hidden;
}
.gantt-label-row:last-child { border-bottom: none; }
.tl-label-stack { display: flex; flex-direction: column; gap: 2px; overflow: hidden; width: 100%; }
.tl-project-name {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.gantt-label-row a {
  color: var(--text); text-decoration: none; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.gantt-label-row a:hover { text-decoration: underline; }

.gantt-scroll { flex: 1; min-width: 0; overflow-x: auto; cursor: grab; user-select: none; }
.gantt-scroll.dragging { cursor: grabbing; }
.gantt-scroll-inner { position: relative; min-width: 100%; }

.gantt-shading { position: absolute; top: 0; bottom: 0; left: 0; right: 0; pointer-events: none; }
.gantt-weekend { position: absolute; top: 0; bottom: 0; background: rgba(0,0,0,0.035); }

.gantt-axis { position: relative; height: 28px; border-bottom: 1px solid var(--border); font-size: 11px; color: var(--text-muted); }
.gantt-axis span { position: absolute; top: 6px; transform: translateX(-50%); white-space: nowrap; }
.gantt-grid-line { position: absolute; top: 28px; bottom: 0; width: 1px; background: var(--border); }

.gantt-rows { position: relative; }
.gantt-row { position: relative; border-bottom: 1px solid var(--border); }
.gantt-row:last-child { border-bottom: none; }
.gantt-row-empty { background: repeating-linear-gradient(45deg, transparent, transparent 8px, rgba(0,0,0,0.015) 8px, rgba(0,0,0,0.015) 16px); }
.gantt-bar {
  position: absolute; top: 18px; height: 20px; border-radius: 4px;
  background: var(--accent); opacity: 0.9; cursor: default;
}
.gantt-bar.overdue { background: var(--danger); }
.gantt-today { position: absolute; top: 28px; bottom: 0; width: 2px; background: var(--danger); z-index: 1; }

.timeline-legend { display: flex; gap: 14px; margin-top: 10px; font-size: 12px; color: var(--text-muted); flex-wrap: wrap; }
.timeline-legend span { display: inline-flex; align-items: center; gap: 5px; }
.timeline-legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.empty { color: var(--text-muted); font-size: 13px; padding: 2rem; text-align: center; }