.phase1-scope{display:flex;align-items:end;justify-content:space-between;gap:20px;flex-wrap:wrap;margin-bottom:24px}
.phase1-scope h2{margin:0}.phase1-scope p{margin:0;max-width:65ch}
.phase1-metrics{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:16px;margin-bottom:24px}
.phase1-metric{display:flex;flex-direction:column;align-items:start;gap:8px;padding:20px;border:1px solid var(--line);border-radius:16px;background:var(--surface)}
.phase1-metric>strong{font-size:32px;line-height:1.15;color:var(--text)}.phase1-metric>small{max-width:30ch;line-height:1.6}
.phase1-card{margin-bottom:24px}.phase1-card .phase1-metrics{margin-bottom:0}.phase1-card .phase1-metric{padding:12px;background:transparent;border:0}
.phase1-data-table{max-height:520px;overflow:auto}.phase1-data-table th{white-space:nowrap}.phase1-data-table td{font-variant-numeric:tabular-nums}
.phase1-distribution{display:grid;grid-template-columns:minmax(0,1fr) auto auto;gap:20px;padding:12px 0;border-bottom:1px solid var(--line)}
.phase1-actions{position:relative;text-align:left}.phase1-actions>summary{min-height:44px;padding:10px 12px;cursor:pointer;border:1px solid var(--line);border-radius:10px;list-style:none;white-space:nowrap}
.phase1-actions>summary::-webkit-details-marker{display:none}
.phase1-action-list[popover]{position:fixed;inset:auto;margin:0;width:min(304px,calc(100vw - 32px));max-height:min(480px,calc(100dvh - 32px));overflow:auto;padding:8px;color:var(--text);background:var(--surface-raised);border:1px solid var(--line);border-radius:14px;box-shadow:0 20px 60px #0008}
.phase1-action-list[popover]:not(:popover-open){display:none}.phase1-action-list:popover-open{display:flex;flex-direction:column;gap:4px}
.phase1-action-list>button{text-align:left;padding:10px 12px;min-height:44px;white-space:normal;color:var(--text);border-radius:8px}.phase1-action-list>button:hover{background:#c1f47712;color:var(--accent)}.phase1-action-list>button.danger{color:var(--coral)}.phase1-actions summary:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
@font-face{font-family:Manrope;src:url('assets/Manrope.woff2') format('woff2');font-style:normal;font-weight:400 800;font-display:swap}
body:not(.super-admin){font-family:Manrope,'Segoe UI',sans-serif}body:not(.super-admin) .sidebar-bottom .nav-link{display:flex;align-items:center;min-height:44px;padding:10px;color:var(--muted);font-size:12px}
@media(max-width:600px){.phase1-metrics{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.phase1-metric{padding:14px}.phase1-metric>strong{font-size:27px}.phase1-distribution{grid-template-columns:minmax(0,1fr) auto}.phase1-distribution>small{grid-column:1/-1}.phase1-actions{width:100%}body:not(.super-admin) .sidebar-bottom{flex-wrap:wrap}body:not(.super-admin) .sidebar{overflow-x:hidden}}

/* Working records: every labelled value and action stays in the available width. */
#records .table-wrap>table{table-layout:fixed;min-width:0;width:100%}
#records :is(th,td){white-space:normal;overflow-wrap:anywhere;vertical-align:top;padding:14px 12px}
#records .primary-cell{min-width:0;align-items:flex-start}
#records .primary-cell>div{min-width:0}
#records .primary-cell :is(strong,.text-button,.secondary){max-width:100%;white-space:normal;overflow-wrap:anywhere}
#records .primary-cell .text-button{text-align:left}
#records .primary-cell>.avatar{flex:none}
#records td .badge{max-width:100%;white-space:normal;overflow-wrap:anywhere;text-align:left;line-height:1.4}
#records .row-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;min-width:0}
#records .row-actions>.button{width:100%;min-width:0;min-height:44px;white-space:normal;overflow-wrap:anywhere}
#records .row-actions>.phase1-actions{grid-column:1/-1;min-width:0}
#records .row-actions>.phase1-actions>summary{min-height:44px;text-align:center}

.customer-device-row .customer-device-copy{display:flex;flex:1;flex-wrap:wrap;align-items:center;gap:.35rem .55rem;min-width:0;overflow-wrap:anywhere}
.customer-device-row .customer-device-copy small{flex-basis:100%;margin:0}
.customer-device-row .customer-device-copy .badge.off{color:var(--coral);border-color:color-mix(in srgb,var(--coral) 36%,transparent)}
.customer-device-row .row-actions{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:8px}
.customer-device-section{margin-block-end:24px}
.customer-device-section .panel-card + .detail-section-heading{margin-block-start:24px}
.customer-device-empty{margin:0;color:var(--muted)}
@media(max-width:600px){
  .customer-device-row{align-items:flex-start;flex-direction:column}
  .customer-device-row .row-actions{justify-content:flex-start;width:100%}
}
@media(hover:none),(max-width:600px){
  .customer-device-row .row-actions .button{min-width:44px;min-height:44px}
}
@media(min-width:801px){
#records[data-kind=customers] :is(th,td):nth-child(1){width:22%}
#records[data-kind=customers] :is(th,td):nth-child(2){width:12%}
#records[data-kind=customers] :is(th,td):nth-child(3){width:16%}
#records[data-kind=customers] :is(th,td):nth-child(4){width:12%}
#records[data-kind=customers] :is(th,td):nth-child(5){width:14%}
#records[data-kind=customers] :is(th,td):nth-child(6){width:24%}
#records[data-kind=agents] :is(th,td):nth-child(1){width:26%}
#records[data-kind=agents] :is(th,td):nth-child(2){width:24%}
#records[data-kind=agents] :is(th,td):nth-child(3){width:14%}
#records[data-kind=agents] :is(th,td):nth-child(4){width:12%}
#records[data-kind=agents] :is(th,td):nth-child(5){width:24%}
#records[data-kind=domains] :is(th,td):nth-child(1){width:22%}
#records[data-kind=domains] :is(th,td):nth-child(2){width:28%}
#records[data-kind=domains] :is(th,td):nth-child(3){width:14%}
#records[data-kind=domains] :is(th,td):nth-child(4){width:14%}
#records[data-kind=domains] :is(th,td):nth-child(5){width:22%}
}

/* The partner record editor uses the existing form, header, fields and footer. */
body:not(.super-admin) #editor{padding:0;max-height:calc(100dvh - 32px);overflow:hidden}
body:not(.super-admin) #editor-form{display:flex;flex-direction:column;min-height:0;max-height:calc(100dvh - 34px)}
body:not(.super-admin) #editor .dialog-header{flex:none;margin:0;padding:24px 28px 20px;border-bottom:1px solid var(--line);background:var(--surface)}
body:not(.super-admin) #editor .dialog-header>.icon-button{flex:none;min-width:44px;min-height:44px}
body:not(.super-admin) #editor-fields{flex:1;min-height:0;min-width:0;overflow:auto;align-content:start;padding:24px 28px;scroll-padding-block:20px;overscroll-behavior:contain}
body:not(.super-admin) #editor-fields>label{min-width:0}
body:not(.super-admin) #editor-fields :is(input:not([type=checkbox]),select,textarea){min-height:44px;scroll-margin-block:20px}
body:not(.super-admin) #editor-fields>.check-label{min-height:44px;align-items:center}
body:not(.super-admin) #editor-error{flex:none;margin:0}
body:not(.super-admin) #editor-error:not(:empty){padding:12px 28px}
body:not(.super-admin) #editor .dialog-actions{flex:none;margin:0;padding:16px 28px;background:var(--surface)}
body:not(.super-admin) #editor .dialog-actions>.button{min-height:44px}

#editor #close-editor{min-width:44px;min-height:44px;flex:none}
@media(max-width:800px){
  #records .primary-cell .text-button{min-width:44px;min-height:44px;display:inline-flex;align-items:center}
  #records .table-wrap{overflow:visible;background:none;border:0}
  #records .table-wrap>table{display:block;table-layout:auto;min-width:0;width:100%}
  #records thead{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
  #records tbody{display:grid;gap:16px}
  #records tbody tr{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));padding:8px;border:1px solid var(--line);border-radius:var(--radius,16px);background:var(--surface)}
  #records[data-kind] :is(th,td){display:block;width:auto;min-width:0;padding:12px 10px;border:0;white-space:normal;overflow-wrap:anywhere;font-size:14px}
  #records td[data-label]::before{content:attr(data-label);display:block;margin-bottom:6px;font-size:12px;line-height:1.5;font-weight:400;color:var(--muted)}
  #records td:first-child{grid-column:1/-1;padding-bottom:16px;border-bottom:1px solid var(--line);margin-bottom:4px}
  #records td:first-child::before{display:none}
  #records td:last-child{grid-column:1/-1;padding-top:16px;border-top:1px solid var(--line);margin-top:4px}
  #records tr:has(>.panel-empty){display:block}
  #records .panel-empty::before{display:none;content:none}
}
@media(max-width:600px){
  body:not(.super-admin) #editor .dialog-header{padding:18px 20px}
  body:not(.super-admin) #editor-fields{padding:20px}
  body:not(.super-admin) #editor-error:not(:empty){padding:12px 20px}
  body:not(.super-admin) #editor .dialog-actions{padding:14px 20px calc(14px + env(safe-area-inset-bottom));flex-wrap:wrap}
  body:not(.super-admin) #editor .dialog-actions>.button{flex:1;min-width:0}
}
