/* 04.55.2 r6 — Elegant Contacts, visual-only overlay.
   All record identity, branch security, edit/merge confirmation and event handling
   are provided by the frozen r4 view/controller. This file adds no new actions. */
.contacts-shell,.customer-record-shell,.contact-global-panel{
  --ct-ink:var(--ui-ink,#273750);--ct-muted:var(--ui-muted,#75839a);
  --ct-line:color-mix(in srgb,var(--ui-line,#e1e8f2) 82%,#bdceeb);
  --ct-blue:#5877db;--ct-purple:#8d6acb;--ct-teal:#168f93;
  --ct-amber:#bf8332;--ct-red:#ce5368;--ct-green:#278864;
  --ct-shadow:0 10px 28px rgba(42,73,121,.065);
  font-family:Inter,'Segoe UI',system-ui,sans-serif;color:var(--ct-ink);
}
.contacts-shell .tw-main,.customer-record-shell .cw-record-main{background:var(--ui-bg)}
/* Contact navigation: existing clickable tabs/filters preserved */
.contacts-shell .tw-sidebar{background:color-mix(in srgb,var(--ui-surface) 90%,#edf2ff);border-right:1px solid var(--ct-line)}
.contacts-shell .tw-sidebar>header{min-height:71px;gap:10px;font-weight:780;color:var(--ct-ink);border-bottom-color:var(--ct-line)}
.contacts-shell .tw-sidebar>header>.ui-icon{width:32px;height:32px;padding:7px;flex:none;border-radius:11px;color:var(--ct-purple);background:color-mix(in srgb,var(--ui-surface) 47%,#e9e0fc);box-shadow:0 4px 14px #896dc01c}
.contacts-shell .tw-nav-item{min-height:40px;margin:3px 0;border-radius:10px;font-weight:670;color:var(--ct-muted);transition:background-color .15s,color .15s}
.contacts-shell .tw-nav-item .ui-icon{color:var(--ct-blue)}
.contacts-shell .tw-nav-item[data-value=blocked] .ui-icon{color:var(--ct-red)}
.contacts-shell .tw-nav-item[data-value=unread] .ui-icon{color:var(--ct-teal)}
.contacts-shell .tw-nav-item[data-value=opportunities] .ui-icon{color:var(--ct-purple)}
.contacts-shell .tw-nav-item[data-value=tasks] .ui-icon{color:var(--ct-amber)}
.contacts-shell .tw-nav-item.active{background:color-mix(in srgb,var(--ui-surface) 62%,#dfe9ff);color:var(--ct-blue);box-shadow:inset 3px 0 var(--ct-blue)}
.contacts-shell .tw-sidebar-note{border-color:var(--ct-line);line-height:1.65}
.contacts-shell .tw-sidebar-note strong{color:var(--ct-ink)}
/* The primary directory heading and controls */
.contacts-shell .tw-head,.customer-record-shell .cw-record-head{
  height:auto;min-height:98px;padding:18px clamp(16px,2.4vw,36px);
  background:radial-gradient(ellipse 35% 180% at 87% -25%,color-mix(in srgb,#b8acf0 20%,transparent),transparent),
  linear-gradient(107deg,color-mix(in srgb,var(--ui-surface) 77%,#e7efff),color-mix(in srgb,var(--ui-surface) 91%,#f5eaff));
  border-bottom:1px solid var(--ct-line);gap:15px;
}
.contacts-shell .tw-head .eyebrow{font-size:10px;font-weight:790;letter-spacing:.16em;color:var(--ct-blue)}
.contacts-shell .tw-head h1{display:flex;align-items:center;gap:12px;font-size:clamp(23px,2.1vw,29px);font-weight:810;letter-spacing:-.7px}
.contacts-shell .tw-head h1:before,.customer-record-shell .cw-record-head h1:before{
 content:"";width:39px;height:39px;display:inline-block;flex:none;border-radius:13px;border:1px solid #d7c6f5;
 background:#f1eafd url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238364c6' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='18' height='18' rx='3'/%3E%3Ccircle cx='12' cy='10' r='3'/%3E%3Cpath d='M6.5 18c0-2.6 2.1-4.2 5.5-4.2s5.5 1.6 5.5 4.2'/%3E%3C/svg%3E") center/23px no-repeat;
 box-shadow:0 5px 15px #8267ca14;
}
.contacts-shell .tw-head-actions :is(select,.icon-button),.customer-record-shell .cw-record-tools button{border-radius:11px;border:1px solid var(--ct-line);background:var(--ui-surface);box-shadow:0 3px 11px #4967ad0a}
.contacts-shell .cw-scroll{padding:24px clamp(16px,2.4vw,36px);background:radial-gradient(ellipse 47% 24% at 95% 0%,#7f90e50a,transparent),var(--ui-bg)}
/* Three attention summary cards: inherit real counts and current filter actions */
.contacts-shell .tw-kpis{gap:12px}
.contacts-shell .tw-kpi{--ct-stat:var(--ct-blue);border-radius:15px;border:1px solid var(--ct-line);border-top:3px solid var(--ct-stat);padding:19px 18px;background:linear-gradient(125deg,color-mix(in srgb,var(--ui-surface) 91%,var(--ct-stat)),var(--ui-surface) 79%);box-shadow:var(--ct-shadow);transition:transform .15s,box-shadow .15s}
.contacts-shell .tw-kpi:nth-child(1){--ct-stat:var(--ct-teal)}
.contacts-shell .tw-kpi:nth-child(2){--ct-stat:var(--ct-purple)}
.contacts-shell .tw-kpi:nth-child(3){--ct-stat:var(--ct-amber)}
.contacts-shell .tw-kpi>span{font-weight:690;font-size:11px;color:var(--ct-ink)}
.contacts-shell .tw-kpi .ui-icon{color:var(--ct-stat);background:color-mix(in srgb,var(--ct-stat) 12%,var(--ui-surface));width:30px;height:30px;padding:7px;border-radius:10px}
.contacts-shell .tw-kpi strong{color:var(--ct-stat);font-size:30px;font-weight:800;font-variant-numeric:tabular-nums}
.contacts-shell .tw-kpi.selected{border-color:var(--ct-stat);box-shadow:0 0 0 2px color-mix(in srgb,var(--ct-stat) 15%,transparent)}
.contacts-shell .tw-kpi:hover:not(:disabled){transform:translateY(-2px);box-shadow:0 12px 26px #5367a21a}
.contacts-shell .tw-scope{border-left:3px solid #93a9e1;border-radius:0 10px 10px 0;padding:10px 12px;background:color-mix(in srgb,var(--ui-surface) 75%,#edf3ff);color:var(--ct-muted);line-height:1.6}
.contacts-shell .tw-filters{border:1px solid var(--ct-line);border-radius:15px;padding:16px;background:var(--ui-surface);box-shadow:var(--ct-shadow);gap:12px}
.contacts-shell .tw-filter>span:first-child{font-size:10px;font-weight:730;color:var(--ct-muted)}
.contacts-shell .tw-filter select,.contacts-shell .tw-search-box,.contacts-shell .tw-search-box input{border-radius:10px}
.contacts-shell .tw-filter select:focus-visible,.contacts-shell .tw-search-box input:focus-visible{outline:3px solid color-mix(in srgb,var(--ct-blue) 31%,transparent);outline-offset:1px}
.contacts-shell .tw-results-head{color:var(--ct-muted);font-size:11px}
.contacts-shell .tw-results-head strong{color:var(--ct-blue)}
/* Contact directory table and mobile cards */
.contacts-shell .cw-table{border-radius:15px;border-color:var(--ct-line);box-shadow:var(--ct-shadow);overflow:hidden}
.contacts-shell .cw-table th{background:color-mix(in srgb,var(--ui-surface) 51%,#e7eeff);padding:13px 11px;color:var(--ct-muted);font-weight:770;letter-spacing:.035em}
.contacts-shell .cw-table td{border-top:1px solid var(--ct-line);padding:15px 11px}
.contacts-shell .cw-table tbody tr:hover{background:color-mix(in srgb,var(--ui-surface) 83%,#edf3ff)}
.contacts-shell .cw-person strong,.customer-record-shell .cw-person strong{font-weight:780;color:var(--ct-ink)}
.contacts-shell .cw-avatar,.customer-record-shell .cw-avatar,.contact-global-panel .cw-avatar{border-radius:12px;background:color-mix(in srgb,var(--ui-surface) 54%,#e0e8fd);border:1px solid #c9d7f7;color:var(--ct-blue);font-weight:820}
.contacts-shell .cw-person-button:hover strong{color:var(--ct-blue)}
.contacts-shell .cw-primary-detail{font-weight:650;color:var(--ct-ink)}
.contacts-shell .cw-channel{gap:7px}
.contacts-shell .cw-channel-icon{width:17px;height:17px;border-radius:6px;padding:2px;background:color-mix(in srgb,var(--ui-surface) 57%,#e5efff)}
.contacts-shell .cw-channel[title*=Messenger] .cw-channel-icon{color:#4679e9;background:#e9efff}
.contacts-shell .cw-channel[title*=Instagram] .cw-channel-icon{color:#c450a4;background:#fcebf5}
.contacts-shell .cw-channel[title*=WhatsApp] .cw-channel-icon{color:#22a974;background:#e4f8ed}
.contacts-shell .cw-work{gap:7px}
.contacts-shell .cw-work>span{font-weight:550}
.contacts-shell .cw-chip,.customer-record-shell .cw-chip{border-radius:999px;padding:4px 9px;font-weight:650}
.contacts-shell .cw-chip[data-kind=lead]{background:color-mix(in srgb,var(--ui-surface) 35%,#e5e9ff);color:#5265bc}
.contacts-shell .cw-chip[data-kind=blocked],.contacts-shell .cw-chip[data-kind=overdue]{background:color-mix(in srgb,var(--ui-surface) 30%,#ffe6ec);border-color:#f1c5ce;color:#ae4257}
.contacts-shell .cw-mobile-card{border-radius:15px;border-color:var(--ct-line);box-shadow:var(--ct-shadow);background:var(--ui-surface)}
.contacts-shell .cw-mobile-card .cw-person strong{font-size:13px}
.contacts-shell .tw-empty{border:1px dashed var(--ct-line);border-radius:16px;padding:36px 16px;background:var(--ui-surface)}
/* Golden customer record: no duplicate identity, no changes to management actions */
.customer-record-shell .cw-record-head h1{display:flex;align-items:center;gap:11px;font-weight:820;letter-spacing:-.65px}
.customer-record-shell .cw-record-head .cw-breadcrumb{font-weight:630}
.customer-record-shell .cw-record-scroll{background:radial-gradient(ellipse 55% 28% at 97% 0%,#8d82e40a,transparent),var(--ui-bg)}
.customer-record-shell .cw-record-content .cw-detail{border:1px solid var(--ct-line);border-radius:17px;box-shadow:var(--ct-shadow);background:var(--ui-surface)}
.customer-record-shell .cw-detail-hero{padding:5px 0 16px;border-bottom:1px solid var(--ct-line)}
.customer-record-shell .cw-detail-hero .cw-avatar{border-radius:16px}
.customer-record-shell .cw-detail-check{color:var(--ct-muted);font-size:11px}
.customer-record-shell .cw-detail-kpis{gap:10px}
.customer-record-shell .cw-detail-kpis button{--ct-kpi:var(--ct-blue);border:1px solid var(--ct-line);border-top:3px solid var(--ct-kpi);border-radius:12px;background:linear-gradient(130deg,color-mix(in srgb,var(--ui-surface) 91%,var(--ct-kpi)),var(--ui-surface));box-shadow:0 5px 16px #3e5fa10b;transition:transform .15s}
.customer-record-shell .cw-detail-kpis button:nth-child(2){--ct-kpi:var(--ct-purple)}
.customer-record-shell .cw-detail-kpis button:nth-child(3){--ct-kpi:var(--ct-teal)}
.customer-record-shell .cw-detail-kpis button:nth-child(4){--ct-kpi:var(--ct-amber)}
.customer-record-shell .cw-detail-kpis button strong{color:var(--ct-kpi);font-weight:800}
.customer-record-shell .cw-detail-kpis button span{font-weight:660}
.customer-record-shell .cw-detail-kpis button:hover:not(:disabled){transform:translateY(-2px)}
.customer-record-shell .cw-tabs{border-bottom:1px solid var(--ct-line);gap:7px}
.customer-record-shell .cw-tabs button{border-radius:10px 10px 0 0;font-weight:670;color:var(--ct-muted)}
.customer-record-shell .cw-tabs button.selected{color:var(--ct-blue);background:color-mix(in srgb,var(--ui-surface) 65%,#dfeaff);border-bottom:3px solid var(--ct-blue);font-weight:800}
.customer-record-shell .cw-info-grid{border-color:var(--ct-line);border-radius:13px;background:color-mix(in srgb,var(--ui-surface) 75%,#edf3ff)}
.customer-record-shell :is(.cw-manage-card,.cw-profile-section,.cw-related-card){border:1px solid var(--ct-line);border-radius:13px;background:var(--ui-surface);box-shadow:0 5px 19px #36589b0b}
.customer-record-shell .cw-manage-card header,.customer-record-shell .cw-profile-section h3{color:var(--ct-ink);font-weight:790}
.customer-record-shell .cw-manage-card .eyebrow{font-size:10px;font-weight:810;letter-spacing:.14em;color:var(--ct-purple)}
.customer-record-shell .cw-details-card{border-top:3px solid var(--ct-blue)}
.customer-record-shell .cw-channels-card{border-top:3px solid var(--ct-teal)}
.customer-record-shell .cw-tags-card{border-top:3px solid var(--ct-purple)}
.customer-record-shell .cw-identities-card{border-top:3px solid var(--ct-amber)}
.customer-record-shell .cw-task-card{border-top:3px solid var(--ct-green)}
.customer-record-shell .cw-duplicates-card{border-top:3px solid var(--ct-red)}
.customer-record-shell .cw-related-card{border-left:3px solid color-mix(in srgb,var(--ct-purple) 35%,var(--ct-line))}
.customer-record-shell .cw-section-head{color:var(--ct-purple);font-weight:740}
.customer-record-shell .cw-detail-foot{border-color:var(--ct-line)}
/* Existing management forms, warning and merge protections stay conspicuous */
.customer-record-shell :is(.cw-edit-form,.cw-confirm-box),.contact-global-panel :is(.cw-edit-form,.cw-confirm-box){background:color-mix(in srgb,var(--ui-surface) 86%,#eef3ff);border:1px solid var(--ct-line);border-radius:12px;padding:15px}
.customer-record-shell .cw-confirm-box.danger,.contact-global-panel .cw-confirm-box.danger{border-color:#e9a6af;background:color-mix(in srgb,var(--ui-surface) 85%,#ffe0e6)}
.customer-record-shell .cw-management-state.warning{border-color:#e0b866;background:color-mix(in srgb,var(--ui-surface) 85%,#fff0d0)}
.contact-global-panel{border-color:var(--ct-line);box-shadow:0 16px 55px #17284936}
.contact-global-panel .action-dialog-head{background:linear-gradient(110deg,color-mix(in srgb,var(--ui-surface) 76%,#e8edff),color-mix(in srgb,var(--ui-surface) 88%,#f4edff));border-bottom-color:var(--ct-line)}
.contact-global-panel .action-dialog-head h2{font-weight:800;color:var(--ct-ink)}
.contacts-shell :is(.tw-kpi,.cw-person-button,.tw-nav-item,.cw-mobile-card button):focus-visible,
.customer-record-shell :is(.cw-tabs button,.cw-detail-kpis button,.cw-record-tools button):focus-visible,
.contact-global-panel button:focus-visible{outline:3px solid #8da9f1;outline-offset:2px}
@media(max-width:1100px){.contacts-shell .tw-head,.customer-record-shell .cw-record-head{padding:16px 19px}.contacts-shell .cw-scroll{padding:19px}.contacts-shell .tw-kpi{padding:14px 12px}}
@media(max-width:800px){.contacts-shell .tw-head h1{font-size:22px}.contacts-shell .tw-head h1:before,.customer-record-shell .cw-record-head h1:before{width:34px;height:34px;background-size:20px}.contacts-shell .tw-filters{padding:12px}.contacts-shell .tw-kpis{gap:8px}.contacts-shell .cw-mobile-card{margin-bottom:12px}.customer-record-shell .cw-detail-kpis{gap:7px}.customer-record-shell .cw-record-scroll{padding:15px 12px}}
@media(max-width:480px){.contacts-shell .cw-scroll{padding:12px}.contacts-shell .tw-head{min-height:82px;padding:12px;gap:7px}.contacts-shell .tw-head h1{font-size:20px}.contacts-shell .tw-kpi strong{font-size:23px}.contacts-shell .tw-kpi>span{font-size:10px}.contacts-shell .tw-kpi .ui-icon{width:25px;height:25px}.customer-record-shell .cw-record-head h1{font-size:20px}.customer-record-shell .cw-record-content .cw-detail{padding:15px 13px}.customer-record-shell .cw-detail-kpis button{padding:11px 7px}.customer-record-shell .cw-detail-kpis button strong{font-size:19px}.customer-record-shell .cw-tabs button{padding:10px 6px}}
:root[data-theme=dark] .contacts-shell,:root[data-theme=dark] .customer-record-shell,:root[data-theme=dark] .contact-global-panel{--ct-line:#3b475b;--ct-shadow:0 8px 24px #0004}
:root[data-theme=dark] .contacts-shell .tw-head,:root[data-theme=dark] .customer-record-shell .cw-record-head,:root[data-theme=dark] .contact-global-panel .action-dialog-head{background:linear-gradient(110deg,#243653,#28273f 86%)}
:root[data-theme=dark] .contacts-shell .tw-sidebar{background:color-mix(in srgb,var(--ui-surface) 90%,#293956)}
:root[data-theme=dark] .contacts-shell .tw-kpi,:root[data-theme=dark] .customer-record-shell .cw-detail-kpis button{background:linear-gradient(130deg,color-mix(in srgb,var(--ui-surface) 88%,var(--ct-stat,var(--ct-kpi))),var(--ui-surface) 85%)}
:root[data-theme=dark] .contacts-shell .tw-kpi strong{color:color-mix(in srgb,var(--ct-stat) 62%,#fff)}
:root[data-theme=dark] .customer-record-shell .cw-detail-kpis button strong{color:color-mix(in srgb,var(--ct-kpi) 60%,#fff)}
:root[data-theme=dark] .contacts-shell .cw-chip[data-kind=lead]{background:#343c65;color:#b9caff}
:root[data-theme=dark] .contacts-shell .cw-chip[data-kind=blocked],:root[data-theme=dark] .contacts-shell .cw-chip[data-kind=overdue]{background:#512e3a;color:#ffc5d1;border-color:#874757}
:root[data-theme=dark] .contacts-shell .cw-channel[title*=Messenger] .cw-channel-icon{background:#2d3f72;color:#9bbaff}
:root[data-theme=dark] .contacts-shell .cw-channel[title*=Instagram] .cw-channel-icon{background:#4b2f52;color:#f1a4dc}
:root[data-theme=dark] .contacts-shell .cw-channel[title*=WhatsApp] .cw-channel-icon{background:#234c42;color:#a2efd1}
:root[data-theme=dark] .contacts-shell .tw-nav-item.active,:root[data-theme=dark] .customer-record-shell .cw-tabs button.selected{background:#304365;color:#b5c8ff}
:root[data-theme=dark] .customer-record-shell .cw-info-grid,:root[data-theme=dark] .contacts-shell .tw-scope{background:color-mix(in srgb,var(--ui-surface) 90%,#3c5384)}
:root[data-theme=dark] .customer-record-shell .cw-edit-form,:root[data-theme=dark] .contact-global-panel .cw-edit-form{background:var(--ui-surface)}
@media(prefers-reduced-motion:reduce){.contacts-shell .tw-kpi,.contacts-shell .tw-nav-item,.customer-record-shell .cw-detail-kpis button{transition:none!important}.contacts-shell .tw-kpi:hover,.customer-record-shell .cw-detail-kpis button:hover{transform:none!important}}
:root[data-theme=dark] .contacts-shell .cw-table th{background:#26334b;color:#b9c8df}
:root[data-theme=dark] .contacts-shell .cw-table tbody tr:hover{background:color-mix(in srgb,var(--ui-surface) 81%,#354b72)}
:root[data-theme=dark] .contacts-shell .tw-head .eyebrow{color:#9fbaff}
:root[data-theme=dark] .contacts-shell .tw-kpi>span{color:var(--ui-ink)}
:root[data-theme=dark] .contacts-shell .cw-avatar,:root[data-theme=dark] .customer-record-shell .cw-avatar{background:#293e60;color:#b7cbff;border-color:#516b9f}
:root[data-theme=dark] .customer-record-shell .cw-related-card{background:var(--ui-surface)}
