/* =====================================================================
   BITÁCORA — sistema de diseño
   ===================================================================== */
:root{
  /* ---- Paleta estilo "cuaderno de papel cálido" ---- */
  --bg:#F6F5F4;
  --bg-soft:#EFEDEB;
  --surface:#FFFFFF;
  --surface-2:#FBFAF9;
  --ink:#000000;
  --ink-soft:#1A1A1A;
  --muted:#757575;
  --muted-soft:#A6A6A6;

  --brand:#0075DE;
  --brand-dark:#097FE8;
  --brand-darker:#02093A;
  --brand-light:#E6F3FE;
  --brand-line:#BFE0FB;

  --blue:#62AEF0;   --blue-light:#EAF4FE;
  --amber:#FFB110;  --amber-light:#FFF4DC;
  --pink:#F64932;   --pink-light:#FDEAE7;
  --violet:#B18164; --violet-light:#F1E7DF;
  --red:#E32D14;    --red-light:#FCE4E0;
  --teal2:#097FE8;  --teal2-light:#E6F3FE;

  --border:rgba(0,0,0,0.08);
  --border-soft:rgba(0,0,0,0.05);
  --ring:rgba(0,117,222,0.18);

  --radius-xl:16px; --radius-lg:12px; --radius-md:10px; --radius-sm:8px; --radius-xs:6px; --radius-pill:9999px;
  --shadow-xs:none;
  --shadow-sm:none;
  --shadow-md:0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg:0 20px 50px -14px rgba(0,0,0,0.28);
  --shadow-nav:0px 0.7px 1.462px rgba(0,0,0,0.015), 0px 3px 9px rgba(0,0,0,0.03);
  --ease:cubic-bezier(.22,.61,.36,1);
  --font-head:'Inter',sans-serif;
  --font-body:'Inter',sans-serif;
  --font-accent:'Source Serif Pro',Georgia,serif;
}
*{ box-sizing:border-box; }
html{ -webkit-tap-highlight-color:transparent; overflow-x:hidden; }
/* overflow-x:hidden a nivel de página evita que CUALQUIER elemento que se
   desborde (una tabla ancha, una palabra larga sin espacios, código pegado, etc.)
   empuje el ancho de toda la página y aparezca la barra de scroll horizontal
   del navegador de lado a lado. El contenido que se desborde se recorta o
   se resuelve con scroll interno (ver .notebook-editor-body table de abajo). */
body{ margin:0; background:var(--bg); color:var(--ink); font-family:var(--font-body); -webkit-font-smoothing:antialiased; overflow-x:hidden; max-width:100vw; }
::selection{ background:var(--brand); color:#fff; }
svg{ display:block; }
.icon{ width:18px; height:18px; flex-shrink:0; }
.icon-sm{ width:15px; height:15px; }
.icon-xs{ width:11px; height:11px; }
.icon-lg{ width:22px; height:22px; }

@keyframes fadeInUp{ from{ opacity:0; transform:translateY(10px);} to{ opacity:1; transform:translateY(0);} }
@keyframes fadeIn{ from{ opacity:0;} to{ opacity:1;} }
@keyframes popIn{ from{ opacity:0; transform:scale(.9);} to{ opacity:1; transform:scale(1);} }
@keyframes spin{ to{ transform:rotate(360deg); } }
@keyframes floatSlow{ 0%,100%{ transform:translateY(0);} 50%{ transform:translateY(-14px);} }

.loading-screen{ height:100vh; display:flex; align-items:center; justify-content:center; background:var(--brand-darker); }
.loading-screen .loader-ring{ width:38px; height:38px; border-radius:50%; border:3px solid rgba(255,255,255,.28); border-top-color:#fff; animation:spin .8s linear infinite; }

/* ===================== BOTONES / CAMPOS ===================== */
input, select, textarea{
  font-family:var(--font-body); font-size:14.5px; padding:13px 15px; border-radius:var(--radius-sm);
  border:1.5px solid var(--border); background:var(--surface-2); color:var(--ink); outline:none; width:100%;
  transition:border-color .2s var(--ease), box-shadow .2s var(--ease), background .2s var(--ease);
  appearance:none; -webkit-appearance:none;
}
input, select{ min-height:46px; }
select{
  background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23757575' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='4,6 8,10 12,6'/></svg>");
  background-repeat:no-repeat; background-position:right 12px center; padding-right:32px; cursor:pointer;
}
input[type="date"], input[type="week"]{ cursor:pointer; }
input:focus, select:focus, textarea:focus{ border-color:var(--brand); background:#fff; box-shadow:0 0 0 4px var(--ring); }
textarea{ resize:vertical; font-family:inherit; }
label.field{ display:flex; flex-direction:column; gap:6px; font-size:12.5px; font-weight:700; color:var(--ink-soft); }

.btn-primary{
  background:var(--brand); color:#fff; border:none;
  padding:14px 22px; border-radius:var(--radius-sm); font-weight:600; font-size:14.5px; cursor:pointer; min-height:46px;
  display:inline-flex; align-items:center; justify-content:center; gap:7px; font-family:inherit;
  transition:background-color .2s ease, transform .15s var(--ease), opacity .18s var(--ease);
}
.btn-primary:hover{ background:var(--brand-dark); }
.btn-primary:active{ transform:scale(.98); }
.btn-primary.btn-danger{ background:var(--red); }
.btn-primary.btn-danger:hover{ background:#c22711; }
.btn-primary.small{ padding:11px 18px; font-size:13.5px; min-height:40px; align-self:flex-start; }
.btn-primary:disabled{ opacity:.55; cursor:not-allowed; transform:none; }

.btn-ghost{
  background:var(--surface); color:var(--ink-soft); border:1.5px solid var(--border);
  padding:12px 18px; border-radius:var(--radius-sm); font-weight:600; font-size:13.5px; cursor:pointer; min-height:46px;
  display:inline-flex; align-items:center; justify-content:center; gap:7px; font-family:inherit;
  transition:background-color .18s ease, border-color .18s ease, color .18s ease;
}
.btn-ghost:hover{ border-color:var(--brand); color:var(--brand-dark); background:var(--brand-light); }
.btn-ghost.small{ padding:10px 15px; font-size:13px; min-height:38px; }

.install-btn{ background:var(--amber) !important; color:#2b1c00 !important; }

/* ===================== AUTH ===================== */
.auth-screen{ min-height:100vh; display:flex; align-items:stretch; justify-content:center; background:var(--bg); padding:28px; }
.auth-shell{ display:flex; width:100%; max-width:1020px; margin:auto; min-height:min(660px,92vh); border-radius:28px; overflow:hidden; box-shadow:var(--shadow-lg); animation:fadeInUp .5s var(--ease); background:var(--surface); }

.auth-brand-panel{ flex:1.1; background:var(--brand-darker); color:#fff; padding:46px 42px; display:flex; flex-direction:column; justify-content:space-between; position:relative; overflow:hidden; }
.avatar-mark{ position:absolute; width:44px; height:44px; border-radius:50%; background:#fff; border:2px solid var(--amber); display:flex; align-items:center; justify-content:center; color:var(--brand-darker); animation:floatSlow 8s ease-in-out infinite; }
.avatar-mark svg{ width:18px; height:18px; }
.avatar-mark.m1{ top:36px; right:54px; border-color:var(--amber); }
.avatar-mark.m2{ bottom:120px; left:-14px; border-color:var(--pink); animation-duration:10s; animation-direction:reverse; }
.avatar-mark.m3{ top:44%; right:-16px; border-color:var(--blue); width:36px; height:36px; animation-duration:11s; }
.avatar-mark.m3 svg{ width:15px; height:15px; }
.auth-brand-mark{ font-family:var(--font-head); font-size:21px; font-weight:700; display:flex; align-items:center; gap:10px; position:relative; z-index:1; letter-spacing:-0.02em; }
.brand-mark-icon{ width:38px; height:38px; border-radius:12px; background:rgba(255,255,255,.16); border:1px solid rgba(255,255,255,.3); display:flex; align-items:center; justify-content:center; backdrop-filter:blur(6px); }
.brand-mark-icon svg{ width:20px; height:20px; }
.auth-illustration{ position:relative; z-index:1; margin:10px 0; }
.auth-brand-headline{ font-family:var(--font-head); font-size:30px; line-height:1.28; font-weight:700; margin:16px 0 10px; position:relative; z-index:1; letter-spacing:-0.01em; }
.highlight-pill{ display:inline-block; background:var(--amber); color:#241a00; border-radius:var(--radius-pill); padding:1px 12px; }
.auth-brand-sub{ opacity:.88; font-size:14px; line-height:1.6; max-width:340px; position:relative; z-index:1; }
.auth-feature-list{ display:flex; flex-direction:column; gap:11px; position:relative; z-index:1; }
.auth-feature-list li{ list-style:none; display:flex; align-items:center; gap:10px; font-size:13px; font-weight:600; }
.auth-feature-list .feat-ico{ width:28px; height:28px; border-radius:9px; background:rgba(255,255,255,.16); display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.auth-feature-list .feat-ico svg{ width:15px; height:15px; }

.auth-card{ flex:1; background:var(--surface); padding:50px 46px; max-width:460px; width:100%; display:flex; flex-direction:column; justify-content:center; }
.auth-mobile-brand{ display:none; }
.auth-form-title{ font-family:var(--font-head); font-size:25px; font-weight:700; margin:0 0 4px; letter-spacing:-0.01em; }
.auth-sub{ color:var(--muted); font-size:13.5px; margin:0 0 22px; line-height:1.5; }
.auth-tabs{ display:flex; gap:4px; background:var(--bg-soft); padding:4px; border-radius:13px; margin-bottom:24px; }
.auth-tabs button{ flex:1; padding:10px; border:none; background:transparent; border-radius:10px; font-size:13.5px; font-weight:700; color:var(--muted); cursor:pointer; font-family:inherit; transition:background .25s var(--ease), color .25s var(--ease); }
.auth-tabs button.active{ background:var(--surface); color:var(--brand-dark); box-shadow:var(--shadow-xs); }
.auth-form{ display:flex; flex-direction:column; gap:15px; animation:fadeIn .35s var(--ease); }
.auth-error{ display:flex; align-items:center; gap:8px; color:#B5292D; font-size:13px; margin:0; background:var(--red-light); padding:10px 12px; border-radius:10px; font-weight:600; }
.btn-link{ background:none; border:none; color:var(--brand-dark); font-size:12.5px; text-decoration:none; cursor:pointer; font-family:inherit; padding:0; text-align:left; font-weight:700; }
.btn-link:hover{ text-decoration:underline; }
.pw-wrap{ position:relative; }
.pw-wrap input{ width:100%; padding-right:40px; }
.pw-wrap button{ position:absolute; right:6px; top:50%; transform:translateY(-50%); background:none; border:none; cursor:pointer; padding:7px; border-radius:8px; color:var(--muted); display:flex; }
.pw-wrap button:hover{ background:var(--bg-soft); color:var(--ink); }

/* ===================== SHELL ===================== */
.app-shell{ min-height:100vh; background:var(--bg); display:flex; }

.sidebar{ width:232px; background:var(--surface); border-right:1px solid var(--border); box-shadow:var(--shadow-nav); padding:22px 14px; display:flex; flex-direction:column; gap:3px; position:sticky; top:0; height:100vh; flex-shrink:0; transition:width .2s var(--ease); z-index:5; }
.sidebar.collapsed{ width:78px; padding:22px 10px; }
.sidebar-toggle{ align-self:flex-end; background:none; border:1.5px solid var(--border); border-radius:9px; width:30px; height:30px; display:flex; align-items:center; justify-content:center; cursor:pointer; color:var(--muted); margin-bottom:10px; transition:all .18s var(--ease); }
.sidebar-toggle:hover{ border-color:var(--brand); color:var(--brand-dark); }
.sidebar.collapsed .sidebar-toggle{ align-self:center; }
.sidebar.collapsed .sidebar-brand span, .sidebar.collapsed .nav-item span{ display:none; }
.sidebar.collapsed .sidebar-brand{ justify-content:center; }
.sidebar.collapsed .nav-item{ justify-content:center; padding:12px 8px; }
.sidebar-brand{ display:flex; align-items:center; gap:10px; font-family:var(--font-head); font-weight:700; font-size:17px; color:var(--ink); padding:6px 10px 14px; letter-spacing:-0.01em; }
.sidebar-brand .brand-mark-icon{ width:32px; height:32px; border-radius:var(--radius-xs); background:var(--brand); border:none; }
.sidebar-brand .brand-mark-icon svg{ width:17px; height:17px; color:#fff; }
.nav-item{ display:flex; align-items:center; gap:11px; padding:10px 12px; border-radius:11px; border:none; background:transparent; color:var(--muted); font-weight:600; font-size:13.5px; cursor:pointer; text-align:left; font-family:inherit; width:100%; transition:background .2s var(--ease), color .2s var(--ease), transform .15s var(--ease); }
.nav-item svg{ color:var(--muted-soft); transition:color .2s var(--ease); }
.nav-item:hover{ background:var(--bg-soft); color:var(--ink); }
.nav-item:hover svg{ color:var(--ink-soft); }
.nav-item.active{ background:var(--brand-light); color:var(--brand-darker); }
.nav-item.active svg{ color:var(--brand); }
.nav-item.logout{ margin-top:auto; color:var(--red); }
.nav-item.logout svg{ color:var(--red); }
.nav-item.logout:hover{ background:var(--red-light); }

.topbar{ display:none; }
.mobile-nav-overlay{ display:none; }
.bottom-nav{ display:none; }

.main-content{ flex:1; padding:28px 34px 64px; max-width:1180px; }
.tab-content{ display:flex; flex-direction:column; gap:18px; animation:fadeInUp .35s var(--ease); }
.page-title{ font-family:var(--font-head); font-size:25px; font-weight:700; margin:0; letter-spacing:-0.01em; }
.page-sub{ color:var(--muted); font-size:13.5px; margin:2px 0 4px; }
.page-head-row{ display:flex; justify-content:space-between; align-items:flex-start; gap:12px; flex-wrap:wrap; }
.head-actions{ display:flex; gap:8px; flex-wrap:wrap; }
.currency-select{ width:auto; }

.card{ background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-lg); padding:20px 22px; transition:border-color .2s var(--ease); }
.card-head{ display:flex; align-items:center; justify-content:space-between; margin-bottom:8px; gap:10px; flex-wrap:wrap; }
.card-head h3{ margin:0; font-size:14.5px; font-weight:700; font-family:var(--font-head); }

.stat-grid{ display:grid; grid-template-columns:repeat(5,1fr); gap:14px; }
.stat-grid.three{ grid-template-columns:repeat(3,1fr); }
.stat-card{ padding:17px; }
.stat-card:hover{ transform:translateY(-2px); border-color:rgba(0,0,0,0.16); }
.stat-icon{ width:36px; height:36px; border-radius:11px; display:flex; align-items:center; justify-content:center; margin-bottom:10px; }
.stat-icon svg{ width:18px; height:18px; }
.stat-label{ font-size:11.5px; color:var(--muted); font-weight:700; margin:0 0 3px; text-transform:uppercase; letter-spacing:0.03em; }
.stat-value{ font-size:20px; font-weight:700; margin:0; font-family:var(--font-head); }

.dash-cols{ display:grid; grid-template-columns:1fr 1fr; gap:16px; }
.dash-cols.three{ grid-template-columns:1fr 1fr 1fr; }
.dash-cols.cal-layout{ grid-template-columns:1.4fr 1fr; align-items:start; }

.mini-list{ list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:10px; }
.mini-list li{ display:flex; align-items:center; gap:9px; font-size:13.5px; }
.mini-title{ flex:1; }
.mini-date{ color:var(--muted); font-size:12px; }
.mini-pending{ font-size:11px; color:var(--muted-soft); }
.dot{ width:8px; height:8px; border-radius:50%; flex-shrink:0; display:inline-block; }

.empty{ display:flex; flex-direction:column; align-items:center; text-align:center; padding:30px 10px; color:var(--muted); gap:8px; }
.empty svg{ width:30px; height:30px; color:var(--muted-soft); }
.empty-title{ font-weight:700; color:var(--ink-soft); margin:4px 0 0; font-size:13.5px; }
.empty-hint{ font-size:12px; margin:0; color:var(--muted); }

/* ===================== FORMULARIOS EN FILA ===================== */
.tx-form, .task-form, .habit-form, .book-form, .event-form{ display:flex; flex-wrap:wrap; gap:10px; align-items:flex-start; }
.tx-form > *, .task-form > *, .habit-form > *, .book-form > *, .event-form > *{ flex:1 1 140px; min-width:0; }
.tx-form .type-toggle, .event-form select, .tx-form select{ flex:1 1 150px; }
.tx-form button, .task-form button, .habit-form button, .book-form button, .event-form button{ flex:0 0 auto; align-self:center; }
.custom-cat-wrap{ flex:1 1 100%; }
.custom-cat-wrap.hidden{ display:none; }
.event-form textarea{ flex:1 1 100%; }

.type-toggle{ display:flex; border:1.5px solid var(--border); border-radius:11px; overflow:hidden; min-height:46px; }
.type-toggle input{ display:none; }
.type-toggle label{ padding:13px 14px; background:var(--surface-2); color:var(--muted); font-weight:700; font-size:13.5px; cursor:pointer; display:flex; align-items:center; justify-content:center; gap:6px; flex:1; text-align:center; transition:background .2s, color .2s; }
.type-toggle input#type-expense:checked + label{ background:var(--red); color:#fff; }
.type-toggle input#type-income:checked + label{ background:var(--brand); color:#fff; }

.pie-legend{ display:flex; flex-wrap:wrap; gap:10px; margin-top:10px; justify-content:center; }
.pie-legend span{ display:flex; align-items:center; gap:5px; font-size:12px; color:var(--muted); }
.legend-dot{ width:8px; height:8px; border-radius:50%; display:inline-block; }

.month-picker{ width:auto; padding:7px 10px; font-size:12.5px; }
.tx-list{ list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:2px; }
.tx-list li{ display:flex; align-items:center; gap:10px; padding:11px 0; border-bottom:1px solid var(--border-soft); font-size:13.5px; }
.tx-list li:last-child{ border-bottom:none; }
.tx-badge{ width:30px; height:30px; border-radius:10px; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.tx-badge svg{ width:15px; height:15px; }
.tx-badge.inc{ background:var(--brand-light); color:var(--brand-dark); } .tx-badge.exp{ background:var(--red-light); color:var(--red); }
.tx-info{ flex:1; display:flex; flex-direction:column; min-width:0; }
.tx-cat{ font-weight:700; } .tx-note{ color:var(--muted); font-size:12px; }
.tx-date{ color:var(--muted); font-size:12px; white-space:nowrap; }
.tx-amount{ font-weight:700; font-family:var(--font-head); }
.tx-amount.inc{ color:var(--brand-dark); } .tx-amount.exp{ color:var(--red); }

.icon-btn{ background:none; border:none; color:var(--muted); cursor:pointer; padding:8px; display:flex; align-items:center; justify-content:center; border-radius:9px; transition:background .18s, color .18s, transform .15s; }
.icon-btn svg{ width:17px; height:17px; }
.icon-btn:hover{ background:var(--bg-soft); color:var(--ink); }
.icon-btn.danger:hover{ background:var(--red-light); color:var(--red); }
.icon-btn.big{ width:40px; height:40px; background:var(--surface-2); color:var(--ink-soft); }
.icon-btn.big:hover{ background:var(--brand-light); color:var(--brand-dark); }

/* ===================== TOOLBAR: filtros + fecha + excel ===================== */
.list-toolbar{ display:flex; align-items:center; gap:10px; flex-wrap:wrap; justify-content:space-between; }
.list-toolbar .chip-row{ flex:1 1 auto; }
.toolbar-tools{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.date-filter-wrap{ display:flex; align-items:center; gap:6px; background:var(--surface-2); border:1.5px solid var(--border); border-radius:11px; padding:4px 4px 4px 11px; }
.date-filter-wrap svg{ width:15px; height:15px; color:var(--muted); flex-shrink:0; }
.date-filter-wrap input{ border:none; background:transparent; padding:6px 4px; width:132px; font-size:12.5px; font-weight:600; }
.date-filter-wrap input:focus{ box-shadow:none; }
.date-filter-clear{ background:none; border:none; color:var(--muted); cursor:pointer; padding:4px; display:flex; border-radius:6px; }
.date-filter-clear:hover{ color:var(--red); }
.btn-excel{ background:var(--surface); color:#1D6F42; border:1.5px solid #CDEBDC; }
.btn-excel:hover{ background:#EAF8F1; border-color:#1D6F42; color:#155C36; }

.chip-row{ display:flex; flex-wrap:wrap; gap:8px; }
.chip{ border:1.5px solid var(--border); background:var(--surface); color:var(--muted); font-weight:700; font-size:12.5px; padding:8px 14px; border-radius:20px; cursor:pointer; font-family:inherit; transition:all .2s var(--ease); display:inline-flex; align-items:center; gap:6px; }
.chip:hover{ border-color:var(--brand); color:var(--brand-dark); }
.chip.active{ background:var(--brand); border-color:var(--brand); color:#fff; }

.task-list{ display:flex; flex-direction:column; gap:12px; }
.task-card{ padding:16px 18px; transition:box-shadow .2s var(--ease); }
.task-card.done-card{ opacity:.72; }
.task-row{ display:flex; align-items:flex-start; gap:12px; }
.check-circle{ width:22px; height:22px; border-radius:50%; border:2px solid var(--border); background:none; cursor:pointer; flex-shrink:0; display:flex; align-items:center; justify-content:center; color:#fff; margin-top:1px; transition:all .2s var(--ease); }
.check-circle svg{ width:12px; height:12px; }
.check-circle:hover{ border-color:var(--brand); }
.check-circle.done{ background:var(--brand); border-color:var(--brand); animation:popIn .25s var(--ease); }
.check-circle.small{ width:19px; height:19px; }
.task-main{ flex:1; cursor:pointer; min-width:0; }
.task-title{ font-weight:700; font-size:14px; }
.task-title.strike{ text-decoration:line-through; color:var(--muted); }
.task-meta{ display:flex; align-items:center; gap:10px; font-size:11.5px; color:var(--muted); margin-top:5px; flex-wrap:wrap; }
.task-meta .meta-item{ display:flex; align-items:center; gap:4px; }
.task-meta svg{ width:12px; height:12px; }
.task-progress-text{ font-weight:700; }
.chevron{ color:var(--muted); cursor:pointer; transition:transform .2s var(--ease); margin-top:5px; display:inline-flex; }
.chevron svg{ width:16px; height:16px; }
.chevron.open{ transform:rotate(180deg); }
.task-row-actions{ display:flex; align-items:center; gap:2px; }

.progress-bar{ height:7px; background:var(--border-soft); border-radius:6px; overflow:hidden; margin-top:9px; }
.progress-bar.thin{ height:4px; margin-top:5px; }
.progress-fill{ height:100%; background:var(--brand); border-radius:6px; transition:width .35s var(--ease); }

.subtasks{ margin-top:12px; padding-left:34px; display:flex; flex-direction:column; gap:8px; animation:fadeIn .25s var(--ease); }
.subtask-row{ display:flex; align-items:center; gap:8px; font-size:13px; }
.subtask-row span{ flex:1; }
.subtask-add{ display:flex; gap:8px; margin-top:4px; }
.subtask-add button{ background:var(--brand-light); color:var(--brand-dark); }

.color-picker{ display:flex; gap:7px; flex:0 0 auto !important; align-items:center; flex-wrap:wrap; }
.color-picker input{ display:none; }
.color-picker label{ width:23px; height:23px; border-radius:50%; display:inline-block; cursor:pointer; border:2px solid transparent; transition:transform .15s var(--ease); }
.color-picker input:checked + label{ border-color:var(--ink); transform:scale(1.15); box-shadow:0 0 0 2px #fff inset; }

.habit-list{ display:flex; flex-direction:column; gap:12px; }
.habit-card{ padding:17px 19px; }
.habit-top{ display:flex; justify-content:space-between; align-items:center; margin-bottom:12px; }
.habit-name{ display:flex; align-items:center; gap:8px; font-size:14px; font-weight:700; }
.habit-stats{ display:flex; align-items:center; gap:8px; }
.streak-badge{ display:flex; align-items:center; gap:5px; font-weight:700; font-size:13px; background:var(--amber-light); color:#8A5A05; padding:5px 11px; border-radius:20px; }
.streak-badge svg{ width:14px; height:14px; }
.habit-summary{ display:grid; grid-template-columns:repeat(4,1fr); gap:8px; margin-bottom:14px; padding-bottom:14px; border-bottom:1px solid var(--border-soft); }
.habit-summary-item{ display:flex; flex-direction:column; align-items:center; text-align:center; gap:2px; }
.habit-summary-item .hs-val{ font-family:var(--font-head); font-weight:700; font-size:17px; color:var(--ink); }
.habit-summary-item .hs-lbl{ font-size:10.5px; color:var(--muted); font-weight:600; }

/* Calendario compacto y libre por hábito (sin metas) */
.habit-mini-cal{ max-width:280px; }
.cal-nav.mini{ margin-bottom:8px; }
.cal-month-label.mini{ font-size:13px; }
.cal-weekdays.mini{ margin-bottom:4px; }
.cal-weekdays.mini span{ font-size:9.5px; }
.cal-grid.mini{ gap:3px; }
.cal-cell.mini{ border-radius:8px; }
.cal-cell.mini .cal-daynum{ font-size:10.5px; }
.cal-cell.habit-cell.on{ animation:popIn .2s var(--ease); }
.cal-cell.future{ cursor:default; opacity:.28; }
.cal-cell.future:hover{ border-color:transparent; }

.book-grid{ display:grid; grid-template-columns:repeat(3,1fr); gap:14px; }
.book-card{ padding:17px; display:flex; flex-direction:column; gap:8px; }
.book-author{ font-size:12px; color:var(--muted); margin:2px 0 0; }
.book-status{ font-size:12.5px; padding:8px 10px; }
.page-input-row{ display:flex; align-items:center; gap:6px; font-size:12px; color:var(--muted); }
.page-input-row input{ width:70px; padding:6px 8px; }
.stars-static{ display:flex; gap:2px; }
.stars-static button{ background:none; border:none; cursor:pointer; padding:0; color:var(--amber); transition:transform .15s; }
.stars-static button svg{ width:17px; height:17px; }
.stars-static button:hover{ transform:scale(1.2); }

.testament-label{ font-weight:700; font-size:12.5px; color:var(--muted); text-transform:uppercase; letter-spacing:0.04em; margin:14px 0 8px; }
.testament-label:first-of-type{ margin-top:0; }
.bible-book-grid{ display:flex; flex-direction:column; gap:8px; }
.bible-book{ border:1px solid var(--border); border-radius:13px; padding:11px 13px; }
.bible-book-head{ display:flex; align-items:center; gap:10px; width:100%; background:none; border:none; cursor:pointer; font-family:inherit; padding:0; }
.bible-book-head span:first-child{ flex:1; text-align:left; font-weight:700; font-size:13.5px; }
.book-pct{ font-size:11.5px; color:var(--muted); }
.chapter-grid{ display:grid; grid-template-columns:repeat(10,1fr); gap:5px; margin-top:10px; animation:fadeIn .25s var(--ease); }
.chapter-cell{ aspect-ratio:1; border-radius:7px; border:1px solid var(--border); background:var(--surface-2); font-size:10.5px; color:var(--muted); cursor:pointer; transition:all .15s; }
.chapter-cell:hover{ transform:scale(1.08); }
.chapter-cell.on{ background:var(--violet); color:#fff; border-color:var(--violet); }

.hint-text{ font-size:12px; color:var(--muted); line-height:1.5; margin:0 0 10px; display:flex; align-items:flex-start; gap:6px; }
.hint-text svg{ width:14px; height:14px; flex-shrink:0; margin-top:1px; color:var(--muted-soft); }
.verse-form, .reflection-form, .gratitude-form{ display:flex; flex-direction:column; gap:10px; }
.reflection-list{ margin-top:14px; display:flex; flex-direction:column; gap:8px; }
.reflection-item{ display:flex; justify-content:space-between; align-items:flex-start; gap:8px; padding:10px 0; border-top:1px solid var(--border-soft); font-size:13px; }
.reflection-date{ font-weight:700; color:var(--teal2); font-size:11.5px; text-transform:uppercase; }
.reflection-item p{ margin:2px 0 0; }

.mood-row{ display:flex; justify-content:space-between; gap:6px; }
.mood-btn{ flex:1; display:flex; flex-direction:column; align-items:center; gap:4px; padding:11px 4px; border-radius:13px; border:1.5px solid var(--border); background:var(--surface-2); cursor:pointer; transition:all .2s var(--ease); }
.mood-btn:hover{ transform:translateY(-2px); }
.mood-btn.sel{ border-color:var(--amber); background:var(--amber-light); animation:popIn .25s var(--ease); }
.mood-emoji{ font-size:22px; }
.mood-label{ font-size:10px; color:var(--muted); }

.breathing-wrap{ display:flex; flex-direction:column; align-items:center; gap:14px; padding:6px 0; }
.breathing-circle{ width:80px; height:80px; border-radius:50%; background:var(--blue-light); border:2px solid var(--blue); display:flex; align-items:center; justify-content:center; color:var(--blue); }
.breathing-circle svg{ width:26px; height:26px; }
.breathing-circle.active{ animation: breathe 6s ease-in-out infinite; }
@keyframes breathe{ 0%,100%{ transform:scale(1);} 50%{ transform:scale(1.35);} }

.water-row{ display:flex; align-items:center; justify-content:center; gap:16px; margin-bottom:8px; }
.water-count{ font-weight:700; font-size:15px; font-family:var(--font-head); }
.sleep-input{ margin-bottom:6px; }
.card-title-row{ display:flex; align-items:center; gap:8px; font-weight:700; font-family:var(--font-head); font-size:14.5px; margin-bottom:10px; }
.card-title-row svg{ width:17px; height:17px; }
.ttl-blue{ color:var(--blue); } .ttl-violet{ color:var(--violet); } .ttl-amber{ color:var(--amber); } .ttl-pink{ color:var(--pink); }

.ring-wrap{ position:relative; flex-shrink:0; }
.ring-label{ position:absolute; inset:0; display:flex; align-items:center; justify-content:center; flex-direction:column; font-size:14px; }
.ring-label svg{ width:18px; height:18px; }

.toast{ position:fixed; bottom:80px; left:50%; transform:translateX(-50%); background:var(--ink); color:#fff; padding:12px 20px; border-radius:12px; font-size:13px; z-index:60; box-shadow:var(--shadow-lg); max-width:90vw; text-align:center; animation:fadeInUp .3s var(--ease); display:flex; align-items:center; gap:8px; font-weight:600; }

/* ===================== CALENDARIO (fusión Tareas + Eventos) ===================== */
.notif-banner{ display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; background:var(--brand-light); border:1px solid var(--border); border-radius:16px; padding:14px 18px; font-size:13px; font-weight:700; animation:fadeInUp .3s var(--ease); }
.notif-banner span{ display:flex; align-items:center; gap:8px; }
.notif-banner svg{ width:18px; height:18px; color:var(--brand-dark); flex-shrink:0; }
.notif-banner.denied{ background:var(--red-light); }
.notif-banner.denied svg{ color:var(--red); }

.cal-card{ overflow:hidden; }
.cal-nav{ display:flex; align-items:center; justify-content:space-between; margin-bottom:12px; }
.cal-month-label{ margin:0; font-family:var(--font-head); font-size:16px; font-weight:700; text-transform:capitalize; }
.cal-weekdays{ display:grid; grid-template-columns:repeat(7,1fr); gap:4px; margin-bottom:6px; }
.cal-weekdays span{ text-align:center; font-size:11px; font-weight:700; color:var(--muted); text-transform:uppercase; }
.cal-grid{ display:grid; grid-template-columns:repeat(7,1fr); gap:4px; }
.cal-cell{ aspect-ratio:1; border:1.5px solid transparent; border-radius:12px; background:var(--surface-2); display:flex; flex-direction:column; align-items:center; justify-content:center; gap:3px; cursor:pointer; font-family:inherit; color:var(--ink); transition:all .18s var(--ease); padding:2px; }
.cal-cell:hover{ border-color:var(--brand); }
.cal-cell.muted{ opacity:.35; }
.cal-cell.today{ background:var(--brand-light); font-weight:700; color:var(--brand-darker); }
.cal-cell.selected{ background:var(--brand); color:#fff; animation:popIn .2s var(--ease); }
.cal-daynum{ font-size:12.5px; }
.cal-dots{ display:flex; gap:2px; align-items:center; height:6px; }
.cal-dot{ width:5px; height:5px; border-radius:50%; }
.cal-more{ font-size:8px; color:var(--muted); }
.cal-cell.selected .cal-more{ color:#fff; }

.agenda-list{ list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:2px; }
.agenda-list li{ display:flex; align-items:flex-start; gap:10px; padding:11px 0; border-bottom:1px solid var(--border-soft); font-size:13.5px; }
.agenda-list li:last-child{ border-bottom:none; }
.agenda-list .dot{ margin-top:5px; }
.agenda-info{ flex:1; display:flex; flex-direction:column; min-width:0; }
.agenda-title{ font-weight:700; }
.agenda-meta{ color:var(--muted); font-size:11.5px; margin-top:1px; display:flex; align-items:center; gap:4px; flex-wrap:wrap; }
.agenda-meta svg{ width:11px; height:11px; }
.agenda-desc{ color:var(--muted); font-size:12px; margin-top:3px; }

/* línea de tiempo estilo Google Calendar para el día seleccionado */
.timeline-wrap{ position:relative; max-height:420px; overflow-y:auto; border:1px solid var(--border-soft); border-radius:14px; background:var(--surface-2); }
.timeline{ position:relative; }
.timeline-row{ display:grid; grid-template-columns:52px 1fr; height:52px; border-bottom:1px dashed var(--border); }
.timeline-row:last-child{ border-bottom:none; }
.timeline-hourlabel{ font-size:10.5px; color:var(--muted-soft); font-weight:700; text-align:right; padding:4px 8px 0 0; transform:translateY(-7px); }
.timeline-track{ position:relative; }
.timeline-now{ position:absolute; left:0; right:0; height:2px; background:var(--red); z-index:3; }
.timeline-now::before{ content:''; position:absolute; left:-4px; top:-3px; width:8px; height:8px; border-radius:50%; background:var(--red); }
.timeline-event{ position:absolute; left:60px; right:8px; border-radius:9px; padding:5px 9px; color:#fff; font-size:11.5px; font-weight:700; overflow:hidden; box-shadow:var(--shadow-xs); cursor:pointer; z-index:2; line-height:1.3; }
.timeline-event .tl-time{ display:block; font-weight:600; opacity:.85; font-size:10px; }
.timeline-event.is-done{ opacity:.55; text-decoration:line-through; }

.allday-strip{ display:flex; flex-wrap:wrap; gap:6px; margin:2px 0 12px; }
.allday-chip{ display:flex; align-items:center; gap:6px; background:var(--surface-2); border:1px solid var(--border); border-radius:20px; padding:5px 11px 5px 8px; font-size:12px; font-weight:700; cursor:pointer; }
.allday-chip .dot{ width:7px; height:7px; }
.allday-chip.is-done{ opacity:.55; text-decoration:line-through; }

.cal-daypanel-head{ display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:10px; flex-wrap:wrap; }
.section-label{ font-size:11.5px; font-weight:700; color:var(--muted); text-transform:uppercase; letter-spacing:.04em; margin:16px 0 8px; }
.section-label:first-child{ margin-top:0; }

@media (min-width: 861px){
  .toast{ bottom:24px; }
}

@media (max-width: 860px){
  .sidebar{ display:none; }
  .topbar{ display:flex; align-items:center; justify-content:space-between; position:sticky; top:0; background:var(--surface); border-bottom:1px solid var(--border); padding:13px 16px; z-index:20; }
  .topbar-title{ display:flex; align-items:center; gap:8px; font-weight:700; font-size:14px; font-family:var(--font-head); }
  .topbar-title svg{ width:18px; height:18px; color:var(--brand); }
  .topbar-user{ display:flex; align-items:center; gap:6px; font-size:12px; color:var(--muted); font-weight:600; }
  .topbar-user svg{ width:15px; height:15px; }
  .app-shell{ flex-direction:column; }
  .main-content{ padding:18px 16px 90px; max-width:100%; }
  .stat-grid, .stat-grid.three{ grid-template-columns:1fr 1fr; }
  .dash-cols, .dash-cols.three, .dash-cols.cal-layout{ grid-template-columns:1fr; }
  .book-grid{ grid-template-columns:1fr 1fr; }
  .bottom-nav{ display:flex; position:fixed; bottom:0; left:0; right:0; background:var(--surface); border-top:1px solid var(--border); z-index:20; padding:6px 2px; padding-bottom:calc(6px + env(safe-area-inset-bottom)); box-shadow:var(--shadow-nav); }
  .bottom-nav-item{ flex:1; display:flex; flex-direction:column; align-items:center; gap:3px; background:none; border:none; color:var(--muted-soft); font-size:9px; font-weight:700; padding:6px 0; cursor:pointer; font-family:inherit; transition:color .2s, transform .2s; }
  .bottom-nav-item svg{ width:19px; height:19px; }
  .bottom-nav-item.active{ color:var(--brand-dark); transform:translateY(-2px); }
  .mobile-nav-overlay{ display:block; position:fixed; inset:0; background:rgba(2,9,58,0.45); z-index:30; animation:fadeIn .2s var(--ease); }
  .mobile-nav{ position:absolute; top:0; left:0; bottom:0; width:240px; background:var(--surface); padding:20px 14px; display:flex; flex-direction:column; gap:4px; animation:fadeInUp .25s var(--ease); }

  .auth-screen{ padding:0; }
  .auth-shell{ flex-direction:column; border-radius:0; min-height:100vh; box-shadow:none; }
  .auth-brand-panel{ flex:none; padding:38px 26px 30px; }
  .auth-brand-headline{ font-size:23px; }
  .auth-illustration{ display:none; }
  .auth-feature-list{ flex-direction:row; flex-wrap:wrap; gap:8px; }
  .auth-feature-list li{ background:rgba(255,255,255,.1); padding:6px 10px; border-radius:20px; }
  .auth-card{ padding:32px 24px 44px; max-width:100%; }
  .list-toolbar{ flex-direction:column; align-items:stretch; }
  .toolbar-tools{ justify-content:space-between; }
}
@media (max-width: 480px){
  .book-grid{ grid-template-columns:1fr; }
  .stat-grid, .stat-grid.three{ grid-template-columns:1fr 1fr; }
  .chapter-grid{ grid-template-columns:repeat(7,1fr); }
  .cal-daynum{ font-size:11px; }
  .date-filter-wrap input{ width:100px; }
  .habit-summary{ grid-template-columns:1fr 1fr; }
}

/* ===================== CUADERNO (notas tipo Notion) ===================== */
/* El panel se fija a una altura ligada al alto de la ventana (en vez de crecer
   sin límite) para que tanto la lista de notas como el editor tengan SU PROPIO
   scroll interno — así la lista de notas de una carpeta se ve grande y cómoda
   de verdad, en vez de una cajita diminuta. */
.notebook-shell{ display:grid; grid-template-columns:380px 1fr; gap:16px; height:calc(100vh - 172px); min-height:600px; }
.notebook-sidebar{ display:flex; flex-direction:column; height:100%; min-height:0; }
.notebook-sidebar-top{ flex-shrink:0; }
.notebook-sidebar .section-label{ margin:14px 0 6px; }
.notebook-newfolder-form{ display:flex; flex-direction:column; gap:8px; }
.notebook-newfolder-form .nf-row{ display:flex; align-items:center; gap:8px; }
.notebook-newfolder-form input{ flex:1; padding:12px 13px; font-size:14px; min-height:44px; }
.notebook-newfolder-form .color-picker{ flex:0 0 auto; }
.notebook-newfolder-form .color-picker label{ width:20px; height:20px; }
.notebook-newfolder-form button[type="submit"]{ width:44px; height:44px; flex-shrink:0; background:var(--brand-light); color:var(--brand-dark); border-radius:var(--radius-sm); }
.notebook-folder-list{ display:flex; flex-direction:column; gap:4px; max-height:190px; overflow-y:auto; }
.notebook-folder-row{ display:flex; align-items:center; gap:2px; }
.notebook-folder-row .notebook-folder-item{ flex:1; }
.notebook-folder-item{ display:flex; align-items:center; gap:10px; padding:11px 12px; border-radius:var(--radius-sm); border:none; background:none; color:var(--ink-soft); font-weight:600; font-size:13.5px; cursor:pointer; font-family:inherit; text-align:left; width:100%; min-height:44px; }
.notebook-folder-item svg{ color:var(--muted-soft); flex-shrink:0; }
.notebook-folder-item span:nth-child(2){ flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.notebook-folder-item:hover{ background:var(--bg-soft); }
.notebook-folder-item.active{ background:var(--brand-light); color:var(--brand-darker); font-weight:700; }
.nf-count{ font-size:11px; color:var(--muted-soft); font-weight:700; flex-shrink:0; }
.icon-btn.sm{ width:26px; height:26px; padding:4px; flex-shrink:0; }

.notebook-sidebar-notes{ flex:1; min-height:0; display:flex; flex-direction:column; margin-top:16px; padding-top:16px; border-top:1px solid var(--border-soft); }
.notebook-notes-headrow{ display:flex; align-items:center; justify-content:space-between; }
.notebook-search{ display:flex; align-items:center; gap:6px; background:var(--surface-2); border:1.5px solid var(--border); border-radius:var(--radius-sm); padding:0 12px; min-height:44px; margin-top:8px; flex-shrink:0; }
.notebook-search svg{ color:var(--muted-soft); flex-shrink:0; }
.notebook-search input{ border:none; background:none; padding:8px 0; font-size:13px; min-height:auto; }
.notebook-search input:focus{ box-shadow:none; }
.notebook-sidebar-notes > .btn-primary{ margin-top:8px; flex-shrink:0; }
/* La lista de notas ocupa TODO el espacio vertical que sobra: es la zona
   "larga" que pediste, con su propio scroll independiente del resto. */
.notebook-note-list{ flex:1; min-height:120px; display:flex; flex-direction:column; gap:4px; overflow-y:auto; margin-top:10px; }
.note-item{ display:flex; flex-direction:column; gap:5px; text-align:left; padding:13px 14px; border-radius:var(--radius-sm); border:1px solid transparent; background:none; cursor:pointer; font-family:inherit; transition:background-color .15s var(--ease), border-color .15s var(--ease); }
.note-item:hover{ background:var(--bg-soft); }
.note-item.active{ background:var(--brand-light); border-color:var(--brand-line); }
.note-item-title{ font-weight:700; font-size:17px; overflow:hidden; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; white-space:normal; word-break:break-word; line-height:1.3; }
.note-item-snippet{ font-size:14.5px; color:var(--muted); overflow:hidden; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; white-space:normal; word-break:break-word; line-height:1.4; }
.note-item-date{ font-size:12px; color:var(--muted-soft); }

.notebook-editor{ height:100%; min-height:0; display:flex; flex-direction:column; padding:20px 24px; }
.notebook-editor > .empty{ margin:auto; }
.notebook-editor-head{ display:flex; align-items:center; gap:10px; margin-bottom:10px; flex-wrap:wrap; flex-shrink:0; }
.notebook-editor-title{ flex:1; border:none; background:none; font-family:var(--font-head); font-weight:700; font-size:21px; padding:4px 2px; min-width:160px; }
.notebook-editor-title:focus{ box-shadow:none; }
.notebook-editor-head-actions{ display:flex; align-items:center; gap:8px; }
.notebook-folder-select{ width:auto; font-size:12.5px; padding:7px 28px 7px 10px; }

.editor-toolbar{ display:flex; flex-wrap:wrap; align-items:center; gap:5px; padding:8px; background:var(--surface-2); border:1px solid var(--border); border-radius:var(--radius-md); margin-bottom:12px; flex-shrink:0; }
.editor-toolbar.et-pinned{ box-shadow:var(--shadow-nav); background:var(--surface); }
.et-select{ width:auto; padding:6px 24px 6px 8px; font-size:12px; font-weight:600; border-radius:var(--radius-xs); }
.et-divider{ width:1px; align-self:stretch; background:var(--border); margin:2px 2px; }
.et-btn{ min-width:30px; height:30px; padding:0 8px; border-radius:var(--radius-xs); border:1.5px solid transparent; background:none; color:var(--ink-soft); font-family:inherit; font-size:12.5px; font-weight:700; cursor:pointer; display:flex; align-items:center; justify-content:center; gap:4px; transition:background .15s, border-color .15s; }
.et-btn:hover{ background:var(--surface); border-color:var(--border); }
.et-btn svg{ width:15px; height:15px; }
.et-btn.et-b{ font-weight:700; } .et-btn.et-i{ font-style:italic; } .et-btn.et-u{ text-decoration:underline; } .et-btn.et-s{ text-decoration:line-through; }
.et-btn.danger:hover{ background:var(--red-light); color:var(--red); border-color:transparent; }
.et-swatches{ display:flex; gap:4px; align-items:center; padding:0 3px; }
.et-swatch{ width:17px; height:17px; border-radius:50%; border:1.5px solid rgba(0,0,0,0.08); cursor:pointer; padding:0; }
.et-swatch:hover{ transform:scale(1.15); }
.et-swatch-none{ background:var(--surface); color:var(--muted); display:flex; align-items:center; justify-content:center; border:1.5px solid var(--border); }
.et-swatch-none svg{ width:9px; height:9px; }

.notebook-editor-body{ flex:1; min-height:0; overflow-y:auto; outline:none; font-size:14.5px; line-height:1.7; color:var(--ink); padding:6px 10px 40px 2px; }
.notebook-editor-body:empty::before{ content:'Escribe aquí...'; color:var(--muted-soft); }
.notebook-editor-body h1{ font-family:var(--font-head); font-size:24px; font-weight:700; margin:14px 0 8px; }
.notebook-editor-body h2{ font-family:var(--font-head); font-size:19px; font-weight:700; margin:12px 0 6px; }
.notebook-editor-body h3{ font-family:var(--font-head); font-size:16px; font-weight:700; margin:10px 0 6px; }
.notebook-editor-body blockquote{ font-family:var(--font-accent); font-style:italic; border-left:3px solid var(--brand); margin:10px 0; padding:4px 14px; color:var(--ink-soft); background:var(--brand-light); border-radius:0 8px 8px 0; }
.notebook-editor-body ul, .notebook-editor-body ol{ padding-left:22px; margin:8px 0; }
.notebook-editor-body img{ max-width:100%; border-radius:10px; }
/* table-layout:fixed reparte el ancho entre columnas de forma pareja en vez de
   estirarse según el contenido más largo; el wrapper con overflow-x:auto le da
   scroll horizontal PROPIO a la tabla si aun así el contenido no cabe, en vez
   de forzar el scroll de toda la página. word-break parte palabras/código muy
   largos sin espacios para que no se salgan de la celda. */
.notebook-editor-body .table-wrap{ max-width:100%; overflow-x:auto; margin:10px 0; -webkit-overflow-scrolling:touch; }
.notebook-editor-body .table-wrap table{ margin:0; }
.notebook-editor-body table{ border-collapse:collapse; table-layout:fixed; width:100%; max-width:100%; }
.notebook-editor-body table td, .notebook-editor-body table th{ border:1px solid var(--border); padding:8px 10px; word-break:break-word; overflow-wrap:anywhere; white-space:pre-wrap; }
.notebook-editor-body code, .notebook-editor-body pre{ font-family:'SFMono-Regular',Consolas,'Liberation Mono',Menlo,monospace; font-size:13px; background:var(--surface-2); border:1px solid var(--border); border-radius:6px; word-break:break-word; overflow-wrap:anywhere; white-space:pre-wrap; }
.notebook-editor-body code{ padding:1px 5px; }
.notebook-editor-body pre{ padding:10px 12px; overflow-x:auto; line-height:1.5; }
.notebook-editor-body pre code{ border:none; padding:0; background:none; }
.notebook-editor-body p{ margin:0 0 8px; }

@media (max-width: 860px){
  .notebook-shell{ grid-template-columns:1fr; height:auto; min-height:0; gap:14px; }
  .notebook-sidebar{ height:auto; }
  .notebook-folder-list{ max-height:160px; }
  .notebook-sidebar-notes{ flex:none; }
  .notebook-note-list{ flex:none; max-height:min(62vh,560px); }
  .notebook-editor{ height:auto; min-height:460px; padding:16px; }
  .notebook-editor-body{ overflow-y:visible; min-height:360px; padding:6px 2px 20px; }
}

/* ===================== GASTOS FIJOS / SUSCRIPCIONES ===================== */
.recurring-total{ font-family:var(--font-head); font-weight:700; font-size:13px; color:var(--brand-dark); background:var(--brand-light); padding:5px 12px; border-radius:20px; white-space:nowrap; }
.tx-list li .btn-ghost{ flex-shrink:0; }
.tx-list li .btn-ghost.is-paid{ color:var(--brand-dark); border-color:var(--brand-line); background:var(--brand-light); }

/* ===================== Edición de imágenes dentro del Cuaderno ===================== */
.image-toolbar{ background:var(--brand-light) !important; border-color:var(--brand-line) !important; }
.image-toolbar .it-label{ font-weight:700; font-size:12.5px; color:var(--brand-darker); display:flex; align-items:center; gap:6px; padding:0 4px; }
.notebook-editor-body .note-figure{ margin:10px 0; text-align:center; }
.notebook-editor-body .note-figure img{ margin:0; }
.notebook-editor-body figcaption{ font-size:12.5px; color:var(--muted); margin-top:5px; outline:none; }
.notebook-editor-body figcaption:empty::before{ content:attr(data-placeholder); color:var(--muted-soft); }
.notebook-editor-body img{ cursor:pointer; transition:box-shadow .15s var(--ease); }
.notebook-editor-body img:hover{ box-shadow:0 0 0 2px var(--brand-line); }

.crop-overlay{ position:fixed; inset:0; background:rgba(2,9,58,0.6); z-index:80; display:flex; align-items:center; justify-content:center; padding:20px; animation:fadeIn .2s var(--ease); }
.crop-modal{ background:var(--surface); border-radius:20px; padding:20px; box-shadow:var(--shadow-lg); max-width:92vw; }
.crop-title{ font-family:var(--font-head); font-weight:700; font-size:15px; margin:0 0 12px; }
.crop-stage{ position:relative; margin:0 auto; touch-action:none; border-radius:6px; overflow:hidden; }
.crop-img{ position:absolute; top:0; left:0; user-select:none; pointer-events:none; display:block; }
.crop-rect{ position:absolute; border:2px solid #fff; box-shadow:0 0 0 2000px rgba(0,0,0,0.45); cursor:move; touch-action:none; }
.crop-handle{ position:absolute; width:16px; height:16px; background:#fff; border:2px solid var(--brand); border-radius:50%; touch-action:none; }
.crop-handle.nw{ left:-8px; top:-8px; cursor:nwse-resize; }
.crop-handle.ne{ right:-8px; top:-8px; cursor:nesw-resize; }
.crop-handle.sw{ left:-8px; bottom:-8px; cursor:nesw-resize; }
.crop-handle.se{ right:-8px; bottom:-8px; cursor:nwse-resize; }
.crop-actions{ display:flex; justify-content:flex-end; gap:10px; margin-top:16px; }

/* ===== Modal de confirmación de borrado (reutilizable en toda la app) ===== */
.confirm-overlay{ position:fixed; inset:0; z-index:100; background:rgba(2,9,58,0.5); display:flex; align-items:center; justify-content:center; padding:20px; opacity:0; transition:opacity .15s var(--ease); }
.confirm-overlay.open{ opacity:1; }
.confirm-modal{ background:var(--surface); border-radius:var(--radius-lg); box-shadow:var(--shadow-lg); padding:26px 26px 22px; width:min(380px,100%); text-align:center; transform:translateY(8px) scale(.97); transition:transform .18s var(--ease); }
.confirm-overlay.open .confirm-modal{ transform:translateY(0) scale(1); }
.confirm-icon{ width:48px; height:48px; border-radius:50%; background:var(--red-light); color:var(--red); display:flex; align-items:center; justify-content:center; margin:0 auto 14px; }
.confirm-icon.neutral{ background:var(--brand-light); color:var(--brand-dark); }
.confirm-title{ font-family:var(--font-head); font-size:17px; font-weight:700; margin:0 0 8px; }
.confirm-message{ font-size:13.5px; color:var(--muted); line-height:1.55; margin:0 0 20px; }
.confirm-actions{ display:flex; gap:10px; }
.confirm-actions .btn-ghost, .confirm-actions .btn-primary{ flex:1; }

/* Menú contextual del editor de notas (clic derecho / mantener presionado): siempre se abre, sobre texto normal o sobre una tabla */
.table-ctx-menu{ position:fixed; z-index:90; background:var(--surface); border:1px solid var(--border); border-radius:12px; box-shadow:var(--shadow-lg); padding:6px; min-width:230px; max-height:min(430px,80vh); overflow-y:auto; animation:popIn .12s var(--ease); }
.ctx-item{ display:block; width:100%; text-align:left; padding:10px 12px; border:none; background:none; border-radius:8px; font-family:inherit; font-size:13px; font-weight:600; color:var(--ink-soft); cursor:pointer; }
.ctx-item:hover{ background:var(--bg-soft); color:var(--ink); }
.ctx-item.danger:hover{ background:var(--red-light); color:var(--red); }
.ctx-sep{ height:1px; background:var(--border-soft); margin:5px 4px; }
.ctx-swatch-row{ display:flex; align-items:center; gap:6px; padding:6px 10px 8px; }
.ctx-swatch-label{ font-size:11px; font-weight:700; color:var(--muted); min-width:54px; flex-shrink:0; }
.ctx-swatch{ width:18px; height:18px; border-radius:50%; border:1.5px solid rgba(0,0,0,0.08); cursor:pointer; padding:0; flex-shrink:0; }
.ctx-swatch:hover{ transform:scale(1.15); }
.ctx-swatch-none{ background:var(--surface); color:var(--muted); display:flex; align-items:center; justify-content:center; border:1.5px solid var(--border); }
.ctx-swatch-none svg{ width:9px; height:9px; }

/* ===== IA integrada: chip de selección + tarjeta de respuesta ===== */
.ai-select-chip{
  position:fixed; z-index:95; display:flex; align-items:center; gap:6px;
  background:var(--brand-darker); color:#fff; border:none; border-radius:20px;
  padding:8px 14px; font-family:inherit; font-size:12.5px; font-weight:700;
  cursor:pointer; box-shadow:0 8px 20px -6px rgba(2,9,58,0.45); animation:popIn .12s var(--ease);
}
.ai-select-chip:hover{ background:var(--brand-dark); }
.ai-select-chip svg{ width:13px; height:13px; }
.ai-answer-backdrop{ position:fixed; inset:0; z-index:96; background:rgba(2,9,58,0.4); animation:fadeIn .15s var(--ease); }
.ai-answer-card{
  position:fixed; z-index:97; left:50%; top:50%; transform:translate(-50%,-50%);
  width:min(420px, 92vw); max-height:min(480px,80vh);
  display:flex; flex-direction:column; background:var(--surface); border:1px solid var(--border);
  border-radius:16px; box-shadow:var(--shadow-lg); overflow:hidden; animation:popIn .15s var(--ease);
}
.ai-answer-head{
  display:flex; align-items:center; justify-content:space-between; gap:8px;
  padding:10px 8px 10px 14px; background:var(--brand-light); color:var(--brand-darker);
  font-size:12.5px; font-weight:700; flex-shrink:0;
}
.ai-answer-head span{ display:flex; align-items:center; gap:6px; }
.ai-answer-head svg{ width:14px; height:14px; }
.ai-answer-body{ padding:12px 14px; overflow-y:auto; font-size:13.5px; line-height:1.55; color:var(--ink-soft); }
.ai-answer-loading{ display:flex; align-items:center; gap:8px; color:var(--muted); }
.ai-answer-loading svg{ animation:spin 1.1s linear infinite; }
.ai-answer-error{ display:flex; align-items:flex-start; gap:8px; color:var(--red); }
.ai-answer-sources{ margin-top:10px; padding-top:10px; border-top:1px solid var(--border-soft); font-size:11.5px; color:var(--muted); display:flex; align-items:flex-start; gap:5px; flex-wrap:wrap; }
.ai-answer-sources svg{ width:11px; height:11px; margin-top:2px; flex-shrink:0; }
.ai-answer-sources a{ color:var(--brand-dark); font-weight:700; text-decoration:none; }
.ai-answer-sources a:hover{ text-decoration:underline; }
