/* Private Zone - Dark & Red Theme */

:root {
    --primary-red: #dc2626;
    --dark-red: #991b1b;
    --light-red: #fca5a5;
    --bg-dark: #0a0a0a;
    --bg-darker: #000000;
    --bg-card: #1a1a1a;
    --bg-card-hover: #252525;
    --text-primary: #ffffff;
    --text-secondary: #a3a3a3;
    --border-color: #2a2a2a;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-darker);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Auth Pages */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bg-darker) 0%, var(--bg-dark) 100%);
    padding: 20px;
}

.auth-container {
    width: 100%;
    max-width: 400px;
}

.auth-box {
    background: var(--bg-card);
    padding: 40px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 40px rgba(220, 38, 38, 0.1);
}

.app-title {
    color: var(--primary-red);
    font-size: 32px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 10px;
}

.auth-box h2 {
    text-align: center;
    margin-bottom: 30px;
    color: var(--text-primary);
}

.auth-link {
    text-align: center;
    margin-top: 20px;
    color: var(--text-secondary);
}

.auth-link a {
    color: var(--primary-red);
    text-decoration: none;
}

.auth-link a:hover {
    text-decoration: underline;
}

/* App Layout */
.app-body {
    min-height: 100vh;
    background: var(--bg-darker);
    padding-bottom: 80px;
}

.app-container {
    max-width: 600px;
    margin: 0 auto;
    background: var(--bg-dark);
    min-height: 100vh;
}

.app-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 15px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.app-header h1 {
    color: var(--primary-red);
    font-size: 24px;
    font-weight: bold;
}

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

.header-icon {
    color: var(--text-primary);
    font-size: 20px;
    text-decoration: none;
    transition: color 0.3s;
}

.header-icon:hover {
    color: var(--primary-red);
}

.app-main {
    padding: 20px;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 600px;
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    padding: 10px 0;
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 8px 20px;
    border-radius: 8px;
    transition: all 0.3s;
    font-size: 12px;
}

.nav-item i {
    font-size: 20px;
}

.nav-item.active {
    color: var(--primary-red);
    background: rgba(220, 38, 38, 0.1);
}

.nav-item:hover {
    color: var(--primary-red);
}

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

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

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px;
    background: var(--bg-darker);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 16px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-red);
}

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

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

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

.btn-primary:hover {
    background: var(--dark-red);
}

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

.btn-success:hover {
    background: #059669;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 14px;
}

.btn-whatsapp {
    background: #25d366;
    color: #fff;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-whatsapp:hover {
    background: #20bd5a;
    color: #fff;
}

.btn-block {
    width: 100%;
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.3s;
}

.btn-icon:hover {
    color: var(--primary-red);
    background: rgba(220, 38, 38, 0.1);
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--danger);
    color: var(--danger);
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid var(--success);
    color: var(--success);
}

/* Page Content */
.page-content {
    animation: fadeIn 0.3s;
}

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

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.page-header h2 {
    color: var(--text-primary);
    font-size: 24px;
}

/* Connections */
.connections-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.connection-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    transition: all 0.3s;
}

.connection-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--primary-red);
}

.connection-avatar {
    position: relative;
    width: 50px;
    height: 50px;
    flex-shrink: 0;
}

.connection-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.avatar-placeholder {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--bg-darker);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 20px;
}

.connection-status-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid var(--bg-card);
}

.connection-status-dot.online {
    background: var(--success);
}

.connection-status-dot.offline {
    background: var(--text-secondary);
}

.connection-info {
    flex: 1;
}

.connection-info h3 {
    color: var(--text-primary);
    font-size: 16px;
    margin-bottom: 4px;
}

.connection-status {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Tasks */
.tasks-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.task-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
}

.task-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.task-header h4 {
    color: var(--text-primary);
    font-size: 18px;
}

.task-status {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-pending {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
}

.status-completed {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
}

.status-in_progress {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
}

.status-aborted {
    background: rgba(107, 114, 128, 0.2);
    color: #6b7280;
}

.status-failed {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.task-description {
    color: var(--text-secondary);
    margin-bottom: 12px;
    line-height: 1.6;
}

.task-meta {
    display: flex;
    gap: 20px;
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 12px;
}

.task-meta i {
    margin-right: 5px;
}

.task-reward,
.task-punishment {
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 12px;
    font-size: 14px;
}

.task-reward {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.task-punishment {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.task-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

/* Broadcast */
.broadcasts-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.broadcast-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

.broadcast-image {
    width: 100%;
    max-height: 300px;
    overflow: hidden;
}

.broadcast-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.broadcast-content {
    padding: 20px;
}

.broadcast-content p {
    color: var(--text-primary);
    line-height: 1.6;
    margin-bottom: 12px;
}

.broadcast-meta {
    color: var(--text-secondary);
    font-size: 14px;
}

.broadcast-actions {
    padding: 0 20px 20px;
    display: flex;
    justify-content: flex-end;
}

/* Chats */
.chats-list {
    display: flex;
    flex-direction: column;
    gap: 1px;
    background: var(--border-color);
}

.chat-item {
    background: var(--bg-card);
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    transition: background 0.3s;
}

.chat-item:hover {
    background: var(--bg-card-hover);
}

.chat-avatar {
    position: relative;
    width: 50px;
    height: 50px;
    flex-shrink: 0;
}

.chat-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.unread-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--primary-red);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
}

.chat-info {
    flex: 1;
}

.chat-info h3 {
    color: var(--text-primary);
    font-size: 16px;
    margin-bottom: 4px;
}

.chat-preview {
    color: var(--text-secondary);
    font-size: 14px;
}

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

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 20px;
    color: var(--primary-red);
    opacity: 0.5;
}

.empty-state p {
    font-size: 16px;
}

.empty-state-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin: 0 auto 20px;
    overflow: hidden;
    background: var(--bg-secondary);
}

.empty-state-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.empty-state-avatar .avatar-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: var(--primary-red);
    opacity: 0.5;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: var(--bg-card);
    border-radius: 12px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-header h3 {
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s;
}

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

.modal form {
    padding: 20px;
}

.modal-body {
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
}

/* Submission view modal: Q&A only, clean */
.submission-view-modal.modal {
    display: none;
}

.submission-view-modal.modal[style*="flex"] {
    display: flex !important;
}

.submission-modal-content {
    max-width: 560px;
}

.submission-modal-body {
    padding: 0;
}

.submission-qa {
    padding: 14px 0;
    border-bottom: 1px solid var(--border-color);
}

.submission-qa:last-child {
    border-bottom: none;
}

.submission-q {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 6px;
    line-height: 1.5;
}

.submission-q p,
.submission-q h1, .submission-q h2, .submission-q h3 {
    margin: 0 0 6px 0;
    font-size: inherit;
}

.submission-q img {
    max-width: 100%;
    height: auto;
}

.submission-a {
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.5;
}

.submission-modal-empty {
    color: var(--text-secondary);
    margin: 0;
}

/* Section */
.section {
    margin-bottom: 30px;
}

.section-title {
    color: var(--text-primary);
    font-size: 18px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

/* Templates (Chat Forms) */
.templates-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.template-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.template-card-main h3 {
    color: var(--text-primary);
    font-size: 16px;
    margin-bottom: 4px;
}

.template-meta {
    color: var(--text-secondary);
    font-size: 13px;
}

.template-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.submissions-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.submissions-table th,
.submissions-table td {
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
}

.submissions-table th {
    color: var(--text-secondary);
    font-weight: 500;
}

.submission-details {
    padding: 10px 0;
}

/* Templates page: tab bar (Your flows | Last submitted forms) */
.templates-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 4px;
}

.templates-tab {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.templates-tab i {
    font-size: 16px;
    opacity: 0.9;
}

.templates-tab:hover {
    color: var(--text-primary);
    background: var(--bg-darker);
}

.templates-tab.active {
    color: var(--primary-red);
    background: rgba(220, 38, 38, 0.12);
}

.templates-tab.active:hover {
    color: var(--primary-red);
    background: rgba(220, 38, 38, 0.18);
}

.templates-tab-desc {
    color: var(--text-secondary);
    font-size: 13px;
    margin: -8px 0 16px 0;
}

/* Last submitted forms: one tab per flow */
.flow-tabs-wrap {
    margin-top: 8px;
}

.flow-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.flow-tab {
    display: inline-block;
    padding: 10px 16px;
    border-radius: 8px;
    background: var(--bg-darker);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s, color 0.2s;
}

.flow-tab:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.flow-tab.active {
    background: rgba(220, 38, 38, 0.15);
    color: var(--primary-red);
}

.flow-tab-content {
    margin-top: 0;
}

.empty-state-inline {
    color: var(--text-secondary);
    padding: 24px 0;
    text-align: center;
}

/* Template list: icon-based cards */
/* Templates list: filter section */
.templates-filter {
    margin-bottom: 20px;
}

.templates-filter-form {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 14px 16px;
}

.templates-filter-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.templates-filter-search {
    flex: 1;
    min-width: 140px;
    padding: 10px 14px;
    background: var(--bg-darker);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
}

.templates-filter-search:focus {
    outline: none;
    border-color: var(--primary-red);
}

.templates-filter-sort,
.templates-filter-submissions {
    padding: 10px 14px;
    background: var(--bg-darker);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    min-width: 140px;
}

.templates-list-cards {
    gap: 10px;
}

.template-card-row {
    flex-direction: row;
    align-items: center;
    padding: 14px 16px;
    gap: 14px;
}

.template-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: rgba(220, 38, 38, 0.15);
    color: var(--primary-red);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.template-card-icon-avatar {
    padding: 0;
    background: var(--bg-secondary);
    overflow: hidden;
}

.template-card-icon-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.template-card-icon-avatar .avatar-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--primary-red);
    opacity: 0.6;
}

.template-card-row .template-card-main {
    flex: 1;
    min-width: 0;
}

.template-card-row .template-card-main h3 {
    font-size: 16px;
    margin-bottom: 4px;
}

.template-card-row .template-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 12px;
}

.template-card-row .template-meta span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.template-card-row .template-meta i {
    opacity: 0.7;
}

.template-last-msg {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.template-last-msg i {
    opacity: 0.8;
    flex-shrink: 0;
}

/* Last submitted forms tab: emphasize last submission */
.templates-list-submitted .template-last-msg-emphasis {
    color: var(--text-primary);
    font-size: 13px;
    margin-top: 8px;
}

.templates-list-submitted .template-last-msg-emphasis strong {
    color: var(--primary-red);
    font-weight: 600;
}

.template-card-actions-icons {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.btn-icon-round {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-darker);
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
    font-size: 14px;
}

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

.btn-icon-primary {
    background: rgba(220, 38, 38, 0.15);
    color: var(--primary-red);
    border-color: transparent;
}

.btn-icon-primary:hover {
    background: var(--primary-red);
    color: white;
}

.btn-icon-danger:hover {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
    border-color: var(--danger);
}

.btn-icon-wrap {
    display: inline-flex;
}

/* Template builder (edit = steps only) */
.template-builder-page {
    padding-bottom: 40px;
}

.template-builder-header {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.btn-back {
    padding: 10px 14px;
    border-radius: 10px;
}

.template-builder-title {
    flex: 1;
    min-width: 0;
}

.template-builder-title h2 {
    font-size: 20px;
    margin-bottom: 4px;
}

.template-builder-subtitle {
    color: var(--text-secondary);
    font-size: 13px;
    margin: 0;
}

.template-builder-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.steps-builder {
    max-width: 560px;
}

.steps-builder-intro {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 24px;
}

.steps-builder-intro-icon {
    color: var(--primary-red);
    font-size: 20px;
    flex-shrink: 0;
}

.steps-builder-intro p {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 0;
    line-height: 1.5;
}

.steps-empty {
    text-align: center;
    padding: 32px 20px;
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 20px;
}

.steps-empty i {
    font-size: 36px;
    display: block;
    margin-bottom: 12px;
    opacity: 0.6;
}

.steps-list {
    list-style: none;
    padding: 0;
    margin: 0 0 28px 0;
}

.step-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
}

.step-number {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary-red);
    color: white;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.step-bubble {
    flex: 1;
    min-width: 0;
    padding: 12px 16px;
    border-radius: 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
}

.step-bubble-bot .step-message {
    color: var(--text-primary);
    font-size: 14px;
    margin: 0 0 10px 0;
    line-height: 1.45;
}

.step-message-rendered {
    max-width: 100%;
    overflow: hidden;
}

.step-message-rendered img {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
    margin: 8px 0;
}

.step-message-rendered a {
    color: var(--primary-red);
    text-decoration: underline;
}

.step-message-rendered p {
    margin: 0 0 8px 0;
}

.step-message-rendered p:last-child {
    margin-bottom: 0;
}

.step-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-secondary);
    background: var(--bg-darker);
    padding: 4px 8px;
    border-radius: 6px;
}

.step-buttons-preview {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.step-btn-pill {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 20px;
    background: rgba(220, 38, 38, 0.15);
    color: var(--primary-red);
}

.step-placeholder-preview {
    font-size: 12px;
    color: var(--text-secondary);
    font-style: italic;
    margin-top: 6px;
    display: block;
}

.step-item-actions {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.step-delete-form {
    display: inline-block;
}

.step-edit-btn {
    padding: 6px 12px;
    font-size: 13px;
}

.step-add-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 20px;
}

.step-add-title {
    font-size: 16px;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.step-add-title i {
    color: var(--primary-red);
}

.step-add-desc {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 18px;
}

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

.step-add-form .form-group:last-of-type {
    margin-bottom: 20px;
}

.step-field-buttons,
.step-field-placeholder {
    display: none;
}

/* RTL Support */
[dir="rtl"] {
    direction: rtl;
}

[dir="rtl"] .header-content,
[dir="rtl"] .page-header,
[dir="rtl"] .connection-card,
[dir="rtl"] .chat-item {
    flex-direction: row-reverse;
}

/* Wishlist Grid */
.wishlist-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.wishlist-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s;
}

.wishlist-item:hover {
    border-color: var(--primary-red);
}

.wishlist-image {
    width: 100%;
    height: 200px;
    overflow: hidden;
}

.wishlist-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wishlist-content {
    padding: 15px;
}

.wishlist-content h3,
.wishlist-content h4 {
    color: var(--text-primary);
    margin-bottom: 8px;
    font-size: 16px;
}

.wishlist-content p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 10px;
}

.wishlist-price {
    color: var(--primary-red);
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 10px;
}

/* Responsive */
@media (max-width: 600px) {
    .app-container {
        max-width: 100%;
    }
    
    .auth-box {
        padding: 30px 20px;
    }
    
    .app-main {
        padding: 15px;
    }

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

    .page-header .btn {
        width: 100%;
    }
    
    .wishlist-grid {
        grid-template-columns: 1fr;
    }
}

/* CKEditor: dark background and light text (match app theme) */
.ck.ck-editor {
    --ck-color-base-background: var(--bg-darker);
    --ck-color-base-foreground: var(--bg-card);
    --ck-color-text: var(--text-primary);
    --ck-color-panel-background: var(--bg-card);
    --ck-color-panel-border: var(--border-color);
    --ck-color-toolbar-background: var(--bg-card);
    --ck-color-toolbar-border: var(--border-color);
    --ck-color-input-background: var(--bg-darker);
    --ck-color-input-border: var(--border-color);
    --ck-color-input-text: var(--text-primary);
    --ck-color-button-default-hover-background: var(--bg-card-hover);
    --ck-color-button-default-hover-border: var(--border-color);
    --ck-color-button-on-background: rgba(220, 38, 38, 0.2);
    --ck-color-button-on-text: var(--primary-red);
    --ck-color-link: var(--primary-red);
}

.ck.ck-editor .ck-editor__editable {
    background: var(--bg-darker) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color);
}

.ck.ck-editor .ck-editor__top .ck-sticky-panel .ck-toolbar {
    background: var(--bg-card) !important;
    border-color: var(--border-color);
}

.ck.ck-editor .ck-toolbar .ck-toolbar__separator {
    background: var(--border-color);
}

.ck.ck-editor .ck-icon {
    color: var(--text-secondary);
}

.ck.ck-editor .ck-button:not(.ck-disabled):hover .ck-icon,
.ck.ck-editor .ck-button.ck-on .ck-icon {
    color: var(--text-primary);
}

.ck.ck-editor .ck-dropdown .ck-dropdown__panel {
    background: var(--bg-card);
    border-color: var(--border-color);
}

.ck.ck-editor .ck-list__item .ck-button:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.ck.ck-editor .ck-input-text {
    background: var(--bg-darker) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color);
}

.ck.ck-editor .ck-editor__editable a {
    color: var(--primary-red);
}
