
    :root {
      --bg: #f4f6f5;
      --surface: #ffffff;
      --line: #dce2df;
      --text: #15211b;
      --muted: #66736c;
      --accent: #00b956;
      --accent-dark: #078743;
      --warn: #a15d00;
      --bad: #b42318;
      --radius: 8px;
      --header-height: 51px;
    }
    * { box-sizing: border-box; }
    body { margin: 0; background: var(--bg); color: var(--text); font: 13px/1.38 Segoe UI, Arial, sans-serif; }
    header { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: var(--header-height); padding: 8px 18px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; box-shadow: 0 1px 2px rgba(21, 33, 27, 0.06); }
    .brand { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--text); text-decoration: none; }
    .brand-logo { display: block; width: 34px; height: 34px; object-fit: contain; flex: 0 0 auto; }
    h1 { font-size: 16px; margin: 0; }
    h2 { font-size: 15px; margin: 0 0 10px; }
    nav { display: flex; gap: 4px; }
    nav a { color: var(--muted); text-decoration: none; padding: 6px 8px; border-radius: 6px; }
    nav a.active, nav a:hover { color: var(--text); background: #e8eeeb; }
    .section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
    .section-head h2 { margin: 0; }
    .period-selector { display: flex; align-items: center; gap: 8px; color: var(--muted); }
    .period-selector nav { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: 6px; background: #f7faf8; }
    .period-selector a { color: var(--muted); text-decoration: none; padding: 6px 9px; border-radius: 4px; white-space: nowrap; }
    .period-selector a.active, .period-selector a:hover { color: var(--text); background: var(--surface); }
    main { padding: 14px 18px 30px; display: grid; gap: 12px; min-width: 0; }
    section, .panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; min-width: 0; }
    .summary { display: grid; grid-template-columns: minmax(120px, 1fr) minmax(120px, 1fr) minmax(320px, 1.6fr) minmax(210px, 1fr); gap: 10px; background: transparent; border: 0; padding: 0; }
    .stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
    .stat b { display: block; font-size: 21px; margin-bottom: 1px; }
    .stat span { color: var(--muted); }
    .forwarding-stats { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 12px; }
    .forwarding-stat { min-width: 0; }
    .forwarding-stat + .forwarding-stat { border-left: 1px solid var(--line); padding-left: 12px; }
    .stat.forwarding-stats span { display: block; letter-spacing: 0; }
    .portal-balances { display: grid; grid-template-columns: repeat(3, minmax(260px, 1fr)); gap: 10px; background: transparent; border: 0; padding: 0; }
    .portal-balance-card { min-width: 0; padding: 9px 11px; border: 1px solid var(--line); border-left: 3px solid var(--accent-dark); border-radius: 8px; background: var(--surface); }
    .portal-balance-card.warning { border-left-color: #d49313; }
    .portal-balance-card.critical { border-left-color: var(--bad); }
    .portal-balance-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
    .portal-balance-head b { font-size: 14px; }
    .portal-balance-head > span { color: var(--muted); font-size: 12px; white-space: nowrap; }
    .portal-balance-card dl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; margin: 0; }
    .portal-balance-card dl div { min-width: 0; }
    .portal-balance-card dt { color: var(--muted); font-size: 10px; line-height: 1.2; }
    .portal-balance-card dd { margin: 2px 0 0; font-size: 13px; font-weight: 600; white-space: nowrap; }
    .credit-meter { height: 4px; margin-top: 7px; overflow: hidden; border-radius: 2px; background: #e7ece9; }
    .credit-meter span { display: block; height: 100%; background: var(--accent-dark); }
    .portal-balance-card.warning .credit-meter span { background: #d49313; }
    .portal-balance-card.critical .credit-meter span { background: var(--bad); }
    .portal-balance-lower { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 6px 10px; margin-top: 6px; }
    .portal-balance-meta { flex: 1 1 180px; min-width: 0; }
    .portal-balance-action { flex: 1 1 280px; min-width: 0; }
    .portal-balance-forecast { display: grid; grid-template-columns: 1fr; gap: 2px; font-size: 11px; line-height: 1.25; }
    .portal-balance-forecast span { min-width: 0; }
    .portal-balance-forecast b { font-weight: 600; }
    .portal-balance-note { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; line-height: 1.25; }
    .portal-balance-note .warn-text, .portal-balance-note.warn-text { color: var(--warn); }
    .prepayment-form { display: grid; grid-template-columns: minmax(80px, 110px) auto minmax(0, 1fr); gap: 5px; align-items: center; margin: 0; }
    .prepayment-form input { min-height: 28px; height: 28px; padding: 4px 6px; font-size: 11px; }
    .prepayment-form button { min-height: 28px; padding: 4px 8px; font-size: 11px; white-space: nowrap; }
    .prepayment-status { display: inline-flex; align-items: baseline; gap: 5px; min-width: 0; color: var(--muted); font-size: 10px; white-space: nowrap; }
    .prepayment-status a { color: var(--accent-dark); font-weight: 600; }
    .prepayment-status small { color: var(--muted); font-size: 9px; }
    .prepayment-status.busy { color: var(--warn); }
    .prepayment-status.failed { color: var(--bad); cursor: help; }
    .toolbar form, .panel { display: grid; grid-template-columns: repeat(4, minmax(180px, 1fr)); gap: 10px; align-items: end; }
    .toolbar form { width: 100%; min-width: 0; grid-template-columns: minmax(160px, 1fr) minmax(120px, 1fr) minmax(150px, auto) minmax(180px, 1.4fr); }
    .toolbar button { width: 100%; }
    .forms { display: grid; gap: 12px; }
    label { display: grid; gap: 5px; color: var(--muted); }
    input, select, textarea { width: 100%; min-height: 34px; border: 1px solid #cbd4d0; border-radius: 6px; padding: 6px 8px; font: inherit; color: var(--text); background: #fff; }
    textarea { resize: vertical; min-height: 78px; }
    .field-note { display: flex; align-items: center; gap: 8px; min-height: 24px; color: var(--muted); font-size: 12px; }
    .field-note .badge { flex: 0 0 auto; }
    .form-actions { display: flex; gap: 8px; align-items: center; }
    .form-actions button { min-width: 150px; }
    .check { display: flex; align-items: center; gap: 8px; color: var(--text); }
    .check input { width: auto; min-height: 0; }
    button { min-height: 34px; border: 0; border-radius: 6px; background: var(--accent); color: white; font-weight: 600; padding: 7px 12px; cursor: pointer; }
    button:hover { background: var(--accent-dark); }
    button.ghost { background: #eef2f0; color: var(--text); }
    button.compact { min-height: 28px; padding: 4px 8px; }
    button.danger { background: #fde8e7; color: var(--bad); }
    button.danger:hover { background: #fbd0cd; }
    .inline { display: inline; }
    .table-wrap { width: 100%; max-width: 100%; min-width: 0; overflow: auto; border: 1px solid var(--line); border-radius: 6px; }
    table { width: 100%; border-collapse: collapse; min-width: 980px; }
    .main-table table { min-width: 1671px; table-layout: fixed; }
    th, td { padding: 6px 7px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; white-space: nowrap; }
    th { position: static; top: auto; background: #f7faf8; color: var(--muted); font-weight: 600; z-index: 4; }
    .static-table th { position: static; top: auto; }
    .main-table th, .main-table td { white-space: normal; overflow-wrap: anywhere; word-break: normal; line-height: 1.24; }
    .main-table th { vertical-align: middle; }
    .main-table td { max-width: 0; }
    .main-table td:nth-child(1), .main-table td:nth-child(2),
    .main-table td:nth-child(8), .main-table td:nth-child(9), .main-table td:nth-child(11) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .main-table .cell-text { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
    .main-table .cell-nowrap { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
    .main-table .badge { display: inline-block; max-width: 100%; white-space: normal; overflow-wrap: anywhere; line-height: 1.2; }
    .badge { display: inline-flex; align-items: center; min-height: 22px; border-radius: 999px; padding: 1px 7px; background: #edf3ef; color: var(--text); }
    .badge.good { background: #e4f8ec; color: #05723a; }
    .badge.bad { background: #fde8e7; color: var(--bad); }
    .badge.warn { background: #fff3db; color: var(--warn); }
    .muted { color: var(--muted); }
    .not-collected { color: var(--warn); font-style: italic; }
    .phone-cell { display: flex; align-items: flex-start; gap: 4px; justify-content: space-between; min-width: 0; }
    .phone-identity { display: grid; gap: 6px; min-width: 0; }
    .phone-iccid { display: block; max-width: 128px; overflow: hidden; color: var(--muted); font-size: 10.5px; font-weight: 400; line-height: 1.15; text-overflow: ellipsis; white-space: nowrap; }
    .refresh-btn { flex: 0 0 auto; min-height: 0; height: 20px; width: 20px; padding: 0; border-radius: 5px; background: #eef2ef; color: var(--accent); line-height: 0; display: inline-flex; align-items: center; justify-content: center; box-shadow: none; }
    .refresh-btn svg { display: block; }
    .refresh-btn:hover { background: #d9e6dd; color: var(--accent-dark); }
    .refresh-btn.busy { animation: refresh-spin 0.9s linear infinite; pointer-events: none; opacity: 0.7; }
    .refresh-btn:disabled, .refresh-btn.disabled { cursor: not-allowed; opacity: 0.45; background: #f2f4f3; color: var(--muted); }
    .refresh-btn:disabled:hover, .refresh-btn.disabled:hover { background: #f2f4f3; color: var(--muted); }
    @keyframes refresh-spin { to { transform: rotate(360deg); } }
    .action-feedback { position: fixed; right: 18px; bottom: 18px; z-index: 40; max-width: min(420px, calc(100vw - 36px)); padding: 9px 12px; border: 1px solid var(--line); border-left: 3px solid #4a7396; border-radius: 6px; background: var(--surface); color: var(--text); box-shadow: 0 4px 14px rgba(21, 33, 27, 0.14); font-size: 13px; }
    .action-feedback.success { border-left-color: var(--accent-dark); }
    .action-feedback.warn { border-left-color: #d49313; }
    .action-feedback.error { border-left-color: var(--bad); color: var(--bad); }
    .action-feedback[hidden] { display: none; }
    .forwarding-actions { display: grid; gap: 4px; align-items: start; min-width: 0; }
    .forwarding-actions form { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; min-width: 0; }
    .forwarding-set-form { display: grid !important; grid-template-columns: minmax(0, 1fr) 68px; gap: 4px; align-items: center; width: 100%; }
    .forwarding-actions input[name="target_number"] { min-height: 26px; width: 100%; min-width: 0; padding: 3px 6px; font-size: 12px; }
    .forwarding-actions input[type="datetime-local"] { min-height: 26px; width: 100%; min-width: 0; padding: 3px 5px; font-size: 12px; }
    .forwarding-actions select[name="forwarding_type"] { min-height: 26px; width: 100%; min-width: 0; padding: 3px 5px; font-size: 12px; }
    .forwarding-actions select[name="forwarding_timeout_seconds"] { min-height: 26px; width: 100%; min-width: 0; padding: 3px 5px; font-size: 12px; }
    .forwarding-set-form select[name="forwarding_type"],
    .forwarding-set-form select[name="forwarding_timeout_seconds"] { grid-column: 1 / -1; }
    .forwarding-set-form.forwarding-schedule-form input[type="datetime-local"] { grid-column: 1 / -1; }
    .forwarding-actions button.compact { min-height: 26px; padding: 3px 7px; font-size: 12px; }
    .forwarding-schedule { max-width: 100%; }
    .forwarding-schedule summary { cursor: pointer; color: var(--accent-dark); font-size: 11px; line-height: 1.2; }
    .forwarding-schedule-form { margin-top: 3px; }
    .forwarding-schedule-note { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; color: var(--warn); font-size: 11px; line-height: 1.2; overflow-wrap: anywhere; }
    .forwarding-cancel-form { display: inline-flex !important; align-items: center; gap: 3px; }
    .forwarding-cancel-form button { min-width: 24px; }
    .forwarding-note, .forwarding-inline-status, .forwarding-install-time { color: var(--muted); font-size: 11px; line-height: 1.2; overflow-wrap: anywhere; }
    .forwarding-install-time { display: block; font-weight: 500; }
    .forwarding-note.warn { color: var(--warn); }
    .forwarding-job-badge { justify-self: start; white-space: normal; line-height: 1.15; }
    .limit-actions { display: grid; gap: 4px; min-width: 0; align-items: start; }
    .limit-current { display: block; line-height: 1.25; overflow-wrap: anywhere; }
    .limit-editor { max-width: 100%; }
    .limit-editor summary { cursor: pointer; color: var(--accent-dark); font-size: 11px; line-height: 1.2; }
    .limit-editor summary.limit-create-trigger { display: inline-flex; align-items: center; width: max-content; max-width: 100%; min-height: 26px; padding: 3px 7px; border-radius: 6px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 600; line-height: 1.2; list-style: none; }
    .limit-editor summary.limit-create-trigger::-webkit-details-marker { display: none; }
    .limit-editor summary.limit-create-trigger:hover,
    .limit-editor[open] summary.limit-create-trigger { background: var(--accent-dark); }
    .limit-editor form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; margin-top: 4px; min-width: 0; }
    .limit-editor label { display: grid; gap: 2px; min-width: 0; color: var(--muted); font-size: 10px; }
    .limit-editor input { width: 100%; min-width: 0; min-height: 26px; padding: 3px 5px; font-size: 12px; }
    .limit-editor button { min-height: 26px; padding: 3px 7px; font-size: 12px; justify-self: start; }
    .limit-note, .limit-inline-status { color: var(--muted); font-size: 11px; line-height: 1.2; overflow-wrap: anywhere; }
    .limit-job-badge { justify-self: start; white-space: normal; line-height: 1.15; }
    .limit-detail-card { align-content: start; }
    .detail-limit-editor { width: 100%; }
    .detail-limit-editor form { grid-template-columns: repeat(2, minmax(92px, 1fr)); align-items: end; }
    .detail-limit-editor button, .detail-limit-editor .limit-inline-status { grid-column: 1 / -1; }
    .detail-forwarding-form { grid-template-columns: 120px 74px !important; width: auto; }
    .detail-forwarding-form select[name="forwarding_type"] { width: 150px; }
    .operator-hint { grid-column: 1 / -1; min-height: 18px; color: var(--muted); font-size: 12px; line-height: 1.4; }
    .fields-title { grid-column: 1 / -1; margin: 8px 0 0; }
    .map-note { grid-column: 1 / -1; color: var(--muted); font-size: 12px; line-height: 1.4; }
    .map-table-wrap { grid-column: 1 / -1; }
    .map-table { min-width: 0; }
    .map-table th:first-child, .map-table td:first-child { width: 64px; text-align: center; }
    .map-table input, .map-table select { min-height: 30px; }
    .map-table[data-value-map] th:first-child, .map-table[data-value-map] td:first-child { width: 240px; text-align: left; }
    .map-table[data-value-map] select { min-width: 220px; }
    .json-example { margin: 8px 0 0; padding: 10px; background: #f4f7f5; border: 1px solid var(--line); border-radius: 6px; overflow: auto; max-height: 320px; font-size: 12px; line-height: 1.4; }
    .api-examples { display: grid; grid-template-columns: repeat(3, minmax(220px, 1fr)); gap: 10px; margin-top: 10px; }
    .api-examples h3 { margin: 0 0 4px; font-size: 13px; }
    .notice { color: var(--muted); background: #fbfcfb; }
    .stale-warning { border-color: #f0c76b; background: #fff8e4; color: #5f4800; }
    .stale-warning b { color: #3f3200; }
    .row-link { color: #0573d1; font-weight: 600; text-decoration: none; }
    .row-link:hover { text-decoration: underline; }
    .forwarding-target-list { display: inline-flex; flex-wrap: wrap; gap: 2px 4px; }
    .forwarding-target-number { border-bottom: 1px dotted #75847d; cursor: help; line-height: 1.2; outline: none; }
    .forwarding-target-number.internal { border-bottom-color: var(--accent); }
    .forwarding-target-number:focus-visible { border-radius: 2px; outline: 2px solid rgba(14, 124, 68, 0.24); outline-offset: 2px; }
    .hover-tooltip { position: fixed; z-index: 1000; max-width: min(360px, calc(100vw - 16px)); padding: 7px 9px; border: 1px solid #30443a; border-radius: 4px; background: #1f2a25; color: #ffffff; box-shadow: 0 6px 16px rgba(16, 24, 20, 0.24); font-size: 12px; line-height: 1.35; pointer-events: none; }
    .hover-tooltip[hidden] { display: none; }
    .wide-table-shell { display: grid; gap: 8px; }
    .subscriber-search { display: grid; grid-template-columns: minmax(220px, 420px) max-content 30px; gap: 8px; align-items: center; justify-content: start; min-width: 0; }
    .subscriber-search input { width: 100%; min-width: 0; height: 34px; padding: 6px 10px; }
    .subscriber-search input::-webkit-search-cancel-button { display: none; }
    .subscriber-search:focus-within input { border-color: var(--accent); background: #f2fbf6; box-shadow: 0 0 0 4px rgba(14, 124, 68, 0.24), 0 5px 14px rgba(14, 124, 68, 0.12); }
    @keyframes subscriber-search-attention {
      0% { box-shadow: 0 0 0 2px rgba(14, 124, 68, 0.18); }
      28% { box-shadow: 0 0 0 8px rgba(14, 124, 68, 0.34), 0 8px 22px rgba(14, 124, 68, 0.18); }
      62% { box-shadow: 0 0 0 5px rgba(14, 124, 68, 0.2), 0 5px 16px rgba(14, 124, 68, 0.14); }
      100% { box-shadow: 0 0 0 4px rgba(14, 124, 68, 0.24), 0 5px 14px rgba(14, 124, 68, 0.12); }
    }
    .subscriber-search.shortcut-focus input { animation: subscriber-search-attention 1.45s ease-out; }
    ::highlight(subscriber-search-text) { background-color: #ffc94a; color: #182019; text-decoration: underline 2px #9a5d00; }
    .subscriber-search-count { color: var(--muted); font-size: 12px; white-space: nowrap; }
    .subscriber-search-count[data-empty="true"] { color: var(--bad); }
    .subscriber-search-clear { width: 30px; min-width: 30px; height: 30px; min-height: 30px; padding: 0; border: 1px solid var(--line); border-radius: 5px; background: #eef2ef; color: var(--text); font-size: 20px; font-weight: 400; line-height: 1; }
    .subscriber-search-clear:hover { background: #dfe8e3; color: var(--text); }
    .subscriber-search-clear[hidden] { display: none; }
    .wide-table-shell:not(.has-horizontal-scroll) .scroll-controls { display: none; }
    .scroll-controls { display: grid; grid-template-columns: 36px minmax(0, 1fr) 36px; gap: 8px; align-items: center; background: var(--surface); }
    .wide-table-shell.has-horizontal-scroll .scroll-controls { position: sticky; top: var(--header-height); z-index: 16; padding: 4px 0; border-bottom: 1px solid var(--line); }
    .scroll-top { height: 18px; overflow-x: auto; overflow-y: hidden; border: 1px solid var(--line); border-radius: 6px; background: #f7faf8; }
    .scroll-spacer { height: 1px; width: 1671px; }
    .icon-btn { width: 36px; min-width: 36px; padding: 0; font-size: 22px; line-height: 1; background: #eef2f0; color: var(--text); }
    .icon-btn:hover { background: #dfe8e3; }
    .sticky-table-head { position: sticky; top: var(--header-height); z-index: 15; width: 100%; max-width: 100%; overflow: hidden; border: 1px solid var(--line); border-bottom: 0; border-radius: 6px 6px 0 0; background: #f7faf8; }
    .wide-table-shell.has-horizontal-scroll .sticky-table-head { top: calc(var(--header-height) + 43px); }
    .sticky-table-head table { min-width: 1671px; table-layout: fixed; }
    .sticky-table-head th { position: static; top: auto; background: #f7faf8; white-space: normal; overflow-wrap: anywhere; word-break: normal; line-height: 1.24; }
    .sticky-table-head th:nth-child(1) { position: sticky; left: 0; width: 58px; min-width: 58px; max-width: 58px; z-index: 2; box-shadow: 1px 0 0 var(--line); }
    .sticky-table-head th:nth-child(2) { position: sticky; left: 58px; width: 166px; min-width: 166px; max-width: 166px; z-index: 2; box-shadow: 1px 0 0 var(--line); }
    .main-table { border-radius: 0 0 6px 6px; }
    .main-table th:nth-child(1), .main-table td.sticky-col-1 { position: sticky; left: 0; width: 58px; min-width: 58px; max-width: 58px; z-index: 3; background: #fff; box-shadow: 1px 0 0 var(--line); }
    .main-table th:nth-child(2), .main-table td.sticky-col-2 { position: sticky; left: 58px; width: 166px; min-width: 166px; max-width: 166px; z-index: 3; background: #fff; box-shadow: 1px 0 0 var(--line); }
    .main-table th:nth-child(1), .main-table th:nth-child(2) { z-index: 5; background: #f7faf8; }
    .main-table .stale-row td,
    .main-table .stale-row td.sticky-col-1,
    .main-table .stale-row td.sticky-col-2 { background: #fffaf0; }
    .main-table .stale-row td:nth-child(15) { white-space: normal; }
    .collected-at { display: grid; gap: 1px; line-height: 1.08; white-space: normal; color: var(--text); }
    .collected-at span { display: block; white-space: nowrap; overflow: hidden; text-overflow: clip; }
    .collected-at span + span { color: var(--muted); }
    .stale-mark { display: block; margin-top: 3px; color: #8a5d00; font-size: 11px; line-height: 1.15; }
    .simple-table-shell { display: grid; gap: 8px; min-width: 0; }
    .simple-sticky-head { position: sticky; top: var(--header-height); z-index: 14; width: 100%; max-width: 100%; overflow: hidden; border: 1px solid var(--line); border-bottom: 0; border-radius: 6px 6px 0 0; background: #f7faf8; }
    .simple-sticky-head th { position: static; top: auto; background: #f7faf8; }
    .simple-table-body { border-radius: 0 0 6px 6px; }
    .runs-table table { min-width: 1770px; table-layout: fixed; }
    .runs-table th, .runs-table td { overflow: hidden; text-overflow: ellipsis; }
    .pagination { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 12px; }
    .pagination-summary { color: var(--muted); font-size: 12px; }
    .pagination-pages { display: flex; align-items: center; gap: 4px; }
    .pagination-page, .pagination-arrow { min-width: 30px; height: 30px; padding: 0 7px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); color: var(--text); text-decoration: none; line-height: 1; }
    .pagination-page:hover, .pagination-arrow:hover { border-color: #aebdb5; background: #f2f6f3; }
    .pagination-page.current { border-color: var(--accent); background: var(--accent); color: #fff; font-weight: 600; }
    .pagination-arrow { font-size: 20px; }
    .pagination-arrow.disabled { color: #aeb7b2; background: #f5f6f5; }
    .pagination-gap { min-width: 22px; text-align: center; color: var(--muted); }
    .detail-hero { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
    .detail-hero h2 { font-size: 24px; margin: 8px 0 4px; }
    .detail-hero p { margin: 0; color: var(--muted); }
    .detail-actions { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
    .ghost-link { color: #0573d1; text-decoration: none; }
    .ghost-link:hover { text-decoration: underline; }
    .detail-grid { display: grid; grid-template-columns: repeat(4, minmax(180px, 1fr)); gap: 12px; }
    .detail-card { border: 1px solid var(--line); border-radius: 6px; padding: 12px; min-height: 76px; display: grid; align-content: start; gap: 6px; background: #fbfcfb; }
    .detail-card span { color: var(--muted); }
    .detail-card b { font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
    .detail-card small { color: var(--muted); line-height: 1.35; }
    .charts-grid { display: grid; grid-template-columns: repeat(2, minmax(280px, 1fr)); gap: 14px; }
    .chart-card { border: 1px solid var(--line); border-radius: 6px; padding: 12px; background: #fbfcfb; min-width: 0; }
    .chart-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 8px; }
    .chart-head h3 { font-size: 14px; margin: 0; }
    .chart-head span { color: var(--muted); white-space: nowrap; }
    .chart-svg { width: 100%; height: 240px; display: block; outline: none; overflow: visible; }
    .chart-svg:focus-visible { outline: 2px solid rgba(15, 138, 75, 0.22); outline-offset: 2px; border-radius: 4px; }
    .chart-plot-bg { fill: #ffffff; }
    .chart-grid { stroke: #edf2ef; stroke-width: 1; }
    .chart-svg .axis { stroke: #c6d0cb; stroke-width: 1; }
    .chart-area { fill: #0f8a4b; opacity: 0.08; }
    .chart-line { fill: none; stroke: #0f8a4b; stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
    .chart-point { fill: #ffffff; stroke: #0f8a4b; stroke-width: 2; }
    .chart-hover-layer { fill: transparent; pointer-events: all; }
    .chart-cursor { pointer-events: none; }
    .chart-cursor-line { stroke: #476256; stroke-width: 1; stroke-dasharray: 4 4; opacity: 0.65; }
    .chart-cursor-dot { fill: #ffffff; stroke: #0f8a4b; stroke-width: 3; }
    .chart-tooltip-bg { fill: #ffffff; stroke: #c6d0cb; filter: drop-shadow(0 6px 12px rgba(16, 24, 20, 0.14)); }
    .chart-tooltip-date { fill: #5f7068; font-size: 12px; }
    .chart-tooltip-value { fill: #102018; font-size: 13px; font-weight: 700; }
    .axis-label { fill: var(--muted); font-size: 12px; }
    .y-label { font-size: 11px; }
    .empty-chart { min-height: 220px; display: grid; place-items: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 6px; }
    .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; background: transparent; border: 0; padding: 0; }
    .grid2 > div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; min-width: 0; }
    @media (max-width: 900px) {
      :root { --header-height: 92px; }
      header { align-items: flex-start; gap: 12px; flex-direction: column; }
      nav { flex-wrap: wrap; }
      .section-head, .period-selector { align-items: flex-start; flex-direction: column; }
      .period-selector nav { flex-wrap: wrap; }
      .pagination { align-items: flex-start; flex-direction: column; }
      .pagination-pages { flex-wrap: wrap; }
      .summary, .portal-balances, .toolbar form, .panel, .grid2, .detail-grid, .charts-grid, .api-examples { grid-template-columns: 1fr; }
      .detail-hero { flex-direction: column; }
      .detail-actions { align-items: flex-start; }
      .subscriber-search { grid-template-columns: minmax(0, 1fr) max-content 30px; justify-content: stretch; }
      main { padding: 14px; }
    }
    @media (prefers-reduced-motion: reduce) {
      .subscriber-search.shortcut-focus input { animation: none; box-shadow: 0 0 0 5px rgba(14, 124, 68, 0.32), 0 5px 14px rgba(14, 124, 68, 0.12); }
    }

    /* ==== Сдержанная тема (слой поверх базовых стилей) ==== */
    :root {
      --bg: #f3f5f4;
      --surface: #ffffff;
      --line: #e2e6e3;
      --text: #1b2420;
      --muted: #6d7873;
      --accent: #0e7c44;
      --accent-dark: #0b6437;
      --header-bg: #d9eaf6;
      --header-text: #1f3d56;
      --shadow-sm: 0 1px 2px rgba(20, 28, 24, 0.05);
      --radius: 10px;
    }
    body {
      background: var(--bg);
      font: 13.5px/1.45 "Segoe UI Variable Text", "Segoe UI", Inter, Arial, sans-serif;
    }
    header {
      background: var(--header-bg);
      border-bottom: 1px solid #c3d8e8;
      box-shadow: 0 1px 3px rgba(31, 61, 86, 0.08);
    }
    .brand { color: var(--header-text); }
    .brand-logo { border-radius: 7px; background: #fff; padding: 3px; box-shadow: 0 1px 2px rgba(31, 61, 86, 0.15); }
    h1 { color: var(--header-text); font-weight: 600; letter-spacing: 0.2px; }
    nav { gap: 4px; }
    nav a {
      color: rgba(31, 61, 86, 0.62);
      padding: 7px 12px;
      border-radius: 7px;
      font-weight: 500;
      transition: background 0.15s ease, color 0.15s ease;
    }
    nav a:hover { color: var(--header-text); background: rgba(255, 255, 255, 0.6); }
    nav a.active { color: #17364e; background: #ffffff; font-weight: 600; box-shadow: 0 1px 3px rgba(31, 61, 86, 0.18); }
    main { padding: 18px 22px 40px; gap: 14px; }
    section, .panel, .grid2 > div {
      border: 1px solid var(--line);
      border-radius: var(--radius);
      box-shadow: var(--shadow-sm);
      padding: 16px;
    }
    .summary { box-shadow: none; border: 0; padding: 0; gap: 12px; }
    .stat {
      position: relative;
      border-radius: var(--radius);
      padding: 13px 16px 11px;
      box-shadow: var(--shadow-sm);
      overflow: hidden;
    }
    .stat::before {
      content: "";
      position: absolute;
      inset: 0 auto 0 0;
      width: 3px;
      background: var(--accent);
    }
    .stat b { font-size: 23px; font-weight: 650; letter-spacing: 0; }
    .stat span { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.5px; }
    h2 { font-size: 14.5px; font-weight: 650; letter-spacing: 0.1px; }
    button {
      background: var(--accent);
      border-radius: 7px;
      box-shadow: none;
      font-weight: 600;
      transition: background 0.12s ease;
    }
    button:hover { background: var(--accent-dark); }
    button.ghost { background: #eef1ef; color: var(--text); }
    button.ghost:hover { background: #e3e8e5; }
    button.danger { background: #f9e9e7; color: var(--bad); }
    button.danger:hover { background: #f3d8d4; }
    input, select, textarea {
      border-radius: 7px;
      border-color: #d6ddd8;
      transition: border-color 0.15s ease, box-shadow 0.15s ease;
    }
    input:focus-visible, select:focus-visible, textarea:focus-visible {
      outline: none;
      border-color: var(--accent);
      box-shadow: 0 0 0 2px rgba(14, 124, 68, 0.14);
    }
    .table-wrap { border-radius: 8px; }
    th {
      background: #f5f7f6;
      color: #75817a;
      font-size: 11px;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 0.4px;
    }
    .sticky-table-head, .simple-sticky-head { background: #f5f7f6; }
    .sticky-table-head th, .simple-sticky-head th, .main-table th:nth-child(1), .main-table th:nth-child(2) { background: #f5f7f6; }
    tbody tr:hover td { background: #f7f9f8; }
    tbody tr:hover td.sticky-col-1, tbody tr:hover td.sticky-col-2 { background: #f7f9f8; }
    .main-table .stale-row td, .main-table .stale-row td.sticky-col-1, .main-table .stale-row td.sticky-col-2 { background: #fdf7ea; }
    .main-table .stale-row:hover td, .main-table .stale-row:hover td.sticky-col-1, .main-table .stale-row:hover td.sticky-col-2 { background: #faf1dd; }
    .main-table tr[hidden] { display: none; }
    .badge { font-weight: 600; font-size: 12px; padding: 2px 9px; }
    .badge.good { background: #e4f3ea; color: #14603a; }
    .badge.bad { background: #f8e7e4; color: #9c2b20; }
    .badge.warn { background: #f8efd8; color: #7d5a10; }
    .row-link { color: #16629f; font-weight: 600; }
    .notice { border-left: 3px solid #ccd6d0; border-radius: 8px; }
    .stale-warning { border-left: 3px solid #dfb763; }
    .detail-card { border-radius: 8px; box-shadow: none; border-color: var(--line); }
    .detail-hero h2 { font-size: 24px; font-weight: 650; }
    .period-selector nav { border-radius: 7px; padding: 2px; }
    .period-selector a { border-radius: 5px; }
    .period-selector a.active { background: #4a7396; color: #fff; }

    /* ==== Графики ==== */
    .chart-card { border-radius: 8px; box-shadow: none; background: #fff; }
    .chart-head h3 { font-weight: 600; color: #3c4a43; }
    .chart-head span { color: var(--text); font-weight: 650; font-size: 14px; }
    .chart-plot-bg { fill: #ffffff; }
    .chart-grid { stroke: #eceeed; stroke-width: 1; stroke-dasharray: 2 4; }
    .chart-svg .axis { stroke: #dfe4e1; stroke-width: 1; }
    .chart-area { fill: url(#chartGrad); opacity: 1; }
    .chart-line { stroke: var(--accent); stroke-width: 2.25; }
    .chart-point { fill: #ffffff; stroke: var(--accent); stroke-width: 1.6; }
    /* Атрибут hidden не действует на SVG-элементы во всех браузерах — скрываем явно. */
    .chart-cursor[hidden] { display: none; }
    .chart-tick { stroke: #6d7873; stroke-width: 1.4; }
    .chart-day-grid { stroke: #dde4df; stroke-width: 1; }
    .chart-cursor-line { stroke: #55655d; stroke-width: 1; stroke-dasharray: 3 4; opacity: 0.7; }
    .chart-cursor-dot { fill: #ffffff; stroke: var(--accent); stroke-width: 2.4; r: 4.5; }
    .chart-tooltip-bg { fill: #1f2a25; stroke: none; filter: drop-shadow(0 4px 10px rgba(16, 24, 20, 0.28)); }
    .chart-tooltip-date { fill: #a9b8b0; font-size: 11.5px; }
    .chart-tooltip-value { fill: #ffffff; font-size: 13px; font-weight: 650; }
    .axis-label { fill: #93a09a; font-size: 11px; }
    .y-label { font-size: 10.5px; }
    .empty-chart { border: 1px dashed #d7ded9; color: #93a09a; }

    th[data-sort-col] { cursor: pointer; user-select: none; }
    th[data-sort-col]:hover { color: var(--text); background: #eef2ef; }
    th[data-sort-col].sorted { color: var(--accent-dark); }
    .sort-arrow { display: inline-block; min-width: 10px; margin-left: 3px; font-size: 8px; vertical-align: 1px; color: var(--accent-dark); }
    footer {
      padding: 10px 22px 22px;
      color: var(--muted);
      font-size: 12px;
      text-align: center;
      letter-spacing: 0.2px;
    }
    ::-webkit-scrollbar { height: 10px; width: 10px; }
    ::-webkit-scrollbar-thumb { background: #c9d1cc; border-radius: 6px; border: 2px solid var(--bg); }
    ::-webkit-scrollbar-thumb:hover { background: #aeb9b2; }
    ::-webkit-scrollbar-track { background: transparent; }
    .subscriber-status-cell .badge { border-radius: 5px; overflow-wrap: normal; word-break: normal; }
    .blocking-until { display: block; margin-top: 5px; color: var(--muted); font-size: 10px; white-space: nowrap; }
    .blocking-button { display: block; padding: 2px 0; margin-top: 5px; font-size: 10px; background: transparent; color: var(--accent-dark); border: 0; text-align: left; }
    .blocking-button:hover { background: transparent; text-decoration: underline; }
    .blocking-pending { display: block; margin-top: 5px; font-size: 10px; color: #956100; }
    .blocking-dialog { width: 420px; max-width: calc(100vw - 32px); padding: 22px; border: 1px solid var(--line); border-radius: 8px; color: var(--text); box-sizing: border-box; }
    .blocking-dialog::backdrop { background: rgba(0,0,0,.3); }
    .blocking-dialog h2 { margin: 0 0 12px; font-size: 16px; }
    .blocking-dialog p { margin: 0 0 18px; }
    .blocking-dialog label { display: block; margin-bottom: 7px; font-size: 12px; }
    .blocking-dialog input[type=date] { width: 100%; box-sizing: border-box; min-height: 36px; }
    .blocking-presets { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; margin-top: 8px; }
    .blocking-presets button { min-width: 0; min-height: 32px; padding: 5px 3px; border: 1px solid var(--line); font-size: 12px; font-weight: 500; white-space: nowrap; transition: none; }
    .blocking-presets button[aria-pressed=true] { border-color: var(--accent-dark); background: var(--accent-dark); color: #fff; }
    .blocking-presets button:focus-visible { outline: 2px solid var(--accent-dark); outline-offset: 2px; }
    @media (max-width: 440px) {
      .blocking-presets { grid-template-columns: repeat(3, minmax(0, 1fr)); }
      .forwarding-stats { grid-template-columns: 1fr; gap: 8px; }
      .forwarding-stat + .forwarding-stat { border-left: 0; border-top: 1px solid var(--line); padding-left: 0; padding-top: 8px; }
    }
    .blocking-dialog-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }
    .blocking-dialog-error { display: block; font-size: 12px; color: var(--bad); margin-top: 10px; }
  