/* Customer aliasing screen. Uses the palette and controls from admin.css (BBB Techs branding). */
.topbar-sub { font-weight: 400; opacity: 0.8; margin-left: 8px; font-size: 14px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.al-main { max-width: 1280px; margin: 0 auto; padding: 16px 16px 72px; }
.al-intro { display: flex; flex-wrap: wrap; gap: 16px 32px; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.al-help { margin: 0; max-width: 44em; color: var(--muted); font-size: 14px; }
.al-progress { min-width: 240px; }
.al-progress-text { font-size: 14px; margin-bottom: 6px; }
.al-bar { height: 6px; border-radius: 3px; background: var(--border); overflow: hidden; }
.al-fill { height: 100%; width: 0; background: var(--navy); transition: width .25s; }
@media (prefers-color-scheme: dark) { .al-fill { background: #FFFFFF; } }

.al-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.al-filters select, .al-filters input { min-height: 36px; width: auto; font-size: 14px; }
.al-filters select { max-width: 100%; }
.al-filters input { flex: 1 1 220px; min-width: 160px; }
.al-combo input { font-size: 14px; }
.al-tabs { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; background: var(--panel); }
.al-date-filter { position: relative; z-index: 10; }
.al-date-filter summary { min-height: 36px; display: flex; align-items: center; gap: 8px; padding: 0 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--panel); color: var(--fg); font-size: 14px; cursor: pointer; list-style: none; }
.al-date-filter summary::-webkit-details-marker { display: none; }
.al-date-filter summary::after { content: "▾"; font-size: 12px; color: var(--label); }
.al-date-filter[open] summary { border-color: var(--ink); }
.al-date-options { position: absolute; top: calc(100% + 4px); left: 0; z-index: 40; min-width: 180px; max-height: 300px; overflow-y: auto; padding: 6px; background: var(--panel); border: 1px solid var(--border); border-radius: 6px; box-shadow: var(--shadow); }
.al-date-option { display: flex; align-items: center; gap: 8px; min-height: 32px; padding: 4px 8px; border-radius: 4px; color: var(--fg); font-size: 14px; cursor: pointer; white-space: nowrap; }
.al-date-option:hover { background: var(--hover); }
.al-date-option input { flex: 0 0 auto; min-height: 0; width: auto; margin: 0; }
.al-tab { appearance: none; border: 0; background: transparent; color: var(--fg); font: inherit; font-size: 14px; padding: 0 14px; min-height: 36px; cursor: pointer; }
.al-tab + .al-tab { border-left: 1px solid var(--border); }
.al-tab:hover { background: var(--hover); }
.al-tab.is-on { background: var(--navy); color: #FFFFFF; }
.al-tab:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }

.al-table { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); }
.al-row { display: grid; grid-template-columns: 110px 100px minmax(170px, 1.4fr) 100px 52px 90px 52px minmax(250px, 1.6fr); gap: 0 10px; align-items: center; padding: 8px 12px; border-top: 1px solid var(--border); font-size: 14px; }
.al-row > div { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.al-head { border-top: 0; background: var(--navy-dark); color: #FFFFFF; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; border-radius: 8px 8px 0 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.al-row .al-name { font-weight: 500; white-space: normal; }
.al-row.is-done { background: var(--hover); }
.al-row.is-saving { opacity: .6; }
.al-target { position: relative; display: flex; flex-direction: column; gap: 4px; overflow: visible !important; white-space: normal !important; }
.al-combo { display: flex; gap: 6px; align-items: center; }
.al-combo input { flex: 1; min-width: 0; min-height: 34px; }
.al-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.al-chip { appearance: none; font: inherit; font-size: 12px; border: 1px solid var(--border); background: transparent; color: var(--ink); border-radius: 12px; padding: 2px 9px; cursor: pointer; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.al-chip:hover { background: var(--hover); border-color: var(--ink); }
.al-chip small { opacity: .7; }
.al-list { position: absolute; z-index: 30; top: 38px; left: 0; right: 0; max-height: 280px; overflow-y: auto; background: var(--panel); border: 1px solid var(--ink); border-radius: 6px; box-shadow: 0 8px 24px rgba(0, 16, 51, .22); }
.al-opt { display: flex; justify-content: space-between; gap: 12px; padding: 8px 10px; cursor: pointer; font-size: 14px; }
.al-opt small { color: var(--label); white-space: nowrap; }
.al-opt.is-on, .al-opt:hover { background: var(--hover); }
.al-opt-none { padding: 8px 10px; color: var(--label); font-size: 13px; }
.al-done { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.al-done .tick { color: var(--navy); font-weight: 700; }
@media (prefers-color-scheme: dark) { .al-done .tick { color: #FFFFFF; } }
.al-done .what { font-weight: 500; }
.al-done .sub { color: var(--label); font-size: 13px; }
.al-empty { text-align: center; color: var(--label); padding: 40px 16px; }
.al-more { text-align: center; margin-top: 14px; }

@media (max-width: 900px) {
  .al-head { display: none; }
  .al-row { grid-template-columns: 1fr 1fr; gap: 4px 12px; padding: 12px; }
  .al-row > div { white-space: normal; }
  .al-row .al-name { grid-column: 1 / -1; order: -1; font-size: 15px; }
  .al-row .al-target { grid-column: 1 / -1; }
  .al-date-filter { flex: 0 1 auto; }
  .al-row [data-l]::before { content: attr(data-l) ": "; color: var(--label); }
  .num { text-align: left; }
  .al-sort-mobile { display: flex; align-items: center; gap: 6px; flex: 1 1 160px; }
  .al-sort-mobile select { flex: 1; min-width: 0; }
}

.al-admin { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; padding: 8px 10px; border: 1px dashed var(--border); border-radius: 8px; }
.al-admin-label { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--label); margin-right: 4px; }
.al-admin label.btn { display: inline-flex; align-items: center; margin: 0; cursor: pointer; font-weight: 400; }
.al-admin label.btn.is-busy { opacity: .5; cursor: progress; }
.al-import-status { flex: 1 1 100%; min-height: 1.5em; color: var(--label); font-size: 13px; }
.al-import-status.is-error { color: var(--danger); }
.al-import-status.is-success { color: var(--navy); font-weight: 600; }
@media (prefers-color-scheme: dark) { .al-import-status.is-success { color: #B8CCFF; } }


/* Live refresh feedback and accessible table sorting */
.al-header-sync { max-width: min(42vw, 430px); color: var(--label); font-size: 12px; line-height: 1.25; }
.al-header-sync.is-error { color: var(--danger); }
.al-header-sync.is-success { color: var(--navy); font-weight: 600; }
.al-customer-picker { width: auto; max-width: min(38vw, 240px); min-height: 36px; padding: 5px 28px 5px 9px; border: 1px solid rgba(255, 255, 255, .35); border-radius: 8px; background: transparent; color: #FFFFFF; font-size: 13px; }
.al-customer-picker:focus-visible { outline: 2px solid #FFFFFF; outline-offset: 2px; }
.al-customer-picker option { background: var(--panel); color: var(--fg); }
.al-refresh-icon { position: relative; width: 36px; height: 36px; padding: 0; display: inline-flex; align-items: center; justify-content: center; color: #FFFFFF; }
.al-refresh-icon svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.al-refresh-icon[aria-busy="true"] { cursor: progress; border: 0; background: transparent; box-shadow: none; color: #FFFFFF; }
.al-refresh-icon[aria-busy="true"] > svg { display: none !important; }
.al-refresh-icon[aria-busy="true"]::before { content: ""; display: block; width: 20px; height: 20px; border: 3px solid rgba(255, 255, 255, 0.86); border-right-color: transparent; border-radius: 50%; animation: al-spin .72s linear infinite; }
@media (prefers-color-scheme: dark) { .al-header-sync.is-success { color: #B8CCFF; } }
@keyframes al-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .al-refresh-icon[aria-busy="true"]::before { animation: none; border-top-color: transparent; } }

.al-sort { appearance: none; border: 0; padding: 4px 2px; width: 100%; background: transparent; color: inherit; font: inherit; font-weight: inherit; letter-spacing: inherit; text-align: left; text-transform: inherit; cursor: pointer; }
.al-sort:hover { text-decoration: underline; text-underline-offset: 3px; }
.al-sort:focus-visible { outline: 2px solid #FFFFFF; outline-offset: 1px; border-radius: 3px; }
.al-head .num .al-sort { text-align: right; }
.al-sort-mark { display: inline-block; min-width: 1em; padding-left: 2px; }
.al-sort-mobile { display: none; }
.al-not-in-list { min-width: 32px; }
.al-plus-glyph { font-size: 20px; font-weight: 400; line-height: 1; }
@media (max-width: 600px) { .al-header-sync { max-width: 120px; font-size: 11px; } }
@media (max-width: 600px) { .al-customer-picker { max-width: 42vw; font-size: 12px; } }

/* Customers tab */
.cu-row { display: grid; grid-template-columns: 32px minmax(150px, 190px) minmax(200px, 1.6fr) minmax(110px, 140px) 84px 64px 72px; gap: 0 10px; align-items: center; padding: 8px 12px; border-top: 1px solid var(--border); font-size: 14px; }
.cu-row > div { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cu-row .cu-name { font-weight: 500; white-space: normal; }
.cu-row .cu-actions { overflow: visible; white-space: normal; display: flex; flex-direction: column; gap: 6px; }
.cu-row input[type="checkbox"] { min-height: 0; width: auto; margin: 0; }
.cu-badge { display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: .03em; padding: 2px 8px; border-radius: 10px; border: 1px solid var(--ink); color: var(--ink); white-space: nowrap; }
.cu-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); }
.cu-form input { flex: 1 1 160px; min-width: 120px; min-height: 36px; font-size: 14px; }
.cu-link { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.cu-link input { width: 130px; min-height: 32px; font-size: 14px; flex: 0 0 auto; }
.cu-edit { display: flex; gap: 6px; flex-wrap: wrap; }
.cu-edit input { flex: 1 1 120px; min-width: 100px; min-height: 32px; font-size: 14px; }
.cu-aliases { grid-column: 1 / -1; overflow: visible !important; white-space: normal !important; margin: 6px 0 2px 42px; padding: 8px 10px; border-radius: 6px; background: var(--hover); font-size: 13px; }
.cu-aliases ul { margin: 0; padding-left: 18px; }
.cu-count { appearance: none; border: 0; background: transparent; color: var(--ink); font: inherit; text-decoration: underline; cursor: pointer; padding: 0; }
.cu-row.is-saving { opacity: .6; }
@media (max-width: 800px) {
  .cu-row { grid-template-columns: 28px 1fr; gap: 4px 10px; }
  .cu-row > div { white-space: normal; }
  .cu-row.al-head { display: none; }
  .cu-row .cu-actions, .cu-aliases { grid-column: 1 / -1; margin-left: 0; }
}

.cu-check { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; white-space: nowrap; }
.cu-check input { min-height: 0; width: auto; margin: 0; }
.cu-auto { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; margin-bottom: 12px; padding: 10px 12px; border: 1px solid var(--border); border-left: 3px solid var(--ink); border-radius: 8px; background: var(--panel); }
.cu-auto p { margin: 0; font-size: 14px; }
.cu-auto-actions { display: flex; gap: 6px; }
.al-filters { position: sticky; top: 0; z-index: 2; background: var(--bg, #fff); }
@keyframes cu-in { from { opacity: 0; transform: translateY(-2px); } to { opacity: 1; transform: none; } }
.cu-row:not(.al-head) { animation: cu-in .16s ease-out; }
@media (prefers-reduced-motion: reduce) { .cu-row:not(.al-head) { animation: none; } }

.al-nav { display: flex; gap: 4px; padding: 0 16px; border-bottom: 1px solid var(--border); background: var(--panel); }
.al-navtab { display: inline-flex; align-items: center; gap: 8px; padding: 12px 14px; font-size: 14px; font-weight: 600; color: var(--muted); text-decoration: none; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.al-navtab:hover { color: var(--ink); }
.al-navtab.is-on { color: var(--ink); border-bottom-color: var(--navy); }
.al-navtab:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
.al-navbadge { font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 10px; background: var(--navy); color: #FFFFFF; }
.cu-steps { margin: 8px 0 0; padding-left: 20px; font-size: 14px; color: var(--muted); max-width: 52em; }
.cu-steps li { margin: 2px 0; }
.cu-steps .btn { margin-left: 6px; }

.cu-row .cu-idcell { overflow: visible; white-space: normal; display: flex; flex-direction: column; gap: 3px; }
.cu-in { width: 100%; min-height: 32px; font: inherit; font-size: 14px; padding: 4px 8px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: inherit; text-overflow: ellipsis; }
.cu-in:hover { border-color: var(--border); }
.cu-in:focus { border-color: var(--navy); background: var(--panel); outline: none; box-shadow: 0 0 0 2px rgba(0, 30, 92, .15); }
.cu-idin { border-style: dashed; border-color: var(--border); }
.cu-idin::placeholder { color: var(--muted); }
.cu-namein { font-weight: 500; }
.cu-suggest { appearance: none; border: 0; background: transparent; color: var(--ink); font: inherit; font-size: 12px; text-align: left; padding: 0 8px; cursor: pointer; text-decoration: underline; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.cu-msg { font-size: 12px; color: var(--muted); padding: 0 8px; }
.cu-msg:empty { display: none; }
.cu-msg.is-bad { color: var(--danger); }
.cu-row .cu-icons { overflow: visible; display: flex; justify-content: flex-end; gap: 2px; }
.cu-icon { appearance: none; border: 0; background: transparent; width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; color: var(--muted); cursor: pointer; }
.cu-icon:hover { background: var(--hover); color: var(--ink); }
.cu-icon:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
.cu-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.al-dialog { border: 1px solid var(--border); border-radius: 8px; padding: 20px; width: min(440px, calc(100vw - 32px)); background: var(--panel); color: var(--fg); box-shadow: var(--shadow); }
.al-dialog::backdrop { background: rgba(0, 10, 31, .45); }
.al-dialog h2 { margin: 0 0 4px; font-size: 18px; }
.al-dialog label { display: block; margin: 12px 0 4px; font-size: 13px; font-weight: 600; }
.al-dialog input { width: 100%; min-height: 36px; font-size: 14px; }
.al-dialog-pair { display: grid; grid-template-columns: 2fr 1fr; gap: 10px; }
.al-dialog-error { margin: 10px 0 0; color: var(--danger); font-size: 13px; }
.al-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
