:root {
  --primary: #0E6B70;
  --primary-dark: #0A5256;
  --primary-soft: #E3F1F1;
  --urgent: #B3401A;
  --urgent-soft: #FBEAE4;
  --success: #1F7A3A;
  --success-soft: #E4F3E8;
  --info: #1D5FA8;
  --info-soft: #E5EEF9;
  --bg: #F3F5F7;
  --surface: #FFFFFF;
  --text: #1A2329;
  --muted: #5A6670;
  --border: #D5DCE1;
  --radius: 14px;
  --tap: 48px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
}
body.has-nav { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
main { max-width: 640px; margin: 0 auto; padding: 12px 16px 24px; }
h1, h2 { margin: 0; line-height: 1.2; }
a { color: var(--primary); }
:focus-visible { outline: 3px solid var(--info); outline-offset: 2px; }

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; padding-top: calc(12px + env(safe-area-inset-top));
  background: var(--primary); color: #fff;
}
.topbar h1 { font-size: 1.3rem; font-weight: 700; }
.lang {
  min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; padding: 0 14px;
  border-radius: 999px; background: rgba(255,255,255,.16); color: #fff; text-decoration: none; font-weight: 600; font-size: .95rem;
}

.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--surface); border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottomnav a {
  min-height: 64px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); text-decoration: none; font-size: .8rem; font-weight: 600;
}
.bottomnav a[aria-current="page"] { color: var(--primary); }
.icon { width: 24px; height: 24px; flex: none; vertical-align: middle; }
.icon-lg { width: 32px; height: 32px; }

.date-line { margin: 4px 0 12px; color: var(--muted); font-weight: 600; text-transform: capitalize; }
.subtitle { margin: 4px 0 12px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; list-style: none; padding: 0; margin: 0 0 16px; }
.stats li { background: var(--surface); border-radius: var(--radius); padding: 10px; text-align: center; border: 1px solid var(--border); }
.stats strong { display: block; font-size: 1.6rem; color: var(--primary); }
.stats span { font-size: .85rem; color: var(--muted); }

.card {
  background: var(--surface); border: 1px solid var(--border); border-left: 6px solid var(--primary);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px;
}
.card-urgent { border-color: var(--urgent); border-left-color: var(--urgent); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.card h2 { font-size: 1.2rem; }
.card p { margin: 6px 0; }
.card form { margin: 0; }
.card .btn { margin-top: 8px; }
.due { font-weight: 700; }
.muted { color: var(--muted); }
.badges:empty { display: none; }
.badge { display: inline-block; font-size: .8rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; margin-right: 4px; }
.badge-urgent { background: var(--urgent-soft); color: var(--urgent); }
.badge-info { background: var(--info-soft); color: var(--info); }

.pill { font-size: .8rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; white-space: nowrap; background: var(--primary-soft); color: var(--primary-dark); }
.pill-in_progress, .pill-issue-seen { background: var(--info-soft); color: var(--info); }
.pill-done, .pill-approved, .pill-paid, .pill-issue-fixed, .pill-issue-bought { background: var(--success-soft); color: var(--success); }
.pill-rejected, .pill-issue-open { background: var(--urgent-soft); color: var(--urgent); }

.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  min-height: var(--tap); padding: 10px 18px; border-radius: 12px; border: 2px solid transparent;
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:active { background: var(--primary-dark); }
.btn-primary:disabled { background: #9AA7AE; cursor: not-allowed; }
.btn-secondary { background: var(--surface); color: var(--primary); border-color: var(--primary); }
.btn-link { background: none; color: var(--muted); text-decoration: underline; font-weight: 600; }
.btn-big { min-height: 60px; font-size: 1.15rem; }

.stack { display: flex; flex-direction: column; gap: 12px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin: 0; }
fieldset.panel { min-width: 0; }
legend, .label, .section-title { font-weight: 700; font-size: 1.05rem; }
legend { padding: 0 4px; }
.section-title { margin-bottom: 8px; }
.label { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.input {
  width: 100%; min-height: var(--tap); padding: 10px 12px; font: inherit; color: var(--text);
  background: #fff; border: 1.5px solid var(--border); border-radius: 10px;
}
textarea.input { resize: vertical; }

.progress-row { display: flex; align-items: center; gap: 12px; margin: 6px 0 10px; }
progress { flex: 1; height: 12px; appearance: none; border: none; border-radius: 999px; background: var(--primary-soft); overflow: hidden; }
progress::-webkit-progress-bar { background: var(--primary-soft); border-radius: 999px; }
progress::-webkit-progress-value { background: var(--success); border-radius: 999px; }
progress::-moz-progress-bar { background: var(--success); border-radius: 999px; }
[data-progress-text] { font-weight: 700; white-space: nowrap; }

.check { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 6px 0; border-top: 1px solid var(--bg); cursor: pointer; }
.check input { width: 28px; height: 28px; accent-color: var(--success); flex: none; }

.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 6px; }
.segmented label, .tile { position: relative; cursor: pointer; }
.segmented input, .tile input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segmented span {
  display: flex; align-items: center; justify-content: center; min-height: 56px;
  border: 2px solid var(--border); border-radius: 12px; font-weight: 700; font-size: 1.1rem;
}
.segmented input:checked + span { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-dark); }
.segmented input[value="no"]:checked + span { border-color: var(--urgent); background: var(--urgent-soft); color: var(--urgent); }
.segmented input:focus-visible + span, .tile input:focus-visible + span { outline: 3px solid var(--info); outline-offset: 2px; }
.no-hint { display: none; margin: 10px 0 0; color: var(--urgent); font-weight: 600; }
.ok-question:has(input[value="no"]:checked) .no-hint { display: block; }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 6px; }
.tile span {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 92px;
  padding: 10px; text-align: center; border: 2px solid var(--border); border-radius: 12px; font-weight: 700;
}
.tile input:checked + span { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-dark); }

.switch { display: flex; align-items: center; gap: 12px; min-height: var(--tap); font-weight: 700; cursor: pointer; }
.switch input { width: 28px; height: 28px; accent-color: var(--urgent); }

.chips { display: grid; grid-template-columns: 1fr; gap: 8px; margin-top: 6px; }
.chip { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 6px 6px 12px; border: 1.5px solid var(--border); border-radius: 12px; }
.chip-on { border-color: var(--primary); background: var(--primary-soft); }
.chip label { font-weight: 600; }
.stepper { display: flex; align-items: center; gap: 4px; }
.step { width: 44px; height: 44px; border-radius: 10px; border: 1.5px solid var(--border); background: #fff; font-size: 1.4rem; font-weight: 700; color: var(--primary); cursor: pointer; }
.stepper input { width: 52px; height: 44px; text-align: center; font: inherit; font-weight: 700; border: 1.5px solid var(--border); border-radius: 10px; }

.previews { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.previews img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; }

.flash { padding: 12px 14px; border-radius: 12px; background: var(--success-soft); color: var(--success); font-weight: 600; margin: 0 0 12px; }
.flash-error { background: var(--urgent-soft); color: var(--urgent); }
.flash-info { background: var(--info-soft); color: var(--info); }
.empty { text-align: center; padding: 32px 12px; color: var(--muted); }

.day { margin-bottom: 18px; }
.day-head { font-size: 1.05rem; margin-bottom: 8px; text-transform: capitalize; }
.rows { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-left: 5px solid var(--primary); border-radius: 12px; padding: 10px 12px; }
.row-urgent { border-left-color: var(--urgent); }

.hero-amount { text-align: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 12px; }
.hero-amount .amount { font-size: 2.2rem; font-weight: 700; color: var(--success); margin: 4px 0; }
.hero-amount p { margin: 2px 0; }
.lines { list-style: none; padding: 0; margin: 0; }
.lines li, .lines-one { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--bg); margin: 0; }
.lines li.total { font-weight: 700; border-top: 2px solid var(--border); }
section.panel { margin-bottom: 12px; }
#mis-reportes { margin-top: 28px; }

.login { max-width: 360px; margin: 24px auto; text-align: center; }
.login-logo { border-radius: 22px; margin-bottom: 12px; }
.input-pin { font-size: 1.8rem; text-align: center; letter-spacing: .4em; }
.logout { margin-top: 24px; }

@media (min-width: 520px) {
  .chips { grid-template-columns: 1fr 1fr; }
  .tiles { grid-template-columns: repeat(4, 1fr); }
}
