/* =============================================================================
   Roadmap — dark glassmorphism UI
   ============================================================================= */

/* -- Tokens ----------------------------------------------------------------- */
:root {
  --bg: #0A0B0F;
  --bg-grad:
    radial-gradient(1200px 800px at 15% -10%, #1A0F3A 0%, transparent 55%),
    radial-gradient(1000px 700px at 90% 110%, #0F2A3A 0%, transparent 55%),
    linear-gradient(180deg, #0A0B0F 0%, #06070B 100%);

  --panel:        rgba(255, 255, 255, 0.04);
  --panel-hi:     rgba(255, 255, 255, 0.07);
  --panel-border: rgba(255, 255, 255, 0.10);

  --ink:      #E8E9F3;
  --ink-soft: #8B8FA8;
  --ink-dim:  #61657A;
  --rule:     rgba(255, 255, 255, 0.06);

  --accent:       #7C5CFF;
  --accent-2:     #00E5FF;
  --accent-grad:  linear-gradient(135deg, #7C5CFF 0%, #00E5FF 100%);

  --cat-feature:   #7C5CFF;
  --cat-bug:       #FF4D6D;
  --cat-infra:     #00E5FF;
  --cat-marketing: #FFB547;

  --danger: #FF4D6D;
  --warn:   #FFB547;
  --ok:     #4ade80;

  --radius-lg: 16px;
  --radius:    12px;
  --radius-sm: 8px;
  --radius-xs: 4px;

  --shadow-1: 0 1px 2px rgba(0,0,0,0.3), 0 4px 16px rgba(0,0,0,0.25);
  --shadow-hi: 0 12px 40px rgba(124,92,255,0.45);

  --ease: cubic-bezier(.22, 1, .36, 1);

  --px-day: 20px;       /* default = week zoom; JS overrides */
  --row-h: 40px;
  --sidebar-w: 280px;
  --header-h: 56px;
  --gantt-header-h: 56px;
}

/* -- Reset ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; width: 100%; }
body {
  margin: 0;
  background-color: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  background-repeat: no-repeat;
  color: var(--ink);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  color-scheme: dark;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; padding: 0; }
input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
ul { list-style: none; padding: 0; margin: 0; }

/* HTML5 [hidden] attribute must always win over class-level display rules */
[hidden] { display: none !important; }

/* Grain overlay for visual texture */
.bg-grain {
  position: fixed; inset: 0;
  pointer-events: none;
  filter: url(#grain);
  opacity: 0.4;
  z-index: 0;
  mix-blend-mode: overlay;
}

/* -- Typography -------------------------------------------------------------- */
.mono { font-family: 'JetBrains Mono', ui-monospace, Menlo, monospace; font-variant-numeric: tabular-nums; }
.meta { font-size: 11px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); }
.muted { color: var(--ink-soft); }

.h2 { font-family: 'Space Grotesk', sans-serif; font-size: 18px; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
.page-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 40px; font-weight: 600; letter-spacing: -0.03em; margin: 0 0 8px 0;
  background: var(--accent-grad);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
.page-sub { color: var(--ink-soft); font-size: 15px; margin: 0; }

/* -- Panel (glass) ---------------------------------------------------------- */
.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  box-shadow: var(--shadow-1);
}

/* -- Buttons ---------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-weight: 500; font-size: 14px;
  transition: transform 120ms var(--ease), background 120ms var(--ease), box-shadow 120ms var(--ease), border-color 120ms var(--ease);
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; padding: 12px 16px; }

.btn-primary {
  background: var(--accent-grad);
  color: #0a0415;
  font-weight: 600;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.1) inset, 0 4px 16px rgba(124,92,255,0.35);
}
.btn-primary:hover { box-shadow: 0 0 0 1px rgba(255,255,255,0.2) inset, 0 6px 24px rgba(124,92,255,0.55); }

.btn-ghost {
  background: var(--panel);
  border-color: var(--panel-border);
  color: var(--ink-soft);
}
.btn-ghost:hover { background: var(--panel-hi); color: var(--ink); border-color: rgba(255,255,255,0.2); }

.btn-danger {
  background: rgba(255,77,109,0.12);
  border-color: rgba(255,77,109,0.35);
  color: #ffb3c1;
}
.btn-danger:hover { background: rgba(255,77,109,0.22); color: #fff; }

.icon-btn {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 20px; line-height: 1;
  transition: background 120ms var(--ease), color 120ms var(--ease);
}
.icon-btn:hover { background: var(--panel-hi); color: var(--ink); }

/* -- Topbar ----------------------------------------------------------------- */
.topbar {
  height: var(--header-h);
  padding: 0 20px;
  display: flex; align-items: center;
  gap: 24px;
  position: sticky; top: 0;
  z-index: 50;
  background: rgba(10,11,15,0.6);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-bottom: 1px solid var(--rule);
}
.logo {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 20px; font-weight: 700; letter-spacing: -0.02em;
  background: var(--accent-grad);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
.nav { display: flex; gap: 4px; }
.nav a {
  padding: 6px 12px;
  font-size: 13px; font-weight: 500;
  color: var(--ink-soft);
  border-radius: var(--radius-sm);
  transition: background 120ms var(--ease), color 120ms var(--ease);
}
.nav a:hover { color: var(--ink); background: var(--panel-hi); }
.nav a.is-active { color: var(--ink); background: var(--panel); }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.me { font-size: 13px; color: var(--ink-soft); padding: 0 6px; }

.zoom-toggle {
  display: inline-flex;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  padding: 2px;
}
.zoom-toggle button {
  padding: 4px 10px;
  font-size: 12px; font-weight: 500;
  color: var(--ink-soft);
  border-radius: 6px;
  transition: all 120ms var(--ease);
}
.zoom-toggle button:hover { color: var(--ink); }
.zoom-toggle button.is-active {
  background: var(--panel-hi);
  color: var(--ink);
}

/* -- Auth pages ------------------------------------------------------------- */
body.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  width: 100%;
  padding: 24px;
  margin: 0;
}
.auth-shell { width: 100%; max-width: 420px; position: relative; z-index: 1; margin: 0 auto; }
.auth-card { padding: 36px 32px; }
.auth-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 36px; font-weight: 600; letter-spacing: -0.02em;
  margin: 0 0 6px 0;
  background: var(--accent-grad);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
.auth-sub { color: var(--ink-soft); margin: 0 0 24px 0; font-size: 15px; }
.auth-body { color: var(--ink-soft); margin: 0 0 24px 0; font-size: 14px; line-height: 1.6; }
.auth-error {
  background: rgba(255,77,109,0.12);
  border: 1px solid rgba(255,77,109,0.3);
  color: #ffb3c1;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
  font-size: 13px;
}
.auth-foot { text-align: center; color: var(--ink-soft); font-size: 13px; margin: 20px 0 0; }
.auth-foot a { color: var(--accent-2); font-weight: 500; }
.auth-foot a:hover { text-decoration: underline; }

/* -- Form fields ------------------------------------------------------------ */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 0; }
.field-row .field { margin-bottom: 14px; }
.field-label {
  font-size: 11px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-soft);
}
.field-hint { text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--ink-dim); }
.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field input[type="date"],
.field input[type="number"],
.field select,
.field textarea {
  width: 100%;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 14px;
  color: var(--ink);
  transition: border-color 120ms var(--ease), background 120ms var(--ease), box-shadow 120ms var(--ease);
  color-scheme: dark;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(255,255,255,0.05);
  box-shadow: 0 0 0 3px rgba(124,92,255,0.15);
}
.field textarea { resize: vertical; min-height: 80px; font-family: inherit; }

/* Native <select> dropdown options — dark background, light text */
.field select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='none' stroke='%238B8FA8' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M1 1.5l5 5 5-5'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}
.field select option,
.field select optgroup {
  background-color: #14151c;
  color: var(--ink);
}
.field select option:checked,
.field select option:hover {
  background-color: rgba(124,92,255,0.25);
  color: #fff;
}

.field input[type="range"] {
  width: 100%;
  -webkit-appearance: none; appearance: none;
  background: transparent;
}
.field input[type="range"]::-webkit-slider-runnable-track {
  height: 6px; border-radius: 3px;
  background: linear-gradient(to right, var(--accent) 0%, var(--accent) var(--val,0%), rgba(255,255,255,0.08) var(--val,0%), rgba(255,255,255,0.08) 100%);
}
.field input[type="range"]::-moz-range-track {
  height: 6px; border-radius: 3px; background: rgba(255,255,255,0.08);
}
.field input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff;
  margin-top: -5px;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.1), 0 4px 12px rgba(124,92,255,0.45);
  cursor: grab;
}
.field input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff; border: none;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.1), 0 4px 12px rgba(124,92,255,0.45);
}

/* -- Gantt layout ----------------------------------------------------------- */
.gantt {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  gap: 16px;
  padding: 16px;
  height: calc(100vh - var(--header-h));
  position: relative;
  z-index: 1;
}

.gantt-sidebar {
  overflow: hidden;
  display: flex; flex-direction: column;
  padding: 0;
}
.sidebar-head {
  height: var(--gantt-header-h);
  padding: 0 16px;
  border-bottom: 1px solid var(--rule);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.sidebar-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--panel-hi) transparent;
}
.sidebar-list::-webkit-scrollbar { width: 6px; }
.sidebar-list::-webkit-scrollbar-thumb { background: var(--panel-hi); border-radius: 3px; }

.sidebar-item {
  height: var(--row-h);
  padding: 0 16px;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--rule);
  cursor: pointer;
  transition: background 120ms var(--ease);
}
.sidebar-item:hover { background: var(--panel-hi); }
.sidebar-item.is-selected { background: rgba(124,92,255,0.12); }
.sidebar-item .cat-dot {
  width: 8px; height: 8px; border-radius: 50%;
  flex-shrink: 0;
}
.sidebar-item .title {
  flex: 1;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 13px;
}
.sidebar-item.is-complete .title { text-decoration: line-through; opacity: 0.6; }
.sidebar-item .prio {
  font-size: 10px; font-weight: 600;
  padding: 2px 5px; border-radius: 4px;
  letter-spacing: 0.04em; text-transform: uppercase;
}
.sidebar-item .prio-high { color: var(--danger); background: rgba(255,77,109,0.14); }
.sidebar-item .prio-med  { color: var(--warn);   background: rgba(255,181,71,0.14); }
.sidebar-item .prio-low  { color: var(--ink-soft); background: rgba(255,255,255,0.06); }

/* Category-group header rows in the sidebar */
.sidebar-group {
  height: var(--row-h);
  padding: 0 16px;
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.025);
  border-bottom: 1px solid var(--rule);
  border-top: 1px solid var(--rule);
  user-select: none;
}
.sidebar-group .cat-dot {
  width: 8px; height: 8px; border-radius: 50%;
  flex-shrink: 0;
  background: var(--ink-soft);
}
/* Category dot colors set inline via JS so they stay in sync with user-managed categories */
.sidebar-group .group-label {
  flex: 1;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.10em; text-transform: uppercase;
  color: var(--ink);
}
.sidebar-group .group-count {
  font-size: 11px; font-weight: 500;
  color: var(--ink-soft);
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(255,255,255,0.05);
}

/* Items now sit beneath their category header — small left indent for visual hierarchy */
.sidebar-item { padding-left: 28px; }

/* Empty row in the timeline body that aligns with a sidebar group header */
.gantt-row.is-header {
  background: rgba(255,255,255,0.02);
  border-bottom: 1px solid var(--rule);
  border-top: 1px solid var(--rule);
  pointer-events: none;
}

/* Gantt timeline */
.gantt-timeline {
  overflow: auto;
  position: relative;
  scrollbar-width: thin;
  scrollbar-color: var(--panel-hi) transparent;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
}
.gantt-timeline::-webkit-scrollbar { width: 8px; height: 8px; }
.gantt-timeline::-webkit-scrollbar-thumb { background: var(--panel-hi); border-radius: 4px; }

.gantt-header {
  height: var(--gantt-header-h);
  position: sticky; top: 0;
  display: flex;
  border-bottom: 1px solid var(--rule);
  background: rgba(10,11,15,0.7);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  z-index: 3;
}
.gantt-header .month {
  position: absolute; top: 4px;
  font-size: 11px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-soft);
  white-space: nowrap;
  padding: 0 8px;
}
.gantt-header .tick {
  position: absolute;
  bottom: 0;
  height: 24px;
  display: flex; align-items: flex-end; justify-content: center;
  font-size: 10px; color: var(--ink-soft);
  font-family: 'JetBrains Mono', monospace;
  padding-bottom: 6px;
  border-left: 1px solid var(--rule);
}
.gantt-header .tick.is-today { color: var(--accent-2); font-weight: 600; }

.gantt-body {
  position: relative;
  min-height: 300px;
}

.gantt-grid {
  position: absolute; inset: 0;
  pointer-events: none;
  z-index: 0;
}
.gantt-grid .weekend {
  position: absolute; top: 0; bottom: 0;
  background: rgba(0,0,0,0.15);
}
.gantt-grid .daylines {
  position: absolute; top: 0; bottom: 0; left: 0; right: 0;
  background-image: linear-gradient(to right, var(--rule) 1px, transparent 1px);
}

.gantt-today {
  position: absolute;
  top: 0; bottom: 0;
  width: 2px;
  background: var(--accent-grad);
  pointer-events: none;
  z-index: 2;
  box-shadow: 0 0 12px rgba(124,92,255,0.5);
}
.gantt-today::before {
  content: '';
  position: absolute;
  top: -3px; left: 50%; transform: translateX(-50%);
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 8px var(--accent-2);
}

.gantt-rows {
  position: relative;
  z-index: 1;
}
.gantt-row {
  position: relative;
  height: var(--row-h);
  border-bottom: 1px solid var(--rule);
}

.gantt-bar {
  position: absolute;
  top: 6px;
  height: calc(var(--row-h) - 12px);
  border-radius: 6px;
  background: rgba(124,92,255,0.16);
  border: 1px solid rgba(124,92,255,0.35);
  cursor: grab;
  display: flex; align-items: center;
  padding: 0 10px;
  overflow: hidden;
  min-width: 8px;
  transition: box-shadow 160ms var(--ease), transform 160ms var(--ease), filter 160ms var(--ease);
  user-select: none;
}
.gantt-bar:hover {
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.15), 0 0 20px currentColor;
}
.gantt-bar.is-dragging {
  cursor: grabbing;
  filter: var(--shadow-hi-filter, drop-shadow(0 12px 40px rgba(124,92,255,0.45)));
  transform: translateY(-1px);
  z-index: 10;
}
.gantt-bar.just-saved { animation: flash 600ms var(--ease); }
@keyframes flash {
  0%, 100% { box-shadow: inset 0 0 0 1px rgba(255,255,255,0.15), 0 0 0 transparent; }
  30%      { box-shadow: inset 0 0 0 1px rgba(255,255,255,0.3), 0 0 24px var(--accent-2); }
}

.gantt-bar-fill {
  position: absolute; top: 0; left: 0; bottom: 0;
  background: currentColor;
  opacity: 0.3;
  pointer-events: none;
  border-radius: 6px 0 0 6px;
}

.gantt-bar-title {
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink);
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
  position: relative; z-index: 1;
  pointer-events: none;
}

.gantt-bar-handle {
  position: absolute; top: 0; bottom: 0;
  width: 6px;
  cursor: ew-resize;
  z-index: 2;
}
.gantt-bar-handle.left  { left: 0; }
.gantt-bar-handle.right { right: 0; }
.gantt-bar-handle:hover { background: rgba(255,255,255,0.1); }
.gantt-bar-handle:hover::after {
  content: '';
  position: absolute; top: 0; bottom: 0;
  width: 2px;
  background: var(--accent-2);
  box-shadow: 0 0 8px var(--accent-2);
}
.gantt-bar-handle.left:hover::after  { left: 1px; }
.gantt-bar-handle.right:hover::after { right: 1px; }

/* Category colors are applied via inline style at render time
   (since categories are user-managed). Defaults below as fallback. */
.gantt-bar { color: var(--ink-soft); background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.15); }
.sidebar-item .cat-dot { background: var(--ink-soft); }

/* Status variants */
.gantt-bar.status-in_progress .gantt-bar-fill {
  background-image: repeating-linear-gradient(
    -45deg,
    currentColor 0, currentColor 4px,
    rgba(255,255,255,0.18) 4px, rgba(255,255,255,0.18) 8px
  );
  animation: stripes 1.2s linear infinite;
  background-size: 200% 100%;
}
@keyframes stripes {
  from { background-position: 0 0; }
  to   { background-position: 40px 0; }
}
.gantt-bar.status-complete  { opacity: 0.55; }
.gantt-bar.status-complete .gantt-bar-title { text-decoration: line-through; }
.gantt-bar.status-blocked {
  border-style: dashed;
}
.gantt-bar.status-blocked::after {
  content: '';
  position: absolute; top: 6px; right: 6px;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 8px var(--danger);
  z-index: 2;
}

/* Arrows */
.gantt-arrows {
  position: absolute; top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 4;
}
.gantt-arrows path { fill: none; stroke: var(--ink-soft); stroke-width: 1.5; opacity: 0.6; transition: stroke 120ms var(--ease), stroke-width 120ms var(--ease), opacity 120ms var(--ease); }
.gantt-arrows path.is-related { stroke: var(--accent); stroke-width: 2; opacity: 1; }

/* Empty state */
.empty-state {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px;
  padding: 40px;
  text-align: center;
  color: var(--ink-soft);
  z-index: 5;
}
.empty-illustration {
  font-size: 64px;
  background: var(--accent-grad);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  opacity: 0.6;
  line-height: 1;
  margin-bottom: 8px;
}

/* -- Modal (drawer) --------------------------------------------------------- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(5,6,10,0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100;
  animation: fade-in 180ms var(--ease);
}
.modal {
  position: fixed;
  top: 20px; right: 20px; bottom: 20px;
  width: 480px; max-width: calc(100vw - 40px);
  z-index: 101;
  padding: 0;
  display: flex; flex-direction: column;
  animation: slide-in 260ms var(--ease);
  overflow: hidden;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-in { from { transform: translateX(40px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

.modal-head {
  padding: 20px 24px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--rule);
  flex-shrink: 0;
}
.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}
.modal-foot {
  padding: 16px 24px;
  display: flex; align-items: center; gap: 10px;
  border-top: 1px solid var(--rule);
  background: rgba(0,0,0,0.2);
  flex-shrink: 0;
}
.modal-foot .spacer { flex: 1; }

/* Chip input for dependencies */
.chip-input {
  position: relative;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  padding: 6px;
  min-height: 42px;
  transition: border-color 120ms var(--ease), box-shadow 120ms var(--ease);
}
.chip-input:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(124,92,255,0.15);
}
.chip-tags {
  display: flex; flex-wrap: wrap; gap: 4px;
}
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 8px;
  background: rgba(124,92,255,0.18);
  border: 1px solid rgba(124,92,255,0.35);
  border-radius: 6px;
  font-size: 12px;
}
.chip-x {
  cursor: pointer;
  opacity: 0.6;
  font-size: 14px; line-height: 1;
  padding: 0 2px;
}
.chip-x:hover { opacity: 1; }
.chip-input input {
  border: none !important;
  background: transparent !important;
  padding: 4px 6px !important;
  flex: 1; min-width: 120px;
  box-shadow: none !important;
}
.chip-menu {
  position: absolute;
  top: calc(100% + 4px); left: 0; right: 0;
  max-height: 220px; overflow-y: auto;
  background: #13151C;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-1);
  z-index: 5;
}
.chip-menu-item {
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  transition: background 100ms var(--ease);
}
.chip-menu-item:hover, .chip-menu-item.is-active { background: var(--panel-hi); }
.chip-menu-item .cat-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.chip-menu-empty { padding: 12px; color: var(--ink-soft); font-size: 13px; text-align: center; }

/* -- Toasts ----------------------------------------------------------------- */
#toast-host {
  position: fixed; bottom: 20px; right: 20px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 200;
  pointer-events: none;
}
.toast {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  box-shadow: var(--shadow-1);
  font-size: 13px;
  min-width: 240px; max-width: 360px;
  animation: toast-in 260ms var(--ease);
  pointer-events: auto;
  display: flex; align-items: center; gap: 10px;
}
@keyframes toast-in { from { transform: translateY(10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.toast.out { animation: toast-out 220ms var(--ease) forwards; }
@keyframes toast-out { to { transform: translateY(10px); opacity: 0; } }
.toast-info  .toast-dot { background: var(--accent-2); }
.toast-ok    .toast-dot { background: var(--ok); }
.toast-error .toast-dot { background: var(--danger); }
.toast-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; box-shadow: 0 0 8px currentColor; }
.toast-msg { flex: 1; color: var(--ink); }

/* -- Users page ------------------------------------------------------------- */
.users-main {
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 24px;
  position: relative; z-index: 1;
  display: flex; flex-direction: column; gap: 24px;
}
.users-head { margin-bottom: 8px; }
.users-invite { padding: 24px; }
.users-invite .h2 { margin-bottom: 16px; }

.users-list { padding: 8px 0; }
.users-list .h2 { padding: 16px 24px 8px; }
.user-rows { }
.user-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 24px;
  border-top: 1px solid var(--rule);
}
.user-row:first-of-type { border-top: none; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--accent-grad);
  color: #0a0415;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 13px;
  font-family: 'Space Grotesk', sans-serif;
  flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name { font-weight: 500; display: flex; align-items: center; gap: 8px; }
.user-meta { font-size: 12px; color: var(--ink-soft); display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.user-meta .dot { color: var(--ink-dim); }
.tag {
  font-size: 10px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 2px 6px; border-radius: 4px;
  background: rgba(0,229,255,0.14);
  color: var(--accent-2);
  border: 1px solid rgba(0,229,255,0.3);
}
.invite-form .btn { margin-top: 8px; }

/* -- Sidebar item reorder buttons ------------------------------------------- */
.sidebar-item .row-reorder {
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity 120ms var(--ease);
  flex-shrink: 0;
}
.sidebar-item:hover .row-reorder,
.sidebar-item.is-selected .row-reorder { opacity: 1; }
.sidebar-item .row-reorder .icon-btn {
  width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 4px;
  font-size: 11px;
  color: var(--ink-soft);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--rule);
  transition: all 120ms var(--ease);
}
.sidebar-item .row-reorder .icon-btn:hover:not(:disabled) {
  background: rgba(124,92,255,0.18);
  color: var(--ink);
  border-color: rgba(124,92,255,0.4);
}
.sidebar-item .row-reorder .icon-btn:disabled {
  opacity: 0.3; cursor: not-allowed;
}

/* -- Settings page ---------------------------------------------------------- */
.settings-main {
  position: relative; z-index: 1;
  max-width: 880px;
  margin: 0 auto;
  padding: 24px 24px 64px;
  display: flex; flex-direction: column; gap: 20px;
}
.settings-head { margin-bottom: 8px; }

/* Accordion sections — native <details>/<summary> with a custom chevron. */
.settings-card { padding: 0; overflow: hidden; }
.settings-card > summary.settings-card-head {
  list-style: none;        /* hide default disclosure triangle */
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 20px 24px;
  margin: 0;
  user-select: none;
  transition: background 120ms ease;
}
.settings-card > summary.settings-card-head::-webkit-details-marker { display: none; }
.settings-card > summary.settings-card-head::marker { content: ''; }
.settings-card > summary.settings-card-head:hover { background: var(--panel-hi); }
.settings-card-head-text { flex: 1; min-width: 0; }
.settings-card-head-text .h2 { margin-bottom: 4px; }
.settings-card-head-text .muted { font-size: 13px; margin: 0; }
.settings-chevron {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 28px;
  line-height: 1;
  color: var(--ink-soft);
  transition: transform 180ms ease, color 120ms ease;
  flex-shrink: 0;
  margin-top: 2px;
  display: inline-block;
  transform-origin: center;
}
.settings-card[open] > summary .settings-chevron { transform: rotate(90deg); }
.settings-card > summary:hover .settings-chevron { color: var(--ink); }
.settings-card-body {
  padding: 0 24px 24px;
  border-top: 1px solid var(--rule);
  padding-top: 20px;
}

.cat-rows {
  display: flex; flex-direction: column; gap: 8px;
  margin-bottom: 24px;
}
.cat-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  transition: background 120ms var(--ease);
}
.cat-row:hover { background: rgba(255,255,255,0.05); }

.cat-reorder { display: flex; flex-direction: column; gap: 2px; }
.cat-reorder .icon-btn {
  width: 22px; height: 18px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 4px;
  font-size: 12px;
  color: var(--ink-soft);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--rule);
  transition: all 120ms var(--ease);
}
.cat-reorder .icon-btn:hover:not(:disabled) {
  background: rgba(124,92,255,0.2); color: var(--ink);
  border-color: rgba(124,92,255,0.4);
}
.cat-reorder .icon-btn:disabled { opacity: 0.3; cursor: not-allowed; }

.cat-color {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.cat-swatch {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.15);
  display: block;
  transition: transform 120ms var(--ease);
}
.cat-color:hover .cat-swatch { transform: scale(1.08); }
.cat-color input[type="color"] {
  position: absolute; inset: 0;
  opacity: 0; cursor: pointer;
  width: 100%; height: 100%;
  padding: 0; border: none; background: none;
}

.cat-label-input {
  flex: 1;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 14px; font-weight: 500;
  color: var(--ink);
  transition: all 120ms var(--ease);
}
.cat-label-input:hover { background: rgba(255,255,255,0.06); }
.cat-label-input:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(124,92,255,0.08);
  box-shadow: 0 0 0 3px rgba(124,92,255,0.18);
}

.cat-key {
  font-size: 11px;
  color: var(--ink-dim);
  background: rgba(255,255,255,0.04);
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  white-space: nowrap;
}

.cat-add {
  border-top: 1px solid var(--rule);
  padding-top: 20px;
}
.cat-add-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 13px; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 12px 0;
}
.cat-add-form {
  display: flex; align-items: center; gap: 12px;
}
.cat-add-form input[type="text"] {
  flex: 1;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 14px;
  color: var(--ink);
  transition: all 120ms var(--ease);
}
.cat-add-form input[type="text"]::placeholder { color: var(--ink-dim); }
.cat-add-form input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(124,92,255,0.08);
  box-shadow: 0 0 0 3px rgba(124,92,255,0.18);
}

/* -- Responsive nudge ------------------------------------------------------- */
@media (max-width: 900px) {
  :root { --sidebar-w: 200px; }
  .topbar { gap: 12px; padding: 0 12px; }
  .topbar-right { gap: 6px; }
  .me { display: none; }
}
@media (max-width: 640px) {
  .gantt { grid-template-columns: 1fr; height: auto; }
  .gantt-sidebar { max-height: 240px; }
  .modal { top: 0; right: 0; bottom: 0; width: 100%; border-radius: 0; }
}

/* ── Games page ────────────────────────────────────────────────────────────── */
.games-main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 24px 80px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.games-head { display: flex; flex-direction: column; gap: 8px; }
.games-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 6px;
}
.games-filter {
  display: inline-flex;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}
.games-filter button {
  background: transparent;
  border: none;
  color: var(--ink-soft);
  padding: 6px 14px;
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
}
.games-filter button:hover { color: var(--ink); }
.games-filter button.is-active {
  background: rgba(124,92,255,0.18);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(124,92,255,0.35);
}
.games-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
}

.games-grid {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.games-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  --sport-color: var(--ink-soft);  /* fallback so child rules always resolve */
}
.games-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0 8px;
  border-bottom: 1px solid var(--rule);
  position: relative;
}
.games-section-head::before {
  content: '';
  position: absolute;
  left: 0; bottom: -1px;
  height: 2px;
  width: 48px;
  background: var(--sport-color);
  border-radius: 2px;
  opacity: 0.9;
}
.games-section-title {
  margin: 0;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink);
}
.games-section-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--ink-soft);
  padding: 2px 9px;
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  background: rgba(255,255,255,0.02);
}
.games-section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
}

.game-card {
  --card-accent: var(--sport-color, var(--accent));
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: transform 0.14s, border-color 0.14s, box-shadow 0.14s, background 0.14s;
  position: relative;
  overflow: hidden;
  min-height: 86px;
}
.game-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--card-accent);
  opacity: 0.55;
  transition: opacity 0.14s, width 0.14s;
}
.game-card:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--card-accent) 45%, var(--panel-border));
  background: var(--panel-hi);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}
.game-card:hover::before { opacity: 1; width: 4px; }

.game-card.is-completed { opacity: 0.5; }
.game-card.is-completed .game-card-title { text-decoration: line-through; text-decoration-thickness: 1px; }

.game-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.game-card-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  margin: 0;
  letter-spacing: -0.005em;
  line-height: 1.3;
  flex: 1;
  min-width: 0;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.game-completed-badge {
  flex-shrink: 0;
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(74,222,128,0.14);
  color: #4ade80;
  border: 1px solid rgba(74,222,128,0.28);
  white-space: nowrap;
}
.game-card-desc {
  font-size: 12px;
  color: var(--ink-soft);
  margin: 0;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.game-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 2px;
}
.game-card-foot:empty { display: none; }
.game-card-thumbs {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
}
.game-card-thumb {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  background-size: cover;
  background-position: center;
  border: 1px solid rgba(255,255,255,0.1);
  flex-shrink: 0;
}
.game-card-thumb-more {
  width: auto;
  padding: 0 6px;
  min-width: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--ink-soft);
  background: rgba(255,255,255,0.04);
}
.game-card-link {
  font-size: 10.5px;
  color: var(--accent-2);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
}
.game-card-link:hover { color: #74f0ff; }

/* ── Game modal ──────────────────────────────────────────────────────────── */
.game-modal { width: 640px; max-width: 95vw; }
.game-modal .modal-body { padding-bottom: 24px; }

.game-complete-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--panel-border);
}
.game-meta-stamp {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--ink-soft);
}
.game-complete-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}
.game-complete-toggle input { display: none; }
.toggle-track {
  width: 38px;
  height: 22px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 999px;
  position: relative;
  transition: background 0.2s, border-color 0.2s;
  flex-shrink: 0;
}
.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s, background 0.2s;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
.game-complete-toggle input:checked ~ .toggle-track {
  background: rgba(74,222,128,0.55);
  border-color: rgba(74,222,128,0.7);
}
.game-complete-toggle input:checked ~ .toggle-track .toggle-thumb {
  transform: translateX(16px);
  background: #fff;
}
.toggle-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
}

/* ── Image dropzone + gallery ────────────────────────────────────────────── */
.image-dropzone {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 70px;
  padding: 14px;
  border-radius: 10px;
  border: 1.5px dashed rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.025);
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s, color 0.18s;
  text-align: center;
}
.image-dropzone:hover,
.image-dropzone:focus,
.image-dropzone.is-drag {
  background: rgba(124,92,255,0.08);
  border-color: rgba(124,92,255,0.5);
  outline: none;
}
.image-dropzone.is-drag { background: rgba(124,92,255,0.16); }
.image-dropzone-hint {
  font-size: 12px;
  color: var(--ink-soft);
  pointer-events: none;
}

.image-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
  margin-top: 10px;
}
.image-gallery:empty { display: none; }
.image-tile {
  position: relative;
  aspect-ratio: 1;
  border-radius: 10px;
  background-size: cover;
  background-position: center;
  border: 1px solid rgba(255,255,255,0.12);
  cursor: zoom-in;
  overflow: hidden;
}
.image-tile.is-uploading {
  cursor: progress;
  background: rgba(255,255,255,0.05);
}
.image-tile.is-uploading::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    45deg,
    rgba(124,92,255,0.15) 0,
    rgba(124,92,255,0.15) 8px,
    rgba(124,92,255,0.05) 8px,
    rgba(124,92,255,0.05) 16px
  );
  animation: imageStripeMove 1.2s linear infinite;
}
@keyframes imageStripeMove {
  to { background-position: 32px 0; }
}
.image-tile-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: #fff;
  border: none;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.16s, background 0.16s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.image-tile:hover .image-tile-remove { opacity: 1; }
.image-tile-remove:hover { background: var(--cat-bug, #FF4D6D); }

/* ── Lightbox ────────────────────────────────────────────────────────────── */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(8, 9, 14, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1200;
  padding: 40px;
  backdrop-filter: blur(16px);
}
.lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 12px;
  box-shadow: 0 20px 80px rgba(0,0,0,0.6);
}
.lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  font-size: 22px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 50%;
  color: var(--ink);
  cursor: pointer;
}
.lightbox-close:hover { background: rgba(255,255,255,0.16); }

@media (max-width: 640px) {
  .game-modal { width: 100%; }
  .games-toolbar { flex-direction: column; align-items: stretch; gap: 10px; }
}
