.whatsapp-page {
    max-width: 1320px;
}

.whatsapp-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
    padding: 28px;
    background: linear-gradient(135deg, #ffffff 0%, #f3fbf7 100%);
    border: 1px solid var(--border-soft);
}

.whatsapp-hero h1 {
    margin: 8px 0 10px;
    font-size: 34px;
    letter-spacing: -0.03em;
}

.whatsapp-hero p {
    margin: 0;
    max-width: 720px;
    color: var(--text-soft);
    line-height: 1.55;
}

.whatsapp-hero__status {
    min-width: 260px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid #e5e7eb;
    background: rgba(255,255,255,.88);
    border-radius: 14px;
}

.whatsapp-hero__status small,
.whatsapp-hero__status strong {
    display: block;
}

.whatsapp-hero__status small {
    color: var(--text-soft);
    margin-bottom: 3px;
}

.whatsapp-hero__status strong {
    font-size: 13px;
}

.wa-status-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    flex: 0 0 auto;
    background: #9ca3af;
    box-shadow: 0 0 0 5px rgba(156,163,175,.12);
}

.wa-status-dot.is-pending {
    background: #d97706;
    box-shadow: 0 0 0 5px rgba(217,119,6,.12);
}

.wa-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.wa-stat-card {
    background: #fff;
    border: 1px solid var(--border-soft);
    border-radius: 16px;
    padding: 18px;
    box-shadow: var(--shadow-panel);
}

.wa-stat-card span,
.wa-stat-card small,
.wa-stat-card strong {
    display: block;
}

.wa-stat-card span {
    color: var(--text-soft);
    font-size: 13px;
    font-weight: 700;
}

.wa-stat-card strong {
    font-size: 28px;
    margin: 9px 0 5px;
}

.wa-stat-card small {
    color: #8b93a3;
    font-size: 12px;
}

.wa-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 330px;
    gap: 24px;
    align-items: start;
}

.wa-main-column,
.wa-side-column {
    min-width: 0;
}

.wa-side-column {
    position: sticky;
    top: 84px;
}

.wa-section {
    padding: 24px;
}

.wa-section__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 22px;
}

.wa-section__header h2,
.wa-tester h2,
.wa-help-card h3,
.wa-subsection h3 {
    margin: 4px 0 7px;
}

.wa-section__header p,
.wa-tester > p,
.wa-subsection__title p,
.wa-help-card p {
    margin: 0;
    color: var(--text-soft);
    font-size: 13px;
    line-height: 1.5;
}

.wa-kicker {
    display: inline-block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .08em;
    font-weight: 800;
    color: #6d28d9;
}

.wa-activation-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 16px 18px;
    border: 1px solid #e6e8ee;
    border-radius: 14px;
    background: #fafafa;
    margin-bottom: 22px;
}

.wa-activation-card strong {
    display: block;
    margin-bottom: 4px;
}

.wa-activation-card p {
    margin: 0;
    color: var(--text-soft);
    font-size: 12px;
}

.wa-switch,
.wa-mini-switch {
    display: inline-flex;
    flex: 0 0 auto;
}

.wa-switch input,
.wa-mini-switch input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.wa-switch span,
.wa-mini-switch span {
    display: block;
    position: relative;
    border-radius: 999px;
    background: #d1d5db;
    cursor: pointer;
    transition: .2s ease;
}

.wa-switch span { width: 50px; height: 28px; }
.wa-mini-switch span { width: 38px; height: 22px; }

.wa-switch span::after,
.wa-mini-switch span::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,.18);
    transition: .2s ease;
}

.wa-switch span::after { width: 22px; height: 22px; }
.wa-mini-switch span::after { width: 16px; height: 16px; }

.wa-switch input:checked + span,
.wa-mini-switch input:checked + span { background: #16a34a; }
.wa-switch input:checked + span::after { transform: translateX(22px); }
.wa-mini-switch input:checked + span::after { transform: translateX(16px); }
.wa-switch input:disabled + span,
.wa-mini-switch input:disabled + span { cursor: not-allowed; opacity: .6; }

.wa-subsection {
    padding-top: 2px;
    margin-bottom: 22px;
}

.wa-subsection__title {
    margin-bottom: 12px;
}

.wa-schedule {
    border: 1px solid #e7e9ef;
    border-radius: 14px;
    overflow: hidden;
}

.wa-schedule-row {
    display: grid;
    grid-template-columns: 170px minmax(280px, 1fr) 150px;
    align-items: center;
    gap: 14px;
    padding: 10px 14px;
    border-bottom: 1px solid #eceef2;
    background: #fff;
}

.wa-schedule-row:last-child { border-bottom: 0; }

.wa-schedule-day {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.wa-schedule-day strong { font-size: 13px; }

.wa-schedule-hours {
    display: flex;
    align-items: end;
    gap: 9px;
}

.wa-schedule-hours.is-disabled { opacity: .45; }
.wa-schedule-hours label { flex: 1; }
.wa-schedule-hours label span { display: block; font-size: 10px; color: var(--text-soft); margin-bottom: 3px; }
.wa-schedule-hours input { height: 34px; padding: 5px 8px; }
.wa-schedule-separator { padding-bottom: 8px; color: var(--text-soft); font-size: 12px; }
.wa-schedule-mode { justify-self: end; font-size: 11px; color: var(--text-soft); font-weight: 700; }

.wa-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.wa-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.wa-field > span {
    font-size: 12px;
    font-weight: 700;
    color: #4b5563;
}

.wa-field small {
    color: #8b93a3;
    font-size: 11px;
    line-height: 1.4;
}

.wa-field textarea { min-height: 92px; }

.wa-form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid #eceef2;
}

.wa-save-note { color: var(--text-soft); font-size: 12px; }

.wa-rules-list {
    display: grid;
    gap: 12px;
}

.wa-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 130px;
    text-align: center;
    border: 1px dashed #d8dbe4;
    border-radius: 14px;
    color: var(--text-soft);
    gap: 6px;
}

.wa-empty strong { color: var(--text-main); }
.wa-empty span { font-size: 12px; }

.wa-rule-card {
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    overflow: hidden;
    background: #fff;
}

.wa-rule-card.is-off { opacity: .68; background: #fafafa; }

.wa-rule-card__top {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    padding: 15px 16px 12px;
}

.wa-rule-card__title-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    margin-bottom: 9px;
}

.wa-rule-card__title-row > strong { font-size: 15px; }
.wa-priority,
.wa-rule-state,
.wa-table-badge {
    padding: 4px 7px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    background: #f1f5f9;
    color: #475569;
}
.wa-rule-state.is-on { background: #dcfce7; color: #166534; }
.wa-table-badge.is-warning { background: #fef3c7; color: #92400e; }

.wa-keywords { display: flex; flex-wrap: wrap; gap: 6px; }
.wa-keywords span {
    padding: 4px 7px;
    border-radius: 7px;
    background: #f5f3ff;
    color: #6d28d9;
    font-size: 10px;
    font-weight: 700;
}

.wa-rule-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
.wa-rule-actions button {
    border: 0;
    background: #f1f3f6;
    color: #374151;
    font-size: 11px;
    font-weight: 700;
    padding: 7px 9px;
    border-radius: 8px;
    cursor: pointer;
}
.wa-rule-actions button:hover { background: #e5e7eb; }
.wa-rule-actions button.is-danger { color: #b91c1c; background: #fef2f2; }

.wa-rule-response {
    border-top: 1px solid #eceef2;
    background: #fafafa;
    padding: 11px 16px 13px;
}
.wa-rule-response small { color: var(--text-soft); font-weight: 700; }
.wa-rule-response p { margin: 5px 0 0; font-size: 12px; line-height: 1.5; white-space: pre-wrap; }

.wa-conversations-table { min-width: 760px; }

.wa-tester,
.wa-help-card {
    padding: 20px;
}

.wa-tester > p { margin-bottom: 16px; }
.wa-full-button { width: 100%; margin-top: 12px; }

.wa-test-result {
    margin-top: 14px;
    border-radius: 12px;
    padding: 14px;
    border: 1px solid #e5e7eb;
    background: #fafafa;
}
.wa-test-result small,
.wa-test-result strong,
.wa-test-result span { display: block; }
.wa-test-result small { color: var(--text-soft); margin-bottom: 5px; font-weight: 700; }
.wa-test-result strong { font-size: 13px; margin-bottom: 4px; }
.wa-test-result span { font-size: 11px; color: #6d28d9; margin-bottom: 7px; }
.wa-test-result p { margin: 0; white-space: pre-wrap; line-height: 1.5; font-size: 12px; }
.wa-test-result.is-match { border-color: #bbf7d0; background: #f0fdf4; }
.wa-test-result.is-fallback { border-color: #fde68a; background: #fffbeb; }
.wa-test-result.is-empty { color: var(--text-soft); }

.wa-help-card ol {
    margin: 14px 0 0;
    padding-left: 20px;
    color: #4b5563;
}
.wa-help-card li { margin: 8px 0; font-size: 12px; line-height: 1.4; }

.wa-modal {
    position: fixed;
    inset: 0;
    z-index: 1800;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 22px;
}
.wa-modal.hidden { display: none; }
.wa-modal__backdrop { position: absolute; inset: 0; background: rgba(15,23,42,.48); }
.wa-modal__dialog {
    position: relative;
    z-index: 1;
    width: min(720px, 100%);
    max-height: calc(100vh - 44px);
    overflow: auto;
    background: #fff;
    border-radius: 18px;
    padding: 22px;
    box-shadow: 0 24px 70px rgba(15,23,42,.28);
}
.wa-modal__header { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.wa-modal__header h2 { margin: 4px 0 0; }
.wa-modal__close { border: 0; width: 38px; height: 38px; border-radius: 10px; background: #f3f4f6; font-size: 24px; cursor: pointer; }
.wa-modal__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.wa-span-2 { grid-column: 1 / -1; }
.wa-check-field { display: flex; align-items: center; gap: 9px; padding-top: 24px; font-weight: 700; color: #4b5563; }
.wa-check-field input { width: 18px; height: 18px; }
.wa-modal__actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; padding-top: 16px; border-top: 1px solid #eceef2; }

@media (max-width: 1050px) {
    .wa-layout { grid-template-columns: 1fr; }
    .wa-side-column { position: static; display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
    .wa-stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
    .whatsapp-hero { flex-direction: column; align-items: flex-start; }
    .whatsapp-hero__status { width: 100%; min-width: 0; }
    .wa-stats-grid { grid-template-columns: 1fr 1fr; }
    .wa-form-grid { grid-template-columns: 1fr; }
    .wa-schedule-row { grid-template-columns: 1fr; align-items: stretch; }
    .wa-schedule-mode { justify-self: start; }
    .wa-rule-card__top { flex-direction: column; }
    .wa-rule-actions { justify-content: flex-start; }
    .wa-side-column { grid-template-columns: 1fr; }
    .wa-modal__grid { grid-template-columns: 1fr; }
    .wa-span-2 { grid-column: auto; }
    .wa-check-field { padding-top: 0; }
}

@media (max-width: 520px) {
    .wa-stats-grid { grid-template-columns: 1fr; }
    .wa-schedule-hours { flex-wrap: wrap; }
    .wa-schedule-hours label { min-width: 120px; }
    .wa-form-actions { align-items: stretch; flex-direction: column; }
    .wa-form-actions .btn-primary { width: 100%; }
}
