@charset "UTF-8";

:root {
    color-scheme: light;
    --page: #ffffff;
    --panel: #ffffff;
    --section: #f8fafb;
    --line: #dfe5ea;
    --input-line: #c9d1d8;
    --text: #333333;
    --text-soft: #414b56;
    --muted: #6f7c87;
    --link: #2067b0;
    --control-bg: #e1e6e7;
    --control-bg-active: #ced3d4;
    --control-border: #bec3c4;
    --control-text: #656767;
    --control-text-active: #2c2d2e;
    --green: #00b263;
    --red: #d93025;
    --shadow-menu: 0 10px 28px rgba(0, 0, 0, .18);
    --font: "SF Pro Display", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--page);
    color: var(--text);
    font: 14px/1.45 var(--font);
}

a {
    color: var(--link);
    text-decoration: none;
    font-weight: 500;
}

a:hover {
    text-decoration: underline;
}

.app-shell {
    min-height: 100vh;
    padding: 22px 24px 36px;
}

.topbar {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    justify-content: space-between;
    border-bottom: 1px solid var(--line);
    padding-bottom: 18px;
}

.topbar h1,
.install-box h1 {
    margin: 0 0 6px;
    font-size: 26px;
    font-weight: 500;
    line-height: 1.2;
}

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 0 15px;
    font: inherit;
    font-size: 14px;
    font-weight: 400;
    line-height: 34px;
    cursor: pointer;
    white-space: nowrap;
}

.btn-black {
    background: #2a2f33;
    border-color: #2a2f33;
    color: #ffffff;
}

.btn-black:hover {
    background: #191b1e;
    border-color: #191b1e;
    text-decoration: none;
}

.btn-outline-green {
    background: #f2fff8;
    border-color: var(--green);
    color: var(--green);
}

.btn-outline-green:hover {
    background: #e7f9ef;
    border-color: #009b56;
    color: #009b56;
}

.btn-gray {
    border-color: transparent;
    background: var(--control-bg);
    color: var(--control-text);
}

.btn-gray:hover {
    border-color: var(--control-border);
    background: var(--control-bg-active);
    color: var(--control-text-active);
}

.filters {
    display: grid;
    grid-template-columns: minmax(150px, 180px) minmax(180px, 190px) minmax(180px, 190px) minmax(240px, 300px);
    gap: 12px;
    align-items: end;
    padding: 18px 0;
    border-bottom: 1px solid var(--line);
}

.filter-field {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.filter-field > span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 400;
}

.filter-dropdown {
    position: relative;
}

.select-btn {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 5.5px;
    width: 100%;
    min-height: 34px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: var(--control-bg);
    color: var(--control-text);
    padding: 0 15px;
    font: inherit;
    font-size: 14px;
    font-weight: 400;
    line-height: 1;
    cursor: pointer;
}

.filter-dropdown.is-open .select-btn,
.select-btn:hover {
    border-color: var(--control-border);
    background: var(--control-bg-active);
    color: var(--control-text-active);
}

.select-btn span:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 9px;
    height: 5px;
    overflow: hidden;
    flex: 0 0 auto;
    font-size: 0;
    line-height: 1;
    transform: translateY(1.5px);
}

.arrow::before {
    content: "";
    display: block;
    width: 9px;
    height: 5px;
    background: currentColor;
    mask: url("data:image/svg+xml,%3Csvg width='9' height='5' viewBox='0 0 9 5' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l3.5 3L8 1' fill='none' stroke='black' stroke-width='1.1' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
    -webkit-mask: url("data:image/svg+xml,%3Csvg width='9' height='5' viewBox='0 0 9 5' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l3.5 3L8 1' fill='none' stroke='black' stroke-width='1.1' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}

.dropdown-demo {
    position: absolute;
    z-index: 20;
    top: calc(100% + 8px);
    left: 0;
    width: max-content;
    min-width: 220px;
    max-width: min(360px, calc(100vw - 38px));
    max-height: 360px;
    overflow: auto;
    padding: 12px 0;
    border-radius: 18px;
    background: #ffffff;
    box-shadow: var(--shadow-menu);
}

.dropdown-search {
    width: calc(100% - 38px);
    min-height: 34px;
    border: 1px solid var(--input-line);
    border-radius: 8px;
    margin: 0 19px;
    padding: 0 10px;
    color: #686868;
    font: inherit;
}

.dropdown-search:focus {
    outline: none;
    border-color: var(--link);
}

.dropdown-actions {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin: 8px 19px 0;
}

.dropdown-actions button {
    border: 0;
    background: transparent;
    color: var(--link);
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    padding: 4px 0;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 220px;
    min-height: 44px;
    padding: 0 19px;
    color: #686868;
    font-size: 15px;
    font-weight: 400;
    white-space: nowrap;
    cursor: pointer;
}

.dropdown-item:hover {
    background: #f7f7f7;
}

.dropdown-item[hidden] {
    display: none !important;
}

.check {
    width: 15px;
    height: 15px;
    margin: 0;
    accent-color: #2067b0;
}

.b24-date-control {
    position: relative;
    width: 100%;
    height: 34px;
}

.b24-date-input {
    width: 100%;
    height: 34px;
    border: 1px solid var(--input-line);
    border-radius: 8px;
    outline: none;
    padding: 0 12px 0 35px;
    background: #ffffff;
    color: #404a54;
    font: 400 14px/34px var(--font);
    transition: border-color .12s ease;
}

.b24-date-input:focus,
.b24-date-control.is-open .b24-date-input {
    border-color: #0077ff;
    box-shadow: none;
}

.b24-calendar-trigger {
    position: absolute;
    z-index: 2;
    left: 9px;
    top: 50%;
    width: 18px;
    height: 18px;
    border: 0;
    padding: 0;
    background: transparent;
    color: #a4afb9;
    transform: translateY(-50%);
    cursor: pointer;
}

.b24-calendar-trigger svg {
    display: block;
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.35;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.b24-calendar-popover {
    position: absolute;
    z-index: 25;
    top: 42px;
    left: 0;
    width: 272px;
    height: 304px;
    padding: 14px 10px 10px;
    border-radius: 18px;
    background: #ffffff;
    box-shadow: var(--shadow-menu);
    color: #333333;
    font-weight: 400;
    user-select: none;
}

.b24-calendar-head {
    display: grid;
    grid-template-columns: 28px 1fr 28px;
    align-items: center;
    height: 30px;
    margin-bottom: 6px;
}

.b24-calendar-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: #323840;
    font-size: 15px;
    font-weight: 500;
    text-align: center;
}

.b24-title-button,
.b24-nav-button,
.b24-day-button,
.b24-picker-button {
    border: 0;
    padding: 0;
    background: transparent;
    font: inherit;
    cursor: pointer;
}

.b24-title-button {
    height: 28px;
    padding: 0 3px;
    border-radius: 4px;
    color: inherit;
    font-weight: 500;
}

.b24-title-button:hover {
    color: #007aa3;
}

.b24-title-text {
    line-height: 28px;
}

.b24-nav-button {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    color: #a7adb5;
}

.b24-nav-button:hover {
    color: #505c6a;
}

.b24-nav-button svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.b24-weekdays,
.b24-days-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.b24-weekdays {
    margin-bottom: 2px;
}

.b24-weekdays span {
    display: grid;
    place-items: center;
    height: 24px;
    color: #b2bbc4;
    font-size: 12px;
    font-weight: 400;
}

.b24-day-button {
    justify-self: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: #47515b;
    font-size: 14px;
    font-weight: 400;
    line-height: 36px;
    text-align: center;
}

.b24-day-button:hover {
    background: #d5f5fe;
}

.b24-day-button.is-muted {
    color: #c8cfd6;
}

.b24-day-button.is-weekend {
    color: #d06a76;
}

.b24-day-button.is-muted.is-weekend {
    color: #d8b2b8;
}

.b24-day-button.is-today {
    color: #00c9fb;
}

.b24-day-button.is-selected,
.b24-day-button.is-selected:hover {
    color: #ffffff;
    background: #00c9fb;
}

.b24-picker-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    row-gap: 24px;
    padding: 14px 0 0;
}

.b24-picker-button {
    justify-self: center;
    width: 84px;
    height: 36px;
    border-radius: 18px;
    color: #343a40;
    font-size: 15px;
    font-weight: 400;
    line-height: 36px;
    text-align: center;
    white-space: nowrap;
}

.b24-picker-button:hover {
    background: #d9f1fa;
}

.b24-picker-button.is-selected,
.b24-picker-button.is-current {
    color: #2fc6f6;
}

.b24-picker-button.is-selected {
    background: transparent;
}

.b24-calendar-popover[hidden],
.b24-weekdays[hidden],
.b24-days-grid[hidden],
.b24-picker-grid[hidden],
.dropdown-demo[hidden] {
    display: none !important;
}

.feed {
    padding-top: 18px;
}

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

.feed-head h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 500;
}

.feed-head span {
    color: var(--muted);
    font-size: 12px;
}

.table-wrap {
    position: relative;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
}

.events-table {
    width: 100%;
    min-width: 1180px;
    border-collapse: collapse;
}

.events-table th,
.events-table td {
    border-bottom: 1px solid var(--line);
    padding: 10px 12px;
    text-align: left;
    vertical-align: top;
}

.events-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--section);
    color: var(--muted);
    font-size: 12px;
    font-weight: 400;
}

.events-table td {
    color: var(--text-soft);
}

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

.entity-link {
    color: var(--link);
    font-weight: 500;
}

.event-badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    border-radius: 999px;
    padding: 0 9px;
    background: var(--control-bg);
    color: var(--control-text-active);
    font-size: 12px;
    white-space: nowrap;
}

.crm-link {
    color: var(--link);
    font-weight: 500;
}

.event-badge.comment {
    background: #eaf8ff;
    color: #137aa2;
}

.event-badge.stage_change {
    background: #f2fff8;
    color: #00874b;
}

.event-badge.add,
.event-badge.initial {
    background: #fff9e8;
    color: #8a6500;
}

.comment-cell {
    max-width: 320px;
    color: var(--text-soft);
}

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

.empty-state {
    padding: 34px;
    color: var(--muted);
    text-align: center;
}

.install-page {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 24px;
}

.install-box {
    width: min(560px, 100%);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 22px;
    background: var(--panel);
}

.settings-panel {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    justify-content: flex-end;
    background: rgba(31, 38, 46, .24);
}

.settings-panel[hidden] {
    display: none !important;
}

.settings-panel-inner {
    width: min(420px, 100%);
    height: 100%;
    overflow: auto;
    background: #ffffff;
    box-shadow: var(--shadow-menu);
    padding: 22px;
}

.settings-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    border-bottom: 1px solid var(--line);
    padding-bottom: 14px;
}

.settings-head h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 500;
}

.settings-section {
    padding: 18px 0;
    border-bottom: 1px solid var(--line);
}

.settings-section h3 {
    margin: 0 0 12px;
    font-size: 15px;
    font-weight: 500;
}

.field-list {
    display: grid;
    gap: 8px;
}

.field-order-control {
    min-height: 34px;
    display: grid;
    grid-template-columns: 16px 15px 1fr;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: var(--text-soft);
    padding: 6px 10px;
}

.field-order-control.is-dragging {
    opacity: .55;
}

.drag-field-handle {
    width: 16px;
    height: 22px;
    display: grid;
    grid-template-columns: repeat(2, 4px);
    grid-template-rows: repeat(3, 4px);
    gap: 3px 4px;
    align-content: center;
    justify-content: center;
    cursor: grab;
}

.drag-field-handle::before,
.drag-field-handle::after {
    content: "";
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #9aa3ad;
    box-shadow: 0 7px 0 #9aa3ad, 0 14px 0 #9aa3ad;
}

.close-icon-button {
    position: relative;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #647084;
    cursor: pointer;
}

.close-icon-button:hover {
    background: #f7f7f7;
    color: #2c2d2e;
}

.close-icon-button::before,
.close-icon-button::after {
    content: "";
    position: absolute;
    left: 11px;
    top: 16px;
    width: 12px;
    height: 1.5px;
    border-radius: 2px;
    background: currentColor;
}

.close-icon-button::before {
    transform: rotate(45deg);
}

.close-icon-button::after {
    transform: rotate(-45deg);
}

.status {
    margin: 0 0 14px;
}

.status-ok {
    color: #00874b;
}

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

.install-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.install-stats span {
    border-radius: 999px;
    background: var(--control-bg);
    color: var(--control-text-active);
    padding: 5px 10px;
    font-size: 12px;
}

@media (max-width: 920px) {
    .topbar,
    .feed-head {
        align-items: stretch;
        flex-direction: column;
    }

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

    .filters .btn {
        width: 100%;
    }
}

@media (max-width: 620px) {
    .app-shell {
        padding: 16px;
    }

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