:root {
  --bg: #f6f4ef; --card: #ffffff; --text: #1f2421; --muted: #5d655f; --line: #e2ded5;
  --primary: #2f6f5e; --primary-ink: #ffffff; --primary-soft: #e3efe9;
  --work: #2f7d5b; --work-soft: #e2f2e9; --free: #6b7280; --free-soft: #eef0f2; --holiday: #b4373b; --holiday-soft: #fbe7e7;
  --warn: #8a5a00; --warn-soft: #fff3d6; --err: #b4373b; --err-soft: #fde8e8; --pend: #7a4bd1; --pend-soft: #efe8fc;
  --radius: 14px; --tap: 52px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px; line-height: 1.4; color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #151816; --card: #1f2421; --text: #eef1ee; --muted: #a8b0aa; --line: #333a35;
    --primary: #5fb79b; --primary-ink: #0d1f19; --primary-soft: #1f3a31;
    --work: #6fcf9f; --work-soft: #1d3329; --free: #a3a9b1; --free-soft: #2a2e33; --holiday: #f08a8d; --holiday-soft: #3d2324;
    --warn: #f3c463; --warn-soft: #3b3016; --err: #f08a8d; --err-soft: #3d2324; --pend: #b79cf0; --pend-soft: #2d2540; color-scheme: dark; }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { -webkit-text-size-adjust: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea { width: 100%; min-height: var(--tap); padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
textarea { min-height: 80px; }
input[type=checkbox] { width: 24px; height: 24px; min-height: 0; accent-color: var(--primary); }
input[type=file] { min-height: 0; border: 0; padding: 8px 0; }

.app { min-height: 100dvh; display: flex; flex-direction: column; padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
.top { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: var(--bg); border-bottom: 1px solid var(--line); }
.top-date { font-weight: 700; font-size: 1.05rem; }
.top-who { color: var(--muted); font-size: .9rem; }
.top-actions { display: flex; align-items: center; gap: 6px; }
.content { padding: 12px 16px; max-width: 720px; width: 100%; margin: 0 auto; }
.h1 { font-size: 1.6rem; margin: 6px 0 10px; }
.h2 { font-size: 1.15rem; margin: 22px 0 8px; }
.muted { color: var(--muted); } .small { font-size: .88rem; } .warn-text { color: var(--warn); }
.error { color: var(--err); font-weight: 600; }
.empty { color: var(--muted); padding: 14px; text-align: center; background: var(--card); border-radius: var(--radius); }
.splash { padding: 40px; text-align: center; color: var(--muted); }
.test-banner { background: var(--pend-soft); color: var(--pend); text-align: center; font-weight: 700; font-size: .8rem; padding: 4px; letter-spacing: .04em; }

.btn { min-height: var(--tap); padding: 10px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); font-weight: 600; cursor: pointer; }
.btn:disabled { opacity: .5; }
.btn-primary { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.btn-danger { color: var(--err); border-color: var(--err); }
.btn-ghost { background: transparent; border-style: dashed; width: 100%; margin-top: 12px; }
.btn-big { width: 100%; min-height: 60px; font-size: 1.1rem; margin: 10px 0; }
.btn-small { min-height: 40px; padding: 6px 12px; font-size: .9rem; }
.icon-btn { min-width: 44px; min-height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); cursor: pointer; font-size: 1.1rem; }
.icon-btn:disabled { opacity: .35; }
.link { background: none; border: 0; color: var(--primary); text-decoration: underline; padding: 4px; cursor: pointer; font-weight: 600; }
.row { display: flex; gap: 8px; align-items: center; } .row.wrap { flex-wrap: wrap; margin: 8px 0; } .row.between { justify-content: space-between; }
.row .field { flex: 1; }

.sync { border: 0; border-radius: 999px; padding: 6px 10px; font-size: .8rem; font-weight: 700; cursor: pointer; }
.sync-ok { background: var(--work-soft); color: var(--work); } .sync-busy { background: var(--free-soft); color: var(--muted); }
.sync-warn { background: var(--warn-soft); color: var(--warn); } .sync-err { background: var(--err-soft); color: var(--err); }

.tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 5; display: flex; background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabs button { flex: 1; min-height: 64px; border: 0; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: .8rem; color: var(--muted); cursor: pointer; }
.tabs button.on { color: var(--primary); font-weight: 700; }
.tab-icon { font-size: 1.35rem; line-height: 1; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin: 10px 0; }
.card.warn { border-color: var(--warn); background: var(--warn-soft); } .card.err { border-color: var(--err); background: var(--err-soft); }
.card-title { font-weight: 700; margin: 0 0 6px; }
.card p { margin: 4px 0; }
.alert { background: var(--warn-soft); color: var(--text); border-left: 5px solid var(--warn); padding: 10px 12px; border-radius: 10px; margin: 10px 0; }
.alert-err { background: var(--err-soft); border-color: var(--err); }
.alert-warn { background: var(--warn-soft); border-color: var(--warn); font-size: 1.1rem; }

.shift-row { display: flex; gap: 8px; }
.shift-box { flex: 1; border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; font-weight: 700; margin: 6px 0; }
.shift-box.work { background: var(--work-soft); color: var(--work); }
.shift-box.free, .shift-box.none { background: var(--free-soft); color: var(--free); }
.shift-box.holiday { background: var(--holiday-soft); color: var(--holiday); font-size: 1.2rem; text-align: center; }
.shift-slot { font-size: .85rem; font-weight: 600; } .shift-time { font-size: 1.35rem; }
.progress { margin: 14px 0 6px; }

.tasks { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.task-btn { width: 100%; display: flex; gap: 12px; align-items: flex-start; text-align: left; min-height: 60px; padding: 12px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--card); cursor: pointer; }
.task-btn:disabled { cursor: default; }
.check { flex: 0 0 30px; height: 30px; border-radius: 8px; border: 2px solid var(--primary); display: grid; place-items: center; font-weight: 800; color: var(--primary-ink); }
.task.done .check { background: var(--primary); }
.task.done .task-title { text-decoration: line-through; color: var(--muted); }
.task.carried .check { border-color: var(--warn); color: var(--warn); }
.task-text { display: flex; flex-direction: column; gap: 2px; }
.task-title { font-weight: 600; font-size: 1.05rem; }
.task-notes { color: var(--muted); font-size: .9rem; }
.badges { display: flex; flex-wrap: wrap; gap: 4px; }
.badge { display: inline-block; font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--free-soft); color: var(--muted); }
.badge-warn { background: var(--warn-soft); color: var(--warn); } .badge-ok { background: var(--work-soft); color: var(--work); } .badge-pend { background: var(--pend-soft); color: var(--pend); }

.week-nav { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
.week-nav .btn { min-width: 52px; font-size: 1.4rem; padding: 0; }
.week-title { flex: 1; text-align: center; font-weight: 700; }
.days { display: flex; flex-direction: column; gap: 8px; }
.day { background: var(--card); border: 1px solid var(--line); border-left: 6px solid var(--free); border-radius: var(--radius); overflow: hidden; }
.day.kind-work { border-left-color: var(--work); } .day.kind-holiday { border-left-color: var(--holiday); background: var(--holiday-soft); }
.day.today { box-shadow: 0 0 0 2px var(--primary); }
.day-head { width: 100%; display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; text-align: left; padding: 12px; background: none; border: 0; cursor: pointer; min-height: 60px; }
.day-name { font-weight: 700; } .day-sub { grid-column: 1; color: var(--muted); font-size: .9rem; }
.day-count { grid-row: 1 / span 2; grid-column: 2; align-self: center; font-weight: 700; color: var(--muted); }
.day-body { padding: 0 12px 12px; }

.punch-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 8px 0; }
.punch { min-height: 96px; border-radius: var(--radius); border: 2px solid var(--line); background: var(--card); display: flex; flex-direction: column; justify-content: center; gap: 4px; padding: 10px; cursor: pointer; text-align: center; }
.punch-label { font-weight: 800; font-size: 1.02rem; } .punch-state { font-size: .9rem; }
.punch-avail { border-color: var(--primary); background: var(--primary-soft); color: var(--text); }
.punch-done { border-color: var(--work); background: var(--work-soft); color: var(--work); }
.punch-queued { border-color: var(--pend); background: var(--pend-soft); color: var(--pend); }
.punch-na { border-style: dashed; color: var(--muted); background: transparent; cursor: default; }
.punch:disabled { cursor: default; }
.plain { list-style: none; padding: 0; margin: 0; } .plain li { padding: 6px 0; border-top: 1px solid var(--line); } .plain li:first-child { border-top: 0; }
.voided { text-decoration: line-through; color: var(--muted); }

.balance { font-size: 1.5rem; font-weight: 800; padding: 22px 16px; border-radius: var(--radius); text-align: center; background: var(--card); border: 1px solid var(--line); }
.balance.eli { background: var(--work-soft); color: var(--work); } .balance.sansan { background: var(--warn-soft); color: var(--warn); } .balance.pending { background: var(--pend-soft); color: var(--pend); }
.history { list-style: none; padding: 0; } .history li { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin: 8px 0; }

.field { display: flex; flex-direction: column; gap: 4px; margin: 10px 0; }
.field-label { font-weight: 600; font-size: .95rem; } .hint { color: var(--muted); font-size: .85rem; }
.check-label { display: flex; align-items: center; gap: 10px; min-height: 44px; margin: 6px 0; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.seg button { flex: 1 1 auto; min-height: 46px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); cursor: pointer; font-weight: 600; }
.seg button.on { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); cursor: pointer; font-weight: 600; }
.chip input { display: none; } .chip.on { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); } .chip.off { opacity: .6; }

.day-edit { border-left: 6px solid var(--free); } .day-edit.kind-work { border-left-color: var(--work); } .day-edit.kind-holiday { border-left-color: var(--holiday); }
.day-edit select { width: auto; min-width: 140px; }
.slot-edit { margin-top: 10px; display: grid; grid-template-columns: 1fr auto 1fr; gap: 6px 8px; align-items: center; }
.slot-edit .check-label { grid-column: 1 / -1; margin: 0; min-height: 36px; }
.slot-edit input[type=time] { width: 100%; min-width: 0; }
.slot-edit > .muted { grid-column: 1 / -1; }
.note { margin-top: 8px; }
.sticky-actions { position: sticky; bottom: calc(70px + env(safe-area-inset-bottom)); display: flex; gap: 8px; background: var(--bg); padding: 10px 0; }
.sticky-actions .btn { flex: 1; }
.order-list { list-style: none; padding: 0; margin: 0; }
.order-list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; margin: 6px 0; }
.order-list li.done .order-title, .order-list li.inactive .order-title { color: var(--muted); }
.order-btns { display: flex; gap: 4px; align-items: center; flex-shrink: 0; }

.sheet-bg { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.4); display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--bg); width: 100%; max-width: 720px; max-height: 92dvh; overflow: auto; border-radius: 18px 18px 0 0; padding-bottom: env(safe-area-inset-bottom); }
.sheet-head { position: sticky; top: 0; display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; background: var(--bg); border-bottom: 1px solid var(--line); }
.sheet-head h2 { margin: 0; font-size: 1.2rem; } .sheet-body { padding: 8px 16px 20px; }
.big-text { font-size: 1.3rem; }
.toast { position: fixed; left: 16px; right: 16px; bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 30; padding: 14px 16px; border-radius: 12px; background: var(--text); color: var(--bg); font-weight: 600; box-shadow: 0 6px 20px rgba(0,0,0,.25); }
.toast-ok { background: var(--work); color: #fff; } .toast-err { background: var(--err); color: #fff; } .toast-warn { background: var(--warn); color: #fff; }

.login { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; padding: 0 0 24px; }
.login-hero { position: relative; width: 100%; height: 44dvh; min-height: 260px; max-height: 460px;
  background: #2f6f5e url('/portada.jpg') center 35% / cover no-repeat; }
.login-hero::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(0,0,0,.05) 35%, rgba(0,0,0,.55)); }
.login-hero-title { position: absolute; left: 20px; right: 20px; bottom: 52px; z-index: 1; color: #fff; text-shadow: 0 2px 10px rgba(0,0,0,.45); }
.login-hero-title h1 { margin: 0; font-size: 2.1rem; } .login-hero-title p { margin: 2px 0 0; font-weight: 600; }
.login-card { position: relative; z-index: 2; width: calc(100% - 32px); max-width: 420px; margin-top: -32px; background: var(--card); border-radius: 20px; padding: 20px; border: 1px solid var(--line); text-align: center; box-shadow: 0 8px 24px rgba(0,0,0,.12); }
.login-card form { text-align: left; }
.import-result { margin-top: 12px; } details { margin: 6px 0; } summary { cursor: pointer; font-weight: 600; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

.note-card { border-left: 5px solid var(--primary); background: var(--primary-soft); }
.note-title { font-weight: 800; margin: 0 0 4px; }
.note-text { white-space: pre-wrap; font-size: 1.05rem; margin: 0 0 6px; }
.note-add { margin-top: 8px; }

.kind-perm { background: var(--free-soft); color: var(--muted); }
.kind-extra { background: var(--primary-soft); color: var(--primary); }
.kind-pend { background: var(--warn-soft); color: var(--warn); }
.kind-done { background: var(--work-soft); color: var(--work); }
.work-sum { margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--line); }

.remind-list { list-style: none; padding: 0; margin: 8px 0; display: flex; flex-direction: column; gap: 6px; }
.remind-btn { width: 100%; display: flex; gap: 10px; align-items: center; text-align: left; min-height: 48px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); cursor: pointer; font-weight: 600; }
.remind-btn .check { flex: 0 0 26px; height: 26px; }
.ok-text { color: var(--work); font-weight: 700; }

.sheet-sticky { position: sticky; bottom: 0; background: var(--bg); padding: 4px 0 2px; }

.basura-alert { font-size: 1.1rem; }
.basura-alert .remind-btn { margin-top: 8px; }

.tabs button { min-width: 0; font-size: .72rem; }
.tab-icon { font-size: 1.2rem; }
.order-btns .btn-small { padding: 6px 10px; }
