*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --red: #cc2222;
  --red-dim: #991a1a;
  --red-glow: rgba(204,34,34,0.15);
  --bg: #0f0f0f;
  --surface: #161616;
  --surface2: #1e1e1e;
  --surface3: #252525;
  --border: #2a2a2a;
  --border2: #333;
  --text: #e8e8e8;
  --muted: #666;
  --muted2: #888;
  --green: #27ae60;
  --green-bg: rgba(39,174,96,0.12);
  --yellow: #e6a817;
  --yellow-bg: rgba(230,168,23,0.12);
  --font: 'JetBrains Mono', 'Fira Code', monospace;
  --radius: 8px;
  --nav-h: 60px;
}

html, body { height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; overscroll-behavior: none; }

/* ── MOBILE LAYOUT ── */
#app { max-width: 430px; margin: 0 auto; height: 100dvh; display: flex; flex-direction: column; position: relative; overflow: hidden; }
.header { background: var(--surface); border-bottom: 1px solid var(--border); padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; z-index: 10; }
.main { flex: 1; overflow-y: auto; overflow-x: hidden; padding-bottom: calc(var(--nav-h) + 16px); -webkit-overflow-scrolling: touch; }
.nav { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 430px; height: var(--nav-h); background: var(--surface); border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-around; z-index: 100; padding-bottom: env(safe-area-inset-bottom); }

/* ── DESKTOP LAYOUT ── */
@media (min-width: 900px) {
  body { background: #0a0a0a; }
  #app { max-width: 100%; height: 100dvh; flex-direction: row; }
  .header { display: none; }
  .nav { position: relative; left: unset; transform: none; width: 220px; height: 100dvh; max-width: 220px; flex-direction: column; justify-content: flex-start; border-top: none; border-right: 1px solid var(--border); padding: 24px 0; gap: 4px; }
  .nav-item { width: 100%; justify-content: flex-start; padding: 10px 20px; gap: 10px; border-radius: 0; font-size: 12px; }
  .nav-item svg { width: 18px; height: 18px; }
  .nav-item span { display: block; font-size: 12px; letter-spacing: 1px; }
  .nav-brand { padding: 0 20px 20px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
  .nav-brand-title { color: var(--red); font-size: 13px; font-weight: 700; letter-spacing: 2px; display: flex; align-items: center; gap: 8px; }
  .nav-brand-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); }
  .main { flex: 1; padding-bottom: 0; max-width: calc(100% - 220px); }
  .page { max-width: 800px; padding: 24px 32px; }
  .widgets { grid-template-columns: repeat(4, 1fr); }
  .widget-wide { grid-column: 1 / -1; }
  .desktop-cfg { display: flex; align-items: center; gap: 8px; padding: 20px; margin-top: auto; border-top: 1px solid var(--border); cursor: pointer; color: var(--muted); font-size: 12px; transition: color 0.15s; }
  .desktop-cfg:hover { color: var(--text); }
}

@media (max-width: 899px) {
  .nav-brand { display: none; }
  .desktop-cfg { display: none; }
}

.header-logo { display: flex; align-items: center; gap: 8px; }
.header-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); }
.header-title { color: var(--red); font-size: 13px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; }
.btn-icon { background: none; border: none; color: var(--muted2); cursor: pointer; padding: 4px; font-size: 18px; line-height: 1; transition: color 0.15s; }
.btn-icon:hover { color: var(--text); }

.page { display: none; padding: 16px; }
.page.active { display: block; }

.nav-item { display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer; padding: 6px 12px; border-radius: var(--radius); transition: all 0.15s; color: var(--muted); background: none; border: none; font-family: var(--font); }
.nav-item span { font-size: 9px; letter-spacing: 1px; text-transform: uppercase; }
.nav-item svg { width: 20px; height: 20px; }
.nav-item.active { color: var(--red); }

.section-label { font-size: 10px; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; margin-top: 20px; }
.section-label:first-child { margin-top: 0; }

/* WIDGETS */
.widgets { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 4px; }
.widget { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; }
.widget-label { font-size: 10px; color: var(--muted); margin-bottom: 4px; letter-spacing: 1px; }
.widget-value { font-size: 22px; font-weight: 700; color: var(--text); }
.widget-value span { font-size: 12px; color: var(--muted); font-weight: 400; }
.widget-sub { font-size: 11px; color: var(--muted2); margin-top: 2px; }
.widget-wide { grid-column: 1 / -1; }

/* FIRE STREAK */
.streak-display { display: flex; align-items: center; gap: 8px; }
.fire-icon { font-size: 28px; animation: fireFlicker 1.5s ease-in-out infinite alternate; display: inline-block; transform-origin: bottom center; filter: drop-shadow(0 0 6px rgba(255,100,0,0.6)); }
@keyframes fireFlicker { 0% { transform: scaleY(1) rotate(-2deg); filter: drop-shadow(0 0 6px rgba(255,100,0,0.6)); } 50% { transform: scaleY(1.08) rotate(1deg); filter: drop-shadow(0 0 10px rgba(255,150,0,0.8)); } 100% { transform: scaleY(0.95) rotate(2deg); filter: drop-shadow(0 0 8px rgba(255,80,0,0.7)); } }

/* PROGRESS BAR */
.progress-bar { background: var(--border); border-radius: 4px; height: 3px; margin-top: 8px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 4px; background: var(--red); transition: width 0.5s ease; }

/* CARDS */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; margin-bottom: 8px; cursor: pointer; transition: border-color 0.15s; }
.card:hover { border-color: var(--border2); }
.card:last-child { margin-bottom: 0; }
.card-row { display: flex; align-items: center; justify-content: space-between; }
.card-title { font-size: 13px; color: var(--text); font-weight: 500; }
.card-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.card-meta { font-size: 11px; color: var(--muted2); }

/* BADGES */
.badge { font-size: 10px; padding: 3px 8px; border-radius: 4px; font-weight: 500; letter-spacing: 0.5px; white-space: nowrap; }
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-yellow { background: var(--yellow-bg); color: var(--yellow); }
.badge-red { background: var(--red-glow); color: var(--red); }
.badge-gray { background: var(--surface3); color: var(--muted2); }

.dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.dot-red { background: var(--red); }
.dot-green { background: var(--green); }
.dot-gray { background: var(--muted); }
.dot-yellow { background: var(--yellow); }

.divider { border: none; border-top: 1px solid var(--border); margin: 12px 0; }

/* COPY BTN */
.btn-copy { background: var(--surface2); border: 1px solid var(--border); color: var(--muted2); border-radius: var(--radius); padding: 6px 12px; font-family: var(--font); font-size: 11px; cursor: pointer; transition: all 0.15s; display: flex; align-items: center; gap: 6px; margin-top: 8px; width: 100%; justify-content: center; }
.btn-copy:hover { border-color: var(--red); color: var(--red); }
.btn-copy.copied { border-color: var(--green); color: var(--green); }

/* BACKLOG */
.linkedin-text { background: var(--surface3); border-radius: var(--radius); padding: 12px; font-size: 12px; color: var(--muted2); line-height: 1.7; white-space: pre-wrap; margin-top: 10px; border: 1px solid var(--border); display: none; }
.linkedin-textarea { background: var(--surface3); border-radius: var(--radius); padding: 12px; font-size: 12px; color: var(--text); line-height: 1.7; margin-top: 10px; border: 1px solid var(--border); width: 100%; min-height: 120px; font-family: var(--font); resize: vertical; outline: none; display: none; }
.linkedin-textarea:focus { border-color: var(--red); }
.card.expanded .linkedin-text, .card.expanded .linkedin-textarea { display: block; }
.backlog-actions { display: flex; gap: 6px; margin-top: 8px; }
.backlog-actions .btn-copy { flex: 1; margin-top: 0; }
.btn-edit { background: var(--surface2); border: 1px solid var(--border); color: var(--muted2); border-radius: var(--radius); padding: 6px 12px; font-family: var(--font); font-size: 11px; cursor: pointer; transition: all 0.15s; }
.btn-edit:hover { border-color: var(--yellow); color: var(--yellow); }
.btn-edit.editing { border-color: var(--green); color: var(--green); }

/* FILTER TABS */
.tabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.tab { background: var(--surface); border: 1px solid var(--border); color: var(--muted); border-radius: var(--radius); padding: 5px 12px; font-family: var(--font); font-size: 11px; cursor: pointer; letter-spacing: 0.5px; transition: all 0.15s; }
.tab.active { border-color: var(--red); color: var(--red); background: var(--red-glow); }

/* ROADMAP */
.roadmap-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.roadmap-table th { text-align: left; color: var(--muted); font-size: 10px; letter-spacing: 1px; text-transform: uppercase; padding: 6px 8px; border-bottom: 1px solid var(--border); font-weight: 400; }
.roadmap-table td { padding: 8px; border-bottom: 1px solid var(--border); color: var(--text); vertical-align: top; cursor: pointer; }
.roadmap-table tr:last-child td { border-bottom: none; }
.roadmap-table tr:hover td { background: var(--surface2); }

/* COMPENDIO */
.cert-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 10px; cursor: pointer; transition: border-color 0.15s; display: flex; align-items: center; justify-content: space-between; }
.cert-card:hover { border-color: var(--red); }
.cert-card-title { font-size: 14px; color: var(--text); font-weight: 500; }
.cert-card-sub { font-size: 11px; color: var(--muted); margin-top: 3px; }
.compendio-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 8px; overflow: hidden; }
.compendio-header { padding: 12px; display: flex; align-items: center; justify-content: space-between; cursor: pointer; }
.compendio-num { font-size: 11px; color: var(--red); margin-right: 8px; font-weight: 700; }
.compendio-title { font-size: 13px; color: var(--text); flex: 1; }
.compendio-body { display: none; padding: 0 12px 12px; border-top: 1px solid var(--border); }
.compendio-item.expanded .compendio-body { display: block; }
.subtema { font-size: 11px; color: var(--muted2); padding: 4px 0; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 6px; }
.subtema:last-child { border-bottom: none; }
.subtema::before { content: '›'; color: var(--red); }
.back-btn { background: none; border: none; color: var(--muted2); font-family: var(--font); font-size: 12px; cursor: pointer; padding: 0; margin-bottom: 14px; display: flex; align-items: center; gap: 6px; transition: color 0.15s; }
.back-btn:hover { color: var(--red); }

/* NOTAS */
.nota-card { border-radius: var(--radius); padding: 12px; margin-bottom: 8px; border: 1px solid var(--border); position: relative; }
.nota-card.pinned { border-color: var(--red); }
.nota-card.archived { opacity: 0.5; }
.nota-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.nota-tag { font-size: 10px; padding: 2px 8px; border-radius: 4px; }
.nota-actions { display: flex; gap: 8px; }
.nota-action-btn { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 14px; padding: 2px; transition: color 0.15s; }
.nota-action-btn:hover { color: var(--text); }
.nota-content { font-size: 13px; line-height: 1.6; outline: none; min-height: 40px; white-space: pre-wrap; word-break: break-word; }
.nota-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.nota-date { font-size: 10px; color: var(--muted); }
.nota-size-sm .nota-content { font-size: 11px; }
.nota-size-md .nota-content { font-size: 13px; }
.nota-size-lg .nota-content { font-size: 16px; }
.color-picker { display: flex; gap: 6px; flex-wrap: wrap; }
.color-dot { width: 18px; height: 18px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; transition: border-color 0.15s; flex-shrink: 0; }
.color-dot.selected { border-color: var(--text); }

/* MODAL */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.8); z-index: 200; display: none; align-items: flex-end; justify-content: center; }
.modal-overlay.open { display: flex; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 16px 16px 0 0; width: 100%; max-width: 430px; max-height: 85dvh; overflow-y: auto; padding: 20px 16px; padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
@media (min-width: 900px) { .modal { border-radius: 16px; max-width: 480px; margin: auto; } .modal-overlay.open { align-items: center; } }
.modal-title { font-size: 14px; color: var(--red); letter-spacing: 1px; text-transform: uppercase; margin-bottom: 16px; font-weight: 700; }
.form-group { margin-bottom: 12px; }
.form-label { font-size: 10px; color: var(--muted); letter-spacing: 1px; text-transform: uppercase; margin-bottom: 4px; display: block; }
.form-input, .form-select, .form-textarea { width: 100%; background: var(--surface3); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); font-family: var(--font); font-size: 13px; padding: 8px 10px; outline: none; transition: border-color 0.15s; }
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--red); }
.form-textarea { min-height: 100px; resize: vertical; }
.form-select option { background: var(--surface3); }
.btn-primary { background: var(--red); border: none; color: #fff; border-radius: var(--radius); padding: 10px 20px; font-family: var(--font); font-size: 13px; cursor: pointer; width: 100%; font-weight: 700; letter-spacing: 0.5px; transition: background 0.15s; margin-top: 4px; }
.btn-primary:hover { background: var(--red-dim); }
.btn-secondary { background: none; border: 1px solid var(--border); color: var(--muted2); border-radius: var(--radius); padding: 10px 20px; font-family: var(--font); font-size: 13px; cursor: pointer; width: 100%; transition: all 0.15s; margin-top: 6px; }
.btn-secondary:hover { border-color: var(--border2); color: var(--text); }

/* COUNTDOWN */
.countdown { display: flex; gap: 6px; margin-top: 6px; }
.countdown-unit { text-align: center; flex: 1; }
.countdown-num { font-size: 18px; font-weight: 700; color: var(--red); display: block; }
.countdown-label { font-size: 9px; color: var(--muted); letter-spacing: 1px; text-transform: uppercase; }

/* CELEBRATION */
.celebration-overlay { position: fixed; inset: 0; pointer-events: none; z-index: 500; }
.confetti-piece { position: absolute; width: 8px; height: 8px; opacity: 0; animation: confettiFall 2s ease-in forwards; }
@keyframes confettiFall { 0% { opacity: 1; transform: translateY(-20px) rotate(0deg); } 100% { opacity: 0; transform: translateY(100vh) rotate(720deg); } }
.resolve-burst { position: fixed; inset: 0; pointer-events: none; z-index: 400; display: flex; align-items: center; justify-content: center; }
.resolve-text { font-size: 48px; animation: burstAnim 0.8s ease-out forwards; opacity: 0; }
@keyframes burstAnim { 0% { opacity: 0; transform: scale(0.5); } 40% { opacity: 1; transform: scale(1.3); } 70% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(1.1); } }

/* EMPTY */
.empty { text-align: center; padding: 40px 20px; color: var(--muted); font-size: 12px; }

/* SCROLLBAR */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; }

/* TOAST */
.toast { position: fixed; top: 20px; left: 50%; transform: translateX(-50%) translateY(-80px); background: var(--surface2); border: 1px solid var(--green); color: var(--green); padding: 8px 16px; border-radius: var(--radius); font-size: 12px; z-index: 999; transition: transform 0.3s ease; white-space: nowrap; }
.toast.show { transform: translateX(-50%) translateY(0); }

/* ── CALENDARIO ── */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 16px; }
.cal-header { text-align: center; font-size: 10px; color: var(--muted); padding: 4px 0; letter-spacing: 1px; }
.cal-day { aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: var(--radius); font-size: 11px; cursor: pointer; transition: all 0.15s; position: relative; border: 1px solid transparent; }
.cal-day:hover { border-color: var(--border2); }
.cal-day.today { border-color: var(--red); color: var(--red); font-weight: 700; }
.cal-day.has-event { background: var(--red-glow); }
.cal-day.has-event::after { content: ''; width: 4px; height: 4px; border-radius: 50%; background: var(--red); position: absolute; bottom: 3px; }
.cal-day.overdue { background: rgba(204,34,34,0.25); }
.cal-day.empty { cursor: default; }
.cal-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cal-nav-btn { background: none; border: 1px solid var(--border); color: var(--muted2); border-radius: var(--radius); padding: 4px 10px; font-family: var(--font); font-size: 12px; cursor: pointer; transition: all 0.15s; }
.cal-nav-btn:hover { border-color: var(--red); color: var(--red); }
.cal-month { font-size: 13px; color: var(--text); font-weight: 500; }
.event-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 6px; display: flex; align-items: center; justify-content: space-between; }
.event-item.overdue { border-color: var(--red); }
.event-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--red); flex-shrink: 0; margin-right: 8px; }
.event-dot.done { background: var(--green); }

/* PROYECTOS CATS */
.proj-cat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 8px; overflow: hidden; }
.proj-cat-header { padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; cursor: pointer; transition: background 0.15s; }
.proj-cat-header:hover { background: var(--surface2); }
.proj-cat-title { font-size: 13px; color: var(--text); font-weight: 500; }
.proj-cat-count { font-size: 10px; color: var(--muted); }
.proj-cat-body { display: none; border-top: 1px solid var(--border); }
.proj-cat.expanded .proj-cat-body { display: block; }
.proj-lab { padding: 10px 14px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); cursor: pointer; transition: background 0.15s; }
.proj-lab:last-child { border-bottom: none; }
.proj-lab:hover { background: var(--surface2); }
.proj-lab-name { font-size: 12px; color: var(--text); }
.proj-lab-nota { font-size: 10px; color: var(--muted); margin-top: 2px; }

/* PORTSWIGGER */
.ps-stats { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-bottom: 16px; }
.ps-stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; text-align: center; }
.ps-stat-num { font-size: 20px; font-weight: 700; color: var(--red); }
.ps-stat-label { font-size: 10px; color: var(--muted); letter-spacing: 1px; }
.ps-cat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 8px; overflow: hidden; }
.ps-cat-header { padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; cursor: pointer; transition: background 0.15s; }
.ps-cat-header:hover { background: var(--surface2); }
.ps-cat-title { font-size: 13px; color: var(--text); font-weight: 500; flex: 1; }
.ps-cat-prog { font-size: 10px; color: var(--muted); margin-right: 8px; }
.ps-cat-body { display: none; border-top: 1px solid var(--border); }
.ps-cat.expanded .ps-cat-body { display: block; }
.ps-lab { padding: 9px 14px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background 0.15s; }
.ps-lab:last-child { border-bottom: none; }
.ps-lab:hover { background: var(--surface2); }
.ps-lab-check { width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--border2); flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 10px; transition: all 0.15s; }
.ps-lab.done .ps-lab-check { background: var(--green); border-color: var(--green); color: #fff; }
.ps-lab-name { font-size: 11px; color: var(--text); flex: 1; line-height: 1.4; }
.ps-lab.done .ps-lab-name { color: var(--muted); text-decoration: line-through; }
.nivel-a { color: var(--green); font-size: 9px; }
.nivel-p { color: var(--yellow); font-size: 9px; }
.nivel-e { color: var(--red); font-size: 9px; }
