:root {
  --cream: #FFF5E9;
  --black: #000000;
  --orange: #FF8B22;
  --yellow: #FFB236;
  --orange-dark: #A84F00;
  --text: #000000;
  --muted: #5A5148;
  --line: #000000;
  --white: #FFFFFF;
  --soft: #FFE3BF;
  --danger: #B3261E;
  --ok: #1E7A3C;
  --radius: 16px;
  --shadow: 4px 4px 0 #000;
  --head: 'Unbounded', 'Montserrat', system-ui, sans-serif;
  --body: 'Montserrat', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--cream); color: var(--text); font-family: var(--body); font-size: 16px; -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; }
img { max-width: 100%; display: block; }
a { color: var(--orange-dark); font-weight: 600; }
a:hover { color: #7A3A00; }
button, input, textarea, select { font: inherit; color: inherit; }

.wrap { max-width: 640px; margin: 0 auto; padding: 20px 16px 120px; display: flex; flex-direction: column; gap: 16px; }

h1, h2, h3 { font-family: var(--head); margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 26px; line-height: 1.15; }
h2 { font-size: 17px; }
.hello { font-size: 28px; margin-top: 6px; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.top .logo { height: 72px; width: auto; }
.top-links { display: flex; gap: 6px; align-items: center; }

.bar { display: flex; align-items: center; gap: 10px; }
.back { width: 44px; height: 44px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; border: 2px solid var(--black); border-radius: 12px; background: var(--white); box-shadow: 2px 2px 0 #000; color: var(--black); text-decoration: none; }
.back:active { transform: translate(2px, 2px); box-shadow: none; }

.card { background: var(--white); border: 2px solid var(--black); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.card.flat { box-shadow: none; }
.label { font-size: 14px; font-weight: 600; }
.hint { font-size: 13px; color: var(--muted); line-height: 1.45; margin: 0; }
.step { font-family: var(--head); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; }

/* Opciones del inicio */
.options { display: flex; flex-direction: column; gap: 14px; }
.option { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--black); background: var(--white); border: 2px solid var(--black); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; min-height: 80px; }
.option:hover { color: var(--black); background: #FFFBF5; }
.option:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 #000; }
.option .ico { width: 52px; height: 52px; flex-shrink: 0; border-radius: 14px; background: var(--yellow); border: 2px solid var(--black); display: flex; align-items: center; justify-content: center; }
.option .t { font-family: var(--head); font-size: 16px; font-weight: 600; display: block; }
.option .d { font-size: 13px; color: var(--muted); font-weight: 500; display: block; margin-top: 3px; }

/* Campos */
.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }
.field input, .field textarea, .field select { width: 100%; border: 2px solid var(--black); border-radius: 12px; padding: 12px; font-size: 16px; font-weight: 500; background: var(--white); min-height: 48px; }
.field textarea { min-height: 120px; resize: vertical; line-height: 1.45; }
.field input:focus, .field textarea:focus, .field select:focus { outline: 3px solid var(--orange); outline-offset: 1px; }
.row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.row3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.row3 .field { font-size: 13px; font-weight: 500; }

/* Botones segmentados */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; }
.seg button { min-height: 48px; border: 2px solid var(--black); border-radius: 12px; background: var(--white); font-weight: 700; font-size: 15px; cursor: pointer; padding: 6px 8px; line-height: 1.2; }
.seg button[aria-pressed="true"] { background: var(--black); color: var(--white); }
.seg button:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }

.check { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; font-weight: 600; cursor: pointer; min-height: 44px; padding-top: 4px; }
.check input { width: 22px; height: 22px; margin: 0; accent-color: var(--orange); flex-shrink: 0; }
.check small { display: block; font-weight: 500; color: var(--muted); font-size: 13px; margin-top: 2px; }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 2px solid var(--black); border-radius: 999px; background: var(--white); padding: 0 14px; min-height: 40px; font-size: 14px; font-weight: 600; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--yellow); }

/* Fotos */
.photos { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.ph { position: relative; aspect-ratio: 1; border: 2px solid var(--black); border-radius: 12px; overflow: hidden; background: #F3EEE6; }
.ph img { width: 100%; height: 100%; object-fit: cover; }
.ph .n { position: absolute; left: 4px; top: 4px; background: var(--black); color: var(--white); font-size: 11px; font-weight: 700; border-radius: 6px; padding: 1px 6px; }
.ph .x { position: absolute; right: 3px; top: 3px; width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--black); background: var(--white); font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; font-size: 16px; line-height: 1; }
.add { aspect-ratio: 1; border: 2px dashed var(--black); border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; cursor: pointer; background: var(--cream); font-size: 12px; font-weight: 700; text-align: center; }
.add .plus { font-size: 26px; line-height: 1; }
.add input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.add:focus-within { outline: 3px solid var(--orange); outline-offset: 2px; }

.variant-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.variant-head h2 { font-size: 16px; }
.link-btn { display: inline-flex; align-items: center; border: 0; background: none; color: var(--orange-dark); font-weight: 700; font-size: 14px; cursor: pointer; min-height: 44px; padding: 0 6px; text-decoration: underline; }
.dashed-btn { border: 2px dashed var(--black); background: transparent; border-radius: 14px; min-height: 52px; font-weight: 700; font-size: 15px; cursor: pointer; }

/* Botón principal */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 56px; padding: 0 20px; border: 2px solid var(--black); border-radius: 14px; background: var(--white); box-shadow: var(--shadow); font-family: var(--head); font-weight: 600; font-size: 15px; color: var(--black); cursor: pointer; text-decoration: none; text-align: center; }
.btn:hover { color: var(--black); }
.btn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 #000; }
.btn.primary { background: var(--orange); }
.btn.dark { background: var(--black); color: var(--white); }
.btn.dark:hover { color: var(--white); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.5; pointer-events: none; }
.btn.small { min-height: 44px; font-size: 13px; padding: 0 14px; box-shadow: 2px 2px 0 #000; }
.footer { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.summary { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; color: var(--muted); font-weight: 500; }
.summary strong { color: var(--black); }
.btns2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }

/* Gasto */
.spend { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.spend .v { font-family: var(--head); font-size: 18px; font-weight: 600; }
.meter { height: 10px; border: 2px solid var(--black); border-radius: 999px; overflow: hidden; background: var(--cream); }
.meter > span { display: block; height: 100%; background: var(--orange); }

/* Historial */
.hist { display: flex; flex-direction: column; }
.hist a { display: flex; justify-content: space-between; gap: 10px; padding: 12px 2px; border-top: 1px solid #E6DccF; text-decoration: none; color: var(--black); font-weight: 500; font-size: 14px; }
.hist a:first-child { border-top: 0; }
.hist .tag { font-size: 12px; color: var(--muted); }

/* Resultados */
.results { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.res { display: flex; flex-direction: column; gap: 8px; }
.res .img { aspect-ratio: 1; border: 2px solid var(--black); border-radius: 12px; overflow: hidden; background: var(--white); display: flex; align-items: center; justify-content: center; text-align: center; padding: 0; }
.res .img img { width: 100%; height: 100%; object-fit: contain; }
.res .img a { display: block; width: 100%; height: 100%; }
.res .name { font-size: 13px; font-weight: 700; word-break: break-word; }
.res .acts { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.res .err { font-size: 12px; color: var(--danger); font-weight: 600; line-height: 1.35; padding: 8px; }
.res .wait { display: flex; flex-direction: column; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; color: var(--muted); }
.fixbox { display: flex; flex-direction: column; gap: 8px; }
.fixbox textarea { width: 100%; border: 2px solid var(--black); border-radius: 10px; padding: 10px; font-size: 15px; min-height: 80px; resize: vertical; }

.spin { width: 30px; height: 30px; border: 3px solid #E6DCCF; border-top-color: var(--orange); border-radius: 50%; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.status { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 14px; }
.progress { height: 12px; border: 2px solid var(--black); border-radius: 999px; overflow: hidden; background: var(--white); }
.progress > span { display: block; height: 100%; background: var(--orange); transition: width 0.4s; }

/* Textos */
.tline { display: flex; align-items: center; gap: 8px; padding: 10px 0; border-top: 1px solid #E6DCCF; }
.tline:first-of-type { border-top: 0; }
.tline .txt { flex: 1; font-size: 15px; font-weight: 600; line-height: 1.35; }
.count { font-size: 12px; font-weight: 700; color: var(--muted); flex-shrink: 0; }
.count.over { color: var(--danger); }
.sec ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; font-size: 15px; }
.sec p { margin: 0 0 10px; font-size: 15px; line-height: 1.55; }
.sec-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

/* Configuración */
.cfg textarea { min-height: 200px; font-size: 14px; }

/* Login */
.login { min-height: 80vh; justify-content: center; }
.login .logo { width: 260px; margin: 0 auto 10px; }

.notice { border: 2px solid var(--black); border-radius: 12px; background: var(--soft); padding: 12px; font-size: 14px; font-weight: 500; line-height: 1.45; }
.errbox { border: 2px solid var(--danger); border-radius: 12px; background: #FDECEA; color: var(--danger); padding: 12px; font-size: 14px; font-weight: 600; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--black); color: var(--white); padding: 12px 18px; border-radius: 12px; font-weight: 600; font-size: 14px; z-index: 50; max-width: calc(100% - 32px); box-shadow: 3px 3px 0 var(--orange); }

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

@media (max-width: 380px) {
  .photos { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  h1 { font-size: 22px; }
  .hello { font-size: 24px; }
}
@media (min-width: 700px) {
  .results { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

[hidden] { display: none !important; }
