/* ============================================
   Buttons
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
    /* Was `transition: all 0.2s`, which animates layout properties too --
       width, padding, border -- so buttons visibly reflowed as their label or
       state changed. Only the properties that actually change are listed. */
    transition: background-color var(--fast) var(--ease),
                border-color var(--fast) var(--ease),
                color var(--fast) var(--ease),
                box-shadow var(--fast) var(--ease),
                transform var(--fast) var(--ease),
                filter var(--fast) var(--ease);
}

/* Keyboard focus draws the shared ring; a mouse click does not, so pointer
   users never see a ring stuck on a button they just pressed. */
.btn:focus-visible,
.btn-icon:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

/* Press feedback. Nothing in the app acknowledged a click before this, which
   is most of why controls felt dead: you pressed, and the only confirmation
   was whatever happened next. A button that gives under the cursor reads as a
   physical control. */
.btn:active:not(:disabled) {
    transform: translateY(1px);
    transition-duration: 60ms;
}

.btn-primary {
    /* This claimed to make the primary "the brightest element on the page"
       while actually running accent -> mid (#7FA096 -> #6E9088), i.e. from the
       middle of the ramp downwards. Against near-black text that reads muted
       and slightly disabled rather than like the action you came to take.
       Moved up the ramp so it is genuinely the brightest thing on screen;
       dark text still measures better than 7:1 against the darker stop. */
    background: linear-gradient(180deg, #A9C6BB 0%, #86A79B 100%);
    border-color: rgba(0, 0, 0, 0.25);
    color: var(--on-accent);
    font-weight: 600;
    box-shadow: var(--elev-1);
}

/* Hover used to lift the button 2px and brighten it. Buttons that jump away
   from the cursor are the single loudest cheap-UI tell, and the movement
   nudged whatever sat beside them. Hover now only changes the surface. */
.btn-primary:hover:not(:disabled) {
    background: linear-gradient(180deg, #C9DED6 0%, #9BBBAF 100%);
    box-shadow: var(--elev-2), 0 0 0 1px var(--sage-glow);
}

.btn-outline {
    background: transparent;
    /* --border-color is a separator tone (1.22:1) and disappeared entirely on
       a dark surface. Controls use the mid green, which clears 3:1. */
    border-color: var(--green-mid);
    color: var(--text-primary);
}

.btn-outline:hover:not(:disabled) {
    background: var(--bg-hover);
    border-color: var(--green-accent);
    color: var(--green-bright);
}

/* .btn-secondary and .btn-danger are used throughout the markup but had NO
   rules anywhere. Since .btn sets `border: none` and no background, every one
   of them rendered as bare text -- which is why the footer buttons looked
   unfinished. */
.btn-secondary {
    background: var(--bg-hover);
    border-color: var(--green-mid);
    color: var(--text-primary);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-tertiary);
    border-color: var(--green-accent);
    color: var(--green-bright);
}

/* Destructive actions sit quietly until you reach for them. A solid red
   Delete beside every campaign row shouts as loudly as the action you
   actually came to take, and a row of shouting buttons is what makes a list
   feel cheap. Committed red is reserved for the confirm step. */
.btn-danger {
    background: transparent;
    border-color: rgba(248, 81, 73, 0.45);
    color: var(--danger);
    font-weight: 500;
}

.btn-danger:hover:not(:disabled) {
    background: var(--danger);
    border-color: var(--danger);
    color: var(--on-accent);
    font-weight: 600;
}

/* When a red button IS the committed action -- a confirmation dialog -- this
   makes it solid from the start. */
.btn-danger.btn-solid {
    background: var(--danger);
    border-color: rgba(0, 0, 0, 0.25);
    color: var(--on-accent);
    font-weight: 600;
    box-shadow: var(--elev-1);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-block {
    width: 100%;
}

/* Buttons the code disables during a submit looked and behaved exactly like
   live ones: :disabled does not stop :hover from matching. Every hover rule
   above is now guarded with :not(:disabled), and a disabled button reads as
   flat and inert rather than merely faded. */
.btn:disabled,
.btn.loading {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
    filter: grayscale(0.35);
}

/* This was also defined in pages.css, which loads last and therefore won --
   these rules never applied and editing them did nothing. The pages.css copy
   has been folded in here and removed from there. */
.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 4px 8px;
    cursor: pointer;
    font-size: 12px;
    border-radius: var(--radius-sm);
    transition: background-color var(--fast) var(--ease),
                color var(--fast) var(--ease);
}

.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* ============================================
   Cards
   ============================================ */
.card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    /* A flat 1px border on a near-black page gives a card no substance -- it
       reads as an outline drawn on the background rather than a surface
       resting on it. --elev-2 adds the top hairline that makes it sit up. */
    box-shadow: var(--elev-2);
}

/* Cards carried NO vertical margin, so any page stacking more than one -- the
   admin page has seven -- rendered them flush, borders touching, reading as
   one continuous slab rather than separate panels.
   
   Adjacent-sibling rather than a blanket margin-bottom: this adds space only
   BETWEEN cards, so a single card on a page gains no stray gap underneath it,
   and a card that already sits in a grid or flex layout is untouched. */
.card + .card {
    margin-top: 20px;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

/* ============================================
   Forms
   ============================================ */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-dark);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-family: inherit;
    transition: border-color var(--fast) var(--ease),
                box-shadow var(--fast) var(--ease),
                background-color var(--fast) var(--ease);
    background: var(--bg-input);
    /* This was --sage-green: everything the user typed came out in the muted
       accent (#7FA096) instead of body text (#E9EDEB), so every filled field
       looked greyed out and every form looked half-disabled. Typed input is
       the most important text on a form and now reads as primary text. */
    color: var(--text-primary);
}

/* A field should acknowledge the cursor before it is even clicked. */
.form-group input:hover:not(:disabled),
.form-group select:hover:not(:disabled),
.form-group textarea:hover:not(:disabled) {
    border-color: var(--green-mid);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--green-accent);
    /* The old ring was rgba(92,201,160,0.18) -- a mint that appears nowhere
       else, at an alpha low enough to be nearly invisible against the field.
       This one is the shared --focus-ring, so focus looks identical on every
       control in the app. */
    box-shadow: var(--focus-ring);
    background: var(--bg-secondary);
}

/* Selects were left as raw native controls: on a dark form the browser draws
   its own small grey arrow in its own style, which is the single most
   obvious "unfinished" tell on a form. appearance:none removes it and the
   chevron below is drawn to match the palette. The data: URI is allowed by
   the app's CSP, which permits data: under img-src. */
/* Every select in the app, not only the ones inside a .form-group -- the
   inbox's mailbox picker sits on its own and was still showing the browser's
   native arrow. */
.form-group select,
select.form-control,
select.mailbox-selector,
.main-content select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 38px;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23A9B3AE' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    cursor: pointer;
}

/* The dropdown list itself is drawn by the OS; without this it opens as white
   rows in the middle of a dark app. */
.main-content select option,
.form-group select option {
    background: var(--bg-primary);
    color: var(--text-primary);
}

/* The browser's default file input is a grey button and a filename, in the
   platform's own styling -- glaringly foreign on a dark form. */
.form-group input[type="file"] {
    padding: 8px 12px;
    cursor: pointer;
}

.form-group input[type="file"]::file-selector-button {
    margin-right: 12px;
    padding: 6px 12px;
    background: var(--bg-hover);
    border: 1px solid var(--green-mid);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    transition: background-color var(--fast) var(--ease),
                border-color var(--fast) var(--ease);
}

.form-group input[type="file"]::file-selector-button:hover {
    background: var(--bg-tertiary);
    border-color: var(--green-accent);
}

/* Checkboxes and radios were the platform's blue. One line puts them on the
   brand. */
input[type="checkbox"],
input[type="radio"] {
    accent-color: var(--green-accent);
    cursor: pointer;
}

/* A native range/number spinner on a dark field is the same problem. */
.form-group input[type="number"] {
    appearance: textfield;
    -moz-appearance: textfield;
}

/* A field the code has disabled should look it. */
.form-group input:disabled,
.form-group select:disabled,
.form-group textarea:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* Invalid only after the browser has something to judge, so a required field
   is not red the moment the form renders. */
.form-group input:not(:placeholder-shown):invalid {
    border-color: var(--danger);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-row {
    display: flex;
    gap: 16px;
}

.form-row .form-group {
    flex: 1;
}

.flex-1 {
    flex: 1;
}

.form-hint {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-muted);
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

/* ============================================
   Page Header
   ============================================ */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.page-header h1 {
    margin-bottom: 0;
}

.header-actions {
    display: flex;
    gap: 8px;
}

/* ============================================
   Stats Grid
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    text-align: center;
    box-shadow: var(--elev-1);
}

.stat-value {
    font-size: 28px;
    font-weight: 650;
    letter-spacing: -0.02em;
    /* Was --primary, the mid-accent green: a 28px figure in a muted sage
       against a card reads as disabled rather than as the headline number on
       the page. The figure is the content; the label beneath carries the hue. */
    color: var(--text-primary);
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ============================================
   Quick Actions
   ============================================ */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    transition: all 0.2s;
}

.action-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-on);
    text-decoration: none;
}

.action-icon {
    width: 24px;
    height: 24px;
}

/* ============================================
   Activity List
   ============================================ */
.activity-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
}

.activity-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.activity-content {
    flex: 1;
}

.activity-title {
    font-weight: 500;
}

.activity-time {
    font-size: 12px;
    color: var(--text-muted);
}

/* ============================================
   Status Badges
   ============================================ */
.status-badge,
.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.status-active,
.status-sent {
    background: rgba(127, 160, 150, 0.3);
    color: var(--mint-green);
}

.status-inactive,
.status-failed {
    background: rgba(232, 139, 130, 0.3);
    color: #E88B82;
}

.status-pending {
    background: rgba(212, 165, 116, 0.3);
    color: #D4A574;
}

.badge {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

/* ============================================
   Tables
   ============================================ */
/* Same story as .btn-icon: pages.css defined this table again and won. One
   definition now, here. */
.contacts-table-wrapper {
    overflow-x: auto;
    /* Vertical must stay visible or a sticky header/dropdown inside a cell
       would be clipped by the scroll container. */
    overflow-y: visible;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.contacts-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    /* Without a floor, a table with seven or eight columns inside a card gets
       squeezed until the cells run into each other -- which is what "the
       tables are overlapping" was. The wrapper already scrolls horizontally;
       this is what makes it actually do so instead of crushing the columns. */
    min-width: 920px;
}

/* Short values should not wrap onto two lines just because a neighbouring
   column is wide -- "Monthly" breaking to "Mont / hly" was the give-away. */
.contacts-table td,
.contacts-table th { white-space: nowrap; }

/* The two columns that legitimately hold long text may wrap. */
.contacts-table td:first-child,
.contacts-table th:first-child { white-space: normal; }

.contacts-table th,
.contacts-table td {
    padding: 12px 16px;
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
    /* Long unbroken tokens -- email addresses, user ids -- break rather than
       spilling out of their column. */
    overflow-wrap: anywhere;
}

.contacts-table th {
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    background: var(--bg-primary);
}

.contacts-table tr:hover {
    background: var(--bg-hover);
}

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

/* ============================================
   Modals
   ============================================ */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(3, 5, 4, 0.72);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-primary);
    border: 1px solid var(--border-dark);
    border-radius: var(--radius-xl);
    /* Lifts the dialog off the blurred backdrop. */
    box-shadow: var(--elev-3);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    /* The dialog is a column so a long form scrolls in its body while the
       header and footer stay put -- previously the whole box scrolled, which
       is how the campaign form's buttons ended up off-screen. */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modal-in var(--slow) var(--ease);
}

@keyframes modal-in {
    from { opacity: 0; transform: translateY(8px) scale(0.99); }
    to   { opacity: 1; transform: none; }
}

.modal-lg {
    max-width: 640px;
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.modal-close {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 22px;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
    transition: background-color var(--fast) var(--ease),
                color var(--fast) var(--ease);
}

.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.modal-close:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.modal-body {
    padding: 20px;
    /* The body is the part that scrolls, so the dialog's own actions stay
       reachable no matter how long the form is. */
    overflow-y: auto;
    flex: 1 1 auto;
}

/* This had no rules at all, so footer buttons sat in an unstyled row with
   default margins -- the cramped, floating look in the email modal. */
.modal-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 20px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-primary);
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
    flex-shrink: 0;
}

.modal-footer .btn {
    margin: 0;
}

/* Dismissal sits apart from the actions. */
.modal-footer .btn-outline:last-child {
    margin-left: auto;
}

/* ============================================
   Auth Page
   ============================================ */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    background: var(--bg-secondary);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.auth-container {
    width: 100%;
    max-width: 400px;
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    padding: 32px;
    box-shadow: var(--shadow-lg);
}

.auth-logo {
    text-align: center;
    margin-bottom: 24px;
}

.auth-logo img {
    max-width: 200px;
    height: auto;
    margin-bottom: 8px;
}

.auth-tagline {
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 1px;
    margin: 0;
}

.auth-header p {
    color: var(--text-muted);
}

.auth-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
}

.auth-tabs .tab-btn {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border-radius: var(--border-radius);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.auth-tabs .tab-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.auth-tabs .tab-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.auth-form .form-group {
    margin-bottom: 16px;
}

.auth-divider {
    text-align: center;
    margin: 16px 0;
    color: var(--text-muted);
    font-size: 12px;
}

.auth-message {
    text-align: center;
    padding: 20px;
}

.message-icon {
    font-size: 48px;
    margin-bottom: 16px;
}


.pricing-header {
    text-align: center;
    margin-bottom: 16px;
}

.pricing-header h3 {
    margin-bottom: 4px;
    color: var(--mint-green);
}

.feature-list {
    list-style: none;
    margin-bottom: 20px;
    padding: 0;
}

.feature-list li {
    padding: 6px 0;
    padding-left: 24px;
    position: relative;
    font-size: 13px;
    color: var(--text-secondary);
}

.feature-list li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--success);
    font-weight: bold;
}

.pricing-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.price-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 16px;
    text-align: center;
    position: relative;
}

.price-card.featured {
    border-color: var(--border-on);
    background: rgba(127, 160, 150, 0.1);
}

.price-card h4 {
    margin-bottom: 8px;
    font-size: 14px;
}

.price-card .price {
    font-size: 28px;
    font-weight: 700;
    color: var(--mint-green);
    margin-bottom: 12px;
}

.price-card .price span {
    font-size: 14px;
    font-weight: 400;
    color: var(--text-muted);
}

.badge-save {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--success);
    color: var(--on-accent);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
}

.pricing-note {
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 16px;
}

/* Plan Selection: two radio cards, monthly and annual. The input itself is
   hidden; the card is the control, and :has(:checked) lights it. */
.plan-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 16px;
}

.plan-option {
    position: relative;
    display: block;
    padding: 14px 12px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.plan-option:hover { border-color: var(--text-muted); }

.plan-option input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    pointer-events: none;
}

.plan-option:has(input:checked) {
    border-color: var(--border-on);
    background: var(--bg-secondary);
    box-shadow: inset 0 0 0 1px var(--primary);
}

.plan-option:has(input:focus-visible) {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.plan-details h4 {
    margin: 0 0 4px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.plan-details p {
    margin: 0;
    font-size: 14px;
    color: var(--text-secondary);
}

.plan-details p strong {
    font-size: 26px;
    font-weight: 650;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.plan-details small {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-muted);
}

.plan-badge {
    position: absolute;
    top: -9px;
    right: 10px;
    padding: 2px 8px;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--bg-primary);
    background: var(--primary);
    border-radius: 3px;
}

.trial-info {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 16px;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
}

.trial-info span {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

.trial-info svg {
    width: 14px;
    height: 14px;
    color: var(--sage-green);
}

/* Auth Switch & Terms */
.auth-switch {
    text-align: center;
    margin-top: 16px;
    font-size: 13px;
    color: var(--text-secondary);
}

.auth-switch a {
    color: var(--text-primary);
    font-weight: 600;
}

.auth-terms {
    text-align: center;
    margin-top: 12px;
    font-size: 11px;
    color: var(--text-muted);
}

.auth-terms a {
    color: var(--text-secondary);
    text-decoration: underline;
}

/* Form small text */
.form-group small {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    color: var(--text-muted);
}

.signup-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--mint-green);
    text-align: center;
    margin: 0 0 20px 0;
}

.auth-footer {
    margin-top: 24px;
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
}


/* Chip row: the pills under a picker, one per chosen item, each removable. */
.chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}
.chip-row:empty { display: none; }

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 6px 4px 10px;
    font-size: 13px;
    color: var(--text-primary);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    font-variant-numeric: tabular-nums;
}

.chip-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    padding: 0;
    font-size: 15px;
    line-height: 1;
    color: var(--text-muted);
    background: transparent;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
}
.chip-remove:hover { color: var(--text-primary); background: var(--bg-hover, var(--bg-secondary)); }
.chip-remove:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }

.check-row { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--text-secondary); cursor: pointer; margin: 4px 0 14px; }
.check-row input { margin-top: 3px; flex: 0 0 auto; }

.campaign-channel {
    display: inline-block;
    padding: 2px 7px;
    margin-right: 6px;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: var(--on-accent);
    background: var(--primary);
    border-radius: 3px;
    vertical-align: middle;
}

.seq-count { display: block; margin-top: 4px; font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* Texting page */
.texting-page .compliance-note {
    padding: 12px 14px;
    margin-bottom: 20px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--primary);
    border-radius: var(--radius-md, 8px);
}
.tx-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.tx-card {
    padding: 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    display: grid;
    gap: 12px;
}
.tx-card.is-off { opacity: 0.7; }
.tx-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.tx-card h3 { margin: 0 0 2px; font-size: 16px; }
.tx-number { margin: 0; font-size: 13px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.tx-provider { margin-left: 6px; padding: 1px 6px; font-size: 11px; color: var(--text-muted); border: 1px solid var(--border-color); border-radius: 3px; }
.tx-error { margin: 0; font-size: 12.5px; color: var(--danger, #B31D28); }
.tx-meta { margin: 0; display: grid; grid-template-columns: 5.5rem 1fr; gap: 6px 10px; font-size: 13px; }
.tx-meta dt { color: var(--text-muted); font-size: 11.5px; letter-spacing: 0.05em; text-transform: uppercase; padding-top: 2px; }
.tx-meta dd { margin: 0; color: var(--text-secondary); overflow-wrap: anywhere; }
.tx-webhook { font-size: 11.5px; }
.btn-link { background: none; border: 0; padding: 0 4px; color: var(--primary); cursor: pointer; font-size: 12px; }
.tx-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.btn-danger-text { color: var(--danger, #B31D28); }
.status-pill { padding: 3px 9px; font-size: 11px; font-weight: 600; border-radius: 999px; background: var(--bg-tertiary); color: var(--text-muted); white-space: nowrap; }
.status-pill.is-good { color: var(--success, #136A2C); background: color-mix(in srgb, var(--success, #136A2C) 12%, transparent); }
.status-pill.is-bad { color: var(--danger, #B31D28); background: color-mix(in srgb, var(--danger, #B31D28) 12%, transparent); }
.tx-section { margin-top: 32px; }
.tx-section .section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; }
.tx-section h2 { margin: 0; font-size: 16px; }
.inline-form { display: flex; gap: 6px; }
.form-control-sm { padding: 6px 10px; font-size: 13px; }
.tx-log .data-table td.tx-body { max-width: 46ch; overflow-wrap: anywhere; }
.tx-log tr.is-in td:first-child { color: var(--primary); font-weight: 600; }
.tx-log .nowrap { white-space: nowrap; }
.tag { display: inline-block; padding: 1px 6px; font-size: 10.5px; font-weight: 600; letter-spacing: 0.05em; border-radius: 3px; background: var(--bg-tertiary); color: var(--text-muted); vertical-align: middle; }
.tag.is-bad { color: var(--danger, #B31D28); }
.tx-optouts ul { list-style: none; margin: 0; padding: 0; }
.tx-optouts .chip.is-locked { border-style: dashed; }

/* Agents page */
.agent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.agent-card {
    display: grid;
    gap: 10px;
    padding: 16px;
    text-align: left;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    cursor: pointer;
    color: inherit;
    font: inherit;
    transition: border-color 0.15s, transform 0.15s;
}
.agent-card:hover { border-color: var(--border-on); transform: translateY(-1px); }
.agent-card:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.agent-card-head { display: flex; align-items: center; gap: 12px; }
.agent-card-head > div { flex: 1; min-width: 0; }
.agent-avatar {
    width: 38px; height: 38px; flex: 0 0 auto;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 650; font-size: 16px;
    color: var(--on-accent); background: var(--primary); border-radius: 50%;
}
.agent-name { font-weight: 600; font-size: 15px; }
.agent-biz { font-size: 12.5px; color: var(--text-muted); }
.agent-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ch-chip {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 9px; font-size: 12px; border-radius: 999px;
    color: var(--text-secondary); background: var(--bg-tertiary); border: 1px solid var(--border-color);
    font-variant-numeric: tabular-nums;
}
.ch-chip.is-on { border-color: var(--border-on); color: var(--text-primary); }
.ch-chip.is-on::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--success, #136A2C); }
.ch-chip.is-bad { border-color: var(--danger, #B31D28); }
.ch-chip.is-none { border-style: dashed; color: var(--text-muted); }
.agent-facts { font-size: 12.5px; color: var(--text-muted); }
.agent-facts.is-warn { color: var(--danger, #B42318); }
.tab-dot { color: var(--text-muted); font-weight: 500; }
.channel-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.channel-title { font-weight: 600; font-size: 15px; }
.channel-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.channel-intro { margin: 0 0 14px; }
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-secondary); cursor: pointer; }
.card-h { margin: 0 0 8px; font-size: 15px; }
.webhook-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.webhook-row code { font-size: 12px; overflow-wrap: anywhere; }
.spare-numbers { display: flex; flex-wrap: wrap; gap: 8px; }
.compliance-note.small { font-size: 12.5px; margin-bottom: 14px; }
.act-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.act-rows li { padding: 10px 12px; background: var(--bg-tertiary); border-radius: var(--radius-md, 8px); font-size: 13px; }
.act-body { margin-top: 4px; color: var(--text-secondary); white-space: pre-wrap; }
.text-muted.small { font-size: 12px; }

/* Inbox: text conversations */
.inbox-btn-primary { color: var(--on-accent); background: var(--primary); border-color: var(--primary); text-decoration: none; }
.sms-threads { display: grid; gap: 8px; padding: 8px; }
.sms-thread { border: 1px solid var(--border-color); border-radius: var(--radius-md, 8px); background: var(--bg-primary); }
.sms-thread summary { display: grid; grid-template-columns: 11rem 1fr auto; gap: 12px; padding: 10px 12px; cursor: pointer; list-style: none; align-items: baseline; }
.sms-thread summary::-webkit-details-marker { display: none; }
.sms-who { font-weight: 600; font-variant-numeric: tabular-nums; }
.sms-last { color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sms-when { color: var(--text-muted); font-size: 12px; white-space: nowrap; }
.sms-thread[open] > summary { border-bottom: 1px solid color-mix(in srgb, var(--text-primary) 10%, transparent); }
.sms-who .cv-av { margin-right: 8px; vertical-align: -7px; }

/* The conversation pane inside an open row.
   Several dark themes set --border-color within a hair of the surface it
   sits on, so edges here are mixed from the text colour instead: they read
   in every theme, light or dark. */
.cv { --cv-edge: color-mix(in srgb, var(--text-primary) 12%, transparent); --cv-well: color-mix(in srgb, var(--bg-secondary) 55%, var(--bg-primary));
      display: grid; gap: 12px; padding: 14px 16px 16px; }
.cv-av { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; flex: none;
    background: color-mix(in srgb, var(--primary) 18%, transparent); color: var(--primary); font-weight: 700; font-size: 12px; letter-spacing: .02em; }
.cv-av.lg { width: 40px; height: 40px; font-size: 15px; }
.cv-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cv-id { min-width: 0; }
.cv-id b { display: block; font-size: 15px; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cv-sub { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 3px; font-size: 12px; color: var(--text-muted); }
.cv-state { margin-left: auto; display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px; border-radius: 999px; font-size: 12px; font-weight: 500;
    color: var(--text-secondary); background: color-mix(in srgb, var(--text-primary) 7%, transparent); white-space: nowrap; }
.cv-state i { width: 7px; height: 7px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent); }
.cv-state.is-you { color: var(--warning, #B7791F); background: color-mix(in srgb, var(--warning, #B7791F) 12%, transparent); }
.cv-state.is-you i { background: var(--warning, #B7791F); box-shadow: 0 0 0 3px color-mix(in srgb, var(--warning, #B7791F) 22%, transparent); }
.cv .journey-strip { margin: 0; background: transparent; border: 1px solid var(--cv-edge); }
.cv-msgs { display: flex; flex-direction: column; gap: 12px; padding: 18px 18px 14px; max-height: 70vh; overflow-y: auto; overscroll-behavior: contain;
    background: var(--cv-well); border-radius: var(--radius-lg); }
.cv-empty { margin: 0; font-size: 13px; color: var(--text-muted); text-align: center; padding: 8px 0; }
.cv-audio { padding-top: 6px; }
.cv-audio audio { width: 100%; max-width: 420px; }
.msg { display: flex; flex-direction: column; align-items: flex-start; max-width: min(72%, 560px); }
.msg.is-out { align-self: flex-end; align-items: flex-end; }
.msg.is-grp + .msg { margin-top: -7px; }
.msg-b { padding: 10px 15px; border-radius: 18px; font-size: 14px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere;
    color: var(--text-primary); background: color-mix(in srgb, var(--text-primary) 9%, var(--bg-primary)); border: 1px solid color-mix(in srgb, var(--text-primary) 10%, transparent); }
.msg.is-in .msg-b { border-bottom-left-radius: 6px; }
.msg.is-out .msg-b { border-bottom-right-radius: 6px; background: color-mix(in srgb, var(--primary) 22%, var(--bg-primary)); border-color: color-mix(in srgb, var(--primary) 45%, transparent); }
.msg.is-human .msg-b { background: var(--primary); color: var(--on-accent); border-color: var(--primary); }
.msg.is-failed .msg-b { border-style: dashed; border-color: var(--danger, #B31D28); }
.msg-m { margin: 5px 8px 0; font-size: 11px; color: var(--text-muted); }
.msg-m b { color: var(--danger, #B31D28); font-weight: 600; }
.cv-reply { display: grid; gap: 8px; }
.cv-input { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 5px 5px 5px 18px; border: 1px solid color-mix(in srgb, var(--text-primary) 18%, transparent); border-radius: 999px;
    background: color-mix(in srgb, var(--text-primary) 5%, var(--bg-primary)); transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease), background-color var(--fast) var(--ease); }
.cv-input:focus-within { border-color: var(--primary); background: var(--bg-primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent); }
.cv-input input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 8px 0; font: inherit; font-size: 14.5px; color: var(--text-primary); outline: none; box-shadow: none; }
.cv-input input::placeholder { color: color-mix(in srgb, var(--text-primary) 50%, transparent); }
.cv-send { width: 38px; height: 38px; flex: none; border: 0; border-radius: 50%; background: var(--primary); color: var(--on-accent); cursor: pointer; padding: 0;
    display: inline-flex; align-items: center; justify-content: center; transition: transform var(--fast) var(--ease), opacity var(--fast) var(--ease); }
.cv-send svg { width: 18px; height: 18px; display: block; }
.cv-send:hover { transform: scale(1.06); }
.cv-send:disabled, .cv-input:has(input:placeholder-shown) .cv-send { opacity: .45; transform: none; }
.cv-tools { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 0 8px; font-size: 12px; color: var(--text-muted); }
.cv-spacer { flex: 1; }
.cv-link { background: none; border: 0; padding: 0; font: inherit; font-size: 12px; font-weight: 500; color: var(--text-secondary); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); }
.cv-link:hover { color: var(--text-primary); text-decoration-color: currentColor; }
.cv-link.is-quiet:hover { color: var(--danger, #B31D28); }
@media (max-width: 640px) { .cv-state { display: none; } .msg { max-width: 88%; } }

/* Web chat settings + inbox threads */
.chat-settings .chat-enabled-row { margin-bottom: 14px; font-size: 14px; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
@media (max-width: 640px) { .form-row-2 { grid-template-columns: 1fr; } }
.color-row { display: flex; gap: 8px; align-items: center; }
.color-row input[type="color"] { width: 40px; height: 36px; padding: 0; border: 1px solid var(--border-color); border-radius: 6px; background: none; }
.color-row input[type="text"] { width: 110px; font-variant-numeric: tabular-nums; }
.snippet-row { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; margin: 8px 0; }
.snip-label { flex: 0 0 90px; font-size: 12px; color: var(--text-muted); padding-top: 9px; }
.snippet-row code { flex: 1; min-width: 0; font-size: 12px; overflow-wrap: anywhere; padding: 8px 10px; background: var(--bg-tertiary); border-radius: 6px; }
.chat-meta { padding: 0 12px 6px; font-size: 12px; }
.unread-pip { display: inline-block; min-width: 18px; padding: 0 5px; font-size: 11px; line-height: 18px; text-align: center; color: var(--on-accent); background: var(--primary); border-radius: 999px; margin-left: 6px; }
.sms-bubble.is-human { background: var(--bg-primary); color: var(--text-primary); border: 1px solid var(--border-on); }
.sms-bubble.is-human small { color: var(--text-muted); }

/* Social tab: one tile per platform, the light says whether it is live. */
.social-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.social-tile {
    display: flex; flex-direction: column; align-items: flex-start; gap: 8px;
    padding: 14px; text-align: left; cursor: pointer; font: inherit; color: var(--text-primary);
    background: var(--bg-primary); border: 1px solid var(--border-color); border-radius: var(--radius-lg);
    transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.social-tile:hover { border-color: var(--border-dark); box-shadow: var(--elev-1); transform: translateY(-1px); }
.social-tile:focus-visible { outline: none; box-shadow: var(--focus-ring); }
/* Logos stay in colour whether or not the tile is connected; the light and the border say which. */
.social-tile.is-connected { border-color: var(--border-on); }
.social-tile.is-bad { border-color: var(--danger, #B31D28); }
.social-logo { display: inline-block; width: 36px; height: 36px; }
.social-logo svg { width: 100%; height: 100%; display: block; }
.social-logo img { width: 100%; height: 100%; display: block; object-fit: contain; border-radius: 8px; }
.social-logo.sm { width: 22px; height: 22px; vertical-align: -5px; margin-right: 4px; }
.social-name { font-weight: 600; font-size: 14px; }
.social-status { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); max-width: 100%; }
.social-status, .channel-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.social-light { display: inline-block; flex-shrink: 0; width: 8px; height: 8px; border-radius: 50%; background: var(--border-dark); }
.is-on .social-light { background: var(--success, #136A2C); box-shadow: 0 0 0 3px color-mix(in srgb, var(--success, #136A2C) 22%, transparent); }
.is-quiet .social-light { background: var(--warning, #B7791F); }
.is-bad .social-light { background: var(--danger, #B31D28); }
.is-on .social-status, .is-quiet .social-status, .is-bad .social-status { color: var(--text-primary); }
.social-modal-title { display: flex; align-items: center; font-size: 16px; margin: 0; }
.social-account { padding: 12px; margin-bottom: 12px; border: 1px solid var(--border-color); border-radius: var(--radius-md); display: grid; gap: 8px; }
.social-account.is-on { border-color: var(--border-on); }
.social-account.is-bad { border-color: var(--danger, #B31D28); }
.social-account .channel-title { display: flex; align-items: center; gap: 6px; }
.social-account-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.social-form-more { padding-top: 12px; border-top: 1px solid var(--border-color); }
.social-meta > summary { cursor: pointer; list-style: none; }
.social-meta > summary::before { content: '▸ '; color: var(--text-muted); }
.social-meta[open] > summary::before { content: '▾ '; }
.social-meta > summary + .card-body { padding-top: 0; }

/* ============================================
   Journeys and analytics
   ============================================ */
.journey-strip { padding: 10px 14px; margin: 8px 12px 4px; background: color-mix(in srgb, var(--bg-tertiary) 55%, var(--bg-primary)); border: 1px solid var(--border-color); border-radius: var(--radius-lg); font-size: 12.5px; }
.journey-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.journey-title { font-weight: 600; }
.btn-xs { padding: 2px 8px; font-size: 12px; }
.tag-won { background: color-mix(in srgb, var(--success, #136A2C) 16%, transparent); color: var(--success, #136A2C); border-color: transparent; font-weight: 600; }
.journey-chain { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 0; }
.jc-step { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-secondary); white-space: nowrap; }
.jc-step + .jc-step::before { content: ''; width: 14px; height: 1px; background: var(--border-dark); margin: 0 5px; }
.jc-more { font-size: 11px; color: var(--text-muted); margin-right: 6px; }
.jc-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--border-dark); flex-shrink: 0; }
.ch-email .jc-dot, .jc-dot.ch-email { background: #3F6055; }
.ch-sms .jc-dot, .jc-dot.ch-sms { background: #B7791F; }
.ch-voice .jc-dot, .jc-dot.ch-voice { background: #9F1239; }
.ch-chat .jc-dot, .jc-dot.ch-chat { background: #0E7490; }
.ch-web .jc-dot, .jc-dot.ch-web { background: #7C3AED; }
.ch-messenger .jc-dot, .jc-dot.ch-messenger { background: #0084FF; }
.ch-instagram .jc-dot, .jc-dot.ch-instagram { background: #E1306C; }
.ch-whatsapp .jc-dot, .jc-dot.ch-whatsapp { background: #25D366; }
.ch-telegram .jc-dot, .jc-dot.ch-telegram { background: #26A5E4; }
.ch-line .jc-dot, .jc-dot.ch-line { background: #06C755; }
.ch-viber .jc-dot, .jc-dot.ch-viber { background: #7360F2; }
.ch-slack .jc-dot, .jc-dot.ch-slack { background: #4A154B; }
.ch-discord .jc-dot, .jc-dot.ch-discord { background: #5865F2; }
.ch-bluesky .jc-dot, .jc-dot.ch-bluesky { background: #0085FF; }
.ch-reddit .jc-dot, .jc-dot.ch-reddit { background: #FF4500; }
.ch-x .jc-dot, .jc-dot.ch-x { background: #111; }
.jc-step.is-received { color: var(--text-primary); font-weight: 500; }
.jc-step.is-goal { color: var(--success, #136A2C); font-weight: 600; }
.jc-step.is-goal .jc-dot { background: var(--success, #136A2C); box-shadow: 0 0 0 3px color-mix(in srgb, var(--success, #136A2C) 22%, transparent); }
.jc-step.is-visit { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; }

.an-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.seg { display: inline-flex; padding: 3px; border: 1px solid var(--border-color); border-radius: 999px; background: var(--bg-primary); box-shadow: var(--elev-1); }
.seg-btn { border: 0; background: none; padding: 5px 13px; font: inherit; font-size: 12.5px; font-weight: 500; color: var(--text-secondary); cursor: pointer; border-radius: 999px; transition: background-color var(--fast) var(--ease), color var(--fast) var(--ease); }
.seg-btn:hover { color: var(--text-primary); }
.seg-btn.is-on { background: var(--primary); color: var(--on-accent); }
.seg-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
/* Cards on this tab sit in a grid; the global .card + .card gap would stagger them. */
.an-card { margin: 0 0 14px; }
.an-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; margin-bottom: 14px; }
.an-grid > .an-card { margin: 0; }
.an-card .card-body { padding: 18px 20px; }
.an-card .card-h-row { margin-bottom: 12px; }
.an-card .card-h-row .card-h { font-size: 15px; }
.an-card > .card-body > p.small { margin: -6px 0 12px; }
/* Funnel: one row of stages, each a column with its bar. */
.funnel-bars { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 12px 0; }
.funnel-stage { padding: 6px 18px 4px 0; margin-right: 18px; border-right: 1px solid var(--border-color); }
.funnel-stage:last-child { border-right: 0; margin-right: 0; padding-right: 0; }
.funnel-name { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); }
.funnel-n { font-size: 30px; font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.2; margin: 4px 0 8px; color: var(--text-primary); }
.funnel-bar { height: 6px; background: var(--bg-tertiary); border-radius: 3px; overflow: hidden; }
.funnel-bar i { display: block; height: 100%; width: var(--w, 0%); background: var(--primary); border-radius: 3px; transition: width var(--slow) var(--ease); }
.funnel-sub { font-size: 12px; color: var(--text-muted); margin-top: 8px; }
.funnel-value .funnel-n { color: var(--success, #136A2C); }
.funnel-value .funnel-bar i { background: var(--success, #136A2C); }
.an-table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.an-table th { text-align: left; font-weight: 600; color: var(--text-muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; padding: 6px 8px; border-bottom: 1px solid var(--border-color); }
.an-table td { padding: 8px; border-bottom: 1px solid var(--border-color); }
.an-table td:first-child { white-space: nowrap; }
.an-table tr:last-child td { border-bottom: 0; }
.card-h-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.card-h-row .card-h { margin: 0; }
.an-empty { display: grid; justify-items: center; gap: 4px; padding: 26px 12px; text-align: center; border: 1px dashed var(--border-color); border-radius: var(--radius-md); color: var(--text-muted); font-size: 13px; }
.an-empty b { color: var(--text-secondary); font-weight: 600; }
.an-empty-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--bg-tertiary); border: 2px solid var(--border-dark); margin-bottom: 4px; }
.journey-rows { display: grid; gap: 8px; }
.journey-row { padding: 10px 12px; border: 1px solid var(--border-color); border-radius: var(--radius-md); background: var(--bg-primary); }
.journey-row.is-won { border-color: color-mix(in srgb, var(--success, #136A2C) 50%, var(--border-color)); }
.journey-who { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.rule-list { display: grid; gap: 6px; margin-bottom: 12px; }
.rule { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border-color); border-radius: var(--radius-md); background: var(--bg-secondary); }
.rule.is-off { opacity: .55; }
.rule-side { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.rule-msg { margin-top: 3px; white-space: pre-wrap; }
.switch.sm { margin: 0; }
/* The add-a-goal / add-a-trigger panels: real form groups, tucked away until asked for. */
.an-add { margin-top: 12px; padding: 14px 16px 4px; border: 1px solid var(--border-color); border-radius: var(--radius-md); background: var(--bg-secondary); }
.an-add .form-group { margin-bottom: 12px; }
.an-add .form-actions { margin: 0 0 10px; display: flex; gap: 8px; }
.int-lookup { display: flex; gap: 8px; align-items: flex-start; }
.int-lookup .form-group { flex: 1; margin: 0; }
.hours-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 10px; }

/* Integrations tab */
.perm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 6px 14px; }
.int-hours > summary { cursor: pointer; }
.day-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.day-pills .pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border: 1px solid var(--border-color); border-radius: 999px; font-size: 12px; cursor: pointer; }
.day-pills .pill:has(input:checked) { border-color: var(--border-on); background: color-mix(in srgb, var(--primary) 14%, transparent); }
.int-preview { margin: 10px 0 0; padding: 12px; background: var(--bg-tertiary); border-radius: var(--radius-md); font-size: 12px; white-space: pre-wrap; max-height: 320px; overflow: auto; }
.act-list { display: grid; gap: 6px; }
.act-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px 10px; background: var(--bg-tertiary); border-radius: var(--radius-md); font-size: 13px; }

/* Campaign builder */
.modal-xl { max-width: 900px; }
.bld .bld-card { padding: 16px 18px 6px; border: 1px solid var(--border-color); border-radius: var(--radius-lg); background: var(--bg-primary); margin-bottom: 14px; }
.bld-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.bld-grid-3 { grid-template-columns: 1fr 1fr 1.4fr; }
@media (max-width: 680px) { .bld-grid, .bld-grid-3 { grid-template-columns: 1fr; } }
.bld-h { margin: 0 0 10px; font-size: 14px; font-weight: 600; }
.bld-h-loose { margin-top: 6px; }
.bld-sub { margin: -4px 0 12px; font-size: 12.5px; color: var(--text-muted); line-height: 1.5; }
.bld .form-group { margin-bottom: 14px; }
.bld-channels { display: grid; gap: 12px; margin-bottom: 8px; }
.bld-ch { border: 1px solid var(--border-color); border-radius: var(--radius-lg); background: var(--bg-secondary); overflow: hidden; }
.bld-ch.is-on { border-color: var(--border-on); background: var(--bg-primary); box-shadow: var(--elev-1); }
.bld-ch-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; cursor: pointer; }
.bld-ch-head input { flex: 0 0 auto; width: 16px; height: 16px; }
.bld-ch-icon { width: 24px; height: 24px; color: var(--primary); flex: 0 0 auto; }
.bld-ch-icon svg { width: 100%; height: 100%; display: block; }
.bld-ch-title { flex: 1; min-width: 0; }
.bld-ch-title b { display: block; font-size: 14px; }
.bld-ch-title small { display: block; color: var(--text-muted); font-size: 12px; }
.bld-ch-state { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.bld-ch.is-on .bld-ch-state { color: var(--primary); font-weight: 600; }
.bld-ch-body { padding: 14px 16px 12px; border-top: 1px solid var(--border-color); }
.bld-ch-body .vx-switch { margin: 0 0 10px; }
.chip-x { border: 0; background: none; cursor: pointer; font-size: 14px; line-height: 1; color: var(--text-muted); padding: 0 2px; }
.chip-x:hover { color: var(--text-primary); }
.bld-lane-head { display: flex; align-items: baseline; gap: 10px; margin: 6px 0 10px; }
.bld-lane-head h5 { margin: 0; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-secondary); }
.bld-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.bld-step { border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 12px 14px 4px; background: var(--bg-secondary); }
.bld-step-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.bld-step-n { width: 22px; height: 22px; border-radius: 50%; background: var(--primary); color: var(--on-accent); font-size: 12px; font-weight: 600; display: grid; place-items: center; flex-shrink: 0; }
.bld-step-title { font-weight: 600; font-size: 13.5px; }
.bld-wait { display: inline-flex; align-items: center; gap: 6px; }
.bld-wait input { width: 60px; padding: 4px 8px; font-size: 13px; border: 1px solid var(--border-dark); border-radius: var(--radius-md); background: var(--bg-input); color: var(--text-primary); text-align: center; }
.bld-step-head .btn-icon { margin-left: auto; }
.bld-step .form-group { margin-bottom: 10px; }
.bld-step textarea { resize: vertical; }
.bld-add-row { margin: 10px 0 2px; }
/* The review dialog: the same numbers and plan the builder used to unfold at
   its own foot, in a dialog of their own. */
.bld-confirm-lead { margin-top: 0; }
.bld-confirm .bld-review-nums { margin: 0 0 18px; padding: 14px 16px; border: 1px solid var(--border-on); border-radius: var(--radius-lg); background: var(--bg-secondary); }
.bld-confirm .bld-plan { margin-bottom: 14px; }
.bld-review-nums { display: flex; flex-wrap: wrap; gap: 18px; margin: 6px 0 10px; }
.bld-review-nums b { font-size: 22px; font-weight: 650; margin-right: 6px; font-variant-numeric: tabular-nums; }
.bld-review-nums span { font-size: 13px; color: var(--text-muted); }
.bld-plan { margin: 0 0 8px; padding-left: 20px; font-size: 13.5px; line-height: 1.6; }

/* Voice / SMS tab */
.vx-switches { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; margin: 4px 0 14px; }
.vx-switch { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border-color); border-radius: var(--radius-md); background: var(--bg-secondary); cursor: pointer; font-size: 13.5px; color: var(--text-primary); margin: 0 0 8px; }
.vx-switch input { margin-top: 3px; flex: 0 0 auto; }
.vx-switch b { display: block; font-weight: 600; }
.vx-switch small { display: block; color: var(--text-muted); font-size: 12px; line-height: 1.45; margin-top: 2px; }
.vx-switch:has(input:checked) { border-color: var(--border-on); background: var(--bg-primary); }
.form-group label.vx-switch { display: flex; }
.form-row-2[hidden], .bld-grid[hidden], .an-grid[hidden] { display: none; }

/* ===== Agent identity: brain, instructions, booking, knowledge ===== */
.brain-h { font-size: 15px; font-weight: 600; margin: 0 0 4px; color: var(--text-primary); }
.brain-h-loose { margin-top: 28px; }
.brain-sub { margin: 0 0 16px; font-size: 13px; line-height: 1.5; max-width: 68ch; }
.brain-form .form-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.brain-note { font-size: 12.5px; line-height: 1.5; color: var(--text-secondary); background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 10px 12px; margin: 0 0 14px; max-width: 72ch; }
.brain-status { font-size: 13px; color: var(--primary); }
.brain-status.is-warn { color: var(--danger, #B42318); }

/* Website tab: where to paste the snippet, per platform */
.install-guide { margin-top: 10px; }
.install-guide summary { cursor: pointer; }
.install-steps { display: grid; grid-template-columns: max-content 1fr; gap: 8px 14px; margin: 12px 0 4px; font-size: 13px; }
.install-steps dt { font-weight: 600; color: var(--text-primary); }
.install-steps dd { margin: 0; color: var(--text-secondary); line-height: 1.5; }
.install-steps code { font-size: 12px; }

/* Inbox: one feed for every channel */
.ch-tag { background: color-mix(in srgb, var(--primary) 12%, transparent); color: var(--primary); }
.feed-src { color: var(--text-muted); font-weight: 400; }
.feed-email { cursor: pointer; }
.feed-email:hover { border-color: var(--border-dark); }
.feed-email:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.feed-head { display: grid; grid-template-columns: 11rem 1fr auto; gap: 12px; padding: 10px 12px; align-items: baseline; }
.feed-mid { min-width: 0; display: grid; gap: 2px; }
.feed-subject { color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-email.unread .sms-who::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--primary); margin-right: 7px; vertical-align: 1px; }
.feed-email.unread .feed-subject, .feed-email.unread .sms-who { font-weight: 700; }
.feed-note { display: flex; align-items: center; gap: 8px; margin: 8px 8px 0; padding: 8px 12px; font-size: 12.5px; color: var(--text-muted); background: var(--bg-tertiary); border-radius: var(--radius-md, 8px); }
.feed-note .spinner-ring { display: inline-block; }
.feed-note.is-warn { color: var(--danger, #B31D28); }
@media (max-width: 640px) { .feed-head, .sms-thread summary { grid-template-columns: 1fr auto; } .feed-head .sms-who, .sms-thread summary .sms-who { grid-column: 1 / -1; } }
.rail-foot { display: flex; align-items: center; gap: 6px; min-width: 0; }
.rail-foot .rail-box { flex: 0 1 auto; }

/* ---------------------------------------------------------------- voice tab */
/* The save row is the end of the voice form; the texting card follows it
   and was sitting flush against the buttons. */
.voice-actions { margin: 4px 0 22px; }
#voice-own { margin: 4px 0 16px; padding: 14px 16px; border: 1px solid var(--border-color); border-radius: var(--radius-lg); background: var(--bg-secondary); }
.voice-load-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 2px 0 16px; }
.voice-clone { padding-top: 14px; border-top: 1px solid var(--border-color); }
.voice-clone h4 { margin: 0; font-size: 14px; }
.voice-clone .card-h-row { margin-bottom: 10px; flex-wrap: wrap; gap: 6px 12px; }
.clone-sample { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.clone-sample .btn { margin: 0; }
#clone-record.is-recording { color: var(--danger); border-color: var(--danger); }
#clone-preview:not([hidden]) { display: block; width: 100%; margin-top: 8px; height: 36px; }
.voice-clone .form-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 4px; }

/* ------------------------------------------------------- chat widget picture */
.chat-avatar-row { display: flex; align-items: center; gap: 14px; }
.chat-avatar-preview {
    width: 56px; height: 56px; flex: 0 0 56px; border-radius: 50%;
    display: grid; place-items: center; overflow: hidden;
    background: var(--primary); color: var(--on-accent); font-weight: 600; font-size: 20px;
}
.chat-avatar-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.chat-avatar-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.chat-avatar-actions .form-hint { flex-basis: 100%; }
.chat-avatar-actions .btn { margin: 0; line-height: 1.2; }
/* Inside a .form-group every label is block-level; this one is a check row. */
.form-group label.chat-avatar-nudge { display: flex; align-items: center; gap: 8px; margin: 10px 0 0; width: auto; }
.form-group .chat-avatar-nudge input { width: auto; padding: 0; margin: 0; flex: 0 0 auto; }

/* ------------------------------------------------------------ saved secrets */
.saved-pill {
    display: inline-flex; align-items: center; gap: 5px;
    margin-top: 6px; padding: 2px 9px;
    font-size: 11px; font-weight: 600; border-radius: 999px;
    color: var(--success, #3FB950); background: color-mix(in srgb, var(--success, #3FB950) 14%, transparent);
}
.saved-pill::before { content: '✓'; font-size: 10px; }
.saved-pill.is-changed { color: var(--text-muted); background: var(--bg-tertiary); }
.saved-pill.is-changed::before { content: '↻'; }
input.is-saved { letter-spacing: 0.12em; }

/* --------------------------------------------------------- rich messages */
.msg-b a { color: inherit; text-decoration: underline; text-underline-offset: 2px; word-break: break-all; }
.msg-b img { display: block; max-width: 100%; max-height: 260px; border-radius: 12px; margin: 6px 0 2px; object-fit: cover; }

/* Channel and file icons: line drawings in the text colour. */
.ch-ic { width: 13px; height: 13px; flex: none; opacity: .85; }
.channel-title .ch-ic { width: 16px; height: 16px; vertical-align: -3px; margin-right: 6px; }
.doc-icon { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; color: var(--text-secondary); }
.doc-ic { width: 22px; height: 22px; }
.doc-ext { font-size: 9px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; line-height: 1; }
