:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --text: #172033;
  --muted: #687386;
  --border: #dfe5ef;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --green: #15803d;
  --red: #b91c1c;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
button, input { font: inherit; }
button { cursor: pointer; }
.shell { width: min(900px, calc(100% - 28px)); margin: 28px auto 40px; }
.topbar, .section-heading, .welcome-row, .list-summary, .invite-box {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.topbar { margin-bottom: 22px; }
h1 { font-size: clamp(2rem, 5vw, 2.7rem); margin: 2px 0 0; letter-spacing: -0.04em; }
h2 { font-size: 1.25rem; margin: 0 0 14px; }
h3 { font-size: 1rem; margin: 0 0 10px; }
p { margin-top: 0; }
.eyebrow { font-size: .72rem; font-weight: 800; letter-spacing: .13em; color: var(--primary); margin: 0 0 5px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 22px; margin-bottom: 18px; box-shadow: 0 8px 28px rgba(20, 37, 65, .04); }
.auth-panel { max-width: 480px; margin: 0 auto; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; background: #f0f3f9; padding: 5px; border-radius: 12px; margin-bottom: 20px; }
.tab { border: 0; border-radius: 9px; padding: 10px; background: transparent; color: var(--muted); font-weight: 700; }
.tab.active { color: var(--text); background: white; box-shadow: 0 1px 4px #15233b12; }
.form { display: flex; flex-direction: column; gap: 9px; }
.form label, .add-item-form label { font-size: .87rem; font-weight: 700; }
input { min-width: 0; width: 100%; padding: 11px 12px; border: 1px solid var(--border); border-radius: 10px; background: #fff; color: var(--text); outline: none; }
input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px #2563eb1a; }
.form input { margin-bottom: 8px; }
.button { border: 0; border-radius: 10px; padding: 11px 15px; font-weight: 750; transition: background .15s ease, transform .15s ease; white-space: nowrap; }
.button:active { transform: translateY(1px); }
.button-primary { color: white; background: var(--primary); }
.button-primary:hover { background: var(--primary-dark); }
.button-secondary { color: #1d4ed8; background: #eaf1ff; }
.button-secondary:hover { background: #dce8ff; }
.button-quiet { color: #344054; background: #edf1f7; }
.button-quiet:hover { background: #e2e8f0; }
.auth-panel .button { margin-top: 5px; }
.auth-panel .muted { margin: 18px 0 0; }
.welcome-row { margin: 10px 0 16px; }
.welcome-row h2 { font-size: 1.4rem; margin: 0; }
.welcome-row p { margin-bottom: 4px; }
.split-form { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border); }
.groups-list { display: grid; gap: 8px; }
.group-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid var(--border); padding: 12px; border-radius: 12px; }
.group-card strong { display: block; }
.group-card .muted { font-size: .8rem; margin-top: 3px; }
.section-heading { margin-bottom: 16px; }
.section-heading h2 { margin: 0; }
.invite-box { background: #f7f9fd; border: 1px dashed #c7d3e5; border-radius: 12px; padding: 12px 14px; margin-bottom: 20px; }
.invite-box span, .invite-box strong { display: block; }
.invite-box strong { letter-spacing: .12em; margin-top: 3px; font-size: 1.1rem; }
.add-item-form { display: flex; align-items: end; gap: 10px; }
.field-grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.quantity-field { width: 145px; display: flex; flex-direction: column; gap: 8px; }
.add-button { min-height: 43px; }
.list-summary { margin: 22px 0 10px; }
.text-button { color: var(--primary); background: transparent; border: 0; font-weight: 700; padding: 5px; }
.items-list { display: grid; gap: 8px; }
.item-row { display: flex; align-items: center; gap: 12px; border: 1px solid var(--border); border-radius: 12px; padding: 12px; }
.item-check { width: 20px; height: 20px; accent-color: var(--green); flex: 0 0 auto; }
.item-main { flex: 1; min-width: 0; }
.item-name { display: block; font-weight: 700; overflow-wrap: anywhere; }
.item-quantity { display: block; font-size: .83rem; color: var(--muted); margin-top: 3px; }
.item-row.bought { background: #f7fbf8; }
.item-row.bought .item-name { color: #718078; text-decoration: line-through; }
.delete-button { border: 0; background: transparent; color: var(--red); font-size: 1.2rem; padding: 6px 8px; border-radius: 8px; }
.delete-button:hover { background: #fee2e2; }
.empty-state { text-align: center; padding: 26px 10px; color: var(--muted); }
.notice { padding: 12px 14px; border-radius: 10px; margin-bottom: 16px; background: #eaf1ff; color: #1e40af; }
.notice.error { background: #fee2e2; color: #991b1b; }
.notice.success { background: #dcfce7; color: #166534; }
footer { color: var(--muted); font-size: .8rem; text-align: center; padding: 20px 0 0; }
.hidden { display: none !important; }
@media (max-width: 620px) {
  .shell { width: min(100% - 18px, 900px); margin-top: 15px; }
  .panel { padding: 16px; border-radius: 15px; }
  .split-form { grid-template-columns: 1fr; gap: 20px; }
  .add-item-form { display: grid; grid-template-columns: 1fr 115px; }
  .field-grow { grid-column: 1 / -1; }
  .quantity-field { width: 100%; }
  .add-button { width: 100%; }
  .group-card { align-items: flex-start; }
  .invite-box { align-items: flex-start; }
  .invite-box .button { white-space: normal; }
}

/* Juntos: mobile first, contraste alto y controles táctiles. */
:root { --bg:#f4f3eb; --primary:#17624e; --primary-dark:#104a3b; --text:#203d34; --muted:#62766b; --border:#dce5d9; }
body { background: radial-gradient(ellipse at 90% 0%, #dfeccf, transparent 55%), var(--bg); min-height:100vh; }
.shell { max-width:760px; }
h1 { font-size:clamp(2.1rem,7vw,3.5rem); line-height:1.06; }
.topbar { align-items:flex-start; padding:12px 0 18px; }
.dot { color:#d6863b; }
.panel { border-radius:24px; box-shadow:0 12px 35px #243d3410; }
.auth-panel { margin-top:24px; padding:28px; }
.auth-panel h2 { font-size:1.65rem; letter-spacing:-.04em; margin:12px 0 24px; }
.button, .tab { min-height:44px; }
button:disabled { opacity:.55; cursor:wait; }
input { font-size:16px; min-height:46px; }
.button-secondary { background:#e8f1de; color:#245842; }
.button-secondary:hover { background:#d8e9c8; }
.button-quiet { background:#ebeee5; color:#3c5649; }
.invite-box { background:#f5f7ef; border-color:#c7d7ba; }
.notice { position:sticky; top:10px; z-index:10; box-shadow:0 4px 20px #203d3420; }
summary { cursor:pointer; font-weight:750; padding:6px 0; min-height:44px; }
details[open]>summary { margin-bottom:14px; }
.sharing { padding:8px 0 18px; }
.sharing .small { margin-top:12px; }
progress { width:100%; height:8px; accent-color:var(--primary); margin-bottom:22px; }
.item-check { width:28px; height:28px; margin:8px 0; }
.delete-button { min-height:44px; min-width:40px; }
.group-card strong { overflow-wrap:anywhere; }
dialog { width:min(440px, calc(100% - 32px)); border:1px solid var(--border); border-radius:24px; padding:24px; color:var(--text); }
dialog::backdrop { background:#102e27aa; backdrop-filter:blur(4px); }
:focus-visible { outline:3px solid #bf791a; outline-offset:3px; }
@media (max-width:620px) { .shell { width:calc(100% - 24px); } .topbar .button { max-width:110px; white-space:normal; } .item-row { gap:8px; padding:10px; } .panel { padding:18px; } }
@media (prefers-reduced-motion:reduce) { * { transition:none!important; } }
