/* Layout, lists and record cards follow the NEXO CRM staging templates. */
:root {
    --r: 8px;
    --r-sm: 6px;
    --p-mid: #b3e4f0;
    --row-hover: #f3f6fb;
    --sb-signature-top: #183854;
    --sb-signature-mid: #20506e;
    --sb-signature-bottom: #25627a;
    --sb-signature-text: #cbd8e3;
    --sb-signature-icon: #8eadc2;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
    margin: 0;
    min-width: 0;
    background: var(--bg);
    color: var(--text);
    font: 13px/1.5 var(--font);
    -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p, dl, dd { margin: 0; }
h2, h3 { color: var(--text-strong); }
h2 { font-size: 16px; }
h3 { font-size: 13px; }
a { color: var(--p-d); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .55; }
:focus-visible { outline: 2px solid var(--p); outline-offset: 2px; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.pre-wrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.wide { width: 100%; }
.section-gap { margin-top: 16px; }
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 28px;
    padding: 4px 14px;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-sm);
    font: 600 11.5px/1.35 var(--font);
    transition: background-color .15s, border-color .15s, color .15s;
}
.button:hover { background: var(--bg); border-color: #cbd5e1; text-decoration: none; }
.button.primary { border-color: var(--p); background: var(--p); color: #fff; box-shadow: 0 2px 6px rgba(0,164,211,.22); }
.button.primary:hover { border-color: var(--p-d); background: var(--p-d); }
.button.small { min-height: 25px; padding-inline: 9px; font-size: 11px; }
.button.danger { color: #b42332; border-color: #f5cbd0; }
.button.ghost { color: var(--p-d); border-color: transparent; box-shadow: none; background: transparent; }
.icon-button {
    position: relative;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    flex: none;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--muted);
    font-size: 18px;
}
.icon-button:hover { background: var(--border2); color: var(--text); }
.icon-button svg, .sidebar nav svg, .dw-back svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* NEXO places navigation horizontally on desktop and in a drawer on phones. */
.app-shell { min-height: 100vh; }
.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    padding-right: 15px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    background: linear-gradient(90deg,var(--sb-signature-top),var(--sb-signature-mid) 56%,var(--sb-signature-bottom));
    box-shadow: 0 1px 0 rgba(15,23,42,.06), 0 8px 26px rgba(15,23,42,.035);
}
.sidebar { display: flex; flex: 1; min-width: 0; align-items: stretch; height: 100%; }
.brand, .mobile-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
}
.brand:hover, .mobile-brand:hover { text-decoration: none; }
.brand {
    margin-right: 18px;
    padding: 0 17px;
    border-right: 1px solid rgba(255,255,255,.07);
}
.wordmark { display: block; width: 111px; height: auto; }
.mobile-brand, .mobile-menu { display: none; }
.sidebar nav { display: flex; align-items: stretch; }
.sidebar nav a {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 0 12px;
    color: rgba(236,245,252,.78);
    font-size: 12px;
    font-weight: 650;
}
.sidebar nav a:hover, .sidebar nav a:focus-visible { color: #fff; background: rgba(255,255,255,.065); text-decoration: none; }
.sidebar nav a[aria-current] { color: #fff; font-weight: 760; }
.sidebar nav a[aria-current]::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 12px;
    right: 12px;
    height: 2px;
    border-radius: 2px 2px 0 0;
    background: var(--p);
}
.topbar-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 100%;
    padding-left: 8px;
    border-left: 1px solid rgba(255,255,255,.07);
}
.topbar .icon-button { color: rgba(238,247,253,.86); }
.topbar .icon-button:hover { color: #fff; background: rgba(255,255,255,.075); }
.profile-menu { position: relative; }
.profile-menu summary {
    display: flex;
    align-items: center;
    gap: 8px;
    list-style: none;
    padding: 4px 8px 4px 4px;
    border-radius: var(--r);
    color: #fff;
    cursor: pointer;
}
.profile-menu summary:hover { background: rgba(255,255,255,.075); }
.profile-menu summary::-webkit-details-marker { display: none; }
.avatar {
    display: grid;
    place-items: center;
    flex: none;
    width: 32px;
    height: 32px;
    border: 1px solid rgba(255,255,255,.22);
    border-radius: 50%;
    background: rgba(255,255,255,.10);
    color: #fff;
    font-size: 13px;
    font-weight: 750;
}
.profile-info { display: grid; min-width: 0; gap: 1px; line-height: 1.3; }
.profile-info > * { max-width: 165px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-info strong { font-size: 13px; }
.profile-info small { color: rgba(226,239,248,.76); font-size: 11px; }
.profile-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 35;
    width: 205px;
    padding: 5px 0;
    border: 1px solid var(--border);
    border-radius: var(--r);
    background: var(--surface);
    box-shadow: var(--shadow-lg);
}
.profile-dropdown a, .profile-dropdown button {
    display: block;
    width: 100%;
    padding: 8px 12px;
    border: 0;
    background: transparent;
    color: var(--text);
    text-align: left;
    text-decoration: none;
    font-size: 11.5px;
}
.profile-dropdown a:hover, .profile-dropdown button:hover { background: var(--bg); }
.notification-count {
    position: absolute;
    top: 0;
    right: 0;
    min-width: 15px;
    padding-inline: 2px;
    border: 1px solid #073454;
    border-radius: 10px;
    background: var(--p);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    line-height: 14px;
    text-align: center;
}
.demo-banner {
    padding: 4px 16px;
    background: var(--p-soft);
    border-bottom: 1px solid var(--p-mid);
    color: #256079;
    text-align: center;
    font-size: 11px;
}
#sidebar-overlay { display: none; }
#main { min-width: 0; padding: 32px 16px 20px; }
[data-page="dashboard"] #main { min-height: calc(100vh - 64px - 26px); }
[data-record-id]:not([data-record-id=""]) #main { padding: 0; }

/* CRM list header, tabs, filter toolbar and table card. */
#main:has(> .abs-admin-wrap) { padding-top: 40px; }
.abs-admin-wrap { width: 100%; min-width: 0; --row-hover: #f8fafc; }
.header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 16px;
    margin-bottom: 6px;
}
.crm-header-title { color: var(--text); font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.main-actions-group, .row-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.row-actions { justify-content: flex-end; }
.tabs-wrapper { display: flex; align-items: flex-end; border-bottom: 1px solid var(--border); margin-bottom: 10px; }
.tabs-header { display: flex; align-items: center; gap: 24px; margin-bottom: -1px; }
.tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 4px;
    border: 0;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--p-d); border-bottom-color: var(--p); font-weight: 700; }
.tab-count { padding: 1px 6px; border-radius: 12px; background: var(--border2); color: var(--muted); font-size: 9px; }
.tab-btn.active .tab-count { background: var(--p-soft); color: var(--p-d); }
.table-top-actions {
    display: flex;
    align-items: end;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 0 12px;
}
.filters label { flex: 0 1 125px; }
.filters label:first-child { flex: 0 1 260px; }
.filters :is(input,select) { height: 30px; padding-block: 0; }
.filters button { min-height: 30px; }
.panel {
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--r);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}
.panel-header, .panel-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
}
.abs-admin-wrap .main-content-card {
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}
.abs-admin-wrap .panel-footer {
    min-height: 52px;
    padding: 10px 20px;
    border: 0;
    background: transparent;
}
.panel-header { border-bottom: 1px solid var(--border); }
.panel-footer { border-top: 1px solid var(--border); color: var(--muted); font-size: 11px; }
.table-wrap { width: 100%; overflow: auto; overscroll-behavior-inline: contain; }
.abs-admin-wrap .table-wrap { scrollbar-width: thin; scrollbar-color: #b8c7d8 transparent; }
table { width: 100%; border-collapse: separate; border-spacing: 0; text-align: left; white-space: nowrap; }
th {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    border-right: 1px solid var(--border);
    background: var(--bg);
    color: var(--muted);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}
td {
    height: 40px;
    padding: 7px 12px;
    border-bottom: 1px solid var(--border2);
    background: var(--surface);
    color: var(--text);
    font-size: 11px;
    font-weight: 500;
    line-height: 1.4;
    transition: background-color .12s ease;
}
:is(th,td):first-child { padding-left: 18px; }
:is(th,td):last-child { padding-right: 18px; border-right: 0; }
td:last-child { text-align: right; }
tbody tr:hover td, tbody tr:focus-within td { background: var(--row-hover); }
tbody tr:last-child td { border-bottom: 0; }
th.chk-col, td.chk-col { width: 48px; min-width: 48px; padding-inline: 0; text-align: center; border-right: 0; }
th.action-col, td.action-col { position: relative; width: 60px; min-width: 60px; }
.catalog-action { min-width: 114px; }
.abs-admin-wrap tbody td { border-bottom-color: #e8eef3; }
table input[type="checkbox"] { display: inline-block; width: 14px; height: 14px; margin: 0; accent-color: var(--p); vertical-align: middle; }
.location-title, .record-link { color: var(--text-strong); font-size: 11.5px; font-weight: 750; }
button.record-link { display: inline; padding: 0; border: 0; background: transparent; text-align: left; }
.record-link:hover { color: var(--p-d); text-decoration: underline; }
.row-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: 1px solid transparent;
    border-radius: var(--r-sm);
    color: var(--light);
    vertical-align: middle;
}
.row-action-btn:hover, .row-action-btn:focus-visible { background: var(--border2); color: var(--text); }
.row-action-btn svg { width: 12px; height: 12px; fill: currentColor; }
.cell-meta, .meta-line { margin-top: 3px; color: var(--muted); font-size: 10px; }
.operator { display: inline-flex; align-items: center; gap: 5px; }
.operator-icon {
    display: inline-grid;
    place-items: center;
    width: 23px;
    height: 23px;
    border-radius: var(--r-sm);
    background: #e9eef8;
    color: #435d8b;
    font-size: 9px;
    font-weight: 800;
}
.op-orange { background: #fff2df; color: #92400e; }
.op-telekom { background: #fbe7f0; color: #a13166; }
.op-o2 { background: #e6f1fb; color: #235c91; }
.op-swan { background: #f0eaf9; color: #6d4e91; }
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 7px;
    border-radius: 12px;
    background: var(--border2);
    color: var(--muted);
    font-size: 10px;
    font-weight: 650;
    line-height: 1.3;
    white-space: nowrap;
}
.badge.good { background: #ecfdf5; color: #166534; }
.badge.info { background: var(--p-soft); color: #176985; }
.badge.warn { background: #fffbeb; color: #92400e; }
.badge.danger { background: #fef2f2; color: #b42332; }
.abs-admin-wrap .status-cell .badge {
    display: inline-block;
    padding: 4px 8px;
    border: 1px solid transparent;
    border-radius: 6px;
    font-weight: 800;
    line-height: 1.2;
}
.abs-admin-wrap .status-cell .badge.good { background: #dcfce7; color: #15803d; border-color: #bbf7d0; }
.abs-admin-wrap .status-cell .badge.info { background: #dbeafe; color: #1d4ed8; border-color: #bfdbfe; }
.abs-admin-wrap .status-cell .badge.warn { background: #fef9c3; color: #ca8a04; border-color: #fef08a; }
.lock { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 10px; }
.lock svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.selection-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-bottom: 1px solid var(--p-mid);
    background: var(--p-soft);
    color: #176985;
    font-size: 11px;
}
.empty {
    display: grid;
    place-content: center;
    gap: 5px;
    min-height: 240px;
    padding: 24px 20px;
    text-align: center;
}
.empty p { max-width: 430px; color: var(--muted); font-size: 12px; }

/* Lead and client details follow the NEXO record header, tabs and field rows. */
.dw-container { width: 100%; max-width: 1150px; padding: 24px 32px; font-size: 11px; line-height: 1.4; }
.dw-topbar { display: flex; align-items: center; gap: 16px; margin-bottom: 28px; }
.dw-title-area { display: flex; min-width: 0; align-items: center; gap: 16px; }
.dw-title-stack { display: grid; gap: 4px; min-width: 0; }
.dw-title-stack h1 { color: var(--text); font-size: 21px; font-weight: 800; letter-spacing: -.02em; overflow-wrap: anywhere; }
.dw-back {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    flex: none;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--surface);
    color: var(--muted);
    box-shadow: var(--shadow-sm);
}
.dw-back:hover { border-color: var(--p-mid); background: var(--p-soft); color: var(--p-d); }
.dw-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.dw-tabs { display: flex; gap: 16px; margin-bottom: 24px; border-bottom: 1px solid var(--border); }
.dw-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: -1px;
    padding: 8px 4px;
    border: 0;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: var(--muted);
    font: 600 12px/1.4 var(--font);
}
.dw-tab.on { color: var(--p); border-bottom-color: var(--p); }
.lead-title-note { color: #2f6d42; font-size: 10.5px; font-weight: 600; }
.main-grid, .inner-grid { display: grid; min-width: 0; align-items: start; gap: 16px; }
.main-grid { grid-template-columns: minmax(0,2.15fr) minmax(0,.8fr); }
.inner-grid { grid-template-columns: minmax(0,1.25fr) minmax(0,.85fr); }
.card {
    min-width: 0;
    border: 1px solid var(--border);
    border-radius: var(--r);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}
.c-hd { padding: 12px 14px 6px; }
.c-hd h2 { color: var(--p); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.c-bd { padding: 6px 14px 14px; }
.fg-row { display: flex; align-items: center; min-width: 0; gap: 8px; margin-bottom: 10px; }
.fg-row:last-child { margin-bottom: 0; }
.fg-row dt { width: 65px; flex: none; color: var(--muted); font-size: 11px; font-weight: 500; }
.fg-row .fi {
    width: 100%;
    min-width: 0;
    display: flex;
    align-items: center;
    min-height: 26px;
    padding: 0 8px;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--bg);
    color: var(--text);
    font-size: 11.5px;
    overflow-wrap: anywhere;
}
#modal-body .fg-row dt { width: 100px; }
.operator-list { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.protected-contact { color: var(--muted); }
.record-relation { margin-top: 10px; }
.record-relation .button { white-space: normal; text-align: center; }

/* Production NEXO client form has its own measured card and control sizes. */
.dw-container[data-record-kind="clients"] {
    --client-control: 30.6px;
    --client-label-width: 56.1px;
    --client-field-gap: 10.2px;
    --client-field-font: 11.9px;
    --client-label-font: 10.625px;
    width: 100%;
    max-width: 1037px;
    padding: 27.2px 25.5px 23.8px;
    font-size: 11.9px;
}
[data-record-kind="clients"] .dw-topbar { gap: 17px; margin-bottom: 20.4px; }
[data-record-kind="clients"] .dw-title-area { gap: 11.9px; }
[data-record-kind="clients"] .dw-title-stack h1 { font-size: 23.8px; font-weight: 700; line-height: 1.3; letter-spacing: -.65px; }
[data-record-kind="clients"] .dw-back { width: 22.1px; height: 30.6px; border: 0; background: none; color: #6655b7; box-shadow: none; }
[data-record-kind="clients"] .dw-back svg { width: 14.45px; height: 14.45px; }
[data-record-kind="clients"] .dw-actions { gap: 6.8px; }
[data-record-kind="clients"] .dw-actions .button { min-height: var(--client-control); padding: 0 11.9px; border-radius: 5.1px; font-size: 11.9px; }
[data-record-kind="clients"] .dw-tabs { gap: 17px; margin-bottom: 17px; }
[data-record-kind="clients"] .dw-tab { min-height: 40px; padding: 8.5px 1.7px; font-size: 13px; font-weight: 500; }
[data-record-kind="clients"] .main-grid { grid-template-columns: minmax(0,1fr) 221px; gap: 17px; }
[data-record-kind="clients"] .inner-grid { grid-template-columns: minmax(0,1.18fr) minmax(0,1fr); gap: 17px; }
[data-record-kind="clients"] .card { border-radius: 6.8px; box-shadow: 0 1px 2.55px #122c4806; }
[data-record-kind="clients"] .c-hd { padding: 14.45px 14.45px 8.5px; }
[data-record-kind="clients"] .c-hd h2 { font-size: 10.2px; font-weight: 700; letter-spacing: .04em; line-height: 1.5; }
[data-record-kind="clients"] .c-bd { padding: 4.25px 14.45px 15.3px; }
[data-record-kind="clients"] .fg-row:not(:last-child) { margin-bottom: var(--client-field-gap); }
[data-record-kind="clients"] .fg-row dt { width: var(--client-label-width); font-size: var(--client-label-font); font-weight: 400; }
[data-record-kind="clients"] .fg-row .fi { min-height: var(--client-control); padding: 0 8.5px; border-radius: 5.1px; font-size: var(--client-field-font); }

@media (min-width: 768px) {
    .abs-admin-wrap th { height: 38px; line-height: 1.5; }
    .abs-admin-wrap td { height: 40px; padding-block: 6px; vertical-align: middle; }
    .abs-admin-wrap .cell-meta { margin-top: 0; line-height: 1.1; }
    .abs-admin-wrap .chk-col { position: sticky; left: 0; z-index: 1; }
    .abs-admin-wrap .action-col { position: sticky; right: 0; z-index: 1; }
}
@media (max-width: 1599px) {
    .dw-container[data-record-kind="clients"] {
        --client-label-width: 56.95px;
        --client-label-font: 11.05px;
        padding: 29.75px 23.8px 25.5px;
    }
    [data-record-kind="clients"] :is(.c-hd,.c-bd) { padding-inline: 15.3px; }
}
@media (min-width: 1200px) {
    .dw-container[data-record-kind="clients"] { max-width: 1106px; }
    [data-record-kind="clients"] .main-grid { grid-template-columns: minmax(0,1fr) 290px; }
    [data-record-kind="clients"] .inner-grid { --client-field-gap: 5.4px; }
    [data-record-kind="clients"] .inner-grid .c-hd { padding-block: 12px 8px; }
    [data-record-kind="clients"] .inner-grid .c-bd { padding-block: 3px 13px; }
}
@media (min-width: 1200px) and (max-width: 1399px) {
    [data-record-kind="clients"] .dw-title-area { gap: 10.2px; }
    [data-record-kind="clients"] .dw-topbar { gap: 13.6px; }
    [data-record-kind="clients"] .dw-actions .button { padding-inline: 10.2px; font-size: 11.05px; }
}

/* Forms and existing Market work queues. */
label { display: block; color: var(--muted); font-size: 11px; font-weight: 600; }
input, select, textarea {
    display: block;
    width: 100%;
    min-width: 0;
    margin-top: 4px;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--surface);
    color: var(--text);
}
:is(input,select,textarea):focus { border-color: var(--p-mid); box-shadow: 0 0 0 2px var(--p-soft); }
textarea { min-height: 88px; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--light); }
.stack, .grid-2, .detail-grid, .settings-grid { display: grid; gap: 12px; }
.grid-2, .detail-grid, .settings-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
.check-label { display: flex; flex-wrap: nowrap; align-items: flex-start; gap: 8px; }
.check-label input { width: 15px; height: 15px; margin: 1px 0 0; flex: none; accent-color: var(--p); }
.form-error { color: #b42332; white-space: pre-wrap; font-size: 11px; }
.form-error:empty { display: none; }
.card-body { padding: 14px; }
.price-big { color: var(--text-strong); font-size: 28px; font-weight: 750; }
.price-big small { color: var(--muted); font-size: 11px; font-weight: 500; }
.stats { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; margin: 12px 0 16px; }
.stat {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: var(--r);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}
.stat-label, .stat-meta { color: var(--muted); font-size: 11px; }
.stat-value { font-size: 20px; font-weight: 800; }
.stat-icon { color: var(--p-d); font-size: 18px; }

dialog {
    width: min(650px,calc(100vw - 28px));
    max-height: 90vh;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--r);
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-lg);
}
dialog::backdrop { background: rgba(15,23,42,.42); }
.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 14px;
    border-bottom: 1px solid var(--border);
}
#modal-body { padding: 14px; }
.modal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.detail-field { min-width: 0; padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--bg); overflow-wrap: anywhere; }
.detail-field span { display: block; color: var(--muted); font-size: 10px; }
.detail-field strong { font-size: 11.5px; font-weight: 600; }
.detail-banner, .notice {
    padding: 9px 12px;
    border: 1px solid var(--p-mid);
    border-radius: var(--r-sm);
    background: var(--p-soft);
    color: #256079;
    font-size: 11px;
}
.detail-banner { margin-bottom: 12px; }
.notice { margin: 10px 0; }
.notice.warning { border-color: #fde68a; background: #fffbeb; color: #92400e; }
.case-steps, .link-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.message { padding: 8px 10px; margin: 8px 0; border: 1px solid var(--border); border-radius: var(--r-sm); font-size: 11.5px; }
.message.internal { background: #fffbeb; border-color: #fde68a; }
.message p { white-space: pre-wrap; overflow-wrap: anywhere; }
.message-meta { margin-top: 4px; color: var(--muted); font-size: 10px; }
.file-link {
    display: block;
    margin-top: 6px;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    font-size: 11px;
}
.result-row, .notification {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 11.5px;
}
.result-row:last-child, .notification:last-child { border-bottom: 0; }
.audit-list { padding: 0; list-style: none; }
.audit-list li { padding: 7px 0; border-bottom: 1px solid var(--border2); font-size: 11px; }
.map-view { padding: 14px; }
.geo-map { display: block; width: 100%; height: auto; max-height: 380px; margin-top: 8px; border: 1px solid var(--border); border-radius: var(--r); background: var(--bg); }
.geo-map line { stroke: var(--border); stroke-width: 1; }
.geo-map text { fill: var(--muted); font-size: 10px; }
.geo-map .marker { fill: var(--p); stroke: #fff; stroke-width: 3; cursor: pointer; }
.geo-map .marker:hover { fill: var(--p-d); }
.geo-map .marker-label { fill: var(--text); font-size: 11px; }
#toast {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 50;
    max-width: min(490px,calc(100vw - 36px));
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-left: 4px solid var(--s);
    border-radius: var(--r);
    background: var(--surface);
    box-shadow: var(--shadow-md);
    font-size: 12px;
}
#toast.error { border-left-color: var(--d); }
.loading, .error-page { display: grid; place-items: center; gap: 10px; padding: 60px 12px; color: var(--muted); text-align: center; }
.spinner { width: 18px; height: 18px; border: 2px solid var(--p-soft); border-top-color: var(--p); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Registration shares the application tokens. The login has its own source stylesheet. */
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-story {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 44px;
    background: var(--sb-bg);
    color: #fff;
}
.auth-story .wordmark { width: 132px; }
.product-tag { margin-top: 8px; color: var(--sb-signature-text); font-size: 11px; font-weight: 650; }
.auth-message { max-width: 390px; margin: auto 0; }
.auth-message h1 { margin-bottom: 12px; font-size: 38px; line-height: 1.2; }
.auth-message p { color: var(--sb-signature-text); line-height: 1.7; }
.auth-form-wrap { display: grid; place-items: center; padding: 28px; }
.auth-form-card { width: 100%; max-width: 370px; }
.auth-form-card h2 { margin-bottom: 8px; font-size: 25px; }
.auth-form-card form { margin-top: 20px; }
.auth-form-card :is(input:not([type=checkbox]),button) { min-height: 37px; }
.auth-form-card .price-note { padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--r-sm); color: var(--muted); font-size: 11px; }
.auth-switch, .back-link { display: block; margin-top: 14px; text-align: center; }

@media (min-width: 768px) and (max-width: 1199px) {
    .app-shell { margin-left: var(--sidebar-w); }
    .topbar { height: var(--topbarH); justify-content: flex-end; background: var(--surface); border-bottom-color: var(--border); }
    .topbar-actions { border-left: 0; }
    .topbar .icon-button, .profile-menu summary { color: var(--text); }
    .topbar .icon-button:hover, .profile-menu summary:hover { color: var(--text); background: var(--bg); }
    .profile-info small { color: var(--muted); }
    .avatar { border-color: var(--p-mid); background: var(--p-soft); color: var(--p-d); }
    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: var(--sidebar-w);
        height: 100vh;
        flex-direction: column;
        background: linear-gradient(180deg,var(--sb-signature-top),var(--sb-signature-mid) 56%,var(--sb-signature-bottom));
    }
    .sidebar .brand { height: 68px; margin: 0; border-right: 0; }
    .sidebar nav { flex-direction: column; padding: 7px 10px; }
    .sidebar nav a { justify-content: flex-start; padding: 11px 12px; border-radius: var(--r); }
    .sidebar nav a[aria-current] { background: rgba(255,255,255,.12); }
    .sidebar nav a[aria-current]::after { display: none; }
    .dw-container[data-record-kind="clients"] { padding: 27.2px 20.4px; }
    [data-record-kind="clients"] .dw-topbar { flex-wrap: wrap; }
    [data-record-kind="clients"] .main-grid { grid-template-columns: minmax(0,1fr); }
    [data-record-kind="clients"] .inner-grid { grid-template-columns: minmax(0,1.15fr) minmax(0,1fr); }
}
@media (min-width: 768px) and (max-width: 949px) {
    .dw-container[data-record-kind="clients"] { --client-field-font: 13.6px; --client-label-font: 11.9px; }
    [data-record-kind="clients"] .inner-grid { grid-template-columns: minmax(0,1fr); }
    [data-record-kind="clients"] .dw-title-area, [data-record-kind="clients"] .dw-actions { width: 100%; }
    [data-record-kind="clients"] .dw-actions { justify-content: flex-start; margin-left: 0; }
}
@media (max-width: 900px) {
    .dw-container[data-record-kind="leads"] { max-width: none; padding: 18px 16px 96px; }
    [data-record-kind="leads"] .dw-topbar { flex-wrap: wrap; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
    [data-record-kind="leads"] .dw-actions { justify-content: flex-start; width: 100%; margin-left: 0; padding-bottom: 2px; }
    [data-record-kind="leads"] .dw-tabs { gap: 12px; margin-bottom: 18px; padding-bottom: 1px; }
    [data-record-kind="leads"] :is(.main-grid,.inner-grid) { grid-template-columns: minmax(0,1fr); }
}

@media (max-width: 767px) {
    .topbar {
        display: grid;
        grid-template-columns: 42px minmax(0,1fr) auto;
        justify-content: initial;
        gap: 6px;
        height: 60px;
        padding: 0 10px;
        border-radius: 0 0 18px 18px;
        background: linear-gradient(90deg,#062a4a,#083a60 58%,#062d50);
        box-shadow: 0 2px 4px rgba(15,23,42,.15),0 1px 1px rgba(15,23,42,.09);
    }
    .mobile-menu { display: grid; width: 42px; height: 42px; }
    .mobile-brand { display: flex; justify-self: center; }
    .mobile-brand .wordmark { width: 90px; }
    .profile-info { display: none; }
    .profile-menu summary { padding: 2px; }
    .topbar-actions { padding-left: 0; border-left: 0; }
    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        z-index: 41;
        width: min(86vw,340px);
        height: 100dvh;
        flex-direction: column;
        background: linear-gradient(180deg,var(--sb-signature-top),var(--sb-signature-mid) 56%,var(--sb-signature-bottom));
        visibility: hidden;
        transform: translateX(-100%);
        transition: transform .2s ease;
    }
    .sidebar.open { visibility: visible; transform: translateX(0); }
    .sidebar .brand { height: 68px; margin: 0; border-right: 0; }
    .sidebar nav { flex-direction: column; padding: 7px 10px; }
    .sidebar nav a { justify-content: flex-start; min-height: 46px; padding: 10px 12px; border-radius: var(--r); }
    .sidebar nav a[aria-current] { background: rgba(255,255,255,.12); }
    .sidebar nav a[aria-current]::after { display: none; }
    #sidebar-overlay {
        position: fixed;
        inset: 0;
        z-index: 29;
        display: block;
        border: 0;
        padding: 0;
        background: rgba(15,23,42,.4);
    }
    #main { padding: 24px 16px 16px; }
    #main:has(> .abs-admin-wrap) { padding-top: 32px; }
    .filters label, .filters label:first-child { flex: 1 1 calc(50% - 8px); }
    .dw-container[data-record-kind="clients"] {
        --client-label-width: 57.8px;
        --client-field-font: 12.75px;
        max-width: none;
        padding: 22.95px 13.6px;
    }
    [data-record-kind="clients"] .dw-topbar { flex-wrap: wrap; align-items: stretch; gap: 17.85px; margin-bottom: 18.7px; }
    [data-record-kind="clients"] .dw-title-area { width: 100%; gap: 9.35px; }
    [data-record-kind="clients"] .dw-title-stack h1 { font-size: 21.25px; line-height: 1.35; }
    [data-record-kind="clients"] .dw-back { width: 15.3px; }
    [data-record-kind="clients"] .dw-back svg { width: 11.9px; height: 11.9px; }
    [data-record-kind="clients"] .dw-actions { justify-content: flex-start; width: 100%; gap: 5.95px; margin-left: 0; }
    [data-record-kind="clients"] .dw-actions .button { min-height: 33.15px; padding-inline: 8.5px; font-size: 10.2px; }
    [data-record-kind="clients"] .dw-tabs { gap: 19.55px; margin-bottom: 18.7px; }
    [data-record-kind="clients"] .dw-tab { padding: 8.5px 0; }
    [data-record-kind="clients"] :is(.main-grid,.inner-grid) { grid-template-columns: minmax(0,1fr); }
    [data-record-kind="clients"] .c-hd { padding-block: 16.15px 9.35px; }
    [data-record-kind="clients"] .c-hd h2 { font-size: 11.05px; }
    [data-record-kind="clients"] .c-bd { padding-block: 5.1px 17.85px; }
    .settings-grid { grid-template-columns: 1fr; gap: 10px; }
    .stats { gap: 6px; }
    .stat { padding: 7px; }
    .stat-icon { display: none; }
    .auth-shell { display: block; }
    .auth-story { display: none; }
    .auth-form-wrap { min-height: 100vh; padding: 24px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
