/* ══════════════════════════════════════════════════════
   FUENTES
══════════════════════════════════════════════════════ */
@font-face {
  font-family: 'Geist';
  src: url('https://cdn.jsdelivr.net/npm/geist@1/dist/fonts/geist-sans/Geist-Regular.woff2') format('woff2');
  font-weight: 400; font-display: swap;
  size-adjust: 100%;
}
@font-face {
  font-family: 'Geist';
  src: url('https://cdn.jsdelivr.net/npm/geist@1/dist/fonts/geist-sans/Geist-Medium.woff2') format('woff2');
  font-weight: 500; font-display: swap;
  size-adjust: 100%;
}
@font-face {
  font-family: 'Geist';
  src: url('https://cdn.jsdelivr.net/npm/geist@1/dist/fonts/geist-sans/Geist-SemiBold.woff2') format('woff2');
  font-weight: 600; font-display: swap;
  size-adjust: 100%;
}
@font-face {
  font-family: 'Geist';
  src: url('https://cdn.jsdelivr.net/npm/geist@1/dist/fonts/geist-sans/Geist-Bold.woff2') format('woff2');
  font-weight: 700; font-display: swap;
  size-adjust: 100%;
}
@font-face {
  font-family: 'Geist Mono';
  src: url('https://cdn.jsdelivr.net/npm/geist@1/dist/fonts/geist-mono/GeistMono-Regular.woff2') format('woff2');
  font-weight: 400; font-display: swap;
  size-adjust: 100%;
}
@font-face {
  font-family: 'Geist Mono';
  src: url('https://cdn.jsdelivr.net/npm/geist@1/dist/fonts/geist-mono/GeistMono-Medium.woff2') format('woff2');
  font-weight: 500; font-display: swap;
  size-adjust: 100%;
}

/* ══════════════════════════════════════════════════════
   TOKENS GLOBALES
══════════════════════════════════════════════════════ */
:root {
  /* Paleta corporativa */
  --accent:        #FF6B35;
  --accent-dk:     #CC4A1A;
  --ink:           #0A0A0A;
  --paper:         #FAFAF7;
  --bone:          #F0F0EB;
  --rule:          #E4E4DF;
  --mute:          #7A7A75;
  --surface:       #FFFFFF;
  --surface-raise: #F7F7F4;

  /* Semánticos — estos son los que cambia el dark mode */
  --bg:            var(--paper);
  --bg-card:       var(--surface);
  --bg-input:      var(--bone);
  --text-1:        var(--ink);
  --text-2:        var(--mute);
  --border:        var(--rule);

  /* Tipografía */
  --sans: 'Geist', system-ui, -apple-system, sans-serif;
  --mono: 'Geist Mono', 'SF Mono', monospace;

  /* Escala tipográfica fluida */
  --text-xs:   clamp(0.6875rem, 1.8vw, 0.75rem);
  --text-sm:   clamp(0.75rem,   2vw,   0.875rem);
  --text-base: clamp(0.875rem,  2.5vw, 1rem);
  --text-lg:   clamp(1rem,      3vw,   1.125rem);
  --text-xl:   clamp(1.125rem,  3.5vw, 1.375rem);

  /* Espaciado base 4px */
  --sp-1:  4px;
  --sp-2:  8px;
  --sp-3:  12px;
  --sp-4:  16px;
  --sp-5:  20px;
  --sp-6:  24px;
  --sp-8:  32px;
  --sp-12: 48px;

  /* Radios */
  --r-sm:   6px;
  --r-md:   10px;
  --r-lg:   16px;
  --r-xl:   20px;
  --r-full: 999px;

  /* Sombras */
  --shadow-sm: 0 1px 3px rgba(10,10,10,0.07);
  --shadow-md: 0 4px 16px rgba(10,10,10,0.10);

  /* Transiciones */
  --t-fast:   150ms cubic-bezier(0.4, 0, 0.2, 1);
  --t-smooth: 260ms cubic-bezier(0.4, 0, 0.2, 1);
  --t-spring: 380ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Z-index semántico */
  --z-base:    1;
  --z-header:  10;
  --z-nav:     20;
  --z-modal:   100;
  --z-toast:   200;

  /* Dimensiones del shell */
  --nav-h:    60px;
  --head-h:   56px;
  --top-h:    40px;
  --safe-b:   env(safe-area-inset-bottom, 0px);
  --safe-t:   env(safe-area-inset-top, 0px);
  --safe-l:   env(safe-area-inset-left, 0px);
  --safe-r:   env(safe-area-inset-right, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:            #0A0A0A;
    --bg-card:       #1A1A18;
    --bg-input:      #242420;
    --text-1:        #FAFAF7;
    --text-2:        #888884;
    --border:        #2E2E2A;
    --surface:       #1A1A18;
    --surface-raise: #242420;
    --bone:          #242420;
    --rule:          #2E2E2A;
    --mute:          #888884;
  }

  .pill-doing,
  .pill-urgente,
  .pill-activo { background: rgba(255,107,53,0.15); color: var(--accent); }

  .pill-done,
  .pill-cerrado { background: rgba(26,122,74,0.18); color: #4ade80; }

  .pill-todo,
  .pill-pendiente { background: #2A2A28; color: var(--text-2); }

  .chip.active { background: var(--text-1); color: var(--bg); }
}

/* ══════════════════════════════════════════════════════
   RESET
══════════════════════════════════════════════════════ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 105%; /* +5% escala global */
}

html, body {
  height: 100%;
  width: 100%;
  background: var(--bg);
  color: var(--text-1);
  font-family: var(--sans);
  font-size: var(--text-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
  overscroll-behavior: none;
}

button {
  font-family: var(--sans);
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  touch-action: manipulation;
}

button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

a { color: inherit; }

img, svg { display: block; }

/* ══════════════════════════════════════════════════════
   LOGIN
══════════════════════════════════════════════════════ */
#login-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100dvh;
  padding: var(--sp-8) var(--sp-6);
  background: var(--ink);
  padding-top: calc(var(--sp-8) + var(--safe-t));
}

.login-logo {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-12);
}
.login-logo .iso { width: 36px; height: 36px; }
.login-logo .wm {
  font-size: 28px;
  font-weight: 700;
  color: white;
  letter-spacing: -0.02em;
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border-radius: var(--r-xl);
  padding: var(--sp-6) var(--sp-5);
}
.login-card h2 {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-1);
  margin-bottom: var(--sp-5);
}

.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-2);
  margin-bottom: var(--sp-1);
}
.field input {
  width: 100%;
  height: 44px;
  border-radius: var(--r-md);
  border: 1.5px solid var(--border);
  background: var(--bg-input);
  font-family: var(--sans);
  font-size: var(--text-base);
  color: var(--text-1);
  padding: 0 var(--sp-3);
  outline: none;
  transition: border-color var(--t-fast);
}
.field input:focus { border-color: var(--accent); }

.btn-login {
  width: 100%;
  height: 48px;
  border-radius: var(--r-md);
  background: var(--accent);
  color: white;
  font-size: var(--text-base);
  font-weight: 700;
  margin-top: var(--sp-2);
  transition: background var(--t-fast), transform var(--t-fast);
}
.btn-login:hover  { background: var(--accent-dk); }
.btn-login:active { transform: scale(0.98); }
.btn-login:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.login-error {
  font-family: var(--mono);
  font-size: 11px;
  color: #c0392b;
  text-align: center;
  margin-top: var(--sp-2);
  min-height: 16px;
}

/* ══════════════════════════════════════════════════════
   APP SHELL
══════════════════════════════════════════════════════ */
#app-screen {
  display: none;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
  /* position fixed: iOS no reajusta el layout cuando sube el teclado */
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100%;
}
#app-screen.visible { display: flex; }

/* Fallback para navegadores sin dvh */
@supports not (height: 100dvh) {
  #app-screen { height: 100vh; }
}

.screens-wrap {
  flex: 1;
  display: flex;
  flex-direction: row;
  min-height: 0;
  overflow: hidden;
}

/* ══════════════════════════════════════════════════════
   HEADER
══════════════════════════════════════════════════════ */
.app-header {
  height: var(--head-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--sp-5);
  z-index: var(--z-header);
  flex-shrink: 0;
  padding-left: calc(var(--sp-5) + var(--safe-l));
  padding-right: calc(var(--sp-5) + var(--safe-r));
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  user-select: none;
}
.logo .iso { width: 24px; height: 24px; flex-shrink: 0; }
.logo .wm {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: -0.02em;
  line-height: 1;
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  height: 34px;
  padding: 0 var(--sp-3);
  border-radius: var(--r-sm);
  background: var(--accent);
  color: white;
  font-size: 13px;
  font-weight: 600;
  transition: background var(--t-fast), transform var(--t-fast);
  touch-action: manipulation;
  min-width: 44px;
}
.btn-primary:hover  { background: var(--accent-dk); }
.btn-primary:active { transform: scale(0.96); }

.avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
  touch-action: manipulation;
  transition: opacity var(--t-fast);
  min-width: 44px;
  min-height: 44px;
}
.avatar:active { opacity: 0.7; }

/* ══════════════════════════════════════════════════════
   TOP TABS
══════════════════════════════════════════════════════ */
.top-tabs {
  height: var(--top-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-shrink: 0;
  padding: 0 var(--sp-1);
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  /* Máscara de gradiente para indicar overflow */
  -webkit-mask-image: linear-gradient(to right, transparent 0px, black 12px, black calc(100% - 12px), transparent 100%);
  mask-image: linear-gradient(to right, transparent 0px, black 12px, black calc(100% - 12px), transparent 100%);
}
.top-tabs::-webkit-scrollbar { display: none; }

.top-tab {
  flex-shrink: 0;
  padding: 0 var(--sp-4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: none;
  color: var(--text-2);
  position: relative;
  touch-action: manipulation;
  transition: color var(--t-fast);
  min-height: 44px;
  white-space: nowrap;
}
.top-tab:active { opacity: 0.7; }
.top-tab.active { color: var(--accent); }
.top-tab.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 20%;
  right: 20%;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
}

/* ══════════════════════════════════════════════════════
   BOTTOM NAV
══════════════════════════════════════════════════════ */
.bottom-nav {
  height: calc(var(--nav-h) + var(--safe-b));
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  padding-top: var(--sp-2);
  padding-bottom: var(--safe-b);
  padding-left: var(--safe-l);
  padding-right: var(--safe-r);
  flex-shrink: 0;
  z-index: var(--z-nav);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: var(--sp-1) 0;
  touch-action: manipulation;
  transition: opacity var(--t-fast);
  min-height: 44px;
  user-select: none;
}
.nav-item:active { opacity: 0.6; }

.nav-label {
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: none;
}

.nav-item.active svg,
.nav-item.active .nav-label { color: var(--accent); }
.nav-item:not(.active) svg,
.nav-item:not(.active) .nav-label { color: var(--text-2); }

/* ══════════════════════════════════════════════════════
   SCREENS
══════════════════════════════════════════════════════ */
.screen {
  display: none;
  flex-direction: column;
  flex: 1 0 100%;
  min-height: 0;
}
.screen.active { display: flex; }

.sub-screen {
  display: none;
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  padding-bottom: var(--sp-4);
  scrollbar-width: none;
}
.sub-screen::-webkit-scrollbar { display: none; }
.sub-screen.active { display: block; }

/* ══════════════════════════════════════════════════════
   TOKENS DE COMPONENTES
══════════════════════════════════════════════════════ */
.section-label {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-2);
  padding: 18px var(--sp-5) var(--sp-2);
  position: sticky;
  top: 0;
  background: var(--bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: var(--z-base);
}

.card {
  background: var(--bg-card);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  padding: var(--sp-1) var(--sp-4);
  margin: 0 var(--sp-5) var(--sp-3);
}

/* ── Pills ── */
.pill {
  display: inline-flex;
  align-items: center;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 3px var(--sp-2);
  border-radius: var(--r-full);
  text-transform: uppercase;
}
.pill-todo    { background: var(--bone);  color: var(--text-2); }
.pill-doing   { background: #FFF3EE;      color: var(--accent); }
.pill-done    { background: #EDFAF3;      color: #1a7a4a; }
.pill-urgente { background: #FFF3EE;      color: var(--accent); }
.pill-activo  { background: #FFF3EE;      color: var(--accent); }
.pill-pendiente { background: var(--bone); color: var(--text-2); }
.pill-cerrado { background: #EDFAF3;      color: #1a7a4a; }

/* ── Avatares ── */
.av-sm {
  width: 20px;
  height: 20px;
  border-radius: var(--r-full);
  font-family: var(--sans);
  font-size: 8px;
  font-weight: 700;
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  user-select: none;
}

/* ══════════════════════════════════════════════════════
   PERFIL STRIP (Hoy)
══════════════════════════════════════════════════════ */
.profile-strip {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}
.profile-strip__av {
  width: 44px;
  height: 44px;
  border-radius: var(--r-full);
  font-size: 16px;
  font-weight: 700;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.profile-strip__info {
  flex: 1;
  min-width: 0;
}
.profile-strip__name {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.profile-strip__role {
  font-size: 12px;
  color: var(--text-2);
  margin-top: 1px;
}
.profile-strip__count { text-align: right; flex-shrink: 0; }
.profile-strip__num {
  font-size: 26px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}
.profile-strip__lbl {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--text-2);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ══════════════════════════════════════════════════════
   TASK ITEM
══════════════════════════════════════════════════════ */
.task-item {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.task-item:last-child { border-bottom: none; }

.task-check {
  width: 22px;
  height: 22px;
  min-width: 22px;
  border-radius: var(--r-full);
  border: 2px solid var(--border);
  flex-shrink: 0;
  margin-top: 1px;
  touch-action: manipulation;
  transition: border-color var(--t-fast), background var(--t-fast), transform var(--t-spring);
}
.task-check:active { transform: scale(0.88); }
.task-check[data-estado="doing"] { border-color: var(--accent); }
.task-check[data-estado="done"]  { background: var(--accent); border-color: var(--accent); }

.task-text  { flex: 1; min-width: 0; }
.task-title { font-size: 14px; color: var(--text-1); line-height: 1.4; }
.task-meta  { display: flex; align-items: center; gap: var(--sp-2); margin-top: var(--sp-1); flex-wrap: wrap; }

/* ══════════════════════════════════════════════════════
   STATS ROW
══════════════════════════════════════════════════════ */
.stats-row {
  display: flex;
  gap: var(--sp-2);
  padding: var(--sp-4) var(--sp-5) var(--sp-2);
  overflow-x: auto;
  scrollbar-width: none;
  scroll-snap-type: x mandatory;
}
.stats-row::-webkit-scrollbar { display: none; }

.stat-mini {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px var(--sp-4);
  min-width: 100px;
  flex-shrink: 0;
  scroll-snap-align: start;
}
.stat-mini.accent {
  background: var(--accent);
  border-color: var(--accent);
}
.stat-mini .sv {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-1);
  line-height: 1;
  margin-bottom: var(--sp-1);
}
.stat-mini.accent .sv { color: white; }
.stat-mini .sl {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-2);
}
.stat-mini.accent .sl { color: rgba(255,255,255,0.75); }

/* ══════════════════════════════════════════════════════
   TEAM ROW
══════════════════════════════════════════════════════ */
.team-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--border);
}
.team-row:last-child { border-bottom: none; }
.team-av {
  width: 36px;
  height: 36px;
  border-radius: var(--r-full);
  font-size: 14px;
  font-weight: 700;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.team-info { flex: 1; min-width: 0; }
.team-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.team-task { font-size: 12px; color: var(--text-2); margin-top: 1px; }

/* ══════════════════════════════════════════════════════
   KANBAN
══════════════════════════════════════════════════════ */
.kanban-cols {
  display: flex;
  gap: var(--sp-3);
  padding: var(--sp-4);
  overflow-x: auto;
  overflow-y: auto;
  flex: 1;
  align-items: flex-start;
  scrollbar-width: none;
  scroll-snap-type: x mandatory;
}
.kanban-cols::-webkit-scrollbar { display: none; }

.kanban-col {
  min-width: 200px;
  flex-shrink: 0;
  scroll-snap-align: start;
}

.col-header {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-2);
}
.col-dot { width: 8px; height: 8px; border-radius: var(--r-full); }
.dot-todo  { background: var(--text-2); }
.dot-doing { background: var(--accent); }
.dot-done  { background: #1a7a4a; }

.col-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-1);
}
.col-count {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-2);
  background: var(--bone);
  border-radius: var(--r-full);
  padding: 1px 6px;
}

.kanban-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-3);
  margin-bottom: var(--sp-2);
  cursor: pointer;
  transition: transform var(--t-fast), box-shadow var(--t-fast);
  touch-action: manipulation;
}
.kanban-card:active {
  transform: scale(0.97);
  box-shadow: var(--shadow-md);
}

.kanban-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: var(--sp-2);
  line-height: 1.4;
}
.kanban-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ══════════════════════════════════════════════════════
   CHIPS
══════════════════════════════════════════════════════ */
.chips-row {
  display: flex;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-5);
  overflow-x: auto;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  scrollbar-width: none;
}
.chips-row::-webkit-scrollbar { display: none; }

.chip {
  background: var(--bone);
  color: var(--text-2);
  border-radius: var(--r-full);
  padding: 6px var(--sp-3);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
  touch-action: manipulation;
  transition: background var(--t-fast), color var(--t-fast), transform var(--t-fast);
  flex-shrink: 0;
}
.chip:active { transform: scale(0.95); }
.chip.active { background: var(--ink); color: white; }

/* ══════════════════════════════════════════════════════
   IDEAS
══════════════════════════════════════════════════════ */
.idea-input-wrap {
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg);
}

.idea-list-card {
  margin-top: var(--sp-3);
}
.idea-input-row { display: flex; gap: var(--sp-2); }

.idea-input {
  flex: 1;
  height: 44px;
  border-radius: var(--r-md);
  border: 1.5px solid var(--border);
  background: var(--bg-input);
  font-family: var(--sans);
  font-size: var(--text-sm);
  color: var(--text-1);
  padding: 0 var(--sp-3);
  outline: none;
  transition: border-color var(--t-fast);
}
.idea-input:focus { border-color: var(--accent); background: var(--bg-card); }

.btn-add {
  height: 44px;
  width: 44px;
  min-width: 44px;
  border-radius: var(--r-md);
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  transition: background var(--t-fast), transform var(--t-fast);
}
.btn-add:hover  { background: var(--accent-dk); }
.btn-add:active { transform: scale(0.94); }

.idea-item {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-2);
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--border);
}
.idea-item:last-child { border-bottom: none; }

.idea-body { flex: 1; min-width: 0; }
.idea-text { font-size: 14px; color: var(--text-1); line-height: 1.4; }
.idea-meta { font-family: var(--mono); font-size: 10px; color: var(--text-2); margin-top: 3px; }

.btn-del {
  background: none;
  color: var(--text-2);
  padding: var(--sp-1);
  min-width: 32px;
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-sm);
  transition: color var(--t-fast), background var(--t-fast);
}
.btn-del:hover { color: #c0392b; background: #fff0ee; }

/* ══════════════════════════════════════════════════════
   LINKS
══════════════════════════════════════════════════════ */
.link-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  transition: opacity var(--t-fast);
}
.link-item:last-child { border-bottom: none; }
.link-item:active { opacity: 0.6; }

.link-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--r-md);
  background: var(--bone);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  flex-shrink: 0;
}
.link-name { font-size: 13px; font-weight: 600; color: var(--text-1); }
.link-cat  { font-family: var(--mono); font-size: 10px; color: var(--text-2); margin-top: 2px; }

/* ══════════════════════════════════════════════════════
   PROYECTOS
══════════════════════════════════════════════════════ */
.proj-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px var(--sp-4);
  margin: 0 var(--sp-5) var(--sp-3);
}
.proj-name    { font-size: 14px; font-weight: 700; color: var(--text-1); }
.proj-cliente { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.proj-status  { display: flex; align-items: center; gap: var(--sp-2); margin-top: var(--sp-2); }

.progress-wrap { margin-top: var(--sp-3); }
.progress-bar-bg {
  height: 4px;
  background: var(--bone);
  border-radius: 2px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width var(--t-smooth);
}
.progress-label {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--text-2);
  margin-top: var(--sp-1);
}

/* ══════════════════════════════════════════════════════
   EMPTY STATE
══════════════════════════════════════════════════════ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--sp-12) var(--sp-5);
  color: var(--text-2);
  gap: var(--sp-3);
}
.empty-state svg { opacity: 0.3; }
.empty-msg {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-align: center;
}

/* ══════════════════════════════════════════════════════
   MODAL (dialog nativo)
══════════════════════════════════════════════════════ */
.modal {
  border: none;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: 0;
  width: 100%;
  max-width: 100%;
  max-height: 90dvh;
  margin: auto auto 0;
  background: var(--bg-card);
  color: var(--text-1);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.modal::backdrop {
  background: rgba(10, 10, 10, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

@keyframes modal-slide-up {
  from { opacity: 0; transform: translateY(100%); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes modal-slide-down {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(100%); }
}

.modal[open] {
  animation: modal-slide-up var(--t-smooth) cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.modal__box {
  display: flex;
  flex-direction: column;
  max-height: 90dvh;
  padding-bottom: var(--safe-b);
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-5) var(--sp-5) var(--sp-4);
  flex-shrink: 0;
}
.modal__title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-1);
}
.modal__close {
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  background: var(--bone);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  touch-action: manipulation;
  transition: background var(--t-fast);
  min-width: 44px;
  min-height: 44px;
}
.modal__close:hover { background: var(--rule); }

.modal__body {
  overflow-y: auto;
  padding: 0 var(--sp-5);
  flex: 1;
}

.modal__footer {
  display: flex;
  gap: var(--sp-2);
  padding: var(--sp-4) var(--sp-5) var(--sp-5);
  flex-shrink: 0;
  border-top: 1px solid var(--border);
}

/* Campos del modal */
.modal-field { margin-bottom: var(--sp-3); }
.modal-field label {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-2);
  margin-bottom: var(--sp-1);
}
.modal-field input,
.modal-field select {
  width: 100%;
  height: 44px;
  border-radius: var(--r-md);
  border: 1.5px solid var(--border);
  background: var(--bg-input);
  font-family: var(--sans);
  font-size: var(--text-sm);
  color: var(--text-1);
  padding: 0 var(--sp-3);
  outline: none;
  transition: border-color var(--t-fast);
  -webkit-appearance: none;
  appearance: none;
}
.modal-field input:focus,
.modal-field select:focus { border-color: var(--accent); }

.btn-cancel {
  flex: 1;
  height: 48px;
  border-radius: var(--r-md);
  background: var(--bone);
  color: var(--text-1);
  font-size: var(--text-sm);
  font-weight: 600;
  touch-action: manipulation;
  transition: background var(--t-fast), transform var(--t-fast);
}
.btn-cancel:active { transform: scale(0.97); }

.btn-confirm {
  flex: 2;
  height: 48px;
  border-radius: var(--r-md);
  background: var(--accent);
  color: white;
  font-size: var(--text-sm);
  font-weight: 700;
  touch-action: manipulation;
  transition: background var(--t-fast), transform var(--t-fast);
}
.btn-confirm:hover  { background: var(--accent-dk); }
.btn-confirm:active { transform: scale(0.97); }

/* ══════════════════════════════════════════════════════
   TOAST
══════════════════════════════════════════════════════ */
@keyframes toast-in-out {
  0%   { opacity: 0; transform: translateX(-50%) translateY(12px); }
  15%  { opacity: 1; transform: translateX(-50%) translateY(0); }
  75%  { opacity: 1; transform: translateX(-50%) translateY(0); }
  100% { opacity: 0; transform: translateX(-50%) translateY(12px); }
}

.toast {
  position: fixed;
  bottom: calc(var(--nav-h) + var(--safe-b) + var(--sp-4));
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: var(--ink);
  color: white;
  font-family: var(--mono);
  font-size: 12px;
  padding: 10px 18px;
  border-radius: var(--r-full);
  opacity: 0;
  pointer-events: none;
  z-index: var(--z-toast);
  white-space: nowrap;
}

.toast.show {
  animation: toast-in-out 2.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
