* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, sans-serif;
    background: #f5f6fa;
    color: #222;
}

.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
}

.auth-card {
    width: 100%;
    max-width: 380px;
    background: #fff;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
}

.subtitle {
    margin-top: 0;
    color: #65708a;
}

.auth-form {
    display: grid;
    gap: 12px;
}

label {
    display: grid;
    gap: 6px;
    font-size: 14px;
}

input {
    border: 1px solid #ccd3e0;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
}

textarea {
    border: 1px solid #ccd3e0;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    font-family: inherit;
}

button {
    border: 0;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 14px;
    background: #2459ff;
    color: #fff;
    cursor: pointer;
}

.error {
    color: #c20028;
    margin: 0 0 12px;
}

.topbar {
    background: #fff;
    border-bottom: 1px solid #e0e4ef;
    padding: 10px 20px;
}

.topbar-main {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.brand-link {
    color: #1f2a44;
    text-decoration: none;
    font-size: 20px;
    font-weight: 700;
    line-height: 1;
}

.top-nav {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.topbar-statuses {
    margin-left: auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    font-size: 11px;
    line-height: 1.1;
    white-space: nowrap;
}

.topbar-status-item {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
}

.topbar-status-name {
    color: #72809b;
    font-weight: 600;
}

.topbar-status-item.is-ok .topbar-status-time {
    color: #0f6d34;
    font-weight: 600;
}

.topbar-status-item.is-fail .topbar-status-time {
    color: #981b1b;
    font-weight: 600;
}

.topbar-status-sep {
    color: #9aa6bf;
}

.nav-dropdown {
    position: relative;
}

.nav-dropdown > summary {
    list-style: none;
    cursor: pointer;
    border: 1px solid #d6deed;
    border-radius: 8px;
    background: #fff;
    color: #27395d;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    padding: 9px 12px;
    user-select: none;
}

.nav-dropdown > summary::-webkit-details-marker {
    display: none;
}

.nav-dropdown > summary::after {
    content: " \25BE";
    font-size: 11px;
    color: #7a879f;
    display: inline-block;
    transition: transform 0.18s ease;
}

.nav-dropdown[open] > summary,
.nav-dropdown.is-active > summary {
    background: #eef3ff;
    border-color: #b5c7ed;
    color: #1d315d;
}

.nav-dropdown[open] > summary::after {
    transform: rotate(180deg);
}

.nav-dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 200;
    min-width: 250px;
    background: #fff;
    border: 1px solid #d6deed;
    border-radius: 10px;
    box-shadow: 0 12px 24px rgba(31, 42, 68, 0.12);
    padding: 6px;
    display: grid;
    gap: 2px;
}

.top-nav-link {
    display: block;
    color: #3b4b6d;
    text-decoration: none;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 14px;
}

.top-nav-link:hover {
    background: #eef3ff;
    color: #1f2a44;
}

.top-nav-link.is-active {
    background: #2459ff;
    color: #fff;
}

.top-nav-divider {
    display: block;
    border-top: 1px solid #d6deed;
    margin: 4px 6px 2px;
}

.top-nav-direct-link {
    display: inline-flex;
    align-items: center;
    border: 1px solid #d6deed;
    border-radius: 8px;
    background: #fff;
    color: #27395d;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    padding: 9px 12px;
    text-decoration: none;
}

.top-nav-direct-link:hover {
    background: #eef3ff;
    border-color: #b5c7ed;
    color: #1d315d;
}

.top-nav-direct-link.is-active {
    background: #2459ff;
    border-color: #2459ff;
    color: #fff;
}

.muted {
    margin-left: 8px;
    color: #72809b;
}

@media (max-width: 900px) {
    .topbar-main {
        align-items: flex-start;
        gap: 12px;
    }

    .top-nav {
        width: 100%;
        gap: 8px;
    }

    .topbar-statuses {
        margin-left: 0;
        width: 100%;
        align-items: flex-start;
    }

    .nav-dropdown {
        width: 100%;
    }

    .nav-dropdown > summary {
        width: 100%;
    }

    .nav-dropdown-menu {
        position: static;
        min-width: 100%;
        box-shadow: none;
        margin-top: 4px;
    }

    .top-nav-direct-link {
        width: 100%;
        justify-content: center;
    }
}

.container {
    max-width: 1920px;
    margin: 0 auto;
    padding: 20px;
}

.card {
    background: #fff;
    border: 1px solid #e0e4ef;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 16px;
}

.inline-form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.inline-form input,
.inline-form select {
    min-width: 160px;
}

.filter-form {
    gap: 10px;
}

.filter-form input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]),
.filter-form select,
.filter-form button {
    min-height: 40px;
    padding: 0 12px;
    border: 1px solid #ccd3e0;
    border-radius: 8px;
    background: #fff;
    color: #1f2a44;
    font-size: 14px;
}

.filter-form button {
    min-width: 120px;
    font-weight: 600;
}

.filter-form input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):focus,
.filter-form select:focus,
.filter-form button:focus {
    outline: none;
    border-color: #2459ff;
    box-shadow: 0 0 0 2px rgba(36, 89, 255, 0.12);
}

.domain-create-inline {
    flex-wrap: nowrap;
    overflow-x: auto;
}

.domain-create-domain-input {
    min-width: 260px;
}

.domain-create-account-select {
    min-width: 180px;
}

.domain-create-inline .domain-create-tags-select,
.domain-create-inline .ts-wrapper {
    min-width: 320px;
    width: 320px;
}

.domain-create-inline .ts-control {
    min-height: 40px;
    border: 1px solid #ccd3e0;
    border-radius: 8px;
    padding: 7px 10px;
    box-shadow: none;
    flex-wrap: nowrap;
    overflow-x: auto;
    white-space: nowrap;
}

.domain-create-inline .ts-wrapper.focus .ts-control {
    border-color: #2459ff;
    box-shadow: 0 0 0 2px rgba(36, 89, 255, 0.12);
}

.domain-create-inline .ts-control > .item {
    white-space: nowrap;
}

.domain-create-inline .ts-control > input {
    font-size: 14px;
    line-height: 1.2;
    min-width: 80px;
}

.domain-create-inline .ts-dropdown {
    border: 1px solid #ccd3e0;
    border-radius: 8px;
    margin-top: 4px;
    z-index: 2100;
}

.offline-edit-form {
    flex-direction: column;
    align-items: stretch;
    max-width: 700px;
}

.offline-edit-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
}

.offline-edit-field__label {
    color: #4d5a78;
    font-size: 13px;
    font-weight: 600;
}

.offline-edit-form input:not([type="hidden"]),
.offline-edit-form select {
    width: 100%;
    min-width: 0;
}

.offline-edit-actions {
    justify-content: flex-start;
    margin-top: 6px;
}

.select-substring-popover {
    position: absolute;
    z-index: 1200;
    background: #fff;
    border: 1px solid #ccd3e0;
    border-radius: 8px;
    box-shadow: 0 12px 28px rgba(31, 42, 68, 0.18);
    padding: 8px;
}

.select-substring-popover__input {
    width: 100%;
    min-height: 40px;
    padding: 0 12px;
    border: 1px solid #ccd3e0;
    border-radius: 8px;
    background: #fff;
    color: #1f2a44;
    font-size: 14px;
    margin-bottom: 8px;
}

.select-substring-popover__input:focus {
    outline: none;
    border-color: #2459ff;
    box-shadow: 0 0 0 2px rgba(36, 89, 255, 0.12);
}

.select-substring-popover__list {
    max-height: 260px;
    overflow-y: auto;
    border: 1px solid #e7ebf3;
    border-radius: 8px;
    background: #fff;
}

.select-substring-popover__option {
    width: 100%;
    min-height: 36px;
    padding: 6px 10px;
    border: 0;
    border-bottom: 1px solid #eef1f7;
    background: #fff;
    color: #1f2a44;
    font-size: 14px;
    text-align: left;
    cursor: pointer;
}

.select-substring-popover__option:last-child {
    border-bottom: 0;
}

.select-substring-popover__option:hover,
.select-substring-popover__option.is-highlighted {
    background: #f2f6ff;
}

.select-substring-popover__option.is-selected {
    font-weight: 600;
}

.select-substring-popover__option:disabled {
    color: #96a0b8;
    cursor: not-allowed;
    background: #fff;
}

.select-substring-popover__empty {
    padding: 10px 12px;
    color: #7885a3;
    font-size: 13px;
}

.flatpickr-alt-input[readonly] {
    background: #fff;
    cursor: pointer;
}

.flatpickr-calendar {
    border: 1px solid #d6deed;
    box-shadow: 0 12px 24px rgba(31, 42, 68, 0.12);
}

.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange {
    background: #2459ff;
    border-color: #2459ff;
}

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

.table th,
.table td {
    border-bottom: 1px solid #e7ebf3;
    padding: 4px;
    vertical-align: middle;
    text-align: left;
    font-size: 14px;
}

.table-select-current {
    display: block;
    color: #4d5a78;
    font-size: 13px;
    line-height: 1.3;
}

.table-inline-select {
    position: relative;
}

.table-select-current-trigger {
    width: 100%;
    min-height: 32px;
    padding: 3px 8px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.table-select-current-trigger:hover {
    background: #f5f8ff;
    border-color: #d9e3fb;
}

.table-select-current-trigger:focus {
    outline: none;
    border-color: #2459ff;
    box-shadow: 0 0 0 2px rgba(36, 89, 255, 0.12);
}

.table-inline-select .js-inline-select-control {
    display: none;
    position: absolute;
    left: 0;
    top: calc(100% + 4px);
    min-width: 260px;
    max-width: 420px;
    z-index: 40;
    box-shadow: 0 10px 24px rgba(31, 42, 68, 0.18);
    background: #fff;
}

.table-inline-select.is-open .js-inline-select-control {
    display: block;
}

.th-sort {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.th-sort-label {
    display: inline-block;
}

.sort-arrows {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.sort-arrow {
    color: #90a0bd;
    text-decoration: none;
    font-size: 12px;
    line-height: 1;
    padding: 0 1px;
}

.sort-arrow:hover {
    color: #2459ff;
}

.sort-arrow.is-active {
    color: #2459ff;
    font-weight: 700;
}

.table select,
.table input {
    width: 100%;
}

.table td input:not([type="checkbox"]):not([type="radio"]),
.table td select,
.table td button:not(.btn-icon) {
    min-height: 36px;
}

.table td textarea {
    width: 100%;
    min-height: 72px;
    resize: vertical;
}

input[type="checkbox"],
input[type="radio"] {
    width: 16px;
    min-width: 16px;
    height: 16px;
    min-height: 16px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 4px;
    accent-color: #2459ff;
}

.table input[type="checkbox"],
.table input[type="radio"] {
    width: 16px;
}

.table-form-controls select {
    min-height: 40px;
    padding: 0 12px;
    border: 1px solid #ccd3e0;
    border-radius: 8px;
    background: #fff;
    color: #1f2a44;
    font-size: 14px;
}

.table-form-controls select:focus {
    outline: none;
    border-color: #2459ff;
    box-shadow: 0 0 0 2px rgba(36, 89, 255, 0.12);
}

select.tags-multiselect {
    min-height: 40px;
    padding: 0 12px;
}

.table .ts-wrapper {
    width: 100%;
}

.table .ts-control {
    min-height: 36px;
    border: 1px solid #ccd3e0;
    border-radius: 8px;
    padding: 5px 10px;
    box-shadow: none;
    flex-wrap: nowrap;
    overflow-x: auto;
    white-space: nowrap;
}

.table .ts-control > .item {
    white-space: nowrap;
}

.table .ts-wrapper.focus .ts-control {
    border-color: #2459ff;
    box-shadow: 0 0 0 2px rgba(36, 89, 255, 0.12);
}

.table .ts-dropdown {
    z-index: 2100;
}

.table tr.row-no-revenue td {
    background: rgba(220, 53, 69, 0.12);
}

.table tr.row-traffic-no-conversions td {
    background: rgba(255, 152, 0, 0.12);
}

.domain-status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.domain-status-badge--active {
    background: rgba(40, 167, 69, 0.14);
    color: #0f6d34;
}

.domain-status-badge--inactive {
    background: rgba(100, 116, 139, 0.16);
    color: #475569;
}

.domain-status-badge--warm {
    background: rgba(255, 152, 0, 0.16);
    color: #8a4a00;
}

.table tr.row-offer-eff-inefficient td {
    background: rgba(220, 53, 69, 0.12);
}

.table tr.row-offer-eff-warning td {
    background: rgba(255, 152, 0, 0.12);
}

.eff-status-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.eff-status-inefficient {
    background: rgba(220, 53, 69, 0.12);
    color: #8b1f2a;
}

.eff-status-warning {
    background: rgba(255, 152, 0, 0.16);
    color: #8a4a00;
}

.eff-status-effective {
    background: rgba(40, 167, 69, 0.14);
    color: #0f6d34;
}

.eff-status-insufficient {
    background: rgba(100, 116, 139, 0.14);
    color: #334155;
}

.eff-alert-list {
    margin: 8px 0 14px;
    padding-left: 20px;
}

.offline-upload-status-badge {
    display: inline-flex;
    align-items: center;
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.offline-upload-status-badge.status-new {
    background: #ffffff;
    border-color: #cbd5e1;
    color: #475569;
}

.offline-upload-status-badge.status-uploading {
    background: rgba(255, 152, 0, 0.16);
    color: #8a4a00;
}

.offline-upload-status-badge.status-success {
    background: rgba(40, 167, 69, 0.14);
    color: #0f6d34;
}

.offline-upload-status-badge.status-failed,
.offline-upload-status-badge.status-skipped {
    background: rgba(100, 116, 139, 0.14);
    color: #334155;
}

.offline-upload-status-badge.status-failed {
    background: rgba(220, 53, 69, 0.12);
    color: #8b1f2a;
}

.offline-upload-status-badge.status-linkage-failed {
    background: rgba(250, 204, 21, 0.2);
    color: #854d0e;
}

.offline-comment-col {
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.offline-conversions-actions {
    margin-top: 12px;
}

.offline-status-dot {
    display: inline-block;
    width: 12px;
    min-width: 12px;
    height: 12px;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    background: #ffffff;
    vertical-align: middle;
}

.offline-status-dot-new {
    background: #ffffff;
    border-color: #cbd5e1;
}

.offline-status-dot-success {
    background: #22c55e;
    border-color: #15803d;
}

.offline-status-dot-uploading {
    background: #f59e0b;
    border-color: #b45309;
}

.offline-status-dot-linkage-failed {
    background: #facc15;
    border-color: #ca8a04;
}

.offline-status-dot-error {
    background: #ef4444;
    border-color: #b91c1c;
}

.offline-status-dot-skipped {
    background: #94a3b8;
    border-color: #64748b;
}

.table tr.row-upload-error td {
    background: rgba(220, 53, 69, 0.12);
}

.table tr.row-upload-pending td {
    background: rgba(255, 152, 0, 0.12);
}

.table tr.row-upload-success td {
    background: rgba(40, 167, 69, 0.12);
}

.table tr.row-upload-linkage-failed td {
    background: rgba(250, 204, 21, 0.24);
}

.table tr.row-upload-skipped td {
    background: rgba(148, 163, 184, 0.18);
}

.table tr.row-status-rejected td {
    background: rgba(220, 53, 69, 0.12);
}

.table tr.row-status-pending td {
    background: rgba(255, 152, 0, 0.12);
}

.table tr.row-status-approved td {
    background: rgba(40, 167, 69, 0.12);
}

.table tfoot tr.row-total td {
    font-weight: 700;
    background: #eef3ff;
}

.table tbody tr.row-total td {
    font-weight: 700;
    background: #eef3ff;
}

.table tr td.expense-missing-source {
    background: #f3f4f6;
}

.table tr td.profit-negative {
    background: rgba(220, 53, 69, 0.2);
    color: #8b1f2a;
    font-weight: 600;
}

.table td.leads-metric {
    font-weight: 700;
    color: #1f2a44;
}

.conversions-groups-table .group-col-last {
    border-right: 2px solid #d6deed;
}

.conversions-groups-table .metric-col-first {
    border-left: 2px solid #d6deed;
}

.conversions-groups-table tr.row-group-even td {
    background: #ffffff;
}

.conversions-groups-table tr.row-group-alt td {
    background: #f6f8fc;
}

.logs-import-jobs-table,
.logs-api-errors-table,
.logs-token-alerts-table {
    table-layout: fixed;
}

.logs-import-jobs-table .log-col-message,
.logs-api-errors-table .log-col-message,
.logs-token-alerts-table .log-col-message {
    width: 280px;
    max-width: 280px;
}

.logs-token-alerts-table .log-col-token {
    width: 260px;
    max-width: 260px;
}

.logs-token-alerts-table .log-col-type {
    width: 140px;
    max-width: 140px;
}

.logs-token-alerts-table .log-col-site {
    width: 180px;
    max-width: 180px;
}

.logs-token-alerts-table .log-kind-text {
    display: inline-block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
}

.logs-import-jobs-table tr.row-import-failed td {
    background: rgba(220, 53, 69, 0.12);
}

.logs-token-alerts-table tr.row-token-alert td {
    background: rgba(220, 53, 69, 0.08);
}

.log-message-cell {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.log-message-text {
    display: inline-block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.log-copy-btn {
    flex: 0 0 auto;
}

.logs-api-errors-table td pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 140px;
    overflow: auto;
}

.risk-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 10px;
}

.risk-counter {
    display: inline-block;
    border: 1px solid #f0b7bd;
    border-radius: 999px;
    padding: 4px 10px;
    background: rgba(220, 53, 69, 0.08);
    color: #8b1f2a;
    font-size: 13px;
    font-weight: 600;
}

.row-form {
    display: contents;
}

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

.flash {
    border-radius: 8px;
    padding: 10px 12px;
    margin: 0 0 12px;
}

.flash-success {
    background: #eaf8ef;
    color: #0f6d34;
}

.flash-error {
    background: #fdecec;
    color: #981b1b;
}

.offline-toast-stack {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 1200;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    pointer-events: none;
}

.offline-toast {
    min-width: 260px;
    max-width: 420px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #d6deed;
    background: #ffffff;
    box-shadow: 0 10px 24px rgba(20, 28, 46, 0.14);
    line-height: 1.3;
    word-break: break-word;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.24s ease, transform 0.24s ease;
    pointer-events: auto;
}

.offline-toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.offline-toast--success {
    color: #15803d;
}

.offline-toast--error {
    color: #b91c1c;
}

.test-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
}

.test-indicator-ok {
    color: #15803d;
}

.test-indicator-error {
    color: #b91c1c;
}

.test-indicator-empty {
    color: transparent;
}

.test-result-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.test-result-inline-text {
    display: inline-block;
    flex: 1 1 auto;
    min-width: 0;
    max-width: 80ch;
    font-size: 12px;
    line-height: 1.25;
    color: #72809b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.test-result-inline-text.is-ok {
    color: #15803d;
}

.test-result-inline-text.is-error {
    color: #b91c1c;
}

.btn-link {
    color: #2459ff;
    text-decoration: none;
}

.domain-cell {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.domain-open-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    min-width: 20px;
    height: 20px;
    min-height: 20px;
    border: 1px solid #ccd3e0;
    border-radius: 4px;
    background: #fff;
    color: #7f8aa2;
    text-decoration: none;
    line-height: 1;
}

.domain-open-btn:hover {
    border-color: #9fb2d9;
    color: #5f6b83;
}

.domain-open-btn--symbol {
    font-size: 12px;
}

.domain-open-icon {
    width: 12px;
    height: 12px;
    fill: currentColor;
}

.table th.domain-yandex-accounts-col,
.table td.domain-yandex-accounts-col {
    width: 130px;
    min-width: 130px;
    max-width: 230px;
}

.domain-yandex-accounts-cell {
    display: inline-flex;
    align-items: flex-start;
    gap: 6px;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.3;
}

.domain-yandex-accounts-cell span {
    min-width: 0;
}

.domain-meta-secondary {
    margin: 6px 0 12px;
    font-size: 18px;
    font-weight: bold;
}

.domain-meta-tags {
    margin: 0 0 12px;
}

.expense-cell {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.coupon-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-left: 6px;
    border-radius: 50%;
    background: #ecfdf5;
    color: #047857;
    font-weight: 700;
    vertical-align: middle;
}

.domain-details-top-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 16px;
    align-items: start;
}

.domain-goals-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.domain-goals-title-wrap h2 {
    margin: 0;
}

.domain-goals-meta-line {
    margin: 4px 0 0;
    color: #5f6b83;
    font-size: 12px;
}

.domain-filter-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.domain-goals-preset-buttons {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.domain-goals-add-textarea {
    width: 100%;
    min-height: 220px;
    font-family: Consolas, "Courier New", monospace;
    font-size: 13px;
}

.domain-goals-add-hint {
    margin: 0;
}

.domain-goals-wrap {
    overflow-x: auto;
}

.domain-goals-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

#domain-goals-table .js-goal-name-input {
    min-width: 260px;
}

#domain-goals-table .js-goal-parameter-input {
    min-width: 220px;
}

.domain-details-top-table {
    overflow-x: auto;
}

.domain-details-note {
    border: 1px solid #e0e4ef;
    border-radius: 10px;
    background: #f7f9ff;
    padding: 12px;
}

.domain-details-note h3 {
    margin: 0 0 10px;
    font-size: 14px;
}

.domain-note-form {
    display: grid;
    gap: 10px;
}

.domain-tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.domain-tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid #d6deed;
    border-radius: 999px;
    background: #eef3ff;
    color: #1f2a44;
    padding: 2px 6px 2px 10px;
}

.domain-tag-chip .btn-icon {
    width: 20px;
    min-width: 20px;
    height: 20px;
    min-height: 20px;
    border-radius: 999px;
    font-size: 12px;
}

.domain-tag-add-form {
    margin-bottom: 12px;
}

.domain-note-form textarea {
    min-height: 220px;
    resize: vertical;
}

.bulk-import-textarea {
    width: 100%;
    min-height: 280px;
    resize: vertical;
}

button.btn-icon {
    width: 20px;
    min-width: 20ox;
    height: 20px;
    min-height: 20px;
    padding: 0;
    border: 1px solid #ccd3e0;
    border-radius: 4px;
    background: #fff;
    color: #7f8aa2;
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
    align-content: flex-end;
    justify-content: center;
    padding-top: 3px;
}

button.btn-icon:hover {
    border-color: #9fb2d9;
    color: #1f2a44;
}

button.btn-secondary {
    border: 1px solid #ccd3e0;
    background: #fff;
    color: #1f2a44;
}

button.btn-danger {
    border: 1px solid #d97785;
    background: #fff1f3;
    color: #991b2e;
}

button.btn-danger:hover {
    border-color: #c95f6e;
    background: #ffe8ec;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(25, 34, 51, 0.35);
}

.modal-overlay[hidden] {
    display: none;
}

.modal-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border: 1px solid #d9e0ee;
    border-radius: 12px;
    padding: 16px;
}

.modal-card h3 {
    margin: 0 0 12px;
}

.modal-form {
    display: grid;
    gap: 12px;
}

.modal-form select {
    min-height: 40px;
    padding: 0 12px;
    border: 1px solid #ccd3e0;
    border-radius: 8px;
    background: #fff;
    color: #1f2a44;
    font-size: 14px;
}

.modal-form select:focus {
    outline: none;
    border-color: #2459ff;
    box-shadow: 0 0 0 2px rgba(36, 89, 255, 0.12);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.console-output {
    margin: 0;
    padding: 10px 12px;
    border: 1px solid #d6deed;
    border-radius: 8px;
    background: #f7f9ff;
    white-space: pre-wrap;
    word-break: break-word;
}

.chart-wrap {
    position: relative;
    min-height: 360px;
}

.chart-canvas {
    width: 100%;
    height: 360px;
}

.chart-empty {
    margin-top: 8px;
}

.help-card {
    max-width: 980px;
}

.help-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.help-header h2 {
    margin: 0;
}

.help-edit-toggle {
    width: 34px;
    min-width: 34px;
    height: 34px;
    min-height: 34px;
    padding-top: 0;
    font-size: 16px;
}

.help-editor-form {
    display: grid;
    gap: 10px;
}

.help-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.help-toolbar[hidden],
.help-actions[hidden] {
    display: none !important;
}

.help-toolbar-btn {
    min-width: 44px;
    min-height: 34px;
    padding: 6px 10px;
    line-height: 1;
}

.help-content {
    min-height: 280px;
    border: 1px solid #d6deed;
    border-radius: 10px;
    background: #fff;
    padding: 14px;
    line-height: 1.45;
}

.help-content.is-editing {
    border-color: #2459ff;
    box-shadow: 0 0 0 2px rgba(36, 89, 255, 0.12);
}

.help-content h2,
.help-content h3,
.help-content h4 {
    margin: 0 0 8px;
}

.help-content p,
.help-content ol,
.help-content ul,
.help-content blockquote {
    margin: 0 0 12px;
}

.help-content code {
    background: #f1f4fa;
    border-radius: 6px;
    padding: 1px 6px;
}

.help-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.table input.postback-link-input {
    width: auto;
    min-width: 0;
    flex: 1 1 auto;
}

.postback-inline {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
    width: 100%;
}

.postback-strategy-select {
    width: 100%;
    min-width: 0;
}

.postback-generate-modal-domain-line {
    margin: 0 0 12px;
}

.table input.start-time-input {
    width: 120px;
    min-width: 120px;
}

.table th.start-time-col,
.table td.start-time-col {
    width: 128px;
    min-width: 128px;
    max-width: 128px;
}

.postback-action-btn {
    width: 30px;
    min-width: 30px;
    height: 30px;
    min-height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #ccd3e0;
    border-radius: 6px;
    background: #fff;
    color: #1f2a44;
    padding: 0;
    line-height: 1;
    font-size: 14px;
}

.offline-conversions-table th,
.offline-conversions-table td {
    border-bottom-color: #cfd7e6;
}

.offline-conversions-table th.offline-upload-status-col,
.offline-conversions-table td.offline-upload-status-col {
    width: 120px;
    min-width: 120px;
    max-width: 120px;
}

.offline-conversions-table .offline-upload-status-select {
    width: 100%;
    min-width: 0;
    max-width: 120px;
}

.offline-conversions-table th.offline-offer-name-col,
.offline-conversions-table td.offline-offer-name-col {
    width: 80px;
    min-width: 80px;
    max-width: 80px;
}

.offline-offer-name-text {
    display: block;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.postback-action-link {
    text-decoration: none;
}

.postback-action-btn:hover:not(:disabled),
.postback-action-link:hover {
    border-color: #9fb2d9;
    color: #1f2a44;
}

.postback-action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.postback-action-delete {
    color: #991b2e;
    border-color: #d97785;
}

.domains-table th.update-col,
.domains-table td.update-col,
.domains-table th.delete-col,
.domains-table td.delete-col {
    width: 86px;
    min-width: 86px;
}

.domains-table th.postback-col,
.domains-table td.postback-col {
    padding-right: 16px;
}

.domains-table th.update-col,
.domains-table td.update-col {
    padding-left: 26px;
    padding-right: 2px;
}

.domains-table th.delete-col,
.domains-table td.delete-col {
    padding-left: 2px;
}

.domains-pagination-summary {
    margin: 10px 0;
    color: #4a5770;
    font-size: 13px;
}

.domains-pagination {
    margin-top: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.domains-pagination-link {
    color: #2459ff;
    text-decoration: none;
    font-size: 14px;
}

.domains-pagination-link:hover {
    text-decoration: underline;
}

.domains-pagination-current {
    color: #4a5770;
    font-size: 14px;
}

.preferences-note {
    margin: 6px 0 12px;
}

.preferences-table .preferences-key-col {
    width: 260px;
    white-space: nowrap;
}

.preferences-value-input {
    width: 100%;
    min-width: 280px;
}

.preferences-actions {
    margin-top: 12px;
}

.postback-file-form {
    display: grid;
    gap: 10px;
}

.postback-file-editor-source {
    width: 100%;
    min-height: 520px;
    font-family: Consolas, "Courier New", monospace;
    font-size: 13px;
    line-height: 1.45;
}

.postback-file-editor-source[hidden] {
    display: none;
}

.postback-file-editor-ace {
    width: 100%;
    min-height: 560px;
    border: 1px solid #ccd3e0;
    border-radius: 8px;
}

.postback-file-actions {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
}

@media (max-width: 1200px) {
    .domain-create-inline .domain-create-tags-select,
    .domain-create-inline .ts-wrapper {
        min-width: 260px;
        width: 260px;
    }

    .domain-details-top-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .domain-create-inline .domain-create-tags-select,
    .domain-create-inline .ts-wrapper {
        min-width: 220px;
        width: 220px;
    }
}
