:root {
    color-scheme: light;
    --ink: #18212f;
    --muted: #657083;
    --line: #dce2ea;
    --surface: #ffffff;
    --canvas: #f4f6f9;
    --brand: #174ea6;
    --brand-dark: #103b7d;
    --danger-bg: #fff1f1;
    --danger: #9b2525;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 0; background: var(--canvas); }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--canvas); }
button, input, select { font: inherit; }

.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    place-items: center;
    padding: 32px 16px;
}

.auth-card, .welcome-card {
    width: min(100%, 460px);
    min-width: 0;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 16px 45px rgba(25, 38, 58, .08);
    padding: clamp(24px, 5vw, 42px);
}

.auth-card p { overflow-wrap: anywhere; }

.brand-mark {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 11px;
    background: var(--brand);
    color: white;
    font-weight: 750;
    letter-spacing: -.02em;
    margin-bottom: 28px;
}

.eyebrow { margin: 0 0 8px; color: var(--brand); font-size: .78rem; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(1.85rem, 6vw, 2.35rem); line-height: 1.12; letter-spacing: -.035em; }
.intro, .muted { color: var(--muted); line-height: 1.6; }
.intro { margin: 12px 0 30px; }
.welcome { margin: 22px 0 4px; font-size: 1.08rem; }

label { display: block; margin: 20px 0 8px; font-weight: 650; font-size: .92rem; }
input {
    width: 100%;
    min-height: 48px;
    padding: 11px 13px;
    color: var(--ink);
    border: 1px solid #b9c2cf;
    border-radius: 9px;
    background: #fff;
}
input:focus { outline: 3px solid rgba(23, 78, 166, .18); border-color: var(--brand); }
button {
    min-height: 46px;
    border: 0;
    border-radius: 9px;
    padding: 10px 18px;
    cursor: pointer;
    background: var(--brand);
    color: #fff;
    font-weight: 700;
}
button:hover { background: var(--brand-dark); }
.auth-card form > button { width: 100%; margin-top: 28px; }
.alert { padding: 12px 14px; border: 1px solid #efb7b7; border-radius: 9px; background: var(--danger-bg); color: var(--danger); line-height: 1.45; font-size: .92rem; }

.topbar {
    min-height: 68px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 10px clamp(16px, 5vw, 64px);
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}
.wordmark { color: var(--ink); text-decoration: none; font-weight: 800; letter-spacing: -.02em; }
.topbar form { margin: 0; }
.button-secondary { min-height: 46px; display: inline-flex; align-items: center; justify-content: center; padding: 10px 18px; border: 1px solid #cbd4df; border-radius: 9px; background: #eef2f7; color: var(--ink); font-weight: 700; text-decoration: none; }
.button-secondary:hover { background: #e1e7ef; }
.button-danger { background: #a33a35; }
.button-danger:hover { background: #842e2a; }
.page-shell { padding: clamp(28px, 7vw, 84px) 16px; }
.welcome-card { margin: 0 auto; width: min(100%, 720px); }

@media (max-width: 374px) {
    .auth-shell { padding: 16px 10px; }
    .auth-card, .welcome-card { border-radius: 12px; padding: 22px 18px; }
    .topbar { align-items: stretch; flex-direction: column; padding: 14px 16px; }
    .topbar form, .topbar button { width: 100%; }
}

/* Internal portal */
.portal-body { background: #f5f7fa; }
.portal-shell { min-height: 100vh; min-width: 0; }
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 10;
    width: 248px;
    display: flex;
    flex-direction: column;
    padding: 24px 16px 18px;
    background: #111c2d;
    color: #dfe7f3;
}
.portal-brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; font-size: 1.08rem; font-weight: 800; }
.brand-mark-small { width: 38px; height: 38px; margin: 0; border-radius: 9px; font-size: .82rem; flex: 0 0 auto; }
.sidebar-nav { display: grid; gap: 5px; margin-top: 38px; }
.nav-link { min-width: 0; display: flex; align-items: center; gap: 11px; padding: 11px 12px; border-radius: 9px; color: #bdc9d9; text-decoration: none; font-size: .92rem; font-weight: 650; }
.nav-link:hover, .nav-link.is-active { color: #fff; background: rgba(255,255,255,.1); }
.nav-link.is-disabled { cursor: default; opacity: .55; }
.nav-link small { margin-left: auto; font-size: .65rem; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; }
.nav-dot { width: 7px; height: 7px; flex: 0 0 auto; border: 1.5px solid currentColor; border-radius: 50%; }
.nav-link.is-active .nav-dot { border-color: #62a3ff; background: #62a3ff; }
.sidebar-account { display: grid; grid-template-columns: 38px minmax(0,1fr) 34px; align-items: center; gap: 10px; margin-top: auto; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.12); }
.avatar { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: #2d4260; color: white; font-weight: 800; }
.account-copy { min-width: 0; display: grid; gap: 2px; }
.account-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .84rem; }
.account-copy small { color: #9baabc; font-size: .73rem; }
.sidebar-account form { margin: 0; }
.logout-button { width: 34px; min-height: 34px; padding: 0; background: transparent; color: #bdc9d9; font-size: 1.2rem; }
.logout-button:hover { background: rgba(255,255,255,.1); }
.mobile-header { display: none; }
.portal-main { min-width: 0; margin-left: 248px; padding: 42px clamp(24px, 4vw, 64px) 72px; }
.portal-main > * { width: min(100%, 1380px); margin-inline: auto; }

.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; margin-bottom: 34px; }
.page-heading h1 { font-size: clamp(2rem, 4vw, 2.8rem); }
.page-intro { max-width: 700px; margin: 10px 0 0; color: var(--muted); line-height: 1.6; }
.page-heading-list { align-items: center; }
.result-count { flex: 0 0 auto; display: grid; min-width: 96px; padding: 13px 18px; border: 1px solid var(--line); border-radius: 12px; background: #fff; text-align: center; }
.result-count strong { font-size: 1.45rem; }
.result-count span { color: var(--muted); font-size: .75rem; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin: 0 0 14px; }
.section-heading h2 { margin: 0; font-size: 1.15rem; letter-spacing: -.015em; }
.section-heading p { margin: 5px 0 0; color: var(--muted); font-size: .88rem; }
.section-note { padding: 5px 9px; border-radius: 999px; background: #e9eef5; color: #566477; font-size: .72rem; font-weight: 700; }
.dashboard-section { margin-top: 38px; }

.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.metric-card { position: relative; min-width: 0; display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; padding: 19px 20px; overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: #fff; color: var(--ink); text-decoration: none; box-shadow: 0 5px 16px rgba(25,38,58,.035); }
.metric-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: #8793a5; }
.metric-card > span { align-self: center; font-size: .84rem; font-weight: 700; color: #465468; }
.metric-card > strong { grid-row: 1 / 3; grid-column: 2; align-self: center; font-size: 2rem; letter-spacing: -.04em; }
.metric-card > small { color: var(--muted); font-size: .72rem; }
.metric-card:hover { border-color: #b9c6d8; box-shadow: 0 9px 24px rgba(25,38,58,.07); }
.metric-new::before { background: #2b6cb0; }
.metric-contact-attempt::before { background: #8b6b28; }
.metric-callback::before { background: #7657a6; }
.metric-qualified::before { background: #2d7a5a; }
.metric-rejected::before { background: #8a5260; }
.metric-unassigned::before { background: #53647b; }

.panel { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: 0 5px 18px rgba(25,38,58,.035); }
.table-wrap { min-width: 0; overflow-x: auto; }
.lead-table { width: 100%; border-collapse: collapse; font-size: .83rem; }
.lead-table th { padding: 12px 15px; background: #f7f9fb; color: #657083; font-size: .7rem; text-align: left; text-transform: uppercase; letter-spacing: .055em; white-space: nowrap; }
.lead-table td { max-width: 260px; padding: 14px 15px; border-top: 1px solid #edf0f4; vertical-align: middle; }
.lead-table tbody tr:hover { background: #fafbfd; }
.contact-cell { min-width: 170px; overflow-wrap: anywhere; font-weight: 650; }
.price-cell { white-space: nowrap; font-variant-numeric: tabular-nums; }
.status-badge { display: inline-flex; align-items: center; min-height: 25px; padding: 3px 8px; border-radius: 999px; font-size: .7rem; font-weight: 750; white-space: nowrap; }
.status-new { background: #e8f1fb; color: #245b93; }
.status-contact-attempt { background: #f6f0e2; color: #76591d; }
.status-callback { background: #f0eafa; color: #684b91; }
.status-qualified { background: #e5f3ec; color: #276348; }
.status-rejected { background: #f4e9ec; color: #784552; }
.empty-state { display: grid; place-items: center; gap: 6px; min-height: 150px; padding: 28px; text-align: center; }
.empty-state span { color: var(--muted); font-size: .88rem; }

.callback-list { padding: 0 18px; }
.callback-row { display: grid; grid-template-columns: 150px 70px minmax(170px,1.5fr) minmax(130px,1fr) minmax(140px,1fr); gap: 18px; align-items: center; padding: 16px 4px; border-bottom: 1px solid #edf0f4; }
.callback-row:last-child { border-bottom: 0; }
.callback-row > div { min-width: 0; display: grid; gap: 3px; }
.callback-row small { color: var(--muted); font-size: .69rem; text-transform: uppercase; letter-spacing: .04em; }
.callback-row strong { overflow-wrap: anywhere; font-size: .82rem; }
.callback-time span { width: fit-content; padding: 3px 7px; border-radius: 999px; background: #edf2f7; color: #546276; font-size: .65rem; font-weight: 800; text-transform: uppercase; }
.callback-row.is-overdue { margin-inline: -18px; padding-inline: 22px; background: #fff8f7; }
.callback-row.is-overdue .callback-time span { background: #f9dfdc; color: #9a3f35; }

.callback-filter { max-width: 680px; display: grid; gap: 7px; margin: 0 0 28px; padding: 16px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.callback-filter label { color: #566477; font-size: .73rem; font-weight: 750; }
.callback-filter > div { display: flex; gap: 9px; }
.callback-filter select { min-width: 220px; min-height: 43px; padding: 9px 11px; border: 1px solid #bcc6d3; border-radius: 8px; background: #fff; color: var(--ink); }
.callback-filter .button-secondary { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.callback-groups { display: grid; gap: 32px; }
.callback-group-today .section-heading h2 { color: #203b66; }
.callback-group-overdue .section-heading h2 { color: #8b423c; }
.callback-worklist { padding: 0 18px; }
.callback-work-item { min-width: 0; display: grid; grid-template-columns: 118px 68px minmax(170px,1.5fr) minmax(120px,.8fr) 92px auto; gap: 16px; align-items: center; padding: 17px 4px; border-bottom: 1px solid #edf0f4; }
.callback-work-item.has-assignee { grid-template-columns: 118px 68px minmax(170px,1.5fr) minmax(120px,.8fr) 92px minmax(120px,.8fr) auto; }
.callback-work-item:last-child { border-bottom: 0; }
.callback-work-item > div { min-width: 0; display: grid; gap: 4px; }
.callback-work-item small { color: var(--muted); font-size: .66rem; font-weight: 700; letter-spacing: .045em; text-transform: uppercase; }
.callback-work-item strong, .callback-phone { overflow-wrap: anywhere; }
.callback-work-time time { display: grid; gap: 2px; }
.callback-work-time strong { font-size: .88rem; }
.callback-work-time span { color: var(--muted); font-size: .78rem; font-weight: 700; }
.callback-work-contact strong { font-size: .86rem; }
.callback-phone { width: fit-content; color: var(--brand); font-size: .78rem; text-decoration: none; }
.callback-phone:hover { text-decoration: underline; }
.callback-open { white-space: nowrap; color: var(--brand); font-size: .78rem; font-weight: 750; text-decoration: none; }
.callback-open:hover { text-decoration: underline; }
.callback-work-item.is-overdue { margin-inline: -18px; padding-inline: 22px; background: #fff8f7; border-color: #f3dedb; }
.callback-empty { margin-top: 12px; }

.deletion-request-list { display: grid; gap: 16px; }
.deletion-request-item { padding: 20px; }
.deletion-request-summary { display: grid; grid-template-columns: 80px minmax(160px,1.25fr) minmax(190px,1.35fr) minmax(130px,.8fr) minmax(150px,.9fr); gap: 18px; }
.deletion-request-summary > div { min-width: 0; display: grid; gap: 4px; }
.deletion-request-summary small, .deletion-request-comment small { color: var(--muted); font-size: .67rem; font-weight: 750; letter-spacing: .045em; text-transform: uppercase; }
.deletion-request-summary strong { overflow-wrap: anywhere; font-size: .84rem; }
.deletion-request-comment { margin-top: 16px; padding-top: 15px; border-top: 1px solid #edf0f4; }
.deletion-request-comment p { margin: 6px 0 0; overflow-wrap: anywhere; line-height: 1.55; }
.deletion-request-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; margin-top: 18px; }
.deletion-request-actions form { margin: 0; }
.deletion-confirm { position: relative; }
.deletion-confirm > summary { min-height: 46px; display: inline-flex; align-items: center; padding: 10px 18px; border: 1px solid #d9a6a2; border-radius: 9px; color: #8d302c; cursor: pointer; font-weight: 700; list-style: none; }
.deletion-confirm > summary::-webkit-details-marker { display: none; }
.deletion-confirm[open] > summary { background: #fff4f3; }
.deletion-confirm > div { max-width: 620px; margin-top: 12px; padding: 18px; border: 1px solid #edc3c0; border-radius: 11px; background: #fff8f7; }
.deletion-confirm p { overflow-wrap: anywhere; line-height: 1.55; }
.deletion-confirm form { display: grid; gap: 14px; }
.deletion-confirm form > div { display: flex; flex-wrap: wrap; gap: 9px; }
.confirmation-check { display: flex; align-items: flex-start; gap: 9px; margin: 0; font-size: .86rem; }
.confirmation-check input { flex: 0 0 auto; width: 18px; min-height: 18px; margin: 1px 0 0; }

.filter-stack { display: grid; gap: 10px; margin-bottom: 18px; }
.search-panel, .filter-panel { display: grid; align-items: end; gap: 12px; padding: 15px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.search-panel { grid-template-columns: minmax(220px, 1fr) auto auto; }
.filter-panel { grid-template-columns: repeat(3, minmax(150px, 1fr)) auto; }
.filter-panel:has(#assigned) { grid-template-columns: repeat(3, minmax(140px, 1fr)) minmax(150px,1fr) auto; }
.search-panel label, .filter-panel label { display: block; margin: 0 0 6px; color: #566477; font-size: .73rem; font-weight: 750; }
.search-panel input, .filter-panel select { width: 100%; min-height: 43px; padding: 9px 11px; border: 1px solid #bcc6d3; border-radius: 8px; background: #fff; color: var(--ink); }
.filter-actions { display: flex; align-items: center; gap: 12px; }
.filter-panel button, .search-panel button { min-height: 43px; }
.text-link { color: var(--brand); font-size: .82rem; font-weight: 700; text-decoration: none; }
.text-link:hover { text-decoration: underline; }
.list-panel { overflow: visible; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 15px; border-top: 1px solid var(--line); color: var(--muted); font-size: .8rem; }
.pagination div { display: flex; gap: 8px; }
.pagination a { padding: 7px 11px; border: 1px solid var(--line); border-radius: 7px; color: var(--ink); text-decoration: none; font-weight: 700; }
.forbidden { max-width: 680px; padding: 42px; border: 1px solid var(--line); border-radius: 15px; background: #fff; }
.forbidden p:last-child { color: var(--muted); line-height: 1.6; }
.full-width { width: 100%; }
.lead-link { color: var(--ink); text-decoration-color: #a9b5c5; text-underline-offset: 3px; }
.lead-link:hover { color: var(--brand); text-decoration-color: currentColor; }

/* Lead detail */
.detail-page { min-width: 0; }
.back-link { display: inline-block; margin-bottom: 18px; color: var(--brand); font-size: .84rem; font-weight: 750; text-decoration: none; }
.back-link:hover { text-decoration: underline; }
.detail-alert { margin-bottom: 18px; padding: 12px 14px; border: 1px solid; border-radius: 10px; font-size: .9rem; }
.detail-alert.is-success { border-color: #add4c0; background: #edf8f2; color: #245f43; }
.detail-alert.is-error { border-color: #efb7b7; background: var(--danger-bg); color: var(--danger); }
.deletion-request-card.is-pending { border-color: #d8c8a5; background: #fffdf8; }
.deletion-request-details { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 0 26px; margin: 0 0 16px; }
.deletion-request-details div { min-width: 0; padding: 11px 0; border-top: 1px solid #eee7d8; }
.deletion-request-details dt { color: var(--muted); font-size: .7rem; font-weight: 750; letter-spacing: .045em; text-transform: uppercase; }
.deletion-request-details dd { margin: 5px 0 0; overflow-wrap: anywhere; line-height: 1.5; }
.deletion-request-form-wrap summary { width: fit-content; padding: 10px 15px; border: 1px solid #cbd4df; border-radius: 9px; background: #eef2f7; cursor: pointer; font-weight: 700; list-style: none; }
.deletion-request-form-wrap summary::-webkit-details-marker { display: none; }
.deletion-request-form { max-width: 680px; display: grid; gap: 8px; margin-top: 16px; padding: 18px; border: 1px solid #dce3eb; border-radius: 11px; background: #f9fafc; }
.deletion-request-form label { margin: 7px 0 0; color: #4b596c; font-size: .76rem; font-weight: 750; }
.deletion-request-form select, .deletion-request-form textarea { width: 100%; min-width: 0; padding: 9px 11px; border: 1px solid #bcc6d3; border-radius: 8px; background: #fff; color: var(--ink); font: inherit; }
.deletion-request-form select { min-height: 43px; }
.deletion-request-form textarea { resize: vertical; line-height: 1.5; }
.deletion-request-form small { color: var(--muted); line-height: 1.45; }
.deletion-request-form button { width: fit-content; margin-top: 7px; }
.detail-hero { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 18px 28px; align-items: start; margin-bottom: 20px; padding: clamp(22px,3vw,34px); border: 1px solid var(--line); border-radius: 15px; background: #fff; box-shadow: 0 5px 18px rgba(25,38,58,.035); }
.detail-hero h1 { margin: 2px 0 0; font-size: clamp(1.65rem,3vw,2.35rem); }
.detail-subtitle { margin: 8px 0 0; color: var(--muted); overflow-wrap: anywhere; }
.detail-hero > .status-badge { margin-top: 4px; }
.hero-facts { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; margin: 0; padding-top: 20px; border-top: 1px solid var(--line); }
.hero-facts div { min-width: 0; }
.hero-facts dt, .detail-list dt, .structured-list dt { color: var(--muted); font-size: .7rem; font-weight: 750; letter-spacing: .045em; text-transform: uppercase; }
.hero-facts dd { margin: 5px 0 0; overflow-wrap: anywhere; font-size: .9rem; font-weight: 700; }
.detail-columns { display: grid; grid-template-columns: minmax(0,1.65fr) minmax(300px,.75fr); gap: 20px; align-items: start; }
.detail-primary, .detail-secondary { min-width: 0; display: grid; gap: 20px; }
.detail-card { min-width: 0; padding: clamp(20px,2.5vw,28px); border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: 0 5px 18px rgba(25,38,58,.03); }
.detail-card h2 { margin: 0 0 20px; font-size: 1.08rem; }
.detail-list, .structured-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 0 28px; margin: 0; }
.calculator-answers { grid-template-columns: minmax(0,1fr); max-width: 780px; }
.detail-list div, .structured-list div { min-width: 0; padding: 12px 0; border-top: 1px solid #edf0f4; }
.detail-list dd, .structured-list dd { margin: 5px 0 0; overflow-wrap: anywhere; line-height: 1.5; }
.detail-list a { color: var(--brand); }
.structured-list.compact { margin-top: 18px; }
.structured-list .is-unknown { border-left: 3px solid #d9e0e9; padding-left: 12px; }
.value-list, .result-list { display: grid; gap: 7px; margin: 0; padding-left: 19px; }
.value-list li, .result-list li { overflow-wrap: anywhere; line-height: 1.5; }
.result-notice { margin: 8px 0 0; color: var(--muted); font-size: .82rem; }
.result-block { margin-top: 24px; padding-top: 20px; border-top: 1px solid #edf0f4; }
.result-block h3, .service-grid h3 { margin: 0 0 11px; font-size: .86rem; }
.result-list { color: #445268; font-size: .84rem; }
.result-list.is-positive li::marker { color: #2d7a5a; }
.service-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 24px; margin-top: 24px; padding-top: 20px; border-top: 1px solid #edf0f4; }
.price-highlight { margin: 0; color: #203b66; font-size: clamp(1.6rem,3vw,2.25rem); font-weight: 800; letter-spacing: -.035em; }
.quiet-note, .muted-copy { color: var(--muted); font-size: .82rem; line-height: 1.55; }
.description-copy { overflow-wrap: anywhere; line-height: 1.72; white-space: normal; }
.break-anywhere { overflow-wrap: anywhere; word-break: break-word; }
.edit-card { position: sticky; top: 20px; }
.edit-form { display: grid; gap: 9px; margin: 0; padding: 18px 0; border-top: 1px solid #edf0f4; }
.edit-form:first-of-type { padding-top: 0; border-top: 0; }
.edit-form label, .note-form > label, .date-time-grid label { color: #4b596c; font-size: .76rem; font-weight: 750; }
.edit-form select, .edit-form input, .note-form textarea { width: 100%; min-width: 0; min-height: 43px; padding: 9px 11px; border: 1px solid #bcc6d3; border-radius: 8px; background: #fff; color: var(--ink); font: inherit; }
.inline-control { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; }
.inline-control button { min-height: 43px; padding-inline: 13px; }
.edit-form fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.edit-form legend { margin-bottom: 9px; color: #4b596c; font-size: .76rem; font-weight: 750; }
.date-time-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,.75fr); gap: 8px; }
.date-time-grid label { min-width: 0; display: grid; gap: 6px; }
.remove-form { display: grid; gap: 8px; margin: -10px 0 0; }
.remove-form label { color: #4b596c; font-size: .76rem; font-weight: 750; }
.remove-form select { width: 100%; min-width: 0; min-height: 43px; padding: 9px 11px; border: 1px solid #bcc6d3; border-radius: 8px; background: #fff; color: var(--ink); font: inherit; }
.detail-wide { margin-top: 20px; }
.note-form { display: grid; gap: 9px; margin: 0 0 24px; padding: 16px; border: 1px solid #dce3eb; border-radius: 11px; background: #f9fafc; }
.note-form textarea { resize: vertical; line-height: 1.55; }
.note-form > div { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.note-form small { color: var(--muted); }
.timeline { display: grid; gap: 0; }
.timeline article { min-width: 0; padding: 16px 0; border-top: 1px solid #edf0f4; }
.timeline-meta { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.timeline-meta strong { overflow-wrap: anywhere; font-size: .86rem; }
.timeline-meta time { flex: 0 0 auto; color: var(--muted); font-size: .74rem; }
.timeline article p { margin: 8px 0 0; overflow-wrap: anywhere; line-height: 1.6; }
.technical-details summary { cursor: pointer; font-weight: 750; }
.technical-details[open] summary { margin-bottom: 20px; }
.technical-list { margin-top: 0; }

@media (max-width: 1180px) {
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .filter-panel, .filter-panel:has(#assigned) { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .filter-actions { align-self: end; min-height: 43px; }
    .callback-row { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .callback-row > div:last-child { display: grid; }
    .callback-work-item, .callback-work-item.has-assignee { grid-template-columns: repeat(3, minmax(0,1fr)); }
    .deletion-request-summary { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .detail-columns { grid-template-columns: 1fr; }
    .edit-card { position: static; }
}

@media (max-width: 899px) {
    .sidebar { display: none; }
    .portal-main { margin-left: 0; padding: 32px 20px 60px; }
    .mobile-header { position: relative; z-index: 20; min-height: 66px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 20px; border-bottom: 1px solid var(--line); background: #111c2d; color: #fff; }
    .mobile-menu { position: relative; }
    .mobile-menu summary { cursor: pointer; list-style: none; padding: 9px 13px; border: 1px solid rgba(255,255,255,.25); border-radius: 8px; font-size: .84rem; font-weight: 750; }
    .mobile-menu summary::-webkit-details-marker { display: none; }
    .mobile-menu[open] { position: static; }
    .mobile-menu[open] > nav, .mobile-menu[open] > .mobile-account, .mobile-menu[open] > form { display: block; }
    .mobile-menu nav, .mobile-account, .mobile-menu > form { display: none; position: absolute; left: 12px; right: 12px; background: #18263a; }
    .mobile-menu nav { top: 66px; padding: 12px 12px 4px; }
    .mobile-account { top: 284px; padding: 12px 24px; border-top: 1px solid rgba(255,255,255,.1); color: #fff; }
    .mobile-account strong, .mobile-account small { display: block; }
    .mobile-account small { margin-top: 3px; color: #aebcce; }
    .mobile-menu > form { top: 344px; padding: 4px 24px 18px; border-radius: 0 0 12px 12px; }
    .role-admin .mobile-account { top: 328px; }
    .role-admin .mobile-menu > form { top: 388px; }
    .callback-row { grid-template-columns: 135px 60px minmax(150px,1fr) minmax(120px,1fr); }
}

@media (max-width: 1180px) {
    .portal-main { padding: 26px 14px 50px; }
    .page-heading { align-items: flex-start; margin-bottom: 26px; }
    .page-heading-list { flex-direction: column; }
    .result-count { display: flex; align-items: baseline; gap: 6px; min-width: 0; padding: 8px 12px; }
    .result-count strong { font-size: 1.1rem; }
    .metric-grid { grid-template-columns: 1fr; gap: 10px; }
    .metric-card { padding: 16px 17px; }
    .section-heading { align-items: flex-start; }
    .search-panel, .filter-panel, .filter-panel:has(#assigned) { grid-template-columns: 1fr; }
    .search-panel .button-secondary { order: 3; }
    .filter-actions { flex-wrap: wrap; }
    .list-panel, .panel { border-radius: 11px; }
    .table-wrap { overflow: visible; }
    .lead-table, .lead-table tbody, .lead-table tr, .lead-table td { display: block; width: 100%; }
    .lead-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    .lead-table tbody { padding: 0 14px; }
    .lead-table tr { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px 18px; padding: 17px 0; border-bottom: 1px solid var(--line); }
    .lead-table tr:last-child { border-bottom: 0; }
    .lead-table td { max-width: none; min-width: 0; padding: 0; border: 0; overflow-wrap: anywhere; }
    .lead-table td::before { content: attr(data-label); display: block; margin-bottom: 3px; color: var(--muted); font-size: .65rem; font-weight: 750; text-transform: uppercase; letter-spacing: .04em; }
    .contact-cell { min-width: 0; }
    .price-cell { white-space: normal; }
    .callback-list { padding: 0 14px; }
    .callback-row { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 13px; padding: 16px 0; }
    .callback-row > div:last-child { display: grid; }
    .callback-row.is-overdue { margin-inline: -14px; padding-inline: 14px; }
    .callback-worklist { padding: 0 14px; }
    .callback-work-item, .callback-work-item.has-assignee { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; padding: 17px 0; }
    .callback-work-item.is-overdue { margin-inline: -14px; padding-inline: 14px; }
    .callback-open { align-self: end; }
    .pagination { align-items: flex-start; flex-direction: column; }
    .pagination div, .pagination a { width: 100%; }
    .pagination a { text-align: center; }
}

@media (max-width: 767px) {
    .lead-table tbody tr:nth-child(even) { background: #f7f9fb; }
}

@media (max-width: 374px) {
    .mobile-header { padding-inline: 12px; }
    .portal-main { padding-inline: 10px; }
    .mobile-header .portal-brand > span:last-child { display: none; }
    .lead-table tr { grid-template-columns: 1fr; }
    .callback-row { grid-template-columns: 1fr; }
    .callback-filter > div { align-items: stretch; flex-direction: column; }
    .callback-filter select { min-width: 0; width: 100%; }
    .callback-work-item, .callback-work-item.has-assignee { grid-template-columns: 1fr; }
    .deletion-request-summary, .deletion-request-details { grid-template-columns: 1fr; }
    .deletion-request-actions, .deletion-confirm form > div { align-items: stretch; flex-direction: column; }
    .deletion-request-actions > *, .deletion-request-actions form, .deletion-request-actions button, .deletion-confirm, .deletion-confirm > summary, .deletion-confirm form > div > * { width: 100%; }
    .deletion-request-form { padding: 14px; }
    .deletion-request-form button { width: 100%; }
    .detail-hero { grid-template-columns: 1fr; padding: 18px 16px; }
    .detail-hero > .status-badge { justify-self: start; }
    .hero-facts, .detail-list, .structured-list { grid-template-columns: 1fr; }
    .detail-card { padding: 18px 15px; }
    .inline-control, .date-time-grid { grid-template-columns: 1fr; }
    .service-grid { grid-template-columns: 1fr; }
    .note-form > div, .timeline-meta { align-items: stretch; flex-direction: column; }
    .timeline-meta time { flex: auto; }
}
