:root,
html[data-theme="light"] {
    /* Cool grey ground so solid white panels read clearly (was washed blue-on-blue). */
    --bg-top: #e6ebf3;
    --bg-bottom: #eef2f7;
    --panel: #ffffff;
    --panel-strong: #ffffff;
    --border: rgba(180, 194, 220, 0.95);
    --text: #162033;
    --muted: #63718c;
    --accent: #3b63ff;
    --accent-soft: #edf2ff;
    --success: #198754;
    --success-soft: #e8f7ef;
    --danger: #b4233c;
    --danger-soft: #fee9ec;
    --shadow-lg: 0 8px 28px rgba(50, 70, 120, 0.10), 0 2px 8px rgba(50, 70, 120, 0.06);
    --shadow-md: 0 4px 16px rgba(50, 70, 120, 0.08), 0 10px 24px rgba(50, 70, 120, 0.05);
    --shadow-metric: 0 2px 8px rgba(50, 70, 120, 0.06), 0 8px 22px rgba(50, 70, 120, 0.07);
    --radius-sm: 8px;
    --radius-md: 11px;
    --radius-lg: 12px;
    --radius-xl: 12px;
    --radius-pill: 999px;
    --text-sm: 0.875rem;
    --input-bg: rgba(255, 255, 255, 0.94);
    --input-border: #cfd8ea;
    --nav-color: #3556c9;
    --nav-hover-bg: rgba(237, 242, 255, 0.9);
    --nav-active-bg: linear-gradient(90deg, rgba(59, 99, 255, 0.14) 0%, rgba(237, 242, 255, 0.98) 100%);
    --nav-active-color: #1e3a8a;
    --body-glow-a: rgba(72, 113, 255, 0.06);
    --body-glow-b: rgba(62, 201, 255, 0.05);
    --card-title: #17233d;
    --ghost-btn-color: #2445b4;
    --meta-label: #7583a0;
    --surface: #ffffff;
    --surface-subtle: #f4f7fc;
    --surface-nested: #ffffff;
    --surface-inset: #eef2f8;
    --zebra-soft: rgba(55, 85, 160, 0.05);
    --hierarchy-accent: rgba(33, 84, 214, 0.95);
    --hierarchy-accent-soft: rgba(78, 211, 255, 0.55);
    --badge-bg: #ecf1ff;
    --badge-color: #4f6fe0;
    --badge-count-bg: #eef7f1;
    --badge-count-color: #1f6b45;
    --type-periodic-bg: rgba(59, 99, 255, 0.10);
    --type-periodic-color: #4a62b8;
    --type-once-bg: rgba(120, 90, 210, 0.10);
    --type-once-color: #6b52b8;
    --type-traffic-bg: rgba(16, 140, 120, 0.10);
    --type-traffic-color: #1a7a6a;
    --type-hotspot-bg: rgba(210, 120, 40, 0.10);
    --type-hotspot-color: #a86418;
    --type-dialup-bg: rgba(100, 110, 130, 0.10);
    --type-dialup-color: #5a6478;
    --type-telephony-bg: rgba(180, 70, 120, 0.10);
    --type-telephony-color: #9a4068;
    --type-unknown-bg: var(--badge-bg);
    --type-unknown-color: var(--badge-color);
    --alert-error-border: #ffc8d0;
    --alert-error-color: #9b1f33;
    --shadow-sm: 0 2px 10px rgba(50, 70, 120, 0.07);
    --link: color-mix(in srgb, var(--accent) 58%, var(--muted));
    --link-hover: var(--accent);
    --font-sans: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    color-scheme: light;
}

html[data-theme="dark"] {
    --bg-top: #0b101a;
    --bg-bottom: #101826;
    --panel: #171e2e;
    --panel-strong: #1c2538;
    --border: rgba(90, 108, 150, 0.45);
    --text: #c9d4ea;
    --muted: #8f9db8;
    --accent: #6b8cff;
    --accent-soft: rgba(107, 140, 255, 0.16);
    --success: #3dd68c;
    --success-soft: rgba(61, 214, 140, 0.14);
    --danger: #ff7a90;
    --danger-soft: rgba(255, 122, 144, 0.14);
    --shadow-lg: 0 10px 32px rgba(0, 0, 0, 0.38), 0 2px 8px rgba(0, 0, 0, 0.22);
    --shadow-md: 0 4px 18px rgba(0, 0, 0, 0.28), 0 12px 28px rgba(0, 0, 0, 0.16);
    --shadow-metric: 0 2px 8px rgba(0, 0, 0, 0.22), 0 10px 24px rgba(0, 0, 0, 0.2);
    --input-bg: rgba(16, 22, 36, 0.96);
    --input-border: #3a4a6c;
    --nav-color: #b0c0f0;
    --nav-hover-bg: rgba(107, 140, 255, 0.12);
    --nav-active-bg: linear-gradient(90deg, rgba(107, 140, 255, 0.22) 0%, rgba(40, 52, 82, 0.98) 100%);
    --nav-active-color: #d5def0;
    --body-glow-a: rgba(72, 113, 255, 0.08);
    --body-glow-b: rgba(62, 201, 255, 0.04);
    --card-title: #d5def0;
    --ghost-btn-color: #b8c6f0;
    --meta-label: #8494b0;
    --surface: #171e2e;
    --surface-subtle: #141b29;
    --surface-nested: #1a2234;
    --surface-inset: #121925;
    --zebra-soft: rgba(0, 0, 0, 0.16);
    --hierarchy-accent: rgba(107, 140, 255, 0.85);
    --hierarchy-accent-soft: rgba(62, 201, 255, 0.35);
    --badge-bg: rgba(107, 140, 255, 0.14);
    --badge-color: #9db0ff;
    --badge-count-bg: rgba(61, 214, 140, 0.12);
    --badge-count-color: #6bcf9a;
    --type-periodic-bg: rgba(107, 140, 255, 0.14);
    --type-periodic-color: #9db0ff;
    --type-once-bg: rgba(160, 130, 255, 0.12);
    --type-once-color: #b8a8f0;
    --type-traffic-bg: rgba(61, 214, 140, 0.12);
    --type-traffic-color: #6bcf9a;
    --type-hotspot-bg: rgba(255, 180, 90, 0.12);
    --type-hotspot-color: #e8b878;
    --type-dialup-bg: rgba(140, 150, 175, 0.12);
    --type-dialup-color: #a0aac0;
    --type-telephony-bg: rgba(255, 130, 170, 0.12);
    --type-telephony-color: #f0a0b8;
    --type-unknown-bg: var(--badge-bg);
    --type-unknown-color: var(--badge-color);
    --alert-error-border: rgba(255, 122, 144, 0.35);
    --alert-error-color: #ff9aab;
    --shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.28);
    --link: color-mix(in srgb, var(--muted) 62%, var(--accent) 38%);
    --link-hover: color-mix(in srgb, var(--accent) 82%, white);
    color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
    html[data-theme="system"] {
        --bg-top: #0b101a;
        --bg-bottom: #101826;
        --panel: #171e2e;
        --panel-strong: #1c2538;
        --border: rgba(90, 108, 150, 0.45);
        --text: #c9d4ea;
        --muted: #8f9db8;
        --accent: #6b8cff;
        --accent-soft: rgba(107, 140, 255, 0.16);
        --success: #3dd68c;
        --success-soft: rgba(61, 214, 140, 0.14);
        --danger: #ff7a90;
        --danger-soft: rgba(255, 122, 144, 0.14);
        --shadow-lg: 0 10px 32px rgba(0, 0, 0, 0.38), 0 2px 8px rgba(0, 0, 0, 0.22);
        --shadow-md: 0 4px 18px rgba(0, 0, 0, 0.28), 0 12px 28px rgba(0, 0, 0, 0.16);
        --shadow-metric: 0 2px 8px rgba(0, 0, 0, 0.22), 0 10px 24px rgba(0, 0, 0, 0.2);
        --input-bg: rgba(16, 22, 36, 0.96);
        --input-border: #3a4a6c;
        --nav-color: #b0c0f0;
        --nav-hover-bg: rgba(107, 140, 255, 0.12);
        --nav-active-bg: linear-gradient(90deg, rgba(107, 140, 255, 0.22) 0%, rgba(40, 52, 82, 0.98) 100%);
        --nav-active-color: #d5def0;
        --body-glow-a: rgba(72, 113, 255, 0.08);
        --body-glow-b: rgba(62, 201, 255, 0.04);
        --card-title: #d5def0;
        --ghost-btn-color: #b8c6f0;
        --meta-label: #8494b0;
        --surface: #171e2e;
        --surface-subtle: #141b29;
        --surface-nested: #1a2234;
        --surface-inset: #121925;
        --zebra-soft: rgba(0, 0, 0, 0.16);
        --hierarchy-accent: rgba(107, 140, 255, 0.85);
        --hierarchy-accent-soft: rgba(62, 201, 255, 0.35);
        --badge-bg: rgba(107, 140, 255, 0.14);
        --badge-color: #9db0ff;
        --badge-count-bg: rgba(61, 214, 140, 0.12);
        --badge-count-color: #6bcf9a;
        --type-periodic-bg: rgba(107, 140, 255, 0.14);
        --type-periodic-color: #9db0ff;
        --type-once-bg: rgba(160, 130, 255, 0.12);
        --type-once-color: #b8a8f0;
        --type-traffic-bg: rgba(61, 214, 140, 0.12);
        --type-traffic-color: #6bcf9a;
        --type-hotspot-bg: rgba(255, 180, 90, 0.12);
        --type-hotspot-color: #e8b878;
        --type-dialup-bg: rgba(140, 150, 175, 0.12);
        --type-dialup-color: #a0aac0;
        --type-telephony-bg: rgba(255, 130, 170, 0.12);
        --type-telephony-color: #f0a0b8;
        --type-unknown-bg: var(--badge-bg);
        --type-unknown-color: var(--badge-color);
        --alert-error-border: rgba(255, 122, 144, 0.35);
        --alert-error-color: #ff9aab;
        --shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.28);
        --link: color-mix(in srgb, var(--muted) 62%, var(--accent) 38%);
        --link-hover: color-mix(in srgb, var(--accent) 82%, white);
        color-scheme: dark;
    }
}
* { box-sizing: border-box; }
html {
    scroll-behavior: smooth;
    scrollbar-gutter: stable;
    overflow-y: scroll;
}
body {
    margin: 0;
    font-family: var(--font-sans);
    font-feature-settings: "kern" 1, "liga" 1;
    background:
        radial-gradient(circle at top left, var(--body-glow-a), transparent 28%),
        radial-gradient(circle at right 10% top 12%, var(--body-glow-b), transparent 18%),
        linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 100%);
    color: var(--text);
    min-height: 100%;
    min-height: 100dvh;
    overflow-x: clip;
}
.page {
    max-width: 1360px;
    margin: 0 auto;
    padding: 28px 18px 48px;
    /* Shared with .profile-hero-body so the hero divider tracks the sidebar edge. */
    --sidebar-width: 280px;
    --layout-gap: 24px;
}
.dashboard-layout {
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    gap: var(--layout-gap);
    align-items: start;
}
.sidebar {
    position: sticky;
    top: var(--profile-hero-sticky-offset, 0px);
    align-self: start;
    width: var(--sidebar-width);
    max-width: 100%;
    /* No nested scroll / 100vh clamp — those cause sticky jitter */
    overflow: visible;
    overscroll-behavior: none;
    isolation: isolate;
}
.sidebar .panel {
    /* Blur + sticky scroll often subpixel-jitters; solid panel is stable */
    backdrop-filter: none;
}
.panel {
    background: var(--panel);
    /* Opaque panels — blur no longer needed for separation from page bg. */
    backdrop-filter: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
}
.page-login {
    max-width: none;
    width: 100%;
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 18px;
    box-sizing: border-box;
}
.login-card {
    width: 100%;
    max-width: 480px;
    background: var(--panel-strong);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-md);
}
.login-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}
.login-card-title {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.login-card-title h1 {
    margin: 0;
    font-size: 20px;
    line-height: 1.2;
    letter-spacing: -0.02em;
    white-space: nowrap;
}
.login-card .alert {
    margin-bottom: 16px;
}
.form-login input.login-input--suggested {
    border-color: color-mix(in srgb, var(--accent) 38%, var(--input-border));
    background: color-mix(in srgb, var(--accent-soft) 72%, var(--input-bg));
}
html[data-theme="dark"] .form-login input.login-input--suggested {
    border-color: color-mix(in srgb, var(--accent) 42%, var(--input-border));
    background: color-mix(in srgb, var(--accent-soft) 58%, var(--input-bg));
}
.login-card .form-login {
    background: transparent;
    border: 0;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
}
.brand-mark {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    background: #2d67ff;
    color: #fff;
    margin: 0 auto 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    letter-spacing: 0.4px;
}
.brand-mark.inline {
    display: inline-flex;
    width: 28px;
    height: 28px;
    margin: 0 8px 0 0;
    font-size: 11px;
    vertical-align: middle;
}
.form {
    background: var(--panel-strong);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 18px;
    box-shadow: var(--shadow-md);
}
label { display: block; margin-bottom: 12px; }
label > span { display: block; margin-bottom: 6px; font-weight: 600; }
input, select, textarea {
    width: 100%;
    border: 1px solid var(--input-border);
    border-radius: var(--radius-sm);
    padding: 12px 13px;
    font-size: 14px;
    background: var(--input-bg);
    color: var(--text);
    caret-color: var(--text);
}
input::placeholder,
textarea::placeholder {
    color: var(--muted);
    opacity: 0.85;
}
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active,
textarea:-webkit-autofill,
select:-webkit-autofill {
    -webkit-text-fill-color: var(--text);
    caret-color: var(--text);
    box-shadow: 0 0 0 1000px var(--input-bg) inset;
    -webkit-box-shadow: 0 0 0 1000px var(--input-bg) inset;
    border: 1px solid var(--input-border);
    transition: background-color 99999s ease-out 0s;
}
.btn {
    display: inline-block;
    border: 0;
    border-radius: var(--radius-sm);
    padding: 11px 15px;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}
.btn:hover {
    transform: translateY(-1px);
}
.btn-primary { background: linear-gradient(135deg, #3d67ff 0%, #6a7cff 100%); color: #fff; width: 100%; font-weight: 600; box-shadow: 0 10px 24px rgba(61, 103, 255, 0.25); }
.btn-ghost { background: var(--accent-soft); color: var(--ghost-btn-color); }
.btn-wide { display: block; width: 100%; text-align: center; }
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: var(--accent-soft);
    color: var(--ghost-btn-color);
    border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
    text-decoration: none;
    flex-shrink: 0;
    transition: transform 0.15s ease, background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.btn-icon:hover {
    transform: translateY(-1px);
    background: color-mix(in srgb, var(--accent) 16%, var(--accent-soft));
}
.btn-icon svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.btn-icon-refresh {
    color: var(--ghost-btn-color);
}
.btn-icon-refresh.is-refresh-ok {
    color: var(--success);
    background: var(--success-soft);
    border-color: color-mix(in srgb, var(--success) 36%, transparent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 18%, transparent);
    animation: refresh-ok-pulse 0.9s ease-in-out 2;
}
@keyframes refresh-ok-pulse {
    0%, 100% {
        box-shadow: 0 0 0 2px color-mix(in srgb, var(--success) 14%, transparent);
    }
    50% {
        box-shadow: 0 0 0 5px color-mix(in srgb, var(--success) 22%, transparent);
    }
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.alert {
    margin-bottom: 14px;
    padding: 12px 14px;
    border-radius: var(--radius-md);
}
.alert-error {
    background: var(--danger-soft);
    border: 1px solid var(--alert-error-border);
    color: var(--alert-error-color);
}
.muted { color: var(--muted); }
.small { font-size: 12px; }


.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    width: 100%;
    margin-bottom: 18px;
}
.sidebar-account-menu {
    position: relative;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    align-self: stretch;
}
.sidebar-login-stack {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    min-height: 36px;
    padding: 6px 10px 6px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}
.sidebar-login-stack:hover {
    filter: brightness(0.985);
}
.sidebar-login-stack:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent);
    outline-offset: 2px;
}
.sidebar-login-stack--active {
    background: var(--success-soft);
    border-color: color-mix(in srgb, var(--success) 28%, transparent);
}
.sidebar-login-stack--blocked {
    background: var(--danger-soft);
    border-color: color-mix(in srgb, var(--danger) 28%, transparent);
}
.sidebar-login-text {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 2px;
    flex: 1 1 auto;
    min-width: 0;
}
.sidebar-login {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.02em;
    font-variant-numeric: tabular-nums;
    color: var(--text);
    line-height: 1.15;
}
.sidebar-login-chevron {
    flex: 0 0 auto;
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    color: var(--muted);
    opacity: 0.85;
    transition: transform 0.15s ease;
}
.sidebar-login-stack[aria-expanded="true"] .sidebar-login-chevron {
    transform: rotate(180deg);
}
.sidebar-account-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 40;
    min-width: 100%;
    width: max-content;
    max-width: min(240px, 80vw);
    padding: 4px;
    background: var(--panel-strong);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
}
.sidebar-account-dropdown[hidden] {
    display: none;
}
.sidebar-account-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    padding: 9px 12px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}
.sidebar-account-item svg {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.sidebar-account-item:hover,
.sidebar-account-item:focus-visible {
    background: var(--accent-soft);
    color: var(--nav-active-color);
    outline: none;
}
.sidebar-account-logout {
    color: var(--danger);
}
.sidebar-account-logout-form {
    margin: 0;
    width: 100%;
}
.sidebar-account-logout:hover,
.sidebar-account-logout:focus-visible {
    background: var(--danger-soft);
    color: var(--danger);
}
.profile-panel {
    padding: 20px;
    margin-bottom: 16px;
}
.profile-hero {
    /* Horizontal padding lives in columns so --sidebar-width tracks .dashboard-layout */
    position: sticky;
    top: 0;
    z-index: 6;
    overflow: visible;
    padding: 18px 0;
    margin-bottom: 22px;
}
.profile-hero-theme {
    position: absolute;
    top: 18px;
    /* D = --layout-gap */
    right: var(--layout-gap, 24px);
    margin: 0;
    /*
     * Above .profile-hero-left (z-index: 3). On ≤760px left is full-width with
     * padding-right for the toggle; padding still hit-tests and would swallow clicks.
     */
    z-index: 4;
}
.profile-hero-body {
    /* Same columns as .dashboard-layout: sidebar | gap | main */
    display: grid;
    grid-template-columns: var(--sidebar-width, 280px) var(--layout-gap, 24px) minmax(0, 1fr);
    column-gap: 0;
    align-items: stretch;
    min-width: 0;
}
.profile-hero-left {
    /* Stretch to hero-body row height; meta uses margin-top: auto */
    position: relative;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-self: stretch;
    justify-content: flex-start;
    gap: 10px;
    min-width: 0;
    height: 100%;
    /*
     * Symmetric inset D: left edge → content matches content → divider.
     * Divider sits on the sidebar’s right edge (start of the gap column).
     */
    padding: 0 var(--layout-gap, 24px);
    box-sizing: border-box;
}
.profile-hero-divider {
    /* Single full-height rule at sidebar right edge (--sidebar-width). */
    width: 1px;
    margin-block: 2px;
    background: color-mix(in srgb, var(--border) 70%, transparent);
    justify-self: start;
    align-self: stretch;
    /* Soft ends experiment — drop -webkit-mask-image + mask-image to revert. */
    -webkit-mask-image: linear-gradient(
        to bottom,
        transparent 0%,
        #000 16%,
        #000 84%,
        transparent 100%
    );
    mask-image: linear-gradient(
        to bottom,
        transparent 0%,
        #000 16%,
        #000 84%,
        transparent 100%
    );
}
.profile-hero-right {
    /* Stretch to hero-body row height; footer uses margin-top: auto */
    display: flex;
    flex-direction: column;
    align-self: stretch;
    justify-content: flex-start;
    gap: 12px;
    min-width: 0;
    height: 100%;
    /* Keep current inset so name/flash stay where cards read; pad-right D */
    padding-left: 12px;
    padding-right: var(--layout-gap, 24px);
    box-sizing: border-box;
}
.profile-hero .sidebar-brand {
    width: 100%;
    flex: 0 0 auto;
    margin-bottom: 0;
}
.profile-hero .sidebar-account-menu {
    width: 100%;
    max-width: none;
    align-self: stretch;
}
.profile-hero .sidebar-login-stack {
    width: 100%;
}
.profile-hero .sidebar-account-dropdown {
    left: 0;
    right: auto;
    width: 100%;
    min-width: 100%;
    max-width: 100%;
}
.profile-hero-status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px 14px;
    width: 100%;
    min-width: 0;
    /* Right-align type/status inside padded content area (not flush to divider) */
    padding-inline: 0;
    box-sizing: border-box;
}
.profile-hero-status {
    margin: 0;
    padding: 0;
    min-width: 0;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.3;
    color: var(--muted);
    pointer-events: none;
    user-select: none;
}
.profile-hero-status.is-active {
    color: color-mix(in srgb, var(--muted) 70%, var(--success));
}
.profile-hero-status.is-blocked {
    color: color-mix(in srgb, var(--muted) 55%, var(--danger));
}
.profile-hero-person-type {
    flex: 0 0 auto;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.3;
    color: var(--muted);
    white-space: nowrap;
}
.profile-name {
    margin: 0;
    min-width: 0;
    padding-right: 100px;
    font-size: 26px;
    line-height: 1.25;
    letter-spacing: -0.02em;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    overflow-wrap: anywhere;
}
.profile-meta,
.stacked-meta {
    display: grid;
    gap: 12px;
}
.profile-hero .profile-meta {
    /* Pin «Лицевой счёт» / «Подключён» to bottom of .profile-hero-left */
    margin: 0;
    margin-top: auto;
    min-width: 0;
    width: 100%;
    flex: 0 0 auto;
}
.profile-meta-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px 16px;
    width: 100%;
    min-width: 0;
    /* Match .profile-hero-status-row: inside column padding */
    padding-inline: 0;
    box-sizing: border-box;
}
.profile-meta-account {
    min-width: 0;
    flex: 0 1 auto;
}
.profile-meta-connected {
    flex: 0 0 auto;
    margin-left: auto;
    text-align: right;
}
.profile-account-value {
    display: inline;
    max-width: 100%;
    padding-block: 0;
    padding-inline: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-inset);
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}
.profile-meta dt,
.stacked-meta dt {
    margin-bottom: 4px;
    color: var(--meta-label);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.profile-meta dd,
.stacked-meta dd {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.3;
    overflow-wrap: anywhere;
}
.profile-panel-footer {
    /* Bottom row: flash (left) + timestamps + refresh (right), pinned via margin-top: auto */
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    gap: 12px;
    margin-top: auto;
    width: 100%;
    flex: 0 0 auto;
    min-width: 0;
}
.profile-hero .hero-flash {
    /* Reserved one-line slot in footer — empty or filled, hero height stays stable */
    flex: 1 1 auto;
    align-self: flex-end;
    min-width: 0;
    max-width: none;
    margin: 0;
    margin-right: auto;
    text-align: left;
    line-height: 1.45;
    min-height: calc(12px * 1.45);
    max-height: calc(12px * 1.45);
    overflow: hidden;
}
.profile-hero .hero-flash:not(:has(.hero-flash-msg)) {
    /* Keep reserved slot when JS clears the message / only subtitle */
    display: block;
}
.profile-hero .hero-flash-subtitle,
.profile-hero .hero-flash-msg {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.profile-hero .hero-flash-subtitle {
    margin: 0;
    font-weight: 400;
    line-height: 1.45;
}
.profile-timestamps {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    min-width: 0;
    flex: 0 1 auto;
}
.profile-timestamp {
    text-align: right;
    line-height: 1.25;
    white-space: nowrap;
    letter-spacing: -0.01em;
}
.profile-timestamp.small {
    font-size: 11px;
}
.profile-panel-footer .btn-icon-refresh-form {
    display: contents;
}
.profile-panel-footer .btn-icon-refresh {
    flex: 0 0 auto;
    align-self: flex-end;
}
.profile-hero-debug {
    margin: 12px 0 0;
}
.section-nav {
    display: grid;
    gap: 0;
    padding: 8px 0;
    overflow: hidden;
}
.section-nav a {
    display: block;
    padding: 12px 20px;
    border-radius: 0;
    color: var(--nav-color);
    text-decoration: none;
    font-weight: 600;
    background: transparent;
    border: 1px solid transparent;
    border-left-width: 4px;
    border-left-color: transparent;
}
.section-nav a:hover {
    background: var(--nav-hover-bg);
}
.section-nav a.active {
    background: var(--nav-active-bg);
    border-color: transparent;
    border-left-color: var(--accent);
    color: var(--nav-active-color);
    font-weight: 700;
}
.section-nav a.active:hover {
    background: var(--nav-active-bg);
    border-left-color: var(--accent);
}
.main-content {
    min-width: 0;
    --content-gutter: 20px;
    /* Shared gap: balance/credit row → next section heading (Home tariffs, Finance pause) */
    --overview-gap: 18px;
}
.hero-flash:not(:has(.hero-flash-msg)):not(:has(.hero-flash-subtitle)) {
    display: none;
}
.hero-flash-msg {
    margin: 0;
    font-size: 12px;
    line-height: 1.45;
    font-weight: 600;
    transition: opacity 0.4s ease;
}
.hero-flash-msg.is-hiding {
    opacity: 0;
}
.theme-toggle {
    display: inline-flex;
    align-items: center;
    height: 36px;
    gap: 2px;
    padding: 2px;
    border-radius: var(--radius-sm);
    background: var(--accent-soft);
    border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
}
.theme-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    padding: 0;
    transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.theme-toggle-btn:hover {
    color: var(--text);
}
.theme-toggle-btn[aria-pressed="true"] {
    background: var(--panel-strong);
    color: var(--accent);
    box-shadow: var(--shadow-sm);
}
.theme-toggle-btn svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
/* Same outer column as profile hero — no section-level inset; gutters live in heads/cards/rows */
.section-block {
    margin-bottom: 26px;
    padding-inline: 0;
}
.section-block > p {
    padding-inline: var(--content-gutter);
}
/* Home pins balance/credit under sticky .profile-hero (--profile-hero-sticky-offset via app.js). */
.home-sticky-stack {
    position: sticky;
    top: var(--profile-hero-sticky-offset, 0px);
    z-index: 5;
    background: transparent;
    padding-bottom: 0;
}
.home-pinned {
    background: transparent;
    padding-bottom: 0;
}
/* Same gap after overview cards on Home (sticky stack) and Finance (direct cards). */
.home-sticky-stack + .section-block,
.main-content > .cards-overview + .section-block {
    margin-top: var(--overview-gap);
}
.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    padding-inline: var(--content-gutter);
}
.section-head h2 {
    margin: 0;
    font-size: 28px;
    letter-spacing: -0.03em;
}
.section-head-end {
    justify-content: flex-end;
}
.stacked-meta dd a,
.profile-card a {
    color: var(--link);
    text-decoration: none;
    font-weight: 600;
}
/* Support contacts: plain values (address) match link weight/color */
.support-contacts .stacked-meta dd {
    color: var(--link);
    font-weight: 600;
}
.stacked-meta dd a:hover,
.profile-card a:hover {
    color: var(--link-hover);
    text-decoration: underline;
}
.cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}
.card {
    background: var(--panel-strong);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px;
    box-shadow: var(--shadow-md);
}
.card h3 {
    margin: 0 0 8px;
    font-size: 16px;
    color: var(--muted);
    font-weight: 600;
}
.cards-overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.cards-overview .metric-card {
    box-shadow: var(--shadow-metric);
}
.metric-card {
    min-height: 120px;
}
.metric {
    margin: 0;
    font-size: 32px;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
}
.text-danger { color: var(--danger); }
.text-ok { color: var(--success); }

h2 { margin: 20px 0 8px; }
dt {
    color: var(--meta-label);
    font-size: 12px;
    margin-bottom: 4px;
}
dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.codeblock {
    background: #111827;
    color: #e5ebff;
    border-radius: var(--radius-sm);
    padding: 12px;
    overflow: auto;
    font-size: 12px;
}
.raw { margin-top: 16px; }
.table-wrap {
    background: var(--panel-strong);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: auto;
    box-shadow: var(--shadow-md);
}
.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 700px;
}
.data-table th,
.data-table td {
    text-align: left;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    vertical-align: top;
}
.data-table th {
    background: var(--surface-inset);
    color: var(--meta-label);
    font-weight: 600;
}
.data-table tbody tr:hover {
    background: var(--accent-soft);
}

.services-rows {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.services-hierarchy {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.tariff-group {
    position: relative;
    /* Visible like finance/metric: overflow:hidden made the accent fill a fuller top arc */
    overflow: visible;
    border-radius: var(--radius-md);
    /* Prefer finance-like smaller top; bottom stays --radius-md */
    border-top-left-radius: var(--radius-sm);
    border-top-right-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: linear-gradient(180deg, var(--surface) 0%, var(--surface-subtle) 100%);
    box-shadow: var(--shadow-sm);
}
.tariff-group::before {
    content: "";
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    height: 4px;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    background: linear-gradient(90deg, var(--hierarchy-accent), var(--hierarchy-accent-soft));
    pointer-events: none;
}
.tariff-group-head {
    padding: 16px var(--content-gutter) 14px;
}
.hierarchy-line {
    --h-col-actions: 5.5rem;
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--h-col-actions);
    gap: 12px;
    align-items: start;
}
.hierarchy-line-spacer {
    min-width: 0;
    pointer-events: none;
}
.hierarchy-grid {
    --h-col-name: minmax(280px, 3.2fr);
    --h-col-period: minmax(150px, 1.25fr);
    --h-col-fee: minmax(88px, 0.8fr);
    --h-col-accrued: minmax(88px, 0.8fr);
    --hierarchy-cols-tariff: var(--h-col-name) var(--h-col-period) var(--h-col-fee) var(--h-col-accrued);
    /* Separate services share the same tracks as the tariff header row. */
    --hierarchy-cols-service: var(--hierarchy-cols-tariff);
    display: grid;
    grid-template-columns: var(--hierarchy-cols-tariff);
    gap: 10px 14px;
    min-width: 0;
}
.hierarchy-grid-service {
    grid-template-columns: var(--hierarchy-cols-service);
}
/* Nested services: drop redundant period; keep fee/accrued on the same tracks. */
.hierarchy-grid-nested {
    grid-template-columns: var(--hierarchy-cols-tariff);
}
.hierarchy-grid-nested .hierarchy-col-name {
    grid-column: 1 / 3;
}
.hierarchy-grid-nested .hierarchy-col-fee {
    grid-column: 3;
}
.hierarchy-grid-nested .hierarchy-col-accrued {
    grid-column: 4;
}
.hierarchy-grid-next {
    grid-template-columns: var(--hierarchy-cols-tariff);
    align-items: baseline;
}
.hierarchy-grid-next .tariff-next-main {
    grid-column: 1 / 3;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
    align-items: baseline;
    min-width: 0;
}
.hierarchy-col-name dd,
.hierarchy-col-name .service-name {
    word-break: break-word;
}
.service-type-line {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
}
.service-type-line dt {
    margin: 0;
}
.service-type-line .service-type-badge {
    padding: 3px 8px;
    font-size: 11px;
    line-height: 1.2;
}
.hierarchy-col-name .service-name {
    margin: 4px 0 0;
    font-size: 14px;
    color: var(--text);
    font-weight: 600;
}

.hierarchy-primary-value {
    font-size: 18px;
    line-height: 1.25;
}
.hierarchy-sum-note {
    display: block;
    margin-top: 3px;
    line-height: 1.25;
    font-weight: 400;
}
.hierarchy-line-tariff .hierarchy-primary-value {
    font-size: 20px;
    color: var(--card-title);
}
/* Full width of hierarchy-grid (below name/period/fee/accrued), not name column. */
.hierarchy-grid > .tariff-description {
    grid-column: 1 / -1;
    margin: 6px 0 0;
    max-width: none;
    width: 100%;
    min-width: 0;
    line-height: 1.4;
    font-weight: 400;
}
.hierarchy-grid-next > .tariff-description {
    margin-top: 4px;
    font-size: 11px;
}
.tariff-description-label {
    display: inline;
    margin-right: 0.35em;
    color: var(--muted);
    font-weight: 500;
}
.tariff-description-text {
    color: var(--muted);
}
.lk-details {
    display: block;
}
.lk-details > summary.lk-details-summary {
    list-style: none;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.15s ease;
}
.lk-details > summary.lk-details-summary::-webkit-details-marker {
    display: none;
}
.lk-details > summary.lk-details-summary::marker {
    content: "";
}
.lk-details > summary.lk-details-summary:hover {
    background: color-mix(in srgb, var(--accent-soft) 55%, transparent);
}
.lk-details > summary.lk-details-summary:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}
.lk-details[open] .tariff-chevron {
    transform: rotate(180deg);
}
.tariff-group-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: flex-end;
    justify-self: end;
    width: 100%;
    box-sizing: border-box;
    padding-top: 18px;
}
.tariff-group-body {
    padding: 0 var(--content-gutter) 14px;
}
.tariff-chevron {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    border-radius: var(--radius-pill);
    background: var(--accent-soft);
    position: relative;
    transition: transform 0.2s ease, background 0.2s ease;
}
.tariff-chevron::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 46%;
    width: 7px;
    height: 7px;
    border-right: 2px solid var(--accent);
    border-bottom: 2px solid var(--accent);
    transform: translate(-50%, -50%) rotate(45deg);
}
.tariff-next-row {
    padding: 2px 0 8px;
    font-size: 12px;
    line-height: 1.35;
}
.tariff-next-label {
    color: var(--muted);
    font-size: 11px;
    font-weight: 400;
    opacity: 0.75;
}
.tariff-next-value {
    color: var(--muted);
    font-size: 12px;
    font-weight: 400;
    opacity: 0.8;
}
.tariff-next-actions {
    grid-column: 3 / 5;
    display: flex;
    align-items: baseline;
    justify-content: flex-end;
    gap: 6px;
    min-width: 0;
}
.tariff-next-actions .btn-compact {
    padding: 0.35rem 0.7rem;
    font-size: 12px;
    font-weight: 500;
}
.tariff-change-panel {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    margin: 0 0 10px;
    padding: 10px 12px;
    border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
    border-radius: var(--radius-sm);
    background: color-mix(in srgb, var(--accent-soft) 28%, transparent);
}
/* Author display:* beats UA [hidden]{display:none} — without this the panel
 * (and nested consent) stay visible and toggle cannot collapse. */
.tariff-change-panel[hidden] {
    display: none;
}
.tariff-change-hint {
    margin: 0 0 8px;
}
.tariff-change-status {
    margin: 0 0 8px;
}
.tariff-change-status.is-error {
    color: var(--danger, #b42318);
}
.tariff-change-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0 0 10px;
}
.tariff-change-option {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 8px 10px;
    align-items: start;
    margin: 0;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
}
.tariff-change-option:hover {
    background: color-mix(in srgb, var(--surface) 70%, transparent);
}
.tariff-change-option.is-selected {
    border-color: color-mix(in srgb, var(--accent) 45%, transparent);
    background: color-mix(in srgb, var(--surface) 85%, transparent);
}
.tariff-change-option.is-disabled {
    opacity: 0.55;
    cursor: not-allowed;
}
.tariff-change-option.is-scheduled-next {
    border-color: color-mix(in srgb, var(--accent) 22%, transparent);
    background: color-mix(in srgb, var(--accent-soft) 40%, transparent);
}
.tariff-change-option.is-scheduled-next:hover {
    background: color-mix(in srgb, var(--accent-soft) 55%, transparent);
}
.tariff-change-option.is-scheduled-next.is-selected {
    border-color: color-mix(in srgb, var(--accent) 45%, transparent);
    background: color-mix(in srgb, var(--accent-soft) 65%, transparent);
}
.tariff-change-option input[type="radio"] {
    width: auto;
    min-width: 0;
    margin: 3px 0 0;
    padding: 0;
    border: 0;
    background: transparent;
    accent-color: var(--accent);
}
.tariff-change-option-main {
    min-width: 0;
}
.tariff-change-option-name {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
}
.tariff-change-option-mark {
    display: block;
    margin-top: 3px;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.3;
    color: var(--accent, #2563eb);
}
.tariff-change-option-comment {
    margin: 4px 0 0;
    width: 100%;
    max-width: none;
    font-size: 11px;
    line-height: 1.4;
    color: var(--muted);
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.tariff-change-option-balance {
    margin: 3px 0 0;
    font-size: 11px;
    line-height: 1.35;
}
.tariff-change-option-cost {
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    justify-self: end;
}
.tariff-change-option-badge {
    display: block;
    margin-top: 2px;
    font-size: 10px;
    font-weight: 400;
    color: var(--muted);
    text-align: right;
}
.tariff-change-consent {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0 0 10px;
    padding: 8px 0 0;
    border-top: 1px solid color-mix(in srgb, var(--border) 55%, transparent);
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}
.tariff-change-consent[hidden] {
    display: none;
}
.tariff-change-notices {
    margin: 0;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}
.tariff-change-notices p {
    margin: 0 0 6px;
    line-height: 1.4;
}
.tariff-change-notices p:last-child {
    margin-bottom: 0;
}
.tariff-change-notices a {
    color: var(--link);
    text-decoration: none;
    font-weight: 600;
}
.tariff-change-notices a:hover,
.tariff-change-notices a:focus-visible {
    color: var(--link-hover);
    text-decoration: underline;
}
/* Beat global `label { display:block }` + `input { width:100% }` + `label > span { display:block }`. */
.tariff-change-consent-label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 0;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    font-size: 13px;
    line-height: 1.35;
    color: var(--text);
    cursor: pointer;
}
.tariff-change-consent-label input[type="checkbox"] {
    width: auto;
    min-width: 1rem;
    max-width: none;
    flex: 0 0 auto;
    margin: 2px 0 0;
    padding: 0;
    border: 0;
    background: transparent;
    accent-color: var(--accent);
}
.tariff-change-consent-label > span {
    display: block;
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    font-weight: 500;
    white-space: normal;
    overflow-wrap: anywhere;
}
.tariff-change-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.tariff-change-actions.is-empty [data-tariff-change-submit] {
    display: none;
}
.tariff-group-services {
    display: flex;
    flex-direction: column;
    gap: 8px;
    /* Keep left edge aligned with tariff header grid (no extra indent). */
    padding: 0;
    margin-top: 0;
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
}
.tariff-group-services .service-row-nested {
    position: relative;
    margin: 0;
    width: 100%;
    box-sizing: border-box;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface-nested);
    box-shadow: none;
    /* Inner padding only — keep outer width; do not bleed with negative margin. */
    padding: 8px 12px 6px;
}
.unlinked-services .service-row .hierarchy-line-service,
.tariff-group-services .service-row-nested .hierarchy-line-service {
    width: 100%;
    min-width: 0;
}
.unlinked-services .service-row .hierarchy-grid-service,
.tariff-group-services .service-row-nested .hierarchy-grid-service {
    width: 100%;
    min-width: 0;
}
.tariff-group-services .service-row-nested::before {
    display: none;
}
.tariff-group-debug {
    padding: 0 var(--content-gutter) 12px;
}
.tariff-group-empty {
    margin: 0;
    padding: 0 var(--content-gutter) 16px;
}
.unlinked-services {
    margin-top: 4px;
}
.unlinked-services-head {
    margin-bottom: 10px;
}
.service-row {
    position: relative;
    overflow: visible;
    border-radius: var(--radius-md);
    border-top-left-radius: var(--radius-sm);
    border-top-right-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: linear-gradient(180deg, var(--surface) 0%, var(--surface-subtle) 100%);
    box-shadow: var(--shadow-sm);
    padding: 16px var(--content-gutter) 14px;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.service-row-has-link {
    cursor: pointer;
}
.service-row-has-link:hover {
    border-color: color-mix(in srgb, var(--accent) 32%, var(--border));
    background: color-mix(in srgb, var(--accent-soft) 28%, var(--surface));
    box-shadow: var(--shadow-md);
}
.service-row-has-link:focus-within {
    border-color: color-mix(in srgb, var(--accent) 42%, var(--border));
    outline: none;
}
.service-row-nested.service-row-has-link:hover {
    box-shadow: none;
    background: color-mix(in srgb, var(--accent-soft) 22%, var(--surface-nested));
}
.service-row::before {
    content: "";
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    height: 4px;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    background: linear-gradient(90deg, rgba(61, 103, 255, 0.95), rgba(78, 211, 255, 0.65));
    pointer-events: none;
}

/* Text link (anchors + link-styled buttons): soft accent, no chrome */
.link,
.service-detail-link {
    display: inline;
    color: var(--link);
    text-decoration: none;
    font-weight: 600;
    background: transparent;
    border: 0;
    box-shadow: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
}
.link:hover,
.link:focus-visible,
.service-detail-link:hover,
.service-detail-link:focus-visible {
    color: var(--link-hover);
    text-decoration: underline;
}
/* Kill UA button chrome so IP-group «Изменить пароль» reads as a text link */
button.link,
button.service-detail-link,
button.service-detail-ip-pass-btn {
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    background-color: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    margin: 0;
    font: inherit;
    font-weight: 600;
    line-height: inherit;
    color: var(--link);
    cursor: pointer;
    text-align: left;
    text-decoration: none;
    display: inline;
}
button.link:hover,
button.link:focus-visible,
button.service-detail-link:hover,
button.service-detail-link:focus-visible,
button.service-detail-ip-pass-btn:hover,
button.service-detail-ip-pass-btn:focus-visible {
    color: var(--link-hover);
    text-decoration: underline;
    background: transparent;
    background-color: transparent;
}
.service-detail-link-name {
    word-break: break-word;
}
.service-detail-more {
    display: inline;
    margin-left: 0.4em;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0.88;
}
.service-detail-panel {
    margin-bottom: 14px;
    padding: 16px 18px;
}
.service-detail-panel-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 8px;
    min-width: 0;
}
.service-detail-panel-head .service-detail-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: auto;
    height: auto;
    padding: 2px;
    border: none;
    border-radius: 0;
    background: transparent;
    color: color-mix(in srgb, var(--muted) 72%, var(--accent) 28%);
    text-decoration: none;
    line-height: 0;
    transition: color 0.15s ease;
}
.service-detail-panel-head .service-detail-back:hover,
.service-detail-panel-head .service-detail-back:focus-visible {
    color: var(--accent);
    background: transparent;
    transform: none;
}
.service-detail-panel-head .service-detail-back svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.service-detail-panel-head .service-detail-panel-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--card-title);
    min-width: 0;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}
.service-detail-panel-title {
    margin: 0 0 14px;
    font-size: 16px;
    font-weight: 600;
    color: var(--card-title);
    line-height: 1.2;
}
.service-detail-section .empty-state .service-detail-panel-head {
    margin-bottom: 8px;
}
.service-detail-hero {
    position: relative;
    overflow: visible;
    /* Keep panel bottom radius; tighten only the accented top */
    border-top-left-radius: var(--radius-sm);
    border-top-right-radius: var(--radius-sm);
}
.service-detail-hero::before {
    content: "";
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    height: 4px;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    background: linear-gradient(90deg, var(--hierarchy-accent), var(--hierarchy-accent-soft));
    pointer-events: none;
}
.service-detail-grid {
    /* Type | Tariff (wider) | Fee | Accrued — name lives in panel head */
    --hierarchy-cols-detail: minmax(110px, 1fr) minmax(200px, 2.5fr) minmax(100px, 1fr) minmax(100px, 1fr);
    grid-template-columns: var(--hierarchy-cols-detail);
}
.service-detail-table-wrap {
    margin: 0;
    border-radius: var(--radius-sm);
    box-shadow: none;
    min-width: 0;
}
/* Auto layout + min-width floor → H-scroll on narrow viewports (like sessions).
 * Avoid table-layout:fixed — it crushed login/password into overlapping wrap. */
.service-detail-table-wrap .data-table,
.service-detail-table {
    width: 100%;
    max-width: none;
    min-width: 32rem;
    table-layout: auto;
}
.service-detail-table th,
.service-detail-table td {
    padding: 10px 14px;
    font-size: 13px;
    white-space: nowrap;
    overflow-wrap: normal;
    word-break: normal;
}
.service-detail-table th:first-child,
.service-detail-table td:first-child {
    width: auto;
    padding-right: 20px;
}
/* Beat .data-table td/th (left) — class alone loses to .data-table td */
.service-detail-table th.service-detail-col-num,
.service-detail-table td.service-detail-col-num {
    width: 9.5rem;
    min-width: 8.5rem;
    text-align: right;
    padding-right: 1.5rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.service-detail-table tfoot th,
.service-detail-table tfoot td {
    font-weight: 600;
    border-top: 1px solid var(--border);
    padding-top: 12px;
}
.service-detail-empty {
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    background: var(--surface-inset);
    border: 1px dashed var(--border);
    text-align: center;
    font-size: 14px;
}
.service-type-badge {
    flex-shrink: 0;
    display: inline-block;
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    background: var(--badge-bg);
    color: var(--badge-color);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.service-type-badge-periodic {
    background: var(--type-periodic-bg);
    color: var(--type-periodic-color);
}
.service-type-badge-once {
    background: var(--type-once-bg);
    color: var(--type-once-color);
}
.service-type-badge-traffic {
    background: var(--type-traffic-bg);
    color: var(--type-traffic-color);
}
.service-type-badge-hotspot {
    background: var(--type-hotspot-bg);
    color: var(--type-hotspot-color);
}
.service-type-badge-dialup {
    background: var(--type-dialup-bg);
    color: var(--type-dialup-color);
}
.service-type-badge-telephony {
    background: var(--type-telephony-bg);
    color: var(--type-telephony-color);
}
.service-type-badge-unknown,
.service-type-badge-tariff {
    background: var(--type-unknown-bg);
    color: var(--type-unknown-color);
}
.service-type-badge-count {
    background: var(--badge-count-bg);
    color: var(--badge-count-color);
}

.service-cell dt {
    margin: 0;
    font-size: 12px;
    color: var(--meta-label);
}
.service-cell dd {
    margin: 4px 0 0;
    font-size: 14px;
    color: var(--text);
    font-weight: 600;
}
.service-footnote {
    margin: 10px 0 0;
    padding-top: 8px;
    border-top: 1px dashed var(--border);
    color: var(--muted);
}
.cards-profile {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.profile-card-full {
    width: 100%;
    max-width: none;
}
.profile-fields {
    display: grid;
    grid-template-columns: minmax(0, 0.88fr) minmax(0, 1.22fr);
    gap: 8px 28px;
    align-items: start;
}
.profile-fields .stacked-meta {
    gap: 0;
}
.profile-fields .stacked-meta > div {
    padding: 10px 12px;
    border-radius: var(--radius-sm);
}
.profile-fields .stacked-meta > div:nth-child(odd) {
    background: var(--zebra-soft);
}
/* Address: ~2 stacked-meta rows so right column matches left (Тип + Пароль) */
.profile-fields-wide > div:last-child {
    grid-row: span 2;
    min-height: calc(2 * (20px + 11px + 4px + 1.3em));
    align-content: start;
}
.profile-fields-wide > div:last-child dd {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.45;
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    overflow-wrap: anywhere;
}
.profile-card h3 {
    margin-bottom: 14px;
    color: var(--card-title);
}
.profile-card-wide {
    grid-column: 1 / -1;
}
.password-form {
    display: grid;
    gap: 8px;
    max-width: none;
}
.password-form label {
    margin-bottom: 0;
}
.password-form label > span {
    margin-bottom: 4px;
}
.password-form input {
    padding: 9px 12px;
}
.password-form .btn-primary {
    width: auto;
    justify-self: start;
    margin-top: 2px;
    padding: 9px 14px;
}
.lk-modal {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.lk-modal[hidden] {
    display: none;
}
.lk-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(12, 18, 32, 0.48);
}
html[data-theme="dark"] .lk-modal-backdrop {
    background: rgba(4, 8, 16, 0.62);
}
@media (prefers-color-scheme: dark) {
    html[data-theme="system"] .lk-modal-backdrop {
        background: rgba(4, 8, 16, 0.62);
    }
}
.lk-modal-dialog {
    position: relative;
    z-index: 1;
    width: min(420px, 100%);
    padding: 18px 20px 20px;
    margin: 0;
    box-shadow: var(--shadow-lg);
}
.lk-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}
.lk-modal-header h3 {
    margin: 0;
    font-size: 20px;
    line-height: 1.2;
    color: var(--card-title);
}
.lk-modal-close {
    flex: 0 0 auto;
}
body.lk-modal-open {
    overflow: hidden;
}
.text-ok { color: var(--success); }
.text-danger { color: var(--danger); }
.profile-card,
.metric-card {
    position: relative;
    /* Keep overflow visible so box-shadow follows border-radius (hidden clipped it into a slab) */
    overflow: visible;
    /* Smaller top corners to match finance action-card accent; bottom stays --radius-lg from .card */
    border-top-left-radius: var(--radius-sm);
    border-top-right-radius: var(--radius-sm);
}
.profile-card::before,
.metric-card::before {
    content: "";
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    height: 4px;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    background: linear-gradient(90deg, rgba(61, 103, 255, 0.95), rgba(78, 211, 255, 0.65));
    pointer-events: none;
}
.empty-state {
    padding: 18px 20px;
    color: var(--muted);
}


@media (max-width: 1100px) {
    .dashboard-layout {
        grid-template-columns: 1fr;
    }
    .sidebar {
        position: static;
        width: auto;
        max-width: none;
        overflow: visible;
    }
    .home-sticky-stack {
        position: static;
        margin-bottom: 0;
    }
    .cards-overview {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .hierarchy-grid {
        --hierarchy-cols-tariff: repeat(2, minmax(0, 1fr));
        --hierarchy-cols-service: repeat(2, minmax(0, 1fr));
        --hierarchy-cols-detail: repeat(2, minmax(0, 1fr));
    }
    .hierarchy-grid-nested .hierarchy-col-name,
    .hierarchy-grid-nested .hierarchy-col-fee,
    .hierarchy-grid-nested .hierarchy-col-accrued,
    .hierarchy-grid-next .tariff-next-main {
        grid-column: auto;
    }
    .tariff-next-actions {
        grid-column: auto;
        justify-content: flex-start;
        margin-top: 4px;
    }
    .tariff-group-actions {
        padding-top: 0;
        grid-column: 1 / -1;
        justify-content: flex-start;
        width: auto;
    }
    .hierarchy-line {
        grid-template-columns: 1fr;
    }
    .hierarchy-line-spacer {
        display: none;
    }
}

.money {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
}
.currency-symbol {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    margin-left: 0.22em;
    line-height: 1;
}
.currency-symbol-svg {
    display: inline-block;
    /* NBRB viewBox is tall/heavy — size to optical cap-height of bold digits */
    width: 0.62em;
    height: 0.78em;
    vertical-align: baseline;
}
.metric .money {
    align-items: center;
}
.metric .currency-symbol-svg {
    /* metric amounts ~32px/700: still ≤ digit cap height */
    width: 0.68em;
    height: 0.84em;
    vertical-align: baseline;
}
.hero-flash-msg .money,
.pause-quote .money,
.pause-tier-list .money {
    display: inline-flex;
    vertical-align: -0.08em;
}
.hero-flash-msg .currency-symbol-svg,
.pause-quote .currency-symbol-svg,
.pause-tier-list .currency-symbol-svg {
    width: 0.58em;
    height: 0.72em;
}

@media (max-width: 760px) {
    .main-content {
        --content-gutter: 16px;
    }
    .profile-hero {
        padding: 16px 18px;
    }
    .profile-hero-theme {
        top: 16px;
        right: 18px;
    }
    .profile-hero-body {
        grid-template-columns: 1fr;
        row-gap: 14px;
        column-gap: 0;
        padding-right: 0;
    }
    .profile-hero-divider {
        display: none;
    }
    .profile-hero-left {
        z-index: 3;
        gap: 8px;
        height: auto;
        padding: 0 112px 0 0;
    }
    .profile-hero-right {
        padding-left: 0;
        padding-right: 0;
        gap: 10px;
        height: auto;
    }
    /* One band: subtitle left (≤2 lines) | timestamps right — same line box on both sides. */
    .profile-panel-footer {
        margin-top: 8px;
        margin-left: 0;
        width: 100%;
        flex-wrap: nowrap;
        align-items: flex-start;
        justify-content: flex-end;
        gap: 8px 10px;
    }
    .profile-hero .hero-flash {
        flex: 1 1 auto;
        width: auto;
        max-width: none;
        margin: 0;
        margin-right: auto;
        padding: 0;
        align-self: flex-start;
        text-align: left;
        min-width: 0;
        /* Same metrics as timestamps: 11px × 1.25, former 4px gap baked into line-height */
        font-size: 11px;
        line-height: calc(11px * 1.25 + 4px);
        min-height: calc(2 * (11px * 1.25 + 4px));
        max-height: calc(2 * (11px * 1.25 + 4px));
        overflow: hidden;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        gap: 0;
    }
    .profile-hero .hero-flash:not(:has(.hero-flash-msg)) {
        display: flex;
    }
    .profile-hero .hero-flash-subtitle,
    .profile-hero .hero-flash-msg {
        white-space: normal;
        overflow: hidden;
        text-overflow: clip;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        font-size: 11px;
        line-height: calc(11px * 1.25 + 4px);
        margin: 0;
        padding: 0;
    }
    .profile-timestamps {
        flex: 0 0 auto;
        min-width: 0;
        margin: 0;
        padding: 0;
        align-self: flex-start;
        /* Gap absorbed into line-height so wrap lines on the left lock to these rows */
        gap: 0;
    }
    .profile-timestamps .profile-timestamp,
    .profile-timestamps .profile-timestamp.small {
        font-size: 11px;
        line-height: calc(11px * 1.25 + 4px);
        margin: 0;
        padding: 0;
    }
    .profile-panel-footer .btn-icon-refresh {
        align-self: center;
    }
    .profile-hero .profile-meta {
        margin-top: 0;
    }
    .profile-meta-connected {
        text-align: right;
    }
    .profile-name {
        font-size: 22px;
        padding-right: 0;
    }
    .page {
        padding: 18px 12px 36px;
    }
    .cards,
    .cards-overview,
    .cards-profile,
    .profile-fields {
        grid-template-columns: 1fr;
    }
    .profile-fields-wide > div:last-child {
        grid-row: auto;
        min-height: 0;
    }
    .service-row {
        padding: 14px var(--content-gutter) 12px;
    }

    .hierarchy-grid {
        --hierarchy-cols-tariff: repeat(2, minmax(0, 1fr));
        --hierarchy-cols-service: repeat(2, minmax(0, 1fr));
        --hierarchy-cols-detail: repeat(2, minmax(0, 1fr));
        gap: 10px 10px;
    }
    .tariff-group-head {
        padding: 14px var(--content-gutter);
    }
    .tariff-group-services {
        padding: 0;
    }
    .tariff-group-services .service-row-nested {
        margin: 0;
        width: 100%;
        padding: 8px 12px 6px;
    }
    .section-head {
        align-items: flex-start;
        flex-direction: column;
    }
}
@media (max-width: 520px) {
    .hierarchy-grid {
        --hierarchy-cols-tariff: 1fr;
        --hierarchy-cols-service: 1fr;
        --hierarchy-cols-detail: 1fr;
    }
    .hierarchy-grid-nested .hierarchy-col-name,
    .hierarchy-grid-nested .hierarchy-col-fee,
    .hierarchy-grid-nested .hierarchy-col-accrued,
    .hierarchy-grid-next .tariff-next-main {
        grid-column: auto;
    }
    .tariff-next-actions {
        grid-column: auto;
        justify-content: flex-start;
    }
}

/* Reports: one card per section — summary head (title | period when open | meta) + body.
 * Period sits in the same summary row (not a second toolbar). Form stops click propagation.
 * Open headers use a shared grid so С/По columns align across multiple open cards. */
.reports-section .report-section-details {
    margin-top: 14px;
    /* Anchor after reload / #report-… (profile hero scrolls away; no sticky title) */
    scroll-margin-top: 1.25rem;
}
.reports-section .report-section-details:first-of-type {
    margin-top: 0;
}
.report-section-details {
    overflow: hidden;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: linear-gradient(180deg, var(--surface) 0%, var(--surface-subtle) 100%);
    box-shadow: var(--shadow-sm);
}
.report-section-details > summary.report-section-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 12px;
    row-gap: 10px;
    margin-bottom: 0;
    padding-block: 14px;
    border-radius: 0;
}
.report-section-details[open] > summary.report-section-head {
    margin-bottom: 0;
    border-bottom: 1px solid var(--border);
    /* title | fixed period track | meta — same tracks on every open card */
    grid-template-columns: minmax(12rem, 1fr) max-content auto;
}
.report-section-details:not([open]) > summary.report-section-head .reports-period-form--inline {
    display: none;
}
.report-section-details > summary.report-section-head h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--card-title);
    min-width: 0;
}
.report-section-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    justify-self: end;
    /* Prefer one line; mid-width MQ may allow wrap */
    white-space: nowrap;
    min-width: 0;
    max-width: 100%;
}
.report-section-body {
    padding: 12px var(--content-gutter) 14px;
}
.report-section-body > .muted.small {
    padding-inline: 0;
}
.report-section-body > .table-wrap,
.report-section-body > .panel {
    margin: 0;
}
.reports-period-form {
    padding: 0;
    margin: 0;
    background: none;
    border: none;
    box-shadow: none;
    backdrop-filter: none;
    width: 100%;
}
.reports-period-form--section {
    margin: 0;
}
.reports-period-form--inline {
    width: max-content;
    max-width: 100%;
    justify-self: start;
}
.reports-period-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
}
.reports-period-row--inline {
    gap: 6px 8px;
    flex-wrap: nowrap;
}
.reports-period-custom {
    display: grid;
    grid-template-columns: auto auto auto;
    align-items: center;
    gap: 6px 8px;
    width: max-content;
    max-width: 100%;
}
.reports-period-form--inline .reports-period-custom {
    gap: 6px;
}
.reports-period-custom--with-type {
    grid-template-columns: auto auto auto auto;
}
.reports-period-field {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
}
.reports-period-field--type {
    gap: 8px;
}
.reports-period-field--type .reports-period-field-label {
    width: auto;
    min-width: 0;
}
.reports-period-field select {
    box-sizing: border-box;
    height: 32px;
    min-height: 32px;
    min-width: 7.5rem;
    padding: 0 28px 0 8px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--input-border);
    background: var(--input-bg);
    color: var(--text);
    font-size: 13px;
    line-height: 1;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    cursor: pointer;
}
/* Override global `label > span { display:block; margin-bottom:6px }` so С/По sit on the input midline. */
.reports-period-field-label {
    display: inline-flex;
    align-items: center;
    margin: 0;
    padding: 0;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    width: 1.25rem;
    height: 32px;
    flex-shrink: 0;
    box-sizing: border-box;
}
.reports-period-field input[type="date"] {
    box-sizing: border-box;
    height: 32px;
    min-height: 32px;
    width: 9.5rem;
    min-width: 9.5rem;
    padding: 0 8px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--input-border);
    background: var(--input-bg);
    color: var(--text);
    font-size: 13px;
    line-height: 1;
}
button.reports-period-submit {
    width: 32px;
    height: 32px;
    padding: 0;
    cursor: pointer;
    font: inherit;
    appearance: none;
    -webkit-appearance: none;
}
button.reports-period-submit svg {
    width: 16px;
    height: 16px;
}
.reports-section .empty-state a {
    color: var(--link);
    text-decoration: none;
    font-weight: 600;
}
.reports-section .empty-state a:hover {
    color: var(--link-hover);
    text-decoration: underline;
}
/* Mid-width (narrow desktop): period filters on own row before they crush the meta */
@media (max-width: 1100px) {
    .report-section-details[open] > summary.report-section-head {
        grid-template-columns: minmax(0, 1fr) auto;
    }
    .report-section-details[open] > summary.report-section-head .reports-period-form--inline {
        grid-column: 1 / -1;
        width: 100%;
        max-width: 100%;
    }
    .reports-period-row--inline {
        flex-wrap: wrap;
    }
    .report-section-meta {
        white-space: normal;
        justify-self: end;
        text-align: right;
    }
}
@media (max-width: 720px) {
    .reports-period-row {
        align-items: stretch;
        width: 100%;
    }
    .reports-period-custom {
        grid-template-columns: 1fr;
        width: 100%;
    }
    .reports-period-field {
        width: 100%;
    }
    .reports-period-field input[type="date"],
    .reports-period-field select {
        flex: 1 1 auto;
        min-width: 0;
        width: 100%;
    }

    /* Reports tables: avoid useless nested vertical scroll; prefer horizontal when wide.
     * Tall result sets (traffic / sessions) keep max-height + vertical scroll (.table-wrap--scroll). */
    .report-section-body > .table-wrap:not(.table-wrap--scroll) {
        overflow-x: auto;
        overflow-y: visible;
        -webkit-overflow-scrolling: touch;
    }

}

/* Tall report tables (traffic / sessions): scroll inside the wrap so the page stays usable.
 * Horizontal scroll still works when the table is wider than the container. */
.table-wrap--scroll {
    max-height: min(60vh, 36rem);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}
.table-wrap--scroll thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    box-shadow: 0 1px 0 var(--border);
}
/* Traffic: fill container on wide desktop; min-width floor → H-scroll when narrow.
 * First/text columns absorb extra width; numeric cols stay compact (nowrap). */
.report-traffic-table.data-table {
    width: 100%;
    max-width: none;
    min-width: 32rem;
    table-layout: auto;
}
.report-traffic-table th,
.report-traffic-table td {
    white-space: nowrap;
    overflow-wrap: normal;
    word-break: normal;
}
.report-traffic-table td.traffic-ip6 {
    max-width: 28ch;
}
.report-traffic-table .col-num,
.report-traffic-table td.col-num,
.report-traffic-table th.col-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    padding-right: 1.25rem;
}
.report-traffic-table tfoot th,
.report-traffic-table tfoot td {
    font-weight: 600;
    border-top: 1px solid var(--border);
}
@media (max-width: 720px) {
    .table-wrap--scroll {
        max-height: min(55vh, 28rem);
    }
    .report-traffic-table td.traffic-ip6 {
        max-width: 18ch;
    }
}

/* Sessions: fill container on wide desktop; min-width floor → H-scroll when narrow.
 * IPv6 ellipsizes only when its column is capped; full address in title= on the td. */
.report-sessions-table.data-table {
    width: 100%;
    max-width: none;
    min-width: 44rem;
    table-layout: auto;
    font-size: 12.5px;
}
.report-sessions-table--no-ipv6.data-table {
    min-width: 34rem;
}
.report-sessions-table th,
.report-sessions-table td {
    padding: 8px 12px;
    font-size: 12.5px;
}
.report-sessions-table .col-nowrap,
.report-sessions-table td.col-nowrap,
.report-sessions-table th.col-nowrap {
    white-space: nowrap;
}
.report-sessions-table .col-num,
.report-sessions-table td.col-num,
.report-sessions-table th.col-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    padding-left: 8px;
    padding-right: 12px;
}
/* Wide default: IPv6 may grow with the table (~full address); ellipsis when capped. */
.report-sessions-table .session-ipv6,
.report-sessions-table td.session-ipv6,
.report-sessions-table th.session-ipv6 {
    font-size: 10px;
    line-height: 1.3;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
    width: 26%;
    max-width: 42ch;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.report-sessions-table .report-ip6 {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* Mid desktop: tighter IPv6 cap; table still width:100% until min-width forces scroll. */
@media (max-width: 1100px) {
    .report-sessions-table td.session-ipv6,
    .report-sessions-table th.session-ipv6 {
        width: auto;
        max-width: 22ch;
    }
}
/* Mobile / narrow: compact IPv6 + H-scroll via min-width. */
@media (max-width: 720px) {
    .report-sessions-table td.session-ipv6,
    .report-sessions-table th.session-ipv6 {
        max-width: 16ch;
    }
}

/* Pause / promised payment (MVP, polish later) */
.actions-block {
    margin-bottom: 1rem;
}
.cards-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 0.85rem;
    align-items: start;
}
.action-card {
    position: relative;
    display: flex;
    flex-direction: column;
    /* Preferred smaller top accent radius (finance); bottom stays --radius-lg from .card */
    border-top-left-radius: var(--radius-sm);
    border-top-right-radius: var(--radius-sm);
}
.action-card::before {
    content: "";
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    height: 4px;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    background: linear-gradient(90deg, var(--hierarchy-accent), var(--hierarchy-accent-soft));
    pointer-events: none;
}
.action-card h3 {
    margin: 0 0 0.5rem;
}
.action-card-disabled {
    opacity: 0.72;
}
.action-form {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    margin-top: 0.75rem;
}
.action-form label {
    display: grid;
    gap: 0.25rem;
    font-size: 0.85rem;
}
.action-form label > span {
    color: var(--muted);
}
.action-form input[type="date"],
.action-form input[type="number"] {
    width: 100%;
    border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    padding: 0.55rem 0.65rem;
}
.pause-meta {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.pause-meta > p {
    margin: 0;
}
.pause-dates {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.55rem;
    min-width: 0;
}
.pause-dates > label {
    min-width: 0;
}
.pause-tier-list {
    display: grid;
    grid-template-columns: 0.75em max-content max-content max-content auto;
    column-gap: 0.4rem;
    row-gap: 0.12rem;
    margin: 0.35rem 0 0;
    padding-left: 0;
    list-style: none;
    line-height: 1.45;
}
.pause-tier-list > li {
    display: grid;
    grid-template-columns: subgrid;
    grid-column: 1 / -1;
    align-items: baseline;
}
.pause-tier-list > li::before {
    content: "•";
    justify-self: start;
    opacity: 0.8;
}
.pause-tier-sep {
    opacity: 0.75;
}
.pause-tier-price {
    white-space: nowrap;
}
.pause-tier-list .is-unavailable {
    opacity: 0.85;
}
.pause-tier-list .is-unavailable .pause-tier-duration,
.pause-tier-list .is-unavailable .pause-tier-sep,
.pause-tier-list .is-unavailable .pause-tier-price {
    opacity: 0.7;
    text-decoration: line-through;
}
.pause-tier-list .is-unavailable .pause-tier-note {
    opacity: 1;
    text-decoration: none;
}
.pause-quote {
    margin: 0.15rem 0 0;
}
.pause-quote strong {
    color: var(--text);
    font-weight: 600;
}
.pause-quote-msg:not([hidden]) {
    color: var(--danger, #b42318);
    margin: 0;
}
.pause-self-unlock-hint {
    margin: 0.15rem 0 0;
}
/* Beat `.action-form label { display:grid }` + global `input { width:100% }`. */
.pause-consent {
    margin: 0.15rem 0 0;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}
.action-form .pause-consent-label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 0;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    font-size: 13px;
    line-height: 1.35;
    color: var(--text);
    cursor: pointer;
}
.action-form .pause-consent-label input[type="checkbox"] {
    width: auto;
    min-width: 1rem;
    max-width: none;
    flex: 0 0 auto;
    margin: 2px 0 0;
    padding: 0;
    border: 0;
    background: transparent;
    accent-color: var(--accent);
}
.action-form .pause-consent-label > span {
    display: block;
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    font-weight: 500;
    white-space: normal;
    overflow-wrap: anywhere;
    color: var(--text);
}
.btn-compact {
    width: auto;
    display: inline-block;
    padding: 0.55rem 0.9rem;
    font-weight: 600;
}
.action-form .btn-compact,
.action-card > .btn-compact {
    align-self: start;
}
