:root{color:#20364f;background:#f3f6f8}
.lock-mark{background-image:url('./icon.svg');background-size:cover;background-position:center;font-size:0}
.brand-mark{background:linear-gradient(145deg,#20364f,#315675);box-shadow:0 5px 14px #17324b24}
.brand-mark svg{width:29px;height:29px;fill:none;stroke:#fff;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.intro{margin:30px 0 20px}.intro h2{font-size:clamp(29px,4vw,38px);margin-bottom:5px}
.count{font-size:13px;font-weight:750;color:#526a80;background:#e6edf2;border-radius:999px;padding:7px 11px}
.search{border-color:#cdd9e2;border-radius:14px;padding-right:9px;box-shadow:0 2px 8px #17324b0a}.search:focus-within{border-color:#6e91ad;box-shadow:0 0 0 3px #6e91ad1f}.search input{min-height:50px}
.clear-search{border:0;background:#e9eff3;color:#536a7d;width:31px;height:31px;border-radius:50%;font-size:21px;line-height:1;flex:none}
.categories{gap:8px;padding:18px 1px 17px}.content-grid{grid-template-columns:minmax(0,1fr) 274px;gap:24px}
.sort-label{display:flex;align-items:center;gap:6px;color:#738496;font-size:13px}.section-title select{border:1px solid #d7e1e8;border-radius:9px;background:#fff;color:#40566c;padding:8px 9px}
.card{border-color:#dde6ec;border-radius:16px;padding:17px;box-shadow:0 3px 10px #193b560b;transition:transform .16s ease,box-shadow .16s ease}.card:hover{transform:translateY(-1px);box-shadow:0 7px 18px #193b5612}.card-phone{margin:13px 0 8px}.card-actions{gap:7px;margin-top:12px}
.side-card{border-color:#dde6ec;border-radius:16px;padding:19px}.side-title{display:flex;align-items:center;gap:10px;margin-bottom:7px}.side-icon{width:32px;height:32px;border-radius:10px;font-size:18px;margin:0;flex:none}
@media(max-width:600px){.app-shell{padding:0 14px 86px}.topbar{position:sticky;top:0;z-index:5;margin:0 -14px;padding:13px 14px;background:#f3f6f8e8;backdrop-filter:blur(14px);border-color:#d8e2e9}.brand h1{font-size:19px}.brand-mark{width:38px;height:38px}.brand-mark svg{width:25px}.eyebrow{font-size:10px}.intro{margin:22px 0 16px;align-items:center}.intro h2{font-size:30px}.intro p{font-size:14px;max-width:245px}.count{font-size:12px;padding:6px 9px;margin:0}.toolbar .button{min-height:43px}.categories{padding:15px 0 14px;margin-right:-14px}.chip{padding:9px 12px}.section-title{align-items:end}.sort-label span{display:none}.card{padding:15px}.card:hover{transform:none}.action{min-height:40px}}
/* Keep the later visual layer responsive; its base grid must not override the phone layout. */
.content-grid>section,.content-grid>aside,.toolbar>*{min-width:0}
.card-actions .action{min-width:0;padding:0 6px}
.section-title{gap:10px;flex-wrap:wrap}
.section-title h3{min-width:0;overflow-wrap:anywhere}
.birthday-row strong{min-width:0;overflow-wrap:anywhere}
.detail-identity>div:last-child{min-width:0;overflow-wrap:anywhere}
@media(max-width:860px){
  .content-grid{grid-template-columns:minmax(0,1fr)}
  .side{grid-template-columns:repeat(2,minmax(0,1fr))}
  .contacts{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:600px){
  .topbar{display:flex;flex-wrap:wrap;align-items:center;gap:10px}
  .brand{min-width:0;flex:1}
  .brand h1{white-space:nowrap}
  .header-actions{width:100%;display:grid;grid-template-columns:minmax(0,1fr) minmax(0,2fr);gap:8px}
  .header-actions .button{min-width:0;width:100%;min-height:42px}
  .header-actions .outline[hidden]{display:none}
  .header-actions:has(.outline[hidden]){grid-template-columns:minmax(0,1fr)}
  .content-grid{grid-template-columns:minmax(0,1fr);gap:16px}
  .contacts,.side{grid-template-columns:minmax(0,1fr)}
  .section-title{align-items:center}
  .section-title select{max-width:100%}
  .card-actions{display:grid;grid-template-columns:repeat(3,minmax(0,1fr))}
  .card-actions .action{white-space:nowrap}
  .side-card{padding:16px}
}
/* Contact selection and one-tap calling. */
.list-controls{display:flex;align-items:center;justify-content:flex-end;gap:8px;flex-wrap:wrap}
.list-controls .button{min-height:38px;padding:8px 12px;font-size:14px}
#duplicateCount{display:inline-grid;place-items:center;background:#e8eef4;border-radius:999px;min-width:22px;height:22px;margin-left:4px;padding:0 5px}
.card.is-selected{border-color:#587fa5;background:#f5f9fd}
.select-contact{appearance:none;width:26px;height:26px;border:2px solid #8198ac;border-radius:8px;background:#fff;flex:none;margin:0;cursor:pointer}
.select-contact:checked{background:#284b70;border-color:#284b70}
.select-contact:checked:after{content:'✓';display:block;text-align:center;color:white;font-weight:800;line-height:22px}
.name-button{border:0;background:none;padding:0;color:inherit;font-weight:750;text-align:left;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.name-button:hover{text-decoration:underline}
.card-actions .action{min-height:46px;font-size:15px}
.bulk-bar{position:fixed;z-index:20;left:50%;bottom:calc(12px + env(safe-area-inset-bottom));transform:translateX(-50%);width:min(1100px,calc(100% - 24px));display:flex;align-items:center;gap:9px;flex-wrap:wrap;padding:12px;background:#fff;border:1px solid #cbd9e4;border-radius:17px;box-shadow:0 12px 38px #1d3b5660}
.bulk-bar[hidden]{display:none}
.bulk-bar strong{margin-right:auto;min-width:90px}
.bulk-bar .button{min-height:42px;padding:9px 13px}
.bulk-bar .button:disabled{opacity:.48;cursor:not-allowed}
.bulk-category-label{display:flex;align-items:center;gap:7px;font-size:14px;font-weight:700}
.bulk-category-label select{min-height:42px;padding:8px;border:1px solid #cbd9e4;border-radius:9px;background:white;max-width:200px;color:#243850}
.import-category-label{display:flex;flex-direction:column;gap:8px;font-weight:700;font-size:14px;margin:16px 0}
.import-category-label select{width:100%;min-height:46px;border:1px solid #cbd9e4;border-radius:10px;padding:10px 12px;background:white;color:#243850;font:inherit}
.app-shell:has(.bulk-bar:not([hidden])){padding-bottom:160px}
.duplicates-content{padding:0 25px 24px;max-height:70vh;overflow:auto}
.duplicates-content>p{color:#5d7185;line-height:1.5;margin:4px 0 18px}
.duplicate-row{display:flex;align-items:center;justify-content:space-between;gap:14px;border-top:1px solid #e7edf1;padding:14px 0}
.duplicate-row strong,.duplicate-row small{display:block;overflow-wrap:anywhere}
.duplicate-row small{color:#718699;margin-top:3px}
.duplicate-row-actions{display:flex;gap:6px;flex-wrap:wrap}
.duplicate-row-actions .button{min-height:40px;padding:8px 11px;font-size:14px}
.duplicate-compare{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.duplicate-person{padding:15px;border:1px solid #dce6ed;border-radius:12px;min-width:0;overflow-wrap:anywhere}
.duplicate-person h3{margin:0 0 11px}
.duplicate-person p{font-size:14px;line-height:1.4}
.duplicate-person b{display:block;color:#718699;font-size:12px;text-transform:uppercase;letter-spacing:.06em}
.duplicate-person .button{white-space:normal;width:100%;min-height:48px}
@media(max-width:600px){
 .section-title{display:block}
 .section-title h3{margin-bottom:10px}
 .list-controls{justify-content:flex-start}
 .list-controls .sort-label{margin-left:auto}
 .list-controls #duplicatesBtn{order:3;width:100%}
 .bulk-bar{bottom:calc(8px + env(safe-area-inset-bottom));display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
 .bulk-bar strong{grid-column:1/2;margin:0;white-space:nowrap}
 #selectAllBtn{grid-column:2/4}
 .bulk-category-label{grid-column:1/4;justify-content:space-between}
 .bulk-category-label select{flex:1;max-width:none}
 .bulk-bar .button{min-width:0;font-size:14px;padding:8px}
 .app-shell:has(.bulk-bar:not([hidden])){padding-bottom:260px}
 .duplicate-row{display:block}
 .duplicate-row-actions{margin-top:10px}
 .duplicate-compare{grid-template-columns:1fr}
}
/* Every category stays visible; five columns make two rows on wider screens. */
.categories{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));overflow:visible;gap:9px;padding:17px 0 19px;margin:0}
.chip{display:flex;align-items:center;gap:6px;min-width:0;min-height:52px;padding:9px 11px;text-align:left;white-space:normal;border-radius:12px;line-height:1.2}
.chip .dot{flex:none;margin:0}
.chip-name{min-width:0;overflow-wrap:anywhere}
.chip-count{margin-left:auto;flex:none;font-size:13px;opacity:.78}
.card-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}
.card-actions .action{display:flex;align-items:center;justify-content:center;gap:8px;min-height:49px}
.card-actions .action svg,.detail-actions .action svg{width:19px;height:19px;flex:none}
.card-actions .action:only-child{grid-column:1/-1}
@media(max-width:860px){.categories{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media(max-width:600px){.categories{grid-template-columns:repeat(3,minmax(0,1fr));gap:7px;margin:0;padding:13px 0 16px}.chip{padding:8px;min-height:58px;font-size:13px}.chip-count{font-size:12px}.card-actions{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:350px){.categories{grid-template-columns:repeat(2,minmax(0,1fr))}}
