:root{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;color:#173b2a;background:#edf3ed;font-synthesis:none;color-scheme:light;--green:#17683f;--muted:#586a5d;--line:#d9e5da}
*{box-sizing:border-box}body{margin:0}a{color:inherit}button,input{font:inherit}button,a,input{-webkit-tap-highlight-color:transparent}button{cursor:pointer}button:focus-visible,a:focus-visible,input:focus-visible{outline:3px solid #976021;outline-offset:4px}::selection{background:#c4e3c6}[hidden]{display:none!important}.sr-only,.skip:not(:focus){position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}.skip:focus{display:block;padding:16px;background:white}.app-shell{max-width:820px;min-height:100svh;margin:0 auto;background:#f8faf6}.header{padding:calc(28px + env(safe-area-inset-top)) 24px 22px;background:#e9f2e7;border-bottom:1px solid #d6e4d5}.brand{display:flex;align-items:center;gap:12px;text-decoration:none;width:fit-content}.brand img{object-fit:contain;flex-shrink:0}.brand>span{font-weight:750;font-size:28px;letter-spacing:-1px;line-height:1.1}.brand .plus{color:#16813b}.brand small{display:block;font-weight:450;font-size:13px;color:#4c6453;letter-spacing:.1px;margin-top:6px}.search{display:flex;align-items:center;gap:12px;background:#fff;border:1px solid #c6d8c9;border-radius:14px;margin-top:24px;padding:0 15px;min-height:52px}.search svg{width:21px;height:21px;fill:none;stroke:#39734d;stroke-width:1.8;flex-shrink:0}.search input{border:0;outline:0!important;min-width:0;width:100%;height:50px;font-size:16px;background:transparent;color:#173b2a}.search:focus-within{outline:2px solid #17683f;outline-offset:2px}.search input::placeholder{color:#607468;opacity:1}.search input::-webkit-search-cancel-button{display:none}.search button{border:0;background:transparent;font-size:25px;color:#41644d;width:40px;height:44px;flex-shrink:0}main{padding:26px 24px 16px}.section-heading{display:flex;justify-content:space-between;gap:12px;align-items:baseline;margin-bottom:18px}.section-heading h1{font-size:25px;font-weight:700;letter-spacing:-.6px;margin:0}.section-heading>span{color:var(--muted);font-size:12px}.categories{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}.category{position:relative;display:flex;flex-direction:column;align-items:flex-start;min-height:151px;padding:20px 17px 17px;border-radius:20px;background:white;border:1px solid var(--line);text-decoration:none;transition:background .15s ease,transform .15s ease}.category:hover{background:#f0f7ed}.category:active{transform:scale(.98)}.category svg{width:34px;height:34px;fill:none;stroke:var(--green);stroke-width:1.65;stroke-linecap:round;stroke-linejoin:round;margin-bottom:19px}.category strong{font-size:16px;line-height:1.25;letter-spacing:-.2px;font-weight:650;max-width:100%;overflow-wrap:break-word}.category small{font-size:12px;color:var(--muted);margin-top:7px;line-height:1.4}.category .arrow{position:absolute;top:18px;right:17px;font-size:19px;font-weight:400;color:#758b78}.search-status{color:var(--muted);font-size:14px;margin:0 0 16px}.empty-search{padding:28px 0;line-height:1.6}.empty-search h2{font-size:20px}.empty-search button{background:white;border:1px solid #9ebba4;border-radius:12px;padding:12px 16px;color:var(--green);min-height:48px}.back{display:inline-flex;align-items:center;gap:9px;min-height:44px;font-size:14px;text-decoration:none;color:var(--green);margin-bottom:26px}.detail-icon svg{width:54px;height:54px;fill:none;stroke:var(--green);stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round}#categoryTitle{font-size:30px;letter-spacing:-.7px;margin:18px 0 12px}.detail-description{line-height:1.6;color:#4c6453;max-width:46ch}.category-placeholder{border-top:1px solid var(--line);margin-top:32px;padding-top:24px;max-width:55ch}.category-placeholder h2{font-size:19px}.category-placeholder p{font-size:15px;line-height:1.7;color:var(--muted)}footer{font-size:12px;color:#5b705f;text-align:center;padding:18px 24px calc(24px + env(safe-area-inset-bottom));line-height:1.5}a{text-underline-offset:3px}@media(min-width:650px){.header{padding-left:40px;padding-right:40px}main{padding:32px 40px}.category{min-height:172px;padding:23px}.category strong{font-size:19px}.category small{font-size:14px}.section-heading>span{font-size:14px}}@media(max-width:350px){.header{padding-left:18px;padding-right:18px}main{padding:24px 18px}.section-heading{display:block}.section-heading>span{display:block;margin-top:7px}.category{padding:17px 13px;min-height:151px}.category strong{font-size:15px}.categories{gap:10px}}@media(prefers-reduced-motion:reduce){.category{transition:none}.category:active{transform:none}}

/* Compra habitual — controles táctiles y orden por sección. */
#shoppingTitle{font-size:28px;letter-spacing:-.7px;margin:0 0 8px}.muted{color:var(--muted);font-size:14px;line-height:1.6}.provisional{font-size:13px;line-height:1.5;padding:12px 14px;background:#edf4e9;border-radius:10px;color:#405b39}.shopping-toolbar{position:sticky;top:0;background:#f8faf6;padding:8px 0 12px;z-index:2;border-bottom:1px solid var(--line)}#shoppingCount{font-size:14px;font-weight:600;margin:4px 0 12px}.shopping-actions{display:flex;gap:8px;margin-bottom:12px}.shopping-actions button{flex:1}.list-actions{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:24px}.list-actions button:first-child{grid-column:1/-1}#shoppingView button,dialog button{min-height:44px;border:1px solid #b0c5b5;border-radius:10px;padding:10px 12px;background:white;color:#245c3b;font-size:14px;font-weight:600}#shoppingView button.green-button,dialog button.green-button{background:#17683f;color:white;border-color:#17683f}#shoppingView button:disabled,dialog button:disabled{opacity:.4;cursor:default}#productSearch{width:100%;font-size:16px;min-height:46px;background:white;border:1px solid #c6d8c9;border-radius:10px;padding:10px 14px;color:#173b2a}#shoppingMessage{font-size:14px;line-height:1.5;color:#245b3c;overflow-wrap:anywhere}#shoppingMessage:empty{display:none}#shoppingMessage.shopping-error,#productError{color:#8d2f22}.shop-heading{display:flex;align-items:baseline;justify-content:space-between;margin:26px 0 14px;gap:8px}.shop-heading h2{font-size:23px;margin:0}.shop-heading>span{font-size:13px;color:#586a5d}.shopping-section{margin-bottom:12px;border:1px solid var(--line);border-radius:14px;background:white;overflow:hidden}.shopping-section summary{display:flex;align-items:center;gap:12px;justify-content:space-between;padding:16px;min-height:54px;font-size:15px;font-weight:650;cursor:pointer;list-style:none}.shopping-section summary::-webkit-details-marker{display:none}.shopping-section summary:before{content:'›';color:#39734d;font-size:22px}.shopping-section details[open]>summary:before{transform:rotate(90deg)}.shopping-section summary>span:first-of-type{flex:1}.section-count{font-size:12px;color:#566c5a;white-space:nowrap;font-variant-numeric:tabular-nums}.group-label{font-size:12px;color:#667467;margin:0;padding:8px 16px;background:#f4f7f0}.shopping-row{display:flex;gap:6px;align-items:center;flex-wrap:wrap;padding:5px 10px 5px 14px;min-height:58px;border-top:1px solid #edf1e9}.shopping-row>label{display:flex;align-items:center;gap:12px;flex:1;min-width:0;cursor:pointer;min-height:48px}.shopping-row input[type=checkbox]{width:26px;height:26px;margin:0;flex-shrink:0;accent-color:#17683f}.product-words{min-width:0;flex:1}.product-name{display:block;font-size:16px;line-height:1.4;overflow-wrap:anywhere}.product-words small{display:block;font-size:12px;color:#657567;line-height:1.5;white-space:pre-wrap;overflow-wrap:anywhere}.shopping-row>button{border:0!important;background:transparent!important;padding:8px!important;flex-shrink:0;font-size:12px!important}.product-order{display:flex;gap:6px;margin-left:38px;width:100%;padding-bottom:8px}.product-order button{min-width:44px}.section-order{display:flex;align-items:center;gap:8px;padding:8px 12px;background:#eef4e9}.section-order span{flex:1;font-size:12px}.section-order button{width:44px}dialog{max-width:calc(100% - 32px);width:450px;max-height:85svh;overflow:auto;border:1px solid #b0c5b5;border-radius:16px;padding:24px;color:#173b2a;background:white}dialog::backdrop{background:#142f224d}dialog h2{font-size:22px;line-height:1.3;margin:0 0 16px}dialog p{font-size:14px;line-height:1.6}dialog label{display:block;font-size:14px;font-weight:600;margin:16px 0 7px}dialog input,dialog select,dialog textarea{font:inherit;font-size:16px;width:100%;border:1px solid #b0c5b5;border-radius:9px;padding:11px;color:#173b2a;background:white;min-height:46px}.dialog-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:20px}.danger{color:#8d2f22!important}#productError:empty{display:none}.shopping-footnote{margin-top:16px;font-size:12px}@media(max-width:350px){#shoppingView button{padding:9px 10px;font-size:13px}.shopping-row{padding-left:10px}.shopping-row label{gap:8px}} 
body.shopping .header{padding-top:calc(16px + env(safe-area-inset-top));padding-bottom:16px}body.shopping .brand img{width:44px;height:43px}body.shopping .brand>span{font-size:24px}body.shopping .brand small,body.shopping .header .search{display:none}body.shopping main{padding-top:16px}#shoppingView>.back{margin-bottom:12px}.shop:first-child .shop-heading{margin-top:20px}
#shoppingTitle:focus,#categoryTitle:focus{outline:none}

/* 016: cabecera fija por sección; solo se pliegan los artículos no necesarios. */
.shopping-section-heading{display:flex;align-items:center;gap:12px;justify-content:space-between;padding:16px;min-height:54px;font-size:15px;font-weight:650}.shopping-section-heading>span:first-child{flex:1}.shopping-unneeded>summary{font-size:13px;font-weight:500;background:#f4f7f0}.shopping-unneeded{border-top:1px solid #edf1e9}

/* P13: resultados agrupados sin cambiar la identidad existente. */
.history-search{display:flex;align-items:center;gap:10px;min-height:44px;margin-top:8px;font-size:14px}.history-search input{width:22px;height:22px;accent-color:var(--green)}.global-category{margin:20px 0;overflow-wrap:anywhere}.global-category h2{font-size:21px}.global-list{background:white;border:1px solid var(--line);border-radius:12px;padding:12px 16px;margin:10px 0}.global-list h3{font-size:17px;margin:0}.global-list a,.global-category h2 a{display:inline-block;padding:10px 0;min-height:44px}.global-list ul{padding-left:20px}.global-list li{margin:12px 0}.global-list p{white-space:pre-wrap;font-size:14px;line-height:1.5;margin:5px 0}.global-list span{font-size:13px;color:var(--muted)}
body.shopping .history-search,body.tasks .history-search,body.camping .history-search,body.travel .history-search,body.planned .history-search,body.leisure .history-search{display:none}

/* P02: controles funcionales de Mis listas. */
.personal-view button,.personal-view a,#personalEntry{min-height:44px;display:inline-flex;align-items:center;padding:10px;margin:4px 4px 4px 0}.personal-view input[type=search]{width:100%;min-height:44px;font-size:16px}.personal-view .shopping-row p{white-space:pre-wrap;overflow-wrap:anywhere;width:100%}.personal-view h1,.personal-view h2,.personal-view h3{overflow-wrap:anywhere}#personalCards{display:flex;flex-direction:column;gap:8px}.personal-view summary{min-height:44px;padding:12px;cursor:pointer}
.personal-view .shopping-row span{overflow-wrap:anywhere;min-width:0}

/* P04: controles de secciones adaptados a pantallas estrechas. */
.shopping-actions{flex-wrap:wrap}.shopping-actions button{flex:1 1 140px}.section-order{flex-wrap:wrap}.section-order .section-rename{width:auto}

.shopping-section-heading>span:first-child{min-width:0;overflow-wrap:anywhere}

.section-order .section-delete{width:auto}#sectionDeleteTitle,#sectionDeleteExplanation{overflow-wrap:anywhere}

#sectionDestination{width:100%;min-width:0;max-width:100%}

.category-management-row,.additional-list{display:flex;flex-wrap:wrap;gap:8px;align-items:center;padding:12px;border-bottom:1px solid #c6d8c9}.category-management-row strong{flex:1;overflow-wrap:anywhere}.additional-list a{font-size:18px;overflow-wrap:anywhere}.additional-list p{width:100%}#additionalCategoryControls{display:flex;flex-wrap:wrap;gap:8px}#categoryManager{width:600px}#categoryManager button,#additionalCategoryView button{min-height:44px}#additionalCategoryView h1,#categoryDeleteTitle,#protectedCategories{overflow-wrap:anywhere}#categoryMoveDialog select,#categoryDeleteDialog select{width:100%;min-width:0;max-width:100%}.additional-category{overflow-wrap:anywhere}

.original-order-row,.list-order-row{display:flex;flex-wrap:wrap;align-items:center;gap:8px;padding:8px;border-bottom:1px solid #c6d8c9}.original-order-row strong,.list-order-row strong{flex:1;min-width:120px;overflow-wrap:anywhere}#listOrderCategory{width:100%;min-width:0}#productDuplicates button{min-height:44px;white-space:normal}#productDuplicates{overflow-wrap:anywhere}
