/* IdentityWare Styles */

.iw-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

.iw-header {
    margin-bottom: 24px;
}

.iw-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--primary-purple, #8B7EC8);
    margin: 0 0 4px;
}

.iw-subtitle {
    font-size: 0.9rem;
    color: #888;
    margin: 0;
}

/* Layout: sidebar + main */
.iw-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 24px;
    min-height: 500px;
}

/* Sidebar */
.iw-sidebar {
    background: var(--bg-card, #fff);
    border: 1px solid var(--border-color, #e5e5e5);
    border-radius: 10px;
    padding: 16px;
    height: fit-content;
}

.iw-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-weight: 600;
    font-size: 0.95rem;
}

.iw-profile-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.iw-profile-card {
    position: relative;
    padding: 10px 12px;
    border: 1px solid var(--border-color, #e5e5e5);
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.iw-profile-card:hover {
    border-color: var(--primary-purple, #8B7EC8);
    background: rgba(139, 126, 200, 0.04);
}

.iw-profile-active {
    border-color: var(--primary-purple, #8B7EC8);
    background: rgba(139, 126, 200, 0.08);
}

.iw-profile-card-name {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 2px;
}

.iw-profile-card-meta {
    font-size: 0.78rem;
    color: #888;
}

.iw-badge-default {
    display: inline-block;
    font-size: 0.65rem;
    background: var(--primary-purple, #8B7EC8);
    color: #fff;
    padding: 1px 6px;
    border-radius: 4px;
    margin-right: 4px;
    vertical-align: middle;
}

.iw-btn-delete {
    position: absolute;
    top: 6px;
    right: 6px;
    background: none;
    border: none;
    font-size: 1.1rem;
    color: #ccc;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}
.iw-btn-delete:hover { color: #e74c3c; }

/* Main area */
.iw-main {
    background: var(--bg-card, #fff);
    border: 1px solid var(--border-color, #e5e5e5);
    border-radius: 10px;
    overflow: hidden;
}

/* Tabs */
.iw-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color, #e5e5e5);
    background: var(--bg-subtle, #fafafa);
}

.iw-tab {
    padding: 10px 20px;
    border: none;
    background: none;
    font-size: 0.9rem;
    cursor: pointer;
    color: #666;
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
}
.iw-tab:hover { color: var(--primary-purple, #8B7EC8); }
.iw-tab-active {
    color: var(--primary-purple, #8B7EC8);
    border-bottom-color: var(--primary-purple, #8B7EC8);
    font-weight: 600;
}

.iw-tab-content {
    padding: 20px;
}

/* Panels */
.iw-panel { min-height: 300px; }

/* Editor form */
.iw-form-section {
    margin-bottom: 24px;
}
.iw-form-section h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-color, #e5e5e5);
    display: flex;
    align-items: center;
    gap: 8px;
}

.iw-field {
    margin-bottom: 10px;
}
.iw-field label {
    display: block;
    font-size: 0.82rem;
    font-weight: 500;
    margin-bottom: 4px;
    color: #555;
}
.iw-field input[type="text"],
.iw-field input[type="email"],
.iw-field input[type="tel"],
.iw-field input[type="url"],
.iw-field select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border-color, #ddd);
    border-radius: 6px;
    font-size: 0.88rem;
    background: var(--bg-input, #fff);
    color: inherit;
    transition: border-color 0.2s;
}
.iw-field input:focus,
.iw-field select:focus {
    outline: none;
    border-color: var(--primary-purple, #8B7EC8);
    box-shadow: 0 0 0 2px rgba(139, 126, 200, 0.15);
}

.iw-field-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 16px;
}

.iw-color-grid {
    grid-template-columns: 1fr 1fr 1fr 1fr;
}
.iw-color-grid input[type="color"] {
    width: 100%;
    height: 36px;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 2px;
    cursor: pointer;
}

/* Buttons */
.iw-btn {
    display: inline-block;
    padding: 8px 16px;
    border: 1px solid var(--border-color, #ddd);
    border-radius: 6px;
    background: var(--bg-card, #fff);
    color: #555;
    font-size: 0.85rem;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
}
.iw-btn:hover { background: var(--bg-subtle, #f5f5f5); }

.iw-btn-primary {
    background: var(--primary-purple, #8B7EC8);
    color: #fff;
    border-color: var(--primary-purple, #8B7EC8);
}
.iw-btn-primary:hover {
    background: #7a6db8;
}

.iw-btn-sm {
    padding: 4px 10px;
    font-size: 0.78rem;
}

.iw-btn-inline {
    border: none;
    background: none;
    color: var(--primary-purple, #8B7EC8);
    font-size: 0.78rem;
    cursor: pointer;
    padding: 0 4px;
    text-decoration: underline;
}

.iw-form-actions {
    display: flex;
    gap: 12px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color, #e5e5e5);
}

/* Preview */
.iw-preview-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}
.iw-preview-tab {
    padding: 6px 14px;
    border: 1px solid var(--border-color, #ddd);
    border-radius: 20px;
    background: var(--bg-card, #fff);
    font-size: 0.82rem;
    cursor: pointer;
    color: #666;
    transition: all 0.2s;
}
.iw-preview-tab:hover { border-color: var(--primary-purple, #8B7EC8); }
.iw-preview-tab-active {
    background: var(--primary-purple, #8B7EC8);
    color: #fff;
    border-color: var(--primary-purple, #8B7EC8);
}

.iw-preview-area {
    min-height: 200px;
    display: flex;
    justify-content: center;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
}

.iw-preview-text {
    font-family: "Courier New", monospace;
    font-size: 0.85rem;
    white-space: pre-wrap;
    background: #fff;
    padding: 16px;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    width: 100%;
    max-width: 500px;
}

/* Download panel */
.iw-download-grid {
    display: grid;
    gap: 12px;
}

.iw-download-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--bg-subtle, #fafafa);
    border: 1px solid var(--border-color, #e5e5e5);
    border-radius: 8px;
}

.iw-download-label {
    flex: 1;
    font-weight: 500;
    font-size: 0.9rem;
}

.iw-download-size {
    font-size: 0.78rem;
    color: #888;
}

.iw-download-actions {
    display: flex;
    gap: 6px;
}

.iw-download-footer {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color, #e5e5e5);
}

/* Loading & empty states */
.iw-loading, .iw-empty {
    text-align: center;
    padding: 40px 20px;
    color: #888;
    font-size: 0.9rem;
}

/* Tagline picker modal */
.iw-tagline-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.iw-tagline-modal {
    background: var(--bg-card, #fff);
    border-radius: 12px;
    padding: 24px;
    max-width: 440px;
    width: 90%;
}
.iw-tagline-modal h3 {
    margin: 0 0 12px;
    font-size: 1rem;
}
.iw-tagline-option {
    display: block;
    width: 100%;
    text-align: left;
    padding: 10px 12px;
    margin-bottom: 6px;
    border: 1px solid var(--border-color, #e5e5e5);
    border-radius: 6px;
    background: var(--bg-card, #fff);
    cursor: pointer;
    font-size: 0.88rem;
    transition: border-color 0.2s;
}
.iw-tagline-option:hover {
    border-color: var(--primary-purple, #8B7EC8);
    background: rgba(139, 126, 200, 0.04);
}
.iw-tagline-cancel {
    margin-top: 8px;
}

/* Share panel */
.iw-share-container {
    max-width: 480px;
}
.iw-share-container h3 {
    font-size: 1.1rem;
    margin-bottom: 16px;
}
.iw-share-section {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color, #eee);
}
.iw-share-section:last-child { border-bottom: none; }
.iw-share-label {
    font-weight: 600;
    font-size: 0.88rem;
    margin-bottom: 8px;
}
.iw-share-url-row {
    display: flex;
    gap: 8px;
    align-items: center;
}
.iw-share-url {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid var(--border-color, #ddd);
    border-radius: 6px;
    font-size: 0.85rem;
    background: var(--bg-subtle, #f9f9f9);
    color: inherit;
}
.iw-handle-prefix {
    font-size: 0.82rem;
    color: #888;
    white-space: nowrap;
}
.iw-handle-input {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid var(--border-color, #ddd);
    border-radius: 6px;
    font-size: 0.85rem;
}
.iw-handle-status {
    font-size: 0.78rem;
    color: #e74c3c;
    margin-top: 4px;
    min-height: 18px;
}
.iw-qr-img {
    display: block;
    margin: 8px 0;
    border-radius: 8px;
    border: 1px solid var(--border-color, #eee);
}
.iw-share-hint {
    font-size: 0.82rem;
    color: #888;
    margin-top: 4px;
}
.iw-share-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Duplicate button */
.iw-btn-dup {
    position: absolute;
    top: 6px;
    right: 26px;
    background: none;
    border: none;
    font-size: 0.8rem;
    color: #ccc;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}
.iw-btn-dup:hover { color: var(--primary-purple, #8B7EC8); }

/* Responsive */
@media (max-width: 768px) {
    .iw-layout {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    .iw-sidebar {
        order: -1;
        max-height: none;
    }
    .iw-profile-list {
        flex-direction: row;
        overflow-x: auto;
        gap: 10px;
        padding-bottom: 6px;
        -webkit-overflow-scrolling: touch;
    }
    .iw-profile-card {
        min-width: 160px;
        flex-shrink: 0;
    }
    .iw-field-grid {
        grid-template-columns: 1fr;
    }
    .iw-color-grid {
        grid-template-columns: 1fr 1fr;
    }
    .iw-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .iw-tabs::-webkit-scrollbar { display: none; }
    .iw-tab {
        white-space: nowrap;
        padding: 10px 16px;
    }
    .iw-form-actions {
        flex-direction: column;
        position: sticky;
        bottom: 0;
        background: var(--bg-card, #fff);
        padding: 12px 0;
        z-index: 5;
        border-top: 1px solid var(--border-color, #e5e5e5);
    }
    .iw-form-actions .iw-btn {
        width: 100%;
        text-align: center;
        padding: 12px 16px;
        font-size: 0.9rem;
    }
    .iw-download-item {
        flex-direction: column;
        align-items: flex-start;
    }
    .iw-download-actions {
        width: 100%;
    }
    .iw-download-actions .iw-btn {
        flex: 1;
        text-align: center;
    }
    .iw-preview-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
    }
    .iw-preview-tab {
        white-space: nowrap;
    }
    .iw-share-url-row {
        flex-direction: column;
    }
    .iw-share-actions {
        flex-direction: column;
    }
    .iw-share-actions .iw-btn {
        width: 100%;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .iw-container { padding: 10px; }
    .iw-title { font-size: 1.3rem; }
    .iw-color-grid { grid-template-columns: 1fr 1fr; }
    .iw-sidebar { padding: 12px; }
    .iw-tab-content { padding: 14px; }
    .iw-field input, .iw-field select {
        font-size: 16px; /* prevent iOS zoom on focus */
    }
    .iw-profile-card {
        min-width: 140px;
    }
    .iw-btn-suggest-design, .iw-btn-suggest-tagline {
        font-size: 0.75rem;
    }
}

/* Warnings */
.iw-warnings {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}
.iw-warning {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.82rem;
    line-height: 1.4;
}
.iw-warning-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 700;
    flex-shrink: 0;
}
.iw-warning-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}
.iw-warning-error .iw-warning-icon {
    background: #ef4444;
    color: #fff;
}
.iw-warning-warn {
    background: #fffbeb;
    color: #92400e;
    border: 1px solid #fde68a;
}
.iw-warning-warn .iw-warning-icon {
    background: #f59e0b;
    color: #fff;
}
.iw-warning-info {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}
.iw-warning-info .iw-warning-icon {
    background: #3b82f6;
    color: #fff;
}

/* Tooltip icon */
.iw-tip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: #e5e5e5;
    color: #666;
    font-size: 0.65rem;
    font-weight: 700;
    cursor: help;
    vertical-align: middle;
    margin-left: 4px;
    flex-shrink: 0;
}
.iw-tip:hover {
    background: var(--primary-purple, #8B7EC8);
    color: #fff;
}

/* Auto-seed button */
.iw-auto-seed-btn {
    margin-top: 10px;
}

/* Modal overlay */
.iw-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9000;
}
.iw-modal {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    max-width: 520px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.iw-modal-wide {
    max-width: 680px;
}
.iw-modal h3 {
    margin: 0 0 8px;
    color: var(--primary-purple, #8B7EC8);
}
.iw-modal-hint {
    font-size: 0.85rem;
    color: #888;
    margin: 0 0 16px;
}
.iw-modal-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    justify-content: flex-end;
}

/* Import signature */
.iw-import-sig-input {
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 10px;
    font-family: monospace;
    font-size: 0.85rem;
    resize: vertical;
}
.iw-import-sig-result {
    margin-top: 12px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
    font-size: 0.85rem;
    line-height: 1.6;
}
.iw-parsed-confidence {
    margin-top: 8px;
    font-size: 0.8rem;
    color: #666;
}
.iw-parsed-notes {
    margin-top: 4px;
    font-size: 0.8rem;
    color: #999;
}

/* Import file input */
.iw-import-file {
    display: block;
    margin: 8px 0;
}

/* Email client notes */
.iw-email-notes-list {
    max-height: 50vh;
    overflow-y: auto;
}
.iw-email-note {
    padding: 12px 0;
    border-bottom: 1px solid #eee;
}
.iw-email-note:last-child { border-bottom: none; }
.iw-email-note-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}
.iw-support-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    color: #fff;
    text-transform: uppercase;
    font-weight: 600;
}
.iw-email-note-details {
    margin: 4px 0 4px 20px;
    padding: 0;
    font-size: 0.85rem;
    color: #555;
}
.iw-email-note-details li { margin: 2px 0; }
.iw-email-note-tip {
    font-size: 0.8rem;
    color: #666;
    margin: 4px 0 0;
}

/* Download info link */
.iw-download-info {
    margin-top: 12px;
    text-align: center;
}
.iw-btn-link {
    background: none;
    border: none;
    color: var(--primary-purple, #8B7EC8);
    cursor: pointer;
    font-size: 0.85rem;
    text-decoration: underline;
    padding: 4px;
}
.iw-btn-link:hover {
    color: #6a5ca0;
}

/* Theme support for modals */
[data-theme="mission-control"] .iw-modal { background: #1e1e2e; color: #e0e0e0; }
[data-theme="mission-control"] .iw-import-sig-input { background: #2a2a3e; border-color: #444; color: #e0e0e0; }
[data-theme="mission-control"] .iw-import-sig-result { background: #252535; }
[data-theme="mission-control"] .iw-email-note { border-color: #333; }

[data-theme="midnight-mode"] .iw-modal { background: #111; color: #d0d0d0; }
[data-theme="midnight-mode"] .iw-import-sig-input { background: #1a1a1a; border-color: #333; color: #d0d0d0; }
[data-theme="midnight-mode"] .iw-import-sig-result { background: #1a1a1a; }
[data-theme="midnight-mode"] .iw-email-note { border-color: #222; }

/* Theme support */
[data-theme="mission-control"] .iw-container { color: #e0e0e0; }
[data-theme="mission-control"] .iw-sidebar,
[data-theme="mission-control"] .iw-main { background: #1e1e2e; border-color: #333; }
[data-theme="mission-control"] .iw-tabs { background: #181828; }
[data-theme="mission-control"] .iw-profile-card { border-color: #333; }
[data-theme="mission-control"] .iw-profile-card:hover { background: rgba(139,126,200,0.1); }
[data-theme="mission-control"] .iw-field input,
[data-theme="mission-control"] .iw-field select { background: #2a2a3e; border-color: #444; color: #e0e0e0; }
[data-theme="mission-control"] .iw-preview-area { background: #15151f; }
[data-theme="mission-control"] .iw-download-item { background: #1e1e2e; border-color: #333; }

[data-theme="midnight-mode"] .iw-container { color: #d0d0d0; }
[data-theme="midnight-mode"] .iw-sidebar,
[data-theme="midnight-mode"] .iw-main { background: #111; border-color: #222; }
[data-theme="midnight-mode"] .iw-tabs { background: #0a0a0a; }
[data-theme="midnight-mode"] .iw-profile-card { border-color: #222; }
[data-theme="midnight-mode"] .iw-field input,
[data-theme="midnight-mode"] .iw-field select { background: #1a1a1a; border-color: #333; color: #d0d0d0; }
[data-theme="midnight-mode"] .iw-preview-area { background: #0a0a0a; }
[data-theme="midnight-mode"] .iw-download-item { background: #111; border-color: #222; }

/* ================================================================
   Contact Capture Admin — Collapsible Sections
   ================================================================ */

.iw-capture-section {
    border: 1px solid var(--border-color, #e5e5e5);
    border-radius: 10px;
    margin-top: 16px;
    overflow: hidden;
}

.iw-capture-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    cursor: pointer;
    user-select: none;
    background: var(--bg-card, #fafafa);
    transition: background 0.15s;
}
.iw-capture-section-header:hover {
    background: var(--bg-card-hover, #f0f0f0);
}

.iw-capture-section-title {
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.iw-capture-section-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--primary-purple, #8B7EC8);
    color: #fff;
}

.iw-capture-section-arrow {
    font-size: 0.75rem;
    color: #888;
    transition: transform 0.2s;
}
.iw-capture-section.open .iw-capture-section-arrow {
    transform: rotate(180deg);
}

.iw-capture-section-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    padding: 0 16px;
}
.iw-capture-section.open .iw-capture-section-body {
    max-height: 2000px;
    padding: 0 16px 16px;
}

.iw-capture-section-count {
    font-size: 0.8rem;
    color: #888;
    font-weight: 400;
}

/* ================================================================
   Toggle Switch
   ================================================================ */

.iw-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 0;
}

.iw-toggle-track {
    width: 44px;
    height: 24px;
    border-radius: 12px;
    background: #ccc;
    position: relative;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
}
.iw-toggle.on .iw-toggle-track {
    background: var(--primary-purple, #8B7EC8);
}

.iw-toggle-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: left 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.iw-toggle.on .iw-toggle-thumb {
    left: 22px;
}

.iw-toggle-label {
    font-size: 0.9rem;
    color: #333;
}

.iw-toggle.disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* ================================================================
   Capture Form Inputs
   ================================================================ */

.iw-capture-input,
.iw-capture-textarea {
    width: 100%;
    border: 1px solid var(--border-color, #ddd);
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 0.9rem;
    font-family: inherit;
    margin-top: 4px;
    box-sizing: border-box;
    background: var(--bg-input, #fff);
    color: var(--text-color, #333);
}
.iw-capture-textarea {
    resize: vertical;
    min-height: 60px;
}

.iw-capture-select {
    width: 100%;
    border: 1px solid var(--border-color, #ddd);
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 0.9rem;
    font-family: inherit;
    margin-top: 4px;
    box-sizing: border-box;
    background: var(--bg-input, #fff);
    color: var(--text-color, #333);
    cursor: pointer;
}

.iw-capture-hint {
    font-size: 0.8rem;
    color: #888;
    margin-top: 4px;
}

.iw-capture-field {
    margin-top: 12px;
}
.iw-capture-field label {
    font-size: 0.85rem;
    font-weight: 500;
    color: #555;
}

.iw-capture-divider {
    margin: 16px 0 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color, #eee);
    font-size: 0.85rem;
    font-weight: 600;
    color: #555;
    display: flex;
    align-items: center;
    gap: 8px;
}
.iw-capture-divider .iw-capture-section-badge {
    font-size: 0.65rem;
}

.iw-capture-actions {
    margin-top: 16px;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* ================================================================
   Event Mode
   ================================================================ */

.iw-event-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    width: 100%;
    box-sizing: border-box;
}
.iw-event-status.active {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}
.iw-event-status.active::before {
    content: '';
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #4caf50;
    animation: iw-pulse 2s infinite;
}

@keyframes iw-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.iw-event-countdown {
    font-size: 0.85rem;
    color: #666;
    margin-top: 6px;
}

.iw-event-summary {
    padding: 12px;
    background: #f3e5f5;
    border-radius: 8px;
    margin-top: 12px;
    font-size: 0.9rem;
    color: #6a1b9a;
}

/* ================================================================
   Captured Contacts List
   ================================================================ */

.iw-contact-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.iw-contact-card {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color, #eee);
}
.iw-contact-card:last-child {
    border-bottom: none;
}

.iw-contact-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-color, #333);
}

.iw-contact-info {
    font-size: 0.8rem;
    color: #666;
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.iw-contact-date {
    font-size: 0.78rem;
    color: #999;
    white-space: nowrap;
}

.iw-contact-event-tag {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 500;
    background: #e8eaf6;
    color: #3f51b5;
}

.iw-contact-empty {
    text-align: center;
    padding: 24px 16px;
    color: #888;
    font-size: 0.9rem;
    line-height: 1.6;
}

.iw-load-more {
    text-align: center;
    margin-top: 12px;
}

/* ================================================================
   Capture Analytics
   ================================================================ */

.iw-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}
@media (max-width: 1200px) {
    .iw-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.iw-stat-card {
    text-align: center;
    padding: 14px 8px;
    border-radius: 8px;
    background: var(--bg-card, #f8f9fa);
    border: 1px solid var(--border-color, #e5e5e5);
}

.iw-stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--primary-purple, #8B7EC8);
    line-height: 1.2;
}

.iw-stat-label {
    font-size: 0.75rem;
    color: #888;
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.iw-period-toggle {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
}
.iw-period-btn {
    padding: 4px 12px;
    border: 1px solid var(--border-color, #ddd);
    border-radius: 6px;
    background: transparent;
    color: #666;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.15s;
}
.iw-period-btn.active {
    background: var(--primary-purple, #8B7EC8);
    color: #fff;
    border-color: var(--primary-purple, #8B7EC8);
}

.iw-sparkline {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 48px;
    margin: 12px 0;
}

.iw-sparkline-bar {
    flex: 1;
    min-width: 2px;
    background: var(--primary-purple, #8B7EC8);
    border-radius: 2px 2px 0 0;
    opacity: 0.7;
    transition: opacity 0.15s;
}
.iw-sparkline-bar:hover {
    opacity: 1;
}

.iw-event-breakdown {
    margin-top: 12px;
}

.iw-event-breakdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color, #eee);
    font-size: 0.85rem;
}
.iw-event-breakdown-item:last-child {
    border-bottom: none;
}
.iw-event-breakdown-label {
    font-weight: 500;
    color: var(--text-color, #333);
}
.iw-event-breakdown-stats {
    color: #888;
    font-size: 0.8rem;
}

/* ================================================================
   Stage Gate (upgrade prompt)
   ================================================================ */

.iw-stage-gate {
    text-align: center;
    padding: 20px 16px;
    background: linear-gradient(135deg, #f3e5f5, #e8eaf6);
    border-radius: 8px;
    margin-top: 8px;
}

.iw-stage-gate-text {
    font-size: 0.9rem;
    color: #555;
    line-height: 1.5;
    margin-bottom: 12px;
}

.iw-stage-gate-btn {
    display: inline-block;
    padding: 8px 20px;
    border: none;
    border-radius: 6px;
    background: var(--primary-purple, #8B7EC8);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.iw-stage-gate-btn:hover {
    background: #6a5ca0;
}

.iw-stage-gate-lock {
    font-size: 0.9rem;
    margin-right: 4px;
}

/* ================================================================
   Analytics section label
   ================================================================ */

.iw-analytics-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #555;
    margin-top: 16px;
    margin-bottom: 4px;
}

/* ================================================================
   Theme support for capture sections
   ================================================================ */

[data-theme="mission-control"] .iw-capture-section { border-color: #333; }
[data-theme="mission-control"] .iw-capture-section-header { background: #1e1e2e; }
[data-theme="mission-control"] .iw-capture-section-header:hover { background: #252538; }
[data-theme="mission-control"] .iw-capture-input,
[data-theme="mission-control"] .iw-capture-textarea,
[data-theme="mission-control"] .iw-capture-select { background: #2a2a3e; border-color: #444; color: #e0e0e0; }
[data-theme="mission-control"] .iw-capture-hint { color: #888; }
[data-theme="mission-control"] .iw-capture-divider { border-color: #333; color: #aaa; }
[data-theme="mission-control"] .iw-toggle-label { color: #e0e0e0; }
[data-theme="mission-control"] .iw-contact-card { border-color: #333; }
[data-theme="mission-control"] .iw-contact-name { color: #e0e0e0; }
[data-theme="mission-control"] .iw-contact-empty { color: #888; }
[data-theme="mission-control"] .iw-stat-card { background: #1e1e2e; border-color: #333; }
[data-theme="mission-control"] .iw-event-status.active { background: #1b3a1b; border-color: #2e7d32; }
[data-theme="mission-control"] .iw-event-summary { background: #2a1f3a; color: #ce93d8; }
[data-theme="mission-control"] .iw-stage-gate { background: linear-gradient(135deg, #2a1f3a, #1e1e3a); }
[data-theme="mission-control"] .iw-stage-gate-text { color: #ccc; }
[data-theme="mission-control"] .iw-event-breakdown-item { border-color: #333; }
[data-theme="mission-control"] .iw-event-breakdown-label { color: #e0e0e0; }
[data-theme="mission-control"] .iw-period-btn { border-color: #444; color: #aaa; }

[data-theme="midnight-mode"] .iw-capture-section { border-color: #222; }
[data-theme="midnight-mode"] .iw-capture-section-header { background: #111; }
[data-theme="midnight-mode"] .iw-capture-section-header:hover { background: #1a1a1a; }
[data-theme="midnight-mode"] .iw-capture-input,
[data-theme="midnight-mode"] .iw-capture-textarea,
[data-theme="midnight-mode"] .iw-capture-select { background: #1a1a1a; border-color: #333; color: #d0d0d0; }
[data-theme="midnight-mode"] .iw-capture-hint { color: #777; }
[data-theme="midnight-mode"] .iw-capture-divider { border-color: #222; color: #999; }
[data-theme="midnight-mode"] .iw-toggle-label { color: #d0d0d0; }
[data-theme="midnight-mode"] .iw-contact-card { border-color: #222; }
[data-theme="midnight-mode"] .iw-contact-name { color: #d0d0d0; }
[data-theme="midnight-mode"] .iw-contact-empty { color: #777; }
[data-theme="midnight-mode"] .iw-stat-card { background: #111; border-color: #222; }
[data-theme="midnight-mode"] .iw-event-status.active { background: #0d1f0d; border-color: #2e7d32; }
[data-theme="midnight-mode"] .iw-event-summary { background: #1a0f22; color: #ba68c8; }
[data-theme="midnight-mode"] .iw-stage-gate { background: linear-gradient(135deg, #1a0f22, #0d0d1f); }
[data-theme="midnight-mode"] .iw-stage-gate-text { color: #bbb; }
[data-theme="midnight-mode"] .iw-event-breakdown-item { border-color: #222; }
[data-theme="midnight-mode"] .iw-event-breakdown-label { color: #d0d0d0; }
[data-theme="midnight-mode"] .iw-period-btn { border-color: #333; color: #999; }
