:root{font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;color:#20242c;background:#f4f5f8;font-synthesis:none;--section-color:#6b7280}
*{box-sizing:border-box}html{background:#f4f5f8}body{margin:0;min-height:100vh;background:#f4f5f8}
button,input,select{font:inherit}button{touch-action:manipulation}button,input,label,select{-webkit-tap-highlight-color:transparent}
.shell{width:min(760px,100%);min-height:100vh;margin:0 auto;padding:env(safe-area-inset-top) 14px calc(24px + env(safe-area-inset-bottom))}
.topbar{display:flex;align-items:center;justify-content:space-between;padding:18px 2px 10px}.brand{display:flex;align-items:center;gap:10px}
.brand-mark{display:grid;place-items:center;width:38px;height:38px;border-radius:13px;background:#20242c;color:#fff;font-weight:900}
.brand strong{display:block;font-size:1.05rem}.brand small{display:block;color:#7a818e;font-size:.72rem;margin-top:1px}
.top-actions{display:flex;align-items:center;gap:7px;flex-shrink:0}.brand{min-width:0}.brand>div:last-child{min-width:0}.brand small{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.home-link{position:relative;display:grid;place-items:center;width:40px;height:40px;border-radius:12px;color:#676e7a;text-decoration:none;background:#fff;border:1px solid #e6e8ed}
.review-link{font-weight:900;font-size:1rem}.gear-symbol{font-size:1.05rem;line-height:1}.review-link.active{background:#252a33;color:#fff;border-color:#252a33}
.review-count{position:absolute;right:-5px;top:-5px;display:grid;place-items:center;min-width:18px;height:18px;padding:0 4px;border-radius:999px;background:#d94a4a;color:#fff;font-size:.62rem;font-weight:900;border:2px solid #f4f5f8}
.list-strip{display:flex;gap:9px;overflow-x:auto;padding:6px 0 14px;scrollbar-width:none}.list-strip::-webkit-scrollbar{display:none}
.list-pill{flex:0 0 auto;display:flex;align-items:center;gap:8px;border:1px solid #e2e5ea;background:#fff;color:#343a44;padding:9px 11px;border-radius:14px;min-height:44px}
.list-pill.active{border-color:color-mix(in srgb,var(--list-color) 65%,#d8dbe2);box-shadow:0 4px 16px rgba(30,35,45,.08)}
.list-dot{width:10px;height:10px;border-radius:50%;background:var(--list-color)}
.list-pill-name{position:relative;display:inline-flex;align-items:center;gap:6px;max-width:145px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:700}
.update-dot{display:inline-block;flex:0 0 auto;width:7px;height:7px;border-radius:50%;background:#ff4d4f;box-shadow:0 0 0 2px rgba(255,77,79,.12)}
.list-pill-count{font-size:.72rem;color:#8a909a}.list-pill-edit{border:0;background:transparent;color:#8a909a;padding:3px 2px;font-size:1rem;line-height:1}
.add-list{flex:0 0 auto;border:1px dashed #c9ced7;background:transparent;color:#656d79;border-radius:14px;padding:9px 13px;font-weight:700}
.panel{background:#fff;border:1px solid #e4e7ec;border-radius:24px;box-shadow:0 12px 38px rgba(30,35,45,.06);overflow:hidden}.shopping-panel{overflow:clip}
.panel-head{position:relative;padding:19px 18px 15px}.panel-head::before{content:"";position:absolute;left:0;top:0;bottom:0;width:5px;background:var(--list-color)}
.title-row{display:flex;align-items:center;gap:9px;min-width:0}.title-row h1{margin:0;font-size:1.45rem;line-height:1.15;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.super-badge{flex:0 0 auto;padding:4px 7px;border-radius:999px;background:#f0f2f6;color:#69707c;font-size:.65rem;font-weight:800;text-transform:uppercase;letter-spacing:.08em}.subtitle{margin:6px 0 0;color:#8a909a;font-size:.8rem}
.add-form{position:sticky;top:env(safe-area-inset-top);z-index:20;display:grid;grid-template-columns:1fr auto;gap:9px;padding:8px 18px 10px;background:#fff;box-shadow:0 7px 12px rgba(30,35,45,.045)}
.add-input{width:100%;min-width:0;border:1px solid #dfe3e8;background:#f8f9fb;border-radius:14px;padding:12px 13px;outline:none}.add-input:focus{border-color:var(--list-color);box-shadow:0 0 0 3px color-mix(in srgb,var(--list-color) 16%,transparent)}
.add-btn{border:0;background:var(--list-color);color:white;border-radius:14px;padding:0 15px;font-weight:800;min-width:52px}
.items-area{padding:5px 0 9px}.section-title{margin:10px 18px 3px;color:var(--section-color);font-size:.68rem;line-height:1;text-transform:uppercase;letter-spacing:.09em;font-weight:800}
.item-row{display:grid;grid-template-columns:34px minmax(0,1fr) auto 30px;align-items:center;min-height:38px;padding:0 12px 0 9px}.item-row:not(.super-item){grid-template-columns:34px minmax(0,1fr) auto}.item-check{appearance:none;width:21px;height:21px;border:2px solid #c9ced7;border-radius:7px;background:#fff;display:grid;place-items:center;margin:0 auto}
.item-check:checked{background:var(--list-color);border-color:var(--list-color)}.item-check:checked::after{content:"✓";color:white;font-size:.9rem;font-weight:900;line-height:1}
.item-share{appearance:none;display:grid;place-items:center;justify-self:center;width:15px;height:15px;margin:0;border:1.5px solid #afb7c3;border-radius:4px;background:#fff;cursor:pointer}
.item-share:checked{background:#687383;border-color:#687383}.item-share:checked::after{content:"✓";color:#fff;font-size:.65rem;font-weight:900;line-height:1}
.item-check:focus-visible,.item-share:focus-visible{outline:2px solid #252a33;outline-offset:3px}
.item-text{min-width:0;border:0;background:transparent;text-align:left;color:#282d35;padding:7px 5px;font-weight:600;line-height:1.2;overflow-wrap:anywhere}.item-row.done .item-text{text-decoration:line-through;color:#9a9fa8;font-weight:500}
.item-category{font-size:.65rem;color:#a0a5ae;padding-left:6px;white-space:nowrap}.done-divider{margin-top:12px;padding-top:4px}.item-row.new-item{background:rgba(255,211,77,.16);border-radius:10px;margin:1px 5px}
.list-meta{padding:10px 16px 12px;text-align:right;color:#9a9fa8;font-size:.64rem;line-height:1.35}
.empty{padding:36px 20px 39px;text-align:center;color:#8a909a}.empty-symbol{display:grid;place-items:center;width:48px;height:48px;margin:0 auto 10px;border-radius:15px;background:#f4f5f8;font-size:1.4rem}.empty strong{display:block;color:#626a76;margin-bottom:4px}.empty p{margin:0;font-size:.84rem;line-height:1.4}
.dialog{width:min(92vw,460px);border:0;border-radius:22px;padding:0;box-shadow:0 28px 90px rgba(0,0,0,.28)}.dialog::backdrop{background:rgba(25,29,36,.42);backdrop-filter:blur(2px)}.dialog form{padding:20px}
.dialog-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:18px}.dialog h2{margin:0;font-size:1.2rem}.icon-btn{display:grid;place-items:center;width:36px;height:36px;border:0;border-radius:11px;background:#f1f3f6;color:#656c77;font-size:1.35rem}
.dialog label{display:block;font-size:.77rem;font-weight:800;color:#555d69;margin-top:13px}.dialog label>input:not([type=checkbox]){display:block;width:100%;margin-top:6px;border:1px solid #dce0e6;border-radius:12px;padding:11px 12px;outline:none}.dialog input[type=color]{height:45px;padding:4px!important}
.check-row{display:flex!important;gap:10px;align-items:flex-start;padding:12px;border:1px solid #e4e7ec;border-radius:14px}.check-row input{margin-top:3px;transform:scale(1.15)}.check-row strong,.check-row small{display:block}.check-row small{font-weight:500;color:#858b95;margin-top:2px;line-height:1.35}
.dialog-actions{display:grid;grid-template-columns:auto 1fr auto auto;gap:8px;align-items:center;margin-top:20px}.primary,.ghost{border:0;border-radius:11px;padding:10px 12px;font-weight:800}.primary{background:#252a33;color:#fff}.ghost{background:#f0f2f5;color:#555d68}.danger{color:#b44242}
.footnote{padding:14px 3px 0;text-align:center;color:#9a9fa8;font-size:.68rem;line-height:1.4}.toast{position:fixed;left:50%;bottom:calc(18px + env(safe-area-inset-bottom));transform:translateX(-50%) translateY(20px);background:#252a33;color:#fff;padding:10px 14px;border-radius:12px;font-size:.78rem;font-weight:700;opacity:0;pointer-events:none;transition:.2s;z-index:40}.toast.show{opacity:1;transform:translateX(-50%) translateY(0)}
.settings-panel{margin-bottom:12px}.device-form{padding:0 18px 18px}.device-form label{display:block;margin-bottom:6px;color:#646c77;font-size:.72rem;font-weight:800}.device-name-row{display:grid;grid-template-columns:1fr auto;gap:8px}.device-name-row input{min-width:0;border:1px solid #dfe3e8;background:#f8f9fb;border-radius:11px;padding:10px 11px;outline:none}.device-name-row input:focus{border-color:#8c929d}
.sync-settings{padding:0 18px 18px}.sync-status{display:flex;align-items:center;gap:7px;margin-bottom:7px}.sync-dot{width:9px;height:9px;border-radius:50%;background:#a1a7b1}.sync-dot.online{background:#32a466}.sync-note{margin:0 0 12px;color:#7b828d;font-size:.78rem;line-height:1.4}.sync-button{width:100%}.sync-or{text-align:center;color:#a0a5ad;font-size:.7rem;margin:10px 0}
.join-form{display:grid;grid-template-columns:1fr auto;gap:7px}.join-form input{min-width:0;border:1px solid #dfe3e8;background:#f8f9fb;border-radius:11px;padding:10px 11px;text-transform:uppercase;letter-spacing:.12em;font-weight:800;outline:none}.join-code-box{margin-top:12px;padding:12px;border-radius:13px;background:#f5f7fa;text-align:center}.join-code-box small,.join-code-box span{display:block;color:#858c96;font-size:.67rem}.join-code-box strong{display:block;margin:3px 0;font-size:1.35rem;letter-spacing:.16em}
.review-list{padding:5px 0 8px}.review-row{display:grid;grid-template-columns:minmax(0,1fr) minmax(130px,180px) 38px;gap:7px;align-items:center;padding:5px 12px}.review-item{min-width:0}.review-item strong{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:.88rem}.review-item small{display:block;margin-top:2px;color:#9298a2;font-size:.66rem}.review-select{width:100%;min-width:0;border:1px solid #dfe3e8;background:#f8f9fb;border-radius:10px;padding:7px 8px;color:#454c57;font-size:.76rem;outline:none}.review-select:focus{border-color:#8c929d}.review-accept{display:grid;place-items:center;width:34px;height:34px;border:0;border-radius:10px;background:#252a33;color:#fff;font-weight:900}
@media(min-width:700px){.shell{padding-left:20px;padding-right:20px}.panel-head{padding:22px 22px 16px}.add-form{padding-left:22px;padding-right:22px}.section-title{margin-left:22px;margin-right:22px}.item-row{padding-left:13px;padding-right:17px}}
@media(max-width:520px){.review-row{grid-template-columns:minmax(0,1fr) 132px 36px;padding-left:10px;padding-right:10px;gap:5px}.review-select{padding-left:6px;padding-right:4px}}
@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important;transition:none!important}}

.recovery-box{margin-top:12px;padding:13px;border-radius:13px;background:#f5f7fa;text-align:center}
.recovery-box small,.recovery-box span{display:block;color:#7f8792;font-size:.67rem;line-height:1.35}
.recovery-box strong{display:block;margin:5px 0 6px;font-size:1rem;letter-spacing:.08em;overflow-wrap:anywhere}
.recovery-copy{margin-top:10px;width:100%}
.recovery-regenerate{margin-top:8px}
.recovery-warning{margin-top:12px;padding:10px 11px;border-radius:11px;background:#fff5df;color:#7e6731;font-size:.72rem;line-height:1.35}
.recovery-form{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:7px}
.recovery-form input{min-width:0;border:1px solid #dfe3e8;background:#f8f9fb;border-radius:11px;padding:10px 9px;text-transform:uppercase;letter-spacing:.04em;font-weight:800;font-size:.72rem;outline:none}

.devices-section{margin:12px 0 14px;padding:11px 12px;border-radius:13px;background:#f7f8fa}
.devices-title{margin-bottom:8px;color:#646c77;font-size:.71rem;font-weight:900}
.devices-list{display:grid;gap:7px}
.device-row{display:grid;grid-template-columns:10px minmax(0,1fr);gap:9px;align-items:center}
.presence-dot{width:9px;height:9px;border-radius:50%;background:#a8adb5}
.presence-dot.online{background:#32a466;box-shadow:0 0 0 3px rgba(50,164,102,.10)}
.presence-dot.recent{background:#e0a736}
.presence-dot.offline{background:#b3b7bf}
.device-info{min-width:0}
.device-info strong{display:block;color:#414852;font-size:.78rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.device-info small{display:block;margin-top:1px;color:#8a9099;font-size:.65rem}
.device-own{color:#989ea7;font-size:.64rem;font-weight:700}
.devices-empty{margin:0;color:#969ca5;font-size:.7rem}

.backup-row{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:11px 12px;border-radius:12px;background:#f7f8fa}
.backup-row>div{min-width:0}
.backup-row strong{display:block;color:#414852;font-size:.78rem}
.backup-row small{display:block;margin-top:2px;color:#8a9099;font-size:.65rem;line-height:1.3}
.backup-row button{flex:0 0 auto}

.list-order{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:13px;padding:11px 12px;border:1px solid #e4e7ec;border-radius:14px;background:#f8f9fb}
.list-order>div:first-child{min-width:0}
.list-order strong{display:block;color:#555d69;font-size:.77rem}
.list-order small{display:block;margin-top:2px;color:#8b919a;font-size:.67rem}
.list-order-buttons{display:flex;gap:7px}
.order-btn{min-width:42px;padding:8px 11px;font-size:1rem}
.order-btn:disabled{opacity:.35}

.home-link:focus-visible{outline:3px solid #3b82f6;outline-offset:2px}

/* La identificación es temporal: no forma parte de la información del producto. */
.item-row.merge-origin-left{background:#e8f1ff;border-left:3px solid #3266c8;margin:1px 5px;border-radius:9px;padding-left:6px}
.item-row.merge-origin-right{background:#fff0e4;border-left:3px solid #d26924;margin:1px 5px;border-radius:9px;padding-left:6px}
.merge-legend{display:flex;align-items:center;flex-wrap:wrap;gap:8px 15px;margin:0 0 12px;padding:10px 12px;background:#fff;border:1px solid #e4e7ec;border-radius:13px;font-size:.71rem;color:#454d59}
.merge-legend span{display:inline-flex;align-items:center;gap:5px}
.origin-dot{width:11px;height:11px;border-radius:4px;display:inline-block;border:1px solid rgba(0,0,0,.1)}
.origin-dot.left{background:#3266c8}.origin-dot.right{background:#d26924}
.merge-legend .merge-neutral{color:#858c97}
.merge-clear{border:0;background:#f0f2f5;border-radius:8px;padding:5px 8px;font-size:.7rem;color:#5e6571;font-weight:700;margin-left:auto}
.share-top-link{font-size:1.25rem;font-weight:800;cursor:pointer}
.share-link-box{padding:11px;margin-top:12px;background:#f7f8fa;border-radius:12px}
.share-link-box small{display:block;color:#727b88;margin-bottom:7px}
.share-link-box input{width:100%;min-width:0;font-size:.72rem;padding:9px;border-radius:9px;border:1px solid #dfe3e8;background:white;margin-bottom:8px}
@media(max-width:420px){.top-actions{gap:4px}.home-link{width:36px;height:36px}}

/* Estado de sincronización confirmado por el servidor, distinto de la credencial guardada. */
.sync-health{display:flex;align-items:center;gap:8px;padding:9px 10px;border-radius:11px;background:#f2f4f7;font-size:.77rem;font-weight:800;color:#596271;margin-bottom:7px}
.sync-health-dot{display:inline-block;width:9px;height:9px;border-radius:50%;background:#9ca3af;flex:none}
.sync-health.ok{background:#edf8f0;color:#24613b}
.sync-health.ok .sync-health-dot{background:#2c9c56}
.sync-health.warn{background:#fff7e5;color:#8c681c}
.sync-health.warn .sync-health-dot{background:#e4a52b}
.sync-health.error{background:#fff0f0;color:#992d31}
.sync-health.error .sync-health-dot{background:#d7424c}
.sync-space-hint{display:block;font-size:.68rem;line-height:1.4;color:#8a909a;margin:2px 0 11px}
.sync-error-msg{border-left:3px solid #d7424c;padding:6px 9px;font-size:.75rem;background:#fff4f3;color:#922d31;border-radius:4px;margin:7px 0 12px}
.sync-retry{display:block;width:100%;margin:4px 0 12px}

/* Selector visible durante el alta, solo en apartados marcados como supermercado. */
.add-share-choice{grid-column:1/-1;display:inline-flex;align-items:center;gap:9px;width:fit-content;max-width:100%;min-height:30px;padding:1px 0;color:#606976;font-size:.76rem;font-weight:650;cursor:pointer;user-select:none}
.add-share-choice input{width:19px;height:19px;margin:0;flex:none;accent-color:var(--list-color);cursor:pointer}
.add-share-choice:has(input:checked){color:#303b4b}
.add-share-choice input:focus-visible{outline:3px solid #3b82f6;outline-offset:2px}

/* Categoría editable desde la ficha de cada producto del supermercado. */
.dialog .item-category-field[hidden]{display:none}
.dialog .item-category-field select{display:block;width:100%;min-height:44px;margin-top:6px;border:1px solid #dce0e6;border-radius:12px;padding:10px 12px;background:#fff;color:#20242c;outline:none}
.dialog .item-category-field select:focus-visible{outline:2px solid #4278d6;outline-offset:2px}
.dialog .item-category-field small{display:block;margin-top:7px;font-size:.69rem;font-weight:500;line-height:1.4;color:#858b95}
