/* ============================================================
   Send Bulk Emails - Custom Styles
   Built on Bootstrap 5.3
   ============================================================ */

/* ── Layout ─────────────────────────────────────────────── */
:root {
    --sidebar-width: 240px;
    --sidebar-bg: #1e2235;
    --sidebar-text: #c8cde4;
    --sidebar-active-bg: rgba(13,110,253,0.15);
    --sidebar-active-text: #6ea8fe;
    --header-height: 56px;
    --brand-color: #0d6efd;
    --sidebar-hover-bg: rgba(255,255,255,0.08);
    --sidebar-hover-text: #ffffff;
    --page-bg: #f4f6fb;
    --text-color: #212529;
    --muted-color: #6c757d;
    --header-bg: #ffffff;
    --header-text: #1f2937;
    --header-border: #dfe4ed;
    --card-bg: #ffffff;
    --card-border: #e4e8f0;
    --table-border: #e4e8f0;
    --detail-bg: #f8f9fb;
    --detail-border: #e9ecef;
    --input-bg: #ffffff;
    --input-text: #212529;
    --input-border: #ced4da;
    --footer-bg: #ffffff;
}

html[data-theme='ocean'] {
    --sidebar-bg: #123b5a;
    --sidebar-text: #d7e8f6;
    --sidebar-active-bg: rgba(56,189,248,0.2);
    --sidebar-active-text: #c6f1ff;
    --brand-color: #0ea5e9;
    --sidebar-hover-bg: rgba(186,230,253,0.18);
    --sidebar-hover-text: #ffffff;
    --page-bg: #edf5fb;
    --text-color: #1f2f3d;
    --muted-color: #5f7588;
    --header-bg: #ffffff;
    --header-text: #1f2f3d;
    --header-border: #cddfeb;
    --card-bg: #ffffff;
    --card-border: #d7e6f1;
    --table-border: #d7e6f1;
    --detail-bg: #f3f9ff;
    --detail-border: #d7e6f1;
    --input-bg: #ffffff;
    --input-text: #1f2f3d;
    --input-border: #b8cfdf;
    --footer-bg: #f5fbff;
}

html[data-theme='sunrise'] {
    --sidebar-bg: #2d1b26;
    --sidebar-text: #f6dbe6;
    --sidebar-active-bg: rgba(251,146,60,0.24);
    --sidebar-active-text: #fdba74;
    --brand-color: #f97316;
    --sidebar-hover-bg: rgba(244,114,182,0.22);
    --sidebar-hover-text: #fff7ed;
    --page-bg: #fff7ed;
    --text-color: #3b2f2f;
    --muted-color: #7c6b6b;
    --header-bg: #fff1e6;
    --header-text: #3b2f2f;
    --header-border: #f2d2bf;
    --card-bg: #ffffff;
    --card-border: #f2d6c7;
    --table-border: #f3ddd1;
    --detail-bg: #fff4ec;
    --detail-border: #f2d6c7;
    --input-bg: #ffffff;
    --input-text: #3b2f2f;
    --input-border: #e4c3b0;
    --footer-bg: #fff1e6;
}

*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--page-bg);
    color: var(--text-color);
    overflow-x: hidden;
    transition: background 0.2s ease, color 0.2s ease;
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 2000;
    background: var(--brand-color);
    color: #fff;
    padding: 0.5rem 0.75rem;
    border-radius: 0 0 0.5rem 0.5rem;
    text-decoration: none;
}

.skip-link:focus {
    left: 1rem;
    top: 0.25rem;
}

.wrapper {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar-nav {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    overflow-y: auto;
    transition: transform 0.25s ease;
}

.sidebar-brand {
    color: #fff !important;
    font-size: 1.05rem;
}

.sidebar-nav .nav-link {
    color: var(--sidebar-text);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    transition: background 0.15s, color 0.15s;
}

.sidebar-nav .nav-link:hover {
    background: var(--sidebar-hover-bg);
    color: var(--sidebar-hover-text);
}

.sidebar-nav .nav-link.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
    font-weight: 600;
    border-left: 3px solid var(--sidebar-active-text);
    padding-left: calc(0.75rem - 3px);
}

.sidebar-nav .nav-link.disabled {
    color: rgba(200, 205, 228, 0.55);
    background: transparent;
    cursor: not-allowed;
    opacity: 1;
}

.sidebar-nav .nav-link.disabled:hover {
    color: rgba(200, 205, 228, 0.55);
    background: transparent;
}

.sidebar-nav .nav-link.disabled small {
    letter-spacing: 0.08em;
}

/* Keyboard focus ring inside the dark sidebar */
.sidebar-nav .nav-link:focus-visible,
.sidebar-sync-btn:focus-visible {
    outline: 2px solid var(--sidebar-active-text);
    outline-offset: -2px;
}

.sidebar-nav hr { border-color: rgba(255,255,255,0.1); }

/* Divider between nav items and quick-action buttons */
.sidebar-action-divider {
    border-color: rgba(255,255,255,0.12);
    margin-left: 0.5rem;
    margin-right: 0.5rem;
}

.text-purple { color: #6f42c1 !important; }
.bg-indigo { background-color: #6610f2 !important; }

.sidebar-sync-btn {
    color: var(--sidebar-text);
    border-radius: 6px;
    font-size: 0.9rem;
    opacity: 0.82;
    transition: background 0.15s, color 0.15s, opacity 0.15s;
}
.sidebar-sync-btn:hover {
    background: var(--sidebar-hover-bg);
    color: var(--sidebar-hover-text);
    opacity: 1;
}

.sidebar-user {
    color: var(--sidebar-text) !important;
    padding: 0.4rem 0;
}
.sidebar-user:hover { color: #fff !important; }
.sidebar-username { color: #fff; font-size: 0.9rem; font-weight: 500; }

.avatar-circle {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--brand-color);
    color: #fff;
    font-weight: 700;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.theme-switcher {
    padding: 0.6rem 0.2rem 0.2rem;
}

.theme-switcher-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(200, 205, 228, 0.72);
    margin-bottom: 0.45rem;
}

.theme-switcher-buttons {
    display: flex;
    gap: 0.55rem;
    align-items: center;
}

.theme-swatch {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.4);
    cursor: pointer;
    transition: transform 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}

.theme-swatch:hover {
    transform: translateY(-1px) scale(1.04);
    border-color: #ffffff;
}

.theme-swatch.active {
    border-color: #ffffff;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.24);
}

.theme-swatch-default {
    background: linear-gradient(135deg, #1e2235 0%, #0d6efd 100%);
}

.theme-swatch-ocean {
    background: linear-gradient(135deg, #123b5a 0%, #0ea5e9 100%);
}

.theme-swatch-sunrise {
    background: linear-gradient(135deg, #5b2333 0%, #f97316 100%);
}

.sidebar-server-info {
    padding: 0.6rem 0.65rem;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 7px;
    background: rgba(255,255,255,0.05);
    color: var(--sidebar-text);
    font-size: 0.72rem;
}

.sidebar-server-heading {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.4rem;
    color: #fff;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.sidebar-server-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #22c55e;
}

.sidebar-server-row {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    line-height: 1.55;
}

.sidebar-server-row span:last-child {
    color: #fff;
    text-align: right;
}

.sidebar-nav-filter-wrap .input-group-text {
    border-color: rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.12);
    color: #ffffff;
}

.sidebar-nav-filter {
    border-color: rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.1);
    color: #ffffff;
}

.sidebar-nav-filter::placeholder {
    color: rgba(255,255,255,0.72);
}

.sidebar-nav-filter:focus {
    border-color: rgba(255,255,255,0.46);
    box-shadow: 0 0 0 0.2rem rgba(255,255,255,0.15);
}

/* ── Main content ────────────────────────────────────────── */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: calc(100vh);
    display: flex;
    flex-direction: column;
    padding-top: 0.5rem;
    transition: margin-left 0.2s ease, padding-top 0.2s ease;
}

/* Responsive sidebar width tweaks to avoid layout overflow on smaller screens */
@media (max-width: 1199.98px) {
    :root { --sidebar-width: 220px; }
}
@media (max-width: 991.98px) {
    /* Mobile: hide sidebar by default and remove left margin */
    :root { --sidebar-width: 0px; }
    .main-content { margin-left: 0; padding-top: 0; }
}

/* ── Top header ─────────────────────────────────────────── */
.top-header {
    height: var(--header-height);
    background: var(--header-bg);
    color: var(--header-text);
    border-color: var(--header-border) !important;
    position: sticky;
    top: 0;
    z-index: 900;
    transition: background 0.2s ease, color 0.2s ease;
}

.header-title {
    color: var(--header-text);
}

.top-header .text-muted {
    color: var(--muted-color) !important;
}

.header-title-wrap {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.header-subtitle {
    font-size: 0.72rem;
    color: var(--muted-color);
    line-height: 1.2;
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-quick-jump-wrap {
    min-width: 210px;
}

.header-quick-jump {
    min-width: 165px;
}

footer {
    background: var(--footer-bg);
    border-color: var(--card-border) !important;
}

.footer-shortcuts kbd {
    font-size: 0.7rem;
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    background: var(--detail-bg);
    border: 1px solid var(--detail-border);
    color: var(--muted-color);
    font-family: inherit;
    box-shadow: 0 1px 0 var(--detail-border);
}

.form-control,
.form-select,
.input-group-text {
    background: var(--input-bg);
    color: var(--input-text);
    border-color: var(--input-border);
}

.form-control::placeholder,
.form-select::placeholder {
    color: color-mix(in srgb, var(--muted-color) 78%, transparent);
}

.form-control:focus,
.form-select:focus {
    border-color: color-mix(in srgb, var(--brand-color) 72%, #ffffff);
    box-shadow: 0 0 0 0.2rem color-mix(in srgb, var(--brand-color) 24%, transparent);
}

.table-light {
    --bs-table-bg: color-mix(in srgb, var(--card-bg) 90%, var(--brand-color) 10%);
    --bs-table-color: var(--muted-color);
}

/* ── Table hover — themed ────────────────────────────────── */
html[data-theme='ocean'] .table-hover > tbody > tr:hover > * {
    --bs-table-color-state: var(--text-color);
    --bs-table-bg-state: rgba(14, 165, 233, 0.07);
}
html[data-theme='sunrise'] .table-hover > tbody > tr:hover > * {
    --bs-table-color-state: var(--text-color);
    --bs-table-bg-state: rgba(249, 115, 22, 0.07);
}

html[data-theme='ocean'] .btn-light {
    --bs-btn-color: #1f2f3d;
    --bs-btn-bg: #eaf4fb;
    --bs-btn-border-color: #b8cfdf;
    --bs-btn-hover-bg: #d7e9f6;
    --bs-btn-hover-border-color: #9fbed3;
}

html[data-theme='ocean'] .text-dark {
    color: var(--text-color) !important;
}

.send-stepper {
    background: var(--card-bg);
}

.send-stepper-track {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.send-stepper-item {
    flex: 1 1 180px;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--detail-border);
    border-radius: 0.7rem;
    background: var(--detail-bg);
}

.send-stepper-dot {
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #dbeafe;
    color: #1d4ed8;
    flex-shrink: 0;
    font-size: 0.84rem;
}

.send-stepper-label {
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--text-color);
}

.send-stepper-item-done .send-stepper-dot {
    background: #dcfce7;
    color: #166534;
}

.send-stepper-item-active {
    border-color: color-mix(in srgb, var(--brand-color) 55%, var(--detail-border));
    background: color-mix(in srgb, var(--brand-color) 10%, var(--card-bg));
}

.send-stepper-item-active .send-stepper-dot {
    background: color-mix(in srgb, var(--brand-color) 22%, #ffffff);
    color: color-mix(in srgb, var(--brand-color) 80%, #0f172a);
}

.send-stepper-item-pending {
    opacity: 0.82;
}

.send-default-actions .btn {
    --bs-btn-padding-y: 0.1rem;
    --bs-btn-padding-x: 0.45rem;
    --bs-btn-font-size: 0.72rem;
    --bs-btn-line-height: 1.2;
}

.send-default-status {
    min-height: 1.05rem;
}

button.is-loading,
input.is-loading {
    cursor: wait;
}

/* ── Cards ───────────────────────────────────────────────── */
.card {
    border-radius: 10px;
    background: var(--card-bg);
    border-color: var(--card-border);
    color: var(--text-color);
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.card-header {
    border-radius: 10px 10px 0 0 !important;
    padding: 0.85rem 1.25rem;
    font-size: 0.95rem;
}

.empty-state {
    min-height: 280px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.detail-label {
    font-size: 0.78rem;
    color: var(--muted-color);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.detail-value {
    font-size: 0.98rem;
    color: var(--text-color);
}

.notes-block {
    min-height: 120px;
    padding: 0.9rem 1rem;
    border-radius: 10px;
    background: var(--detail-bg);
    border: 1px solid var(--detail-border);
}

/* ── Stat cards ─────────────────────────────────────────── */
.stat-card .card-body { padding: 1.1rem 1.25rem; }

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--text-color);
}

.stat-label {
    font-size: 0.78rem;
    color: var(--muted-color);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ── Tables ──────────────────────────────────────────────── */
.table th {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted-color);
    white-space: nowrap;
}

.table td { vertical-align: middle; }

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

.table > :not(caption) > * > * {
    border-bottom-color: var(--table-border);
}

.companies-sort-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: inherit;
    text-decoration: none;
}

.companies-sort-link:hover {
    color: var(--brand-color);
}

.companies-sort-link .bi {
    font-size: 0.78rem;
    opacity: 0.78;
}

.companies-density-toggle .btn {
    min-width: 6.75rem;
}

.companies-table-wrapper {
    overflow-y: visible;
}

.companies-table-wrapper .companies-table thead th {
    /* Bootstrap's responsive wrapper is the sticky container here, so a large
       top offset pushes the header down into the first data row. */
    position: sticky;
    top: 0;
    z-index: 2;
    background: color-mix(in srgb, var(--brand-color) 8%, var(--card-bg));
    box-shadow: inset 0 -1px 0 var(--table-border);
}

.companies-table-wrapper .companies-table thead th:first-child {
    z-index: 3;
}

.companies-table-compact > :not(caption) > * > * {
    padding-top: 0.45rem;
    padding-bottom: 0.45rem;
}

.companies-table-compact .badge {
    font-size: 0.68rem;
}

.companies-table-compact .btn-group.btn-group-sm > .btn,
.companies-table-compact .btn.btn-sm {
    --bs-btn-padding-y: 0.16rem;
    --bs-btn-padding-x: 0.45rem;
    --bs-btn-font-size: 0.78rem;
}

/* ── Badges ──────────────────────────────────────────────── */
.badge { font-weight: 500; font-size: 0.75rem; }

/* ── Flash container ─────────────────────────────────────── */
.flash-container { padding-top: 0.5rem; }

/* ── Progress bars ───────────────────────────────────────── */
.progress { border-radius: 100px; }

/* ── Sidebar overlay (mobile) ────────────────────────────── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

.sidebar-overlay.active { display: block; }

/* ── Responsive (mobile sidebar) ────────────────────────── */
@media (max-width: 991.98px) {
    .sidebar-nav {
        transform: translateX(-100%);
    }
    .sidebar-nav.show {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
}

/* ── Utility ─────────────────────────────────────────────── */
.cursor-pointer { cursor: pointer; }
.fs-7 { font-size: 0.85rem; }
.fw-medium { font-weight: 500; }
.min-w-0 { min-width: 0; }

.template-editor {
    min-height: 320px;
    border: 1px solid var(--detail-border);
    border-radius: 0.5rem;
    background: var(--card-bg);
}

.template-editor.is-invalid {
    border-color: #dc3545;
}

.template-editor .ql-toolbar {
    border: 0;
    border-bottom: 1px solid var(--detail-border);
    border-radius: 0.5rem 0.5rem 0 0;
}

.template-editor .ql-container {
    border: 0;
    min-height: 250px;
    font-family: inherit;
    font-size: 0.96rem;
    border-radius: 0 0 0.5rem 0.5rem;
}

/* Quill editor wrapper — toolbar is a sibling injected before the container */
.quill-editor-wrapper {
    border: 1px solid var(--detail-border);
    border-radius: 0.5rem;
    overflow: hidden;
    background: var(--card-bg);
}

.quill-editor-wrapper.is-invalid {
    border-color: #dc3545;
}

.quill-editor-wrapper .ql-toolbar.ql-snow {
    border: none;
    border-bottom: 1px solid var(--detail-border);
    background: var(--card-bg);
}

.quill-editor-wrapper .ql-container.ql-snow {
    border: none;
    min-height: 420px;
    font-family: inherit;
    font-size: 0.96rem;
    background: var(--card-bg);
}

.quill-editor-wrapper .ql-editor {
    min-height: 420px;
    color: var(--text-color);
}

/* Live preview pane */
.template-live-preview {
    border-radius: 0.5rem;
    border: 1px solid var(--detail-border);
}

.template-live-preview iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.template-attachment-option {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    padding: 0.75rem;
    border: 1px solid var(--detail-border);
    border-radius: 0.75rem;
    background: var(--card-bg);
    cursor: pointer;
}

.template-attachment-option:hover {
    border-color: var(--brand-color);
    background: color-mix(in srgb, var(--brand-color) 12%, var(--card-bg));
}

.template-attachment-copy {
    min-width: 0;
}

.template-subject {
    max-width: 360px;
}

.template-preview-body {
    min-height: 280px;
    padding: 1.25rem;
    border: 1px solid var(--detail-border);
    border-radius: 0.75rem;
    background: var(--card-bg);
}

.template-preview-text {
    padding: 1rem;
    border-radius: 0.75rem;
    background: var(--detail-bg);
    border: 1px solid var(--detail-border);
    white-space: pre-wrap;
    word-break: break-word;
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.92rem;
}

.dashboard-trend-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.65rem;
    align-items: end;
    min-height: 140px;
}

.dashboard-trend-col {
    text-align: center;
    min-width: 0;
}

.dashboard-trend-bars {
    height: 98px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 0.25rem;
}

.dashboard-trend-bar {
    width: 12px;
    border-radius: 999px;
    display: inline-block;
}

.dashboard-trend-bar-sent {
    background: #198754;
}

.dashboard-trend-bar-failed {
    background: #dc3545;
}

.dashboard-legend {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 999px;
    margin-right: 0.35rem;
    vertical-align: -1px;
}

.dashboard-legend-sent {
    background: #198754;
}

.dashboard-legend-failed {
    background: #dc3545;
}

.dashboard-sender-scroll {
    max-height: 42rem;
    overflow-y: auto;
}

.dashboard-sender-table-wrap {
    min-width: 100%;
}

.dashboard-sender-summary-table {
    table-layout: fixed;
}

.dashboard-sender-summary-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--bs-table-bg, #f8f9fa);
    white-space: nowrap;
}

.dashboard-sender-summary-table th,
.dashboard-sender-summary-table td {
    padding-top: 0.9rem;
    padding-bottom: 0.9rem;
}

.dashboard-sender-summary-table th:nth-child(1),
.dashboard-sender-summary-table td:nth-child(1) {
    width: 26%;
}

.dashboard-sender-summary-table th:nth-child(2),
.dashboard-sender-summary-table td:nth-child(2) {
    width: 26%;
}

.dashboard-sender-summary-table th:nth-child(3),
.dashboard-sender-summary-table td:nth-child(3) {
    width: 28%;
}

.dashboard-sender-summary-table th:nth-child(4),
.dashboard-sender-summary-table td:nth-child(4) {
    width: 12%;
}

.dashboard-sender-summary-table th:nth-child(5),
.dashboard-sender-summary-table td:nth-child(5) {
    width: 8%;
}

.dashboard-sender-profile-meta {
    white-space: nowrap;
}

.dashboard-sender-link {
    color: inherit;
}

.dashboard-sender-link:hover {
    color: var(--bs-primary, #0d6efd);
}

.dashboard-sender-pill {
    font-weight: 500;
}

.dashboard-sender-row-muted {
    opacity: 0.82;
}

.dashboard-sender-usage-item {
    min-height: 7.25rem;
}

@media (max-width: 1199.98px) {
    .dashboard-sender-scroll {
        max-height: none;
        overflow: visible;
    }

    .dashboard-sender-summary-table {
        table-layout: auto;
    }

    .dashboard-sender-profile-meta {
        white-space: normal;
    }
}

.candidate-notes-section {
    padding: 1rem;
    border: 1px solid color-mix(in srgb, var(--brand-color) 18%, var(--detail-border));
    border-left: 4px solid var(--brand-color);
    border-radius: 8px;
    background:
        linear-gradient(135deg,
            color-mix(in srgb, var(--brand-color) 7%, var(--card-bg)) 0%,
            color-mix(in srgb, #198754 5%, var(--card-bg)) 48%,
            color-mix(in srgb, #ffc107 5%, var(--card-bg)) 100%);
}

.candidate-notes-heading,
.sender-profile-notes-title {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin-bottom: 0.9rem;
    font-weight: 700;
    color: var(--text-color);
}

.candidate-notes-icon,
.sender-profile-notes-title .bi {
    width: 2rem;
    height: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: color-mix(in srgb, var(--brand-color) 15%, #ffffff);
    color: var(--brand-color);
    flex-shrink: 0;
}

.candidate-note-field,
.sender-profile-note-item,
.candidate-chip {
    --candidate-accent: var(--brand-color);
}

.candidate-note-visa,
.candidate-chip-visa { --candidate-accent: #0d6efd; }
.candidate-note-status,
.candidate-chip-status { --candidate-accent: #6f42c1; }
.candidate-note-subscription,
.candidate-chip-subscription { --candidate-accent: #198754; }
.candidate-note-education,
.candidate-chip-education { --candidate-accent: #0aa2c0; }
.candidate-note-experience,
.candidate-chip-experience { --candidate-accent: #fd7e14; }
.candidate-note-dependent,
.candidate-chip-dependent { --candidate-accent: #d63384; }
.candidate-chip-subscription-free { --candidate-accent: #0aa2c0; }
.candidate-chip-subscription-not_paid { --candidate-accent: #dc3545; }
.candidate-chip-subscription-paid_500 { --candidate-accent: #198754; }

.candidate-note-field {
    height: 100%;
    padding: 0.85rem;
    border: 1px solid color-mix(in srgb, var(--candidate-accent) 20%, var(--detail-border));
    border-left: 4px solid var(--candidate-accent);
    border-radius: 8px;
    background: color-mix(in srgb, var(--candidate-accent) 6%, var(--card-bg));
}

.candidate-note-field .form-label {
    display: flex;
    align-items: center;
    margin-bottom: 0.45rem;
    color: color-mix(in srgb, var(--candidate-accent) 72%, var(--text-color));
}

.candidate-note-field .bi {
    color: var(--candidate-accent);
}

.candidate-notes-cell {
    min-width: 240px;
}

.candidate-chip-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}

.candidate-chip {
    max-width: 100%;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.22rem 0.5rem;
    border: 1px solid color-mix(in srgb, var(--candidate-accent) 24%, var(--detail-border));
    border-radius: 999px;
    background: color-mix(in srgb, var(--candidate-accent) 9%, var(--card-bg));
    color: var(--text-color);
    font-size: 0.72rem;
    line-height: 1.25;
}

.candidate-chip .bi {
    color: var(--candidate-accent);
    flex-shrink: 0;
}

.candidate-chip span {
    color: var(--muted-color);
}

.candidate-chip strong {
    max-width: 10.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 650;
}

.candidate-empty-note {
    color: var(--muted-color);
    font-size: 0.82rem;
}

.sender-profile-notes {
    padding: 0.95rem;
    border: 1px solid color-mix(in srgb, var(--brand-color) 18%, var(--detail-border));
    border-radius: 8px;
    background: color-mix(in srgb, var(--brand-color) 5%, var(--card-bg));
}

.sender-profile-note-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
}

.sender-profile-note-item {
    min-width: 0;
    padding: 0.65rem 0.7rem;
    border: 1px solid color-mix(in srgb, var(--candidate-accent) 18%, var(--detail-border));
    border-left: 3px solid var(--candidate-accent);
    border-radius: 7px;
    background: color-mix(in srgb, var(--candidate-accent) 7%, var(--card-bg));
}

.candidate-subscription-table {
    min-width: 1180px;
}

.candidate-subscription-table th {
    white-space: nowrap;
}

.candidate-primary-cell {
    min-width: 210px;
}

.candidate-money-cell {
    min-width: 220px;
}

.candidate-date-cell {
    min-width: 230px;
}

.candidate-profile-cell {
    min-width: 260px;
}

.candidate-setup-cell {
    min-width: 210px;
}

.candidate-notes-inline-cell {
    min-width: 220px;
}

.candidate-money-grid,
.candidate-date-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
}

.candidate-money-grid label,
.candidate-date-grid label {
    display: grid;
    gap: 0.25rem;
}

.sender-profile-note-label {
    display: block;
    margin-bottom: 0.2rem;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted-color);
}

.sender-profile-note-item strong {
    display: block;
    min-width: 0;
    overflow-wrap: anywhere;
    font-size: 0.9rem;
    color: var(--text-color);
}

@media (max-width: 575.98px) {
    .sender-profile-note-grid {
        grid-template-columns: 1fr;
    }
}

.sender-profile-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.15rem;
    border: 1px solid var(--card-border);
    border-left: 4px solid var(--brand-color);
    border-radius: 8px;
    background: var(--card-bg);
    box-shadow: 0 0.35rem 1.1rem rgba(15, 23, 42, 0.06);
}

.sender-profile-topbar-main {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.sender-profile-avatar {
    width: 2.75rem;
    height: 2.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: color-mix(in srgb, var(--brand-color) 14%, #ffffff);
    color: var(--brand-color);
    font-size: 1.25rem;
    flex-shrink: 0;
}

.sender-profile-title {
    max-width: 100%;
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-color);
}

.sender-profile-subtitle {
    color: var(--muted-color);
    font-size: 0.9rem;
    overflow-wrap: anywhere;
}

.sender-profile-actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.45rem;
    flex-shrink: 0;
}

.sender-editor-form {
    display: grid;
    gap: 1rem;
}

.sender-form-section {
    padding: 1rem;
    border: 1px solid var(--detail-border);
    border-left: 4px solid var(--section-accent, var(--brand-color));
    border-radius: 8px;
    background: color-mix(in srgb, var(--section-accent, var(--brand-color)) 4%, var(--card-bg));
}

.sender-form-section-candidate { --section-accent: #0d6efd; }
.sender-form-section-identity { --section-accent: #198754; }
.sender-form-section-rules { --section-accent: #f59f00; }
.sender-form-section-limits { --section-accent: #6f42c1; }
.sender-form-section-smtp { --section-accent: #495057; }

.sender-form-section-header {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid color-mix(in srgb, var(--section-accent, var(--brand-color)) 12%, var(--detail-border));
}

.sender-form-section-icon {
    width: 2.15rem;
    height: 2.15rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: color-mix(in srgb, var(--section-accent, var(--brand-color)) 14%, #ffffff);
    color: var(--section-accent, var(--brand-color));
    flex-shrink: 0;
}

.sender-form-section-header h3 {
    margin: 0;
    font-size: 1rem;
    line-height: 1.25;
    font-weight: 700;
    color: var(--text-color);
}

.sender-form-section-header p {
    margin: 0.15rem 0 0;
    color: var(--muted-color);
    font-size: 0.84rem;
}

.sender-attachment-lock-grid {
    max-height: 20rem;
    overflow-y: auto;
    padding: 0.75rem;
}

.sender-attachment-option {
    min-width: 0;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.sender-attachment-lock-panel {
    border: 1px solid var(--detail-border);
    border-radius: 8px;
    background: color-mix(in srgb, #0d6efd 3%, var(--card-bg));
    overflow: hidden;
}

.sender-attachment-lock-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.7rem 0.85rem;
    border-bottom: 1px solid var(--detail-border);
    background: color-mix(in srgb, #0d6efd 6%, var(--card-bg));
}

.sender-attachment-option:hover {
    border-color: color-mix(in srgb, var(--brand-color) 42%, var(--detail-border)) !important;
    background: color-mix(in srgb, var(--brand-color) 5%, #ffffff) !important;
}

.sender-attachment-option.is-selected {
    border-color: color-mix(in srgb, var(--brand-color) 55%, var(--detail-border)) !important;
    background: color-mix(in srgb, var(--brand-color) 9%, #ffffff) !important;
    box-shadow: inset 3px 0 0 var(--brand-color);
}

.sender-attachment-file-icon {
    width: 1.75rem;
    height: 1.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
    background: color-mix(in srgb, var(--brand-color) 10%, #ffffff);
    color: var(--brand-color);
    flex-shrink: 0;
}

.sender-attachment-empty {
    padding: 0.75rem 0.85rem;
    border: 1px dashed var(--detail-border);
    border-radius: 8px;
    background: var(--detail-bg);
}

.sender-inline-note {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 0.75rem;
    border: 1px solid color-mix(in srgb, #0dcaf0 24%, var(--detail-border));
    border-radius: 7px;
    background: color-mix(in srgb, #0dcaf0 9%, var(--card-bg));
    color: var(--text-color);
    font-size: 0.88rem;
}

.sender-inline-note .bi {
    color: #0aa2c0;
}

.sender-active-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    min-height: 3.65rem;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--detail-border);
    border-radius: 7px;
    background: var(--card-bg);
}

.sender-summary-stack {
    display: grid;
    gap: 0.5rem;
}

.sender-summary-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.55rem 0;
    border-bottom: 1px solid var(--detail-border);
}

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

.sender-summary-row span {
    color: var(--muted-color);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.sender-summary-row strong {
    min-width: 0;
    text-align: right;
    overflow-wrap: anywhere;
    font-size: 0.9rem;
    color: var(--text-color);
}

.sender-lock-summary {
    padding: 0.8rem;
    border: 1px solid var(--detail-border);
    border-radius: 8px;
    background: var(--detail-bg);
}

.sender-lock-summary-title {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 0.55rem;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-color);
}

.sender-lock-summary-title .bi {
    color: #f59f00;
}

@media (max-width: 1199.98px) {
    .sender-profile-topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .sender-profile-actions {
        justify-content: flex-start;
        width: 100%;
    }
}

@media (max-width: 767.98px) {
    .sender-attachment-lock-grid {
        grid-template-columns: 1fr;
    }

    .sender-active-toggle {
        align-items: flex-start;
        flex-direction: column;
    }
}
