:root {
  --ink: #161410;
  --ink-soft: #3c3832;
  --paper: #f4efe6;
  --paper-2: #ebe4d6;
  --cream: #fbf8f2;
  --pin: #c45a3a;
  --pin-deep: #9a3e28;
  --olive: #3f4a3a;
  --line: rgb(22 20 16 / 0.12);
  --shadow:
    0 0 0 1px rgb(22 20 16 / 0.08),
    0 1px 2px -1px rgb(22 20 16 / 0.08),
    0 8px 24px -16px rgb(22 20 16 / 0.28);
  --sans: "Figtree", ui-sans-serif, system-ui, sans-serif;
  --display: "Fraunces", ui-serif, Georgia, serif;
}

*,
*::before,
*::after { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body { padding-bottom: env(safe-area-inset-bottom); }

h1, h2, h3, .display {
  font-family: var(--display);
  text-wrap: balance;
  font-weight: 500;
}

p { text-wrap: pretty; }

button:not(:disabled),
[role="button"]:not(:disabled) { cursor: pointer; }

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

a { color: inherit; text-decoration: none; }

.app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.top {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 56px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: rgb(244 239 230 / 0.92);
  backdrop-filter: blur(12px);
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--display);
  font-size: 1.125rem;
}

.pin {
  width: 14px;
  height: 14px;
  background: var(--pin);
  border-radius: 100% 100% 100% 0;
  transform: rotate(-45deg);
}

.who {
  border: 0;
  background: none;
  color: var(--ink-soft);
  font-size: 0.875rem;
  padding: 8px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lang {
  display: inline-flex;
  border-radius: 999px;
  background: var(--cream);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.lang button {
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 6px 10px;
  min-height: 32px;
}

.lang button.on {
  background: var(--ink);
  color: var(--cream);
}

.login-top {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}

.main {
  width: 100%;
  max-width: 48rem;
  margin: 0 auto;
  padding: 20px 16px 8rem;
  flex: 1;
}

.bottom {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 30;
  border-top: 1px solid var(--line);
  background: rgb(244 239 230 / 0.95);
  backdrop-filter: blur(12px);
  padding-bottom: env(safe-area-inset-bottom);
}

.bottom ul {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  max-width: 48rem;
  margin: 0 auto;
  padding: 0;
  list-style: none;
  height: 64px;
}

.bottom a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 56px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--ink-soft);
}

.bottom a.active { color: var(--pin); }

.kicker {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--pin);
}

h1 {
  margin: 4px 0 0;
  font-size: 1.875rem;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.lead {
  margin: 8px 0 0;
  font-size: 0.875rem;
  color: var(--ink-soft);
}

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 24px 0;
}

.card {
  display: block;
  border-radius: 1rem;
  background: var(--cream);
  box-shadow: var(--shadow);
  padding: 16px;
}

.stat-label {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.stat-num {
  margin: 4px 0 0;
  font-family: var(--display);
  font-size: 1.875rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--pin);
}

.stat-num.olive { color: var(--olive); }

.stat-hint {
  margin: 8px 0 0;
  font-size: 0.75rem;
  color: var(--ink-soft);
}

.search { position: relative; margin: 8px 0 16px; }
.search input { padding-left: 2.5rem; }
.search svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--ink-soft);
  pointer-events: none;
}

.list { display: flex; flex-direction: column; gap: 12px; }

.shop {
  display: block;
  border-radius: 1rem;
  background: var(--cream);
  box-shadow: var(--shadow);
  padding: 16px;
}

.shop-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.shop h3 {
  margin: 0;
  font-size: 1.125rem;
  line-height: 1.3;
}

.meta {
  margin: 2px 0 0;
  font-size: 0.875rem;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--paper-2);
  color: var(--ink-soft);
}

.badge.pin { background: rgb(196 90 58 / 0.12); color: var(--pin-deep); }
.badge.olive { background: rgb(63 74 58 / 0.12); color: var(--olive); }
.badge.warn { background: var(--pin); color: #fffdf8; }

.tiny {
  margin: 12px 0 0;
  font-size: 0.75rem;
  color: var(--ink-soft);
}

.empty {
  border-radius: 1rem;
  background: var(--cream);
  box-shadow: var(--shadow);
  padding: 32px 20px;
  text-align: center;
}

.empty h2 { margin: 0; font-size: 1.25rem; }
.empty p { margin: 8px 0 0; font-size: 0.875rem; color: var(--ink-soft); }

.section {
  border-radius: 1rem;
  background: rgb(251 248 242 / 0.72);
  box-shadow: var(--shadow);
  padding: 16px;
  margin: 0 0 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.section h2 {
  margin: 0;
  font-size: 1.25rem;
  line-height: 1.2;
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 0.875rem; font-weight: 500; }

.hint {
  margin: 0;
  font-size: 0.75rem;
  line-height: 1.35;
  color: var(--ink-soft);
}

.control {
  height: 48px;
  width: 100%;
  border: 0;
  border-radius: 0.75rem;
  background: var(--cream);
  box-shadow: var(--shadow);
  padding: 0 14px;
  font-size: 1rem;
}

textarea.control {
  height: auto;
  min-height: 96px;
  padding: 12px 14px;
  resize: vertical;
}

.control:focus {
  outline: none;
  box-shadow: var(--shadow), 0 0 0 3px rgb(196 90 58 / 0.35);
}

.control:disabled { opacity: 0.5; }

.control::placeholder {
  color: #9a948a;
  opacity: 1;
}

.check {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  border-radius: 0.75rem;
  background: var(--cream);
  box-shadow: var(--shadow);
  padding: 8px 14px;
  font-size: 0.875rem;
}

.check input {
  width: 20px;
  height: 20px;
  accent-color: var(--pin);
  flex-shrink: 0;
}

.day {
  border-radius: 0.75rem;
  background: var(--cream);
  box-shadow: var(--shadow);
  padding: 12px;
}

.day p { margin: 0 0 8px; font-size: 0.875rem; font-weight: 500; }

.day-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.days-closed {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.invite-pin-label {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 500;
}

.invite-pin {
  margin: 0;
  font-size: 2rem;
  letter-spacing: 0.35em;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.actions { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  border: 0;
  border-radius: 0.75rem;
  padding: 0 16px;
  font-weight: 600;
  background: var(--pin);
  color: #fffdf8;
}

.btn:disabled { opacity: 0.6; }
.btn.outline {
  background: var(--cream);
  color: var(--ink);
  box-shadow: var(--shadow);
}
.btn.ghost { background: transparent; color: var(--pin-deep); }
.btn.ink { background: var(--ink); color: var(--cream); }

.savebar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(4rem + env(safe-area-inset-bottom));
  z-index: 40;
  border-top: 1px solid var(--line);
  background: rgb(244 239 230 / 0.95);
  backdrop-filter: blur(12px);
}

.savebar-inner {
  max-width: 48rem;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
}

.savebar p {
  margin: 0;
  flex: 1;
  min-width: 0;
  font-size: 0.75rem;
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.savebar .btn { flex-shrink: 0; min-height: 44px; }

.login {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 40px 20px;
}

.login-box { width: 100%; max-width: 24rem; }
.login-box h1 { margin-top: 8px; }
.err { color: var(--pin-deep); font-size: 0.875rem; margin: 0; }

.payrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-radius: 1rem;
  background: var(--cream);
  box-shadow: var(--shadow);
  padding: 14px 16px;
}

.payrow .amt {
  font-family: var(--display);
  font-size: 1.125rem;
  color: var(--pin);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.skel {
  height: 96px;
  border-radius: 1rem;
  background: var(--paper-2);
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse { 50% { opacity: 0.55; } }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 8px; }
.chip {
  border: 0;
  border-radius: 999px;
  background: var(--cream);
  box-shadow: var(--shadow);
  color: var(--ink);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 8px 12px;
  min-height: 36px;
}
.chip.on { background: #161410; color: #fbf8f2; }
.stats-filters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 8px 0 16px;
}
.bars { display: flex; flex-direction: column; gap: 12px; }
.bar-row { }
.bar-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.875rem;
  font-weight: 500;
}
.bar-num { font-variant-numeric: tabular-nums; color: var(--pin); }
.bar {
  margin-top: 6px;
  height: 8px;
  border-radius: 999px;
  background: rgb(22 20 16 / 0.08);
  overflow: hidden;
}
.bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--pin);
}
.tiny { margin: 4px 0 0; font-size: 0.75rem; color: var(--ink-soft); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

.checks { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 6px; }

.namebar {
  position: sticky;
  top: 56px;
  z-index: 20;
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  margin: -20px -16px 16px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: rgb(244 239 230 / 0.94);
  backdrop-filter: blur(12px);
}
.namebar-name {
  font-family: var(--display);
  font-size: 1.125rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.namebar-place {
  flex-shrink: 0;
  max-width: 45%;
  font-size: 0.75rem;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.namebar-place:empty { display: none; }

.domain-block { margin-top: 8px; padding: 14px; border-radius: 1rem; background: var(--paper-2); }
.domain-block .field:last-of-type { margin-bottom: 0; }
.section.domains { margin: 16px 0; }
.dom-group { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.dom-head { margin: 0; font-size: 0.8125rem; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.dom-days { font-family: inherit; font-size: 0.8125rem; font-weight: 600; text-align: right; }
.dom-group.expired .dom-head, .dom-group.expired .dom-days { color: #b3261e; }
.dom-group.expired .dom-row { box-shadow: inset 3px 0 0 #b3261e, var(--shadow); }

/* ---- v22: acuerdo (service agreement) ---- */
.agreement-block { margin-top: 16px; }
.ag-prices { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.ag-page { max-width: 48rem; margin: 0 auto; padding: 16px; }
.ag-toolbar { display: flex; gap: 8px; justify-content: space-between; margin-bottom: 16px; }
.ag-doc {
  background: #fffdf8;
  color: var(--ink);
  border-radius: 1rem;
  box-shadow: var(--shadow);
  padding: 28px 28px 22px;
  font-size: 0.9rem;
  line-height: 1.45;
}
.ag-brand { display: flex; align-items: center; gap: 8px; font-family: var(--display); font-weight: 600; font-size: 1rem; }
.ag-brand .pin { width: 10px; height: 10px; border-radius: 999px; background: var(--pin); display: inline-block; }
.ag-title { font-family: var(--display); font-size: 1.25rem; letter-spacing: 0.02em; margin: 12px 0 10px; }
.ag-parties { margin: 0 0 10px; }
.ag-clauses { margin: 0 0 12px; padding-left: 1.25rem; }
.ag-clauses li { margin: 0 0 6px; }
.ag-date { margin: 12px 0 18px; }
.ag-sigs { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: end; }
.ag-sigbox p { margin: 4px 0 0; font-weight: 600; font-size: 0.85rem; }
.ag-sigbox .ag-small { font-weight: 400; }
.ag-line { display: block; height: 56px; border-bottom: 1px solid var(--ink); }
.ag-sig { display: block; width: 100%; max-height: 80px; object-fit: contain; object-position: left bottom; border-bottom: 1px solid var(--ink); }
.ag-small { font-size: 0.75rem; color: var(--ink-soft); }
.ag-meta { margin: 14px 0 0; }
.sign-section .ag-doc { box-shadow: none; padding: 16px; margin-bottom: 16px; font-size: 0.85rem; }
.sig-pad {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 1;
  background: #fffdf8;
  border: 1px dashed var(--ink-soft);
  border-radius: 0.75rem;
  touch-action: none;
  cursor: crosshair;
}
.ag-done { color: var(--olive); font-weight: 600; }

@page { size: A4; margin: 14mm 16mm; }
@media print {
  html, body { background: #fff !important; }
  .no-print, .top, .bottom, .savebar { display: none !important; }
  .ag-page { max-width: none; padding: 0; }
  .ag-doc { box-shadow: none; border-radius: 0; padding: 0; font-size: 10pt; line-height: 1.35; background: #fff; }
  .ag-title { font-size: 14pt; }
  .ag-clauses li { margin-bottom: 3pt; break-inside: avoid; }
  .ag-sigs { break-inside: avoid; }
}

/* b23: extras editor + extras section + Nixfriction signature */
.ag-extra-row { display: grid; grid-template-columns: 1fr 110px auto; gap: 8px; margin: 0 0 8px; align-items: center; }
.ag-extras { margin: 6px 0 10px; font-size: 0.9rem; }
.ag-extras p { margin: 0 0 4px; }
.ag-extras ul { list-style: none; margin: 0; padding: 0; max-width: 420px; }
.ag-extras li { display: flex; justify-content: space-between; gap: 16px; padding: 2px 0; border-bottom: 1px dotted var(--line, #ccc); }
.ag-extras li.ag-extras-total { font-weight: 600; border-bottom: 0; }
.nix-sig-preview { max-width: 360px; background: #fff; margin: 0 0 6px; }

/* b28: signatures */
.sig-thumb { margin: 10px 0 4px; padding: 8px; background: #fff; border: 1px solid var(--line, #d9d4c7); border-radius: 8px; max-width: 360px; }
.sig-thumb img { display: block; width: 100%; height: auto; max-height: 120px; object-fit: contain; }
.sig-thumb figcaption { font-size: 12px; opacity: .7; margin-top: 4px; }
.sig-review { max-width: 600px; }
.sign-banner { margin: 0 0 12px; padding: 12px 14px; border-radius: 8px; background: #fbe9e5; border: 1px solid #c4432b; color: #7a1f10; }
.sign-err { margin: 8px 0 0; }
.btn.danger { background: #c4432b; border-color: #c4432b; color: #fff; }
.reset-log { margin-top: 8px; font-size: 13px; }
.tablet-sign .main { max-width: 760px; }
.tablet-sign .sig-pad { touch-action: none; }

/* b29: recibo */
.rcp-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.rcp-no { font-size: 0.9rem; }
.rcp-draft { color: var(--pin-deep, #a33); font-weight: 600; letter-spacing: .04em; }
.rcp-void { color: #b3261e; font-weight: 700; }
.rcp-table { width: 100%; border-collapse: collapse; margin: 10px 0 12px; }
.rcp-table th, .rcp-table td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--line, #d9d4c7); }
.rcp-table th:last-child, .rcp-table td:last-child { text-align: right; white-space: nowrap; }
.rcp-table tfoot td { font-weight: 700; border-bottom: 0; border-top: 2px solid var(--ink); }
.rcp-sigs { margin-top: 18px; }
.rcp-foot { margin: 16px 0 0; text-align: center; }
.rcp-opt { margin: 0 0 10px; }
.rcp-opt.off { opacity: .55; }
.rcp-ov { display: grid; grid-template-columns: 1fr 120px; gap: 8px; margin-top: 4px; }
.rcp-log { list-style: none; padding: 0; margin: 0; font-size: .85rem; }
.rcp-log li { display: flex; justify-content: space-between; gap: 8px; align-items: center; padding: 4px 0; border-bottom: 1px dotted var(--line, #ccc); }
@media print {
  .rcp-page { max-width: none; }
}

/* b31: Kaart */
.map-wrap { display: flex; flex-direction: column; gap: 8px; }
.map-head h1 { margin: 0; }
.map-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.map-chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line, #d9d4c7); background: #fffdf8; border-radius: 999px; padding: 6px 10px; font: inherit; font-size: .8rem; cursor: pointer; }
.map-chip.on { background: var(--ink); color: #fffdf8; border-color: var(--ink); }
.map-dot { width: 10px; height: 10px; border-radius: 999px; background: var(--c); display: inline-block; }
.map-n { opacity: .65; }
.map-sel { margin: 0; font-size: .85rem; }
.map-box { height: calc(100vh - 290px); height: calc(100dvh - 290px); min-height: 380px; border-radius: 1rem; overflow: hidden; box-shadow: var(--shadow); z-index: 0; }
.map-mk { background: none; border: 0; }
.map-pop { font-size: .85rem; line-height: 1.4; }
.map-pop-sub { opacity: .7; font-size: .78rem; }
.map-pop-links { margin-top: 4px; }
.map-pop a { color: var(--pin-deep, #a33); }

/* b34: upsells */
.up-row { display: grid; grid-template-columns: 130px 1fr 100px; gap: 6px 8px; margin: 0 0 10px; padding: 0 0 10px; border-bottom: 1px dotted var(--line, #ccc); align-items: center; }
.up-row .up-paid { margin: 0; }
.up-row .up-comm { grid-column: 1 / -1; margin: 0; }
.up-ro { list-style: none; margin: 0; padding: 0; font-size: .85rem; }
.up-ro li { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; border-bottom: 1px dotted var(--line, #ccc); }
.comm-split p { margin: 2px 0; font-size: .85rem; }
.comm-split .comm-total { font-size: .95rem; }
@media (max-width: 560px) { .up-row { grid-template-columns: 1fr 1fr; } }
/* b35: upsell presets + qty */
.up-preset{display:flex;gap:8px;flex-wrap:wrap;align-items:center;margin:8px 0}
.up-preset select{flex:1 1 200px}
.up-preset input{width:72px}
.up-qty{width:72px}
/* b36: price breakdown + scanner sub-check */
.price-calc{margin:10px 0;padding:10px 12px;border:1px solid rgba(0,0,0,.12);border-radius:10px}
.price-calc table{width:100%;border-collapse:collapse;font-size:.9rem}
.price-calc th,.price-calc td{text-align:left;padding:3px 4px}
.price-calc td:nth-child(n+2),.price-calc th:nth-child(n+2){text-align:right}
.price-calc tfoot th{border-top:1px solid rgba(0,0,0,.15)}
.check.sub-check{margin-left:22px;font-size:.9rem}
.hint.warn{color:#9a5b00}
