html, body {
    background: #f7f8fa;
    color: #1b1f24;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    height: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

a {
    color: #2357c6;
}

.content {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding-top: 1.5rem;
}

h1, h2, p {
    margin-top: 0;
}

h1 {
    font-size: 2rem;
    line-height: 1.2;
}

h2 {
    font-size: 1rem;
}

.page-header {
    align-items: center;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.page-header p {
    color: #667085;
    margin-bottom: 0;
    max-width: 720px;
}

.button,
.btn {
    align-items: center;
    appearance: none;
    background: #ffffff;
    border: 1px solid #d0d5dd;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
    color: #1d2939;
    cursor: pointer;
    display: inline-flex;
    font-size: 0.92rem;
    font-weight: 700;
    gap: 0.45rem;
    justify-content: center;
    line-height: 1.2;
    min-height: 2.75rem;
    padding: 0 1rem;
    text-decoration: none;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background-color 0.18s ease, color 0.18s ease;
}

.button:hover:not(:disabled),
.btn:hover:not(:disabled) {
    border-color: #b8c1d1;
    box-shadow: 0 10px 22px rgba(16, 24, 40, 0.08);
    transform: translateY(-1px);
}

.button:focus-visible,
.btn:focus-visible,
.icon-button:focus-visible,
.pager-button:focus-visible,
.tab:focus-visible,
.label-chip:focus-visible,
.settings-nav-link:focus-visible {
    box-shadow: 0 0 0 4px rgba(35, 87, 198, 0.16);
    outline: none;
}

.button.primary,
.btn-primary {
    background: #2357c6;
    border-color: #2357c6;
    box-shadow: 0 10px 22px rgba(35, 87, 198, 0.18);
    color: #ffffff;
}

.button.primary:hover:not(:disabled),
.btn-primary:hover:not(:disabled) {
    background: #1d4fb8;
    border-color: #1d4fb8;
}

.fit-content {
    align-self: flex-start;
    width: fit-content;
}

.button.secondary {
    background: #eff4ff;
    border-color: #c7d7fe;
    color: #1d4ed8;
}

.button.secondary:hover:not(:disabled) {
    background: #dfeaff;
    border-color: #a8c0ff;
}

.button.danger,
.btn-danger {
    background: #fff5f5;
    border-color: #fecdca;
    color: #b42318;
}

.button.danger:hover:not(:disabled),
.btn-danger:hover:not(:disabled) {
    background: #ffe4e2;
    border-color: #fda29b;
}

.btn-link {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
    color: #2357c6;
    min-height: auto;
    padding: 0;
}

.btn-link:hover:not(:disabled) {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
    color: #1d4fb8;
    transform: none;
}

.button:disabled,
.btn:disabled,
.button[disabled],
.btn[disabled] {
    box-shadow: none;
    cursor: not-allowed;
    opacity: 0.58;
    transform: none;
}

.toolbar, .editor, .panel, .table-panel, .integration {
    background: #ffffff;
    border: 1px solid #d9dee7;
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(16, 24, 40, 0.05);
}

.toolbar {
    align-items: center;
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding: 0.75rem;
}

.toolbar .button,
.toolbar .btn {
    white-space: nowrap;
}

.filter-summary-bar {
    align-items: center;
    background: #ffffff;
    border: 1px solid #d9dee7;
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(16, 24, 40, 0.05);
    display: flex;
    gap: 0.75rem;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding: 0.85rem;
}

.filter-summary-title {
    color: #1d2939;
    display: block;
    font-size: 0.92rem;
    font-weight: 800;
    margin-bottom: 0.1rem;
}

.filter-summary-text {
    color: #667085;
    font-size: 0.88rem;
}

.filter-active-badge {
    align-items: center;
    background: #dcfae6;
    border: 1px solid #abefc6;
    border-radius: 999px;
    color: #067647;
    display: inline-flex;
    font-size: 0.82rem;
    font-weight: 800;
    min-height: 2rem;
    padding: 0 0.65rem;
}

.filter-drawer {
    max-width: 900px;
    width: min(900px, 100vw);
}

.filter-drawer-caption {
    color: #667085;
    font-size: 0.88rem;
    margin: 0.2rem 0 0;
    max-width: 44rem;
}

.filter-drawer-actions,
.advanced-filter-footer {
    align-items: center;
    display: flex;
    gap: 0.75rem;
    justify-content: space-between;
}

.advanced-filter-empty,
.filter-no-value {
    color: #667085;
    font-size: 0.88rem;
    margin: 0;
}

.advanced-filter-groups,
.advanced-filter-rules {
    display: grid;
    gap: 0.5rem;
}

.advanced-filter-group {
    background: #fcfcfd;
    border: 1px solid #e4e7ec;
    border-radius: 8px;
    display: grid;
    gap: 0.6rem;
    padding: 0.65rem;
}

.advanced-filter-group-header {
    align-items: center;
    display: grid;
    gap: 0.5rem;
    grid-template-columns: 5.5rem minmax(0, 1fr) auto;
}

.filter-group-title {
    color: #344054;
    font-size: 0.9rem;
    font-weight: 800;
}

.advanced-filter-rule {
    align-items: center;
    display: grid;
    gap: 0.5rem;
    grid-template-columns: 5.5rem minmax(11rem, 1fr) minmax(10rem, 0.9fr) minmax(12rem, 1fr) 2.2rem;
}

.compact-input {
    min-width: 5.5rem;
}

.filter-connector-placeholder {
    color: #475467;
    font-size: 0.88rem;
    font-weight: 700;
    padding-left: 0.2rem;
}

.filter-no-value {
    align-items: center;
    display: inline-flex;
    min-height: 2.5rem;
}

.filter-option-picker {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    min-width: 12rem;
}

/* Searchable select dropdown */
.searchable-select {
    position: relative;
    width: 100%;
}

.searchable-select-trigger {
    align-items: center;
    background: #ffffff;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    text-align: left;
    width: 100%;
}

.searchable-select-trigger:hover {
    border-color: #94a3b8;
}

.searchable-select.is-open .searchable-select-trigger {
    border-color: #2563eb;
    outline: none;
}

.searchable-select-value {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.searchable-select-arrow {
    color: #64748b;
    flex-shrink: 0;
    margin-left: 0.4rem;
    transition: transform 0.15s ease;
}

.searchable-select.is-open .searchable-select-arrow {
    transform: rotate(180deg);
}

.searchable-select-dropdown {
    background: #ffffff;
    border: 1px solid #cfd6e3;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(16, 24, 40, 0.12);
    max-width: 22rem;
    min-width: 14rem;
    position: fixed;
    z-index: 9999;
}

.searchable-select-search {
    border-bottom: 1px solid #e8edf5;
    padding: 0.5rem;
}

.searchable-select-search .input {
    min-height: 2rem;
    padding: 0.35rem 0.6rem;
}

.searchable-select-options {
    max-height: 14rem;
    overflow-y: auto;
    padding: 0.25rem;
}

.searchable-select-option {
    background: none;
    border: none;
    border-radius: 5px;
    color: #1d2939;
    cursor: pointer;
    display: block;
    font-size: 0.9rem;
    padding: 0.45rem 0.65rem;
    text-align: left;
    width: 100%;
    word-break: break-word;
}

.searchable-select-option:hover {
    background: #f1f5f9;
}

.searchable-select-option.is-selected {
    background: #eff6ff;
    color: #2563eb;
    font-weight: 500;
}

.searchable-select-empty {
    color: #94a3b8;
    font-size: 0.85rem;
    padding: 0.6rem 0.65rem;
    text-align: center;
}

.input {
    background: #ffffff;
    border: 1px solid #cfd6e3;
    border-radius: 6px;
    color: #1d2939;
    min-height: 2.5rem;
    padding: 0.55rem 0.7rem;
    width: 100%;
}

.textarea {
    min-height: 6rem;
}

.editor {
    display: grid;
    gap: 0.9rem;
    margin-bottom: 1rem;
    padding: 1rem;
}

.drawer-backdrop {
    background: rgba(16, 24, 40, 0.42);
    bottom: 0;
    left: 0;
    position: fixed;
    right: 0;
    top: 0;
    z-index: 20;
}

.drawer {
    background: #ffffff;
    border-left: 1px solid #d9dee7;
    bottom: 0;
    box-shadow: -8px 0 24px rgba(16, 24, 40, 0.18);
    display: flex;
    flex-direction: column;
    max-width: 760px;
    position: fixed;
    right: 0;
    top: 0;
    width: min(760px, 100vw);
    z-index: 21;
}

.drawer-header {
    align-items: center;
    border-bottom: 1px solid #edf0f5;
    display: flex;
    justify-content: space-between;
    padding: 1rem 1.25rem;
}

.drawer-header h2 {
    margin-bottom: 0;
}

.drawer-body {
    align-content: start;
    display: grid;
    flex: 1;
    gap: 1rem;
    min-height: 0;
    overflow-y: auto;
    padding: 1rem 1.25rem;
}

.drawer-footer {
    background: #ffffff;
    border-top: 1px solid #edf0f5;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: flex-end;
    padding: 1rem 1.25rem;
}

.drawer-body > .drawer-footer {
    margin-bottom: -1rem;
    margin-left: -1.25rem;
    margin-right: -1.25rem;
}

.drawer-notice,
.drawer-validation {
    margin: 0;
}

.drawer-validation {
    background: #fff4f3;
    border: 1px solid #fecdca;
    border-radius: 8px;
    color: #b42318;
    padding: 0.75rem 0.9rem 0.75rem 1.9rem;
}

.drawer-validation:empty {
    display: none;
}

.field-grid, .metric-grid, .integration-grid, .scope-grid {
    display: grid;
    gap: 0.9rem;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.option-set {
    border: 1px solid #cfd6e3;
    border-radius: 6px;
    display: grid;
    gap: 0.35rem;
    max-height: 18rem;
    overflow-y: auto;
    padding: 0.55rem 0.7rem;
}

.drawer-body > .option-set {
    max-height: 22rem;
}

.option-check {
    align-items: center;
    display: flex;
    gap: 0.45rem;
}

.selected-option-preview {
    min-height: 1.45rem;
    padding-top: 0.3rem;
}

.pipedrive-label-list {
    align-items: center;
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.pipedrive-label {
    align-items: center;
    background: #eef2f7;
    border: 1px solid #d8dee8;
    border-radius: 4px;
    color: #344054;
    display: inline-flex;
    font-size: 0.76rem;
    font-weight: 700;
    line-height: 1.15;
    max-width: 14rem;
    min-height: 1.35rem;
    padding: 0.16rem 0.42rem;
    vertical-align: middle;
    white-space: normal;
}

.pipedrive-label-default {
    background: #eef2f7;
    border-color: #d8dee8;
    color: #344054;
}

.pipedrive-label-red {
    background: #fee4e2;
    border-color: #fecdca;
    color: #b42318;
}

.pipedrive-label-pink {
    background: #fce7f3;
    border-color: #fbcfe8;
    color: #9d174d;
}

.pipedrive-label-orange {
    background: #ffead5;
    border-color: #fed7aa;
    color: #b54708;
}

.pipedrive-label-yellow {
    background: #fef7c3;
    border-color: #fde68a;
    color: #854d0e;
}

.pipedrive-label-green {
    background: #dcfae6;
    border-color: #abefc6;
    color: #067647;
}

.pipedrive-label-blue {
    background: #dbeafe;
    border-color: #bfdbfe;
    color: #1d4ed8;
}

.pipedrive-label-purple {
    background: #ede9fe;
    border-color: #ddd6fe;
    color: #6d28d9;
}

.pipedrive-label-gray,
.pipedrive-label-dark-gray {
    background: #eaecf0;
    border-color: #d0d5dd;
    color: #344054;
}

.related-organizations-heading {
    margin-bottom: 0.35rem;
}

.related-organizations-set {
    background: #fcfcfd;
    min-height: 14rem;
    max-height: min(34rem, 62vh);
    padding: 0.4rem;
}

.related-organization-option {
    align-items: flex-start;
    border: 1px solid transparent;
    border-radius: 8px;
    gap: 0.6rem;
    padding: 0.45rem 0.55rem;
}

.related-organization-option:hover {
    background: #f8fafc;
    border-color: #e4e7ec;
}

.related-organization-option input {
    margin-top: 0.15rem;
}

.related-organization-name {
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.related-picker {
    border: 1px solid #cfd6e3;
    border-radius: 8px;
    display: grid;
    gap: 0.7rem;
    padding: 0.75rem;
}

.related-selected-list,
.related-results {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.related-selected-item {
    align-items: center;
    background: #eef2ff;
    border: 1px solid #c7d7fe;
    border-radius: 999px;
    color: #1d4ed8;
    display: inline-flex;
    font-size: 0.84rem;
    font-weight: 700;
    gap: 0.45rem;
    max-width: 100%;
    padding: 0.28rem 0.38rem 0.28rem 0.7rem;
}

.related-selected-item span {
    overflow-wrap: anywhere;
}

.related-remove {
    align-items: center;
    background: #dbe7ff;
    border: 0;
    border-radius: 999px;
    color: #1d4ed8;
    cursor: pointer;
    display: inline-flex;
    font-size: 1rem;
    font-weight: 800;
    height: 1.35rem;
    justify-content: center;
    line-height: 1;
    width: 1.35rem;
}

.related-remove:hover {
    background: #bfdbfe;
}

.related-search {
    display: grid;
    gap: 0.5rem;
    grid-template-columns: minmax(0, 1fr) auto;
}

.related-result {
    background: #ffffff;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    color: #1d2939;
    cursor: pointer;
    font: inherit;
    padding: 0.45rem 0.65rem;
    text-align: left;
}

.related-result:hover {
    background: #f8fafc;
    border-color: #98a2b3;
}

.related-empty {
    color: #667085;
    font-size: 0.88rem;
}

.related-item-hint {
    color: #94a3b8;
    font-size: 0.82rem;
}

/* Stacked (nested) drawer — slides in on top of the primary drawer */
.drawer-stacked {
    background: #ffffff;
    border-left: 1px solid #d9dee7;
    bottom: 0;
    box-shadow: -12px 0 32px rgba(16, 24, 40, 0.22);
    display: flex;
    flex-direction: column;
    max-width: 680px;
    position: fixed;
    right: 0;
    top: 0;
    width: min(680px, 100vw);
    z-index: 22;
}

/* Row with a heading + action button side-by-side */
.section-header-row {
    align-items: center;
    display: flex;
    gap: 0.75rem;
    justify-content: space-between;
}

.section-header-row h2 {
    margin-bottom: 0;
}

/* Edit/remove button group inside a related-selected-item */
.related-item-actions {
    align-items: center;
    display: flex;
    gap: 0.25rem;
    margin-left: auto;
}

.permission-grid {
    display: grid;
    gap: 0.8rem;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.permission-group {
    border: 1px solid #d7deea;
    border-radius: 8px;
    padding: 0.8rem;
}

.permission-group h3 {
    font-size: 0.95rem;
    margin: 0 0 0.6rem;
}

.permission-check {
    align-items: center;
    display: flex;
    gap: 0.5rem;
    margin: 0.4rem 0;
}

.permission-check.muted {
    color: #6c7280;
}

.actions {
    align-items: center;
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.action-column,
.action-cell {
    background: #ffffff;
    border-left: 1px solid #edf0f5;
    box-shadow: -4px 0 8px rgba(16, 24, 40, 0.04);
    position: sticky;
    right: 0;
    text-align: center;
    width: 3.5rem;
    z-index: 3;
}

.action-column {
    background: #f8fafc;
    z-index: 4;
}

.row-action {
    display: inline-flex;
    justify-content: center;
    position: relative;
}

.icon-button {
    align-items: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 5px;
    color: #475467;
    cursor: pointer;
    display: inline-flex;
    font-size: 1rem;
    font-weight: 700;
    height: 1.8rem;
    justify-content: center;
    line-height: 1;
    min-width: 2rem;
    padding: 0 0.35rem;
}

.icon-button:hover {
    background: #f2f4f7;
    border-color: #d0d5dd;
}

.action-menu {
    background: #ffffff;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    box-shadow: 0 8px 20px rgba(16, 24, 40, 0.14);
    display: grid;
    min-width: 9rem;
    padding: 0.3rem;
    position: absolute;
    right: 0;
    top: calc(100% + 0.25rem);
    z-index: 5;
}

.action-menu button {
    background: transparent;
    border: 0;
    border-radius: 4px;
    color: #1d2939;
    cursor: pointer;
    font: inherit;
    padding: 0.5rem 0.65rem;
    text-align: left;
}

.action-menu button:hover:not(:disabled) {
    background: #f2f4f7;
}

.action-menu button.danger {
    color: #b42318;
}

.action-menu button:disabled {
    color: #98a2b3;
    cursor: not-allowed;
}

.table-panel {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    height: calc(100vh - 16rem);
    max-width: 100%;
    min-height: 28rem;
    min-width: 0;
    overflow: hidden;
}

.table-scroll {
    flex: 1 1 auto;
    max-height: none;
    max-width: 100%;
    min-height: 0;
    overflow: auto;
    width: 100%;
}

.table-panel table {
    min-width: 100%;
    width: max-content;
}

.pagination-bar {
    align-items: center;
    border-top: 1px solid #edf0f5;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: space-between;
    padding: 0.65rem 0.75rem;
}

.pagination-controls {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.pagination-page,
.pagination-summary,
.pagination-size {
    color: #4b5563;
    font-size: 0.92rem;
}

.pagination-size {
    align-items: center;
    display: flex;
    gap: 0.4rem;
    margin-left: 0.5rem;
}

.pagination-size .input {
    min-width: 5rem;
    min-height: 2rem;
    padding: 0.25rem 0.45rem;
}

.pager-button {
    align-items: center;
    background: #ffffff;
    border: 1px solid #d0d5dd;
    border-radius: 5px;
    color: #344054;
    cursor: pointer;
    display: inline-flex;
    font-weight: 650;
    height: 2rem;
    justify-content: center;
    min-width: 2rem;
    padding: 0 0.45rem;
}

.pager-button:hover:not(:disabled),
.pager-button.active {
    background: #eff4ff;
    border-color: #84adff;
    color: #2357c6;
}

.pager-button:disabled {
    color: #98a2b3;
    cursor: not-allowed;
}

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

th, td {
    border-bottom: 1px solid #edf0f5;
    font-size: 0.85rem;
    line-height: 1.25;
    max-width: 18rem;
    overflow-wrap: anywhere;
    padding: 0.42rem 0.65rem;
    text-align: left;
    vertical-align: middle;
}

th {
    background: #f8fafc;
    color: #667085;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0;
    position: sticky;
    top: 0;
    text-transform: uppercase;
    z-index: 2;
}

.sort-header {
    align-items: center;
    background: transparent;
    border: 0;
    color: inherit;
    cursor: pointer;
    display: inline-flex;
    font: inherit;
    gap: 0.35rem;
    letter-spacing: inherit;
    padding: 0;
    text-align: left;
    text-transform: inherit;
    width: 100%;
}

.sort-header:hover {
    color: #1d2939;
}

.sort-indicator {
    color: #98a2b3;
    font-size: 0.66rem;
    line-height: 1;
}

tbody tr:hover {
    background: #f9fafb;
}

td .button {
    border-radius: 5px;
    font-size: 0.78rem;
    min-height: 1.85rem;
    padding: 0 0.5rem;
}

.details-cell {
    cursor: help;
}

.table-footer {
    color: #667085;
    font-size: 0.86rem;
    padding: 0.55rem 0.75rem;
}

.metric {
    background: #ffffff;
    border: 1px solid #d9dee7;
    border-radius: 8px;
    padding: 1rem;
}

.metric span {
    color: #667085;
    display: block;
}

.metric strong {
    display: block;
    font-size: 2rem;
    margin-top: 0.35rem;
}

.panel {
    margin-top: 1rem;
    padding: 1rem;
}

.panel-header {
    align-items: flex-start;
    display: flex;
    gap: 0.75rem;
    justify-content: space-between;
    margin-bottom: 0.9rem;
}

.panel-header h2 {
    margin-bottom: 0.2rem;
}

.panel-title {
    align-items: center;
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.panel-title span, .notice {
    color: #667085;
}

.notice.error {
    background: #fff4f3;
    border: 1px solid #fecdca;
    border-radius: 8px;
    color: #b42318;
    padding: 0.75rem 0.9rem;
}

.email-layout {
    align-items: start;
    display: grid;
    gap: 1rem;
    grid-template-columns: minmax(0, 1fr) minmax(18rem, 26rem);
}

.email-compose-panel {
    margin-top: 0;
}

.email-form {
    display: grid;
    gap: 0.9rem;
}

.email-side {
    display: grid;
    gap: 1rem;
}

.email-side .panel {
    margin-top: 0;
}

.email-body-editor {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    min-height: 14rem;
}

.html-email-editor-field {
    display: grid;
    gap: 0.35rem;
    min-width: 0;
}

.html-email-editor-label {
    font-weight: 400;
}

.html-email-editor {
    min-width: 0;
}

.html-email-editor .ck.ck-editor {
    min-width: 0;
}

.html-email-editor .ck.ck-toolbar {
    border-color: #cfd6e3;
    border-radius: 6px 6px 0 0;
}

.html-email-editor .ck.ck-editor__main > .ck-editor__editable {
    border-color: #cfd6e3;
    border-radius: 0 0 6px 6px;
    min-height: 16rem;
    overflow-wrap: anywhere;
}

.html-email-editor .ck.ck-editor__main > .ck-editor__editable:focus {
    border-color: #84adff;
    box-shadow: 0 0 0 4px rgba(35, 87, 198, 0.12);
}

.html-email-editor-fallback {
    min-height: 16rem;
}

.recipient-picker {
    border: 1px solid #d7deea;
    border-radius: 8px;
    display: grid;
    gap: 0.75rem;
    padding: 0.8rem;
}

.recipient-picker-header {
    align-items: flex-start;
    display: flex;
    gap: 0.75rem;
    justify-content: space-between;
}

.recipient-picker-header h2 {
    margin-bottom: 0.2rem;
}

.recipient-picker-actions {
    align-items: center;
    display: flex;
    flex-shrink: 0;
    gap: 0.5rem;
}

/* Attachment field */
.attachment-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.attachment-field-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
}

.attachment-pick-btn {
    align-self: flex-start;
    cursor: pointer;
}

.attachment-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.attachment-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.6rem;
    background: #f8fafc;
    border: 1px solid #e5e9f0;
    border-radius: 6px;
    font-size: 0.85rem;
}

.attachment-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.attachment-size {
    color: #6b7280;
    flex-shrink: 0;
}

.recipient-list {
    border: 1px solid #edf0f5;
    border-radius: 8px;
    display: grid;
    max-height: 22rem;
    overflow-y: auto;
}

.recipient-row {
    align-items: flex-start;
    border-bottom: 1px solid #edf0f5;
    cursor: pointer;
    display: flex;
    gap: 0.7rem;
    padding: 0.65rem 0.75rem;
}

.recipient-row:last-child {
    border-bottom: 0;
}

.recipient-row:hover {
    background: #f8fafc;
}

.recipient-row input {
    margin-top: 0.15rem;
}

.recipient-row span,
.compact-list-item div {
    display: grid;
    gap: 0.15rem;
    min-width: 0;
}

.recipient-row small,
.compact-list-item small {
    color: #667085;
    overflow-wrap: anywhere;
}

.email-preview {
    border: 1px solid #d7deea;
    border-radius: 8px;
    display: grid;
    gap: 0.65rem;
    margin-top: 1rem;
    padding: 0.8rem;
}

.email-preview-subject {
    background: #f8fafc;
    border: 1px solid #edf0f5;
    border-radius: 6px;
    font-weight: 700;
    padding: 0.65rem 0.75rem;
}

.email-preview-body {
    background: #ffffff;
    border: 1px solid #edf0f5;
    border-radius: 6px;
    min-height: 8rem;
    overflow-wrap: anywhere;
    padding: 0.75rem;
}

.compact-list {
    display: grid;
    gap: 0.65rem;
}

.compact-list-item {
    align-items: flex-start;
    border: 1px solid #edf0f5;
    border-radius: 8px;
    display: grid;
    gap: 0.65rem;
    padding: 0.75rem;
}

.compact-actions .button {
    min-height: 2.1rem;
    padding: 0 0.65rem;
}

/* ── Campaign history ──────────────────────────────────────────────────── */

.campaigns-history {
    margin-top: 1.5rem;
}

.campaigns-toolbar {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.campaigns-search-form {
    align-items: center;
    display: flex;
    flex: 1;
    gap: 0.5rem;
    min-width: 14rem;
}

.campaigns-search {
    flex: 1;
}

.status-filter-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.status-filter-tabs .button {
    min-height: 2rem;
    padding: 0 0.75rem;
}

.status-filter-tabs .button.active {
    background: #2357c6;
    border-color: #2357c6;
    color: #fff;
}

.campaigns-table {
    border: 1px solid #edf0f5;
    border-radius: 8px;
    overflow: hidden;
}

.campaign-row {
    align-items: center;
    border-bottom: 1px solid #edf0f5;
    display: flex;
    gap: 1rem;
    padding: 0.7rem 1rem;
    transition: background 0.12s;
}

.campaign-row:last-child {
    border-bottom: none;
}

.campaign-row:hover {
    background: #f8fafc;
}

.campaign-row.is-active {
    background: #eef3fd;
}

.campaign-row-info {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.campaign-row-name {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.campaign-row-meta {
    color: #667085;
    font-size: 0.82rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.campaign-row-stats {
    align-items: center;
    display: flex;
    flex-shrink: 0;
    gap: 0.6rem;
}

.campaign-status-badge {
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.2em 0.7em;
}

.campaign-status-badge.status-sending {
    background: #dbeafe;
    color: #1d4ed8;
}

.campaign-status-badge.status-sent {
    background: #dcfce7;
    color: #15803d;
}

.campaign-status-badge.status-partial {
    background: #fef9c3;
    color: #a16207;
}

.campaign-status-badge.status-failed {
    background: #fee2e2;
    color: #b91c1c;
}

.campaign-status-badge.status-draft {
    background: #f1f5f9;
    color: #475569;
}

.campaign-row-count {
    color: #667085;
    font-size: 0.85rem;
    white-space: nowrap;
}

.campaign-row-failed {
    color: #b91c1c;
    font-size: 0.82rem;
    white-space: nowrap;
}


.tabs {
    align-items: center;
    border-bottom: 1px solid #d9dee7;
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1rem;
}

.tab {
    background: transparent;
    border: 0;
    border-bottom: 2px solid transparent;
    color: #667085;
    cursor: pointer;
    font-weight: 650;
    padding: 0.75rem 0.9rem;
}

.tab.active {
    border-bottom-color: #2357c6;
    color: #2357c6;
}

.detail-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.section-caption {
    color: #667085;
    font-size: 0.88rem;
    margin-bottom: 0;
}

.settings-layout {
    align-items: start;
    display: grid;
    gap: 1rem;
    grid-template-columns: minmax(250px, 290px) minmax(0, 1fr);
}

.settings-sidebar,
.settings-content {
    background: #ffffff;
    border: 1px solid #d9dee7;
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(16, 24, 40, 0.05);
}

.settings-sidebar {
    padding: 1rem;
    position: sticky;
    top: 6rem;
}

.settings-content {
    min-width: 0;
    padding: 1.25rem;
}

.settings-content > :first-child {
    margin-top: 0;
}

/* ── Profile edit form ──────────────────────────────────────────────────── */

.profile-form {
    display: grid;
    gap: 1.25rem;
    max-width: 480px;
}

.profile-section-title {
    border-bottom: 1px solid #eaecf0;
    color: #1d2939;
    font-size: 0.95rem;
    font-weight: 650;
    margin: 0;
    padding-bottom: 0.75rem;
}

.profile-name-grid {
    grid-template-columns: 1fr 1fr;
}

.profile-readonly-field {
    display: grid;
    gap: 0.3rem;
}

.profile-readonly-label {
    color: #667085;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.profile-readonly-value {
    background: #f9fafb;
    border: 1px solid #eaecf0;
    border-radius: 6px;
    color: #667085;
    font-size: 0.92rem;
    padding: 0.55rem 0.7rem;
}

.settings-nav {
    display: grid;
    gap: 0.35rem;
}

.settings-nav-title {
    color: #667085;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    margin-bottom: 0.35rem;
    text-transform: uppercase;
}

.settings-nav-link {
    border: 1px solid transparent;
    border-radius: 12px;
    color: #344054;
    font-weight: 650;
    padding: 0.8rem 0.9rem;
    text-decoration: none;
    transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.settings-nav-link:hover {
    background: #f8fafc;
    border-color: #e4e7ec;
    color: #1d2939;
    transform: translateX(1px);
}

.settings-nav-link.active {
    background: #eff4ff;
    border-color: #c7d7fe;
    color: #2357c6;
}

.settings-nav-link.danger {
    color: #b42318;
}

.account-card {
    background: #ffffff;
    border: 1px solid #d9dee7;
    border-radius: 10px;
    display: grid;
    gap: 1rem;
    padding: 1rem;
}

.account-form-narrow {
    max-width: 32rem;
}

.account-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.account-status-grid {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.account-status-grid > div {
    background: #f8fafc;
    border: 1px solid #edf0f5;
    border-radius: 8px;
    display: grid;
    gap: 0.25rem;
    padding: 0.8rem;
}

.account-status-grid strong {
    color: #1d2939;
    font-size: 1rem;
}

.two-factor-card .alert {
    margin-bottom: 0;
}

.detail-panel,
.timeline-item {
    background: #ffffff;
    border: 1px solid #d9dee7;
    border-radius: 14px;
    display: grid;
    gap: 0.75rem;
    min-width: 0;
    padding: 1rem;
}

.contact-collection {
    display: grid;
    gap: 0.85rem;
}

.collection-header {
    align-items: flex-start;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: space-between;
}

.collection-header h2 {
    margin-bottom: 0.25rem;
}

.collection-editor {
    display: grid;
    gap: 0.85rem;
}

.collection-card {
    background: #fcfcfd;
    border: 1px solid #d9dee7;
    border-radius: 14px;
    display: grid;
    gap: 0.85rem;
    padding: 1rem;
}

.collection-card-header {
    align-items: flex-start;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: space-between;
}

.collection-card-title {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.collection-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.collection-kind-badge,
.primary-badge {
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 700;
    padding: 0.32rem 0.65rem;
}

.collection-kind-badge {
    background: #f2f4f7;
    color: #475467;
}

.primary-badge {
    background: #eff8ff;
    color: #175cd3;
}

.inline-fields {
    display: grid;
    gap: 0.9rem;
    grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
}

.label-suggestion-row {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.label-suggestion-caption {
    color: #667085;
    font-size: 0.8rem;
    font-weight: 650;
}

.label-chip {
    background: #ffffff;
    border: 1px solid #d0d5dd;
    border-radius: 999px;
    color: #344054;
    cursor: pointer;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 650;
    min-height: 2rem;
    padding: 0 0.8rem;
    transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.label-chip:hover,
.label-chip.active {
    background: #eff4ff;
    border-color: #a8c0ff;
    color: #1d4ed8;
}

.collection-empty {
    background: #f8fafc;
    border: 1px dashed #d0d5dd;
    border-radius: 14px;
    color: #667085;
    padding: 1rem;
}

.collection-add {
    justify-self: flex-start;
}

.detail-list {
    display: grid;
    gap: 0.55rem 1rem;
    grid-template-columns: 10rem 1fr;
    margin: 0;
}

.detail-list dt {
    color: #667085;
    font-weight: 650;
}

.detail-list dd {
    margin: 0;
    min-width: 0;
    overflow-wrap: anywhere;
}

.detail-link-list {
    align-items: flex-start;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    min-width: 0;
    max-width: 100%;
}

.detail-link-list span,
.detail-link-list a {
    background: #eff4ff;
    border: 1px solid #c7d7fe;
    border-radius: 999px;
    color: #1d4ed8;
    max-width: 100%;
    font-size: 0.84rem;
    font-weight: 700;
    line-height: 1.2;
    overflow-wrap: anywhere;
    padding: 0.28rem 0.6rem;
    text-decoration: none;
    word-break: break-word;
}

.detail-link-list a:hover {
    background: #dfeaff;
    border-color: #a8c0ff;
    color: #1d4fb8;
}

.timeline {
    display: grid;
    gap: 0.75rem;
}

.timeline-header {
    align-items: center;
    display: flex;
    gap: 0.75rem;
    justify-content: space-between;
}

.timeline-meta {
    color: #667085;
    font-size: 0.82rem;
}

.timeline-item p {
    margin-bottom: 0;
    white-space: pre-wrap;
}

.email-editor {
    border: 1px solid #cfd6e3;
    border-radius: 12px;
    overflow: hidden;
}

.editor-toolbar {
    align-items: center;
    background: #f8fafc;
    border-bottom: 1px solid #d9dee7;
    display: flex;
    gap: 0.25rem;
    padding: 0.35rem;
}

.editor-toolbar button {
    background: #ffffff;
    border: 1px solid #d0d5dd;
    border-radius: 5px;
    color: #344054;
    cursor: pointer;
    font-weight: 650;
    min-height: 1.8rem;
    padding: 0 0.55rem;
}

.email-editor-input {
    border: 0;
    border-radius: 0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    min-height: 18rem;
    resize: vertical;
}

.integration-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.integration {
    align-items: center;
    display: flex;
    justify-content: space-between;
    padding: 1rem;
}

.integration p {
    color: #667085;
    margin-bottom: 0;
}

.integration-log-header {
    border-top: 1px solid #e4e7ec;
    margin-bottom: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
}

.integration-log-header h2 {
    font-size: 1.15rem;
    margin-bottom: 0.25rem;
}

.integration-log-toolbar {
    align-items: stretch;
    border-radius: 8px;
    box-shadow: none;
    margin-bottom: 0;
}

.integration-log-toolbar .button {
    border-radius: 6px;
    min-height: 2.5rem;
}

.integration-log-panel {
    border-radius: 8px;
    box-shadow: none;
    height: min(34rem, calc(100vh - 20rem));
    margin-top: 0.75rem;
    min-height: 22rem;
}

.integration-log-panel th,
.integration-log-panel td {
    max-width: 22rem;
    padding-bottom: 0.55rem;
    padding-top: 0.55rem;
}

.integration-log-panel tbody tr:last-child td {
    border-bottom: 0;
}

.integration-log-status {
    background: #eef2f7;
    border: 1px solid #d8dee8;
    border-radius: 999px;
    color: #344054;
    display: inline-flex;
    font-size: 0.78rem;
    font-weight: 800;
    line-height: 1.2;
    min-height: 1.45rem;
    padding: 0.16rem 0.5rem;
    white-space: nowrap;
}

.integration-log-panel .details-cell {
    color: #475467;
    max-width: 34rem;
}

.badge {
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 0.3rem 0.6rem;
}

.badge.enabled {
    background: #dcfae6;
    color: #067647;
}

.badge.disabled {
    background: #f2f4f7;
    color: #475467;
}

@media (max-width: 720px) {
    .integration-log-toolbar {
        display: grid;
    }

    .integration-log-toolbar .button {
        width: 100%;
    }

    .integration-log-panel {
        height: min(32rem, calc(100vh - 18rem));
        min-height: 20rem;
    }
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #17b26a;
}

.invalid {
    outline: 1px solid #d92d20;
}

.validation-message {
    color: #d92d20;
}

#blazor-error-ui {
    background: #fef0c7;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(16, 24, 40, 0.08);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem;
    position: fixed;
    right: 0;
    z-index: 1000;
}

@media (max-width: 720px) {
    .page-header, .toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .filter-summary-bar,
    .filter-drawer-actions,
    .advanced-filter-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .advanced-filter-group-header,
    .advanced-filter-rule {
        grid-template-columns: 1fr;
    }

    .settings-layout {
        grid-template-columns: 1fr;
    }

    .settings-sidebar {
        position: static;
    }

    .inline-fields {
        grid-template-columns: 1fr;
    }

    th, td {
        padding: 0.7rem;
    }

    .drawer {
        width: 100vw;
    }

    .collection-card-header,
    .collection-header {
        align-items: stretch;
        flex-direction: column;
    }

    .collection-card-actions {
        width: 100%;
    }

    .collection-card-actions .button {
        flex: 1 1 12rem;
    }
}

@media (max-width: 980px) {
    .email-layout {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* ── Login page ─────────────────────────────────────────────────── */

.login-header {
    margin-bottom: 1.75rem;
    text-align: center;
}

.login-title {
    color: #101828;
    font-size: 1.3rem;
    font-weight: 720;
    letter-spacing: -0.02em;
    margin: 0 0 0.25rem;
}

.login-subtitle {
    color: #667085;
    font-size: 0.9rem;
    margin: 0;
}

.login-error {
    align-items: center;
    background: #fef3f2;
    border: 1px solid #fecdca;
    border-radius: 8px;
    color: #b42318;
    display: flex;
    font-size: 0.875rem;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    padding: 0.75rem 1rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.login-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.login-label {
    color: #344054;
    font-size: 0.875rem;
    font-weight: 500;
}

.login-label-row {
    align-items: center;
    display: flex;
    justify-content: space-between;
}

.login-forgot {
    color: #2357C6;
    font-size: 0.82rem;
    text-decoration: none;
}

.login-forgot:hover {
    text-decoration: underline;
}

.login-field-error {
    color: #b42318;
    font-size: 0.8rem;
}

.login-remember {
    align-items: center;
    color: #344054;
    cursor: pointer;
    display: flex;
    font-size: 0.875rem;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.login-remember input[type="checkbox"] {
    accent-color: #2357C6;
    height: 16px;
    width: 16px;
}

.login-submit {
    margin-top: 0.5rem;
    width: 100%;
    justify-content: center;
}

.login-divider {
    align-items: center;
    color: #98a2b3;
    display: flex;
    font-size: 0.8rem;
    gap: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.login-divider::before,
.login-divider::after {
    background: #e4e7ec;
    content: '';
    flex: 1;
    height: 1px;
}

.login-passkey {
    gap: 0.5rem;
    justify-content: center;
    width: 100%;
}

.login-hint {
    color: #98a2b3;
    font-size: 0.8rem;
    margin: 1rem 0 0;
    text-align: center;
}
