@font-face { font-family: Gelasio; src: url(fonts/Gelasio-Regular.ttf); font-weight: 400; }
@font-face { font-family: Gelasio; src: url(fonts/Gelasio-Bold.ttf); font-weight: 700; }
@font-face { font-family: Gelasio; src: url(fonts/Gelasio-Italic.ttf); font-weight: 400; font-style: italic; }

:root {
  --bg: #FDF7F7;
  --rose-dark: #B85C6E;
  --rose: #D98A99;
  --soft: #F7E1E5;
  --text: #4A3438;
  --muted: #7D6468;
  --white: #fff;
  --danger: #b3261e;
  --radius: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
#app { max-width: 640px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }
main { padding: 16px; display: flex; flex-direction: column; gap: 16px; flex: 1; }
h1, h2 { font-family: Gelasio, Georgia, serif; font-weight: 400; color: var(--rose-dark); margin: 0; }
h1 { font-size: 20px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
h2 { font-size: 18px; margin-bottom: 8px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.danger { color: var(--danger); }
.empty { text-align: center; color: var(--muted); padding: 24px 0; }

/* encabezado (estilo navbar de Bootstrap) */
html { scroll-padding-top: calc(var(--header-h) + 8px); scroll-padding-bottom: calc(var(--footer-h) + 12px); }
:root { --header-h: 112px; --footer-h: 72px; }
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: var(--bg);
  padding-top: env(safe-area-inset-top);
}
.navbar {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 16px; min-height: 60px;
  background: var(--white);
  border-bottom: 1px solid var(--soft);
  box-shadow: 0 2px 8px rgba(74, 52, 56, .06);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--rose-dark); min-width: 0; }
.brand img { height: 44px; flex: none; }
.brand span {
  font-family: Gelasio, Georgia, serif; font-size: 19px; line-height: 1.15;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand strong { font-weight: 700; }
.topbar {
  display: flex; align-items: center; gap: 4px;
  padding: 6px 12px 6px 16px; min-height: 52px;
  border-bottom: 1px solid var(--soft);
}
.topbar:has(> .icon:first-child) { padding-left: 4px; }

/* barra del total: fija al fondo de la pantalla */
.bottombar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  max-width: 640px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; padding-bottom: max(12px, env(safe-area-inset-bottom));
  background: var(--white); border-top: 1px solid var(--soft);
  box-shadow: 0 -4px 16px rgba(74, 52, 56, .08);
}
.bottombar strong { color: var(--rose-dark); font-size: 19px; font-family: Gelasio, Georgia, serif; }
main.editor { padding-bottom: calc(var(--footer-h) + 24px + env(safe-area-inset-bottom)); }

/* botones */
button { font: inherit; color: inherit; cursor: pointer; }
.btn {
  border: 1px solid var(--rose-dark); border-radius: 999px; padding: 11px 20px;
  background: transparent; color: var(--rose-dark); font-weight: 600;
}
.btn.primary { background: var(--rose-dark); color: var(--white); }
.btn.ghost { background: var(--white); }
.btn.block { width: 100%; }
.icon {
  border: 0; background: transparent; font-size: 26px; line-height: 1; width: 40px; height: 40px;
  border-radius: 50%; color: var(--rose-dark); display: grid; place-items: center; flex: none;
}
.icon:active { background: var(--soft); }
.icon.sm { font-size: 17px; width: 34px; height: 34px; }
.icon:disabled { opacity: .3; }
.icon.danger { color: var(--muted); }
.link { border: 0; background: none; color: var(--rose-dark); padding: 6px 0; font-weight: 600; align-self: flex-start; }
.link.danger { color: var(--danger); }

/* tarjetas y campos */
.card {
  background: var(--white); border: 1px solid var(--soft); border-radius: var(--radius);
  padding: 14px; display: flex; flex-direction: column; gap: 12px;
}
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > span { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--rose-dark); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 380px) { .two { grid-template-columns: 1fr; } }
input[type=text], input[type=date], textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--white);
  border: 1px solid #e6cdd2; border-radius: 8px; padding: 9px 10px; min-height: 42px;
}
textarea { resize: none; overflow: hidden; }
input:focus, textarea:focus { outline: 2px solid var(--rose); outline-offset: -1px; border-color: transparent; }
input.bad { border-color: var(--danger); }

/* lista */
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.budget { padding: 0; gap: 0; }
.budget-main {
  border: 0; background: none; text-align: left; padding: 14px; display: grid; gap: 2px;
  grid-template-columns: 1fr auto;
}
.budget-main strong { font-size: 17px; }
.budget-main .muted { grid-column: 1; font-size: 14px; }
.budget-main .price { grid-column: 2; grid-row: 1 / span 2; align-self: center; color: var(--rose-dark); font-weight: 600; }
.row-actions { display: flex; gap: 18px; padding: 0 14px 6px; border-top: 1px solid var(--soft); }

/* editor */
.items { display: flex; flex-direction: column; gap: 10px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin: -6px -6px -4px 0; }
.tag { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.tools { display: flex; }
.title-card { background: var(--soft); border-color: var(--rose); }
.title-card textarea { font-family: Gelasio, Georgia, serif; font-weight: 700; color: var(--rose-dark); }
.subs { display: flex; flex-direction: column; gap: 10px; padding-left: 10px; border-left: 2px solid var(--soft); }
.sub { display: flex; flex-direction: column; gap: 6px; }
.sub-row { display: flex; gap: 6px; align-items: flex-start; }
.sub-row textarea { font-style: italic; }
.dash { color: var(--muted); padding-top: 10px; }
.price-ctl { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.price-ctl .amount { flex: 1; min-width: 110px; text-align: right; font-variant-numeric: tabular-nums; }
.seg { display: inline-flex; border: 1px solid var(--rose); border-radius: 999px; overflow: hidden; flex: none; }
.seg button { border: 0; background: var(--white); padding: 8px 12px; font-size: 14px; color: var(--rose-dark); }
.seg button + button { border-left: 1px solid var(--rose); }
.seg button.on { background: var(--rose-dark); color: var(--white); }
.add-row { display: flex; gap: 10px; }
.add-row .btn { flex: 1; }

/* fotos */
.photos { display: flex; gap: 10px; flex-wrap: wrap; }
.thumb { position: relative; width: 96px; height: 96px; border-radius: 10px; overflow: hidden; border: 1px solid var(--rose); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb.add { background: var(--white); color: var(--rose-dark); border-style: dashed; font-weight: 600; }
.thumb .x {
  position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%; border: 0;
  background: rgba(255,255,255,.9); color: var(--danger); font-size: 18px; line-height: 1;
}

/* resultado */
.tabs { margin: 12px 16px 0; align-self: stretch; display: flex; }
.tabs button { flex: 1; padding: 10px; }
.result-actions { display: flex; gap: 10px; }
.result-actions .btn { flex: 1; }
.previews { display: flex; flex-direction: column; gap: 14px; align-items: center; }
.previews img { width: 100%; border-radius: 6px; box-shadow: 0 4px 18px rgba(74, 52, 56, .15); }
.previews.phone img { max-width: 360px; }

.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); z-index: 20;
  background: var(--text); color: var(--white); padding: 10px 18px; border-radius: 999px; font-size: 15px;
}
