/* ==========================================================================
   Zeckta – SMS Campaign (Create + Preview)
   Clean, single-source-of-truth stylesheet. No duplicate rules.
   ========================================================================== */

/* ── Alpine cloak ─────────────────────────────────────────────────────────── */
[x-cloak] { display: none !important; }

/* ==========================================================================
   PAGE SHELL
   ========================================================================== */

.campaign-page {
    min-height: auto;
    padding: 40px 0 calc(8rem + env(safe-area-inset-bottom, 0)) 0;
    font-size: 14px;
    color: #0f172a;
}

.campaign-container {
    width: 70%;
    margin: 0 auto;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

@media (max-width: 768px) {
    .campaign-container {
        width: auto;
    }
}

/* ==========================================================================
   CREATE PAGE — TWO-COLUMN LAYOUT (form + phone)
   ========================================================================== */

.campaign-layout {
    display: grid;
    gap: 28px;
    align-items: start;
}

.campaign-main   { min-width: 0; }

.campaign-container,
.campaign-layout,
.campaign-main {
    min-height: 0;
}

.campaign-phone-column {
    padding-top: 44px;
    position: sticky;
    top: 20px;
    align-self: start;
}

@media (max-width: 1100px) {
    .campaign-layout {
        grid-template-columns: 1fr;
    }
    .campaign-phone-column {
        position: static;
        margin-top: 24px;
        display: flex;
        justify-content: center;
    }
}

/* ==========================================================================
   HEADER
   ========================================================================== */

.campaign-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    background: linear-gradient(to bottom, #ffffff, #f9fafb);
}

.campaign-header h2 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 4px;
    color: #111827;
}

.campaign-header p {
    font-size: 14px;
    color: #6b7280;
    margin: 0;
}

/* ==========================================================================
   FORM SECTIONS
   ========================================================================== */

.campaign-section {
    padding: 24px;
    border-bottom: 1px solid #e5e7eb;
}

.campaign-section:last-of-type { border-bottom: none; }

/* ── Labels ── */
.campaign-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #111827;
}

.campaign-label span {
    color: #dc2626;
    margin-left: 2px;
}

.campaign-label-sm {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
    color: #374151;
}

/* ── Inputs ── */
.campaign-input,
.campaign-select,
.campaign-textarea {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 14px;
    background: #ffffff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    font-family: inherit;
}

.campaign-textarea {
    min-height: 120px;
    resize: vertical;
    line-height: 1.6;
}

.campaign-input:focus,
.campaign-select:focus,
.campaign-textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.campaign-input:disabled,
.campaign-select:disabled,
.campaign-textarea:disabled {
    background: #f3f4f6;
    cursor: not-allowed;
    opacity: 0.6;
}

/* ── Help text ── */
.campaign-help {
    font-size: 13px;
    color: #6b7280;
    margin-top: 6px;
    line-height: 1.5;
}

/* ==================================================================
   FORM SECTION ROWS (2 columns inside campaign-main)
   ================================================================== */

.campaign-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
}

.campaign-row .campaign-section {
    border-bottom: 1px solid #e5e7eb;
}

.campaign-row .campaign-section:first-child {
    border-right: 1px solid #e5e7eb;
}

.campaign-row .campaign-section.full {
    grid-column: span 2;
    border-right: none;
}

@media (max-width: 900px) {
    .campaign-row {
        grid-template-columns: 1fr;
    }

    .campaign-row .campaign-section:first-child {
        border-right: none;
    }

    .campaign-row .campaign-section.full {
        grid-column: span 1;
    }
}

/* ==========================================================================
   GATE SCREENS — no-sender + no-balance
   ========================================================================== */

.no-sender-widget {
    text-align: center;
    max-width: 480px;
    margin: 0 auto;
}

.no-sender-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #eff6ff;
    color: #2563eb;
}

.no-sender-icon--danger {
    background: #fef2f2;
    color: #dc2626;
}

.no-sender-title {
    font-size: 20px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 8px;
}

.no-sender-text {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 20px;
}

/* ==========================================================================
   CONTACT GROUP SELECTOR
   ========================================================================== */

.contacts-panel {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #ffffff;
    max-height: 260px;
    overflow-y: auto;
    padding: 6px;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.04);
}

.contacts-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s ease, border 0.15s ease;
    border: 1px solid transparent;
}

.contacts-item:hover { background: #f8fafc; }

.contacts-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #3b82f6;
    cursor: pointer;
}

.contacts-item strong { font-size: 14px; font-weight: 600; color: #111827; }
.contacts-item span   { font-size: 14px; color: #374151; }
.contacts-item small  { font-size: 12px; color: #6b7280; margin-left: 6px; }

.contacts-divider {
    height: 1px;
    background: #e5e7eb;
    margin: 6px 0;
}

.contacts-selected {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.contacts-selected .badge {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 999px;
    background: #dbeafe;
    color: #1e40af;
    font-weight: 600;
}

.contacts-panel::-webkit-scrollbar        { width: 6px; }
.contacts-panel::-webkit-scrollbar-thumb  { background: #cbd5e1; border-radius: 6px; }

.total-recipients-count { margin-top: 10px !important; }
.tag-length-display     { margin-top: 10px !important; }

/* ==========================================================================
   RECIPIENT TABS
   ========================================================================== */

.campaign-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.campaign-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    color: #374151;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    white-space: nowrap;
}

.campaign-tab:hover    { background: #f9fafb; border-color: #d1d5db; }
.campaign-tab.active   { background: #3b82f6; color: #ffffff; border-color: #3b82f6; }
.campaign-tab:disabled { opacity: 0.4; cursor: not-allowed; }

.tab-content { /* hook for JS */ }

/* ==========================================================================
   PERSONALISATION HINT
   ========================================================================== */

.personalisation-hint {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    margin-bottom: 10px;
    border-radius: 8px;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    font-size: 13px;
    color: #0369a1;
    line-height: 1.5;
}

.personalisation-hint svg      { flex-shrink: 0; width: 16px; height: 16px; color: #0ea5e9; }
.personalisation-hint strong   { font-weight: 600; color: #0369a1; }

/* ==========================================================================
   CHECKBOXES
   ========================================================================== */

.campaign-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    user-select: none;
}

.campaign-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
    border-radius: 4px;
}

/* ==========================================================================
   BADGES (message section + recipient tabs)
   ========================================================================== */

.campaign-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 0;
    align-items: center;
}

.campaign-badges .badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: #475569;
}

.campaign-badges .badge strong { font-weight: 700; color: #0f172a; }

.campaign-badges .badge-primary { background: #dbeafe; border-color: #93c5fd; color: #1e40af; }
.campaign-badges .badge-success { background: #dcfce7; border-color: #86efac; color: #166534; }
.campaign-badges .badge-warning { background: #fef3c7; border-color: #fde047; color: #92400e; }
.campaign-badges .badge-error   { background: #fee2e2; border-color: #fca5a5; color: #991b1b; }

/* ==========================================================================
   PLACEHOLDER DROPDOWN
   ========================================================================== */

.placeholder-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    background: #ffffff;
    color: #374151;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.placeholder-button:hover { background: #f9fafb; border-color: #3b82f6; color: #3b82f6; }

.placeholder-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    width: 320px;
    max-width: 100%;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 10px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);
    z-index: 50;
    overflow: hidden;
}

.placeholder-dropdown.drop-up {
    top: auto;
    bottom: 100%;
    margin-top: 0;
    margin-bottom: 4px;
}

.placeholder-search {
    padding: 8px;
    border-bottom: 1px solid #e5e7eb;
}

.placeholder-search-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
    outline: none;
}

.placeholder-search-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.placeholder-list { max-height: 280px; overflow-y: auto; }

.placeholder-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    background: #ffffff;
    text-align: left;
    cursor: pointer;
    transition: background 0.1s;
    font-size: 13px;
}

.placeholder-item:hover              { background: #f9fafb; }
.placeholder-item span:first-child   { font-size: 16px; flex-shrink: 0; }
.placeholder-item span:nth-child(2)  { flex: 1; color: #111827; font-weight: 500; }

.placeholder-item code {
    font-size: 11px;
    color: #6b7280;
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
}

.placeholder-empty {
    padding: 20px;
    text-align: center;
    color: #9ca3af;
    font-size: 13px;
}

/* ==========================================================================
   SCHEDULE INPUTS
   ========================================================================== */

.schedule-inputs { margin-top: 12px; }

.schedule-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* ==========================================================================
   STICKY ACTION BAR
   Layout: [pills ··············] [Cancel] [Continue →]
   ========================================================================== */

.campaign-action-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid #e5e7eb;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.campaign-action-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px 20px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 60px;
}

.action-pills {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    flex: 1 1 0;
    min-width: 0;
}

.action-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    border-radius: 6px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    white-space: nowrap;
    line-height: 1;
}

.action-pill strong        { font-weight: 700; color: #0f172a; }
.action-pill-label         { color: #64748b; font-weight: 500; }
.action-pill-icon          { width: 13px; height: 13px; flex-shrink: 0; color: #94a3b8; }

.action-pill--primary {
    background: #dbeafe;
    border-color: #93c5fd;
    color: #1d4ed8;
}

.action-pill--primary .action-pill-icon  { color: #3b82f6; }
.action-pill--primary strong             { color: #1e40af; }
.action-pill--primary .action-pill-label { color: #3b82f6; }

.action-buttons {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

@media (max-width: 768px) {

    .campaign-action-inner {
        flex-direction: column;
        align-items: stretch;
        padding: 10px 12px;
        gap: 8px;
        min-height: auto;
    }

    .action-pills {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 5px;
        flex: none;
        width: 100%;
    }

    .action-pill {
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 6px 4px;
        gap: 2px;
        font-size: 11px;
        border-radius: 8px;
        text-align: center;
    }

    .action-pill-label { display: none; }

    .action-pill--text-only .action-pill-label {
        display: block;
        font-weight: 700;
        color: #0f172a;
        font-size: 11px;
    }

    .action-pill-icon { width: 14px; height: 14px; }

    .action-pill--primary {
        grid-column: span 2;
        flex-direction: row;
        justify-content: center;
        gap: 6px;
        font-size: 12px;
        padding: 7px 8px;
    }

    .action-pill--primary .action-pill-label { display: inline; }

    .action-buttons { width: 100%; gap: 8px; }
    .action-buttons > * { flex: 1; justify-content: center; text-align: center; }
}

@media (max-width: 380px) {
    .action-pills { grid-template-columns: repeat(3, 1fr); }
    .action-pill--primary { grid-column: span 3; }
}

/* ==========================================================================
   DARK MODE — action bar
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    .campaign-action-bar {
        background: rgba(15, 23, 42, 0.97);
        border-color: #334155;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
    }

    .action-pill {
        background: #1e293b;
        border-color: #334155;
        color: #cbd5e1;
    }

    .action-pill strong        { color: #f1f5f9; }
    .action-pill-label         { color: #94a3b8; }
    .action-pill-icon          { color: #64748b; }

    .action-pill--primary {
        background: #1e3a5f;
        border-color: #3b82f6;
        color: #93c5fd;
    }

    .action-pill--primary strong             { color: #bfdbfe; }
    .action-pill--primary .action-pill-label { color: #93c5fd; }
    .action-pill--primary .action-pill-icon  { color: #60a5fa; }
}

/* ==========================================================================
   PHONE MOCKUP (legacy — kept for create page, non-preview contexts)
   ========================================================================== */

.phone-mockup {
    width: clamp(240px, 32vw, 300px);
    height: calc(clamp(260px, 24vw, 300px) * 2.05);
    padding: 14px;
    border-radius: 40px;
    position: relative;
    background:
        radial-gradient(circle at top, rgba(255,255,255,0.08), transparent 40%),
        linear-gradient(180deg, #0f172a, #020617);
    box-shadow:
        0 40px 80px -20px rgba(0,0,0,0.8),
        inset 0 0 0 1px rgba(255,255,255,0.08);
}

.phone-mockup::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 40px;
    pointer-events: none;
    background: linear-gradient(
        120deg,
        rgba(255,255,255,0.12),
        rgba(255,255,255,0.02) 30%,
        transparent 60%
    );
}

.phone-notch {
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 150px;
    height: 28px;
    background: #020617;
    border-radius: 0 0 20px 20px;
    z-index: 10;
}

.phone-screen {
    width: 100%;
    height: 100%;
    border-radius: 32px;
    background: #ffffff;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.phone-statusbar {
    height: 46px;
    padding: 0 16px;
    background: #f8fafc;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.message-area {
    flex: 1;
    padding: 16px 14px;
    background: linear-gradient(180deg, #f1f5f9, #e2e8f0);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 8px;
}

/* ==========================================================================
   MESSAGE TOP ROW
   ========================================================================== */

.message-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.message-counter { font-size: 12px; color: #64748b; white-space: nowrap; }

@media (max-width: 640px) {
    .message-top-row  { flex-wrap: wrap; gap: 6px; }
    .message-counter  { width: 100%; text-align: right; }
}

.phone-meta    { font-size: 11px; color: #64748b; margin-bottom: 8px; }

.message-bubble {
    max-width: 82%;
    padding: 10px 12px;
    border-radius: 18px 18px 18px 6px;
    background: #ffffff;
    box-shadow:
        0 1px 2px rgba(0,0,0,0.06),
        0 6px 14px rgba(0,0,0,0.08);
    display: inline-flex;
    flex-direction: column;
    gap: 4px;
    animation: bubbleIn 0.25s ease;
}

.message-sender {
    font-size: 10px;
    font-weight: 700;
    color: #2563eb;
    background: rgba(37, 99, 235, 0.08);
    padding: 2px 6px;
    border-radius: 999px;
    width: fit-content;
}

.message-text  { font-size: 14px; line-height: 1.5; color: #111; white-space: pre-wrap; word-break: break-word; }
.message-time  { font-size: 10px; color: #9ca3af; align-self: flex-end; }

/* ==========================================================================
   FLASH SMS MOCKUP
   ========================================================================== */

.phone-mockup--flash .phone-screen {
    position: relative;
    overflow: hidden;
    background: #1a1a2e;
    display: block;
}

.flash-wallpaper {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    z-index: 0;
}

.flash-wallpaper-dots {
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle, rgba(255,255,255,0.06) 1px, transparent 1px);
    background-size: 18px 18px;
    z-index: 1;
}

.phone-statusbar--flash {
    position: relative;
    z-index: 2;
    color: rgba(255,255,255,0.7);
    background: transparent;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.flash-modal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 82%;
    background: rgba(255,255,255,0.97);
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.45), 0 2px 8px rgba(0,0,0,0.2);
    z-index: 10;
    overflow: hidden;
}

.flash-modal-header {
    display: flex;
    align-items: center;
    padding: 12px 14px 8px;
    border-bottom: 1px solid #f1f5f9;
    gap: 4px;
    font-size: 13px;
    font-weight: 600;
    color: #111827;
}

.flash-modal-icon   { font-size: 15px; margin-right: 2px; }
.flash-modal-from   { color: #6b7280; font-weight: 400; }
.flash-modal-sender { color: #111827; font-weight: 700; }

.flash-modal-body { padding: 12px 14px; }

.flash-modal-text {
    font-size: 13px;
    line-height: 1.6;
    color: #111827;
    margin: 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.flash-modal-actions { display: flex; border-top: 1px solid #f1f5f9; }

.flash-btn {
    flex: 1;
    padding: 10px;
    border: none;
    background: transparent;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.1s;
}

.flash-btn + .flash-btn { border-left: 1px solid #f1f5f9; }
.flash-btn--save        { color: #2563eb; }
.flash-btn--dismiss     { color: #6b7280; }
.flash-btn:hover        { background: #f9fafb; }

@keyframes flashModalEnter {
    0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.85); filter: brightness(1.5); }
    100% { opacity: 1; transform: translate(-50%, -50%) scale(1);    filter: brightness(1);   }
}

.flash-modal-enter { animation: flashModalEnter 0.35s ease; }

.flash-live-dot {
    width: 8px;
    height: 8px;
    background: #ef4444;
    border-radius: 50%;
    margin-right: 4px;
    flex-shrink: 0;
    animation: livePulse 1.2s infinite;
}

@keyframes livePulse {
    0%, 100% { opacity: 0.4; }
    50%       { opacity: 1; }
}

/* ==========================================================================
   PREVIEW PAGE (legacy z-* classes — kept for backwards compat)
   ========================================================================== */

.z-preview {
    padding: 24px;
    max-width: 1200px;
    margin: auto;
}

.z-header h2 { font-size: 24px; font-weight: 700; color: #0f172a; margin-bottom: 4px; }
.z-header p  { font-size: 14px; color: #64748b; }

.z-grid {
    margin-top: 24px;
    display: grid;
    grid-template-columns: minmax(0,1fr) 340px;
    gap: 30px;
}

.z-main { display: flex; flex-direction: column; gap: 16px; }
.z-side { position: sticky; top: 24px; display: flex; flex-direction: column; gap: 16px; }

.z-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 18px;
    transition: all .2s ease;
    animation: fadeUp .4s ease;
}

.z-card:hover { border-color: #cbd5f5; }

.z-card h3 {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #64748b;
    margin-bottom: 14px;
}

.z-row {
    display: grid;
    grid-template-columns: 150px minmax(0,1fr);
    padding: 10px 0;
    border-bottom: 1px solid #f1f5f9;
    align-items: center;
}

.z-row:last-child { border-bottom: none; }
.z-row span       { font-size: 13px; color: #64748b; }
.z-row strong     { font-size: 13px; font-weight: 600; text-align: right; word-break: break-word; }

.z-message {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 10px;
    border-radius: 10px;
    font-size: 12px;
    line-height: 1.6;
    white-space: pre-wrap;
}

.z-billing        { border-color: #fde68a; background: #fffbeb; }

.z-total {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 2px solid #fde68a;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.z-total span   { font-weight: 600; }
.z-total strong { font-size: 24px; color: #d97706; }
.z-note         { font-size: 12px; color: #92400e; margin-top: 10px; }

.z-phone {
    background: #0f172a;
    border-radius: 24px;
    padding: 14px;
    box-shadow: 0 20px 40px rgba(0,0,0,.25);
}

.z-phone-header { color: white; font-size: 12px; text-align: center; padding-bottom: 10px; }

.z-bubble { background: white; border-radius: 14px; padding: 12px; }
.z-sender { font-size: 11px; font-weight: 700; color: #2563eb; margin-bottom: 6px; }
.z-text   { font-size: 13px; line-height: 1.6; word-break: break-word; }

@media (max-width: 1024px) { .z-grid { grid-template-columns: 1fr; } .z-side { position: static; } }

.z-compact      { padding: 16px; }
.z-inline-grid  { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.z-label        { font-size: 11px; color: #64748b; display: block; }
.z-badges       { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

.z-badge {
    font-size: 12px;
    padding: 5px 10px;
    border-radius: 999px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: #334155;
    font-weight: 500;
}

.z-message-layout  { display: grid; grid-template-columns: 1fr 260px; gap: 16px; align-items: start; }
.z-credit          { background: #f8fafc; border: 1px solid #e2e8f0; }
.z-credit-box      { background: #ffffff; border-radius: 10px; border: 1px solid #e5e7eb; overflow: hidden; }
.z-credit-required { color: #2563eb; font-weight: 700; }
.z-credit-final    { background: #f1f5f9; font-weight: 600; }
.z-credit-strong   { background: linear-gradient(to bottom, #ffffff, #f8fafc); border: 1px solid #e2e8f0; }
.z-credit-rows     { border-radius: 10px; overflow: hidden; }

.z-credit-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 14px;
    font-size: 14px;
}

.z-credit-row + .z-credit-row { border-top: 1px solid #f1f5f9; }

.z-layout { display: grid; grid-template-columns: 1fr 300px; gap: 20px; margin-top: 20px; }
.z-left   { display: flex; flex-direction: column; gap: 16px; }
.z-right  { position: sticky; top: 20px; }
.z-phone-wrap { display: flex; justify-content: center; }

.z-credit-premium {
    background: linear-gradient(180deg, #ffffff, #f8fafc);
    border: 1px solid #e2e8f0;
    padding: 18px;
    border-radius: 14px;
    transition: all .25s ease;
}

.z-credit-premium:hover { box-shadow: 0 10px 30px rgba(0,0,0,0.08); transform: translateY(-2px); }

.z-credit-header     { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.z-credit-percentage { font-size: 18px; font-weight: 700; color: #0f172a; }

.z-credit-progress {
    height: 8px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 10px;
}

.z-credit-bar { height: 100%; border-radius: 999px; transition: width .4s ease; }

.z-credit-bar.safe    { background: linear-gradient(90deg, #22c55e, #4ade80); }
.z-credit-bar.warning { background: linear-gradient(90deg, #f59e0b, #facc15); }
.z-credit-bar.danger  { background: linear-gradient(90deg, #ef4444, #f87171); }

.z-credit-hint         { font-size: 13px; margin-bottom: 14px; }
.z-credit-hint.safe    { color: #16a34a; }
.z-credit-hint.warning { color: #d97706; }
.z-credit-hint.danger  { color: #dc2626; }

.z-credit-grid        { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.z-credit-grid span   { font-size: 12px; color: #64748b; }
.z-credit-grid strong { font-size: 16px; font-weight: 700; }

@media (max-width: 768px) {
    .z-inline-grid    { grid-template-columns: 1fr 1fr; }
    .z-message-layout { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
    .z-layout { grid-template-columns: 1fr; }
    .z-right  { position: static; }
}

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

/* ==========================================================================
   BILLING CARD
   ========================================================================== */

.billing-card { background: #fffbeb; border: 1px solid #fde68a; border-left: 3px solid #f59e0b; }
.billing-card .stat-value { color: #92400e; }

.billing-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0 4px;
    margin-top: 4px;
    border-top: 2px solid #fde68a;
}

.billing-total-label { font-size: 14px; font-weight: 700; color: #111827; }
.billing-total-value { font-size: 22px; font-weight: 800; color: #d97706; line-height: 1; }

/* ==========================================================================
   MODAL
   ========================================================================== */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: #ffffff;
    border-radius: 12px;
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1);
}

.modal-content.modal-large { max-width: 700px; }

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 { font-size: 18px; font-weight: 600; color: #111827; margin: 0; }

.modal-close {
    width: 32px; height: 32px; border-radius: 6px; border: none;
    background: #f3f4f6; color: #6b7280; font-size: 24px; line-height: 1;
    cursor: pointer; transition: background 0.15s;
}

.modal-close:hover { background: #e5e7eb; color: #111827; }
.modal-body        { flex: 1; overflow-y: auto; padding: 16px 24px; }
.modal-footer      { padding: 16px 24px; border-top: 1px solid #e5e7eb; display: flex; gap: 12px; justify-content: flex-end; }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 1024px) {
    .campaign-container { margin: 0 16px; }
}

@media (max-width: 640px) {
    .campaign-page      { padding: 20px 0 calc(10rem + env(safe-area-inset-bottom, 0)) 0; }
    .campaign-container { margin: 0 12px; border-radius: 6px; }
    .campaign-header    { padding: 16px; }
    .campaign-header h2 { font-size: 18px; }
    .campaign-section   { padding: 16px; }
    .campaign-tab       { padding: 7px 12px; font-size: 12px; }
    .campaign-badges .badge { padding: 5px 10px; font-size: 11px; }
    .placeholder-dropdown   { width: calc(100vw - 48px); }
    .schedule-grid          { grid-template-columns: 1fr; }
    .phone-mockup           { width: 260px; height: 520px; }
}

@media (max-width: 375px) {
    .campaign-container { margin: 0 8px; }
    .campaign-header, .campaign-section { padding: 12px; }
    .campaign-tab       { font-size: 11px; padding: 6px 10px; }
    .phone-mockup       { width: 240px; height: 500px; }
    .modal-content      { max-width: 100%; }
}

/* ==========================================================================
   DARK MODE — pages
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    .campaign-page           { color: #e2e8f0; }
    .campaign-container      { background: #1e293b; border-color: #334155; }
    .campaign-header         { background: linear-gradient(to bottom, #1e293b, #0f172a); border-color: #334155; }
    .campaign-header h2      { color: #f1f5f9; }
    .campaign-header p       { color: #94a3b8; }
    .campaign-section        { border-color: #334155; }
    .campaign-label          { color: #f1f5f9; }
    .campaign-input,
    .campaign-select,
    .campaign-textarea       { background: #0f172a; border-color: #334155; color: #e2e8f0; }
    .campaign-input:focus,
    .campaign-select:focus,
    .campaign-textarea:focus { border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,0.2); }
    .campaign-tab            { background: #0f172a; border-color: #334155; color: #cbd5e1; }
    .campaign-tab:hover      { background: #1e293b; }
    .campaign-tab.active     { background: #3b82f6; color: #ffffff; border-color: #3b82f6; }
    .campaign-badges .badge  { background: #0f172a; border-color: #334155; color: #cbd5e1; }
    .campaign-badges .badge strong { color: #f1f5f9; }
    .placeholder-dropdown    { background: #1e293b; border-color: #334155; }
    .placeholder-search      { border-color: #334155; }
    .placeholder-search-input { background: #0f172a; border-color: #334155; color: #e2e8f0; }
    .placeholder-item        { background: #1e293b; color: #e2e8f0; }
    .placeholder-item:hover  { background: #334155; }
    .personalisation-hint    { background: #0c2133; border-color: #1e4a6e; color: #7dd3fc; }
    .no-sender-title         { color: #f1f5f9; }
    .no-sender-text          { color: #94a3b8; }
    .billing-card            { background: #1c1508; border-color: #78350f; border-left-color: #f59e0b; }
    .billing-total-value     { color: #fbbf24; }
}

/* ==========================================================================
   PRINT
   ========================================================================== */

@media print {
    .campaign-action-bar { display: none; }
    .campaign-page       { padding-bottom: 0; }
}

/* ==========================================================================
   ENTERPRISE DECISION PANEL
   ========================================================================== */

.decision-panel  { position: sticky; top: 20px; gap: 14px; }

.decision-card {
    width: 100%;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 6px 14px rgba(0,0,0,0.05);
    margin-top: 10px;
}

.decision-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #64748b;
    margin-bottom: 12px;
}

.decision-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    padding: 6px 0;
    color: #334155;
}

.decision-row strong { font-weight: 700; color: #0f172a; }
.decision-divider    { height: 1px; background: #e5e7eb; margin: 10px 0; }

.decision-total {
    display: flex;
    justify-content: space-between;
    font-size: 15px;
    font-weight: 700;
    color: #111827;
}

.decision-total strong { font-size: 20px; color: #2563eb; }
.decision-trust        { margin-top: 10px; font-size: 12px; color: #16a34a; font-weight: 600; }

/* ==========================================================================
   PRIORITY LIGHTNING EFFECT
   ========================================================================== */

.priority-lightning {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    animation: lightningFlash 2.2s ease-out forwards;
}

.priority-lightning::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 0%, rgba(253,224,71,0.55) 0%, rgba(255,255,255,0.85) 40%, transparent 75%);
    animation: screenCrack 2.2s ease-out forwards;
}

.priority-lightning .bolt {
    position: absolute;
    top: -10vh;
    height: 120vh;
    width: 7px;
    border-radius: 4px;
    background: linear-gradient(to bottom, #ffffff 0%, #fef08a 12%, #facc15 35%, #f59e0b 65%, rgba(245,158,11,0) 100%);
    filter: drop-shadow(0 0 10px #facc15) drop-shadow(0 0 32px #fde047);
    transform-origin: top center;
    animation: boltStrike 1.1s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.lightning-stamp {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    font-size: 22px;
    font-weight: 900;
    letter-spacing: 0.08em;
    color: #ffffff;
    text-shadow: 0 0 12px #f59e0b, 0 0 30px #fde047, 0 2px 4px rgba(0,0,0,0.4);
    white-space: nowrap;
    animation: stampPop 0.9s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    animation-delay: 0.15s;
}

.priority-select-glow {
    border-color: #f59e0b !important;
    box-shadow: 0 0 0 3px rgba(245,158,11,0.25), 0 0 16px rgba(253,224,71,0.4) !important;
    transition: border-color 0.1s ease, box-shadow 0.1s ease !important;
}

@keyframes boltStrike {
    0%   { transform: translateX(-50%) skewX(var(--skew, -20deg)) scaleY(0); opacity: 0; }
    18%  { opacity: 1; transform: translateX(-50%) skewX(var(--skew, -20deg)) scaleY(1.2); }
    45%  { opacity: 1; transform: translateX(-50%) skewX(var(--skew, -20deg)) scaleY(1); }
    75%  { opacity: .8; }
    100% { opacity: 0; transform: translateX(-50%) skewX(var(--skew, -20deg)) scaleY(1); }
}

@keyframes lightningFlash {
    0%   { opacity: 0; } 8%   { opacity: 1; } 18%  { opacity: 0.6; }
    28%  { opacity: 1; } 40%  { opacity: 0.8; } 100% { opacity: 0; }
}

@keyframes screenCrack {
    0%   { opacity: 0; } 10%  { opacity: 1; } 25%  { opacity: 0.4; }
    35%  { opacity: 0.9; } 100% { opacity: 0; }
}

@keyframes stampPop {
    0%   { transform: translate(-50%, -50%) scale(0);    opacity: 0; }
    50%  { transform: translate(-50%, -50%) scale(1.15); opacity: 1; }
    70%  { transform: translate(-50%, -50%) scale(0.95); opacity: 1; }
    85%  { transform: translate(-50%, -50%) scale(1);    opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1);    opacity: 0; }
}

/* ==========================================================================
   MESSAGE TEXTAREA INLINE FIELD BUTTON
   ========================================================================== */

.message-input-wrap { position: relative; }
.message-textarea   { padding-right: 56px; }

.message-field-trigger {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 20;
    border: none;
    background: transparent;
    color: #6b7280;
    font-weight: 700;
    font-size: 18px;
    line-height: 1;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: all .15s ease;
}

.message-field-trigger:hover { background: #f3f4f6; color: #111827; }

.textarea-dropdown {
    position: absolute;
    top: 44px;
    right: 10px;
    left: auto;
    width: 320px;
    max-width: calc(100% - 20px);
}

@media (max-width: 640px) {
    .textarea-dropdown      { left: 10px; right: 10px; width: auto; }
    .message-field-trigger  { top: 8px; right: 8px; font-size: 16px; }
}

/* ==========================================================================
   FORM ERRORS
   ========================================================================== */

.field-error {
    margin-top: 6px;
    font-size: 13px;
    color: #dc2626;
    font-weight: 500;
}

.input-error {
    border-color: #dc2626 !important;
    box-shadow: 0 0 0 3px rgba(220,38,38,.12) !important;
}

/* ==========================================================================
   TAG INPUT (paste numbers)
   ========================================================================== */

.tag-box {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 8px;
    min-height: 48px;
    max-height: 120px;
    overflow-y: auto;
    align-content: flex-start;
    background: white;
}

.tag-chip {
    background: #eef2ff;
    color: #4338ca;
    padding: 6px 10px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}

.tag-chip button { border: none; background: none; cursor: pointer; font-size: 14px; }
.tag-input { flex: 1; border: none; outline: none; min-width: 180px; min-height: 30px; }

/* ==========================================================================
   PREVIEW PAGE — zp-* namespace
   Scoped entirely to .zp-preview. Zero impact on any other page.
   ========================================================================== */

.zp-preview {
    --zp-ink:       #0a0a0b;
    --zp-ink-2:     #3a3a3d;
    --zp-ink-3:     #8a8a91;
    --zp-ink-4:     #b8b8be;
    --zp-line:      rgba(0, 0, 0, 0.07);
    --zp-line-2:    rgba(0, 0, 0, 0.12);
    --zp-surface:   #ffffff;
    --zp-surface-2: #f7f7f8;
    --zp-surface-3: #f0f0f2;
    --zp-blue:      #2563eb;
    --zp-safe:      #1a9e5c;
    --zp-warn:      #d97706;
    --zp-danger:    #dc2626;
    --zp-radius:    14px;
    --zp-radius-sm: 8px;
    --zp-shadow:    0 1px 3px rgba(0,0,0,0.06), 0 4px 12px rgba(0,0,0,0.04);

    max-width: 900px;
    margin: 0 auto;
    padding: 28px 20px 100px;
    color: var(--zp-ink);
    font-size: 14px;
}

@media (prefers-color-scheme: dark) {
    .zp-preview {
        --zp-ink:       #f0f0f2;
        --zp-ink-2:     #c8c8ce;
        --zp-ink-3:     #75757d;
        --zp-ink-4:     #4a4a52;
        --zp-line:      rgba(255,255,255,0.07);
        --zp-line-2:    rgba(255,255,255,0.12);
        --zp-surface:   #1c1c1e;
        --zp-surface-2: #2a2a2e;
        --zp-surface-3: #313136;
        --zp-shadow:    0 1px 3px rgba(0,0,0,0.3), 0 4px 12px rgba(0,0,0,0.2);
    }
}

/* ── Header ── */
.zp-head          { margin-bottom: 24px; }
.zp-head h1       { font-size: 19px; font-weight: 600; color: var(--zp-ink); letter-spacing: -0.3px; margin: 0 0 3px; }
.zp-head p        { font-size: 13px; color: var(--zp-ink-3); font-weight: 400; margin: 0; }

/* ── Two-column grid ── */
.zp-grid {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 40px;
    align-items: start;
}

@media (max-width: 1024px) {
    .zp-grid { grid-template-columns: 1fr; gap: 24px; }
    .zp-right { position: static; justify-content: center; }
    .zp-phone-card { width: 100%; display: flex; flex-direction: column; align-items: center; }
}

.zp-left  { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.zp-right {
    position: sticky;
    top: 40px;
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
}

/* ── Cards ── */
.zp-card {
    background: var(--zp-surface);
    border: 1px solid var(--zp-line-2);
    border-radius: var(--zp-radius);
    box-shadow: var(--zp-shadow);
    overflow: hidden;
    animation: zp-rise 0.35s ease both;
}

.zp-card:nth-child(1) { animation-delay: 0.00s; }
.zp-card:nth-child(2) { animation-delay: 0.06s; }
.zp-card:nth-child(3) { animation-delay: 0.12s; }

@keyframes zp-rise {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0);   }
}

.zp-card-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px 0; margin-bottom: 12px; }
.zp-card-title  { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--zp-ink-3); }

/* ── Campaign meta grid (3-col ruled) ── */
.zp-meta-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border-top: 1px solid var(--zp-line);
    border-bottom: 1px solid var(--zp-line);
}

.zp-meta-cell            { padding: 14px 18px; border-right: 1px solid var(--zp-line); }
.zp-meta-cell:last-child { border-right: none; }
.zp-meta-label           { font-size: 11px; color: var(--zp-ink-3); font-weight: 500; letter-spacing: 0.03em; margin-bottom: 4px; }
.zp-meta-value           { font-weight: 600; color: var(--zp-ink); letter-spacing: -0.4px; line-height: 1.1; }
.zp-meta-value--md       { font-size: 15px; }
.zp-meta-value--lg       { font-size: 22px; }

/* ── Badges row ── */
.zp-badges-row { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 18px 14px; }

.zp-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 99px;
    font-size: 12px;
    font-weight: 500;
    background: var(--zp-surface-2);
    border: 1px solid var(--zp-line-2);
    color: var(--zp-ink-2);
}

.zp-badge-dot         { width: 6px; height: 6px; border-radius: 50%; background: var(--zp-ink); flex-shrink: 0; }
.zp-badge-dot--blue   { background: var(--zp-blue); }
.zp-badge-dot--gray   { background: var(--zp-ink-4); }

/* ── Message body ── */
.zp-message-body {
    padding: 14px 18px 16px;
    border-top: 1px solid var(--zp-line);
    font-size: 13.5px;
    line-height: 1.7;
    color: var(--zp-ink-2);
    background: var(--zp-surface-2);
    white-space: pre-wrap;
    word-break: break-word;
}

/* ── Credit section ── */
.zp-credit-section { padding: 14px 18px 18px; border-top: 1px solid var(--zp-line); }

.zp-credit-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 10px;
    gap: 12px;
}

.zp-credit-pct           { font-size: 28px; font-weight: 600; letter-spacing: -1px; line-height: 1; color: var(--zp-ink); }
.zp-credit-pct--safe     { color: var(--zp-safe);   }
.zp-credit-pct--warning,
.zp-credit-pct--warn     { color: var(--zp-warn);   }
.zp-credit-pct--danger   { color: var(--zp-danger); }

.zp-credit-sub { font-size: 12px; color: var(--zp-ink-3); font-weight: 400; margin-top: 2px; }

.zp-credit-hint              { font-size: 12px; font-weight: 500; text-align: right; flex-shrink: 0; }
.zp-credit-hint--safe        { color: var(--zp-safe);   }
.zp-credit-hint--warning,
.zp-credit-hint--warn        { color: var(--zp-warn);   }
.zp-credit-hint--danger      { color: var(--zp-danger); }

.zp-progress-track {
    height: 5px;
    background: var(--zp-surface-3);
    border-radius: 99px;
    overflow: hidden;
    margin-bottom: 14px;
}

.zp-progress-fill              { height: 100%; border-radius: 99px; background: var(--zp-ink); transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1); }
.zp-progress-fill--safe        { background: var(--zp-safe);   }
.zp-progress-fill--warning,
.zp-progress-fill--warn        { background: var(--zp-warn);   }
.zp-progress-fill--danger      { background: var(--zp-danger); }

.zp-credit-nums {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    background: var(--zp-surface-2);
    border: 1px solid var(--zp-line);
    border-radius: var(--zp-radius-sm);
    overflow: hidden;
}

.zp-credit-num-cell            { padding: 12px 14px; border-right: 1px solid var(--zp-line); }
.zp-credit-num-cell:last-child { border-right: none; }
.zp-cnum-label                 { font-size: 11px; color: var(--zp-ink-3); font-weight: 500; letter-spacing: 0.03em; margin-bottom: 3px; }
.zp-cnum-val                   { font-size: 16px; font-weight: 600; color: var(--zp-ink); letter-spacing: -0.3px; }
.zp-cnum-val--blue             { color: var(--zp-blue); }

/* ── Phone card wrapper (right column) ── */
.zp-phone-card {
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: zp-rise 0.35s ease 0.18s both;
    width: auto;
}

.zp-phone-label {
    margin-top: 10px;
    font-size: 11px;
    color: var(--zp-ink-4);
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* ── Action bar ── */
.zp-action-bar {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: rgba(255, 255, 255, 0.93);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--zp-line-2);
    padding: 12px 20px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    z-index: 100;
}

@media (prefers-color-scheme: dark) {
    .zp-action-bar { background: rgba(28, 28, 30, 0.93); }
}

.zp-action-inner {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 44px;
}

.zp-action-back   { display: flex; align-items: center; }
.zp-action-launch { display: flex; align-items: center; }

/* ── Responsive ── */
@media (max-width: 720px) {
    .zp-grid  { grid-template-columns: 1fr; }
    .zp-right { position: static; }
}

@media (max-width: 640px) {
    .zp-preview       { padding: 20px 12px 120px; }
    .zp-action-inner  { gap: 8px; min-height: auto; }
    .zp-action-back   { flex-shrink: 0; }
    .zp-action-launch { flex-shrink: 0; }
}

@media (max-width: 480px) {
    .zp-meta-grid                     { grid-template-columns: repeat(2, 1fr); }
    .zp-meta-cell:nth-child(2)        { border-right: none; }
    .zp-meta-cell:nth-child(3)        { border-top: 1px solid var(--zp-line); grid-column: span 2; border-right: none; }
    .zp-credit-nums                   { grid-template-columns: 1fr; }
    .zp-credit-num-cell               { border-right: none; border-bottom: 1px solid var(--zp-line); }
    .zp-credit-num-cell:last-child    { border-bottom: none; }
}

/* ── Print ── */
@media print {
    .zp-action-bar { display: none; }
    .zp-preview    { padding-bottom: 0; }
}

/* ==========================================================================
   LEGACY PHONE INNER ELEMENTS (zp-* prefix)
   ========================================================================== */

.zp-statusbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 26px 16px 8px;
    background: #f8f8f8;
    border-bottom: 1px solid #ebebeb;
    font-size: 10px;
    font-weight: 600;
    color: #1a1a1a;
    flex-shrink: 0;
}

@keyframes bubbleIn {
    from { opacity: 0; transform: translateY(6px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.zp-bubble {
    background: #ffffff;
    max-width: 82%;
    padding: 12px 14px;
    border-radius: 18px 18px 18px 6px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06), 0 6px 18px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    gap: 4px;
    animation: bubbleIn 0.25s ease;
}

.zp-bubble-sender {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: #2563eb;
    background: rgba(37, 99, 235, 0.08);
    padding: 2px 6px;
    border-radius: 999px;
    width: fit-content;
}

.zp-bubble-text { font-size: 13px; line-height: 1.55; color: #111; white-space: pre-wrap; word-break: break-word; }
.zp-bubble-time { font-size: 10px; color: #9ca3af; text-align: right; margin-top: 2px; }

/* Flash variant */
.zp-flash-bg {
    flex: 1;
    background: linear-gradient(135deg, #1a1a2e, #0f3460);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

.zp-flash-modal  { background: rgba(255,255,255,0.97); border-radius: 12px; overflow: hidden; width: 100%; box-shadow: 0 4px 20px rgba(0,0,0,0.3); }

.zp-flash-header {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 10px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 10px;
    font-weight: 600;
    color: #111827;
}

.zp-flash-icon   { font-size: 11px; }
.zp-flash-from   { color: #6b7280; font-weight: 400; }
.zp-flash-sender { color: #111827; font-weight: 700; }
.zp-flash-body   { padding: 8px 10px; }
.zp-flash-text   { font-size: 10px; line-height: 1.5; color: #111827; margin: 0; word-break: break-word; }

.zp-flash-actions              { display: flex; border-top: 1px solid #f1f5f9; }
.zp-flash-btn                  { flex: 1; padding: 7px; border: none; background: transparent; font-size: 10px; font-weight: 600; cursor: pointer; }
.zp-flash-btn + .zp-flash-btn  { border-left: 1px solid #f1f5f9; }
.zp-flash-btn--save            { color: #2563eb; }
.zp-flash-btn--dismiss         { color: #6b7280; }

.zeckta-phone {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    width: 100%;
}

.message-bubble::after {
    content: '';
    position: absolute;
    bottom: 6px;
    left: -4px;
    width: 10px;
    height: 10px;
    background: #ffffff;
    border-bottom-right-radius: 10px;
    transform: rotate(45deg);
}

/* ==========================================================================
   HALF-PHONE MOCKUP — zpm-* namespace
   Used on the preview page right column.
   Shows top ~65% of a phone; bottom is intentionally cropped.
   ========================================================================== */

.zpm-scene {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 260px;
    flex-shrink: 0;
}

/* Responsive: slightly narrower on small containers */
@media (max-width: 400px) {
    .zpm-scene { width: 220px; }
}

/* ── Outer shell: dark rounded frame, no bottom ── */
.zpm-shell {
    position: relative;
    width: 260px;
    height: 340px;          /* deliberately crops bottom of phone */
    border-radius: 36px 36px 0 0;
    background: linear-gradient(160deg, #1c1c1e 0%, #0a0a0c 100%);
    border: 1.5px solid rgba(255,255,255,0.10);
    border-bottom: none;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.12),
        0 20px 50px rgba(0,0,0,0.50);
    overflow: hidden;
}

/* Side hardware buttons */
.zpm-btn {
    position: absolute;
    background: rgba(255,255,255,0.10);
    border-radius: 2px;
}

.zpm-btn--power { right: -2px; top: 80px; width: 3px; height: 52px; border-radius: 0 2px 2px 0; }
.zpm-btn--vol1  { left: -2px;  top: 68px; width: 3px; height: 36px; border-radius: 2px 0 0 2px; }
.zpm-btn--vol2  { left: -2px;  top: 112px; width: 3px; height: 36px; border-radius: 2px 0 0 2px; }

/* Pill / Dynamic-Island notch */
.zpm-notch {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 84px;
    height: 22px;
    background: #0a0a0c;
    border-radius: 0 0 14px 14px;
    z-index: 10;
}

/* ── Inner screen ── */
.zpm-screen {
    position: absolute;
    top: 8px;
    left: 8px;
    right: 8px;
    bottom: 0;              /* open at the bottom — crops naturally */
    border-radius: 28px 28px 0 0;
    background: #ffffff;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Status bar */
.zpm-statusbar {
    height: 44px;
    padding: 0 16px;
    display: flex;
    align-items: flex-end;
    padding-bottom: 6px;
    justify-content: space-between;
    background: #f8f8f8;
    border-bottom: 0.5px solid #e8e8ea;
    flex-shrink: 0;
}

.zpm-time {
    font-size: 11px;
    font-weight: 700;
    color: #111;
    line-height: 1;
}

.zpm-status-icons {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Signal bars */
.zpm-signal {
    display: flex;
    align-items: flex-end;
    gap: 2px;
}

.zpm-bar {
    display: block;
    width: 3px;
    background: #111;
    border-radius: 1px;
}

.zpm-bar--1 { height: 4px; }
.zpm-bar--2 { height: 6px; }
.zpm-bar--3 { height: 8px; }
.zpm-bar--4 { height: 10px; }

/* WiFi icon */
.zpm-icon-wifi {
    width: 14px;
    height: 10px;
    color: #111;
    display: block;
}

/* Battery */
.zpm-battery {
    display: flex;
    align-items: center;
    width: 22px;
    height: 11px;
    border: 1.5px solid #111;
    border-radius: 2px;
    padding: 2px;
    position: relative;
}

.zpm-battery::after {
    content: '';
    position: absolute;
    right: -4px;
    top: 50%;
    transform: translateY(-50%);
    width: 2px;
    height: 5px;
    background: #111;
    border-radius: 0 1px 1px 0;
}

.zpm-battery-fill {
    width: 75%;
    height: 100%;
    background: #111;
    border-radius: 1px;
}

/* Chat nav bar */
.zpm-nav {
    height: 52px;
    display: flex;
    align-items: center;
    padding: 0 12px;
    gap: 8px;
    border-bottom: 0.5px solid #e8e8ea;
    background: rgba(255,255,255,0.96);
    flex-shrink: 0;
}

.zpm-back {
    font-size: 22px;
    font-weight: 300;
    color: #007aff;
    line-height: 1;
    flex-shrink: 0;
}

.zpm-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    letter-spacing: 0.02em;
}

.zpm-nav-info { flex: 1; min-width: 0; }

.zpm-nav-name {
    font-size: 12px;
    font-weight: 700;
    color: #111;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.zpm-nav-sub {
    font-size: 10px;
    color: #8e8e93;
    line-height: 1.2;
}

.zpm-more {
    font-size: 18px;
    color: #007aff;
    line-height: 1;
    flex-shrink: 0;
}

/* Messages area */
.zpm-messages {
    flex: 1;
    overflow: hidden;
    padding: 12px 10px 10px;
    background: #f2f2f7;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.zpm-date-label {
    text-align: center;
    font-size: 9px;
    color: #8e8e93;
    font-weight: 500;
    margin-bottom: 2px;
}

.zpm-bubble-row {
    display: flex;
    align-items: flex-end;
}

.zpm-bubble {
    max-width: 82%;
    padding: 8px 11px;
    border-radius: 4px 18px 18px 18px;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(0,0,0,0.07);
    display: flex;
    flex-direction: column;
    gap: 3px;
    animation: bubbleIn 0.25s ease;
}

.zpm-bubble-sender {
    font-size: 9px;
    font-weight: 700;
    color: #2563eb;
    background: rgba(37,99,235,0.08);
    padding: 1px 5px;
    border-radius: 99px;
    display: inline-block;
    width: fit-content;
    letter-spacing: 0.04em;
    margin-bottom: 1px;
    text-transform: uppercase;
}

.zpm-bubble-text {
    font-size: 12px;
    line-height: 1.5;
    color: #1a1a1a;
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
}

.zpm-bubble-time {
    font-size: 9px;
    color: #8e8e93;
    text-align: right;
    margin-top: 1px;
}

/* Gradient fade — sells the half-phone crop */
.zpm-fade {
    position: absolute;
    bottom: 0;
    left: 8px;
    right: 8px;
    height: 60px;
    background: linear-gradient(to bottom, transparent, rgba(242,242,247,0.98) 85%);
    pointer-events: none;
    z-index: 5;
}

/* Ground shadow beneath the cutoff edge */
.zpm-ground-shadow {
    width: 200px;
    height: 16px;
    background: radial-gradient(ellipse, rgba(0,0,0,0.16) 0%, transparent 70%);
    margin-top: -1px;
    flex-shrink: 0;
}

/* ── Stats pills ── */
.zpm-pills {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 5px;
    margin-top: 14px;
    max-width: 280px;
}

.zpm-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 500;
    color: var(--zp-ink-2);
    background: var(--zp-surface-2);
    border: 1px solid var(--zp-line-2);
    white-space: nowrap;
}

.zpm-pill strong {
    font-weight: 700;
    color: var(--zp-ink);
}

.zpm-pill--blue {
    background: #dbeafe;
    border-color: #93c5fd;
    color: #1a4fa0;
}

.zpm-pill--blue strong { color: #1e3f87; }

.zpm-pill-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.zpm-pill-dot--green  { background: #22c55e; }
.zpm-pill-dot--purple { background: #6366f1; }

/* Dark mode for pills */
@media (prefers-color-scheme: dark) {
    .zpm-pill--blue {
        background: #0c2a5a;
        border-color: #1e4a8a;
        color: #7ab3ff;
    }

    .zpm-pill--blue strong { color: #9fc8ff; }
}

/* Responsive: stack below 720px (already done by zp-grid) */
@media (max-width: 720px) {
    .zpm-scene { width: 240px; }
    .zpm-shell { width: 240px; height: 310px; }
    .zpm-ground-shadow { width: 180px; }
    .zpm-pills { max-width: 260px; }
}

@media (max-width: 400px) {
    .zpm-scene { width: 210px; }
    .zpm-shell { width: 210px; height: 280px; }
}


/* 1. Apply the mask to the entire scene container */
.zpm-scene {
    position: relative;
    /* This ensures the bottom of the entire phone assembly fades out */
    -webkit-mask-image: linear-gradient(
        to bottom,
        black 0%,
        black 60%,        /* Solid until 60% down */
        transparent 95%   /* Smoothly fades to nothing by 95% */
    );
    mask-image: linear-gradient(
        to bottom,
        black 0%,
        black 60%,
        transparent 95%
    );
}

/* 2. Adjust the Fade Overlay (Optional) */
/* If you want a colored "glow" or background-matched fade in addition to the transparency mask */
.zpm-fade {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 120px; /* Adjust height to taste */
    background: linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0) 0%,
        rgba(225, 232, 237,1) 100% /* Match this color to your zp-right background */
    );
    pointer-events: none;
    z-index: 20; /* Ensure it sits above the shell buttons */
}

/* 3. Soften the Ground Shadow */
.zpm-ground-shadow {
    height: 50px;
    margin-top: -25px; /* Pull it up slightly so it starts inside the fade */
    background: radial-gradient(
        ellipse at center,
        rgba(0,0,0,0.15) 0%,
        transparent 80%
    );
    filter: blur(8px);
    opacity: 0.6;
}

@media (max-width: 1024px) {

    .zp-right {
        position: static;
        display: flex;
        justify-content: center;
        align-items: center;
    }

    .zp-phone-card {
        display: flex;
        flex-direction: column;
        align-items: center;
        margin: 0 auto;
    }

}
