:root {
  --bg: #080c14;
  --bg-soft: #0d1320;
  --panel: #111827;
  --panel-2: #162034;
  --panel-3: #1b2740;
  --line: #22304a;
  --line-soft: #1a2539;
  --text: #e9eefb;
  --muted: #93a3c0;
  --dim: #6b7c9b;
  --accent: #6d7cff;
  --accent-2: #a855f7;
  --accent-soft: rgba(109, 124, 255, 0.14);
  --good: #34d399;
  --good-soft: rgba(52, 211, 153, 0.14);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.14);
  --bad: #f87171;
  --bad-soft: rgba(248, 113, 113, 0.14);
  --info: #38bdf8;
  --info-soft: rgba(56, 189, 248, 0.14);
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 18px 50px -24px rgba(0, 0, 0, 0.9);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  background-image:
    radial-gradient(900px 500px at 15% -10%, rgba(109, 124, 255, 0.13), transparent 65%),
    radial-gradient(800px 500px at 95% 0%, rgba(168, 85, 247, 0.10), transparent 60%);
  background-attachment: fixed;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

button, input, select, textarea { font: inherit; color: inherit; }

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.02em; }

::selection { background: rgba(109, 124, 255, 0.35); }

/* ------------------------------------------------------------------ layout */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px clamp(16px, 4vw, 40px);
  background: rgba(8, 12, 20, 0.78);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-size: 15px;
  box-shadow: 0 6px 18px -6px rgba(109, 124, 255, 0.8);
}

.topnav { display: flex; gap: 4px; margin-left: 8px; }

.topnav a {
  padding: 7px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 550;
}

.topnav a:hover { color: var(--text); background: var(--panel); }
.topnav a.active { color: var(--text); background: var(--panel-2); }

.top-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }

main {
  max-width: 1320px;
  margin: 0 auto;
  padding: 28px clamp(16px, 4vw, 40px) 80px;
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.page-head h1 { font-size: clamp(26px, 3vw, 34px); }

.sub { color: var(--muted); font-size: 14px; line-height: 1.55; margin: 6px 0 0; }

.muted { color: var(--muted); }
.dim { color: var(--dim); }
.tiny { font-size: 12px; }
.nowrap { white-space: nowrap; }

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 15px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  white-space: nowrap;
}

.btn:hover { background: var(--panel-3); border-color: var(--line-soft); }
.btn:active { transform: translateY(1px); }

.btn.primary {
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 22px -12px rgba(109, 124, 255, 0.9);
}

.btn.primary:hover { filter: brightness(1.07); }

.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--panel); }

.btn.danger { color: var(--bad); border-color: rgba(248, 113, 113, 0.35); background: var(--bad-soft); }
.btn.danger:hover { background: rgba(248, 113, 113, 0.22); }

.btn.small { padding: 6px 10px; font-size: 12.5px; border-radius: 8px; }
.btn.block { width: 100%; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}

.icon-btn:hover { background: var(--panel-3); color: var(--text); border-color: var(--line); }
.icon-btn.danger:hover { background: var(--bad-soft); color: var(--bad); }

/* -------------------------------------------------------------------- pills */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
  white-space: nowrap;
}

.pill::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

.pill.active, .pill.doing { color: var(--good); background: var(--good-soft); }
.pill.idea, .pill.planned { color: var(--info); background: var(--info-soft); }
.pill.paused, .pill.blocked { color: var(--warn); background: var(--warn-soft); }
.pill.done { color: var(--good); background: var(--good-soft); }
.pill.archived, .pill.todo { color: var(--muted); background: var(--panel-3); }

.pill.plain::before { display: none; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 8px;
  background: var(--panel-3);
  color: var(--muted);
  font-size: 12px;
  font-weight: 550;
  white-space: nowrap;
}

.chip.bad { color: var(--bad); background: var(--bad-soft); }
.chip.warn { color: var(--warn); background: var(--warn-soft); }
.chip.good { color: var(--good); background: var(--good-soft); }

.prio { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 650; }
.prio.p1 { color: var(--muted); }
.prio.p2 { color: var(--warn); }
.prio.p3 { color: var(--bad); }

/* --------------------------------------------------------------------- KPIs */
.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.kpi {
  position: relative;
  padding: 16px 18px;
  background: linear-gradient(160deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  overflow: hidden;
}

.kpi-label { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.kpi-value { font-size: 28px; font-weight: 700; letter-spacing: -0.04em; margin-top: 6px; }
.kpi-value small { font-size: 14px; font-weight: 600; color: var(--dim); margin-left: 2px; }
.kpi-sub { margin-top: 4px; font-size: 12px; color: var(--dim); }
.kpi.accent .kpi-value { color: #aeb6ff; }
.kpi.bad .kpi-value { color: var(--bad); }
.kpi.good .kpi-value { color: var(--good); }

/* ------------------------------------------------------------------ panels */
.panel {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.panel-head h2 { font-size: 15.5px; }
.panel-head .hint { font-size: 12px; color: var(--dim); }

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 18px;
  align-items: start;
}

.side { display: grid; gap: 18px; }

/* ---------------------------------------------------------------- projects */
.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.filters { display: flex; gap: 6px; flex-wrap: wrap; }

.filter {
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.filter:hover { color: var(--text); background: var(--panel-2); }
.filter.on { background: var(--accent-soft); border-color: rgba(109, 124, 255, 0.5); color: #c3c9ff; }

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--muted);
  min-width: 190px;
}

.search input {
  border: 0;
  background: transparent;
  outline: none;
  width: 100%;
  font-size: 13px;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.pcard {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 17px;
  background: linear-gradient(165deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.16s, transform 0.16s, box-shadow 0.16s;
  overflow: hidden;
}

.pcard::after {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, var(--pc, var(--accent)), transparent);
  opacity: 0.9;
}

.pcard:hover {
  border-color: var(--line);
  transform: translateY(-2px);
  box-shadow: 0 22px 45px -28px rgba(0, 0, 0, 0.95);
}

.pcard-top { display: flex; align-items: flex-start; gap: 11px; }

.picon {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: color-mix(in srgb, var(--pc, var(--accent)) 18%, var(--panel-3));
  border: 1px solid color-mix(in srgb, var(--pc, var(--accent)) 35%, transparent);
  font-size: 19px;
}

.pcard-title { flex: 1; min-width: 0; }
.pcard-title h3 {
  font-size: 15.5px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pcard-title .meta { display: flex; align-items: center; gap: 7px; margin-top: 5px; }

.pdesc {
  margin: 0;
  color: var(--muted);
  font-size: 12.8px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 38px;
}

.progress {
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.progress > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--pc, var(--accent)), color-mix(in srgb, var(--pc, var(--accent)) 60%, #ffffff));
  transition: width 0.4s ease;
}

.progress.thin { height: 5px; }

.pstat { display: flex; align-items: center; justify-content: space-between; font-size: 12px; }
.pstat strong { font-size: 13px; }
.pstat .pct { font-weight: 700; color: var(--text); }

.pcard-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11.8px;
  color: var(--dim);
  border-top: 1px solid var(--line-soft);
  padding-top: 10px;
  margin-top: auto;
}

.empty {
  padding: 42px 20px;
  text-align: center;
  color: var(--dim);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  font-size: 13.5px;
  line-height: 1.6;
}
.empty strong { color: var(--muted); display: block; margin-bottom: 4px; font-size: 14.5px; }

/* --------------------------------------------------------------- deadlines */
.feed { display: flex; flex-direction: column; gap: 2px; }

.feed-item {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  padding: 9px 8px;
  border-radius: 10px;
  cursor: pointer;
}

.feed-item:hover { background: var(--panel-2); }

.feed-dot {
  display: grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--panel-3);
  font-size: 14px;
}

.feed-main { flex: 1; min-width: 0; }
.feed-title { font-size: 13px; font-weight: 550; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-sub { font-size: 11.5px; color: var(--dim); margin-top: 2px; display: flex; gap: 6px; flex-wrap: wrap; }

.due { font-size: 11.5px; font-weight: 650; color: var(--muted); white-space: nowrap; }
.due.soon { color: var(--warn); }
.due.late { color: var(--bad); }
.due.today { color: var(--info); }

.mini-empty { color: var(--dim); font-size: 12.5px; padding: 10px 4px; line-height: 1.5; }

/* ------------------------------------------------------------ detail header */
.back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 550;
  margin-bottom: 14px;
}

.back:hover { color: var(--text); }

.detail-head {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  padding: 22px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background:
    radial-gradient(600px 200px at 0% 0%, color-mix(in srgb, var(--pc, var(--accent)) 16%, transparent), transparent 70%),
    linear-gradient(160deg, var(--panel-2), var(--panel));
  box-shadow: var(--shadow);
  flex-wrap: wrap;
}

.detail-icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 15px;
  font-size: 27px;
  background: color-mix(in srgb, var(--pc, var(--accent)) 20%, var(--panel-3));
  border: 1px solid color-mix(in srgb, var(--pc, var(--accent)) 40%, transparent);
  flex: none;
}

.detail-title { flex: 1; min-width: 220px; }
.detail-title .row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.detail-title h1 { font-size: clamp(22px, 2.6vw, 30px); line-height: 1.15; }
.detail-title .pdesc { margin-top: 7px; -webkit-line-clamp: 3; min-height: 0; max-width: 720px; }
.detail-meta { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; font-size: 12px; color: var(--dim); }

.detail-side { display: flex; align-items: center; gap: 14px; margin-left: auto; }

.ring {
  --p: 0;
  position: relative;
  display: grid;
  place-items: center;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background: conic-gradient(var(--pc, var(--accent)) calc(var(--p) * 1%), rgba(255, 255, 255, 0.07) 0);
  flex: none;
}

.ring::before {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: 50%;
  background: var(--panel);
}

.ring span { position: relative; font-size: 16px; font-weight: 700; }
.ring span small { font-size: 10px; color: var(--dim); font-weight: 600; }

.detail-actions { display: flex; flex-direction: column; gap: 7px; }

.detail-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0 0;
}

.dstat {
  padding: 12px 14px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--panel);
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.dstat b { font-size: 19px; color: var(--text); letter-spacing: -0.02em; }
.dstat span { margin-left: auto; }

/* --------------------------------------------------------------------- tabs */
.tabs {
  display: flex;
  gap: 4px;
  margin: 22px 0 16px;
  border-bottom: 1px solid var(--line-soft);
  overflow-x: auto;
  padding-bottom: 1px;
}

.tab {
  padding: 10px 14px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  margin-bottom: -1px;
}

.tab:hover { color: var(--text); }
.tab.on { color: var(--text); border-bottom-color: var(--accent); }
.tab .n { color: var(--dim); font-weight: 550; margin-left: 4px; }

.tab-grid { display: grid; gap: 16px; }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }

/* -------------------------------------------------------------------- phase */
.phase {
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: var(--panel);
  overflow: hidden;
}

.phase + .phase { margin-top: 12px; }

.phase-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line-soft);
  flex-wrap: wrap;
}

.phase-num {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: #b6bdff;
  font-size: 12px;
  font-weight: 700;
  flex: none;
}

.phase-title { flex: 1; min-width: 150px; }
.phase-title h3 { font-size: 14.5px; }
.phase-title .meta { font-size: 11.5px; color: var(--dim); margin-top: 3px; display: flex; gap: 8px; flex-wrap: wrap; }

.phase-progress { display: flex; align-items: center; gap: 8px; min-width: 130px; }
.phase-progress .progress { width: 90px; }
.phase-progress b { font-size: 12px; width: 38px; text-align: right; }

.phase-body { padding: 8px 10px 12px; }

.mini-select {
  padding: 5px 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

/* --------------------------------------------------------------------- task */
.tasks { list-style: none; margin: 0; padding: 0; }

.task {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 8px;
  border-radius: 9px;
}

.task:hover { background: var(--panel-2); }
.task + .task { border-top: 1px solid var(--line-soft); }
.task.done .task-title { color: var(--dim); text-decoration: line-through; }

.check {
  position: relative;
  flex: none;
  width: 18px;
  height: 18px;
  margin-top: 2px;
  cursor: pointer;
}

.check input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }

.check span {
  display: block;
  width: 18px;
  height: 18px;
  border-radius: 6px;
  border: 1.5px solid var(--line);
  background: var(--bg-soft);
  transition: background 0.15s, border-color 0.15s;
}

.check input:checked + span {
  background: var(--good);
  border-color: var(--good);
}

.check input:checked + span::after {
  content: "✓";
  display: grid;
  place-items: center;
  height: 100%;
  font-size: 11px;
  font-weight: 800;
  color: #06231a;
}

.task-main { flex: 1; min-width: 0; }
.task-title { font-size: 13.2px; line-height: 1.4; word-break: break-word; }
.task-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 3px; font-size: 11.5px; color: var(--dim); }
.task-actions { display: flex; gap: 2px; opacity: 0; transition: opacity 0.15s; }
.task:hover .task-actions, .phase:hover .task-actions { opacity: 1; }
.task-actions .icon-btn { width: 26px; height: 26px; font-size: 12px; }

.add-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 10px;
  margin-top: 4px;
  border: 1px dashed var(--line);
  border-radius: 9px;
  background: transparent;
  color: var(--dim);
  font-size: 12.5px;
  font-weight: 550;
  cursor: pointer;
}

.add-row:hover { color: var(--text); border-color: var(--line); background: var(--panel-2); }

/* --------------------------------------------------------------------- goal */
.goals-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }

.goal {
  padding: 16px;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: linear-gradient(165deg, var(--panel-2), var(--panel));
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.goal.head { border-color: rgba(52, 211, 153, 0.35); }

.goal-top { display: flex; align-items: flex-start; gap: 8px; }
.goal-top h3 { font-size: 14.5px; line-height: 1.35; flex: 1; }
.goal-desc { margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.goal-head-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.goal-numbers { font-size: 13px; color: var(--muted); }
.goal-numbers b { color: var(--text); font-size: 19px; letter-spacing: -0.02em; }
.goal-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.goal-input {
  width: 92px;
  padding: 7px 9px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  outline: none;
  font-size: 13px;
}
.goal-input:focus { border-color: var(--accent); }

.goal-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 11.5px; color: var(--dim); }

/* ----------------------------------------------------------------- timeline */
.gantt { overflow-x: auto; padding-bottom: 4px; }
.gantt-inner { min-width: 640px; position: relative; }

.gantt-scale {
  display: flex;
  align-items: center;
  height: 26px;
  border-bottom: 1px solid var(--line-soft);
  margin-left: 190px;
  position: relative;
  font-size: 10.5px;
  color: var(--dim);
}

.gantt-tick { position: absolute; transform: translateX(-50%); white-space: nowrap; }

.gantt-row { display: flex; align-items: center; min-height: 42px; border-bottom: 1px solid var(--line-soft); }
.gantt-label { width: 190px; flex: none; padding-right: 14px; font-size: 12.5px; }
.gantt-label b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gantt-label span { font-size: 11px; color: var(--dim); }
.gantt-track { position: relative; flex: 1; height: 42px; }

.gantt-bar {
  position: absolute;
  top: 13px;
  height: 16px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--pc, var(--accent)), color-mix(in srgb, var(--pc, var(--accent)) 55%, #fff));
  opacity: 0.9;
  min-width: 6px;
}

.gantt-bar::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.25);
  width: calc(100% - var(--done, 0%));
  left: var(--done, 0%);
}

.gantt-today {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1.5px;
  background: var(--bad);
  opacity: 0.75;
}

.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11.5px; color: var(--dim); margin-top: 12px; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; }

/* ------------------------------------------------------------------- events */
.events { list-style: none; margin: 0; padding: 0; position: relative; }
.events::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 8px;
  bottom: 8px;
  width: 1px;
  background: var(--line);
}

.event { position: relative; display: flex; gap: 14px; padding: 7px 0 7px 26px; }
.event::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 13px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--panel-3);
  border: 1.5px solid var(--line);
}
.event.task::before { border-color: var(--good); }
.event.goal::before { border-color: var(--accent); }
.event.phase::before { border-color: var(--info); }
.event.status::before { border-color: var(--warn); }
.event-text { font-size: 13px; line-height: 1.45; }
.event-time { font-size: 11px; color: var(--dim); margin-top: 2px; }

/* -------------------------------------------------------------------- modal */
.modal[hidden] { display: none; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(4, 7, 12, 0.72);
  backdrop-filter: blur(4px);
  animation: fade 0.12s ease;
}

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.modal-card {
  width: min(560px, 100%);
  max-height: min(88vh, 820px);
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.9);
  animation: pop 0.14s ease;
}

@keyframes pop { from { transform: translateY(6px) scale(0.99); opacity: 0; } to { transform: none; opacity: 1; } }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 0;
}

.modal-head h2 { font-size: 17px; }
.modal-body { padding: 16px 20px 20px; display: grid; gap: 13px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 0 20px 20px; }

.field { display: grid; gap: 6px; }
.field > label { font-size: 12px; font-weight: 600; color: var(--muted); }
.field .hint { font-size: 11.5px; color: var(--dim); }

.field input, .field select, .field textarea {
  width: 100%;
  padding: 9px 11px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  outline: none;
  font-size: 13.5px;
  transition: border-color 0.15s;
}

.field textarea { resize: vertical; min-height: 74px; line-height: 1.5; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

.color-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.swatch { width: 26px; height: 26px; border-radius: 8px; border: 2px solid transparent; cursor: pointer; padding: 0; }
.swatch.on { border-color: #fff; }
.color-row input[type="color"] { width: 40px; height: 30px; padding: 2px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg-soft); cursor: pointer; }

/* -------------------------------------------------------------------- toast */
#toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 20px);
  z-index: 200;
  max-width: min(92vw, 460px);
  padding: 11px 16px;
  border-radius: 11px;
  background: var(--panel-3);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s, transform 0.18s;
}

#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.error { border-color: rgba(248, 113, 113, 0.5); color: #ffc9c9; }
#toast.ok { border-color: rgba(52, 211, 153, 0.5); color: #b8f5dd; }

/* ------------------------------------------------------------------- login */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(380px, 100%);
  padding: 28px;
  background: linear-gradient(165deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.login-card .brand { font-size: 19px; margin-bottom: 6px; }
.login-card .hint { color: var(--muted); font-size: 13px; margin: 8px 0 20px; line-height: 1.5; }
.login-card label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.login-card input {
  width: 100%;
  padding: 11px 13px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  outline: none;
  font-size: 14px;
}
.login-card input:focus { border-color: var(--accent); }
.login-error { min-height: 18px; margin-top: 10px; font-size: 12.5px; color: var(--bad); }
.login-foot { margin-top: 18px; font-size: 11.5px; color: var(--dim); text-align: center; }

/* ------------------------------------------------------------------ footer */
.footer { margin-top: 42px; text-align: center; font-size: 11.5px; color: var(--dim); }
.footer a { color: var(--muted); }

/* --------------------------------------------------------------- responsive */
@media (max-width: 1024px) {
  .layout { grid-template-columns: minmax(0, 1fr) 300px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .layout, .two-col { grid-template-columns: minmax(0, 1fr); }
  .side { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .detail-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-side { margin-left: 0; }
}

@media (max-width: 620px) {
  .topbar { gap: 10px; padding: 12px 16px; }
  .topnav { display: none; }
  .top-actions .btn span { display: none; }
  main { padding-top: 20px; }
  .kpis { gap: 10px; }
  .kpi { padding: 13px 14px; }
  .kpi-value { font-size: 23px; }
  .side { grid-template-columns: minmax(0, 1fr); }
  .detail-head { padding: 17px; }
  .detail-icon { width: 48px; height: 48px; font-size: 22px; }
  .detail-side { width: 100%; justify-content: space-between; }
  .detail-actions { flex-direction: row; }
  .ring { width: 62px; height: 62px; }
  .ring span { font-size: 14px; }
  .field-row, .field-row-3 { grid-template-columns: minmax(0, 1fr); }
  .projects-grid { grid-template-columns: minmax(0, 1fr); }
  .phase-progress { min-width: 0; }
  .task-actions { opacity: 1; }
}
