/* ═══════════════════════════════════════════════════════
   AICA Gifts — WhatsApp-Style Dashboard
   ═══════════════════════════════════════════════════════ */

/* ─── Variables ─────────────────────────────────────── */
:root {
    --wa-teal: #075E54;
    --wa-teal-dark: #054C44;
    --wa-teal-light: #128C7E;
    --wa-green: #25D366;
    --wa-green-light: #DCF8C6;
    --wa-blue-tick: #53BDEB;
    --wa-chat-bg: #ECE5DD;
    --wa-chat-pattern: #d9d2c5;
    --wa-white: #ffffff;
    --wa-light: #f0f2f5;
    --wa-border: #e1e1e1;
    --wa-text: #111b21;
    --wa-text-secondary: #667781;
    --wa-text-muted: #8696a0;
    --wa-bubble-in: #ffffff;
    --wa-bubble-out: #d9fdd3;
    --wa-danger: #ea4335;
    --wa-warning: #f59e0b;
    --wa-info: #34B7F1;
    --wa-icon-bar-w: 64px;
    --wa-list-w: 380px;
    --wa-header-h: 60px;
    --wa-bottom-h: 60px;
    --wa-radius: 8px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ─── Reset ─────────────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    height: 100%;
    font-family: var(--font);
    font-size: 14px;
    color: var(--wa-text);
    background: var(--wa-light);
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: var(--font);
    font-size: inherit;
    color: inherit;
}

input,
select {
    font-family: var(--font);
    font-size: inherit;
}

.mono {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.9em;
}

.text-muted {
    color: var(--wa-text-muted);
}

/* ─── App Layout ────────────────────────────────────── */
.wa-app {
    display: grid;
    grid-template-columns: var(--wa-icon-bar-w) 1fr;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* ─── Icon Sidebar (Desktop) ───────────────────────── */
.wa-icon-bar {
    background: var(--wa-teal-dark);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    z-index: 100;
}

.icon-bar-top,
.icon-bar-bottom {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    width: 100%;
}

.icon-bar-brand {
    width: 42px;
    height: 42px;
    background: var(--wa-green);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    margin-bottom: 1.25rem;
}

.icon-bar-item {
    width: 52px;
    height: 52px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.55);
    transition: all 0.2s;
    position: relative;
    gap: 2px;
}

.icon-bar-item i {
    font-size: 1.15rem;
}

.icon-label {
    font-size: 0.55rem;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.icon-bar-item:hover {
    color: rgba(255, 255, 255, 0.85);
    background: rgba(255, 255, 255, 0.08);
}

.icon-bar-item.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.15);
}

.icon-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: var(--wa-green);
    color: white;
    font-size: 0.6rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* ─── Main Area ─────────────────────────────────────── */
.wa-main {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    background: var(--wa-light);
}

/* ─── Bottom Tabs (Mobile) ──────────────────────────── */
.wa-bottom-tabs {
    display: none;
}

/* ─── Flash Messages ────────────────────────────────── */
.wa-flash-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 400px;
}

.wa-flash {
    padding: 12px 16px;
    border-radius: var(--wa-radius);
    background: var(--wa-white);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    display: flex;
    align-items: center;
    justify-content: space-between;
    animation: slideIn 0.3s ease;
    font-size: 0.875rem;
}

.wa-flash-success {
    border-left: 4px solid var(--wa-green);
}

.wa-flash-danger {
    border-left: 4px solid var(--wa-danger);
}

.wa-flash-warning {
    border-left: 4px solid var(--wa-warning);
}

.wa-flash-info {
    border-left: 4px solid var(--wa-info);
}

.wa-flash-close {
    font-size: 1.2rem;
    opacity: 0.5;
    margin-left: 12px;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ─── Page Layout ───────────────────────────────────── */
.wa-page {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.wa-header {
    background: var(--wa-teal);
    color: white;
    padding: 0 1.25rem;
    height: var(--wa-header-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.wa-header-title {
    font-size: 1.15rem;
    font-weight: 600;
}

.wa-header-subtitle {
    font-size: 0.8rem;
    opacity: 0.8;
    margin-left: 12px;
}

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

.wa-header-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: white;
    transition: background 0.2s;
}

.wa-header-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.wa-page-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
    background: var(--wa-light);
}

/* ─── Split Panel Layout ────────────────────────────── */
.wa-split-layout {
    display: grid;
    grid-template-columns: var(--wa-list-w) 1fr;
    height: 100%;
    overflow: hidden;
}

/* List Panel */
.wa-list-panel {
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--wa-border);
    background: var(--wa-white);
    overflow: hidden;
    height: 100%;
}

/* Detail Panel */
.wa-detail-panel {
    display: flex;
    flex-direction: column;
    background: var(--wa-chat-bg);
    overflow: hidden;
    height: 100%;
}

.wa-detail-panel:not(.has-content) {
    background: var(--wa-light);
}

/* ─── Search Bar ────────────────────────────────────── */
.wa-search-bar {
    padding: 8px 12px;
    background: var(--wa-white);
    border-bottom: 1px solid var(--wa-border);
}

.wa-search-input {
    display: flex;
    align-items: center;
    background: var(--wa-light);
    border-radius: 8px;
    padding: 0 12px;
    height: 36px;
}

.wa-search-input i {
    color: var(--wa-text-muted);
    font-size: 0.85rem;
    margin-right: 8px;
}

.wa-search-input input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    height: 100%;
    color: var(--wa-text);
}

/* ─── Filter Row ────────────────────────────────────── */
.wa-filter-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--wa-border);
    overflow-x: auto;
    flex-shrink: 0;
}

.wa-filter-chip {
    padding: 5px 12px;
    border-radius: 16px;
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--wa-light);
    color: var(--wa-text-secondary);
    white-space: nowrap;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.wa-filter-chip:hover {
    background: #e2e8ed;
}

.wa-filter-chip.active {
    background: var(--wa-teal);
    color: white;
}

.wa-status-select {
    padding: 5px 8px;
    border-radius: 16px;
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--wa-light);
    color: var(--wa-text-secondary);
    border: 1px solid var(--wa-border);
    outline: none;
    margin-left: auto;
}

/* ─── Contact List ──────────────────────────────────── */
.wa-contact-list {
    flex: 1;
    overflow-y: auto;
}

.wa-contact-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.15s;
    cursor: pointer;
}

.wa-contact-item:hover {
    background: #f5f6f6;
}

.wa-contact-item.active {
    background: #f0f2f5;
}

/* Avatar */
.wa-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 1rem;
    flex-shrink: 0;
    letter-spacing: 0.02em;
}

.wa-avatar.small {
    width: 40px;
    height: 40px;
    font-size: 0.85rem;
}

.wa-contact-body {
    flex: 1;
    min-width: 0;
    margin-left: 12px;
}

.wa-contact-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 2px;
}

.wa-contact-name {
    font-weight: 500;
    font-size: 0.95rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wa-contact-time {
    font-size: 0.7rem;
    color: var(--wa-text-muted);
    flex-shrink: 0;
    margin-left: 8px;
}

.wa-contact-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.wa-contact-preview {
    font-size: 0.8rem;
    color: var(--wa-text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    display: flex;
    align-items: center;
    gap: 4px;
}

.wa-contact-badge {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--wa-teal);
    flex-shrink: 0;
    margin-left: 8px;
}

.wa-unread-badge {
    background: var(--wa-green);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    flex-shrink: 0;
    margin-left: 8px;
}

/* Status Dots */
.wa-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.wa-status-dot.status-inforeceived {
    background: var(--wa-warning);
}

.wa-status-dot.status-intransit {
    background: var(--wa-info);
}

.wa-status-dot.status-delivered {
    background: var(--wa-green);
}

.wa-status-dot.status-delayed {
    background: var(--wa-danger);
}

.wa-status-dot.status-refund-initiated {
    background: #9C27B0;
}

.wa-status-dot.status-pending,
.wa-status-dot.status-pickup_schedule {
    background: #bbb;
}

.wa-status-dot.status-unknown {
    background: #ccc;
}

/* ─── Detail Header ─────────────────────────────────── */
.wa-detail-header {
    background: var(--wa-teal);
    color: white;
    padding: 0 1rem;
    height: var(--wa-header-h);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.wa-back-btn {
    width: 36px;
    height: 36px;
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: white;
}

.wa-back-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.wa-detail-header-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.wa-detail-name {
    font-weight: 600;
    font-size: 1rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wa-detail-sub {
    font-size: 0.75rem;
    opacity: 0.8;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wa-detail-header-actions {
    display: flex;
    gap: 4px;
}

/* ─── Detail Body ───────────────────────────────────── */
.wa-detail-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.wa-detail-full-body {
    background: var(--wa-light);
    padding-bottom: 2rem;
}

/* Empty States */
.wa-empty-state,
.wa-empty-detail {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    height: 100%;
    color: var(--wa-text-muted);
    text-align: center;
}

.wa-empty-state i,
.wa-empty-detail i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}

.wa-empty-detail h2 {
    font-size: 1.4rem;
    color: var(--wa-text);
    margin-bottom: 0.5rem;
}

.wa-chat-empty-icon {
    width: 100px;
    height: 100px;
    background: var(--wa-teal);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.wa-chat-empty-icon i {
    font-size: 2.5rem;
    color: white;
    opacity: 1;
}

/* ─── Info Cards ────────────────────────────────────── */
.wa-info-section {
    margin-bottom: 0.75rem;
}

.wa-info-card {
    background: var(--wa-white);
    border-radius: var(--wa-radius);
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.wa-info-header {
    padding: 12px 16px;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--wa-teal);
    border-bottom: 1px solid var(--wa-border);
    display: flex;
    align-items: center;
    gap: 8px;
}

.wa-info-row {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid #f5f5f5;
}

.wa-info-row:last-child {
    border-bottom: none;
}

.wa-info-icon {
    width: 32px;
    color: var(--wa-text-muted);
    flex-shrink: 0;
}

.wa-info-content {
    flex: 1;
    min-width: 0;
}

.wa-info-label {
    display: block;
    font-size: 0.7rem;
    color: var(--wa-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 1px;
}

.wa-info-value {
    display: block;
    font-size: 0.88rem;
    color: var(--wa-text);
    word-break: break-word;
}

.wa-address-block {
    padding: 12px 16px;
    font-size: 0.88rem;
    line-height: 1.5;
    color: var(--wa-text);
}

.wa-parcel-text {
    padding: 12px 16px;
    font-size: 0.88rem;
    color: var(--wa-text);
    line-height: 1.5;
}

/* Parcel contents truncation in table */
.parcel-cell {
    max-width: 30vw;
}

.parcel-text {
    font-size: 0.82rem;
    line-height: 1.4;
    word-break: break-word;
    /*
    Source - https://stackoverflow.com/a/32817857
    Posted by Pankaj Verma, modified by community. See post 'Timeline' for change history
    Retrieved 2026-03-08, License - CC BY-SA 3.0
    */
    white-space: initial;
}

.parcel-text.truncated {
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.parcel-toggle {
    display: inline-block;
    font-size: 0.75rem;
    color: var(--wa-teal);
    font-weight: 600;
    margin-top: 2px;
    cursor: pointer;
    text-decoration: none;
}

.parcel-toggle:hover {
    text-decoration: underline;
}

/* ─── Actions Row ───────────────────────────────────── */
.wa-actions-row {
    display: flex;
    gap: 8px;
    padding: 0.75rem 0;
    flex-wrap: wrap;
}

.wa-actions-row.full {
    padding: 0.75rem;
}

.inline-form {
    display: inline;
}

.wa-action-btn {
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    border: 1px solid var(--wa-border);
    background: var(--wa-white);
}

.wa-action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.wa-action-btn.info {
    color: var(--wa-info);
    border-color: var(--wa-info);
}

.wa-action-btn.warn {
    color: var(--wa-warning);
    border-color: var(--wa-warning);
}

.wa-action-btn.danger {
    color: var(--wa-danger);
    border-color: var(--wa-danger);
}

/* ─── History Items ─────────────────────────────────── */
.wa-timeline {
    padding: 0;
}

.wa-history-section {
    margin-top: 0.75rem;
}

.wa-section-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--wa-teal);
    margin-bottom: 8px;
}

.wa-history-item {
    display: flex;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid #f5f5f5;
}

.wa-history-item:last-child {
    border-bottom: none;
}

.wa-history-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-top: 4px;
    flex-shrink: 0;
    background: var(--wa-text-muted);
}

.wa-history-dot.status-delayed {
    background: var(--wa-danger);
}

.wa-history-dot.status-delivered {
    background: var(--wa-green);
}

.wa-history-dot.status-intransit {
    background: var(--wa-info);
}

.wa-history-dot.status-info-requested {
    background: var(--wa-info);
}

.wa-history-dot.status-refund-initiated {
    background: #9C27B0;
}

.wa-history-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.wa-history-status {
    font-weight: 600;
    font-size: 0.82rem;
}

.wa-history-msg {
    font-size: 0.8rem;
    color: var(--wa-text-secondary);
    line-height: 1.4;
}

.wa-history-time {
    font-size: 0.7rem;
    color: var(--wa-text-muted);
}

/* ─── Status Badges ─────────────────────────────────── */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.status-badge.status-delivered {
    background: #d4edda;
    color: #155724;
}

.status-badge.status-transit {
    background: #cce5ff;
    color: #004085;
}

.status-badge.status-warning {
    background: #fff3cd;
    color: #856404;
}

.status-badge.status-danger {
    background: #f8d7da;
    color: #721c24;
}

.status-badge.status-returned {
    background: #e8daef;
    color: #6c3483;
}

.status-badge.status-neutral {
    background: #e9ecef;
    color: #495057;
}

/* ─── Chat Area (Inbox) ─────────────────────────────── */
.wa-chat-panel {
    background: var(--wa-chat-bg);
}

.wa-chat-header {
    background: var(--wa-teal);
}

.wa-chat-body {
    flex: 1;
    overflow-y: auto;
    position: relative;
}

.wa-chat-bg {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    min-height: 100%;
    gap: 4px;
    background-image: url("data:image/svg+xml,%3Csvg width='80' height='80' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 0h80v80H0z' fill='%23ECE5DD'/%3E%3Cpath d='M20 20h2v2h-2zm20 0h2v2h-2zm20 0h2v2h-2zm-30 20h2v2h-2zm20 0h2v2h-2zm20 0h2v2h-2zm-50 20h2v2h-2zm20 0h2v2h-2zm20 0h2v2h-2z' fill='%23d4cdc4' opacity='.3'/%3E%3C/svg%3E");
}

/* Message Bubbles */
.wa-msg {
    display: flex;
    max-width: 75%;
    animation: msgFade 0.25s ease;
}

.wa-msg-new {
    animation: msgSlide 0.3s ease;
}

@keyframes msgFade {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes msgSlide {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.wa-msg-in {
    align-self: flex-start;
}

.wa-msg-out {
    align-self: flex-end;
}

.wa-msg-bubble {
    padding: 6px 10px 6px 10px;
    border-radius: 8px;
    position: relative;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.06);
    word-break: break-word;
}

.wa-msg-in .wa-msg-bubble {
    background: var(--wa-bubble-in);
    border-top-left-radius: 0;
}

.wa-msg-out .wa-msg-bubble {
    background: var(--wa-bubble-out);
    border-top-right-radius: 0;
}

.wa-msg-alert .wa-msg-bubble {
    background: #fff3cd;
    border-left: 3px solid var(--wa-warning);
}

.wa-msg-type {
    display: block;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--wa-teal);
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.wa-msg-alert .wa-msg-type {
    color: var(--wa-warning);
}

.wa-msg-text {
    font-size: 0.88rem;
    line-height: 1.4;
    display: inline;
    white-space: pre-wrap;
    word-break: break-word;
}

.wa-msg-time {
    float: right;
    font-size: 0.65rem;
    color: var(--wa-text-muted);
    margin-left: 8px;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
}

.wa-read-icon {
    color: var(--wa-text-muted);
    font-size: 0.7rem;
}

.wa-read {
    color: var(--wa-blue-tick) !important;
}

.fa-check-double.wa-read {
    color: var(--wa-blue-tick);
}

/* Delivery Status Ticks */
.wa-tick-pending {
    color: var(--wa-text-muted);
}

.wa-tick-sent {
    color: var(--wa-text-muted);
}

.wa-tick-delivered {
    color: var(--wa-text-muted);
}

.wa-tick-read {
    color: var(--wa-blue-tick);
}

.wa-tick-failed {
    color: var(--wa-danger);
}

/* Reaction Badge */
.wa-reaction-badge {
    position: absolute;
    bottom: -10px;
    right: 8px;
    background: var(--wa-white);
    border-radius: 12px;
    padding: 1px 6px;
    font-size: 0.85rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    z-index: 2;
}

.wa-msg-bubble {
    position: relative;
}

/* Reaction Picker */
.wa-reaction-picker {
    display: none;
    position: absolute;
    top: -36px;
    right: 0;
    background: var(--wa-white);
    border-radius: 20px;
    padding: 4px 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
    gap: 2px;
    z-index: 10;
}

.wa-reaction-picker.show {
    display: flex;
}

.wa-reaction-picker button {
    background: none;
    border: none;
    font-size: 1.2rem;
    padding: 2px;
    cursor: pointer;
    transition: transform 0.15s;
}

.wa-reaction-picker button:hover {
    transform: scale(1.3);
}

/* Document Card */
.wa-doc-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 6px;
    margin-bottom: 4px;
    cursor: pointer;
}

.wa-doc-icon {
    width: 40px;
    height: 40px;
    background: var(--wa-teal);
    color: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.wa-doc-info {
    flex: 1;
    min-width: 0;
}

.wa-doc-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--wa-text);
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wa-doc-size {
    font-size: 0.7rem;
    color: var(--wa-text-muted);
}

.wa-doc-download {
    color: var(--wa-teal);
    font-size: 1.1rem;
    flex-shrink: 0;
}

/* Media Download Overlay */
.wa-media-wrap {
    position: relative;
    cursor: pointer;
}

.wa-download-overlay {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 28px;
    height: 28px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
    font-size: 0.8rem;
    z-index: 2;
}

.wa-media-wrap:hover .wa-download-overlay {
    opacity: 1;
}

/* Unread Divider */
.wa-unread-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 8px 0;
    color: var(--wa-teal);
    font-size: 0.75rem;
    font-weight: 600;
}

.wa-unread-divider::before,
.wa-unread-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--wa-teal);
    opacity: 0.3;
}

/* Reply action button */
.wa-reply-action,
.wa-react-action {
    position: absolute;
    top: 4px;
    opacity: 0;
    transition: opacity 0.15s;
    background: none;
    border: none;
    color: var(--wa-text-muted);
    cursor: pointer;
    font-size: 0.8rem;
    padding: 2px 6px;
}

.wa-reply-action {
    right: 4px;
}

.wa-react-action {
    right: 28px;
}

.wa-msg-bubble:hover .wa-reply-action,
.wa-msg-bubble:hover .wa-react-action {
    opacity: 1;
}

/* Chat Input */
.wa-chat-input {
    padding: 8px 12px;
    background: var(--wa-light);
    border-top: 1px solid var(--wa-border);
    flex-shrink: 0;
}

.wa-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.wa-input-wrapper textarea,
.wa-input-wrapper input {
    flex: 1;
    padding: 10px 16px;
    border: none;
    border-radius: 18px;
    background: var(--wa-white);
    outline: none;
    font-size: 0.9rem;
    color: var(--wa-text);
    resize: none;
    max-height: 120px;
    min-height: 42px;
    line-height: 1.4;
    font-family: inherit;
}

.wa-send-btn {
    width: 44px;
    height: 44px;
    background: var(--wa-teal);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all 0.2s;
    flex-shrink: 0;
}

.wa-send-btn:hover {
    background: var(--wa-teal-light);
    transform: scale(1.05);
}

/* ─── Metrics Grid ──────────────────────────────────── */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}

.metrics-secondary {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.metric-card {
    background: var(--wa-white);
    border-radius: var(--wa-radius);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    transition: transform 0.2s, box-shadow 0.2s;
    border-left: 4px solid transparent;
}

.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.metric-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    flex-shrink: 0;
}

.metric-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.metric-value {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
}

.metric-label {
    font-size: 0.72rem;
    color: var(--wa-text-muted);
    font-weight: 500;
}

/* Metric Colors */
.metric-purple {
    border-left-color: #7c3aed;
}

.metric-purple .metric-icon {
    background: #ede9fe;
    color: #7c3aed;
}

.metric-amber {
    border-left-color: #f59e0b;
}

.metric-amber .metric-icon {
    background: #fef3c7;
    color: #f59e0b;
}

.metric-blue {
    border-left-color: var(--wa-info);
}

.metric-blue .metric-icon {
    background: #e0f2fe;
    color: var(--wa-info);
}

.metric-green {
    border-left-color: var(--wa-green);
}

.metric-green .metric-icon {
    background: #dcfce7;
    color: #16a34a;
}

.metric-teal {
    border-left-color: var(--wa-teal);
}

.metric-teal .metric-icon {
    background: #ccfbf1;
    color: var(--wa-teal);
}

.metric-orange {
    border-left-color: #ea580c;
}

.metric-orange .metric-icon {
    background: #fff7ed;
    color: #ea580c;
}

.metric-lime {
    border-left-color: #84cc16;
}

.metric-lime .metric-icon {
    background: #f7fee7;
    color: #4d7c0f;
}

/* ─── Quick Actions ─────────────────────────────────── */
.quick-actions-section {
    margin-top: 0.75rem;
}

.section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--wa-text);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title i {
    color: var(--wa-teal);
}

.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 10px;
}

.quick-action-card {
    background: var(--wa-white);
    border-radius: var(--wa-radius);
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    transition: all 0.2s;
    color: var(--wa-text);
    text-align: center;
    font-size: 0.85rem;
    font-weight: 500;
}

.quick-action-card i {
    font-size: 1.5rem;
    color: var(--wa-teal);
}

.quick-action-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    background: var(--wa-teal);
    color: white;
}

.quick-action-card:hover i {
    color: white;
}

/* ─── Pagination ────────────────────────────────────── */
.wa-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px;
}

.wa-page-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--wa-teal);
    color: white;
    font-size: 0.8rem;
    transition: background 0.2s;
}

.wa-page-btn:hover {
    background: var(--wa-teal-light);
}

.wa-page-info {
    font-size: 0.8rem;
    color: var(--wa-text-muted);
    font-weight: 500;
}

/* ─── Modal ─────────────────────────────────────────── */
.wa-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 1rem;
}

.wa-modal-overlay.show {
    display: flex;
}

.wa-modal {
    background: var(--wa-white);
    border-radius: 12px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
    animation: modalPop 0.25s ease;
}

@keyframes modalPop {
    from {
        transform: scale(0.9);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

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

.wa-modal-header h3 {
    font-size: 1.05rem;
    font-weight: 600;
}

.wa-modal-close {
    font-size: 1.5rem;
    opacity: 0.5;
}

.wa-modal-body {
    padding: 20px;
}

.wa-modal-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--wa-border);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* File Upload */
.file-upload-zone {
    border: 2px dashed var(--wa-border);
    border-radius: var(--wa-radius);
    padding: 2rem;
    text-align: center;
    transition: all 0.2s;
    color: var(--wa-text-muted);
}

.file-upload-zone i {
    font-size: 2rem;
    margin-bottom: 8px;
    display: block;
}

.file-upload-zone.dragover {
    border-color: var(--wa-teal);
    background: #f0f9f8;
}

.file-upload-zone input[type="file"] {
    display: none;
}

.file-label {
    color: var(--wa-teal);
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
}

.file-name {
    display: block;
    margin-top: 8px;
    font-size: 0.85rem;
    color: var(--wa-teal);
    font-weight: 500;
}

/* Buttons */
.btn-submit {
    padding: 8px 20px;
    background: var(--wa-teal);
    color: white;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.88rem;
    transition: background 0.2s;
}

.btn-submit:hover {
    background: var(--wa-teal-light);
}

.btn-cancel {
    padding: 8px 20px;
    color: var(--wa-text-secondary);
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.88rem;
}

.btn-cancel:hover {
    background: var(--wa-light);
}

/* ─── Login Page ────────────────────────────────────── */
.login-body {
    background: linear-gradient(135deg, var(--wa-teal-dark) 0%, var(--wa-teal) 50%, var(--wa-teal-light) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    overflow: auto;
}

.login-wrapper {
    width: 100%;
    max-width: 380px;
    padding: 1rem;
}

.login-card {
    background: var(--wa-white);
    border-radius: 16px;
    padding: 2.5rem 2rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    width: 64px;
    height: 64px;
    background: var(--wa-teal);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    color: white;
    font-size: 1.6rem;
}

.login-header h1 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--wa-teal-dark);
    letter-spacing: 0.08em;
}

.login-header p {
    font-size: 0.8rem;
    color: var(--wa-text-muted);
    margin-top: 4px;
}

.login-flash {
    margin-bottom: 1rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.input-group {
    display: flex;
    align-items: center;
    background: var(--wa-light);
    border-radius: 10px;
    padding: 0 14px;
    height: 48px;
    border: 2px solid transparent;
    transition: border-color 0.2s;
}

.input-group:focus-within {
    border-color: var(--wa-teal);
}

.input-group i {
    color: var(--wa-text-muted);
    width: 20px;
    text-align: center;
}

.input-group input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    height: 100%;
    margin-left: 10px;
    font-size: 0.92rem;
    color: var(--wa-text);
}

.login-btn {
    height: 48px;
    background: var(--wa-teal);
    color: white;
    border-radius: 10px;
    font-weight: 600;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
    transition: background 0.2s, transform 0.1s;
}

.login-btn:hover {
    background: var(--wa-teal-light);
}

.login-btn:active {
    transform: scale(0.98);
}

.login-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.75rem;
    color: var(--wa-text-muted);
}

/* ═══════════════════════════════════════════════════════
   RESPONSIVE — Mobile (<768px)
   ═══════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    :root {
        --wa-header-h: 56px;
    }

    /* Hide icon sidebar, show bottom tabs */
    .wa-icon-bar {
        display: none;
    }

    .wa-app {
        grid-template-columns: 1fr;
    }

    .wa-bottom-tabs {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: var(--wa-bottom-h);
        background: var(--wa-white);
        border-top: 1px solid var(--wa-border);
        z-index: 200;
        justify-content: space-around;
        align-items: center;
        padding-bottom: env(safe-area-inset-bottom, 0);
    }

    .tab-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        color: var(--wa-text-muted);
        font-size: 0.65rem;
        font-weight: 500;
        flex: 1;
        padding: 6px 0;
    }

    .tab-item i {
        font-size: 1.15rem;
    }

    .tab-item.active {
        color: var(--wa-teal);
    }

    .wa-main {
        height: calc(100vh - var(--wa-bottom-h));
        padding-bottom: 0;
    }

    /* Split layout: show one panel at a time */
    .wa-split-layout {
        grid-template-columns: 1fr;
        position: relative;
    }

    .wa-list-panel {
        height: calc(100vh - var(--wa-bottom-h));
    }

    .wa-detail-panel {
        position: absolute;
        inset: 0;
        z-index: 50;
        transform: translateX(100%);
        transition: transform 0.3s ease;
        height: calc(100vh - var(--wa-bottom-h));
    }

    .wa-detail-panel.has-content {
        transform: translateX(0);
    }

    .wa-back-btn {
        display: flex;
    }

    /* Page body padding for bottom tabs */
    .wa-page-body {
        padding-bottom: calc(var(--wa-bottom-h) + 1rem);
    }

    .wa-page {
        height: calc(100vh - var(--wa-bottom-h));
    }

    /* Detail full page */
    .wa-detail-full {
        height: calc(100vh - var(--wa-bottom-h));
    }

    .wa-msg {
        max-width: 85%;
    }

    .metric-value {
        font-size: 1.25rem;
    }

    .wa-chat-input {
        padding-bottom: calc(8px + env(safe-area-inset-bottom, 0));
    }
}

/* ─── Tablet (768–1024) ─────────────────────────────── */
@media (min-width: 769px) and (max-width: 1024px) {
    :root {
        --wa-list-w: 300px;
    }
}

/* ─── View Toggle ───────────────────────────────────── */
.wa-view-toggle {
    display: flex;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    overflow: hidden;
    margin-right: 4px;
}

.wa-toggle-btn {
    width: 36px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.85rem;
    transition: all 0.2s;
}

.wa-toggle-btn.active {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.wa-toggle-btn:hover {
    color: rgba(255, 255, 255, 0.85);
}

/* ─── Table View ────────────────────────────────────── */
.shipment-table-view {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.table-wrapper {
    flex: 1;
    overflow: auto;
}

.shipment-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.82rem;
}

.shipment-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.shipment-table th {
    background: var(--wa-teal-dark);
    color: white;
    padding: 10px 14px;
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
    text-align: left;
    border-bottom: 2px solid var(--wa-teal);
}

.shipment-table th:first-child {
    padding-left: 20px;
}

.shipment-table td {
    padding: 10px 14px;
    border-bottom: 1px solid #f0f0f0;
    color: var(--wa-text);
    white-space: nowrap;
    vertical-align: middle;
}

.shipment-table td:first-child {
    padding-left: 20px;
}

.shipment-row {
    cursor: pointer;
    transition: background 0.15s;
}

.shipment-row:hover {
    background: #f5f8f5;
}

.shipment-row:nth-child(even) {
    background: #fafbfa;
}

.shipment-row:nth-child(even):hover {
    background: #f0f4f0;
}

.shipment-id-cell {
    font-weight: 600;
    color: var(--wa-teal);
}

.customer-cell {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wa-avatar.mini {
    width: 28px;
    height: 28px;
    font-size: 0.6rem;
    flex-shrink: 0;
}

.table-actions {
    display: flex;
    gap: 4px;
    align-items: center;
}

.tbl-action-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    border: 1px solid var(--wa-border);
    background: var(--wa-white);
    color: var(--wa-text-muted);
    transition: all 0.2s;
}

.tbl-action-btn:hover {
    background: var(--wa-teal);
    color: white;
    border-color: var(--wa-teal);
}

.tbl-action-btn.warn:hover {
    background: var(--wa-warning);
    border-color: var(--wa-warning);
}

.tbl-action-btn.danger:hover {
    background: var(--wa-danger);
    border-color: var(--wa-danger);
}

/* ─── List View Inner Split ─────────────────────────── */
.shipment-list-view {
    flex: 1;
    overflow: hidden;
}

.wa-split-inner {
    height: 100%;
}

.wa-split-inner .wa-list-panel {
    border-right: 1px solid var(--wa-border);
}

/* ─── Scrollbar ─────────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}

/* ─── WhatsApp Connection Banner ────────────────────── */
.wa-connection-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    font-size: 0.78rem;
    font-weight: 500;
    flex-shrink: 0;
}

.wa-connection-banner.connected {
    background: #dcfce7;
    color: #166534;
}

.wa-connection-banner.disconnected {
    background: #fef3c7;
    color: #92400e;
}

.wa-conn-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wa-conn-indicator i {
    font-size: 1rem;
}

.wa-conn-btn {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 600;
    background: rgba(0, 0, 0, 0.08);
    transition: background 0.2s;
}

.wa-conn-btn:hover {
    background: rgba(0, 0, 0, 0.15);
}

/* ─── WhatsApp Settings Modal ───────────────────────── */
.wa-settings-status {
    margin-bottom: 16px;
}

.wa-conn-status-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-radius: var(--wa-radius);
    border: 1px solid var(--wa-border);
}

.wa-conn-status-card.connected {
    background: #f0fdf4;
    border-color: #86efac;
}

.wa-conn-status-card.disconnected {
    background: #fffbeb;
    border-color: #fcd34d;
}

.wa-conn-status-icon {
    font-size: 1.5rem;
}

.wa-conn-status-card.connected .wa-conn-status-icon {
    color: #16a34a;
}

.wa-conn-status-card.disconnected .wa-conn-status-icon {
    color: #d97706;
}

.wa-conn-status-info {
    display: flex;
    flex-direction: column;
}

.wa-conn-status-info strong {
    font-size: 0.95rem;
}

.wa-conn-status-info span {
    font-size: 0.78rem;
    color: var(--wa-text-muted);
}

.wa-settings-note {
    font-size: 0.8rem;
    color: var(--wa-text-secondary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.wa-env-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.wa-env-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--wa-light);
    border-radius: 6px;
}

.wa-env-item code {
    font-size: 0.75rem;
    font-family: 'SF Mono', 'Fira Code', monospace;
    color: var(--wa-teal);
}

.wa-env-status {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--wa-danger);
}

.wa-env-status.set {
    color: var(--wa-green);
}

.wa-webhook-info {
    margin-top: 8px;
}

.wa-webhook-info h4 {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.wa-webhook-url {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--wa-light);
    border-radius: 6px;
    border: 1px solid var(--wa-border);
}

.wa-webhook-url code {
    flex: 1;
    font-size: 0.78rem;
    font-family: 'SF Mono', 'Fira Code', monospace;
    color: var(--wa-text);
    word-break: break-all;
}

.wa-copy-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--wa-teal);
    color: white;
    font-size: 0.75rem;
    flex-shrink: 0;
    transition: background 0.2s;
}

.wa-copy-btn:hover {
    background: var(--wa-teal-light);
}

/* ─── WhatsApp Chat Elements ────────────────────────── */
.wa-whatsapp-btn {
    color: #25D366 !important;
}

.wa-msg-type-wa {
    color: #25D366 !important;
}

.wa-msg-customer .wa-msg-bubble {
    border-left: 3px solid #25D366;
}

.wa-chat-info-banner {
    background: #fef9c3;
    color: #854d0e;
    font-size: 0.72rem;
    text-align: center;
    padding: 6px 16px;
    border-radius: 6px;
    margin: 0 auto 12px;
    max-width: 380px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.wa-chat-info-banner i {
    font-size: 0.6rem;
}

/* Quick Action Panel */
.wa-input-actions {
    flex-shrink: 0;
}

.wa-attach-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--wa-text-muted);
    font-size: 1rem;
    transition: all 0.2s;
}

.wa-attach-btn:hover {
    color: var(--wa-teal);
    background: rgba(0, 0, 0, 0.05);
}

.wa-quick-panel {
    display: flex;
    gap: 12px;
    padding: 10px 12px 4px;
    animation: quickSlide 0.25s ease;
}

@keyframes quickSlide {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.wa-quick-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 0.68rem;
    color: var(--wa-text-secondary);
    transition: color 0.2s;
}

.wa-quick-item:hover {
    color: var(--wa-text);
}

.wa-quick-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.1rem;
    transition: transform 0.2s;
}

.wa-quick-item:hover .wa-quick-icon {
    transform: scale(1.08);
}

/* Empty State Features */
.wa-empty-features {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 1.5rem;
}

.wa-feature-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    color: var(--wa-text-secondary);
}

.wa-feature-item i {
    color: var(--wa-teal);
    width: 20px;
    text-align: center;
    font-size: 0.9rem;
    opacity: 1;
}

/* ─── Large Modal Variant ───────────────────────────── */
.wa-modal-lg {
    max-width: 640px;
}

.wa-modal-detail-body {
    padding: 16px 20px;
    max-height: 65vh;
    overflow-y: auto;
}

/* ─── Shipment Detail Modal ─────────────────────────── */
.shipment-modal-status {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--wa-border);
}

.shipment-modal-id {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--wa-text);
}

.shipment-modal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 16px;
}

.shipment-modal-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    background: var(--wa-light);
    border-radius: 8px;
    border: 1px solid #f0f0f0;
}

.shipment-modal-card.full-width {
    grid-column: 1 / -1;
}

.smc-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: rgba(7, 94, 84, 0.08);
    color: var(--wa-teal);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    flex-shrink: 0;
    margin-top: 1px;
}

.smc-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.smc-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--wa-text-muted);
    font-weight: 600;
}

.smc-value {
    font-size: 0.82rem;
    color: var(--wa-text);
    word-break: break-word;
}

/* Timeline in modal */
.shipment-modal-history {
    border-top: 1px solid var(--wa-border);
    padding-top: 12px;
}

.shipment-modal-history h4 {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--wa-text-secondary);
    margin-bottom: 10px;
}

.smo-timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding-left: 12px;
    border-left: 2px solid var(--wa-border);
}

.smo-timeline-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 6px 0;
    position: relative;
}

.smo-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--wa-teal);
    flex-shrink: 0;
    margin-top: 3px;
    margin-left: -17px;
    border: 2px solid var(--wa-white);
}

.smo-dot.status-inforeceived {
    background: var(--wa-warning);
}

.smo-dot.status-intransit {
    background: var(--wa-info);
}

.smo-dot.status-delivered {
    background: var(--wa-green);
}

.smo-dot.status-delayed {
    background: var(--wa-danger);
}

.smo-dot.status-refund-initiated {
    background: #9C27B0;
}

.smo-timeline-content {
    display: flex;
    flex-direction: column;
}

.smo-status {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--wa-text);
}

.smo-msg {
    font-size: 0.72rem;
    color: var(--wa-text-secondary);
}

.smo-time {
    font-size: 0.65rem;
    color: var(--wa-text-muted);
    margin-top: 2px;
}

/* Modal footer actions */
.shipment-modal-actions {
    display: flex;
    gap: 8px;
    flex: 1;
}

@media (max-width: 768px) {
    .wa-modal-lg {
        max-width: 95%;
    }

    .shipment-modal-grid {
        grid-template-columns: 1fr;
    }

    .shipment-modal-card.full-width {
        grid-column: 1;
    }
}

/* ═══════════════════════════════════════════════════ */
/* ─── Rich Messaging Styles ─────────────────────── */
/* ═══════════════════════════════════════════════════ */

/* Reply Quote inside message bubble */
.wa-reply-quote {
    background: rgba(0, 0, 0, 0.04);
    border-left: 3px solid var(--wa-teal);
    border-radius: 4px;
    padding: 4px 8px;
    margin-bottom: 4px;
    cursor: pointer;
    max-width: 100%;
    overflow: hidden;
}

.wa-msg-out .wa-reply-quote {
    background: rgba(0, 0, 0, 0.04);
    border-left-color: #075e54;
}

.wa-reply-sender {
    display: block;
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--wa-teal);
    text-transform: capitalize;
}

.wa-reply-text {
    display: block;
    font-size: 0.72rem;
    color: var(--wa-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Reply action button (shows on hover) */
.wa-reply-action {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(0, 0, 0, 0.05);
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--wa-text-muted);
    font-size: 0.65rem;
    transition: all 0.15s;
}

.wa-msg-bubble {
    position: relative;
}

.wa-msg:hover .wa-reply-action {
    display: flex;
}

.wa-reply-action:hover {
    background: rgba(0, 0, 0, 0.12);
    color: var(--wa-teal);
}

/* Reply bar above input */
.wa-reply-bar {
    display: flex;
    align-items: center;
    padding: 6px 12px;
    background: var(--wa-white);
    border-top: 1px solid var(--wa-border);
    border-left: 3px solid var(--wa-teal);
    margin: 0 8px;
    border-radius: 4px 4px 0 0;
}

.wa-reply-bar-content {
    flex: 1;
    min-width: 0;
}

.wa-reply-bar-sender {
    display: block;
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--wa-teal);
    text-transform: capitalize;
}

.wa-reply-bar-text {
    display: block;
    font-size: 0.72rem;
    color: var(--wa-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wa-reply-bar-close {
    background: none;
    border: none;
    color: var(--wa-text-muted);
    cursor: pointer;
    padding: 4px;
    font-size: 0.85rem;
    margin-left: 8px;
}

.wa-reply-bar-close:hover {
    color: var(--wa-danger);
}

/* Message highlight animation */
.wa-msg-highlight>.wa-msg-bubble {
    animation: msgHighlight 2s ease;
}

@keyframes msgHighlight {

    0%,
    100% {
        box-shadow: none;
    }

    20% {
        box-shadow: 0 0 0 3px rgba(7, 94, 84, 0.3);
    }

    80% {
        box-shadow: 0 0 0 3px rgba(7, 94, 84, 0.15);
    }
}

/* ─── Media Messages ─────────────────────────────── */
.wa-media-wrap {
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 4px;
    max-width: 280px;
    cursor: pointer;
}

.wa-msg-image {
    width: 100%;
    display: block;
    border-radius: 6px;
    transition: opacity 0.2s;
}

.wa-msg-image:hover {
    opacity: 0.9;
}

.wa-msg-video {
    width: 100%;
    display: block;
    border-radius: 6px;
    max-height: 300px;
}

.wa-media-caption {
    font-style: italic;
    font-size: 0.78rem !important;
    color: var(--wa-text-secondary) !important;
}

/* ─── Image Lightbox ─────────────────────────────── */
.wa-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
}

.wa-lightbox.show {
    display: flex;
}

.wa-lightbox img {
    max-width: 90%;
    max-height: 90%;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.wa-lightbox-close {
    position: absolute;
    top: 20px;
    right: 24px;
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    z-index: 10001;
}

/* ─── Poll Cards ─────────────────────────────────── */
.wa-poll-card {
    background: rgba(0, 0, 0, 0.03);
    border-radius: 8px;
    padding: 8px 10px;
    margin-bottom: 4px;
    min-width: 200px;
}

.wa-poll-header {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #9C27B0;
    font-weight: 700;
    margin-bottom: 4px;
}

.wa-poll-question {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--wa-text);
    margin-bottom: 8px;
}

.wa-poll-options {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.wa-poll-option {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    background: var(--wa-white);
    border: 1px solid var(--wa-border);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.78rem;
    color: var(--wa-text);
    transition: all 0.15s;
    overflow: hidden;
    text-align: left;
}

.wa-poll-option:hover {
    border-color: var(--wa-teal);
    background: rgba(7, 94, 84, 0.02);
}

.wa-poll-opt-text {
    position: relative;
    z-index: 1;
}

.wa-poll-opt-votes {
    position: relative;
    z-index: 1;
    font-weight: 700;
    color: var(--wa-teal);
    font-size: 0.72rem;
    min-width: 16px;
    text-align: right;
}

.wa-poll-bar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    background: rgba(7, 94, 84, 0.08);
    border-radius: 6px 0 0 6px;
    transition: width 0.3s ease;
    z-index: 0;
}

/* ─── Emoji Picker ───────────────────────────────── */
.wa-emoji-btn {
    background: none;
    border: none;
    color: var(--wa-text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px;
    transition: color 0.15s;
}

.wa-emoji-btn:hover {
    color: var(--wa-teal);
}

.wa-emoji-picker {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    max-height: 220px;
    overflow-y: auto;
    background: var(--wa-white);
    border-top: 1px solid var(--wa-border);
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.08);
    z-index: 100;
    padding: 8px;
}

.wa-emoji-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(32px, 1fr));
    gap: 2px;
}

.wa-emoji-item {
    background: none;
    border: none;
    font-size: 1.3rem;
    padding: 4px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.1s;
    line-height: 1;
}

.wa-emoji-item:hover {
    background: rgba(0, 0, 0, 0.06);
}

/* Twemoji img sizing */
.emoji-render img.emoji {
    width: 1.1em;
    height: 1.1em;
    vertical-align: -0.15em;
    margin: 0 1px;
}

/* Template badge */
.wa-msg-type-template {
    color: #34B7F1 !important;
}

/* ─── Poll Form Modal ────────────────────────────── */
.poll-form-group {
    margin-bottom: 14px;
}

.poll-form-group label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--wa-text-secondary);
    margin-bottom: 6px;
}

.poll-input,
.poll-option-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--wa-border);
    border-radius: 6px;
    font-size: 0.85rem;
    background: var(--wa-light);
    margin-bottom: 6px;
    box-sizing: border-box;
}

.poll-input:focus,
.poll-option-input:focus {
    border-color: var(--wa-teal);
    outline: none;
}

.poll-add-option {
    background: none;
    border: none;
    color: var(--wa-teal);
    font-size: 0.78rem;
    cursor: pointer;
    padding: 4px 0;
    font-weight: 600;
}

.poll-add-option:hover {
    text-decoration: underline;
}

/* ─── Responsive ─────────────────────────────────── */
@media (max-width: 768px) {
    .wa-media-wrap {
        max-width: 100%;
    }

    .wa-emoji-picker {
        max-height: 180px;
    }

    .wa-poll-card {
        min-width: unset;
    }
}

/* ═══════════════════════════════════════════════════ */
/* ─── WhatsApp Profile & Templates Pages ────────── */
/* ═══════════════════════════════════════════════════ */

/* ─── Shared Page Layout ─────────────────────────── */
.wa-page-container {
    padding: 24px;
    max-width: 1100px;
    margin: 0 auto;
}

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

.wa-page-header h1 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--wa-text);
    margin: 0;
}

.wa-page-subtitle {
    font-size: 0.82rem;
    color: var(--wa-text-secondary);
    margin: 2px 0 0 0;
}

.wa-page-header-right {
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-outline {
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid var(--wa-border);
    background: var(--wa-white);
    color: var(--wa-text);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s;
}

.btn-outline:hover {
    border-color: var(--wa-teal);
    color: var(--wa-teal);
}

/* ─── WhatsApp Profile Page ──────────────────────── */

/* Status Bar */
.wap-status-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.wap-status-bar.connected {
    background: rgba(37, 211, 102, 0.08);
    color: #128C7E;
    border: 1px solid rgba(37, 211, 102, 0.2);
}

.wap-status-bar.disconnected {
    background: rgba(220, 53, 69, 0.06);
    color: #dc3545;
    border: 1px solid rgba(220, 53, 69, 0.15);
}

.wap-status-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
}

.wap-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}

.wap-status-detail {
    font-weight: 400;
    color: var(--wa-text-secondary);
    font-size: 0.75rem;
}

.wap-status-detail i {
    margin-right: 4px;
}

/* Grid Layout */
.wap-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* Cards */
.wap-card {
    background: var(--wa-white);
    border-radius: 12px;
    border: 1px solid var(--wa-border);
    overflow: hidden;
}

.wap-card-header {
    padding: 14px 18px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--wa-text);
    border-bottom: 1px solid var(--wa-border);
    background: var(--wa-light);
}

.wap-card-header i {
    margin-right: 6px;
    color: var(--wa-teal);
}

.wap-card-body {
    padding: 18px;
}

.wap-right-col {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Avatar */
.wap-avatar-section {
    text-align: center;
    margin-bottom: 16px;
}

.wap-avatar-large {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    background: linear-gradient(135deg, #25D366, #075E54);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    overflow: hidden;
}

.wap-avatar-large img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wap-avatar-large i {
    font-size: 2rem;
    color: white;
}

/* Form Groups */
.wap-form-group {
    margin-bottom: 14px;
}

.wap-form-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--wa-text-secondary);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.wap-form-group .required {
    color: var(--wa-danger);
}

.wap-form-group input,
.wap-form-group textarea,
.wap-form-group select {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--wa-border);
    border-radius: 8px;
    font-size: 0.85rem;
    background: var(--wa-light);
    color: var(--wa-text);
    box-sizing: border-box;
    font-family: inherit;
    transition: border 0.15s;
}

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

.wap-hint {
    font-size: 0.7rem;
    color: var(--wa-text-muted);
    margin-top: 3px;
    display: block;
}

.wap-hint a {
    color: var(--wa-teal);
}

/* Info Rows (API section) */
.wap-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.wap-info-row:last-of-type {
    border-bottom: none;
}

.wap-info-label {
    font-size: 0.78rem;
    color: var(--wa-text-secondary);
}

.wap-info-value {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--wa-text);
    font-family: 'Courier New', monospace;
}

/* Form Actions */
.wap-form-actions {
    padding: 20px 0;
    text-align: right;
}

.btn-submit {
    padding: 10px 24px;
    border-radius: 8px;
    border: none;
    background: linear-gradient(135deg, #25D366, #128C7E);
    color: white;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(18, 140, 126, 0.3);
}

/* ─── Templates Page ─────────────────────────────── */

/* Stats Bar */
.wpt-stats {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.wpt-stat {
    background: var(--wa-white);
    border: 1px solid var(--wa-border);
    border-radius: 10px;
    padding: 12px 20px;
    text-align: center;
    min-width: 80px;
}

.wpt-stat-num {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--wa-text);
}

.wpt-stat-num.wpt-draft {
    color: #6c757d;
}

.wpt-stat-num.wpt-approved {
    color: #25D366;
}

.wpt-stat-num.wpt-pending {
    color: #ffc107;
}

.wpt-stat-label {
    font-size: 0.7rem;
    color: var(--wa-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Template Card Grid */
.wpt-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.wpt-card {
    background: var(--wa-white);
    border: 1px solid var(--wa-border);
    border-radius: 12px;
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.wpt-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

.wpt-card-top {
    padding: 14px 16px 10px;
}

.wpt-card-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.wpt-name {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--wa-text);
}

.wpt-card-meta {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Badges */
.wpt-badge {
    font-size: 0.6rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.wpt-badge-draft {
    background: #ede7f6;
    color: #6c757d;
}

.wpt-badge-pending {
    background: #fff3cd;
    color: #856404;
}

.wpt-badge-approved {
    background: #d4edda;
    color: #155724;
}

.wpt-badge-rejected {
    background: #f8d7da;
    color: #721c24;
}

.wpt-category {
    font-size: 0.68rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}

.wpt-cat-utility {
    background: #e3f2fd;
    color: #1565c0;
}

.wpt-cat-marketing {
    background: #fce4ec;
    color: #c62828;
}

.wpt-cat-authentication {
    background: #fff8e1;
    color: #f57f17;
}

.wpt-lang {
    font-size: 0.68rem;
    color: var(--wa-text-muted);
    font-weight: 500;
}

/* Preview */
.wpt-preview {
    margin: 0 16px 12px;
    background: #dcf8c6;
    border-radius: 0 8px 8px 8px;
    padding: 10px 12px;
    position: relative;
    font-size: 0.8rem;
    color: var(--wa-text);
    max-height: 120px;
    overflow: hidden;
}

.wpt-preview::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 24px;
    background: linear-gradient(transparent, #dcf8c6);
}

.wpt-preview-header {
    font-weight: 700;
    margin-bottom: 4px;
}

.wpt-preview-body {
    white-space: pre-line;
    line-height: 1.4;
}

.wpt-preview-footer {
    font-size: 0.7rem;
    color: var(--wa-text-muted);
    margin-top: 4px;
}

/* Card Actions */
.wpt-card-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    border-top: 1px solid var(--wa-border);
    background: var(--wa-light);
}

.wpt-date {
    font-size: 0.7rem;
    color: var(--wa-text-muted);
}

.wpt-date i {
    margin-right: 3px;
}

.wpt-action-btns {
    display: flex;
    gap: 6px;
}

.wpt-btn-edit,
.wpt-btn-del {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    border: 1px solid var(--wa-border);
    background: var(--wa-white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    transition: all 0.15s;
}

.wpt-btn-edit {
    color: var(--wa-teal);
}

.wpt-btn-edit:hover {
    background: var(--wa-teal);
    color: white;
    border-color: var(--wa-teal);
}

.wpt-btn-del {
    color: #dc3545;
}

.wpt-btn-del:hover {
    background: #dc3545;
    color: white;
    border-color: #dc3545;
}

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

.wpt-empty i {
    font-size: 3rem;
    color: var(--wa-border);
    margin-bottom: 12px;
}

.wpt-empty h3 {
    font-size: 1.1rem;
    color: var(--wa-text);
    margin: 8px 0;
}

.wpt-empty p {
    font-size: 0.82rem;
    margin-bottom: 16px;
}

/* ─── Modal ──────────────────────────────────────── */
.wpt-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.wpt-modal {
    background: var(--wa-white);
    border-radius: 14px;
    width: 100%;
    max-width: 640px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

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

.wpt-modal-header h2 {
    font-size: 1.1rem;
    margin: 0;
}

.wpt-modal-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: var(--wa-text-muted);
    padding: 4px;
}

.wpt-modal-close:hover {
    color: var(--wa-danger);
}

.wpt-modal-body {
    padding: 20px;
}

.wpt-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 20px;
    border-top: 1px solid var(--wa-border);
    background: var(--wa-light);
}

/* Form Layout in Modal */
.wpt-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.wpt-form-group {
    margin-bottom: 14px;
}

.wpt-form-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--wa-text-secondary);
    margin-bottom: 5px;
}

.wpt-form-group .required {
    color: var(--wa-danger);
}

.wpt-form-group input,
.wpt-form-group textarea,
.wpt-form-group select {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--wa-border);
    border-radius: 8px;
    font-size: 0.85rem;
    background: var(--wa-light);
    color: var(--wa-text);
    box-sizing: border-box;
    font-family: inherit;
    transition: border 0.15s;
}

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

/* Live Preview */
.wpt-live-preview {
    margin-top: 16px;
    background: #e5ddd5;
    border-radius: 10px;
    padding: 16px;
}

.wpt-live-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--wa-text-muted);
    margin-bottom: 8px;
}

.wpt-live-bubble {
    background: #dcf8c6;
    border-radius: 0 8px 8px 8px;
    padding: 10px 14px;
    font-size: 0.82rem;
    color: var(--wa-text);
    max-width: 85%;
}

.wpt-live-header {
    font-weight: 700;
    margin-bottom: 4px;
}

.wpt-live-body {
    white-space: pre-line;
    line-height: 1.5;
}

.wpt-live-footer {
    font-size: 0.7rem;
    color: var(--wa-text-muted);
    margin-top: 4px;
}

.wpt-var {
    background: rgba(7, 94, 84, 0.12);
    color: var(--wa-teal);
    padding: 1px 4px;
    border-radius: 3px;
    font-weight: 600;
    font-family: 'Courier New', monospace;
    font-size: 0.78rem;
}

/* ─── Responsive ─────────────────────────────────── */
@media (max-width: 768px) {
    .wa-page-container {
        padding: 16px 12px;
    }

    .wa-page-header {
        flex-direction: column;
    }

    .wap-grid {
        grid-template-columns: 1fr;
    }

    .wpt-grid {
        grid-template-columns: 1fr;
    }

    .wpt-form-row {
        grid-template-columns: 1fr;
    }

    .wap-status-bar {
        flex-wrap: wrap;
    }

    .wpt-stats {
        gap: 8px;
    }

    .wpt-stat {
        flex: 1;
        min-width: 60px;
        padding: 10px 12px;
    }
}

/* ═══════════════════════════════════════════════════════════════════
   Additional CSS for WhatsApp Profile & Templates pages
   Append these rules to the end of static/css/style.css
   ═══════════════════════════════════════════════════════════════════ */

/* ─── Notice / Alert banners ──────────────────────────────────────── */
.wap-notice {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 0.82rem;
    line-height: 1.5;
}

.wap-notice i {
    margin-top: 2px;
    flex-shrink: 0;
    font-size: 1rem;
}

.wap-notice-warn {
    background: #fff8e1;
    border: 1px solid #ffe082;
    color: #7d5400;
}

.wap-notice-error {
    background: #fce4ec;
    border: 1px solid #f48fb1;
    color: #880e4f;
}

/* ─── "Live from Meta" badge inside card headers ──────────────────── */
.wap-live-badge {
    margin-left: auto;
    font-size: 0.65rem;
    font-weight: 600;
    color: #25D366;
    background: rgba(37, 211, 102, 0.1);
    border: 1px solid rgba(37, 211, 102, 0.25);
    border-radius: 10px;
    padding: 2px 8px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* ─── Env-var code block ──────────────────────────────────────────── */
.wap-env-block {
    background: #f8f9fa;
    border: 1px solid var(--wa-border);
    border-radius: 8px;
    margin-top: 12px;
    overflow: hidden;
}

.wap-env-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--wa-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 7px 12px;
    border-bottom: 1px solid var(--wa-border);
    background: #f1f3f4;
}

.wap-env-code {
    font-family: 'Courier New', monospace;
    font-size: 0.72rem;
    color: #37474f;
    line-height: 1.9;
    margin: 0;
    padding: 10px 12px;
    white-space: pre;
    overflow-x: auto;
}

/* ─── Form actions bar ────────────────────────────────────────────── */
.wap-form-actions {
    padding: 20px 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    border-top: 1px solid var(--wa-border);
    margin-top: 20px;
}

.wap-save-note {
    font-size: 0.78rem;
    color: var(--wa-text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-right: auto;
}

.wap-save-note-warn {
    color: #856404;
}

/* ─── Character counter ───────────────────────────────────────────── */
.wap-char-counter {
    float: right;
    font-size: 0.68rem;
    font-weight: 400;
    color: var(--wa-text-muted);
    letter-spacing: 0;
    text-transform: none;
}

/* ─── Templates: Meta source pill on card ────────────────────────── */
.wpt-meta-source {
    font-size: 0.6rem;
    font-weight: 600;
    color: #1565c0;
    background: #e3f2fd;
    border-radius: 10px;
    padding: 2px 6px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

/* ─── Templates: Rejected card treatment ─────────────────────────── */
.wpt-card-rejected {
    border-color: rgba(220, 53, 69, 0.35);
}

.wpt-rejected-banner {
    margin: 0 16px 8px;
    padding: 8px 10px;
    background: #fff0f0;
    border: 1px solid #f5c2c7;
    border-radius: 6px;
    font-size: 0.75rem;
    color: #842029;
    display: flex;
    align-items: flex-start;
    gap: 6px;
    line-height: 1.4;
}

/* ─── Templates: Locked (non-editable) button ────────────────────── */
.wpt-btn-disabled {
    opacity: 0.35;
    cursor: not-allowed !important;
    pointer-events: none;
}

/* ─── Templates: Media header placeholder in preview ─────────────── */
.wpt-live-media,
.wpt-preview-media {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.06);
    border-radius: 6px;
    padding: 10px 12px;
    margin-bottom: 6px;
    font-size: 0.78rem;
    color: var(--wa-text-muted);
}

.wpt-live-media i,
.wpt-preview-media i {
    font-size: 1.1rem;
}

/* ─── Badge for rejected status ───────────────────────────────────── */
.wpt-badge-rejected {
    background: #f8d7da;
    color: #721c24;
}

/* ═══════════════════════════════════════════════════════════════════
   AICA Gifts — Additional CSS  (append to static/css/style.css)
   ═══════════════════════════════════════════════════════════════════ */

/* ─── Notices ─────────────────────────────────────────────────────── */
.wap-notice {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: .82rem;
    line-height: 1.5
}

.wap-notice i {
    margin-top: 2px;
    flex-shrink: 0;
    font-size: 1rem
}

.wap-notice-warn {
    background: #fff8e1;
    border: 1px solid #ffe082;
    color: #7d5400
}

.wap-notice-error {
    background: #fce4ec;
    border: 1px solid #f48fb1;
    color: #880e4f
}

/* ─── Live / Meta badges ──────────────────────────────────────────── */
.wap-live-badge {
    margin-left: auto;
    font-size: .65rem;
    font-weight: 600;
    color: #25D366;
    background: rgba(37, 211, 102, .1);
    border: 1px solid rgba(37, 211, 102, .25);
    border-radius: 10px;
    padding: 2px 8px;
    display: inline-flex;
    align-items: center;
    gap: 4px
}

.wpt-meta-source {
    font-size: .6rem;
    font-weight: 600;
    color: #1565c0;
    background: #e3f2fd;
    border-radius: 10px;
    padding: 2px 6px;
    display: inline-flex;
    align-items: center;
    gap: 3px
}

/* ─── Env vars block ──────────────────────────────────────────────── */
.wap-env-block {
    background: #f8f9fa;
    border: 1px solid var(--wa-border);
    border-radius: 8px;
    margin-top: 12px;
    overflow: hidden
}

.wap-env-label {
    font-size: .7rem;
    font-weight: 700;
    color: var(--wa-text-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: 7px 12px;
    border-bottom: 1px solid var(--wa-border);
    background: #f1f3f4
}

.wap-env-code {
    font-family: 'Courier New', monospace;
    font-size: .72rem;
    color: #37474f;
    line-height: 1.9;
    margin: 0;
    padding: 10px 12px;
    white-space: pre;
    overflow-x: auto
}

/* ─── Form actions ────────────────────────────────────────────────── */
.wap-form-actions {
    padding: 20px 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    border-top: 1px solid var(--wa-border);
    margin-top: 20px
}

.wap-save-note {
    font-size: .78rem;
    color: var(--wa-text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-right: auto
}

.wap-save-note-warn {
    color: #856404
}

/* ─── Char counter ────────────────────────────────────────────────── */
.wap-char-counter {
    float: right;
    font-size: .68rem;
    font-weight: 400;
    color: var(--wa-text-muted);
    letter-spacing: 0;
    text-transform: none
}

/* ─── Template rejected ───────────────────────────────────────────── */
.wpt-card-rejected {
    border-color: rgba(220, 53, 69, .35)
}

.wpt-rejected-banner {
    margin: 0 16px 8px;
    padding: 8px 10px;
    background: #fff0f0;
    border: 1px solid #f5c2c7;
    border-radius: 6px;
    font-size: .75rem;
    color: #842029;
    display: flex;
    align-items: flex-start;
    gap: 6px;
    line-height: 1.4
}

.wpt-badge-rejected {
    background: #f8d7da;
    color: #721c24
}

.wpt-btn-disabled {
    opacity: .35;
    cursor: not-allowed !important;
    pointer-events: none
}

/* ─── Media placeholder ───────────────────────────────────────────── */
.wpt-live-media,
.wpt-preview-media {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, .06);
    border-radius: 6px;
    padding: 10px 12px;
    margin-bottom: 6px;
    font-size: .78rem;
    color: var(--wa-text-muted)
}

.wpt-live-media i,
.wpt-preview-media i {
    font-size: 1.1rem
}

/* ─── Template Analytics panel ────────────────────────────────────── */
.wpt-analytics {
    margin: 0 12px 8px;
    padding: 10px 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px
}

.wpt-analytics-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: .72rem;
    font-weight: 700;
    color: var(--wa-teal);
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: 8px
}

.wpt-analytics-period {
    margin-left: auto;
    font-size: .65rem;
    font-weight: 400;
    color: var(--wa-text-muted);
    text-transform: none;
    letter-spacing: 0
}

.wpt-analytics-stats {
    display: flex;
    gap: 12px;
    margin-bottom: 10px
}

.wpt-anl-stat {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center
}

.wpt-anl-num {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--wa-text);
    line-height: 1.2
}

.wpt-anl-label {
    font-size: .62rem;
    color: var(--wa-text-muted);
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: .03em
}

.wpt-analytics-bars {
    display: flex;
    flex-direction: column;
    gap: 5px
}

.wpt-anl-bar-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .72rem
}

.wpt-anl-bar-label {
    width: 48px;
    flex-shrink: 0;
    color: var(--wa-text-muted);
    font-size: .7rem
}

.wpt-anl-bar-track {
    flex: 1;
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden
}

.wpt-anl-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width .6s ease
}

.wpt-anl-bar-delivery {
    background: #25D366
}

.wpt-anl-bar-read {
    background: #34B7F1
}

.wpt-anl-bar-click {
    background: #FF9800
}

.wpt-anl-bar-pct {
    width: 36px;
    text-align: right;
    font-size: .7rem;
    font-weight: 600;
    color: var(--wa-text);
    flex-shrink: 0
}

.wpt-analytics-empty {
    margin: 0 12px 8px;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 6px;
    font-size: .72rem;
    color: var(--wa-text-muted);
    display: flex;
    align-items: center;
    gap: 6px
}

/* ─── Enable steps card ───────────────────────────────────────────── */
.wpt-steps-card {
    background: var(--wa-white);
    border: 1px solid var(--wa-border);
    border-radius: 10px;
    margin-bottom: 16px;
    overflow: hidden
}

.wpt-steps-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    cursor: pointer;
    font-size: .85rem;
    color: var(--wa-text);
    user-select: none;
    transition: background .15s
}

.wpt-steps-header:hover {
    background: #f8f9fa
}

.wpt-steps-header i:first-child {
    color: var(--wa-teal)
}

.wpt-steps-body {
    padding: 16px
}

.wpt-steps-intro {
    font-size: .82rem;
    color: var(--wa-text-secondary);
    margin-bottom: 14px
}

.wpt-steps-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px
}

@media(max-width:640px) {
    .wpt-steps-cols {
        grid-template-columns: 1fr
    }
}

.wpt-steps-col {
    font-size: .8rem
}

.wpt-steps-colhead {
    font-weight: 700;
    font-size: .75rem;
    color: var(--wa-teal);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    text-transform: uppercase;
    letter-spacing: .03em
}

.wpt-steps-list {
    padding-left: 16px;
    line-height: 1.7;
    color: var(--wa-text)
}

.wpt-steps-list li {
    margin-bottom: 4px
}

.wpt-steps-list code {
    background: #f1f3f4;
    padding: 1px 5px;
    border-radius: 4px;
    font-size: .78rem;
    font-family: 'Courier New', monospace
}

.wpt-code-block {
    display: block;
    background: #1e1e2e;
    color: #cdd6f4;
    font-family: 'Courier New', monospace;
    font-size: .72rem;
    padding: 10px 12px;
    border-radius: 6px;
    margin-top: 6px;
    line-height: 1.7;
    white-space: pre;
    overflow-x: auto
}

.wpt-steps-note {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: 14px;
    padding: 10px 12px;
    background: #e3f2fd;
    border-radius: 8px;
    font-size: .78rem;
    color: #1565c0
}

.wpt-steps-note i {
    flex-shrink: 0;
    margin-top: 1px
}

/* ═══════════════════════════════════════════════════════════════════
   Dashboard — WhatsApp Analytics Section
   ═══════════════════════════════════════════════════════════════════ */
.dash-section {
    background: var(--wa-white);
    border-radius: 10px;
    padding: 16px 20px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .06)
}

.dash-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    flex-wrap: wrap;
    gap: 8px
}

.dash-wa-controls {
    display: flex;
    align-items: center;
    gap: 8px
}

.dash-range-select {
    padding: 5px 10px;
    border: 1px solid var(--wa-border);
    border-radius: 6px;
    font-size: .78rem;
    background: var(--wa-white);
    color: var(--wa-text);
    cursor: pointer
}

.dash-refresh-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid var(--wa-border);
    background: var(--wa-white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .8rem;
    color: var(--wa-text-muted);
    cursor: pointer;
    transition: all .15s
}

.dash-refresh-btn:hover {
    border-color: var(--wa-teal);
    color: var(--wa-teal)
}

/* Stat row */
.dash-wa-stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 14px
}

@media(max-width:640px) {
    .dash-wa-stats-row {
        grid-template-columns: repeat(2, 1fr)
    }
}

.dash-wa-stat-card {
    background: var(--wa-light);
    border-radius: 8px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 3px
}

.dash-wa-stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--wa-text);
    line-height: 1.1
}

.dash-wa-stat-label {
    font-size: .68rem;
    color: var(--wa-text-muted);
    text-transform: uppercase;
    letter-spacing: .04em
}

.dash-wa-stat-total {
    border-left: 3px solid #25D366
}

.dash-wa-stat-marketing {
    border-left: 3px solid #E91E63
}

.dash-wa-stat-utility {
    border-left: 3px solid #34B7F1
}

.dash-wa-stat-service {
    border-left: 3px solid #07b06c
}

/* Direction / cost row */
.dash-wa-meta-row {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 14px;
    font-size: .78rem;
    color: var(--wa-text-secondary)
}

.dash-wa-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 5px
}

.dash-wa-meta-hint {
    font-size: .7rem;
    color: var(--wa-text-muted)
}

/* Charts */
.dash-charts-row {
    display: flex;
    gap: 14px;
    flex-wrap: wrap
}

.dash-chart-card {
    background: var(--wa-light);
    border-radius: 8px;
    padding: 14px;
    min-width: 0;
    flex: 1
}

.dash-chart-title {
    font-size: .72rem;
    font-weight: 700;
    color: var(--wa-text-secondary);
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: 10px
}

/* Donut legend */
.dash-donut-legend {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 8px;
    font-size: .72rem
}

.dash-donut-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--wa-text)
}

.dash-donut-item i {
    width: 8px;
    height: 8px;
    border-radius: 2px;
    flex-shrink: 0;
    display: inline-block
}

.dash-donut-item strong {
    margin-left: auto;
    font-weight: 600
}

/* No-data / error / disconnected */
.dash-wa-nodata {
    text-align: center;
    padding: 20px;
    font-size: .8rem;
    color: var(--wa-text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px
}

.dash-wa-nodata i {
    font-size: 1.5rem;
    opacity: .4
}

.dash-wa-error {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #fff8e1;
    border: 1px solid #ffe082;
    border-radius: 8px;
    font-size: .8rem;
    color: #7d5400
}

.dash-wa-error i {
    font-size: 1rem;
    flex-shrink: 0
}

.dash-wa-disconnected {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 32px 16px;
    text-align: center;
    color: var(--wa-text-secondary);
    gap: 8px
}

.dash-wa-disconnected-icon {
    width: 56px;
    height: 56px;
    background: rgba(37, 211, 102, .1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    color: #25D366;
    margin-bottom: 4px
}

.dash-wa-disconnected h3 {
    font-size: 1rem;
    color: var(--wa-text);
    margin: 0
}

.dash-wa-disconnected p {
    font-size: .82rem;
    margin: 0;
    max-width: 280px
}

/* Skeleton shimmer */
@keyframes shimmer {
    0% {
        background-position: -200% center
    }

    100% {
        background-position: 200% center
    }
}

.skel-line {
    height: 12px;
    border-radius: 6px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite
}

.skel-short {
    width: 40%
}

.skel-long {
    width: 70%
}

.dash-skeleton-card {
    min-height: 68px;
    display: flex;
    flex-direction: column;
    justify-content: center
}

.skel-chart {
    height: 160px;
    border-radius: 8px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite
}

.skel-donut {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    margin: 0 auto;
    background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite
}