@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;0,600;0,700;1,300;1,400&family=DM+Sans:wght@300;400;500;600;700&display=swap');

:root{
  --bg: #f2f2f0;
  --bg-raised: #f5ede4;
  --bg-card: #fdfcfa;
  --border: rgba(127,169,155,0.2);
  --border-strong: rgba(127,169,155,0.4);
  --text: #2a2a28;
  --text-muted: #6b6b68;
  --text-faint: #9a9890;
  --accent: #e85d24;
  --accent-dim: rgba(232,93,36,0.10);
  --accent-strong: #7fa99b;
  --accent-ink: #fdfcfa;
  --teal-bg: #e8f0ee;
  --teal-dark: #5c8578;
  --danger: #b5432f;
  --radius-pill: 999px;
  --radius: 14px;
  --serif: 'Cormorant Garamond', Georgia, serif;
  --sans: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

*{ box-sizing: border-box; }
[hidden]{ display: none !important; }
html{ scroll-behavior: smooth; }
body{
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1,h2,h3,h4{
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: 0.01em;
  margin: 0 0 0.4em;
}
p{ margin: 0 0 1em; color: var(--text-muted); }
a{ color: inherit; text-decoration: none; }
:focus-visible{ outline: 2px solid var(--accent); outline-offset: 3px; }
img{ max-width: 100%; display:block; }

.container{ max-width: 1920px; margin: 0 auto; padding: 0 32px; }
/* Nota: dejamos un tope en 1920px (no ancho infinito) para que en monitores
   ultrawide el texto no se estire a líneas imposibles de leer. En cualquier
   laptop/monitor normal esto ya ocupa el ancho real de la pantalla. */

/* ---------- Reveal on scroll (textos y bloques que van "apareciendo") ---------- */
.reveal{ opacity: 0; transform: translateY(18px); transition: opacity .55s ease, transform .55s ease; }
.reveal.reveal-visible{ opacity: 1; transform: translateY(0); }
@media (prefers-reduced-motion: reduce){
  .reveal{ opacity: 1; transform: none; transition: none; }
}

/* ---------- Header ---------- */
.site-header{
  position: sticky; top: 0; z-index: 50;
  background: rgba(253,252,250,0.96);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.site-header .container{
  display:flex; align-items:center; justify-content:space-between;
  height: 68px;
}
.logo{
  font-family: var(--serif); font-weight: 600; font-size: 1.15rem; letter-spacing: 0.1em;
  display:flex; align-items:center; gap:8px;
}
.logo .dot{ color: var(--accent); }
.main-nav{ display:flex; align-items:center; gap: 28px; }
.main-nav a{
  font-size: 0.92rem; color: var(--text-muted); transition: color .15s ease;
}
.main-nav a:hover, .main-nav a.active{ color: var(--text); }
.header-actions{ display:flex; align-items:center; gap: 14px; }
.user-chip{ font-size: 0.85rem; color: var(--text-muted); }
.user-chip strong{ color: var(--text); font-weight: 500; }

/* ---------- Buttons ---------- */
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  padding: 11px 24px;
  border-radius: var(--radius-pill);
  font-family: var(--sans); font-size: 0.9rem; font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .12s ease, background .15s ease, border-color .15s ease, opacity .15s ease;
  white-space: nowrap;
}
.btn:active{ transform: scale(0.97); }
.btn-primary{ background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover{ background: var(--accent-strong); }
.btn-outline{ background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn-outline:hover{ border-color: var(--accent); color: var(--accent); }
.btn-ghost{ background: transparent; color: var(--text-muted); padding: 11px 14px; }
.btn-ghost:hover{ color: var(--text); }
.btn-danger{ background: transparent; color: var(--danger); border-color: rgba(217,105,95,0.4); }
.btn-danger:hover{ background: rgba(217,105,95,0.1); }
.btn-sm{ padding: 7px 16px; font-size: 0.8rem; }
.btn:disabled{ opacity: 0.4; cursor: not-allowed; }
.btn-block{ width: 100%; }

/* ---------- Hero ---------- */
.hero{ padding: 108px 0 88px; position: relative; overflow: hidden; }
.hero::before{
  content:''; position:absolute; top:-180px; right:-160px; width:520px; height:520px;
  background: radial-gradient(circle, var(--accent-dim) 0%, transparent 70%);
  pointer-events:none;
}
.eyebrow{
  display:inline-flex; align-items:center; gap:8px;
  font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--accent-strong); font-weight: 600; margin-bottom: 22px;
}
.eyebrow::before{ content:''; width:6px; height:6px; border-radius:50%; background: var(--accent-strong); }
.hero h1{
  font-size: clamp(2.4rem, 5vw, 4rem);
  max-width: 15ch; margin-bottom: 0.3em; color: var(--text);
}
.hero .lead{ font-size: 1.15rem; max-width: 56ch; color: var(--text-muted); margin-bottom: 2.2em; }
.hero-actions{ display:flex; gap: 14px; flex-wrap: wrap; }

/* ---------- Sections ---------- */
section{ padding: 72px 0; }
.section-head{ max-width: 62ch; margin-bottom: 44px; }
.section-head .eyebrow{ margin-bottom: 14px; }
.section-head h2{ font-size: clamp(1.8rem, 3vw, 2.4rem); }

.grid{ display:grid; gap: 20px; }
.grid-3{ grid-template-columns: repeat(3, 1fr); }
.grid-4{ grid-template-columns: repeat(4, 1fr); }
@media (max-width: 880px){ .grid-3, .grid-4{ grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px){ .grid-3, .grid-4{ grid-template-columns: 1fr; } }

.card{
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
}
.card h3{ font-size: 1.1rem; color: var(--text); }
.card .num{ font-family: var(--serif); color: var(--accent); font-size: 1.6rem; margin-bottom: 10px; display:block; }

/* ---------- Tarjeta de precio (home) ---------- */
.price-card{
  max-width: 420px; margin: 0 auto;
  background: var(--bg-card); border: 1.5px solid var(--accent);
  border-radius: var(--radius); padding: 40px; text-align: center;
}
.price-card-eyebrow{
  font-size: 0.74rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--accent); font-weight: 700; margin-bottom: 14px;
}
.price-card-amount{ font-family: var(--serif); font-size: 2.6rem; color: var(--text); margin-bottom: 6px; }
.price-card-amount span{ font-size: 0.95rem; color: var(--text-faint); font-family: var(--sans); margin-left: 6px; }
.price-card-note{ font-size: 0.82rem; color: var(--text-faint); margin-bottom: 26px; }
.price-card-features{ list-style: none; padding: 0; margin: 0 0 28px; text-align: left; display:flex; flex-direction:column; gap: 11px; }
.price-card-features li{ font-size: 0.88rem; color: var(--text-muted); padding-left: 22px; position: relative; }
.price-card-features li::before{ content: '—'; position: absolute; left: 0; color: var(--accent); }

/* ---------- Footer ---------- */
.site-footer{ border-top: 1px solid var(--border); padding: 40px 0; margin-top: 60px; }
.site-footer .container{ display:flex; justify-content:space-between; align-items:center; flex-wrap: wrap; gap: 12px; }
.site-footer p{ margin:0; font-size: 0.85rem; color: var(--text-faint); }

/* ---------- Forms ---------- */
.field{ margin-bottom: 18px; }
.field label{ display:block; font-size: 0.82rem; color: var(--text-muted); margin-bottom: 7px; font-weight: 500; }
.field .hint{ font-size: 0.76rem; color: var(--text-faint); margin-top: 5px; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], select, textarea{
  width: 100%;
  background: var(--bg-raised);
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: 10px;
  padding: 12px 14px;
  font-family: var(--sans);
  font-size: 0.95rem;
  transition: border-color .15s ease;
}
input:focus, select:focus, textarea:focus{ border-color: var(--accent); outline: none; }
.input-unit{ position:relative; }
.input-unit input{ padding-right: 56px; }
.input-unit .unit-badge{
  position:absolute; right: 12px; top: 50%; transform: translateY(-50%);
  font-size: 0.72rem; color: var(--accent); background: var(--accent-dim);
  padding: 3px 8px; border-radius: 6px; pointer-events:none;
}
.checkbox-row{ display:flex; align-items:center; gap:10px; }
.checkbox-row input[type="checkbox"]{ width:18px; height:18px; accent-color: var(--accent); }

/* ---------- Badges ---------- */
.badge{
  display:inline-flex; align-items:center; font-size: 0.7rem; font-weight: 600;
  padding: 3px 10px; border-radius: var(--radius-pill); letter-spacing: 0.02em;
}
.badge-accent{ background: var(--accent-dim); color: var(--accent); }
.badge-muted{ background: rgba(43,46,49,0.06); color: var(--text-faint); }
.badge-warn{ background: rgba(217,163,60,0.14); color: #d9a33c; }

/* ---------- Modal ---------- */
.modal-overlay{
  position: fixed; inset: 0; background: rgba(6,7,8,0.72);
  display:flex; align-items:center; justify-content:center; z-index: 100;
  padding: 20px;
}
.modal-overlay[hidden]{ display:none; }
.modal{
  background: var(--bg-card); border: 1px solid var(--border-strong);
  border-radius: 18px; padding: 34px; width: 100%; max-width: 420px;
  position: relative;
}
.modal-close{
  position:absolute; top: 18px; right: 18px; background:none; border:none;
  color: var(--text-faint); font-size: 1.2rem; cursor:pointer; line-height:1;
}
.modal-close:hover{ color: var(--text); }
.modal-tabs{ display:flex; gap: 6px; margin-bottom: 22px; background: var(--bg-raised); padding: 4px; border-radius: var(--radius-pill); }
.modal-tab{ flex:1; text-align:center; padding: 8px; border-radius: var(--radius-pill); font-size: 0.85rem; cursor:pointer; color: var(--text-muted); }
.modal-tab.active{ background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.form-error{ color: var(--danger); font-size: 0.82rem; margin: -6px 0 14px; min-height: 1em; }

/* ---------- Cuadernos grid ---------- */
.cuaderno-card{
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; display:flex; flex-direction:column; gap: 10px; transition: border-color .15s ease;
}
.cuaderno-card:hover{ border-color: var(--border-strong); }
.cuaderno-card h3{ font-size: 1.05rem; margin:0; }
.cuaderno-card .meta{ font-size: 0.8rem; color: var(--text-faint); }
.cuaderno-new{
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius);
  display:flex; align-items:center; justify-content:center; flex-direction:column; gap: 10px;
  min-height: 150px; cursor:pointer; color: var(--text-muted); background: transparent;
}
.cuaderno-new:hover{ border-color: var(--accent); color: var(--accent); }
.cuaderno-new .plus{ font-size: 1.8rem; line-height:1; }

/* ---------- Cuaderno detail layout ---------- */
.cuaderno-layout{ display:flex; gap: 32px; align-items: flex-start; }
@media (max-width: 820px){ .cuaderno-layout{ flex-direction: column; } }
.cuaderno-sidebar{
  position: sticky; top: 88px; z-index: 40; overflow: hidden;
  flex: 0 0 52px; transition: flex-basis .22s ease;
}
.cuaderno-sidebar:hover{ flex-basis: 210px; }
.sidebar-rail{
  display:flex; flex-direction:column; gap: 4px;
  width: 100%; overflow: hidden; border-radius: 12px;
  background: var(--bg-card); border: 1px solid transparent;
}
.cuaderno-sidebar:hover .sidebar-rail{
  border-color: var(--border-strong);
  box-shadow: 0 12px 28px rgba(0,0,0,0.35);
}
.cuaderno-content{ flex: 1 1 0%; min-width: 0; }
.side-link{
  display:flex; align-items:center; gap: 12px;
  padding: 10px 14px; border-radius: 10px; font-size: 0.88rem; color: var(--text-muted); cursor:pointer;
  white-space: nowrap;
}
.side-icon{ flex-shrink:0; width:18px; height:18px; display:flex; }
.side-icon svg{ width:18px; height:18px; display:block; }
.side-label{ opacity:0; transition: opacity .15s ease; }
.cuaderno-sidebar:hover .side-label{ opacity:1; }
.side-link:hover{ color: var(--text); background: var(--bg-raised); }
.side-link.active{ color: var(--accent); background: var(--accent-dim); font-weight: 600; }
.side-link.active .side-icon{ color: var(--accent); }
.side-link.disabled{ opacity: 0.4; cursor: default; pointer-events: none; }
.side-divider{ height:1px; background: var(--border); margin: 10px 6px; }
.cuaderno-sidebar:hover .side-divider{ margin: 10px 14px; }

.rubro-block{ margin-bottom: 30px; }
.rubro-title{ display:flex; align-items:center; gap: 10px; margin-bottom: 14px; }
.rubro-title h3{ font-size: 1.05rem; margin:0; }

.categoria-card{
  border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 12px; overflow:hidden;
  background: var(--bg-card);
}
.categoria-header{
  display:flex; align-items:center; justify-content:space-between;
  padding: 16px 20px; cursor:pointer;
}
.categoria-header .left{ display:flex; align-items:center; gap: 12px; }
.categoria-header h4{ margin:0; font-size: 0.95rem; font-family: var(--sans); font-weight: 600; }
.categoria-header .chev{ color: var(--text-faint); transition: transform .15s ease; }
.categoria-card.open .chev{ transform: rotate(180deg); }
.categoria-body{ display:none; padding: 0 20px 20px; border-top: 1px solid var(--border); }
.categoria-card.open .categoria-body{ display:block; padding-top: 16px; }

.item-inputs{ display:flex; gap: 12px; flex-wrap: wrap; margin: 0; }
.categoria-form{ padding-top: 14px; border-top: 1px solid var(--border); }
.categoria-form-row{ display:flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.cat-type-field{ width: 320px; flex-shrink: 0; margin-bottom: 0; }
.item-inputs .field{ margin-bottom: 0; width: 130px; }
.item-inputs .field.wide{ width: 180px; }
.field-group-label{
  width: 100%; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--accent); font-weight: 700; margin: 6px 0 -2px;
}
.field-group-label:first-child{ margin-top: 0; }
.item-total{ font-size: 0.82rem; color: var(--accent); margin-top: 8px; font-weight: 600; }
.item-materiales{ display:flex; flex-direction:column; gap: 4px; padding: 10px 12px; background: var(--bg-raised); border-radius: 8px; margin-top: 4px; }
.item-material-line{ display:flex; align-items:center; justify-content:space-between; font-size: 0.8rem; color: var(--text-muted); }
.item-material-line span:last-child{ color: var(--text); font-weight: 500; }

/* ---------- Líneas guardadas por ítem (varias instancias del mismo ítem) ---------- */
.item-instances{ display:flex; flex-direction:column; gap: 6px; margin-bottom: 10px; }
.item-instance-line{
  display:flex; align-items:center; gap: 12px;
  background: var(--bg-raised); border-radius: 10px; padding: 9px 12px;
}
.instance-info{ flex:1; min-width:0; display:flex; flex-direction:column; }
.instance-label{ font-size: 0.78rem; font-weight: 600; color: var(--text); }
.instance-detail{ font-size: 0.72rem; color: var(--text-faint); }
.instance-amount{ font-size: 0.82rem; font-weight: 600; color: var(--accent); white-space: nowrap; }
.instance-actions{ display:flex; gap: 4px; }
.icon-btn{
  width: 26px; height: 26px; border-radius: 7px; border: 1px solid var(--border-strong);
  background: transparent; color: var(--text-muted); cursor: pointer;
  display:flex; align-items:center; justify-content:center; font-size: 0.8rem;
  transition: border-color .15s ease, color .15s ease;
}
.icon-btn:hover{ border-color: var(--accent); color: var(--accent); }
.icon-btn.delete-instance-btn:hover{ border-color: var(--danger); color: var(--danger); }
.item-add-actions{ display:flex; gap: 8px; margin-top: 10px; }
.cat-form-badge{ margin: 4px 0 0; }
.cat-form-badge:empty{ display:none; }

/* ---------- Tables ---------- */
table{ width:100%; border-collapse: collapse; }
th, td{ text-align:left; padding: 12px 14px; font-size: 0.87rem; border-bottom: 1px solid var(--border); }
th{ color: var(--text-faint); font-weight: 600; font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.04em; }
td{ color: var(--text-muted); }
td.strong{ color: var(--text); font-weight: 500; }
tbody tr:hover{ background: rgba(43,46,49,0.025); }
.table-card{ background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.table-card table{ margin:0; }
input.inline-edit{ width: 100px; padding: 6px 10px; font-size: 0.85rem; }

/* ---------- Summary / totals ---------- */
.summary-bar{
  position: sticky; bottom: 0; margin-top: 30px;
  background: var(--bg-card); border: 1px solid var(--border-strong); border-radius: var(--radius);
  padding: 22px 26px; display:flex; align-items:center; justify-content:space-between; flex-wrap: wrap; gap: 16px;
}
.summary-bar .total-label{ font-size: 0.8rem; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.06em; }
.summary-bar .total-value{ font-family: var(--serif); font-size: 2rem; color: var(--accent); }

/* ---------- Utility ---------- */
.flex{ display:flex; }
.flex-between{ display:flex; align-items:center; justify-content:space-between; }
.gap-8{ gap: 8px; } .gap-12{ gap:12px; } .gap-16{ gap:16px; }
.mt-8{ margin-top:8px; } .mt-16{ margin-top:16px; } .mt-24{ margin-top:24px; } .mt-40{ margin-top:40px; }
.mb-0{ margin-bottom:0; }
.text-center{ text-align:center; }
.text-muted{ color: var(--text-muted); }
.text-faint{ color: var(--text-faint); }
.empty-state{ text-align:center; padding: 70px 20px; color: var(--text-faint); }
.empty-state h3{ color: var(--text-muted); font-size: 1.1rem; }
.divider{ height:1px; background: var(--border); margin: 40px 0; }
.tag-row{ display:flex; flex-wrap:wrap; gap: 8px; margin-top: 6px; }
.page-title-row{ display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:16px; margin-bottom: 36px; }
.small-note{ font-size: 0.78rem; color: var(--text-faint); }

/* ---------- Rubro tabs — chips en línea + burbuja conectora hacia el panel ---------- */
/* Diseño nuevo: cada rubro es un chip suelto (borde solo cuando está activo).
   Al activarse, una burbuja (rombo rotado) aparece justo debajo, conectando
   visualmente el chip con el panel de ítems — como una cola de globo de diálogo. */
.rubro-tabs{ position: relative; }
.rubro-tab-buttons{ display:flex; gap: 10px; flex-wrap:wrap; align-items:center; position:relative; z-index:1; padding-bottom: 16px; }
.rubro-tab{
  display:flex; align-items:center; gap:8px;
  background: transparent; border: 1.5px solid transparent; cursor:pointer;
  padding: 9px 16px; border-radius: var(--radius-pill);
  color: var(--text-muted); font-size: 0.86rem; font-weight: 600; font-family: var(--sans);
  transition: border-color .2s ease, background .2s ease, color .2s ease;
}
.rubro-tab:hover:not(.active):not(.disabled){ color: var(--text); background: rgba(43,46,49,0.05); }
.rubro-tab.active{ border-color: var(--accent); background: var(--accent-dim); color: var(--text); }
.rubro-tab.disabled{ opacity: 0.35; cursor: default; }
.rubro-tab .count{
  background: rgba(43,46,49,0.08); border-radius: 999px; padding: 1px 8px; font-size: 0.7rem;
}
.rubro-tab.active .count{ background: rgba(43,46,49,0.14); color: var(--accent); }

.rubro-tab-bubble{
  position: absolute; width: 16px; height: 16px; opacity: 0;
  background: var(--bg-card);
  border-right: 1.5px solid var(--accent); border-bottom: 1.5px solid var(--accent);
  border-radius: 0 0 3px 0;
  transform: rotate(45deg);
  transition: left .4s cubic-bezier(.34,1.2,.64,1), top .4s cubic-bezier(.34,1.2,.64,1), opacity .2s ease;
  z-index: 2; pointer-events: none;
}
.rubro-tab-bubble.no-anim{ transition: none; }

.rubro-panel-shell{
  background: var(--bg-card); border: 1.5px solid var(--accent-dim); border-radius: 16px;
  padding: 28px; animation: rubroFadeIn .28s ease; position: relative;
}
@keyframes rubroFadeIn{
  from{ opacity: 0; transform: translateY(8px); }
  to{ opacity: 1; transform: translateY(0); }
}

/* ---------- Presupuesto en vivo — ahora es un panel deslizante, no un sidebar fijo ---------- */
/* Se abre/cierra con el ícono de "budget-toggle-btn" en el header de la página.
   Reusa .slide-panel/.panel-overlay (ver más abajo) para el desplazamiento y el fondo con blur. */
.live-summary{
  padding: 24px; display:flex; flex-direction:column; height:100%;
  overflow-y: auto; scrollbar-width: none; -ms-overflow-style: none;
}
.live-summary::-webkit-scrollbar{ display: none; width: 0; height: 0; }
.live-summary h4{
  font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; font-family: var(--sans); font-weight: 700;
  color: var(--accent); margin-bottom: 18px; display:flex; align-items:center; gap:8px;
}
.live-summary h4 .badge-accent{ text-transform: none; letter-spacing: normal; }
.live-summary-list{ display:flex; flex-direction:column; gap: 8px; margin-bottom: 18px; }
.live-summary-line{
  display:flex; justify-content:space-between; align-items:flex-start; gap: 10px;
  font-size: 0.8rem; color: var(--text-muted);
  background: rgba(43,46,49,0.03); border-radius: 10px; padding: 10px 12px;
  transition: background .15s ease;
}
.live-summary-line:hover{ background: rgba(43,46,49,0.05); }
.live-summary-line .name{ color: var(--text); display:block; font-weight: 500; }
.live-summary-line .qty{ color: var(--text-faint); font-size: 0.72rem; display:block; margin-top:2px; font-weight: 400; }
.live-summary-line .amount{ color: var(--text); font-weight: 600; white-space: nowrap; }
.live-summary-total{
  display:flex; justify-content:space-between; align-items:center;
  background: var(--accent-dim); border-radius: 12px; padding: 14px 16px; margin-top: auto;
}
.live-summary-total .val{ font-family: var(--serif); color: var(--accent); font-size: 1.5rem; }
.live-summary-empty{ font-size: 0.8rem; color: var(--text-faint); text-align:center; padding: 28px 10px; line-height:1.6; }

/* Botón ícono que abre/cierra el panel */
.budget-toggle-btn{
  position: relative; width: 44px; height: 44px; padding:0; border-radius: 50%;
  display:flex; align-items:center; justify-content:center;
  background: var(--bg-card); border: 1px solid var(--border-strong); color: var(--text);
  cursor: pointer; transition: border-color .15s ease, transform .15s ease;
}
.budget-toggle-btn:hover{ border-color: var(--accent); color: var(--accent); }
.budget-toggle-btn:active{ transform: scale(0.94); }
.budget-toggle-btn svg{ display:block; width:19px; height:19px; }
.budget-toggle-badge{
  position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 4px;
  border-radius: 999px; background: var(--accent); color: var(--accent-ink);
  font-size: 0.66rem; font-weight: 700; display:flex; align-items:center; justify-content:center;
}

/* ---------- Ticket imprimible (solo visible al exportar/imprimir) ---------- */
.print-ticket{ display:none; }
@media print{
  /* Chrome/Edge solo imprimen su encabezado/pie por default (fecha, título de
     la pestaña, URL, N° de página) dentro del margen de página. Poniendo el
     margen en 0 no queda espacio donde dibujarlo, así que desaparece — y acá
     compensamos ese espacio con padding propio en el ticket. Esto no depende
     de que el usuario desmarque "Encabezados y pies de página" a mano en el
     diálogo de impresión. */
  @page{ margin: 0; }
  body{ margin: 0; }
  .print-ticket{
    display:block !important; max-width: 720px; margin: 0 auto; padding: 18mm 14mm; color:#171a1b; font-family: var(--sans);
  }
  .print-ticket .pt-header{
    display:flex; justify-content:space-between; align-items:flex-start; gap:24px;
    padding-bottom: 16px; margin-bottom: 20px; border-bottom: 3px solid var(--accent);
  }
  .print-ticket .pt-brand{ font-family: var(--serif); font-size: 1.9rem; color:var(--accent); margin-bottom: 4px; }
  .print-ticket .pt-brand .dot{ color: var(--accent); }
  .print-ticket .pt-meta{ font-size: 0.85rem; color:#666; line-height:1.65; }
  .print-ticket .pt-meta strong{ color:#171a1b; font-size:1rem; }
  .print-ticket .pt-membrete{ max-width:160px; max-height:80px; object-fit:contain; }
  .print-ticket table{ width:100%; border-collapse: collapse; margin-top: 4px; }
  .print-ticket th, .print-ticket td{ text-align:left; padding: 9px 6px; font-size: 0.85rem; border-bottom: 1px solid #e3e3e3; color:#171a1b; }
  .print-ticket th{ text-transform: uppercase; font-size: 0.68rem; letter-spacing: 0.06em; color:var(--accent); border-bottom: 2px solid var(--accent); padding-bottom: 9px; }
  .print-ticket tfoot td{ border-bottom: none; border-top: 2px solid var(--accent); font-weight: 700; font-size: 1.05rem; padding-top: 14px; color:var(--accent); }
  .print-ticket .pt-subtitle{ display:block; margin-top:6px; font-size:0.68rem; text-transform:uppercase; letter-spacing:0.06em; color: var(--accent); }
  /* Hay dos tickets en el DOM (materiales / ítems); solo se imprime el que
     esté activo — el otro tiene [hidden] y esta regla gana por especificidad
     a la de .print-ticket{display:block!important} de más arriba. */
  .print-ticket[hidden]{ display:none !important; }
}

/* ---------- Toast de confirmación (referencia: imagen "File Uploaded") ---------- */
.toast-stack{
  position: fixed; bottom: 24px; right: 24px; z-index: 1000;
  display:flex; flex-direction:column; gap:10px; align-items:flex-end;
  pointer-events:none;
}
.toast{
  pointer-events:auto;
  display:flex; align-items:flex-start; gap:12px;
  background: var(--bg-card); border: 1px solid var(--border-strong);
  border-radius: var(--radius); padding: 14px 16px; max-width: 340px;
  box-shadow: 0 12px 28px rgba(0,0,0,0.35);
  opacity:0; transform: translateX(24px);
  animation: toastIn .32s cubic-bezier(.34,1.56,.64,1) forwards;
}
.toast.toast-out{ animation: toastOut .22s ease forwards; }
@keyframes toastIn{ to{ opacity:1; transform: translateX(0); } }
@keyframes toastOut{ to{ opacity:0; transform: translateX(24px); } }
.toast-icon{
  flex-shrink:0; width:26px; height:26px; border-radius:50%; margin-top:1px;
  background: var(--accent-dim); color: var(--accent);
  display:flex; align-items:center; justify-content:center;
}
.toast-icon svg{ width:14px; height:14px; }
.toast.toast-warn .toast-icon{ background: rgba(217,105,95,0.14); color: var(--danger); }
.toast-body{ flex:1; min-width:0; }
.toast-title{ font-size:0.86rem; font-weight:600; color: var(--text); margin-bottom:2px; }
.toast-msg{ font-size:0.78rem; color: var(--text-faint); line-height:1.4; margin:0; }

/* ---------- Backdrop blur + panel deslizante (usado por el Presupuesto en vivo) ---------- */
.panel-overlay{
  position: fixed; inset: 0; background: rgba(0,0,0,0.4); backdrop-filter: blur(3px);
  opacity: 0; pointer-events: none; transition: opacity .3s ease; z-index: 150;
}
.panel-overlay.open{ opacity: 1; pointer-events: auto; }
.slide-panel{
  position: fixed; top:0; right:0; height:100%; width: min(380px, 100%);
  background: var(--bg-card); border-left: 1px solid var(--border-strong);
  box-shadow: -12px 0 30px rgba(0,0,0,0.35);
  transform: translateX(100%); transition: transform .32s cubic-bezier(.34,1.2,.64,1);
  z-index: 200;
}
.slide-panel.open{ transform: translateX(0); }

/* ---------- Dual-list (selector de dos columnas con flechas al medio) ----------
   Usado para armar listas eligiendo de "Disponibles" hacia "Elegidos" (rubros,
   y pensado para poder reusarse con ítems en el futuro). */
.duallist{ display:flex; align-items:stretch; gap:14px; margin-top:6px; }
.duallist-col{ flex:1; min-width:0; display:flex; flex-direction:column; }
.duallist-label{ font-size: 0.78rem; color: var(--text-muted); margin-bottom: 8px; }
.duallist-search{
  width:100%; margin-bottom:8px; padding:8px 12px; font-size:0.85rem;
  background: var(--bg-raised); border:1px solid var(--border-strong); border-radius:8px; color:var(--text);
}
.duallist-search:focus{ outline:none; border-color: var(--accent); }
.duallist-box{
  background: var(--bg-raised); border:1px solid var(--border); border-radius:10px;
  height:260px; overflow-y:auto; padding:6px;
}
.duallist-row{
  padding:9px 12px; border-radius:7px; font-size:0.87rem; cursor:pointer; user-select:none;
  transition: background 0.12s ease;
}
.duallist-row:hover{ background: rgba(43,46,49,0.05); }
.duallist-row.active{ background: var(--accent-dim); color: var(--accent-strong); font-weight:600; }
.duallist-empty{ padding:14px 12px; font-size:0.84rem; color: var(--text-faint); }
.duallist-controls{
  display:flex; flex-direction:column; justify-content:center; gap:8px; flex-shrink:0;
}
.duallist-btn{
  width:38px; height:38px; border-radius:8px; border:1px solid var(--border-strong);
  background: var(--bg-card); color: var(--text); font-size:1rem; cursor:pointer;
  display:flex; align-items:center; justify-content:center; transition: border-color .12s ease, color .12s ease;
}
.duallist-btn:hover{ border-color: var(--accent); color: var(--accent); }

@media (max-width: 620px){
  .duallist{ flex-direction:column; }
  .duallist-controls{ flex-direction:row; }
}

/* ================================================================
   MOBILE — 780px (nav/layout) y 480px (celular chico)
   ================================================================ */
.mobile-nav-toggle{
  display: none; background: none; border: none; color: var(--text); cursor: pointer;
  padding: 8px; margin-right: -8px;
}
.mobile-nav-toggle svg{ display:block; width: 22px; height: 22px; }

@media (max-width: 780px){
  .container{ padding: 0 20px; }

  /* Header: la nav pasa a ser un panel colapsable debajo del header */
  .mobile-nav-toggle{ display:flex; align-items:center; justify-content:center; }
  .main-nav{
    position: fixed; top: 68px; left: 0; right: 0;
    background: var(--bg-card); border-bottom: 1px solid var(--border);
    flex-direction: column; align-items: stretch; gap: 0;
    max-height: 0; overflow: hidden; transition: max-height .3s ease;
    z-index: 49;
  }
  .site-header.nav-open .main-nav{ max-height: 60vh; overflow-y: auto; }
  .main-nav a{ padding: 15px 24px; border-bottom: 1px solid var(--border); }
  .header-actions{ gap: 8px; }
  .header-actions .btn{ padding: 9px 14px; font-size: 0.82rem; }
  .user-chip{ display: none; }

  .hero{ padding: 60px 0 52px; }
  .hero::before{ width: 300px; height: 300px; top: -110px; right: -110px; }
  .hero-actions{ flex-direction: column; align-items: stretch; }
  .hero-actions .btn{ width: 100%; }

  section{ padding: 48px 0; }

  .price-card{ padding: 28px 22px; }
  .price-card-amount{ font-size: 2.1rem; }

  .cuaderno-layout{ flex-direction: column; gap: 18px; }
  .cuaderno-sidebar{ position: static; flex-basis: auto; width: auto; }
  .sidebar-rail{
    width: auto !important; flex-direction: row; overflow-x: auto;
    gap: 6px; padding-bottom: 6px; -webkit-overflow-scrolling: touch;
    background: none !important; border: none !important; box-shadow: none !important; padding: 0 !important;
  }
  .side-label{ opacity: 1; }
  .side-link{ white-space: nowrap; }
  .side-divider{ display: none; }

  .rubro-tab-buttons{ gap: 6px; }
  .rubro-tab{ padding: 8px 12px; font-size: 0.82rem; }
  .rubro-panel-shell{ padding: 18px; }

  .categoria-form-row{ flex-direction: column; align-items: stretch; }
  .cat-type-field{ width: 100%; }
  .item-inputs .field, .item-inputs .field.wide{ width: 100%; }

  .table-card{ overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; }
  .table-card table{ min-width: 480px; }

  .modal{ padding: 26px 22px; }
  .page-title-row{ margin-bottom: 26px; }
}

@media (max-width: 480px){
  .toast-stack{ left: 14px; right: 14px; bottom: 14px; align-items: stretch; }
  .toast{ max-width: none; }
  .budget-toggle-btn{ width: 40px; height: 40px; }
  .price-card-features li{ font-size: 0.85rem; }
}

/* ============================================================
   Vocabulario de componentes real de Arquiar (estudios.html /
   proyectos.html) — usar esto en vez de .page-title-row/.eyebrow
   para que las páginas de Cotarq se vean como una sola web.
   ============================================================ */

/* ---------- Encabezado de sección: charcoal + sidebar hueso + barra naranja ---------- */
.page-header{
  margin-top: 0; background: var(--text); padding: 48px 48px 40px;
  display: grid; grid-template-columns: 72px 1fr; position: relative;
}
.page-sidebar{ background: var(--bg-raised); display:flex; align-items:center; justify-content:center; }
.page-sidebar-text{
  font-size: 11px; font-weight: 500; letter-spacing: .2em; color: var(--text-muted);
  writing-mode: vertical-rl; transform: rotate(180deg);
}
.page-main{ padding: 0 48px; position: relative; }
.page-bar{ position: absolute; left: 72px; top: 0; bottom: 0; width: 6px; background: var(--accent); }
.page-tag{ font-size: 11px; letter-spacing: .2em; font-weight: 500; color: var(--accent-strong); margin-bottom: 10px; display:block; }
.page-title{ font-family: var(--serif); font-size: clamp(32px,4vw,52px); font-weight: 300; color: var(--bg-card); line-height: 1.1; }
.page-title em{ font-style: italic; color: var(--accent-strong); font-weight: 300; }

@media (max-width: 768px){
  .page-header{ grid-template-columns: 1fr; padding: 32px 20px 28px; }
  .page-sidebar, .page-bar{ display:none; }
  .page-main{ padding: 0; }
  .page-title{ font-size: clamp(26px,7vw,40px); }
}

/* ---------- Barra de filtros / búsqueda, pegajosa, inputs tipo píldora ---------- */
.filters{
  background: var(--bg-card); border-bottom: 1px solid var(--border);
  padding: 20px 48px; display:flex; gap:12px; flex-wrap:wrap; align-items:center;
  position: sticky; top: 57px; z-index: 40;
}
.filter-label{ font-size: 11px; letter-spacing: .1em; color: var(--text-muted); font-weight: 500; margin-right: 4px; }
.filter-input{
  font-size: 13px; padding: 8px 14px; border: 1px solid var(--border); border-radius: 20px;
  background: var(--bg-card); color: var(--text); outline: none; font-family: var(--sans);
  min-width: 220px; transition: border-color .2s;
}
.filter-input:focus{ border-color: var(--accent-strong); }
.filter-select{
  font-size: 13px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--bg-card); color: var(--text); outline: none; font-family: var(--sans);
}
.filter-btn{
  font-size: 12px; font-weight: 500; padding: 7px 18px; border-radius: 20px;
  border: 1px solid var(--border); background: transparent; color: var(--text-muted);
  cursor: pointer; transition: all .15s;
}
.filter-btn.active, .filter-btn:hover{ background: var(--accent-strong); color: var(--bg-card); border-color: var(--accent-strong); }
.filter-count{ font-size: 12px; color: var(--text-muted); margin-left: auto; }

@media (max-width: 768px){
  .filters{ padding: 14px 16px; gap: 8px; flex-direction: column; }
  .filter-label{ display:none; }
  .filter-input{ min-width: 100% !important; width: 100%; }
  .filter-select{ width: 100%; }
  .filter-count{ margin-left: 0; }
}

/* ---------- Cards estilo directorio (usar para "Cuadernos", listas de ítems, etc.) ---------- */
.arq-grid{ display:grid; grid-template-columns: repeat(auto-fill, minmax(300px,1fr)); gap:20px; }
.arq-card{
  background: var(--bg-card); border-radius: 10px; overflow: hidden; border: 1px solid var(--border);
  cursor: pointer; transition: transform .2s, box-shadow .2s; display:flex; flex-direction:column; position:relative;
}
.arq-card:hover{ transform: translateY(-4px); box-shadow: 0 12px 40px rgba(0,0,0,.1); }
.arq-card-bar{ position:absolute; left:0; top:0; bottom:0; width:5px; background: var(--accent); }
.arq-card-body{ padding: 18px 20px 18px 24px; flex:1; display:flex; flex-direction:column; }
.arq-card-title{ font-family: var(--serif); font-size: 20px; font-weight: 500; color: var(--text); }
.arq-card-meta{ font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.arq-card-footer{ display:flex; justify-content:space-between; align-items:center; margin-top:auto; padding-top:14px; border-top:1px solid var(--border); }
.arq-card-btn{
  font-size: 11px; font-weight: 500; padding: 7px 16px; border-radius: 20px;
  background: var(--accent-strong); color: var(--bg-card); border:none; cursor:pointer;
  transition: background .2s; text-decoration:none;
}
.arq-card-btn:hover{ background: var(--teal-dark); }

@media (max-width: 768px){
  .arq-grid{ grid-template-columns: 1fr; }
}

/* ---------- Cursor custom (dot + ring) ---------- */
#cursor-dot{ width:10px; height:10px; background: var(--accent); border-radius:50%; position:fixed; pointer-events:none; z-index:9999; transform:translate(-50%,-50%); transition:transform .1s ease, opacity .3s; opacity:0; }
#cursor-ring{ width:32px; height:32px; border:1.5px solid var(--accent); border-radius:50%; position:fixed; pointer-events:none; z-index:9998; transform:translate(-50%,-50%); transition:width .2s,height .2s,opacity .3s; opacity:0; }
@media(hover:none){ #cursor-dot, #cursor-ring{ display:none; } }

/* ---------- Reveal on scroll (mismo mecanismo que index.html/estudios.html) ---------- */
.arq-reveal{ opacity:0; transition:opacity .65s cubic-bezier(.2,0,0,1), transform .65s cubic-bezier(.2,0,0,1); }
.arq-reveal.from-up{ transform:translateY(32px); }
.arq-reveal.from-left{ transform:translateX(-32px); }
.arq-reveal.from-right{ transform:translateX(32px); }
.arq-reveal.scale-in{ transform:scale(.94); }
.arq-reveal.visible{ opacity:1; transform:none; }
.arq-reveal[data-delay="1"]{ transition-delay:.08s; }
.arq-reveal[data-delay="2"]{ transition-delay:.18s; }
.arq-reveal[data-delay="3"]{ transition-delay:.28s; }
.arq-reveal[data-delay="4"]{ transition-delay:.38s; }
.arq-reveal[data-delay="5"]{ transition-delay:.48s; }

/* ---------- Entrada animada del page-header (tag + title) ---------- */
.page-header .page-tag{ opacity:0; transform:translateX(-16px); transition:opacity .6s ease, transform .6s ease; }
.page-header .page-title{ opacity:0; transform:translateY(20px); transition:opacity .7s ease .15s, transform .7s ease .15s; }
.page-header.loaded .page-tag, .page-header.loaded .page-title{ opacity:1; transform:none; }

/* ---------- Título simple para páginas de app logueada (mismo criterio que dashboard.html) ---------- */
.app-page-title{ font-family: var(--serif); font-size: 36px; font-weight: 300; color: var(--text); margin-bottom: 4px; }
.app-page-sub{ font-size: 13px; color: var(--text-muted); margin-bottom: 32px; }
@media (max-width: 768px){ .app-page-title{ font-size: 28px; } }
