/* ===== Quotes — jardín de ideas ===== */
:root {
  --bg: #f7f4ee;
  --paper: #fffdf9;
  --ink: #211c15;
  --ink2: #4a4338;
  --muted: #938b7d;
  --line: #ece6db;
  --accent: #c8772e;        /* ámbar cálido = chispa/idea */
  --accent-soft: #f3e3d0;
  --shadow: 0 8px 28px rgba(60, 45, 25, .08);

  /* colores de categoría */
  --c-green: #5a8f5e; --c-green-bg: #e7f0e6;
  --c-purple: #7b5ea8; --c-purple-bg: #ece6f4;
  --c-amber: #c8932e; --c-amber-bg: #f6ecd4;
  --c-blue: #4d7aa8; --c-blue-bg: #e3edf5;
  --c-rose: #b65a78; --c-rose-bg: #f6e3ea;
  --c-teal: #3f8f8a; --c-teal-bg: #def0ee;
  --c-gray: #847b6d; --c-gray-bg: #eceae4;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }   /* el atributo hidden siempre manda sobre display:flex/block */
html, body { background: var(--bg); }
body { font-family: "Inter", system-ui, sans-serif; color: var(--ink); }

.app {
  max-width: 560px; margin: 0 auto; min-height: 100vh;
  padding: max(18px, env(safe-area-inset-top)) 18px calc(40px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 16px;
}

/* ===== Cabecera ===== */
.topbar { display: flex; align-items: center; justify-content: space-between; padding-top: 6px; }
.brand { display: flex; align-items: center; gap: 12px; }
.logo { width: 42px; height: 42px; border-radius: 13px; background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center; }
.logo svg { width: 24px; height: 24px; }
.brand h1 { font-family: "Fraunces", serif; font-weight: 600; font-size: 24px; letter-spacing: -.02em; line-height: 1; }
.brand p { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.icon-btn { width: 42px; height: 42px; border-radius: 13px; border: 1px solid var(--line); background: var(--paper);
  color: var(--ink2); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: .15s; }
.icon-btn:active { transform: scale(.94); }
.icon-btn svg { width: 21px; height: 21px; }

/* ===== Búsqueda ===== */
.searchbar { display: flex; align-items: center; gap: 10px; background: var(--paper); border: 1px solid var(--line);
  border-radius: 14px; padding: 11px 14px; box-shadow: var(--shadow); }
.searchbar svg { width: 19px; height: 19px; color: var(--muted); flex: 0 0 auto; }
.searchbar input { flex: 1; border: none; outline: none; background: none; font-size: 15px; color: var(--ink); font-family: inherit; }
.search-clear { border: none; background: none; color: var(--muted); font-size: 16px; cursor: pointer; padding: 2px 4px; }

/* ===== Captura ===== */
.capture { background: var(--paper); border: 1px solid var(--line); border-radius: 18px; padding: 14px;
  box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; }
#capture-text { border: none; outline: none; background: none; resize: none; width: 100%; font-family: inherit;
  font-size: 16px; line-height: 1.5; color: var(--ink); max-height: 180px; }
#capture-text::placeholder { color: var(--muted); }
.capture-row { display: flex; align-items: center; gap: 10px; }

/* selector de categoría (pastilla) */
.cat-select { position: relative; flex: 1; }
.cat-pill { display: inline-flex; align-items: center; gap: 7px; width: 100%; background: var(--bg);
  border: 1px solid var(--line); border-radius: 11px; padding: 9px 12px; font-size: 13.5px; font-weight: 500;
  color: var(--ink2); cursor: pointer; font-family: inherit; }
.cat-pill .dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; background: var(--c-green); }
.cat-pill svg { width: 16px; height: 16px; margin-left: auto; color: var(--muted); }
.cat-menu { position: absolute; bottom: calc(100% + 6px); left: 0; right: 0; background: var(--paper);
  border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 6px; z-index: 20;
  max-height: 280px; overflow-y: auto; }
.cat-opt { display: flex; align-items: center; gap: 9px; padding: 10px 11px; border-radius: 10px; cursor: pointer; font-size: 14px; }
.cat-opt:hover, .cat-opt.sel { background: var(--bg); }
.cat-opt .dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.cat-opt.add { color: var(--accent); font-weight: 600; }

.add-btn { width: 46px; height: 46px; flex: 0 0 auto; border-radius: 13px; border: none; background: var(--accent);
  color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: .15s;
  box-shadow: 0 6px 16px rgba(200, 119, 46, .32); }
.add-btn:active { transform: scale(.92); }
.add-btn svg { width: 24px; height: 24px; }

/* ===== Chips de categoría ===== */
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--paper); font-size: 13px; font-weight: 500; color: var(--ink2);
  cursor: pointer; transition: .15s; }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; }
.chip .count { color: var(--muted); font-size: 12px; }
.chip.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip.active .count { color: rgba(255,255,255,.7); }

/* ===== Lista ===== */
.list { display: flex; flex-direction: column; gap: 12px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 15px 16px;
  box-shadow: var(--shadow); cursor: pointer; transition: .15s; }
.card:active { transform: scale(.99); }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 9px; }
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600; }
.tag .dot { width: 7px; height: 7px; border-radius: 50%; }
.card-date { font-size: 11.5px; color: var(--muted); flex: 0 0 auto; }
.card-text { font-size: 15.5px; line-height: 1.5; color: var(--ink); white-space: pre-wrap;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.card-note { margin-top: 8px; font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.card-note svg { width: 14px; height: 14px; }

/* ===== Vacío ===== */
.empty { text-align: center; padding: 48px 24px; color: var(--muted); }
.empty .ei { width: 64px; height: 64px; border-radius: 20px; background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; }
.empty .ei svg { width: 32px; height: 32px; }
.empty b { display: block; font-family: "Fraunces", serif; font-weight: 600; font-size: 19px; color: var(--ink); margin-bottom: 7px; }
.empty p { font-size: 14px; line-height: 1.6; max-width: 300px; margin: 0 auto; }

/* ===== Hoja de detalle ===== */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-end; justify-content: center; }
.modal-bg { position: absolute; inset: 0; background: rgba(33, 28, 21, .42); animation: fade .2s ease; }
.sheet { position: relative; width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto;
  background: var(--bg); border-radius: 24px 24px 0 0; padding: 10px 20px calc(28px + env(safe-area-inset-bottom));
  animation: slideup .26s cubic-bezier(.2,.8,.2,1); }
.sheet-grip { width: 42px; height: 5px; border-radius: 3px; background: var(--line); margin: 4px auto 16px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.sheet textarea, .sheet input { font-family: inherit; }
.field-idea { width: 100%; border: none; outline: none; background: none; resize: none; font-family: "Fraunces", serif;
  font-size: 22px; line-height: 1.35; font-weight: 500; color: var(--ink); }
.dev-block { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 14px; margin-top: 18px; }
.dev-block label { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; color: var(--ink2); margin-bottom: 10px; }
.dev-block label svg { width: 16px; height: 16px; color: var(--accent); }
.field-dev { width: 100%; border: none; outline: none; background: none; resize: none; font-size: 15px; line-height: 1.6;
  color: var(--ink); min-height: 90px; }
.field-dev::placeholder { color: var(--muted); }

/* bloque "voces" (futuro IA) */
.voices { margin-top: 18px; border: 1px dashed var(--line); border-radius: 16px; padding: 16px; background: var(--paper); }
.voices h4 { display: flex; align-items: center; gap: 8px; font-family: "Fraunces", serif; font-size: 16px; font-weight: 600; color: var(--ink); margin-bottom: 8px; }
.voices h4 svg { width: 18px; height: 18px; color: var(--accent); }
.voices p { font-size: 13px; line-height: 1.55; color: var(--muted); }
.soon { display: inline-block; margin-top: 10px; font-size: 11px; font-weight: 600; color: var(--accent);
  background: var(--accent-soft); padding: 4px 9px; border-radius: 999px; }

.sheet-actions { display: flex; gap: 10px; margin-top: 22px; }
.btn { flex: 1; border: none; border-radius: 13px; padding: 14px; font-size: 15px; font-weight: 600; cursor: pointer; font-family: inherit; transition: .15s; }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 6px 16px rgba(200,119,46,.28); }
.btn-ghost { background: none; color: var(--muted); flex: 0 0 auto; padding: 14px 18px; }
.btn-ghost.danger { color: #c0453f; }

/* categoría dentro del detalle */
.sheet .cat-select { flex: 0 0 auto; max-width: 62%; }

@keyframes fade { from { opacity: 0; } }
@keyframes slideup { from { transform: translateY(100%); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; } }
