:root {
  --bg:      #0b0b0d;
  --bg2:     #111115;
  --bg3:     #18181e;
  --bg4:     #1f1f28;
  --border:  rgba(255,255,255,0.07);
  --border2: rgba(255,255,255,0.12);
  --text:    #e8e4dc;
  --muted:   #6a6672;
  --gold:    #f0c060;
  --green:   #3ddc97;
  --red:     #ff6b4a;
  --blue:    #5b9cf6;
  --purple:  #b07cf8;
  --teal:    #40d9c8;
  --sidebar-w: 220px;
  --sidebar-collapsed: 56px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Outfit', sans-serif;
  font-weight: 300;
  font-size: 14px;
  line-height: 1.6;
  overflow-x: hidden;
}

.hidden { display: none !important; }

/* ── LOGIN ─────────────────────────────────────────────────── */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 30% 50%, rgba(240,192,96,0.04) 0%, transparent 60%),
              var(--bg);
}

.login-box {
  width: 360px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 40px;
  animation: fadeUp 0.5s ease both;
}

.login-logo {
  font-family: 'Fraunces', serif;
  font-size: 28px;
  font-weight: 900;
  letter-spacing: -0.03em;
  margin-bottom: 4px;
}

.login-logo span { color: var(--gold); }

.login-sub {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 32px;
}

.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

input[type="text"], input[type="password"], input[type="date"],
input[type="number"], input[type="url"], textarea, select {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 10px 14px;
  color: var(--text);
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

input:focus, textarea:focus, select:focus { border-color: rgba(255,255,255,0.22); }
input::placeholder, textarea::placeholder { color: var(--muted); }
select option { background: var(--bg3); }
textarea { resize: vertical; min-height: 80px; }

.login-error {
  color: var(--red);
  font-size: 12px;
  margin-top: 10px;
  text-align: center;
  min-height: 18px;
}

/* ── APP LAYOUT ─────────────────────────────────────────────── */
.app {
  display: flex;
  min-height: 100vh;
}

/* ── SIDEBAR ─────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: width 0.25s ease;
  overflow: hidden;
}

.sidebar.collapsed { width: var(--sidebar-collapsed); }
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-section-label,
.sidebar.collapsed .user-pill,
.sidebar.collapsed .sidebar-logo { display: none; }
.sidebar.collapsed .sidebar-toggle { transform: rotate(180deg); }

.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo {
  font-family: 'Fraunces', serif;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--gold);
}

.sidebar-toggle {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 10px;
  padding: 4px 7px;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.sidebar-toggle:hover { color: var(--text); border-color: var(--border2); }

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  overflow-y: auto;
  overflow-x: hidden;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 4px;
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 400;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.nav-item:hover { background: var(--bg3); color: var(--text); }
.nav-item.active { background: rgba(240,192,96,0.1); color: var(--gold); }

.nav-icon { font-size: 15px; flex-shrink: 0; width: 20px; text-align: center; }
.nav-dot  { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

.nav-divider { height: 1px; background: var(--border); margin: 8px 0; }

.nav-section-label {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 4px 10px;
  margin-top: 4px;
}

.sidebar-bottom {
  padding: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-pill {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.06em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.logout-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 5px 8px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 13px;
  flex-shrink: 0;
  transition: all 0.2s;
}

.logout-btn:hover { color: var(--red); border-color: rgba(255,107,74,0.3); }

/* ── MAIN ────────────────────────────────────────────────────── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  transition: margin-left 0.25s ease;
  padding: 0;
}

.main.collapsed { margin-left: var(--sidebar-collapsed); }

/* ── VIEWS ───────────────────────────────────────────────────── */
.view { display: none; padding: 36px 40px 80px; animation: fadeUp 0.3s ease both; }
.view.active { display: block; }

.view-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 36px;
  flex-wrap: wrap;
  gap: 16px;
}

.view-eyebrow {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.view-title {
  font-family: 'Fraunces', serif;
  font-size: clamp(24px, 3vw, 38px);
  font-weight: 900;
  letter-spacing: -0.025em;
  line-height: 1;
}

.header-actions { display: flex; align-items: center; gap: 10px; }

.date-badge {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--muted);
  background: var(--bg2);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 3px;
  letter-spacing: 0.06em;
}

.btn-back {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--muted);
  background: none;
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 3px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
  letter-spacing: 0.06em;
}

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

/* ── DASHBOARD CARDS ─────────────────────────────────────────── */
.project-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.proj-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 24px;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.2s;
  position: relative;
  overflow: hidden;
}

.proj-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
}

.proj-card:hover { transform: translateY(-2px); border-color: var(--border2); }

.proj-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
}

.proj-icon { font-size: 26px; line-height: 1; }

.proj-status-badge {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 2px;
  border: 1px solid;
}

.status-active   { color: var(--green);  background: rgba(61,220,151,0.08);  border-color: rgba(61,220,151,0.25); }
.status-paused   { color: var(--gold);   background: rgba(240,192,96,0.08);  border-color: rgba(240,192,96,0.25); }
.status-archived { color: var(--muted);  background: transparent;            border-color: var(--border); }

.proj-name {
  font-family: 'Fraunces', serif;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.proj-tagline { font-size: 13px; color: var(--muted); margin-bottom: 20px; line-height: 1.45; }

.proj-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

.stat-box {
  background: var(--bg3);
  border-radius: 4px;
  padding: 10px;
  text-align: center;
}

.stat-val {
  font-family: 'Fraunces', serif;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1;
  margin-bottom: 3px;
}

.stat-lbl {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.proj-progress-wrap { margin-bottom: 8px; }

.progress-label {
  display: flex;
  justify-content: space-between;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--muted);
  margin-bottom: 5px;
}

.progress-track {
  height: 4px;
  background: var(--bg3);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.6s ease;
}

/* ── TABS ────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 28px;
  overflow-x: auto;
}

.tab {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 12px 20px;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: color 0.2s, border-color 0.2s;
}

.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--gold); }

.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeUp 0.25s ease both; }

.tab-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

/* ── PROSPECTS SUB-TABS (namespaced aparte de .tab para no chocar con el handler global de tabs de proyecto) ── */
.ptab {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 12px 20px;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: color 0.2s, border-color 0.2s;
}
.ptab:hover { color: var(--text); }
.ptab.active { color: var(--text); border-bottom-color: var(--gold); }
.ptab-content { display: none; }
.ptab-content.active { display: block; animation: fadeUp 0.25s ease both; }

.filter-sel {
  width: auto;
  padding: 7px 12px;
  font-size: 12px;
}

/* ── PHASES / ROADMAP ────────────────────────────────────────── */
.phases-list { display: flex; flex-direction: column; gap: 12px; }

.phase-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 5px;
  overflow: hidden;
  transition: border-color 0.2s;
}

.phase-card:hover { border-color: var(--border2); }

.phase-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  cursor: pointer;
}

.phase-status-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-pending     { background: var(--muted); }
.dot-in_progress { background: var(--gold); box-shadow: 0 0 6px rgba(240,192,96,0.5); }
.dot-completed   { background: var(--green); }

.phase-name { font-size: 15px; font-weight: 500; flex: 1; }

.phase-date {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.06em;
}

.phase-actions { display: flex; gap: 6px; }

.phase-body {
  padding: 0 20px 16px;
  border-top: 1px solid var(--border);
}

.phase-tasks-summary {
  display: flex;
  gap: 12px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.phase-task-pill {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  padding: 3px 10px;
  border-radius: 2px;
  border: 1px solid var(--border);
  color: var(--muted);
}

.phase-task-pill.clickable {
  cursor: pointer;
  transition: all 0.2s ease;
}

.phase-task-pill.clickable:hover {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

/* ── KANBAN ──────────────────────────────────────────────────── */
.kanban {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  align-items: start;
}

@media (max-width: 900px) { .kanban { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .kanban { grid-template-columns: 1fr; } }

.kanban-col { min-height: 200px; }

.kanban-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.k-dot { width: 8px; height: 8px; border-radius: 50%; }
.k-todo     { background: var(--muted); }
.k-progress { background: var(--gold); }
.k-done     { background: var(--green); }
.k-blocked  { background: var(--red); }

.k-count {
  margin-left: auto;
  background: var(--bg3);
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 10px;
}

.kanban-cards { display: flex; flex-direction: column; gap: 8px; }

.task-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}

.task-card:hover { border-color: var(--border2); transform: translateX(2px); }

.task-card-title {
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 8px;
  line-height: 1.4;
}

.task-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.priority-badge {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 2px;
  border: 1px solid;
}

.p-critical { color: var(--red);    background: rgba(255,107,74,0.08);  border-color: rgba(255,107,74,0.25); }
.p-high     { color: var(--gold);   background: rgba(240,192,96,0.08);  border-color: rgba(240,192,96,0.25); }
.p-medium   { color: var(--blue);   background: rgba(91,156,246,0.08);  border-color: rgba(91,156,246,0.25); }
.p-low      { color: var(--muted);  background: transparent;            border-color: var(--border); }

.task-due {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--muted);
}

.task-due.overdue { color: var(--red); }

.task-phase-tag {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  color: var(--muted);
  background: var(--bg3);
  padding: 2px 6px;
  border-radius: 2px;
}

/* ── METRICS ─────────────────────────────────────────────────── */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}

.metric-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 18px 16px;
  position: relative;
  transition: border-color 0.2s;
}

.metric-card:hover { border-color: var(--border2); }

.metric-name {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.metric-value {
  font-family: 'Fraunces', serif;
  font-size: 32px;
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 4px;
}

.metric-unit {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--muted);
}

.metric-target {
  margin-top: 10px;
}

.metric-target-label {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  color: var(--muted);
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between;
}

.metric-bar-track {
  height: 3px;
  background: var(--bg3);
  border-radius: 2px;
  overflow: hidden;
}

.metric-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.5s ease;
}

.metric-actions {
  position: absolute;
  top: 10px; right: 10px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s;
}

.metric-card:hover .metric-actions { opacity: 1; }

/* ── GTM ─────────────────────────────────────────────────────── */
.gtm-content { display: flex; flex-direction: column; gap: 20px; }

.gtm-section {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 5px;
  overflow: hidden;
}

.gtm-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--bg3);
  border-bottom: 1px solid var(--border);
}

.gtm-section-title {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.gtm-items { padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; }

.gtm-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 13.5px;
  color: #bdb8b0;
  line-height: 1.5;
}

.gtm-item::before { content: '→'; color: var(--gold); flex-shrink: 0; font-family: 'DM Mono', monospace; margin-top: 1px; }

.gtm-empty {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  padding: 24px;
  letter-spacing: 0.08em;
}

/* ── NOTES ───────────────────────────────────────────────────── */
.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.note-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 16px;
  cursor: pointer;
  transition: border-color 0.2s;
  position: relative;
}

.note-card:hover { border-color: var(--border2); }
.note-card.pinned { border-color: rgba(240,192,96,0.3); }

.note-type-badge {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 2px;
  margin-bottom: 8px;
  display: inline-block;
}

.type-note     { color: var(--muted);   background: var(--bg3); }
.type-decision { color: var(--gold);    background: rgba(240,192,96,0.1); }
.type-insight  { color: var(--blue);    background: rgba(91,156,246,0.1); }
.type-risk     { color: var(--red);     background: rgba(255,107,74,0.1); }
.type-idea     { color: var(--green);   background: rgba(61,220,151,0.1); }

.note-title { font-size: 14px; font-weight: 500; margin-bottom: 6px; }
.note-preview { font-size: 12.5px; color: var(--muted); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.note-pin {
  position: absolute;
  top: 12px; right: 12px;
  font-size: 13px;
  opacity: 0.5;
}

.note-date {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  color: var(--muted);
  margin-top: 10px;
  letter-spacing: 0.06em;
}

/* ── LINKS ───────────────────────────────────────────────────── */
.links-list { display: flex; flex-direction: column; gap: 8px; }

.link-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 12px 16px;
  transition: border-color 0.15s;
}

.link-item:hover { border-color: var(--border2); }

.link-icon { font-size: 16px; flex-shrink: 0; }

.link-info { flex: 1; min-width: 0; }
.link-title { font-size: 13.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.link-url   { font-family: 'DM Mono', monospace; font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.link-cat {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--bg3);
  padding: 2px 8px;
  border-radius: 2px;
  white-space: nowrap;
}

.link-actions { display: flex; gap: 4px; opacity: 0; transition: opacity 0.2s; }
.link-item:hover .link-actions { opacity: 1; }

/* ── BUTTONS ─────────────────────────────────────────────────── */
.btn-primary {
  background: var(--gold);
  color: #000;
  border: none;
  padding: 10px 20px;
  border-radius: 4px;
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  transition: opacity 0.2s;
}

.btn-primary:hover { opacity: 0.88; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-ghost {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 8px 16px;
  border-radius: 4px;
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.btn-ghost:hover { color: var(--text); border-color: var(--border2); }

.btn-sm {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 14px;
  border-radius: 3px;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-sm:hover { border-color: var(--border2); }

.btn-icon {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 3px;
  font-size: 12px;
  transition: all 0.2s;
}

.btn-icon:hover { color: var(--text); background: var(--bg3); }
.btn-icon.danger:hover { color: var(--red); }

/* ── MODAL ───────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.15s ease both;
}

.modal {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 8px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: scaleIn 0.2s ease both;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}

.modal-title { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }

.modal-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
  padding: 2px 6px;
  transition: color 0.2s;
}

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

.modal-body {
  padding: 22px;
  overflow-y: auto;
  flex: 1;
}

.modal-body .field { margin-bottom: 14px; }
.modal-body .field label { display: block; font-family: 'DM Mono', monospace; font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-bottom: 5px; }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 22px;
  border-top: 1px solid var(--border);
}

.modal-footer .btn-primary { width: auto; }

/* ── TOAST ───────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 5px;
  padding: 12px 18px;
  font-size: 13px;
  z-index: 2000;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
  max-width: 320px;
}

.toast.show { opacity: 1; transform: translateY(0); }
.toast.ok   { border-left: 3px solid var(--green); }
.toast.err  { border-left: 3px solid var(--red); }

/* ── EMPTY STATES ────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}

.empty-icon { font-size: 36px; margin-bottom: 12px; opacity: 0.4; }
.empty-text { font-family: 'DM Mono', monospace; font-size: 12px; letter-spacing: 0.1em; }

/* ── ANIMATIONS ──────────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}

/* ── SCROLLBAR ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ── TASK ASSIGNEE ────────────────────────────────────────────── */
.task-assignee {
  font-size: 11px;
  color: var(--muted);
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}

.task-assignee-tag {
  font-size: 11px;
  color: var(--muted);
  background: var(--bg3);
  padding: 1px 6px;
  border-radius: 10px;
  flex-shrink: 0;
}

/* ── PHASE EXPAND ─────────────────────────────────────────────── */
.phase-tasks-expand {
  border-top: 1px solid var(--border);
  margin-top: 12px;
  padding-top: 10px;
}

.phase-task-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.phase-task-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  flex-wrap: wrap;
}
.phase-task-item:hover { background: var(--bg3); border-color: var(--border2); }

.phase-task-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.phase-task-status-dot.dot-todo       { background: var(--muted); }
.phase-task-status-dot.dot-in_progress{ background: var(--gold); }
.phase-task-status-dot.dot-done       { background: var(--green); }
.phase-task-status-dot.dot-blocked    { background: var(--red); }

.phase-task-title {
  flex: 1;
  font-size: 13px;
  color: var(--text);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── PLAYBOOKS ────────────────────────────────────────────────── */
.playbooks-content {
  animation: fadeUp 0.25s ease both;
}

.playbooks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.playbook-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 22px;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.2s;
  position: relative;
}

.playbook-card:hover {
  border-color: var(--border2);
  transform: translateY(-2px);
}

.playbook-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.playbook-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.playbook-card-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s;
}

.playbook-card:hover .playbook-card-actions {
  opacity: 1;
}

.playbook-card-title {
  font-family: 'Fraunces', serif;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
  line-height: 1.3;
}

.playbook-card-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 14px;
}

.playbook-card-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.playbook-tag {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.06em;
  padding: 3px 9px;
  border-radius: 3px;
  background: var(--bg3);
  color: var(--muted);
  border: 1px solid var(--border);
}

/* ── PLAYBOOK VIEWER ──────────────────────────────────────────── */
.playbook-viewer {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 8px;
  overflow: hidden;
  animation: fadeUp 0.2s ease both;
}

.playbook-viewer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background: var(--bg3);
  border-bottom: 1px solid var(--border);
}

.playbook-viewer-title {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.playbook-iframe {
  width: 100%;
  height: 75vh;
  border: none;
  background: #fff;
}

/* ── TASK PROGRESS ────────────────────────────────────────────── */
.task-progress-bar {
  margin-top: 8px;
}

.task-progress-track {
  height: 4px;
  background: var(--bg);
  border-radius: 2px;
  overflow: hidden;
}

.task-progress-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
  background: var(--gold);
}

.task-progress-fill.complete {
  background: var(--green);
}

.task-progress-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  color: var(--muted);
  margin-bottom: 4px;
  letter-spacing: 0.06em;
}

.task-progress-pct {
  font-weight: 600;
  color: var(--gold);
}

.task-progress-pct.complete {
  color: var(--green);
}

/* ── PHASE TASK PROGRESS ──────────────────────────────────────── */
.phase-task-progress {
  width: 60px;
  height: 4px;
  background: var(--bg3);
  border-radius: 2px;
  overflow: hidden;
  flex-shrink: 0;
}

.phase-task-progress-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--gold);
  transition: width 0.4s ease;
}

.phase-task-progress-fill.complete {
  background: var(--green);
}

.phase-task-pct {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  color: var(--muted);
  flex-shrink: 0;
  min-width: 28px;
  text-align: right;
}

/* ── ACTIVITY CHECKLIST (inside modal) ─────────────────────────── */
.activity-section {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.activity-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.activity-section-title {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.activity-progress-summary {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--gold);
  letter-spacing: 0.06em;
}

.activity-progress-summary.complete {
  color: var(--green);
}

.activity-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 300px;
  overflow-y: auto;
  margin-bottom: 10px;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 13px;
  transition: background 0.15s, border-color 0.15s;
}

.activity-item:hover {
  background: var(--bg3);
  border-color: var(--border2);
}

.activity-item.completed .activity-text {
  text-decoration: line-through;
  color: var(--muted);
}

.activity-check {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 2px solid var(--border2);
  background: var(--bg3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
  font-size: 11px;
  color: transparent;
}

.activity-check:hover {
  border-color: var(--gold);
}

.activity-check.checked {
  background: var(--green);
  border-color: var(--green);
  color: #000;
}

.activity-text {
  flex: 1;
  min-width: 0;
  color: var(--text);
  line-height: 1.4;
}

.activity-delete {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  padding: 2px 4px;
  opacity: 0;
  transition: all 0.2s;
  flex-shrink: 0;
}

.activity-item:hover .activity-delete {
  opacity: 1;
}

.activity-delete:hover {
  color: var(--red);
}

.activity-add-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.activity-add-input {
  flex: 1;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px 12px;
  color: var(--text);
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  outline: none;
}

.activity-add-input:focus {
  border-color: rgba(255,255,255,0.22);
}

.activity-add-input::placeholder {
  color: var(--muted);
}

.activity-add-btn {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--gold);
  padding: 8px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
  white-space: nowrap;
}

.activity-add-btn:hover {
  border-color: var(--gold);
  background: rgba(240,192,96,0.1);
}

.activity-bulk-row {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.activity-bulk-btn {
  background: none;
  border: 1px dashed var(--border);
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.06em;
  transition: all 0.2s;
  width: 100%;
  text-align: center;
}

.activity-bulk-btn:hover {
  border-color: var(--border2);
  color: var(--text);
  background: var(--bg3);
}

/* ── PROGRESS MODE SELECTOR ──────────────────────────────────── */
.progress-mode-tabs {
  display: flex;
  gap: 0;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.progress-mode-tab {
  flex: 1;
  padding: 8px 12px;
  background: var(--bg3);
  border: none;
  color: var(--muted);
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.progress-mode-tab:not(:last-child) {
  border-right: 1px solid var(--border);
}

.progress-mode-tab:hover {
  color: var(--text);
}

.progress-mode-tab.active {
  background: rgba(240,192,96,0.12);
  color: var(--gold);
}

/* ── NUMERIC PROGRESS ─────────────────────────────────────────── */
.numeric-progress-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.numeric-progress-row .field {
  margin-bottom: 0;
}

/* ── LEADS PROGRESS TABLE ─────────────────────────────────────── */
#progress-leads-section select {
  font-family: inherit;
  border-radius: 2px;
  background-color: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 2px 4px;
}

#progress-leads-section tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

#progress-leads-section td {
  border-bottom: 1px solid var(--border);
}

#progress-leads-section th {
  font-weight: 600;
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.05em;
}

/* ── RESPONSIVE ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  .view { padding: 20px 16px 60px; }
  .sidebar { width: var(--sidebar-collapsed); }
  .sidebar .nav-label, .sidebar .nav-section-label,
  .sidebar .user-pill, .sidebar .sidebar-logo { display: none; }
  .main { margin-left: var(--sidebar-collapsed); }
  .project-cards { grid-template-columns: 1fr; }
  .numeric-progress-row { grid-template-columns: 1fr; }
  .admin-grid { grid-template-columns: 1fr !important; }
}

/* ── BILLING & EARNINGS STYLES ───────────────────────────────── */
.admin-card {
  transition: transform 0.2s, box-shadow 0.2s;
}
.admin-card:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.earn-card {
  backdrop-filter: blur(8px);
  background: rgba(17, 17, 21, 0.7) !important;
  transition: transform 0.2s, border-color 0.2s;
}
.earn-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.15) !important;
}

.admin-grid form input, .admin-grid form select {
  margin-top: 4px;
}

