/* ── Reset & base ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:       #07080d;
  --surface:  #0f111a;
  --border:   rgba(255,255,255,0.07);
  --text:     #e8eaf0;
  --muted:    #6b7280;
  --accent:   #6366f1;
  --accent2:  #818cf8;
  --green:    #22c55e;
  --amber:    #f59e0b;
  --red:      #ef4444;
  --blue:     #3b82f6;

  --radius:   10px;
  --font-body: 'DM Sans', sans-serif;
  --font-head: 'Syne', sans-serif;
}

html { font-size: 15px; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.6;
  min-height: 100vh;
}

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

/* ── Nav ─────────────────────────────────────────────────────── */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  height: 56px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky; top: 0; z-index: 10;
}

.nav-brand { display: flex; align-items: center; gap: .5rem; }
.brand-mark { font-size: 1.4rem; color: var(--accent2); }
.brand-name { font-family: var(--font-head); font-weight: 700; font-size: 1rem; letter-spacing: .02em; }

.nav-links { display: flex; gap: 1.5rem; }
.nav-link { color: var(--muted); font-size: .875rem; transition: color .2s; }
.nav-link:hover { color: var(--text); text-decoration: none; }

/* ── Dashboard layout ─────────────────────────────────────────── */
.dash {
  max-width: 860px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
  display: flex;
  flex-direction: column;
  gap: 3rem;
}

.dash-section {}

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  gap: 1rem;
}

.section-title {
  font-family: var(--font-head);
  font-size: 1.25rem;
  font-weight: 700;
}

.section-sub {
  color: var(--muted);
  font-size: .875rem;
  margin-top: .25rem;
}

/* ── Goal form ────────────────────────────────────────────────── */
.goal-form {}

.input-row {
  display: flex;
  gap: .75rem;
}

.goal-input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: .75rem 1rem;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: .95rem;
  outline: none;
  transition: border-color .2s;
}
.goal-input:focus { border-color: var(--accent); }
.goal-input::placeholder { color: var(--muted); }

.btn-primary {
  display: flex;
  align-items: center;
  gap: .5rem;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: .75rem 1.25rem;
  border-radius: var(--radius);
  font-family: var(--font-head);
  font-weight: 600;
  font-size: .9rem;
  cursor: pointer;
  transition: background .2s, opacity .2s;
  white-space: nowrap;
}
.btn-primary:hover { background: var(--accent2); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: .45rem .9rem;
  border-radius: var(--radius);
  font-size: .85rem;
  cursor: pointer;
  transition: border-color .2s, color .2s;
}
.btn-ghost:hover { border-color: var(--accent); color: var(--text); }

.btn-sm { padding: .45rem .9rem; font-size: .85rem; }

.form-error {
  color: var(--red);
  font-size: .85rem;
  margin-top: .5rem;
}

.hidden { display: none !important; }

/* ── Spinner ──────────────────────────────────────────────────── */
.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Goal cards ───────────────────────────────────────────────── */
.goal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.goal-card:last-child { margin-bottom: 0; }

.goal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: .75rem;
}

.goal-meta { display: flex; align-items: center; gap: .75rem; }

.badge {
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: .2em .6em;
  border-radius: 4px;
}
.badge-pending   { background: rgba(107,114,128,.2); color: var(--muted); }
.badge-processing{ background: rgba(59,130,246,.15); color: var(--blue); }
.badge-done      { background: rgba(34,197,94,.15);  color: var(--green); }
.badge-error     { background: rgba(239,68,68,.15);  color: var(--red); }

.task-count { font-size: .8rem; color: var(--muted); }

.goal-date { font-size: .8rem; color: var(--muted); }

.goal-text {
  font-size: .95rem;
  margin-bottom: 1rem;
  line-height: 1.5;
}

/* ── Task list ────────────────────────────────────────────────── */
.tasks-list {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.task-generating {
  display: flex;
  align-items: center;
  gap: .6rem;
  color: var(--muted);
  font-size: .85rem;
  padding: .75rem 0;
}

.pulse-dot {
  width: 8px; height: 8px;
  background: var(--blue);
  border-radius: 50%;
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .4; transform: scale(.8); }
}

.task-error { color: var(--red); font-size: .85rem; padding: .5rem 0; }

.task-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: .75rem;
  background: rgba(255,255,255,.025);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: border-color .2s;
}
.task-item:hover { border-color: rgba(255,255,255,.14); }

.task-left {
  display: flex;
  align-items: flex-start;
  gap: .65rem;
  flex: 1;
  min-width: 0;
}

.priority-pip {
  flex-shrink: 0;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-top: .45rem;
}
.priority-high   .priority-pip { background: var(--red); }
.priority-medium .priority-pip { background: var(--amber); }
.priority-low    .priority-pip { background: var(--green); }

.task-text {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  min-width: 0;
}

.task-title {
  font-size: .9rem;
  font-weight: 500;
  line-height: 1.4;
}

.task-desc {
  font-size: .8rem;
  color: var(--muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.task-right {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-shrink: 0;
}

.assignee-badge {
  font-size: .75rem;
  background: rgba(99,102,241,.15);
  color: var(--accent2);
  padding: .15em .6em;
  border-radius: 4px;
  font-weight: 500;
}

.task-status-select {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: .78rem;
  padding: .25rem .5rem;
  border-radius: 6px;
  cursor: pointer;
  font-family: var(--font-body);
}
.task-status-select:focus { outline: none; border-color: var(--accent); }

/* ── Add member form ──────────────────────────────────────────── */
.add-member-form {
  display: flex;
  gap: .75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.field {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: .55rem .85rem;
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: .875rem;
  outline: none;
  transition: border-color .2s;
}
.field:focus { border-color: var(--accent); }
.field::placeholder { color: var(--muted); }
#member-capacity { width: 110px; }

/* ── Team grid ────────────────────────────────────────────────── */
.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: .75rem;
}

.team-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.team-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: .95rem;
}

.team-info { display: flex; flex-direction: column; gap: .1rem; }
.team-name  { font-weight: 600; font-size: .9rem; }
.team-role  { font-size: .8rem; color: var(--muted); }

.capacity-bar-wrap {
  height: 4px;
  background: rgba(255,255,255,.08);
  border-radius: 2px;
  overflow: hidden;
}
.capacity-bar {
  height: 100%;
  background: var(--accent2);
  border-radius: 2px;
  transition: width .4s;
}
.capacity-label { font-size: .75rem; color: var(--muted); }

/* ── Empty state ──────────────────────────────────────────────── */
.empty-state {
  color: var(--muted);
  font-size: .875rem;
  padding: 1.5rem 0;
  text-align: center;
}
.empty-state.error { color: var(--red); }

/* ── Landing page styles (used by layout.ejs) ─────────────────── */
.nav .status-dot {
  width: 7px; height: 7px;
  background: var(--green);
  border-radius: 50%;
}
.nav .status-text { font-size: .8rem; color: var(--muted); }
.nav .nav-status { display: flex; align-items: center; gap: .4rem; }
