:root {
    --blue: #007AFF;
    --blue-dark: #0062CC;
    --red: #FF3B30;
    --green: #34C759;
    --ink: #15171a;
    --muted: #737780;
    --line: rgba(31, 35, 40, 0.12);
    --soft: #F5F6F8;
    --panel: #fff;
    --panel-muted: #FAFAFC;
    --shadow: 0 18px 52px rgba(20, 26, 33, 0.12);
}

* {
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
    letter-spacing: 0;
}

body {
    margin: 0;
    background: #eef1f5;
    color: var(--ink);
    font-size: 14px;
}

button,
input,
select {
    font: inherit;
}

.login-shell,
.install-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-panel,
.install-panel {
    width: min(380px, 100%);
    background: #fff;
    border-radius: 28px;
    padding: 45px;
    text-align: center;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.05);
}

.login-panel h1,
.install-panel h1 {
    margin: 0 0 8px;
    font-size: 26px;
}

.login-panel p,
.install-panel p {
    color: var(--muted);
    margin: 0 0 35px;
}

.field {
    width: 100%;
    min-height: 42px;
    border: 1px solid rgba(31, 35, 40, 0.16);
    border-radius: 8px;
    padding: 10px 12px;
    background: #fff;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.field:focus {
    border-color: var(--blue);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.12);
}

input[type="checkbox"] {
    width: 15px;
    height: 15px;
    accent-color: var(--blue);
}

.login-panel .field {
    margin-bottom: 10px;
}

.auth-switch {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
    margin: 0 0 14px;
    padding: 3px;
    border-radius: 14px;
    background: #F2F2F7;
}

.auth-switch button {
    min-height: 34px;
    border: 0;
    border-radius: 11px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-weight: 800;
}

.auth-switch button.active {
    background: #fff;
    color: var(--ink);
    box-shadow: 0 4px 14px rgba(31, 35, 48, 0.08);
}

.auth-register-only {
    display: none;
}

.domain-tools {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.domain-tools strong {
    display: block;
    margin-bottom: 10px;
    font-size: 13px;
}

.domain-tools .field {
    margin-bottom: 8px;
}

.domain-list {
    display: grid;
    gap: 8px;
    margin-top: 10px;
}

.domain-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.domain-actions {
    display: grid;
    gap: 6px;
    justify-items: end;
}

.domain-actions [data-dismiss-domain-notice] {
    min-width: 28px;
    padding: 5px 8px;
    border-radius: 999px;
    font-size: 14px;
    line-height: 1;
}

.domain-item b,
.domain-item span,
.domain-item small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.domain-item b {
    font-size: 12px;
}

.domain-item span,
.domain-item small,
.muted-mini {
    color: var(--muted);
    font-size: 11px;
}

.domain-item.ready {
    border-color: rgba(52, 199, 89, 0.3);
}

.domain-item.failed {
    border-color: rgba(255, 59, 48, 0.22);
}

.domain-error {
    margin-top: 7px;
}

.domain-error summary {
    color: #d0473d;
    cursor: pointer;
    font-size: 11px;
    font-weight: 800;
    list-style: none;
}

.domain-error summary::-webkit-details-marker {
    display: none;
}

.domain-error code {
    display: block;
    margin-top: 7px;
    max-height: 160px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
    border: 1px solid rgba(255, 59, 48, 0.14);
    border-radius: 10px;
    background: rgba(255, 59, 48, 0.06);
    color: #5f1712;
    padding: 8px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 11px;
    line-height: 1.45;
}

.domain-error .clear-domain-error {
    margin-top: 8px;
}

.primary-btn,
.ghost-btn,
.danger-btn,
.icon-btn {
    border: 0;
    cursor: pointer;
    font-weight: 700;
    transition: transform 0.18s, opacity 0.18s, background 0.18s;
}

.primary-btn {
    background: var(--blue);
    color: #fff;
    min-height: 42px;
    padding: 0 28px;
    border-radius: 10px;
    box-shadow: 0 8px 18px rgba(0, 122, 255, 0.18);
}

.primary-btn:hover {
    background: var(--blue-dark);
}

.primary-btn:active,
.ghost-btn:active,
.danger-btn:active,
.icon-btn:active {
    transform: scale(0.97);
}

.primary-btn:disabled,
.ghost-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ghost-btn,
.danger-btn {
    min-height: 34px;
    padding: 0 14px;
    border-radius: 8px;
    background: #EEF0F3;
    color: var(--ink);
    font-size: 13px;
    font-weight: 600;
}

.danger-btn {
    color: var(--red);
}

.icon-btn {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: #EEF0F3;
    color: var(--muted);
    font-size: 22px;
    line-height: 1;
}

.compact,
.full {
    width: 100%;
}

.form-msg {
    display: block;
    min-height: 20px;
    margin-top: 12px;
    color: var(--red);
}

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 240px;
    height: 100vh;
    background: #FBFBFD;
    border-right: 1px solid var(--line);
    padding: 22px 18px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 4px;
}

.brand-mark {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    background: var(--blue);
    color: #fff;
    border-radius: 10px;
    font-weight: 800;
}

.brand small {
    display: block;
    color: var(--muted);
    margin-top: 2px;
}

.group-list {
    display: grid;
    gap: 4px;
    overflow-y: auto;
}

.group-item {
    min-height: 42px;
    padding: 0 14px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--ink);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-align: left;
    font-weight: 600;
    transition: background 0.2s, color 0.2s, transform 0.2s;
}

.group-item:hover {
    background: rgba(0, 122, 255, 0.08);
}

.group-item.active {
    background: var(--blue);
    color: #fff;
    box-shadow: 0 8px 18px rgba(0, 122, 255, 0.16);
}

.group-delete {
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font-weight: 800;
}

.side-tools {
    margin-top: auto;
    display: grid;
    gap: 10px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.main {
    margin-left: 240px;
    padding: 28px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
    padding: 4px 0 2px;
}

.topbar h1 {
    margin: 0 0 4px;
    font-size: 28px;
    line-height: 1.15;
}

.topbar p {
    margin: 0;
    color: var(--muted);
}

.table-wrap {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(20, 26, 33, 0.05);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

.data-table th {
    color: var(--muted);
    background: #F7F8FA;
    font-size: 11px;
    text-transform: uppercase;
    position: sticky;
    top: 0;
    z-index: 1;
}

.data-table tr:hover td {
    background: #FAFBFD;
}

.data-table tr:last-child td {
    border-bottom: 0;
}

.empty-cell,
.empty-logs {
    padding: 60px 20px;
    text-align: center;
    color: var(--muted);
}

.link-main {
    color: #075fb8;
    font-weight: 750;
    text-decoration: none;
}

.link-main:hover {
    text-decoration: underline;
}

.metric-pill {
    display: inline-grid;
    min-width: 34px;
    height: 28px;
    place-items: center;
    border-radius: 8px;
    background: rgba(52, 199, 89, 0.13);
    color: #16823b;
    font-weight: 800;
}

.strategy-line,
.clip-text {
    display: block;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mini-select {
    border: 0;
    border-radius: 7px;
    min-height: 32px;
    padding: 4px 8px;
    background: #F2F2F7;
    font-size: 12px;
    font-weight: 600;
}

.mini-action {
    margin-top: 6px;
    border: 0;
    border-radius: 8px;
    background: rgba(255, 59, 48, 0.08);
    color: #b42318;
    padding: 5px 8px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 800;
}

.mini-action:hover {
    background: rgba(255, 59, 48, 0.14);
}

.danger-mini {
    background: rgba(255, 59, 48, 0.1);
    color: #d92d20;
}

.danger-mini:hover {
    background: rgba(255, 59, 48, 0.18);
}

.actions {
    white-space: nowrap;
    display: flex;
    gap: 8px;
    align-items: center;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(15, 20, 28, 0.42);
    opacity: 0;
    transition: opacity 0.3s;
}

.modal.active {
    display: flex;
    opacity: 1;
}

.modal.closing {
    display: flex;
    opacity: 0;
}

.modal-panel {
    width: min(720px, 100%);
    max-height: min(860px, 94vh);
    overflow: hidden;
    background: var(--soft);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 12px;
    box-shadow: var(--shadow);
    opacity: 0;
    transform: scale(0);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s;
}

.modal.active .modal-panel {
    opacity: 1;
    transform: scale(1);
}

.modal.closing .modal-panel {
    opacity: 0;
    transform: scale(0);
}

.modal-panel.wide {
    width: min(1160px, 96vw);
    display: grid;
    grid-template-columns: 230px minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto;
}

.modal-panel.logs {
    width: min(1100px, 94vw);
    display: flex;
    flex-direction: column;
    max-height: min(860px, 94vh);
}

.modal-head,
.modal-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 24px;
    background: #fff;
    border-bottom: 1px solid var(--line);
}

.modal-actions {
    justify-content: flex-end;
    border-top: 1px solid var(--line);
    border-bottom: 0;
    padding: 14px 24px 18px;
    background: rgba(255, 255, 255, 0.94);
}

.save-status {
    margin-right: auto;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.save-status.ok {
    color: #16823b;
}

.save-status.bad {
    color: var(--red);
}

.modal-head h2 {
    margin: 0;
    font-size: 20px;
}

.modal-kicker {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
}

.modal-panel.wide .modal-head {
    grid-column: 1 / -1;
}

.modal-tabs {
    display: grid;
    align-content: start;
    gap: 6px;
    padding: 16px;
    background: #F7F7FA;
    border-right: 1px solid var(--line);
}

.modal-panel.wide .modal-tabs {
    grid-column: 1;
    grid-row: 2;
}

.modal-tabs button {
    width: 100%;
    min-height: 58px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    text-align: left;
    padding: 9px 12px;
    transition: background 0.2s, color 0.2s, transform 0.2s;
}

.modal-tabs button strong {
    display: block;
    color: inherit;
    font-size: 14px;
    line-height: 1.2;
}

.modal-tabs button span {
    display: block;
    margin-top: 5px;
    color: inherit;
    opacity: 0.72;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.25;
}

.modal-tabs button:hover {
    background: rgba(0, 122, 255, 0.08);
    color: var(--blue);
}

.modal-tabs button.active {
    background: var(--blue);
    color: #fff;
    box-shadow: 0 8px 18px rgba(0, 122, 255, 0.18);
}

.modal-body {
    padding: 22px;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
}

.modal-panel.wide .modal-body {
    grid-column: 2;
    grid-row: 2;
}

.modal-panel.wide .modal-actions {
    grid-column: 1 / -1;
}

.modal-body.flush {
    padding: 0;
}

.modal-panel.logs .modal-body {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow: auto;
    overscroll-behavior: contain;
}

.modal-panel.logs .data-table {
    min-width: 980px;
}

.config-tabs {
    background: #F6F7FA;
}

.config-panel {
    display: none;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 8px 22px rgba(20, 26, 33, 0.04);
}

.config-panel.active {
    display: block;
}

.panel-title {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin: -2px 0 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid #EEF0F3;
}

.panel-title strong {
    display: block;
    font-size: 16px;
    line-height: 1.25;
}

.panel-title span {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.45;
}

.form-grid {
    display: grid;
    gap: 14px 16px;
}

.form-grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid.three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field-title {
    display: block;
    margin-bottom: 10px;
}

label {
    display: grid;
    gap: 7px;
    margin-bottom: 13px;
    font-weight: 700;
    min-width: 0;
}

.field-hint {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.45;
}

.field-hint + .field-hint {
    margin-top: -2px;
}

.risk-threshold-hint {
    border: 1px solid rgba(0, 122, 255, 0.14);
    border-radius: 8px;
    background: rgba(0, 122, 255, 0.07);
    color: #235b91;
    padding: 10px 12px;
    font-weight: 700;
}

.policy-note {
    border: 1px solid rgba(0, 122, 255, 0.12);
    border-radius: 8px;
    background: rgba(0, 122, 255, 0.06);
    color: #235b91;
    padding: 10px 12px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.55;
}

.source-card {
    display: grid;
    gap: 10px;
    margin: 14px 0;
    padding: 14px;
    border: 1px solid #EEF0F3;
    border-radius: 10px;
    background: var(--panel-muted);
}

.risk-card,
.env-card {
    display: grid;
    gap: 14px;
    margin: 0;
}

.env-subtitle {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    margin-top: 4px;
    text-transform: uppercase;
}

.textarea-field {
    min-height: 74px;
    resize: vertical;
    line-height: 1.5;
}

.risk-checks {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.rate-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.region-grid {
    margin: 14px 0;
}

.region-picker {
    display: grid;
    gap: 14px;
    margin: 14px 0 18px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--panel-muted);
}

.region-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 10px;
    align-items: center;
}

.token-list {
    min-height: 44px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-content: flex-start;
    padding: 10px;
    border: 1px dashed rgba(60, 60, 67, 0.18);
    border-radius: 8px;
    background: #fff;
}

.token {
    border: 0;
    border-radius: 999px;
    background: rgba(0, 122, 255, 0.11);
    color: #0a5eb2;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 800;
}

.empty-token {
    color: var(--muted);
    font-size: 12px;
    align-self: center;
}

.option-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.option-grid label {
    display: flex;
    align-items: center;
    gap: 7px;
    min-height: 38px;
    margin: 0;
    padding: 7px 10px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: #F7F8FA;
    font-weight: 600;
    line-height: 1.25;
    min-width: 0;
}

.option-grid label:hover {
    border-color: rgba(0, 122, 255, 0.18);
    background: #fff;
}

.inline-check {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    margin: 0;
    padding: 0 10px;
    border-radius: 8px;
    background: rgba(255, 59, 48, 0.08);
    color: #9f241f;
    font-weight: 800;
}

.check-row {
    display: flex;
    gap: 18px;
    margin: 12px 0 16px;
}

.check-row label,
.option-grid label,
.country-grid label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    font-weight: 500;
}

.country-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 12px;
    max-height: 54vh;
    overflow-y: auto;
}

.country-zone {
    padding: 12px;
    border: 1px solid #EEF0F3;
    border-radius: 10px;
    background: #fff;
}

.country-zone strong {
    display: block;
    color: var(--blue);
    font-size: 12px;
    margin-bottom: 10px;
}

.modal-filter {
    display: flex;
    gap: 4px;
    width: min(360px, calc(100% - 50px));
    margin: 15px 25px 5px;
    padding: 2px;
    background: #EEEEF0;
    border-radius: 8px;
}

.modal-filter button {
    flex: 1;
    border: 0;
    border-radius: 7px;
    background: transparent;
    padding: 6px 0;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
    transition: 0.2s;
}

.modal-filter button.active {
    background: #fff;
    color: #000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.status {
    font-weight: 800;
}

.status.ok {
    color: var(--green);
}

.status.bad,
.bad-text {
    color: var(--red);
}

.muted-text {
    color: var(--muted);
}

.trace-popover-btn {
    border: 0;
    border-radius: 999px;
    background: rgba(0, 122, 255, 0.1);
    color: var(--blue);
    cursor: pointer;
    font-size: 12px;
    font-weight: 800;
    padding: 7px 12px;
}

.trace-popover-btn.active,
.trace-popover-btn:hover {
    background: var(--blue);
    color: #fff;
}

.trace-popover {
    position: fixed;
    z-index: 2200;
    min-width: 240px;
    padding: 14px;
    border: 1px solid rgba(15, 23, 42, 0.1);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.22);
    color: var(--text);
    font-size: 12px;
    line-height: 1.55;
}

.trace-popover-title {
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.08em;
}

.trace-popover div:not(.trace-popover-title) {
    padding: 6px 0;
    border-top: 1px solid rgba(15, 23, 42, 0.06);
}

.ok-text {
    color: var(--green);
}

.pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    background: #fff;
    border-top: 1px solid var(--line);
}

.pager div {
    display: flex;
    align-items: center;
    gap: 10px;
}

.log-page-input {
    width: 68px;
    height: 36px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    color: var(--text);
    font-size: 13px;
    font-weight: 800;
    outline: none;
    text-align: center;
}

.log-page-input:focus {
    border-color: rgba(0, 122, 255, 0.45);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

@media (max-width: 860px) {
    .sidebar {
        position: static;
        width: auto;
        height: auto;
    }

    .main {
        margin-left: 0;
        padding: 18px;
    }

    .topbar,
    .form-grid.two,
    .form-grid.three {
        grid-template-columns: 1fr;
        display: grid;
    }

    .modal-tabs {
        display: flex;
        overflow-x: auto;
        padding: 12px 18px;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .modal-tabs button {
        min-width: 132px;
        text-align: center;
    }

    .modal-tabs button span {
        display: none;
    }

    .modal-panel.wide {
        display: block;
    }

    .option-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .region-actions {
        grid-template-columns: 1fr;
    }

    .country-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .table-wrap {
        overflow-x: auto;
    }
}

/* Modern iOS solid theme */
:root {
    --ink: #111114;
    --muted: #8A8A93;
    --line: rgba(60, 60, 67, 0.13);
    --soft: #F2F2F7;
    --panel-muted: #F8F8FC;
    --shadow: 0 24px 64px rgba(20, 24, 34, 0.16);
}

body {
    background: #F4F5FA;
}

.main {
    min-height: 100vh;
    background: #F4F5FA;
}

.login-panel,
.install-panel,
.table-wrap,
.config-panel,
.region-picker,
.country-zone {
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow:
        0 14px 38px rgba(31, 35, 48, 0.07),
        inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.login-panel,
.install-panel {
    border-radius: 26px;
    background: #fff;
}

.sidebar {
    background: #FBFBFD;
    border-right: 1px solid rgba(60, 60, 67, 0.12);
    box-shadow: 16px 0 40px rgba(31, 35, 48, 0.045);
}

.brand-mark {
    border-radius: 14px;
    box-shadow:
        0 10px 22px rgba(0, 122, 255, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.group-item {
    border-radius: 13px;
}

.group-item:hover {
    background: #fff;
    box-shadow: inset 0 0 0 1px rgba(0, 122, 255, 0.08);
}

.group-item.active {
    box-shadow:
        0 12px 24px rgba(0, 122, 255, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.topbar {
    min-height: 58px;
}

.topbar h1 {
    font-size: 30px;
    font-weight: 800;
}

.field {
    min-height: 44px;
    border-radius: 12px;
    border-color: rgba(60, 60, 67, 0.14);
    background: #fff;
    box-shadow: inset 0 1px 1px rgba(31, 35, 48, 0.03);
}

.field:focus {
    box-shadow:
        0 0 0 4px rgba(0, 122, 255, 0.13),
        inset 0 1px 2px rgba(31, 35, 48, 0.035);
}

.primary-btn,
.ghost-btn,
.danger-btn,
.icon-btn,
.mini-select,
.mini-action {
    border-radius: 12px;
}

.primary-btn {
    box-shadow:
        0 11px 22px rgba(0, 122, 255, 0.22),
        inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.ghost-btn,
.danger-btn,
.icon-btn {
    background: #fff;
    box-shadow:
        0 6px 16px rgba(31, 35, 48, 0.045),
        inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.table-wrap {
    border-radius: 20px;
    background: #fff;
}

.empty-state {
    min-height: 260px;
    display: grid;
    place-items: center;
    padding: 42px 20px;
    text-align: center;
    color: var(--muted);
}

.empty-state strong {
    display: block;
    margin-bottom: 8px;
    color: #1C1C1E;
    font-size: 16px;
}

.empty-state span {
    display: block;
    font-size: 13px;
    line-height: 1.6;
}

.data-table th {
    background: rgba(248, 248, 252, 0.86);
}

.data-table th:first-child {
    border-top-left-radius: 20px;
}

.data-table th:last-child {
    border-top-right-radius: 20px;
}

.data-table tr:hover td {
    background: rgba(0, 122, 255, 0.045);
}

.metric-pill {
    border-radius: 12px;
}

.modal {
    background: rgba(20, 20, 28, 0.34);
}

.modal-panel {
    border-radius: 22px;
    background: #F2F2F7;
    border: 1px solid rgba(60, 60, 67, 0.12);
    box-shadow:
        0 30px 84px rgba(20, 24, 34, 0.24),
        inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.modal-head,
.modal-actions {
    background: #fff;
}

.modal-tabs {
    background: #F7F7FA;
}

.modal-tabs button {
    border-radius: 14px;
}

.modal-tabs button:hover {
    background: #fff;
}

.modal-tabs button.active {
    background: rgba(0, 122, 255, 0.96);
    box-shadow:
        0 12px 24px rgba(0, 122, 255, 0.22),
        inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

.config-panel {
    border-radius: 20px;
    background: #fff;
}

.source-card,
.region-picker,
.country-zone {
    border-radius: 16px;
    background: #F8F8FC;
}

.option-grid label,
.country-grid label,
.check-row label {
    border-radius: 12px;
    background: #fff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.66);
}

.option-grid label:hover,
.country-grid label:hover,
.check-row label:hover {
    background: #fff;
    border-color: rgba(0, 122, 255, 0.16);
}

.option-grid label:has(input:checked),
.country-grid label:has(input:checked),
.check-row label:has(input:checked) {
    color: #005fc7;
    border-color: rgba(0, 122, 255, 0.22);
    background: rgba(0, 122, 255, 0.1);
}

.token,
.modal-filter,
.modal-filter button {
    border-radius: 999px;
}

.modal-filter {
    background: rgba(118, 118, 128, 0.14);
}

.modal-filter button.active {
    background: rgba(255, 255, 255, 0.92);
}

@media (max-width: 860px) {
    .sidebar {
        border-right: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.7);
    }

    .modal-panel {
        border-radius: 20px;
    }

    .table-wrap {
        border-radius: 18px;
    }
}

/* HH premium command-center theme */
:root {
    --blue: #2f6bff;
    --blue-dark: #174ee8;
    --red: #f04438;
    --green: #19a55a;
    --amber: #d99013;
    --ink: #121722;
    --muted: #667085;
    --line: rgba(16, 24, 40, 0.09);
    --soft: #f3f5f9;
    --panel: #ffffff;
    --panel-muted: #f8fafc;
    --shadow: 0 24px 70px rgba(15, 23, 42, 0.13);
}

body {
    min-height: 100vh;
    background:
        radial-gradient(circle at 35% -10%, rgba(47, 107, 255, 0.12), transparent 32%),
        linear-gradient(180deg, #f7f9fc 0%, #eef2f7 100%);
    color: var(--ink);
}

.login-shell {
    background:
        radial-gradient(circle at 28% 18%, rgba(47, 107, 255, 0.22), transparent 28%),
        radial-gradient(circle at 78% 74%, rgba(217, 144, 19, 0.1), transparent 30%),
        #080d16;
}

.login-panel {
    width: min(430px, 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 28px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(246, 248, 252, 0.96));
    box-shadow: 0 32px 100px rgba(0, 0, 0, 0.34);
}

.login-brand {
    display: grid;
    justify-items: center;
    gap: 12px;
    margin-bottom: 22px;
}

.login-brand img {
    width: 76px;
    height: 76px;
    border-radius: 22px;
    box-shadow: 0 18px 42px rgba(13, 19, 31, 0.28);
}

.login-brand span {
    color: #1f2937;
    font-size: 13px;
    font-weight: 900;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.login-panel h1 {
    font-size: 30px;
    letter-spacing: 0;
}

.sidebar {
    width: 268px;
    padding: 24px 18px;
    border-right: 0;
    background:
        linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(8, 13, 22, 0.98)),
        #0b101a;
    color: #e5e7eb;
    box-shadow: 18px 0 54px rgba(15, 23, 42, 0.16);
}

.brand {
    min-height: 66px;
    padding: 10px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.05);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

.brand-mark {
    width: 48px;
    height: 48px;
    display: block;
    border-radius: 15px;
    background: transparent;
    object-fit: cover;
    box-shadow: 0 16px 34px rgba(0, 0, 0, 0.28);
}

.brand strong {
    color: #fff;
    font-size: 15px;
    letter-spacing: 0.02em;
}

.brand small,
.nav-label {
    color: rgba(229, 231, 235, 0.58);
}

.nav-label {
    margin: 6px 8px -6px;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.group-item {
    min-height: 44px;
    color: rgba(255, 255, 255, 0.78);
    border-radius: 13px;
    font-weight: 750;
}

.group-item:hover {
    background: rgba(255, 255, 255, 0.07);
    color: #fff;
    transform: translateX(2px);
}

.group-item.active {
    background: linear-gradient(135deg, #2f6bff, #174ee8);
    color: #fff;
    box-shadow: 0 16px 32px rgba(47, 107, 255, 0.28);
}

.side-tools {
    border-top-color: rgba(255, 255, 255, 0.09);
}

.sidebar .field {
    border-color: rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}

.sidebar .field::placeholder {
    color: rgba(255, 255, 255, 0.38);
}

.sidebar .ghost-btn {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.78);
}

.domain-tools {
    border-top-color: rgba(255, 255, 255, 0.09);
}

.domain-tools strong {
    color: #fff;
}

.domain-item {
    border-color: rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.05);
}

.domain-item b {
    color: #fff;
}

.main {
    margin-left: 268px;
    padding: 30px 34px 42px;
}

.topbar {
    margin-bottom: 18px;
    padding: 0;
}

.topbar h1 {
    color: #0f172a;
    font-size: 30px;
    font-weight: 850;
}

.topbar p {
    max-width: 720px;
    color: #667085;
    font-size: 13px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.system-pill {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0 13px;
    border: 1px solid rgba(47, 107, 255, 0.12);
    border-radius: 999px;
    background: #fff;
    color: #475467;
    font-size: 12px;
    font-weight: 800;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.04);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.stat-card {
    position: relative;
    overflow: hidden;
    min-height: 126px;
    padding: 18px;
    border: 1px solid rgba(16, 24, 40, 0.08);
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 16px 42px rgba(15, 23, 42, 0.06);
}

.stat-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 3px;
    background: var(--blue);
}

.stat-card span,
.stat-card small {
    display: block;
    color: #667085;
    font-size: 12px;
    font-weight: 750;
}

.stat-card strong {
    display: block;
    margin: 12px 0 8px;
    color: #101828;
    font-size: 32px;
    line-height: 1;
}

.stat-card small {
    line-height: 1.4;
}

.stat-card.tone-green::before {
    background: var(--green);
}

.stat-card.tone-red::before {
    background: var(--red);
}

.stat-card.tone-amber::before {
    background: var(--amber);
}

.stat-card.tone-slate::before {
    background: #475467;
}

.table-wrap {
    border-color: rgba(16, 24, 40, 0.08);
    border-radius: 22px;
    background: #fff;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.08);
}

.data-table th {
    height: 48px;
    background: #f8fafc;
    color: #667085;
    font-weight: 900;
    letter-spacing: 0.04em;
}

.data-table td {
    height: 64px;
}

.data-table tr {
    transition: background 0.16s, transform 0.16s;
}

.data-table tr:hover td {
    background: #f9fbff;
}

.link-main {
    color: #175cd3;
    font-weight: 850;
}

.metric-pill {
    border-radius: 999px;
    background: rgba(25, 165, 90, 0.1);
    color: #087443;
}

.primary-btn {
    border-radius: 12px;
    background: linear-gradient(135deg, #2f6bff, #174ee8);
    box-shadow: 0 16px 32px rgba(47, 107, 255, 0.23);
}

.primary-btn:hover {
    background: linear-gradient(135deg, #3f7aff, #174ee8);
    transform: translateY(-1px);
}

.ghost-btn,
.danger-btn,
.icon-btn,
.mini-action {
    border-radius: 11px;
}

.modal {
    background: rgba(7, 12, 22, 0.56);
}

.modal-panel {
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 24px;
    background: #f7f9fc;
    box-shadow: 0 34px 110px rgba(0, 0, 0, 0.32);
}

.modal-head {
    background: #fff;
}

.modal-tabs {
    background: #0f172a;
}

.modal-tabs button {
    color: rgba(255, 255, 255, 0.64);
}

.modal-tabs button:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.modal-tabs button.active {
    background: linear-gradient(135deg, #2f6bff, #174ee8);
    color: #fff;
}

.config-tabs {
    background: #f4f6fb;
}

.config-panel {
    border-color: rgba(16, 24, 40, 0.08);
    border-radius: 20px;
}

.trace-popover {
    border-radius: 16px;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
}

@media (max-width: 1100px) {
    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 860px) {
    .sidebar {
        width: auto;
        background: #0b101a;
    }

    .main {
        margin-left: 0;
        padding: 18px;
    }

    .topbar-actions {
        width: 100%;
        justify-content: space-between;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* HH refined luxury-tech pass */
:root {
    --blue: #315caa;
    --blue-dark: #263f75;
    --red: #c6534a;
    --green: #2f8f65;
    --amber: #b9a06e;
    --ink: #171717;
    --muted: #6f706b;
    --line: rgba(29, 28, 25, 0.1);
    --soft: #f2f1ed;
    --panel: #fffdf8;
    --panel-muted: #f7f5ef;
    --shadow: 0 24px 70px rgba(32, 30, 25, 0.12);
}

body {
    background:
        radial-gradient(circle at 18% 0%, rgba(185, 160, 110, 0.16), transparent 30%),
        linear-gradient(180deg, #f6f5f1 0%, #eeefef 100%);
    color: var(--ink);
}

.sidebar {
    overflow-x: hidden;
    background:
        linear-gradient(180deg, #1c1d1f 0%, #141517 100%);
    box-shadow: 16px 0 44px rgba(29, 28, 25, 0.16);
}

.brand {
    background: rgba(255, 253, 248, 0.075);
    border: 1px solid rgba(255, 253, 248, 0.08);
    border-radius: 20px;
}

.brand strong {
    color: #f7f1e3;
}

.brand small,
.nav-label {
    color: rgba(247, 241, 227, 0.62);
}

.brand-mark {
    box-shadow:
        0 15px 32px rgba(0, 0, 0, 0.32),
        0 0 0 1px rgba(247, 241, 227, 0.12);
}

.group-list {
    overflow-x: hidden;
    padding-right: 0;
}

.group-item {
    width: 100%;
    min-width: 0;
    color: rgba(247, 241, 227, 0.78);
    background: transparent;
}

.group-item:hover {
    background: rgba(247, 241, 227, 0.08);
    color: #fffaf0;
}

.group-item.active {
    background: linear-gradient(135deg, #d8c28b, #b9a06e);
    color: #151513;
    box-shadow: 0 16px 34px rgba(185, 160, 110, 0.24);
}

.group-delete {
    flex: 0 0 auto;
    margin-left: 10px;
}

.side-tools {
    border-top-color: rgba(247, 241, 227, 0.1);
}

.sidebar .field {
    border-color: rgba(247, 241, 227, 0.13);
    background: rgba(255, 253, 248, 0.065);
    color: #fffaf0;
}

.sidebar .field:focus {
    border-color: rgba(216, 194, 139, 0.55);
    box-shadow: 0 0 0 3px rgba(216, 194, 139, 0.12);
}

.sidebar .field::placeholder {
    color: rgba(247, 241, 227, 0.42);
}

.domain-tools,
.domain-tools strong {
    color: #f7f1e3;
}

.domain-tools {
    border-top-color: rgba(247, 241, 227, 0.1);
}

.domain-item {
    border-color: rgba(247, 241, 227, 0.11);
    background: rgba(255, 253, 248, 0.055);
}

.main {
    background:
        linear-gradient(90deg, rgba(185, 160, 110, 0.08), transparent 260px),
        transparent;
}

.topbar h1 {
    color: #151513;
}

.system-pill,
.stat-card,
.table-wrap,
.config-panel,
.modal-head {
    background: #fffdf8;
}

.system-pill {
    border-color: rgba(185, 160, 110, 0.22);
    color: #4f4a3f;
}

.primary-btn {
    border: 1px solid rgba(216, 194, 139, 0.28);
    background: linear-gradient(135deg, #23211e, #141414);
    color: #fff7e6;
    box-shadow: 0 14px 30px rgba(23, 23, 23, 0.18);
}

.primary-btn:hover {
    background: linear-gradient(135deg, #2f2c27, #191817);
    box-shadow: 0 18px 36px rgba(23, 23, 23, 0.22);
}

.sidebar .primary-btn {
    border-color: rgba(216, 194, 139, 0.36);
    background: linear-gradient(135deg, #d8c28b, #b9a06e);
    color: #151513;
    box-shadow: 0 14px 28px rgba(185, 160, 110, 0.18);
}

.ghost-btn {
    border: 1px solid rgba(29, 28, 25, 0.08);
    background: #f2f0ea;
    color: #24231f;
}

.ghost-btn:hover {
    background: #e9e5d9;
}

.sidebar .ghost-btn {
    border-color: rgba(247, 241, 227, 0.16);
    background: rgba(255, 253, 248, 0.075);
    color: rgba(247, 241, 227, 0.82);
}

.danger-btn {
    background: rgba(198, 83, 74, 0.08);
    color: #b43831;
}

.stats-grid {
    gap: 16px;
}

.stat-card {
    border-color: rgba(29, 28, 25, 0.08);
    border-radius: 18px;
    box-shadow: 0 18px 46px rgba(32, 30, 25, 0.07);
}

.stat-card::before {
    height: 2px;
    background: #b9a06e;
}

.stat-card.tone-blue::before,
.stat-card.tone-slate::before {
    background: #b9a06e;
}

.stat-card.tone-green::before {
    background: #2f8f65;
}

.stat-card.tone-red::before {
    background: #c6534a;
}

.stat-card strong {
    color: #171717;
}

.table-wrap {
    border-color: rgba(29, 28, 25, 0.08);
    box-shadow: 0 22px 60px rgba(32, 30, 25, 0.08);
}

.data-table th {
    background: #f6f3ec;
    color: #6f6859;
}

.data-table tr:hover td {
    background: #fbf8f0;
}

.link-main {
    color: #2a2721;
    text-decoration: underline;
    text-decoration-color: rgba(185, 160, 110, 0.42);
    text-underline-offset: 3px;
}

.metric-pill {
    background: rgba(47, 143, 101, 0.1);
    color: #22764f;
}

.mini-select {
    background: #f2f0ea;
}

.modal {
    background: rgba(20, 20, 18, 0.48);
}

.modal-panel {
    background: #f3f1ed;
    border-color: rgba(255, 253, 248, 0.72);
}

.modal-tabs {
    background: #f0ede5;
    border-right-color: rgba(29, 28, 25, 0.08);
}

.modal-tabs button {
    color: #6f6859;
}

.modal-tabs button strong {
    color: inherit;
}

.modal-tabs button:hover {
    background: rgba(185, 160, 110, 0.13);
    color: #2a2721;
}

.modal-tabs button.active {
    background: linear-gradient(135deg, #23211e, #151513);
    color: #fff7e6;
    box-shadow: 0 14px 28px rgba(32, 30, 25, 0.18);
}

.config-tabs {
    background: #f3f1ed;
}

.source-card,
.region-picker,
.country-zone {
    background: #f7f5ef;
}

.option-grid label,
.country-grid label,
.check-row label {
    background: #fffdf8;
}

.option-grid label:has(input:checked),
.country-grid label:has(input:checked),
.check-row label:has(input:checked) {
    color: #2a2721;
    border-color: rgba(185, 160, 110, 0.42);
    background: rgba(185, 160, 110, 0.13);
}

.field:focus {
    border-color: rgba(185, 160, 110, 0.58);
    box-shadow: 0 0 0 3px rgba(185, 160, 110, 0.13);
}

.trace-popover-btn {
    background: rgba(185, 160, 110, 0.14);
    color: #5f4f2c;
}

.trace-popover-btn.active,
.trace-popover-btn:hover {
    background: #23211e;
    color: #fff7e6;
}

.trace-popover {
    background: #fffdf8;
    border-color: rgba(185, 160, 110, 0.2);
}

@media (max-width: 860px) {
    .sidebar {
        background: #1c1d1f;
    }
}

/* HH airy luxury-tech refinement */
:root {
    --blue: #4d75bf;
    --blue-dark: #345a9d;
    --red: #d45f58;
    --green: #36a979;
    --amber: #c7a968;
    --ink: #1d211f;
    --muted: #777970;
    --line: rgba(54, 50, 42, 0.1);
    --soft: #f7f6f1;
    --panel: #fffef9;
    --panel-muted: #faf8f1;
    --shadow: 0 24px 70px rgba(67, 61, 47, 0.1);
}

body {
    background:
        radial-gradient(circle at 12% -8%, rgba(219, 198, 145, 0.22), transparent 30%),
        radial-gradient(circle at 88% 0%, rgba(77, 117, 191, 0.1), transparent 28%),
        linear-gradient(180deg, #fbfaf6 0%, #f3f5f3 100%);
}

.login-shell {
    background:
        radial-gradient(circle at 28% 20%, rgba(219, 198, 145, 0.3), transparent 28%),
        radial-gradient(circle at 74% 72%, rgba(77, 117, 191, 0.16), transparent 32%),
        linear-gradient(180deg, #f9f6ee, #edf2f4);
}

.login-panel {
    border: 1px solid rgba(255, 255, 255, 0.8);
    background: rgba(255, 254, 249, 0.94);
    box-shadow: 0 28px 90px rgba(67, 61, 47, 0.14);
}

.sidebar {
    background:
        linear-gradient(180deg, rgba(255, 254, 249, 0.98) 0%, rgba(246, 243, 233, 0.97) 100%);
    color: #28251f;
    box-shadow:
        14px 0 42px rgba(67, 61, 47, 0.08),
        inset -1px 0 0 rgba(201, 174, 111, 0.14);
}

.brand {
    background: rgba(255, 255, 255, 0.72);
    border-color: rgba(201, 174, 111, 0.18);
    box-shadow: 0 12px 30px rgba(67, 61, 47, 0.07);
}

.brand strong {
    color: #24221d;
}

.brand small,
.nav-label {
    color: #8a8170;
}

.brand-mark {
    box-shadow:
        0 12px 26px rgba(67, 61, 47, 0.18),
        0 0 0 1px rgba(201, 174, 111, 0.22);
}

.group-item {
    color: #5e5c54;
}

.group-item:hover {
    background: rgba(201, 174, 111, 0.11);
    color: #22201b;
}

.group-item.active {
    background: linear-gradient(135deg, #fff7df, #e8d6a3);
    color: #26231d;
    box-shadow: 0 12px 28px rgba(201, 174, 111, 0.24);
}

.side-tools,
.domain-tools {
    border-top-color: rgba(201, 174, 111, 0.16);
}

.domain-tools,
.domain-tools strong {
    color: #26231d;
}

.sidebar .field {
    border-color: rgba(67, 61, 47, 0.12);
    background: rgba(255, 255, 255, 0.72);
    color: #24221d;
}

.sidebar .field::placeholder {
    color: #9b9588;
}

.sidebar .field:focus {
    border-color: rgba(201, 174, 111, 0.58);
    box-shadow: 0 0 0 3px rgba(201, 174, 111, 0.14);
}

.domain-item {
    border-color: rgba(201, 174, 111, 0.16);
    background: rgba(255, 255, 255, 0.66);
}

.domain-item b {
    color: #26231d;
}

.sidebar .ghost-btn {
    border-color: rgba(67, 61, 47, 0.12);
    background: rgba(255, 255, 255, 0.76);
    color: #514c40;
}

.sidebar .primary-btn {
    border-color: rgba(201, 174, 111, 0.45);
    background: linear-gradient(135deg, #fff5d9, #e5cf91);
    color: #24221d;
    box-shadow: 0 14px 28px rgba(201, 174, 111, 0.2);
}

.main {
    background:
        linear-gradient(90deg, rgba(201, 174, 111, 0.08), transparent 270px),
        transparent;
}

.topbar h1 {
    color: #20231f;
}

.topbar p {
    color: #71766f;
}

.primary-btn {
    border-color: rgba(201, 174, 111, 0.38);
    background: linear-gradient(135deg, #2d332f, #1d211f);
    color: #fff8e8;
    box-shadow: 0 14px 30px rgba(67, 61, 47, 0.17);
}

.primary-btn:hover {
    background: linear-gradient(135deg, #394039, #252a27);
}

.stat-card,
.table-wrap,
.config-panel,
.modal-head,
.system-pill {
    background: rgba(255, 254, 249, 0.96);
}

.stat-card {
    border-color: rgba(201, 174, 111, 0.14);
    box-shadow: 0 18px 42px rgba(67, 61, 47, 0.07);
}

.stat-card::before,
.stat-card.tone-blue::before,
.stat-card.tone-slate::before,
.stat-card.tone-amber::before {
    background: linear-gradient(90deg, #d9c081, #f1dfaa);
}

.stat-card strong {
    color: #20231f;
}

.stat-card span,
.stat-card small {
    color: #777970;
}

.table-wrap {
    border-color: rgba(201, 174, 111, 0.13);
    box-shadow: 0 22px 58px rgba(67, 61, 47, 0.08);
}

.data-table th {
    background: #fbf8ef;
    color: #77715f;
}

.data-table tr:hover td {
    background: #fffaf0;
}

.link-main {
    color: #2e3431;
}

.ghost-btn {
    background: #f7f3e8;
    color: #39352c;
}

.ghost-btn:hover {
    background: #efe6cf;
}

.modal {
    background: rgba(36, 34, 30, 0.34);
}

.modal-panel {
    background: rgba(248, 246, 239, 0.98);
    box-shadow: 0 34px 100px rgba(67, 61, 47, 0.22);
}

.modal-tabs {
    background: #f8f3e6;
    border-right-color: rgba(201, 174, 111, 0.17);
}

.modal-tabs button {
    color: #807865;
}

.modal-tabs button:hover {
    background: rgba(201, 174, 111, 0.12);
    color: #24221d;
}

.modal-tabs button.active {
    background: linear-gradient(135deg, #fff3d2, #e2ca86);
    color: #24221d;
    box-shadow: 0 14px 28px rgba(201, 174, 111, 0.22);
}

.config-tabs {
    background: #f5f3ed;
}

.source-card,
.region-picker,
.country-zone {
    background: #fbf8ef;
}

.option-grid label,
.country-grid label,
.check-row label {
    background: #fffef9;
}

.option-grid label:has(input:checked),
.country-grid label:has(input:checked),
.check-row label:has(input:checked) {
    border-color: rgba(201, 174, 111, 0.48);
    background: #fff6df;
}

@media (max-width: 860px) {
    .sidebar {
        background: #fffef9;
    }
}

/* HH clean porcelain-blue refinement */
:root {
    --blue: #4f68c8;
    --blue-dark: #344ea5;
    --red: #d75f64;
    --green: #2ea978;
    --amber: #7a8aa6;
    --ink: #172033;
    --muted: #6d7484;
    --line: rgba(31, 42, 68, 0.09);
    --soft: #f6f8fb;
    --panel: #ffffff;
    --panel-muted: #f8faff;
    --shadow: 0 24px 70px rgba(31, 42, 68, 0.1);
}

body {
    background:
        radial-gradient(circle at 10% -8%, rgba(116, 143, 214, 0.18), transparent 32%),
        radial-gradient(circle at 88% 2%, rgba(171, 193, 226, 0.16), transparent 30%),
        linear-gradient(180deg, #fbfcff 0%, #f1f5fa 100%);
    color: var(--ink);
}

.login-shell {
    background:
        radial-gradient(circle at 28% 20%, rgba(116, 143, 214, 0.22), transparent 30%),
        radial-gradient(circle at 76% 72%, rgba(196, 210, 232, 0.28), transparent 34%),
        linear-gradient(180deg, #fbfcff, #edf3f9);
}

.login-panel {
    border-color: rgba(255, 255, 255, 0.86);
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 28px 90px rgba(31, 42, 68, 0.14);
}

.sidebar {
    background: rgba(255, 255, 255, 0.92);
    color: #172033;
    box-shadow:
        14px 0 46px rgba(31, 42, 68, 0.08),
        inset -1px 0 0 rgba(31, 42, 68, 0.07);
}

.brand {
    background: linear-gradient(180deg, #ffffff, #f6f8fc);
    border-color: rgba(31, 42, 68, 0.08);
    box-shadow: 0 14px 34px rgba(31, 42, 68, 0.08);
}

.brand strong {
    color: #172033;
}

.brand small,
.nav-label {
    color: #7a8497;
}

.brand-mark {
    box-shadow:
        0 12px 26px rgba(31, 42, 68, 0.16),
        0 0 0 1px rgba(31, 42, 68, 0.1);
}

.group-item {
    color: #596274;
}

.group-item:hover {
    background: #f1f5ff;
    color: #172033;
}

.group-item.active {
    background: linear-gradient(135deg, #edf3ff, #dce8ff);
    color: #1f3b78;
    box-shadow: 0 12px 28px rgba(79, 104, 200, 0.14);
}

.side-tools,
.domain-tools {
    border-top-color: rgba(31, 42, 68, 0.08);
}

.domain-tools,
.domain-tools strong,
.domain-item b {
    color: #172033;
}

.sidebar .field {
    border-color: rgba(31, 42, 68, 0.11);
    background: #f8faff;
    color: #172033;
}

.sidebar .field::placeholder {
    color: #9aa3b3;
}

.sidebar .field:focus,
.field:focus {
    border-color: rgba(79, 104, 200, 0.48);
    box-shadow: 0 0 0 3px rgba(79, 104, 200, 0.11);
}

.domain-item {
    border-color: rgba(31, 42, 68, 0.08);
    background: #f8faff;
}

.sidebar .ghost-btn {
    border-color: rgba(31, 42, 68, 0.1);
    background: #f2f5fb;
    color: #4b5568;
}

.sidebar .primary-btn,
.primary-btn {
    border-color: rgba(79, 104, 200, 0.2);
    background: linear-gradient(135deg, #5c78d6, #3f5fbe);
    color: #fff;
    box-shadow: 0 14px 30px rgba(79, 104, 200, 0.2);
}

.sidebar .primary-btn:hover,
.primary-btn:hover {
    background: linear-gradient(135deg, #6b85dd, #435fc0);
    box-shadow: 0 18px 36px rgba(79, 104, 200, 0.22);
}

.main {
    background:
        linear-gradient(90deg, rgba(116, 143, 214, 0.08), transparent 280px),
        transparent;
}

.topbar h1 {
    color: #172033;
}

.topbar p,
.stat-card span,
.stat-card small {
    color: #6d7484;
}

.stat-card,
.table-wrap,
.config-panel,
.modal-head,
.system-pill {
    background: rgba(255, 255, 255, 0.96);
}

.stat-card {
    border-color: rgba(31, 42, 68, 0.08);
    box-shadow: 0 18px 42px rgba(31, 42, 68, 0.07);
}

.stat-card::before,
.stat-card.tone-blue::before,
.stat-card.tone-slate::before,
.stat-card.tone-amber::before {
    background: linear-gradient(90deg, #8fa8e8, #c3d4f5);
}

.stat-card.tone-green::before {
    background: #53bc8b;
}

.stat-card.tone-red::before {
    background: #e7797e;
}

.stat-card strong {
    color: #172033;
}

.table-wrap {
    border-color: rgba(31, 42, 68, 0.08);
    box-shadow: 0 22px 58px rgba(31, 42, 68, 0.08);
}

.data-table th {
    background: #f7f9fd;
    color: #697386;
}

.data-table tr:hover td {
    background: #f8fbff;
}

.link-main {
    color: #304fa9;
    text-decoration-color: rgba(79, 104, 200, 0.34);
}

.metric-pill {
    background: rgba(46, 169, 120, 0.11);
    color: #1f8a60;
}

.ghost-btn {
    border-color: rgba(31, 42, 68, 0.08);
    background: #f3f6fb;
    color: #344054;
}

.ghost-btn:hover {
    background: #e9eef8;
}

.danger-btn {
    background: rgba(215, 95, 100, 0.09);
    color: #c8464c;
}

.modal {
    background: rgba(23, 32, 51, 0.34);
}

.modal-panel {
    background: rgba(246, 248, 251, 0.98);
    box-shadow: 0 34px 100px rgba(31, 42, 68, 0.24);
}

.modal-tabs {
    background: #f4f7fc;
    border-right-color: rgba(31, 42, 68, 0.08);
}

.modal-tabs button {
    color: #6d7484;
}

.modal-tabs button:hover {
    background: #eaf0fb;
    color: #172033;
}

.modal-tabs button.active {
    background: linear-gradient(135deg, #5c78d6, #3f5fbe);
    color: #fff;
    box-shadow: 0 14px 28px rgba(79, 104, 200, 0.22);
}

.config-tabs {
    background: #f4f7fb;
}

.source-card,
.region-picker,
.country-zone {
    background: #f7f9fd;
}

.option-grid label,
.country-grid label,
.check-row label {
    background: #fff;
}

.option-grid label:has(input:checked),
.country-grid label:has(input:checked),
.check-row label:has(input:checked) {
    color: #1f3b78;
    border-color: rgba(79, 104, 200, 0.34);
    background: #edf3ff;
}

.trace-popover-btn {
    background: #edf3ff;
    color: #304fa9;
}

.trace-popover-btn.active,
.trace-popover-btn:hover {
    background: #405fbd;
    color: #fff;
}

.trace-popover {
    background: #fff;
    border-color: rgba(31, 42, 68, 0.1);
}

@media (max-width: 860px) {
    .sidebar {
        background: rgba(255, 255, 255, 0.96);
    }
}

select.field,
.mini-select {
    appearance: none;
    -webkit-appearance: none;
    background-color: #f8faff;
    background-image:
        linear-gradient(45deg, transparent 50%, #64748b 50%),
        linear-gradient(135deg, #64748b 50%, transparent 50%);
    background-position:
        calc(100% - 18px) 50%,
        calc(100% - 13px) 50%;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    border: 1px solid rgba(31, 42, 68, 0.1);
    color: #172033;
    cursor: pointer;
    outline: none;
    overflow: hidden;
    padding-right: 38px;
}

select.field {
    border-radius: 16px;
    font-weight: 750;
}

select.field:hover,
.mini-select:hover {
    border-color: rgba(79, 104, 200, 0.22);
    background-color: #f3f7ff;
}

select.field:focus,
.mini-select:focus {
    border-color: rgba(79, 104, 200, 0.48);
    box-shadow: 0 0 0 3px rgba(79, 104, 200, 0.11);
}

select.field option,
.mini-select option {
    background: #ffffff;
    color: #172033;
    font-weight: 700;
}

.mini-select {
    min-width: 110px;
    min-height: 36px;
    border-radius: 999px;
    background-color: #f3f6fb;
    font-size: 12px;
    font-weight: 800;
    padding: 0 34px 0 12px;
}

select.field:focus-visible,
.mini-select:focus-visible {
    outline: none;
}

.account-entry {
    justify-content: center;
}

.table-wrap {
    overflow: visible;
}

.custom-select {
    position: relative;
    width: 100%;
}

.custom-select-mini {
    display: inline-block;
    min-width: 110px;
    width: max-content;
}

.native-select-hidden {
    height: 1px !important;
    opacity: 0 !important;
    pointer-events: none !important;
    position: absolute !important;
    width: 1px !important;
}

.custom-select-button {
    align-items: center;
    background: #f8faff;
    border: 1px solid rgba(31, 42, 68, 0.1);
    border-radius: 16px;
    color: #172033;
    cursor: pointer;
    display: flex;
    font: inherit;
    font-weight: 750;
    justify-content: space-between;
    min-height: 42px;
    padding: 0 38px 0 13px;
    position: relative;
    text-align: left;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, transform 0.18s ease;
    width: 100%;
}

.custom-select-button::after {
    border-bottom: 2px solid #64748b;
    border-right: 2px solid #64748b;
    content: "";
    height: 7px;
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-62%) rotate(45deg);
    transition: transform 0.18s ease, border-color 0.18s ease;
    width: 7px;
}

.custom-select-button:hover {
    background: #f3f7ff;
    border-color: rgba(79, 104, 200, 0.22);
}

.custom-select.open .custom-select-button {
    background: #fff;
    border-color: rgba(79, 104, 200, 0.44);
    box-shadow: 0 0 0 3px rgba(79, 104, 200, 0.11), 0 14px 30px rgba(31, 42, 68, 0.1);
}

.custom-select.open .custom-select-button::after {
    border-color: #4f68c8;
    transform: translateY(-35%) rotate(225deg);
}

.custom-select-mini .custom-select-button {
    background: #f3f6fb;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    min-height: 36px;
    padding-left: 12px;
}

.custom-select-menu {
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(31, 42, 68, 0.1);
    border-radius: 16px;
    box-shadow: 0 22px 54px rgba(31, 42, 68, 0.16);
    display: none;
    left: 0;
    max-height: 240px;
    overflow: auto;
    padding: 6px;
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    z-index: 2600;
}

.custom-select.open .custom-select-menu {
    display: grid;
    gap: 3px;
}

.custom-select-option {
    background: transparent;
    border: 0;
    border-radius: 11px;
    color: #172033;
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    font-weight: 750;
    min-height: 34px;
    padding: 0 11px;
    text-align: left;
    transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.custom-select-option:hover {
    background: #f1f5ff;
    transform: translateX(1px);
}

.custom-select-option.active {
    background: linear-gradient(135deg, #edf3ff, #dce8ff);
    color: #1f3b78;
}

.account-panel {
    width: min(720px, 94vw);
    display: flex;
    flex-direction: column;
    max-height: min(860px, 94vh);
}

.account-headline {
    display: flex;
    align-items: center;
    gap: 14px;
}

.account-headline img {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    box-shadow: 0 12px 26px rgba(31, 42, 68, 0.14);
}

.account-body {
    display: grid;
    gap: 14px;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    background: #f6f8fb;
}

.account-card {
    padding: 18px;
    border: 1px solid rgba(31, 42, 68, 0.08);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 14px 34px rgba(31, 42, 68, 0.06);
}

.account-label {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

#accountUsername {
    display: block;
    margin-top: 6px;
    color: var(--ink);
    font-size: 28px;
    line-height: 1;
}

.account-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 16px;
}

.account-meta span {
    min-width: 0;
    padding: 11px 12px;
    border-radius: 12px;
    background: #f7f9fd;
    color: var(--muted);
    font-size: 12px;
    font-weight: 750;
}

.account-meta b {
    color: var(--ink);
    font-weight: 850;
}

.account-stats {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
}

.account-stats div {
    padding: 14px;
    border: 1px solid rgba(31, 42, 68, 0.08);
    border-radius: 16px;
    background: #fff;
}

.account-stats span {
    display: block;
    color: var(--muted);
    font-size: 11px;
    font-weight: 850;
}

.account-stats strong {
    display: block;
    margin-top: 8px;
    color: var(--ink);
    font-size: 22px;
}

.account-domain-list {
    display: grid;
    gap: 10px;
    margin-top: 14px;
}

.account-domain-list .domain-item {
    background: #f8faff;
    border-radius: 14px;
    padding: 12px;
}

.account-domain-list .domain-item b {
    font-size: 13px;
}

.password-card {
    display: grid;
    gap: 12px;
}

.account-actions,
.account-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.account-footer {
    background: #fff;
    flex: 0 0 auto;
    border-top: 1px solid var(--line);
}

@media (max-width: 720px) {
    .account-meta,
    .account-stats {
        grid-template-columns: 1fr;
    }
}
