/* NPS Application - Light, tight, consistent design system */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --primary-color: #2570e8;
    --primary-dark: #1a5cc7;
    --primary-light: #5b93ef;
    --secondary-color: #26a69a;
    --success-color: #1f9d55;
    --warning-color: #e8930c;
    --danger-color: #d64541;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-disabled: #9ca3af;
    --border-color: #e5e8ee;
    --background-light: #f7f8fa;
    --bg-card: #ffffff;
    --radius-sm: 6px;
    --radius: 8px;
    --radius-lg: 10px;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
    --shadow-md: 0 2px 8px rgba(16, 24, 40, 0.08);
    --shadow-lg: 0 8px 24px rgba(16, 24, 40, 0.12);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--background-light);
    min-height: 100vh;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.375rem; }
h3 { font-size: 1.125rem; }
h4 { font-size: 1rem; }
h5 { font-size: 0.9375rem; }
h6 { font-size: 0.875rem; }

/* Navigation — light chrome */
.navbar-modern {
    background: var(--bg-card);
    border: none;
    border-bottom: 1px solid var(--border-color);
    box-shadow: none;
    padding: 0;
}

.navbar-modern .navbar-brand {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary) !important;
    padding: 0.625rem 0;
}

.navbar-modern .nav-link {
    color: var(--text-secondary) !important;
    font-weight: 500;
    font-size: 0.9375rem;
    padding: 1rem 0.875rem !important;
    transition: color 0.15s ease;
    border-bottom: 2px solid transparent;
    /* "Log ud" is two words; without this it wraps inside the 992–1100px bar
       while the single-word Settings label stays on one line. */
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
}

/* Logout is a submit control (.btn.btn-link). Drop the button chrome so it
   matches the Settings link's height instead of reading as a stray text button. */
.navbar-modern form button.nav-link {
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    background: transparent;
    line-height: inherit;
    text-align: start;
    text-decoration: none;
    box-shadow: none;
    vertical-align: baseline;
}

.navbar-modern form button.nav-link:hover,
.navbar-modern form button.nav-link:focus {
    text-decoration: none;
    box-shadow: none;
    background: none;
}

.navbar-modern .nav-link:hover {
    color: var(--text-primary) !important;
    background: none;
    border-bottom-color: var(--border-color);
}

.navbar-modern .nav-link.active {
    color: var(--primary-color) !important;
    background: none;
    border-bottom-color: var(--primary-color);
}

.lang-switcher {
    display: flex;
    gap: 0.5rem;
}

/* Container */
.container-modern {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
}

/* Cards */
.card-modern {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.25rem;
    transition: box-shadow 0.15s ease;
    overflow: hidden;
}

.card-modern:hover {
    box-shadow: var(--shadow-md);
}

.card-modern .card-header-modern {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 0.875rem 1.25rem;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-modern .card-body {
    padding: 1.25rem;
}

/* Card headers that carry controls: title left, controls right, wrapping
   onto their own line instead of overflowing on narrow screens. */
.card-header-split {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem 0.75rem;
}

.card-header-title {
    display: flex;
    align-items: center;
    min-width: 0;
}

/* Existing Bootstrap-utility headers keep their look but stop overflowing */
.card-header-modern.d-flex {
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
}

/* Align plain Bootstrap cards (settings, auth pages) with the same look */
.card {
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.card .card-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 0.875rem 1.25rem;
}

.card .card-header h5 {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 600;
}

/* Buttons — one flat, consistent system */
.btn-modern {
    font-family: inherit;
    font-weight: 500;
    font-size: 0.875rem;
    padding: 0.5rem 0.875rem;
    border-radius: var(--radius);
    border: 1px solid transparent;
    text-transform: none;
    letter-spacing: 0;
    line-height: 1.4;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    box-shadow: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    white-space: nowrap;
}

.btn-modern:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 112, 232, 0.25);
}

.btn-modern:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* Toggle switches, checkboxes and their labels read as clickable controls. */
.form-check-input,
.form-check-label {
    cursor: pointer;
}

.form-check-input:disabled {
    cursor: not-allowed;
}

.btn-primary-modern {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.btn-primary-modern:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    color: white;
}

.btn-success-modern {
    background: var(--success-color);
    border-color: var(--success-color);
    color: white;
}

.btn-success-modern:hover {
    background: #187f44;
    border-color: #187f44;
    color: white;
}

.btn-warning-modern {
    background: #fdf3e0;
    border-color: #f2d9ab;
    color: #93610a;
}

.btn-warning-modern:hover {
    background: #fae7c3;
    border-color: #e8c584;
    color: #7a5008;
}

.btn-danger-modern {
    background: #fdeceb;
    border-color: #f4c4c2;
    color: #b53531;
}

.btn-danger-modern:hover {
    background: #f9d8d6;
    border-color: #eba7a4;
    color: #9c2925;
}

/* Neutral secondary button — used everywhere an action is not the main one */
.btn-outline-modern,
.btn-modern.btn-outline-secondary {
    background: var(--bg-card);
    border: 1px solid #d3d8e1;
    color: var(--text-primary);
}

.btn-outline-modern:hover,
.btn-modern.btn-outline-secondary:hover {
    background: #f3f5f8;
    border-color: #c1c8d4;
    color: var(--text-primary);
}

/* Button size variants */
.btn-modern.btn-sm {
    padding: 0.3rem 0.7rem;
    font-size: 0.8125rem;
}

.btn-modern.btn-lg {
    padding: 0.7rem 1.5rem;
    font-size: 0.9375rem;
}

/* Segmented button groups (filters, sort, exports) — restore the corner handling
   that the global .btn radius below would otherwise override */
.btn-group > .btn:not(:first-child) {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    margin-left: -1px;
}

.btn-group > .btn:not(:last-child) {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

/* Campaign list filters are separate pills, not a joined .btn-group.
   Sort stays a compact menu on the right and wraps under the pills. */
.campaign-status-pills > .btn {
    border-radius: var(--radius);
}

.campaign-filter-row .campaign-sort-menu {
    flex: 0 0 auto;
}

.campaign-filter-row .campaign-sort-menu > .dropdown-toggle {
    border-radius: var(--radius);
}

/* Bring plain Bootstrap buttons in line with the palette */
.btn {
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover, .btn-primary:focus {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}

/* NPS Score Display */
.nps-display {
    text-align: center;
    padding: 1.75rem 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.25rem;
}

.nps-score-circle {
    width: 128px;
    height: 128px;
    margin: 0 auto 1rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.75rem;
    font-weight: 600;
    color: white;
    box-shadow: var(--shadow-md);
}

.nps-positive { background: var(--success-color); }
.nps-neutral  { background: var(--warning-color); }
.nps-negative { background: var(--danger-color); }
.nps-empty    { background: var(--text-disabled); }

.nps-display h3 {
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 0.5rem 0 0.25rem;
}

/* Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.metric-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.125rem 1.25rem;
    box-shadow: var(--shadow-sm);
    border-left: 3px solid;
}

.metric-card.promoters { border-left-color: var(--success-color); }
.metric-card.passives { border-left-color: var(--warning-color); }
.metric-card.detractors { border-left-color: var(--danger-color); }

.metric-card .metric-value {
    font-size: 2rem;
    font-weight: 600;
    line-height: 1.1;
    margin: 0.25rem 0;
}

.metric-card .metric-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.metric-card .metric-percentage {
    font-size: 1rem;
    color: var(--text-secondary);
}

/* Tables */
.table-modern {
    width: 100%;
    background: var(--bg-card);
    border-collapse: separate;
    border-spacing: 0;
    border-radius: var(--radius);
    overflow: hidden;
}

.table-modern thead {
    background: #f8f9fb;
}

.table-modern th {
    padding: 0.625rem 0.875rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 0.71875rem;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-color);
}

.table-modern td {
    padding: 0.75rem 0.875rem;
    border-bottom: 1px solid #f0f2f5;
    color: var(--text-primary);
}

.table-modern tbody tr {
    transition: background-color 0.15s ease;
}

.table-modern tbody tr:hover {
    background-color: #f8f9fb;
}

.table-modern tbody tr:last-child td {
    border-bottom: none;
}

/* Badges — soft, quiet pills */
.badge-modern {
    padding: 0.25rem 0.625rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.71875rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    line-height: 1.4;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    white-space: nowrap;
}

.badge-draft {
    background: #eef0f3;
    color: #57606a;
}

.badge-active {
    background: #e2f4e8;
    color: #17753f;
}

.badge-closed {
    background: #fdeceb;
    color: #b53531;
}

.badge-anonymized {
    background: #efeafb;
    color: #6743b8;
}

.badge-info {
    background: #e6f0fd;
    color: #1a5cc7;
}

.badge-test {
    background: #fff3d6;
    color: #9a6b00;
    border: 1px solid #f0d48a;
}

.badge-yes {
    background: #e2f4e8;
    color: #17753f;
}

.badge-no {
    background: #fdeceb;
    color: #b53531;
}

/* Bootstrap utility badges (respondent summary tags etc.) get the same shape */
.badge {
    padding: 0.3rem 0.625rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.4;
}

/* Forms */
.form-modern .form-label {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.375rem;
    font-size: 0.875rem;
}

.form-modern .form-control,
.form-control {
    border: 1px solid #d3d8e1;
    border-radius: var(--radius);
    padding: 0.5rem 0.75rem;
    font-size: 0.9375rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

/* A select needs a wider right-hand gutter than a text input: Bootstrap draws
   its chevron as a background image at calc(100% - 0.75rem) and reserves
   2.25rem for it. The shared padding shorthand above reset that gutter to
   0.75rem, so the arrow was painted on top of the selected text — most visible
   on the short selects in the NPS trend card (2026-10-25). */
.form-modern .form-select,
.form-select {
    border: 1px solid #d3d8e1;
    border-radius: var(--radius);
    padding: 0.5rem 2.25rem 0.5rem 0.75rem;
    font-size: 0.9375rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

/* ...and the small variant stays small, with its own narrower gutter. */
.form-select.form-select-sm {
    padding: 0.25rem 1.75rem 0.25rem 0.5rem;
    font-size: 0.875rem;
}

.form-modern .form-control:focus,
.form-modern .form-select:focus,
.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 112, 232, 0.12);
    outline: none;
}

/* Survey Page */
/* Skip to content link - visible on focus for keyboard users */
.skip-to-content {
    position: absolute;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary-color);
    color: white;
    padding: 0.75rem 2rem;
    border-radius: 0 0 8px 8px;
    z-index: 10000;
    font-weight: 500;
    text-decoration: none;
    transition: top 0.2s ease;
}

.skip-to-content:focus {
    top: 0;
    outline: 3px solid white;
    outline-offset: 2px;
}

.survey-container {
    /* Flex child of .survey-body: without width/min-width:0 it grows to the
       min-content of long unbreakable words (e.g. DA "Kundetilfredshedsundersøgelse")
       and overflows narrow viewports (WCAG 1.4.10). */
    width: 100%;
    min-width: 0;
    max-width: 650px;
    margin: 2rem auto;
}

.survey-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 2rem;
}

.survey-question {
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 2rem;
    line-height: 1.5;
}

.survey-card h1,
.survey-card .survey-question,
.survey-card legend,
.rating-labels small {
    overflow-wrap: anywhere;
    hyphens: auto;
}

.rating-buttons {
    display: flex;
    flex-wrap: nowrap; /* all 11 on one row so end labels sit under 0 and 10 */
    gap: 4px; /* >=576px: 576 - 2*20 padding - 2 border = 534; (534 - 10*4) / 11 = 44.9px */
    justify-content: center;
    margin: 1.5rem 0;
}

.rating-btn {
    width: 52px;
    height: 52px;
    /* Task #74: never let a squeezed grid cell take the tap target below 44px.
       The narrow-viewport rules below keep the grid wide enough for this floor. */
    min-width: 44px;
    min-height: 44px;
    border: 1px solid #8a94a6;
    border-radius: var(--radius);
    background: var(--bg-card);
    font-size: 1.25rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rating-buttons .rating-btn { /* flexible width; beats the later 768px .rating-btn rule */
    flex: 1 1 0;
    /* Task #74: the 44px floor is enforced here too, because this rule is more
       specific than .rating-btn and would otherwise re-open min-width: 0. */
    min-width: 44px;
    max-width: 52px;
    width: auto;
    height: auto;
    aspect-ratio: 1;
}

.rating-btn:focus-visible {
    outline: 3px solid var(--primary-dark);
    outline-offset: 2px;
}

@media (max-width: 575.98px) {
    .rating-buttons {
        display: grid;
        grid-template-columns: repeat(6, minmax(0, 1fr));
        gap: 3px;
    }
    .rating-buttons .rating-btn { /* beats the later 768px .rating-btn rule */
        width: auto;
        height: auto;
        aspect-ratio: 1;
    }
    .survey-card h1 {
        font-size: clamp(1.125rem, 5.5vw, 2rem); /* DA "Kundetilfredshedsundersøgelse" is ~302px at 20px; 18px fits 286px at 320 */
    }
    /* 320px: 320 - 2*16 padding - 2*1 border = 286px; (286 - 5*3) / 6 = 45.2px per button
       (44.3px with a 15px desktop scrollbar -> still over the 44px floor after task #74). */
    .survey-container .survey-card { /* beats the later 768px .survey-card rule */
        padding: 1.5rem 1rem;
    }
}

/* Task #74: six columns stop holding a 44px target once the content box gets
   narrow (320px with a 15px scrollbar -> 42.7px, 300px -> 41.0px, Galaxy Fold
   280px -> 37.7px). Four per row keeps every button comfortably over 44px:
   320px -> (320 - 2*16 - 2*1 - 3*3) / 4 = 69.2px. */
@media (max-width: 359.98px) {
    .rating-buttons {
        grid-template-columns: repeat(4, minmax(0, 52px));
        justify-content: center; /* four 52px columns, centred as a block */
    }
}

.rating-btn:hover {
    transform: scale(1.06);
    box-shadow: var(--shadow-md);
}

.rating-btn.selected {
    transform: scale(1.1);
    box-shadow: 0 4px 14px rgba(37, 112, 232, 0.35);
    border-color: var(--primary-color);
    background-color: var(--primary-color);
    color: white;
    font-weight: 700;
}

.rating-btn.detractor {
    border-color: #f4c4c2;
    color: var(--danger-color);
}

.rating-btn.detractor:hover {
    background: var(--danger-color);
    border-color: var(--danger-color);
    color: white;
}

.rating-btn.passive {
    border-color: #f2d9ab;
    color: var(--warning-color);
}

.rating-btn.passive:hover {
    background: var(--warning-color);
    border-color: var(--warning-color);
    color: white;
}

.rating-btn.promoter {
    border-color: #b7e3c6;
    color: var(--success-color);
}

.rating-btn.promoter:hover {
    background: var(--success-color);
    border-color: var(--success-color);
    color: white;
}

.rating-labels {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 0.75rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Alert */
.alert-modern {
    padding: 0.875rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
    border-left: 3px solid;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9375rem;
}

.alert-info {
    background: #e6f0fd;
    color: #1a4d9e;
    border-left-color: var(--primary-color);
}

.alert-success {
    background: #e2f4e8;
    color: #135f34;
    border-left-color: var(--success-color);
}

.alert-warning {
    background: #fdf3e0;
    color: #7a5008;
    border-left-color: var(--warning-color);
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.page-header h1 {
    margin: 0;
}

/* Action clusters inside the page header wrap instead of cramping */
.page-header > .d-flex {
    flex-wrap: wrap;
    row-gap: 0.5rem;
    justify-content: flex-end;
}

/* #51: emails-this-month counter is its own full-width row on every card */
.campaign-card-meta > .campaign-emails-month {
    flex: 0 0 100%;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
}

/* Campaign detail header: title column may shrink; actions wrap (2 columns below sm) */
.campaign-detail-title {
    min-width: 0;
    overflow-wrap: anywhere;
}

@media (max-width: 575.98px) {
    .page-header > .campaign-detail-actions {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.5rem;
        min-width: 0;
    }
    .campaign-detail-actions > form,
    .campaign-detail-actions > button,
    .campaign-detail-actions > a,
    .campaign-detail-actions > .btn-group,
    .campaign-detail-actions > .dropdown {
        min-width: 0;
    }
    .campaign-detail-actions > form > .btn,
    .campaign-detail-actions > button.btn,
    .campaign-detail-actions > a.btn,
    .campaign-detail-actions > .dropdown > .btn {
        width: 100%;
    }
    /* The actions menu is the primary control now, so it takes the full row like the
       old three-button export group did (2026-10-28). */
    .campaign-detail-actions > .dropdown,
    .campaign-detail-actions > .btn-group {
        grid-column: 1 / -1;
        display: flex;
        width: 100%;
    }
    .campaign-detail-actions > .btn-group > .btn {
        flex: 1 1 0;
        min-width: 0;
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
    .campaign-detail-actions .btn {
        white-space: normal;
    }
}

/* Campaign Cards Grid */
/* Pin toggle + color label (per-user dashboard preferences) */
.pin-star-btn {
    background: none;
    border: none;
    padding: 0.125rem 0.25rem;
    line-height: 1;
    color: var(--text-secondary);
    font-size: 1rem;
    cursor: pointer;
    border-radius: var(--radius-sm, 4px);
    transition: color 0.15s ease;
}

.pin-star-btn:hover {
    color: #f5b301;
}

.pin-star-btn i.pinned,
.pin-star-btn .bi-star-fill.pinned {
    color: #f5b301;
}

/* Colour label picker (2026-10-28): a theme palette instead of a native colour input.
   Six options, each a submit button, so a click posts the colour straight back. */
.campaign-colour-form {
    line-height: 1;
}

.campaign-colour-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.375rem;
    background: var(--bg-card, #fff);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm, 6px);
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.campaign-colour-trigger:hover,
.campaign-colour-trigger:focus-visible {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(37, 112, 232, 0.18);
    outline: none;
}

.campaign-colour-swatch {
    display: inline-block;
    width: 1.125rem;
    height: 1.125rem;
    border-radius: 4px;
    background: var(--text-disabled);
}

/* No colour chosen yet: hollow square, so it reads as "none" next to a filled one. */
.campaign-colour-swatch--empty {
    background: none;
    border: 1px dashed var(--text-disabled);
}

.campaign-colour-caret {
    font-size: 0.5rem;
    color: var(--text-secondary);
}

.campaign-colour-menu {
    min-width: 0;
    padding: 0.375rem;
}

.campaign-colour-menu-grid {
    display: grid;
    grid-template-columns: repeat(3, auto);
    gap: 0.375rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.campaign-colour-option {
    width: 1.5rem;
    height: 1.5rem;
    padding: 0;
    border: 1px solid rgba(16, 24, 40, 0.12);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.campaign-colour-option:hover,
.campaign-colour-option:focus-visible {
    transform: scale(1.12);
    box-shadow: 0 0 0 2px var(--bg-card, #fff), 0 0 0 4px rgba(37, 112, 232, 0.45);
    outline: none;
}

.campaign-color-dot {
    display: inline-block;
    width: 0.625rem;
    height: 0.625rem;
    border-radius: 50%;
    margin-right: 0.375rem;
    vertical-align: middle;
    border: 1px solid rgba(0, 0, 0, 0.15);
}

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

.campaign-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.25rem;
    transition: box-shadow 0.15s ease;
    border-left: 3px solid var(--primary-color);
    display: flex;
    flex-direction: column;
}

.campaign-card:hover {
    box-shadow: var(--shadow-md);
}

/* Name takes the remaining width; TEST pill, pin, colour and status stay on one row */
/* Name wraps as a whole; when it and the badges don't fit, the badge row (TEST, pin,
   colour, status) drops below as one unbroken, right-aligned row on every card. */
.campaign-card-header {
    flex-wrap: wrap;
}
.campaign-card-header > h3 {
    flex: 1 1 9rem;
    min-width: 0;
}
.campaign-card-header > .campaign-card-actions {
    flex-wrap: nowrap;
    flex-shrink: 0;
    margin-left: auto;
}

.campaign-card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.campaign-card h3 {
    font-size: 1.0625rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.campaign-card p.text-muted {
    font-size: 0.875rem;
    margin-bottom: 0;
}

.campaign-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.625rem 1.5rem;
    margin-top: auto;
    padding-top: 0.875rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.8125rem;
}

.campaign-card-meta > div {
    min-width: 0;
}

.campaign-card-meta small {
    font-size: 0.71875rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.campaign-card-meta span {
    white-space: nowrap;
    color: var(--text-primary);
    font-weight: 500;
}

.campaign-card .mt-4 {
    margin-top: 1rem !important;
}

/* Footer */
.footer-modern {
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
    text-align: center;
    padding: 1.5rem 1rem;
    margin-top: 3rem;
}

/* Campaign metrics empty state: the guidance grid must not widen the table
   past its card. Bootstrap's negative .row gutters overflow the cell's own
   padding and trigger a phantom horizontal scrollbar when there are no
   campaigns; zero the outer margins so the row fits the cell exactly (the
   column padding still provides the horizontal spacing). */
.empty-state-cell .row {
    margin-left: 0;
    margin-right: 0;
}

/* Signed-in menu collapses below Bootstrap's lg breakpoint. Desktop
   padding (1rem) plus a centered, wrapping action cluster made the open
   panel a tall loose stack. Tighten only here — the expanded bar is unchanged. */
@media (max-width: 991.98px) {
    .navbar-modern .navbar-collapse .nav-link {
        padding: 0.375rem 0.5rem !important;
    }

    .navbar-modern .navbar-collapse .navbar-nav.ms-auto {
        align-items: flex-start !important;
        flex-wrap: nowrap;
        gap: 0.125rem !important;
        row-gap: 0;
        width: 100%;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .container-modern {
        padding: 1rem 0.75rem;
    }

    .card-modern .card-body {
        padding: 1rem;
    }

    .campaign-card {
        padding: 1rem;
    }

    .nps-score-circle {
        width: 104px;
        height: 104px;
        font-size: 2.25rem;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .campaigns-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .rating-btn {
        width: 46px;
        height: 46px;
        font-size: 1.125rem;
    }

    /* Long badges (e.g. scheduled-close) may wrap instead of overflowing */
    .badge-modern {
        white-space: normal;
    }

    .survey-card {
        padding: 1.5rem 1.25rem;
    }

    .page-header {
        flex-direction: column;
        align-items: stretch;
    }

    .page-header > .d-flex {
        justify-content: flex-start;
    }

    /* Full-width tap targets for primary flows on small screens */
    .page-header .btn-modern {
        flex: 1 1 auto;
    }

    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.25rem; }

    /* Collapsed action cluster: see the max-width: 991.98px rule. Do not
       re-introduce wrap/row-gap here or the phone menu stacks centered again. */
    .navbar-modern .navbar-collapse .navbar-nav.ms-auto {
        flex-wrap: nowrap;
        align-items: flex-start !important;
        gap: 0.125rem !important;
        row-gap: 0;
    }

    /* Card header controls take their own full-width line */
    .card-header-split .chart-controls,
    .card-header-split .form-check {
        width: 100%;
    }

    .chart-controls .btn-group {
        flex: 1 1 100%;
    }

    .chart-controls .chart-select {
        flex: 1 1 auto;
        min-width: 0;
    }

    .chart-legend {
        column-gap: 1rem !important;
    }

    /* Wide metrics table scrolls inside its card rather than stretching it */
    .table-responsive > .table th,
    .table-responsive > .table td {
        white-space: nowrap;
    }

    .table-responsive > .table td.empty-state-cell {
        white-space: normal;
    }

    /* ── Campaign Metrics: restack as cards ──────────────────────────────
       Eight columns cannot be read on a phone even with a sideways scroll,
       so below this breakpoint each row becomes a self-contained card and
       every cell carries its column name via data-label. */
    .metrics-table-wrap {
        overflow-x: visible;
    }

    .metrics-table,
    .metrics-table > tbody,
    .metrics-table > tbody > tr,
    .metrics-table > tbody > tr > td {
        display: block;
        width: 100%;
    }

    /* Header is redundant once each cell is labelled, but keep it for
       screen readers rather than display:none. */
    .metrics-table > thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    .metrics-table > tbody > tr {
        position: relative;
        border: 1px solid var(--border-color);
        border-radius: var(--radius-lg);
        padding: 0.75rem 0.875rem;
        margin-bottom: 0.75rem;
        background: var(--bg-card);
    }

    /* Beats the .table-responsive > .table td nowrap rule above. */
    .table-responsive > .table.metrics-table > tbody > tr > td {
        white-space: normal;
        border: none;
        padding: 0.2rem 0;
        text-align: left;
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        gap: 1rem;
    }

    .metrics-table > tbody > tr > td::before {
        content: attr(data-label);
        font-size: 0.75rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.03em;
        color: var(--text-secondary);
    }

    /* Campaign name is the card title; checkbox pins to the top-right. */
    .table-responsive > .table.metrics-table > tbody > tr > td.name-cell {
        display: block;
        font-size: 1rem;
        font-weight: 600;
        padding-right: 2rem;
        margin-bottom: 0.35rem;
        overflow-wrap: anywhere;
    }

    .table-responsive > .table.metrics-table > tbody > tr > td.cb-cell {
        display: block;
        position: absolute;
        top: 0.75rem;
        right: 0.875rem;
        padding: 0;
        width: auto;
    }

    .metrics-table > tbody > tr > td.name-cell::before,
    .metrics-table > tbody > tr > td.cb-cell::before {
        content: none;
    }

    /* ── Cases inbox: restack as cards ─────────────────────────────────────
       Eight columns on a phone means a sideways-scrolling table where you can
       never see the deadline and the status at the same time (2026-10-25).
       Below this breakpoint each case becomes a card: badges on the first line,
       the respondent as the title, then labelled rows, then a full-width Open. */
    .cases-table-wrap {
        overflow-x: visible;
        padding: 0.875rem;
    }

    .cases-table,
    .cases-table > tbody,
    .cases-table > tbody > tr,
    .cases-table > tbody > tr > td {
        display: block;
        width: 100%;
    }

    /* Column headers stay for screen readers; the cells label themselves. */
    .cases-table > thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    /* One grid per case: badges and the respondent share the first line, every
       other field spans the full width as a labelled row. A grid (not absolute
       positioning) so a long name or a wide status badge can never overlap. */
    .cases-table > tbody > tr {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr) auto;
        align-items: center;
        column-gap: 0.4rem;
        border: 1px solid var(--border-color);
        border-radius: var(--radius-lg);
        padding: 0.75rem 0.875rem;
        margin-bottom: 0.75rem;
        background: var(--bg-card);
    }

    /* Beats the nowrap rule that travels with .table-responsive. */
    .table-responsive > .cases-table > tbody > tr > td {
        white-space: normal;
        border: none;
        padding: 0.2rem 0;
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        gap: 1rem;
        text-align: right;
        grid-column: 1 / -1;
    }

    .cases-table > tbody > tr > td::before {
        content: attr(data-label);
        font-size: 0.75rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.03em;
        color: var(--text-secondary);
        text-align: left;
    }

    /* First line: rating badge, respondent, status badge. */
    .table-responsive > .cases-table > tbody > tr > td.rating-cell {
        grid-column: 1;
        grid-row: 1;
        display: block;
        padding: 0;
        align-self: start;
    }

    .table-responsive > .cases-table > tbody > tr > td.respondent-cell {
        grid-column: 2;
        grid-row: 1;
        display: block;
        text-align: left;
        font-size: 1rem;
        font-weight: 600;
        line-height: 1.25;
        padding: 0;
        overflow-wrap: anywhere;
    }

    .table-responsive > .cases-table > tbody > tr > td.status-cell {
        grid-column: 3;
        grid-row: 1;
        display: block;
        padding: 0;
        align-self: start;
    }

    .cases-table > tbody > tr > td.rating-cell::before,
    .cases-table > tbody > tr > td.status-cell::before,
    .cases-table > tbody > tr > td.respondent-cell::before,
    .cases-table > tbody > tr > td.action-cell::before {
        content: none;
    }

    .table-responsive > .cases-table > tbody > tr > td.respondent-cell .small {
        font-weight: 400;
        font-size: 0.75rem;
    }

    /* Keep the status badge compact so the respondent column keeps its width. */
    .cases-table > tbody > tr > td.status-cell .badge {
        font-size: 0.68rem;
        padding: 0.25em 0.45em;
    }

    /* The comment needs the width — label above the text instead of beside it. */
    .table-responsive > .cases-table > tbody > tr > td.comment-cell {
        display: block;
        text-align: left;
        margin-top: 0.35rem;
    }

    .cases-table > tbody > tr > td.comment-cell::before {
        display: block;
        margin-bottom: 0.1rem;
    }

    .table-responsive > .cases-table > tbody > tr > td.action-cell {
        display: block;
        text-align: left;
        padding-top: 0.6rem;
    }

    .cases-table > tbody > tr > td.action-cell .btn {
        width: 100%;
    }

    /* The empty state is one message, not a case: no card chrome, no labels. */
    .table-responsive > .cases-table > tbody > tr.empty-row {
        display: block;
        border: none;
        padding: 1rem 0;
        background: none;
    }

    .table-responsive > .cases-table > tbody > tr.empty-row > td {
        display: block;
        text-align: center;
    }

    /* The empty state spans the whole card and must not be restacked. */
    .table-responsive > .table.metrics-table > tbody > tr.empty-row {
        border: none;
        padding: 0;
        background: none;
    }

    .table-responsive > .table.metrics-table > tbody > tr.empty-row > td {
        display: block;
        text-align: center;
    }

    .metrics-table > tbody > tr.empty-row > td::before {
        content: none;
    }
}

@media (max-width: 576px) {
    .container-modern {
        padding: 1rem 0.5rem;
    }

    .card-modern .card-body {
        padding: 0.875rem;
    }

    .card-modern .card-header-modern {
        padding: 0.75rem 0.875rem;
    }

    .metric-card {
        padding: 0.875rem 1rem;
    }

    /* Reclaim vertical space so the whole summary fits one phone screen. */
    .nps-display {
        padding: 1.25rem 1rem;
    }

    .nps-score-circle {
        width: 96px;
        height: 96px;
        font-size: 2rem;
    }

    .metric-card .metric-value {
        font-size: 1.625rem;
    }

    /* Response Statistics stays 3-across; shrink type so labels still fit. */
    .stat-row h3 {
        font-size: 1.25rem;
    }

    .stat-row p {
        font-size: 0.6875rem;
        margin-bottom: 0;
        overflow-wrap: anywhere;
    }

    /* Long campaign names / emails must wrap rather than widen the page. */
    .campaign-card h3,
    .metrics-table .name-cell {
        overflow-wrap: anywhere;
    }
}

/* Loading Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* Modal Improvements */
.modal-content {
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
}

.modal-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
}

.modal-title {
    font-weight: 600;
    font-size: 1.0625rem;
}

.modal-body {
    padding: 1.25rem;
}

.modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 0.875rem 1.25rem;
}

/* Campaign Table Styles */
.campaign-checkbox {
    cursor: pointer;
    width: 18px;
    height: 18px;
}

.inactive-campaign {
    opacity: 0.6;
}

.table-hover tbody tr:hover {
    background-color: #f8f9fb;
}

.page-section {
    margin-bottom: 1.25rem;
}

.page-section h2 {
    margin-bottom: 0.5rem;
}

.table th {
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

.table td {
    vertical-align: middle;
}

/* Sortable table headers */
.th-sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.th-sortable::after {
    content: ' ⇅';
    opacity: 0.3;
    font-size: 0.8em;
}

.th-sortable.sort-asc::after {
    content: ' ▲';
    opacity: 1;
}

.th-sortable.sort-desc::after {
    content: ' ▼';
    opacity: 1;
}

/* Keyboard shortcut kbd styling */
kbd {
    background: #f0f2f5;
    border: 1px solid #d3d8e1;
    border-radius: 4px;
    box-shadow: 0 1px 0 rgba(0,0,0,0.12);
    padding: 2px 6px;
    font-size: 0.85em;
    font-family: inherit;
    /* Bootstrap's default kbd is white-on-dark; our light background needs an
       explicit dark colour (without this, white text is unreadable in light mode). */
    color: var(--text-primary);
}

[data-theme="dark"] kbd {
    background: #333;
    border-color: #555;
    color: #e0e0e0;
    box-shadow: 0 1px 0 rgba(255,255,255,0.1);
}

/* Multi-key shortcuts (e.g. Ctrl + K) must stay on one line, side by side. */
.shortcut-keys {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}
.shortcut-keys .shortcut-sep {
    color: var(--text-secondary);
    font-size: 0.85em;
}

/* Shortcut hint badge on navbar (light chrome) */
.shortcut-hint {
    color: var(--text-secondary);
    font-size: 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 3px 7px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.shortcut-hint:hover {
    color: var(--text-primary);
    border-color: #c1c8d4;
}

/* NPS Trend Chart */
.chart-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.chart-controls .chart-select {
    width: auto;
}

.chart-legend {
    flex-wrap: wrap;
    /* beats Bootstrap's .gap-4 { gap: ... !important } for the wrapped rows */
    row-gap: 0.5rem !important;
}

/* Positioning context for the chart tooltips (siblings of the scroll
   container, so they must not be anchored to the scroller itself). */
.trend-chart-wrap {
    position: relative;
    width: 100%;
}

.trend-chart-container {
    position: relative;
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
}

.trend-chart-container svg {
    display: block;
    min-width: 280px;
    max-width: 100%;
}

.trend-chart-tooltip {
    position: absolute;
    background: var(--bg-card, white);
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 6px;
    padding: 10px 14px;
    font-size: 0.85rem;
    pointer-events: none;
    box-shadow: var(--shadow-md, 0 2px 6px rgba(0,0,0,0.15));
    opacity: 0;
    transition: opacity 0.15s ease;
    z-index: 10;
    color: var(--text-primary, rgba(0,0,0,0.87));
}

.trend-chart-tooltip.visible {
    opacity: 1;
}

.trend-chart-tooltip .tooltip-date {
    font-weight: 500;
    margin-bottom: 4px;
}

.trend-chart-tooltip .tooltip-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.trend-chart-tooltip .tooltip-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.trend-empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary, rgba(0,0,0,0.6));
}

.trend-empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
}

.trend-empty-state p {
    margin: 0;
    font-size: 1rem;
}

/* =============================================
   Comment Review Dashboard
   ============================================= */

.comment-card {
    transition: box-shadow 0.15s ease;
}

.comment-card:hover {
    box-shadow: var(--shadow-md, 0 2px 8px rgba(16,24,40,0.08));
}

.comment-card .card-body {
    padding: 1rem 1.25rem;
}

.rating-badge {
    flex-shrink: 0;
}

.comment-text {
    color: var(--text-primary, #1f2937);
    line-height: 1.6;
    font-size: 0.95rem;
    padding: 0.75rem;
    background: var(--background-light, #f7f8fa);
    border-radius: var(--radius-sm, 6px);
    white-space: pre-wrap;
    word-break: break-word;
}

[data-theme="dark"] .comment-text {
    background: rgba(255,255,255,0.05);
}

.respondent-name {
    font-size: 0.95rem;
}

/* Pagination styling */
.pagination {
    margin-top: 1.5rem;
}

.pagination .page-link {
    color: var(--text-primary, #1f2937);
    border-color: var(--border-color, #e5e8ee);
    padding: 0.4rem 0.75rem;
    font-size: 0.9rem;
}

.pagination .page-item.active .page-link {
    background: var(--primary-color, #2570e8);
    border-color: var(--primary-color, #2570e8);
    color: white;
}

.pagination .page-link:hover {
    background: var(--background-light, #f7f8fa);
}

[data-theme="dark"] .pagination .page-link {
    background: transparent;
    border-color: rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.85);
}

[data-theme="dark"] .pagination .page-link:hover {
    background: rgba(255,255,255,0.1);
}

[data-theme="dark"] .pagination .page-item.disabled .page-link {
    background: transparent;
    border-color: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.3);
}

/* ── Notification bell + live response feed (task #10) ─────────────── */

.notif-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 10px;
    background: #e74c3c;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 17px;
    text-align: center;
}

.notif-dropdown {
    width: 340px;
    max-width: 92vw;
    padding: 0;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
}

.notif-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    font-weight: 600;
    border-bottom: 1px solid rgba(0,0,0,0.08);
}

.notif-dropdown-header a {
    font-size: 0.8rem;
    font-weight: 500;
    text-decoration: none;
}

.notif-dropdown-list {
    max-height: 360px;
    overflow-y: auto;
}

.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 14px;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    transition: background 0.15s ease;
}

.notif-item:hover {
    background: rgba(0,0,0,0.03);
    color: inherit;
}

.notif-item-unread {
    background: rgba(37,112,232,0.07);
}

.notif-item-icon {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(37,112,232,0.12);
    color: #2570e8;
    font-size: 0.95rem;
}

.notif-item-body {
    flex: 1;
    min-width: 0;
}

.notif-item-title {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notif-comment,
.notif-details {
    font-size: 0.78rem;
    color: #6b7280;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.notif-item-meta {
    font-size: 0.7rem;
    color: #9ca3af;
    margin-top: 2px;
}

.notif-empty {
    padding: 24px 14px;
    text-align: center;
    color: #9ca3af;
    font-size: 0.85rem;
}

.notif-dropdown-footer {
    padding: 6px 10px;
    border-top: 1px solid rgba(0,0,0,0.08);
    text-align: center;
}

.notif-dropdown-footer .btn-link {
    font-size: 0.8rem;
    text-decoration: none;
}

/* Live response feed (dashboard card) */
.feed-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 4px;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.feed-item:hover {
    background: rgba(0,0,0,0.02);
    color: inherit;
}

.feed-item:last-child {
    border-bottom: none;
}

.feed-rating-badge {
    min-width: 28px;
    height: 28px;
    flex-shrink: 0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: #fff;
}

.feed-rating-promoter {
    background: #27ae60;
}

.feed-rating-passive {
    background: #f39c12;
}

.feed-rating-detractor {
    background: #e74c3c;
}

.feed-item-body {
    flex: 1;
    min-width: 0;
}

.feed-item-title {
    font-size: 0.85rem;
    font-weight: 600;
}

.feed-campaign {
    font-weight: 400;
    color: #6b7280;
}

.feed-comment {
    font-size: 0.8rem;
    color: #6b7280;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.feed-empty {
    padding: 20px 12px;
    text-align: center;
    color: #9ca3af;
    font-size: 0.85rem;
}

/* Notification center page */
.notif-center-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
}

.notif-center-item + .notif-center-item {
    border-top: 1px solid rgba(0,0,0,0.06);
}

.notif-center-item a.notif-center-link {
    color: inherit;
    text-decoration: none;
}

.notif-center-item a.notif-center-link:hover .notif-item-title {
    color: #2570e8;
}

/* ── Side-by-side campaign comparison (task #12) ───────────────────────── */
.compare-table th,
.compare-table td {
    vertical-align: middle;
    min-width: 160px;
}

.compare-table .compare-metric-label {
    min-width: 130px;
    width: 170px;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.9rem;
    background: var(--background-light);
}

.compare-campaign-head {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    font-weight: 600;
}

.baseline-col {
    background: rgba(37, 112, 232, 0.06);
    box-shadow: inset 0 0 0 1px rgba(37, 112, 232, 0.18);
}

.baseline-badge {
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    vertical-align: middle;
}

.nps-big {
    font-size: 1.35rem;
    line-height: 1.2;
}

.compare-delta {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 10px;
    white-space: nowrap;
}

.delta-pos {
    color: var(--success-color);
    background: rgba(31, 157, 85, 0.12);
}

.delta-neg {
    color: var(--danger-color);
    background: rgba(214, 69, 65, 0.12);
}

.delta-zero {
    color: var(--text-disabled);
    background: rgba(0, 0, 0, 0.05);
}

.dist-bar {
    display: flex;
    height: 14px;
    width: 100%;
    min-width: 140px;
    border-radius: 7px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.07);
}

.dist-seg {
    height: 100%;
    transition: width 0.4s ease;
}

.seg-promoter { background: #27ae60; }
.seg-passive  { background: #f39c12; }
.seg-detractor { background: #e74c3c; }

.dist-legend {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 6px;
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.dist-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.dot-promoter { background: #27ae60; }
.dot-passive  { background: #f39c12; }
.dot-detractor { background: #e74c3c; }

/* Dashboard: rows selected for comparison */
tr.compare-selected td {
    background: rgba(37, 112, 232, 0.05) !important;
}

.compare-checkbox {
    cursor: pointer;
}

/* Global search page (task #19): allow flex children to shrink/truncate */
.min-w-0 {
    min-width: 0;
}

/* ==========================================================================
   Command palette (task #23) — replaces the #19 navbar search box.
   Ctrl+K opens a modal listing commands + live global search results.
   ========================================================================== */
.command-palette-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(16, 24, 40, 0.45);
    align-items: flex-start;
    justify-content: center;
    padding: 12vh 16px 16px;
}

.command-palette-overlay.open {
    display: flex;
}

.command-palette {
    width: min(640px, 100%);
    background: var(--bg-card, #fff);
    border: 1px solid var(--border-color, #e5e8ee);
    border-radius: 12px;
    box-shadow: var(--shadow-lg, 0 8px 24px rgba(16, 24, 40, 0.12));
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 72vh;
}

.command-palette-overlay.open .command-palette {
    animation: cp-pop 0.12s ease-out;
}

@keyframes cp-pop {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.command-palette-input-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color, #e5e8ee);
}

.command-palette-search-icon {
    color: var(--text-secondary, #6b7280);
    font-size: 1.05rem;
    flex: none;
}

.command-palette-input {
    flex: 1;
    min-width: 0;
    border: none;
    outline: none;
    background: transparent;
    font-size: 1rem;
    color: var(--text-primary, #1f2937);
}

.command-palette-input::placeholder {
    color: var(--text-disabled, #9ca3af);
}

.command-palette-esc {
    font-size: 0.7rem;
    flex: none;
}

.command-palette-body {
    overflow-y: auto;
    padding: 8px;
}

.command-palette-footer {
    padding: 8px 16px;
    border-top: 1px solid var(--border-color, #e5e8ee);
    font-size: 0.72rem;
    color: var(--text-disabled, #9ca3af);
}

/* -- rows -- */
.cp-section {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-disabled, #9ca3af);
    padding: 10px 10px 4px;
}

.cp-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-primary, #1f2937);
}

.cp-item.cp-active {
    background: var(--bg-hover, rgba(37, 112, 232, 0.08));
}

.cp-item.cp-disabled {
    opacity: 0.45;
    cursor: default;
}

.cp-item.cp-muted {
    cursor: default;
    color: var(--text-secondary, #6b7280);
}

.cp-item-icon {
    width: 22px;
    text-align: center;
    color: var(--text-secondary, #6b7280);
    flex: none;
}

.cp-item.cp-active .cp-item-icon {
    color: var(--primary-color, #2570e8);
}

.cp-item-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.cp-item-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cp-item-snippet {
    font-size: 0.92rem;
}

.cp-item-sub {
    font-size: 0.78rem;
    color: var(--text-secondary, #6b7280);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cp-item-right {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary, #6b7280);
    flex: none;
}

.cp-item-lock {
    font-size: 0.8rem;
}

.cp-kbd {
    font-size: 0.72rem;
    padding: 1px 5px;
}

.cp-rating {
    flex: none;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
}

.cp-spin {
    display: inline-block;
    animation: cp-spin 1s linear infinite;
}

@keyframes cp-spin {
    to { transform: rotate(360deg); }
}

/* Command palette on phones (task: fit labels on mobile): use (nearly) the full
   viewport width and let long command/result labels wrap instead of truncating,
   so nothing critical is cut off at ~375px. Desktop keeps the compact
   single-line ellipsis. */
@media (max-width: 576px) {
    .command-palette-overlay {
        padding: 6vh 6px 6px;
    }

    .command-palette {
        width: 100%;
        max-height: 86vh;
    }

    .cp-item-label,
    .cp-item-sub {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
    }
}

/* Niotio brand lockup: theme-aware swap so the wordmark stays readable.
   Both variants are in the DOM (identical intrinsic size → no layout shift);
   only one is shown per theme. The dark variant is hidden here for light mode;
   dark-mode.css shows it and hides the light one when [data-theme="dark"]. */
.niotio-lockup-wrap {
    vertical-align: middle;
    line-height: 0;
}
.niotio-lockup {
    display: inline-block;
}
.niotio-lockup--dark {
    display: none;
}

/* Niotio gauge wait-spinner (needle sweep) — fixed box, theme via CSS vars */
.niotio-spinner {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;   /* md default */
    height: 2rem;
    flex: none;
    vertical-align: middle;
    line-height: 0;
}

.niotio-spinner--sm {
    width: 1.25rem;
    height: 1.25rem;
}

.niotio-spinner--lg {
    width: 2.5rem;
    height: 2.5rem;
}

.niotio-spinner-gauge {
    display: block;
    width: 100%;
    height: 100%;
}

.niotio-spinner-arc--primary {
    stroke: var(--primary-color, #2570e8);
}

.niotio-spinner-arc--light {
    stroke: var(--primary-light, #5b93ef);
}

.niotio-spinner-arc--success {
    stroke: var(--success-color, #1f9d55);
}

.niotio-spinner-needle path,
.niotio-spinner-needle circle {
    fill: var(--text-primary, #1f2937);
    stroke: var(--text-primary, #1f2937);
}

.niotio-spinner-needle {
    transform-origin: 0 0;
    animation: niotio-needle-sweep 1.6s ease-in-out infinite;
}

@keyframes niotio-needle-sweep {
    0%, 100% { transform: rotate(-110deg); }
    50%      { transform: rotate(110deg); }
}

@media (prefers-reduced-motion: reduce) {
    .niotio-spinner-needle {
        animation: niotio-needle-pulse 1.6s ease-in-out infinite;
        transform: rotate(20deg); /* rest near promoter zone */
    }
}

@keyframes niotio-needle-pulse {
    0%, 100% { opacity: 0.55; }
    50%      { opacity: 1; }
}

/* Themed metrics loading overlay (campaign detail) */
.metrics-loading-overlay {
    background: color-mix(in srgb, var(--bg-card, #fff) 75%, transparent);
}

/* Comment review: Promoter/Passive/Detractor filter pills (toggle a category on/off). */
.category-toggle {
    cursor: pointer;
    user-select: none;
    transition: opacity .15s ease, filter .15s ease;
}
.category-toggle[aria-pressed="false"] {
    opacity: .4;
    filter: grayscale(1);
}
.category-toggle:focus-visible {
    outline: 2px solid var(--primary-color, #1565c0);
    outline-offset: 2px;
}

/* Comment review: loading overlay that sits over the (kept) cards while a filter
   refetch is in flight, so the list does not blank out and reflow (wobble). */
.comments-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--bg-card, #fff) 78%, transparent);
    border-radius: 8px;
    z-index: 3;
}

/* Comment review: bounded first-paint skeleton. A small, fixed set of card-shaped
   placeholders (mirroring a real comment card) so the initial load paints structure
   instead of a bare "Loading...". Uses the theme tokens, so it adapts to dark mode. */
.comments-skeleton {
    display: block;
}
.comment-skeleton-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
}
.comment-skeleton-avatar {
    display: inline-block;
    width: 36px;
    height: 36px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--border-color);
    animation: comment-skeleton-pulse 1.4s ease-in-out infinite;
}
.comment-skeleton-line {
    display: block;
    height: 0.85rem;
    border-radius: 4px;
    background: var(--border-color);
    animation: comment-skeleton-pulse 1.4s ease-in-out infinite;
}
.comment-skeleton-line--sm {
    height: 0.65rem;
}
@keyframes comment-skeleton-pulse {
    0%, 100% { opacity: 0.55; }
    50%      { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
    .comment-skeleton-avatar,
    .comment-skeleton-line {
        animation: none;
        opacity: 0.7;
    }
}

/* ============================================================
   Campaign lifecycle panel (Direction C, 2026-10-13)
   Horizontal stepper + one primary action per stage; automation
   badges live in their own section so they don't read as status.
   ============================================================ */
.campaign-lifecycle .card-body {
    padding: 1.25rem 1.5rem;
}

.lifecycle-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.lifecycle-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.lifecycle-stepper {
    list-style: none;
    display: flex;
    margin: 0 0 1rem 0;
    padding: 0;
}

.lifecycle-step {
    flex: 1 1 0;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    padding: 0 0.5rem;
    text-align: center;
}

/* Connector line between stages, coloured by progress. */
.lifecycle-step::before {
    content: "";
    position: absolute;
    top: 0.8rem;
    left: -50%;
    width: 100%;
    height: 2px;
    background: var(--border-color);
    z-index: 0;
}

.lifecycle-step:first-child::before {
    display: none;
}

.lifecycle-marker {
    position: relative;
    z-index: 1;
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card, #fff);
    border: 2px solid var(--border-color);
    color: var(--text-disabled);
    font-size: 0.8rem;
}

.lifecycle-step.is-done .lifecycle-marker {
    border-color: var(--success-color);
    color: var(--success-color);
}

.lifecycle-step.is-current .lifecycle-marker {
    border-color: var(--primary-color);
    color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(37, 112, 232, 0.15);
}

.lifecycle-step.is-done::before,
.lifecycle-step.is-current::before {
    background: var(--success-color);
}

.lifecycle-step-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.lifecycle-step.is-current .lifecycle-step-label {
    color: var(--text-primary);
}

.lifecycle-step-hint {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-disabled);
}

.lifecycle-current {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--border-color);
}

.lifecycle-meaning {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.875rem;
    max-width: 44rem;
}

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

.lifecycle-automation {
    margin-top: 1rem;
    padding-top: 0.85rem;
    border-top: 1px dashed var(--border-color);
}

.lifecycle-automation-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

/* ------------------------------------------------------------
   Campaign list: "what this campaign is set up to do" chips.
   Only non-default settings render (CampaignFeatures), so a
   plain campaign card stays as quiet as it was.
   ------------------------------------------------------------ */
.campaign-feature-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin: 0.5rem 0 0.25rem;
}

.feature-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.15rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background-color: var(--background-light);
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
}

.feature-chip i {
    font-size: 0.8rem;
    color: var(--primary-color);
}

/* Integrations read as "wired up to something else", so they get the
   secondary accent instead of the primary one. */
.feature-chip.feature-integration i {
    color: var(--secondary-color);
}

/* ------------------------------------------------------------
   Spam-risk score of the survey email template.
   Lives here, not in the template fragment: a Thymeleaf
   th:replace only emits the selected fragment, so a <style>
   block next to it was never sent to the browser and the
   section rendered unstyled (found 2026-10-25).
   ------------------------------------------------------------ */
    .spam-score-block { font-size: 0.9rem; }

    /* --- own section inside the Email Customization card ------------------ */
    .spam-score-section {
        margin-top: 1.25rem;
        padding: 0.875rem 1rem;
        border: 1px solid var(--border-color);
        border-left: 3px solid var(--primary-color);
        border-radius: var(--radius);
        background-color: var(--background-light);
        font-size: 0.9rem;
    }
    .spam-score-section-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    .spam-score-section-title {
        display: inline-flex;
        align-items: center;
        gap: 0.4rem;
        color: var(--text-primary);
    }
    .spam-score-help { color: var(--text-secondary); }

    /* The marker next to a field label whose content produced findings. */
    .spam-field-warning {
        color: #c77700;
        margin-left: 0.25rem;
        cursor: help;
    }

    .spam-score-chip {
        display: inline-flex;
        align-items: center;
        gap: 0.4rem;
        padding: 0.25rem 0.6rem;
        border-radius: 999px;
        font-weight: 600;
        border: 1px solid transparent;
        white-space: nowrap;
    }
    .spam-score-risk { font-weight: 500; opacity: 0.85; }
    .spam-score-low      { background: #e6f4ea; color: #1e6b34; border-color: #b7dfc3; }
    .spam-score-moderate { background: #fff7e0; color: #8a6100; border-color: #f0d99a; }
    .spam-score-high     { background: #fff0e0; color: #9a4a00; border-color: #f3c99b; }
    .spam-score-critical { background: #fde8e8; color: #a11c1c; border-color: #f2b8b8; }
    .spam-score-details summary {
        cursor: pointer;
        color: var(--text-secondary);
        font-size: 0.85rem;
    }
    .spam-score-list li {
        display: flex;
        gap: 0.5rem;
        padding: 0.15rem 0;
        font-size: 0.85rem;
        color: var(--text-secondary);
    }
    .spam-score-points {
        min-width: 2.2rem;
        font-variant-numeric: tabular-nums;
        font-weight: 600;
        color: #b02a37;
    }
    .spam-score-clean { font-size: 0.85rem; color: #1e6b34; }

    [data-theme="dark"] .spam-score-clean { color: #7fd08f; }
    [data-theme="dark"] .spam-field-warning { color: #ffb74d; }


/* ------------------------------------------------------------
   Grouped settings pages: jump nav + section headings.
   Shared by the campaign Settings tab and the account /settings
   page, which both group long forms into labelled sections.
   ------------------------------------------------------------ */
.settings-section-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.settings-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.7rem;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background-color: var(--bg-card);
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-decoration: none;
}

.settings-nav-link:hover,
.settings-nav-link:focus-visible {
    color: var(--primary-color);
    border-color: var(--primary-color);
    background-color: rgba(37, 112, 232, 0.07);
}

.settings-nav-link i {
    font-size: 0.95rem;
}


.settings-section {
    scroll-margin-top: 1rem;
}

.settings-section + .settings-section {
    margin-top: 2rem;
}

.settings-group-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 1.5rem 0 0.15rem;
}

.settings-group-help {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
}

/* UIBot live pass (2026-10-26): long support address must wrap inside its footer column (768px). */
.footer .footer-contact-email {
    display: flex;
    align-items: baseline;
}
.footer .footer-contact-email a {
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* UIBot live pass: hamburger not flush against the right edge on small screens (pricing/marketing). */
@media (max-width: 991.98px) {
    .marketing-nav-toggler {
        margin-right: 0.5rem;
    }
}

/* UIBot live pass: all four lifecycle steps fit below 400px (step 4 "Anonymized" was clipped at 320px). */
@media (max-width: 399.98px) {
    .campaign-lifecycle .card-body {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
    .lifecycle-step {
        padding: 0;
        min-width: 0;
    }
    .lifecycle-step-label {
        font-size: 0.625rem;
        letter-spacing: -0.01em;
    }
    .lifecycle-step-hint {
        font-size: 0.5625rem;
        letter-spacing: 0;
    }
}
