/* ============================================================
   Intra SMS Portal — sms-portal.css
   Matches the Intra Modern theme colour palette exactly.
   ============================================================ */

:root {
    --sms-primary:      #0066FF;
    --sms-primary-dark: #0052CC;
    --sms-secondary:    #00D9FF;
    --sms-dark:         #0A0E27;
    --sms-dark-light:   #1A1F3A;
    --sms-text:         #FFFFFF;
    --sms-muted:        #A0A5B8;
    --sms-success:      #00C851;
    --sms-success-bg:   rgba(0,200,81,0.12);
    --sms-success-bdr:  rgba(0,200,81,0.3);
    --sms-error:        #FF4444;
    --sms-error-bg:     rgba(255,68,68,0.12);
    --sms-error-bdr:    rgba(255,68,68,0.3);
    --sms-warn-bg:      rgba(255,179,0,0.1);
    --sms-warn-bdr:     rgba(255,179,0,0.3);
    --sms-card:         rgba(26,31,58,0.7);
    --sms-border:       rgba(255,255,255,0.1);
    --sms-input-bg:     rgba(10,14,39,0.8);
    --sms-radius:       14px;
    --sms-radius-sm:    8px;
}

/* ── Page wrap ─────────────────────────────────────────────── */

.intra-sms-wrap {
    padding: 7rem 5% 5rem;
    min-height: 70vh;
    background: var(--sms-dark);
    color: var(--sms-text);
}

/* ── Auth card (login / register / 2fa) ────────────────────── */

.sms-auth-card {
    max-width: 480px;
    margin: 0 auto;
    background: var(--sms-card);
    border: 1px solid var(--sms-border);
    border-radius: 20px;
    padding: 3rem;
    backdrop-filter: blur(12px);
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}

.sms-auth-logo {
    font-size: 1.3rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--sms-primary), var(--sms-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
    margin-bottom: 1.25rem;
}

.sms-auth-card h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--sms-text);
    margin: 0 0 0.4rem;
}

.sms-subtitle {
    color: var(--sms-muted);
    font-size: 0.93rem;
    margin: 0 0 1.75rem;
    line-height: 1.5;
}

/* ── Form fields ───────────────────────────────────────────── */

.sms-field {
    margin-bottom: 1.2rem;
}

.sms-field label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--sms-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 0.5rem;
}

.sms-field-hint {
    font-size: 0.75rem;
    color: var(--sms-muted);
    text-transform: none;
    letter-spacing: 0;
    font-weight: 400;
}

.sms-field input,
.sms-field select,
.sms-field textarea {
    width: 100%;
    padding: 0.85rem 1rem;
    background: var(--sms-input-bg);
    border: 1px solid var(--sms-border);
    border-radius: var(--sms-radius-sm);
    color: var(--sms-text);
    font-size: 0.97rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.25s, box-shadow 0.25s;
}

.sms-field input:focus,
.sms-field select:focus,
.sms-field textarea:focus {
    border-color: var(--sms-primary);
    box-shadow: 0 0 0 3px rgba(0,102,255,0.18);
}

.sms-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* OTP / 2FA code input */
.sms-otp-input {
    font-size: 2rem !important;
    font-weight: 700 !important;
    text-align: center !important;
    letter-spacing: 0.6rem !important;
    padding: 1rem !important;
}

/* ── Buttons ───────────────────────────────────────────────── */

.sms-btn-primary {
    display: inline-block;
    width: 100%;
    padding: 0.9rem 2rem;
    background: linear-gradient(135deg, var(--sms-primary), var(--sms-primary-dark));
    border: none;
    border-radius: 50px;
    color: #fff;
    font-size: 0.97rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: transform 0.25s, box-shadow 0.25s, opacity 0.25s;
    margin-top: 0.4rem;
}

.sms-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0,102,255,0.4);
    color: #fff;
    text-decoration: none;
}

.sms-btn-primary:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.sms-btn-secondary {
    display: inline-block;
    padding: 0.55rem 1.1rem;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: var(--sms-radius-sm);
    color: var(--sms-text);
    font-size: 0.85rem;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, border-color 0.2s;
    white-space: nowrap;
}

.sms-btn-secondary:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.3);
    color: var(--sms-text);
    text-decoration: none;
}

.sms-file-label {
    cursor: pointer;
}

.sms-btn-outline {
    display: inline-block;
    padding: 0.45rem 1.1rem;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 50px;
    color: var(--sms-text);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: border-color 0.2s, color 0.2s;
}

.sms-btn-outline:hover {
    border-color: var(--sms-primary);
    color: var(--sms-primary);
    text-decoration: none;
}

/* ── Alerts ────────────────────────────────────────────────── */

.sms-error {
    background: var(--sms-error-bg);
    border: 1px solid var(--sms-error-bdr);
    border-radius: var(--sms-radius-sm);
    padding: 0.85rem 1rem;
    color: #ff7f7f;
    font-size: 0.9rem;
    margin-bottom: 1.2rem;
    line-height: 1.5;
}

.sms-success {
    background: var(--sms-success-bg);
    border: 1px solid var(--sms-success-bdr);
    border-radius: var(--sms-radius-sm);
    padding: 0.85rem 1rem;
    color: #5de08a;
    font-size: 0.9rem;
    margin-bottom: 1.2rem;
    line-height: 1.5;
}

.sms-notice {
    border-radius: var(--sms-radius);
    padding: 1.25rem 1.5rem;
    margin-bottom: 2rem;
    font-size: 0.95rem;
    line-height: 1.65;
}

.sms-notice-warning {
    background: var(--sms-warn-bg);
    border: 1px solid var(--sms-warn-bdr);
    color: #ffd54f;
}

/* ── Auth footer ───────────────────────────────────────────── */

.sms-auth-footer {
    margin-top: 1.5rem;
    text-align: center;
    color: var(--sms-muted);
    font-size: 0.88rem;
}

.sms-auth-footer a {
    color: var(--sms-secondary);
    text-decoration: none;
    font-weight: 500;
}

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

/* ══════════════════════════════════════════════════════════════
   DASHBOARD
   ══════════════════════════════════════════════════════════════ */

.sms-dashboard {
    max-width: 1200px;
    margin: 0 auto;
}

/* Header */

.sms-dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--sms-border);
    gap: 1.5rem;
    flex-wrap: wrap;
}

.sms-dashboard-header h1 {
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--sms-text), var(--sms-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0 0 0.3rem;
    line-height: 1.2;
}

.sms-from-badge {
    color: var(--sms-secondary);
    font-family: monospace;
    font-size: 0.95rem;
}

.sms-user-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.sms-user-name {
    color: var(--sms-muted);
    font-size: 0.9rem;
}

/* Tabs */

.sms-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.sms-tab {
    padding: 0.65rem 1.4rem;
    background: var(--sms-card);
    border: 1px solid var(--sms-border);
    border-radius: var(--sms-radius-sm);
    color: var(--sms-muted);
    font-size: 0.88rem;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.sms-tab.active {
    background: rgba(0,102,255,0.15);
    border-color: var(--sms-primary);
    color: var(--sms-text);
}

.sms-tab-content { display: none; }
.sms-tab-content.active { display: block; }

/* Cards */

.sms-compose-card,
.sms-history-card {
    background: var(--sms-card);
    border: 1px solid var(--sms-border);
    border-radius: 20px;
    overflow: hidden;
}

/* Toolbar */

.sms-compose-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.1rem 1.5rem;
    border-bottom: 1px solid var(--sms-border);
    gap: 1rem;
    flex-wrap: wrap;
}

.sms-toolbar-left,
.sms-toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.sms-row-count {
    color: var(--sms-muted);
    font-size: 0.85rem;
}

/* Progress bar */

.sms-progress {
    height: 5px;
    background: rgba(10,14,39,0.5);
    display: none;
    overflow: hidden;
}

.sms-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--sms-primary), var(--sms-secondary));
    width: 0%;
    transition: width 0.4s ease;
}

/* Table */

.sms-table-wrap {
    overflow-x: auto;
}

.sms-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.sms-table thead th {
    padding: 0.75rem 1rem;
    background: rgba(10,14,39,0.4);
    color: var(--sms-muted);
    font-weight: 600;
    text-align: left;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    white-space: nowrap;
}

.sms-table tbody tr {
    border-bottom: 1px solid rgba(255,255,255,0.04);
    transition: background 0.15s;
}

.sms-table tbody tr:hover {
    background: rgba(255,255,255,0.025);
}

.sms-table td {
    padding: 0.65rem 1rem;
    color: var(--sms-text);
    vertical-align: middle;
}

/* Column widths */
.col-num    { width: 44px;  text-align: center; color: var(--sms-muted); font-size: 0.78rem; }
.col-phone  { width: 190px; }
.col-status { width: 150px; }
.col-del    { width: 44px;  }
.col-time   { width: 160px; white-space: nowrap; color: var(--sms-muted); font-size: 0.8rem; }

/* Inline inputs inside table */

.sms-table input[type="text"],
.sms-table textarea {
    width: 100%;
    background: rgba(10,14,39,0.55);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 6px;
    color: var(--sms-text);
    padding: 0.45rem 0.7rem;
    font-size: 0.85rem;
    font-family: inherit;
    resize: none;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.sms-table input[type="text"]:focus,
.sms-table textarea:focus {
    border-color: var(--sms-primary);
    box-shadow: 0 0 0 2px rgba(0,102,255,0.15);
}

.sms-table textarea {
    min-height: 56px;
    max-height: 110px;
    line-height: 1.4;
}

/* Delete row button */

.row-del-btn {
    background: none;
    border: none;
    color: var(--sms-error);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    opacity: 0.35;
    transition: opacity 0.2s;
    display: block;
    margin: 0 auto;
}

.row-del-btn:hover { opacity: 1; }

/* Status badges */

.sms-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.28rem 0.7rem;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-pending  { background: rgba(160,165,184,0.1); color: var(--sms-muted);    border: 1px solid rgba(255,255,255,0.08); }
.badge-sending  { background: rgba(0,102,255,0.15);  color: #7eb8ff;             border: 1px solid rgba(0,102,255,0.3); }
.badge-sent     { background: var(--sms-success-bg); color: #5de08a;             border: 1px solid var(--sms-success-bdr); }
.badge-failed   { background: var(--sms-error-bg);   color: #ff7f7f;             border: 1px solid var(--sms-error-bdr); }

/* Hint */

.sms-hint {
    padding: 0.85rem 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.05);
    color: var(--sms-muted);
    font-size: 0.8rem;
    line-height: 1.6;
}

.sms-hint code {
    background: rgba(0,102,255,0.15);
    border-radius: 4px;
    padding: 0.1em 0.4em;
    font-size: 0.85em;
    color: var(--sms-secondary);
}

/* History */

.sms-history-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.1rem 1.5rem;
    border-bottom: 1px solid var(--sms-border);
}

.sms-history-head h3 {
    color: var(--sms-text);
    font-size: 0.97rem;
    font-weight: 600;
    margin: 0;
}

#history-count {
    color: var(--sms-muted);
    font-size: 0.82rem;
    font-weight: 400;
    margin-left: 0.5rem;
}

.sms-empty {
    text-align: center;
    padding: 2.5rem 1rem !important;
    color: var(--sms-muted);
    font-size: 0.9rem;
}

/* ── Responsive ────────────────────────────────────────────── */

@media (max-width: 768px) {
    .intra-sms-wrap          { padding: 6rem 4% 4rem; }
    .sms-auth-card           { padding: 2rem 1.5rem; }
    .sms-field-row           { grid-template-columns: 1fr; gap: 0; }
    .sms-dashboard-header    { flex-direction: column; }
    .sms-compose-toolbar     { flex-direction: column; align-items: stretch; }
    .sms-toolbar-left,
    .sms-toolbar-right       { flex-wrap: wrap; }
    .sms-toolbar-right       { justify-content: space-between; }
    .sms-btn-primary         { font-size: 0.95rem; }
    .col-phone               { width: 140px; }
    .col-status              { width: 120px; }
}

/* ══════════════════════════════════════════════════════════════
   CHAT INTERFACE
   ══════════════════════════════════════════════════════════════ */

/* Layout */
.sms-chat-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    height: calc(100vh - 280px);
    min-height: 500px;
    background: var(--sms-card);
    border: 1px solid var(--sms-border);
    border-radius: 20px;
    overflow: hidden;
}

/* ── Conversation panel (left) ───────────────────────────────── */

.sms-conv-panel {
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--sms-border);
    background: rgba(10,14,39,0.3);
}

.sms-conv-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.1rem;
    border-bottom: 1px solid var(--sms-border);
}

.sms-conv-header h3 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--sms-text);
    margin: 0;
}

.sms-conv-search-wrap {
    padding: 0.65rem 0.9rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.sms-search-input {
    width: 100%;
    padding: 0.6rem 0.9rem;
    background: var(--sms-input-bg);
    border: 1px solid var(--sms-border);
    border-radius: var(--sms-radius-sm);
    color: var(--sms-text);
    font-size: 0.85rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

.sms-search-input:focus {
    border-color: var(--sms-primary);
}

.sms-conv-list {
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}

/* Conversation item */
.sms-conv-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.9rem 1.1rem;
    cursor: pointer;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    transition: background 0.15s;
    position: relative;
}

.sms-conv-item:hover    { background: rgba(255,255,255,0.04); }
.sms-conv-item.active   { background: rgba(0,102,255,0.12); border-left: 3px solid var(--sms-primary); }

.sms-conv-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--sms-primary), var(--sms-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    color: #fff;
    flex-shrink: 0;
}

.sms-conv-info {
    flex: 1;
    min-width: 0;
}

.sms-conv-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.4rem;
    margin-bottom: 0.2rem;
}

.sms-conv-name {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--sms-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sms-conv-time {
    font-size: 0.72rem;
    color: var(--sms-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

.sms-conv-preview {
    font-size: 0.8rem;
    color: var(--sms-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sms-conv-preview.unread {
    color: var(--sms-text);
    font-weight: 500;
}

.sms-unread-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--sms-primary);
    flex-shrink: 0;
}

/* Unread badge on tab */
.sms-unread-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--sms-error);
    border-radius: 9px;
    font-size: 0.7rem;
    font-weight: 700;
    color: #fff;
    margin-left: 6px;
    vertical-align: middle;
}

/* ── Thread panel (right) ────────────────────────────────────── */

.sms-thread-panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Empty state */
.sms-thread-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    color: var(--sms-muted);
    padding: 2rem;
    text-align: center;
}

.sms-thread-empty-icon {
    font-size: 3.5rem;
    opacity: 0.3;
}

/* Thread header */
.sms-thread-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.9rem 1.5rem;
    border-bottom: 1px solid var(--sms-border);
    background: rgba(10,14,39,0.2);
    flex-shrink: 0;
}

.sms-thread-contact {
    display: flex;
    align-items: center;
    gap: 0.9rem;
}

.sms-contact-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--sms-primary), var(--sms-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    color: #fff;
}

.sms-thread-name {
    font-weight: 700;
    font-size: 0.97rem;
    color: var(--sms-text);
}

.sms-thread-number {
    font-size: 0.8rem;
    color: var(--sms-muted);
    font-family: monospace;
}

/* Messages area */
.sms-messages-wrap {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.sms-messages-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Message bubbles */
.sms-msg {
    display: flex;
    flex-direction: column;
    max-width: 72%;
}

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

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

.sms-bubble {
    padding: 0.65rem 1rem;
    border-radius: 16px;
    font-size: 0.9rem;
    line-height: 1.5;
    word-break: break-word;
}

.sms-msg.out .sms-bubble {
    background: linear-gradient(135deg, var(--sms-primary), var(--sms-primary-dark));
    color: #fff;
    border-bottom-right-radius: 4px;
}

.sms-msg.in .sms-bubble {
    background: var(--sms-dark-light);
    border: 1px solid var(--sms-border);
    color: var(--sms-text);
    border-bottom-left-radius: 4px;
}

.sms-msg-time {
    font-size: 0.7rem;
    color: var(--sms-muted);
    margin-top: 0.25rem;
    padding: 0 0.25rem;
}

.sms-msg-date-divider {
    text-align: center;
    color: var(--sms-muted);
    font-size: 0.75rem;
    margin: 0.75rem 0;
    position: relative;
}

.sms-msg-date-divider::before,
.sms-msg-date-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 38%;
    height: 1px;
    background: rgba(255,255,255,0.07);
}

.sms-msg-date-divider::before { left: 0; }
.sms-msg-date-divider::after  { right: 0; }

/* Compose row */
.sms-compose-row {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--sms-border);
    background: rgba(10,14,39,0.2);
    flex-shrink: 0;
}

.sms-chat-input {
    flex: 1;
    padding: 0.7rem 1rem;
    background: var(--sms-input-bg);
    border: 1px solid var(--sms-border);
    border-radius: 20px;
    color: var(--sms-text);
    font-size: 0.9rem;
    font-family: inherit;
    resize: none;
    outline: none;
    max-height: 120px;
    overflow-y: auto;
    line-height: 1.4;
    transition: border-color 0.2s;
}

.sms-chat-input:focus {
    border-color: var(--sms-primary);
}

.sms-chat-send-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--sms-primary), var(--sms-primary-dark));
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
}

.sms-chat-send-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 16px rgba(0,102,255,0.4);
}

.sms-chat-send-btn:disabled {
    opacity: 0.4;
    transform: none;
}

/* ── Contacts tab ────────────────────────────────────────────── */

.sms-contacts-card {
    background: var(--sms-card);
    border: 1px solid var(--sms-border);
    border-radius: 20px;
    overflow: hidden;
}

.sms-contacts-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.1rem 1.5rem;
    border-bottom: 1px solid var(--sms-border);
    gap: 1rem;
    flex-wrap: wrap;
}

/* ── Modals ──────────────────────────────────────────────────── */

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

.sms-modal {
    background: var(--sms-dark-light);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 20px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 30px 80px rgba(0,0,0,0.5);
    overflow: hidden;
}

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

.sms-modal-header h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--sms-text);
    margin: 0;
}

.sms-modal-close {
    background: none;
    border: none;
    color: var(--sms-muted);
    font-size: 1.4rem;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    transition: color 0.2s;
}

.sms-modal-close:hover { color: var(--sms-text); }

.sms-modal-body   { padding: 1.5rem; }
.sms-modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--sms-border);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* Suggestions dropdown */
.sms-suggestions {
    border-radius: var(--sms-radius-sm);
    overflow: hidden;
    margin-top: 0.4rem;
}

.sms-suggestion-item {
    padding: 0.65rem 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.87rem;
    background: var(--sms-input-bg);
    border-bottom: 1px solid rgba(255,255,255,0.04);
    transition: background 0.15s;
}

.sms-suggestion-item:hover { background: rgba(0,102,255,0.12); }

.sms-suggestion-name  { color: var(--sms-text); font-weight: 500; }
.sms-suggestion-phone { color: var(--sms-muted); font-size: 0.8rem; font-family: monospace; }

/* ── Responsive ──────────────────────────────────────────────── */

@media (max-width: 768px) {
    .sms-chat-layout {
        grid-template-columns: 1fr;
        height: auto;
    }

    .sms-conv-panel {
        border-right: none;
        border-bottom: 1px solid var(--sms-border);
        max-height: 300px;
    }

    .sms-thread-panel {
        height: 60vh;
        min-height: 400px;
    }

    .sms-msg { max-width: 88%; }
}

/* -- Scroll fix -- */
.sms-thread-panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
}
.sms-thread-active {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    min-height: 0;
    position: relative;
}
.sms-messages-wrap {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    padding: 1.5rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.sms-compose-row { flex-shrink: 0; }

/* -- Delete bar -- */
.sms-delete-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: rgba(255,68,68,0.1);
    border-top: 1px solid rgba(255,68,68,0.3);
    gap: 0.75rem;
    flex-wrap: wrap;
    font-size: 0.85rem;
    color: #ff7f7f;
}
.sms-delete-bar-btns { display: flex; gap: 0.5rem; }
.sms-btn-delete {
    display: inline-block;
    padding: 0.45rem 1rem;
    background: var(--sms-error);
    border: none;
    border-radius: var(--sms-radius-sm);
    color: #fff;
    font-size: 0.82rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: opacity 0.2s;
}
.sms-btn-delete:hover { opacity: 0.85; }
.sms-conv-item.selected {
    background: rgba(255,68,68,0.08);
    border-left: 3px solid var(--sms-error);
}

/* -- New message button -- */
.sms-new-msg-btn {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--sms-primary);
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 0.5rem 1.2rem;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0,102,255,0.4);
    z-index: 10;
    white-space: nowrap;
}

/* -- New message highlight -- */
.sms-msg-new .sms-bubble { animation: highlightMsg 3s ease forwards; }
@keyframes highlightMsg {
    0%   { box-shadow: 0 0 0 3px rgba(0,217,255,0.6); }
    100% { box-shadow: none; }
}

/* -- Mail Merge Bulk Send -- */
.sms-merge-section {
    border-bottom: 1px solid var(--sms-border);
    padding: 1.25rem 1.5rem;
}
.sms-merge-section:last-of-type { border-bottom: none; }
.sms-merge-step-label {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--sms-muted);
    margin-bottom: 0.85rem;
}
.sms-merge-step-body { display: flex; flex-direction: column; gap: 0.75rem; }
.sms-merge-send-row { flex-direction: row; align-items: center; gap: 1rem; }
.sms-merge-textarea {
    width: 100%;
    min-height: 90px;
    max-height: 200px;
    padding: 0.85rem 1rem;
    background: var(--sms-input-bg);
    border: 1px solid var(--sms-border);
    border-radius: var(--sms-radius-sm);
    color: var(--sms-text);
    font-size: 0.95rem;
    font-family: inherit;
    line-height: 1.6;
    resize: none;
    outline: none;
    transition: border-color 0.2s;
}
.sms-merge-textarea:focus { border-color: var(--sms-primary); }
.sms-placeholders { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.4rem; }
.sms-placeholder-btn {
    padding: 0.3rem 0.75rem;
    background: rgba(0,102,255,0.12);
    border: 1px solid rgba(0,102,255,0.3);
    border-radius: 20px;
    color: var(--sms-secondary);
    font-size: 0.78rem;
    font-family: monospace;
    cursor: pointer;
    transition: background 0.2s;
}
.sms-placeholder-btn:hover { background: rgba(0,102,255,0.25); }
.sms-merge-template-actions { display: flex; flex-direction: column; gap: 0.6rem; }
.sms-template-list { display: flex; flex-direction: column; gap: 0.4rem; }
.sms-template-empty { color: var(--sms-muted); font-size: 0.82rem; }
.sms-template-item {
    background: rgba(10,14,39,0.4);
    border: 1px solid var(--sms-border);
    border-radius: var(--sms-radius-sm);
    padding: 0.65rem 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.sms-template-name { font-weight: 600; font-size: 0.85rem; color: var(--sms-text); min-width: 100px; }
.sms-template-preview { flex: 1; font-size: 0.78rem; color: var(--sms-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sms-template-btns { display: flex; gap: 0.4rem; flex-shrink: 0; }
.sms-preview-item { padding: 0.85rem 0; border-bottom: 1px solid rgba(255,255,255,0.06); }
.sms-preview-item:last-child { border-bottom: none; }
.sms-preview-num { font-size: 0.78rem; color: var(--sms-muted); margin-bottom: 0.3rem; }
.sms-preview-msg {
    font-size: 0.9rem;
    color: var(--sms-text);
    line-height: 1.5;
    background: rgba(0,102,255,0.06);
    border-radius: var(--sms-radius-sm);
    padding: 0.6rem 0.9rem;
}

/* -- PWA standalone / mobile full width -- */
@media (display-mode: standalone) {
    .intra-sms-wrap {
        padding: 1rem 0 0 0;
    }
    .sms-dashboard {
        max-width: 100%;
        padding: 0;
    }
    .sms-dashboard-header {
        padding: 0 0.75rem 1rem 0.75rem;
    }
    .sms-tabs {
        padding: 0 0.75rem;
    }
    .sms-chat-layout {
        border-radius: 0;
        border-left: none;
        border-right: none;
        height: calc(100vh - 140px);
    }
    .sms-compose-card,
    .sms-contacts-card {
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
    .sms-merge-section {
        padding: 1rem 0.75rem;
    }
}

/* -- Also apply on small screens in browser -- */
@media (max-width: 480px) {
    .intra-sms-wrap {
        padding: 5rem 0 0 0;
    }
    .sms-dashboard {
        max-width: 100%;
    }
    .sms-dashboard-header {
        padding: 0 0.75rem 1rem 0.75rem;
    }
    .sms-tabs {
        padding: 0 0.75rem;
    }
    .sms-chat-layout {
        border-radius: 0;
        border-left: none;
        border-right: none;
        height: calc(100vh - 160px);
    }
    .sms-compose-card,
    .sms-contacts-card {
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
}

/* -- Mobile full width override -- */
@media (max-width: 600px), (display-mode: standalone) {

    /* Remove theme page wrapper padding */
    .page-content,
    .entry-content,
    .post-content,
    .site-content,
    .content-area,
    .page .wp-block-post-content,
    main article,
    main .entry-content,
    #content,
    #main,
    #page {
        padding: 0 !important;
        margin: 0 !important;
        max-width: 100% !important;
        width: 100% !important;
    }

    /* Remove our own wrapper padding */
    .intra-sms-wrap {
        padding: 4.5rem 0 0 0 !important;
        min-height: 100vh;
    }

    /* Auth card full width */
    .sms-auth-card {
        max-width: 100% !important;
        width: 100% !important;
        border-radius: 0 !important;
        border-left: none !important;
        border-right: none !important;
        margin: 0 !important;
        padding: 2rem 1.25rem !important;
    }

    /* Dashboard full width */
    .sms-dashboard {
        max-width: 100% !important;
        padding: 0 0.75rem !important;
    }

    .sms-chat-layout {
        border-radius: 0 !important;
        border-left: none !important;
        border-right: none !important;
        height: calc(100vh - 150px) !important;
    }

    .sms-compose-card,
    .sms-contacts-card {
        border-radius: 0 !important;
        border-left: none !important;
        border-right: none !important;
    }
}

/* -- Remove theme page wrapper on mobile and PWA -- */
@media (max-width: 600px), (display-mode: standalone) {

    .contact-form-section {
        padding: 0 !important;
        background: var(--sms-dark) !important;
    }

    .contact-form-container {
        max-width: 100% !important;
        width: 100% !important;
        background: transparent !important;
        border: none !important;
        border-radius: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        box-shadow: none !important;
    }

    .page-content {
        padding: 0 !important;
    }

    .page-hero {
        display: none !important;
    }

    .intra-sms-wrap {
        padding: 4.5rem 0 0 0 !important;
    }

    .sms-auth-card {
        max-width: 100% !important;
        border-radius: 0 !important;
        border-left: none !important;
        border-right: none !important;
        margin: 0 !important;
        box-shadow: none !important;
    }

    .sms-dashboard {
        max-width: 100% !important;
        padding: 0 0.75rem !important;
    }

    .sms-chat-layout {
        border-radius: 0 !important;
        border-left: none !important;
        border-right: none !important;
        height: calc(100vh - 150px) !important;
    }

    .sms-compose-card,
    .sms-contacts-card {
        border-radius: 0 !important;
        border-left: none !important;
        border-right: none !important;
    }
}

/* -- MMS media in chat bubbles -- */
.sms-mms-img {
    max-width: 100%;
    max-height: 260px;
    border-radius: 10px;
    display: block;
    cursor: pointer;
    margin-top: 0.25rem;
}
.sms-mms-video {
    max-width: 100%;
    max-height: 260px;
    border-radius: 10px;
    display: block;
    margin-top: 0.25rem;
}
.sms-mms-file {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.9rem;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: var(--sms-radius-sm);
    color: var(--sms-text);
    text-decoration: none;
    font-size: 0.85rem;
    margin-top: 0.25rem;
}
.sms-mms-file:hover { background: rgba(255,255,255,0.15); }

/* -- Slim footer for PWA and mobile -- */
@media (max-width: 600px), (display-mode: standalone) {
    .footer-content {
        grid-template-columns: 1fr !important;
    }
    .footer-section {
        display: none !important;
    }
    .footer-brand p {
        display: none !important;
    }
    .footer-brand {
        text-align: center;
        padding-bottom: 0.5rem;
    }
    .footer-bottom {
        justify-content: center !important;
        flex-direction: column !important;
        align-items: center !important;
        gap: 0.5rem;
        text-align: center;
    }
    .social-links {
        display: none !important;
    }
    footer {
        padding: 1.25rem 5% 1.25rem !important;
    }
}

/* -- Chat tab notification flash -- */
@keyframes tabPulse {
    0%   { background: var(--sms-tab-bg, rgba(255,255,255,0.05)); }
    50%  { background: rgba(0,102,255,0.35); }
    100% { background: var(--sms-tab-bg, rgba(255,255,255,0.05)); }
}
.sms-tab.sms-tab-notify {
    animation: tabPulse 1.2s ease infinite;
    color: #fff !important;
}

/* -- Shared inbox sender label -- */
.sms-msg-sender {
    font-size: 0.72rem;
    color: var(--sms-muted);
    margin-bottom: 0.2rem;
    padding-left: 0.25rem;
}
.sms-msg.out .sms-msg-sender {
    text-align: right;
    padding-right: 0.25rem;
    padding-left: 0;
}

/* -- Particle background -- */
#sms-particle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.intra-sms-wrap {
    position: relative;
    z-index: 1;
}
