/* ===========================================
   GEX Apollo - Notion-style Stylesheet v5
   Light por padrão + Dark via .dark-mode no body
   Accent: azul (Apollo) | Tipografia: Inter + JetBrains Mono
   =========================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* =====================================================
   LIGHT THEME (default) — estilo Notion
   ===================================================== */
:root {
    --bg:              #ffffff;
    --bg-elevated:     #fbfbfa;
    --surface:         #ffffff;
    --surface-hover:   #f7f7f5;
    --surface-active:  #f1f1ef;

    --border:          rgba(55, 53, 47, 0.09);
    --border-hover:    rgba(55, 53, 47, 0.16);
    --border-strong:   rgba(55, 53, 47, 0.2);

    --text:            #37352f;
    --text-secondary:  #4d4a44;
    --text-muted:      #787774;
    --text-dim:        #9b9a97;

    --sidebar-bg:      #f7f7f5;
    --sidebar-text:    #37352f;
    --sidebar-text-muted: #787774;
    --sidebar-hover:   rgba(55, 53, 47, 0.06);
    --sidebar-active:  rgba(55, 53, 47, 0.10);

    --primary:         #1a73e8;
    --primary-hover:   #1557b0;
    --primary-dim:     #1557b0;
    --primary-light:   #e8f0fe;
    --primary-glow:    rgba(26, 115, 232, 0.15);
    --primary-text:    #1a73e8;

    --success:         #0f9d58;
    --success-bg:      #e6f4ea;
    --success-text:    #137333;
    --success-border:  #b7e1cd;
    --warning:         #f9ab00;
    --warning-bg:      #fef7e0;
    --warning-text:    #b06000;
    --warning-border:  #fde293;
    --danger:          #d93025;
    --danger-bg:       #fce8e6;
    --danger-text:     #c5221f;
    --danger-border:   #f4c7c3;
    --info:            #1a73e8;
    --info-bg:         #e8f0fe;
    --info-text:       #185abc;
    --info-border:     #aecbfa;

    --phone-bezel:     #2c2c30;
    --phone-screen:    #f5f5f7;
    --phone-bubble:    #ffffff;

    --sidebar-width:   240px;
    --radius-sm:       4px;
    --radius:          6px;
    --radius-lg:       8px;
    --radius-xl:       12px;

    --shadow-sm:       0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow:          0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-lg:       0 8px 24px rgba(0, 0, 0, 0.10);
    --shadow-modal:    0 24px 48px rgba(0, 0, 0, 0.18);
    --glow:            0 0 0 3px var(--primary-glow);

    --transition:      all 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* =====================================================
   DARK THEME — body.dark-mode
   ===================================================== */
body.dark-mode {
    --bg:              #191919;
    --bg-elevated:     #202020;
    --surface:         #2a2a2a;
    --surface-hover:   #2f2f2f;
    --surface-active:  #373737;

    --border:          rgba(255, 255, 255, 0.08);
    --border-hover:    rgba(255, 255, 255, 0.14);
    --border-strong:   rgba(255, 255, 255, 0.2);

    --text:            #ebebeb;
    --text-secondary:  #cccccc;
    --text-muted:      #9b9b9b;
    --text-dim:        #6b6b6b;

    --sidebar-bg:      #202020;
    --sidebar-text:    #ebebeb;
    --sidebar-text-muted: #9b9b9b;
    --sidebar-hover:   rgba(255, 255, 255, 0.05);
    --sidebar-active:  rgba(255, 255, 255, 0.10);

    --primary:         #4d8af0;
    --primary-hover:   #6da3f5;
    --primary-dim:     #2563eb;
    --primary-light:   rgba(77, 138, 240, 0.15);
    --primary-glow:    rgba(77, 138, 240, 0.25);
    --primary-text:    #6da3f5;

    --success-bg:      rgba(15, 157, 88, 0.15);
    --success-text:    #6ee7b7;
    --success-border:  rgba(15, 157, 88, 0.3);
    --warning-bg:      rgba(249, 171, 0, 0.15);
    --warning-text:    #fcd34d;
    --warning-border:  rgba(249, 171, 0, 0.3);
    --danger-bg:       rgba(217, 48, 37, 0.15);
    --danger-text:     #fca5a5;
    --danger-border:   rgba(217, 48, 37, 0.3);
    --info-bg:         rgba(26, 115, 232, 0.15);
    --info-text:       #93c5fd;
    --info-border:     rgba(26, 115, 232, 0.3);

    --phone-bezel:     #0a0a0a;
    --phone-screen:    #1a1a1a;
    --phone-bubble:    #2a2a2a;

    --shadow-sm:       0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow:          0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg:       0 12px 32px rgba(0, 0, 0, 0.5);
    --shadow-modal:    0 24px 48px rgba(0, 0, 0, 0.6);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.5;
    transition: background-color 200ms ease, color 200ms ease;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--border-hover);
    border-radius: 5px;
}
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

code, pre, .mono, .stat-card .stat-value, .api-key-box code {
    font-family: 'JetBrains Mono', 'Menlo', Monaco, Consolas, monospace;
    font-feature-settings: 'tnum' 1;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}
a:hover { color: var(--primary-hover); }

.main-content {
    animation: fadeIn 200ms ease-out;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(2px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ========= Login ========= */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-elevated);
    padding: 20px;
}
.login-card {
    background: var(--surface);
    padding: 40px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
}
.login-card h1 {
    font-size: 22px;
    font-weight: 600;
    margin: 0 0 8px 0;
    text-align: center;
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    letter-spacing: -0.02em;
}
.login-card h1 i { color: var(--primary); font-size: 24px; }
.login-card .subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 30px;
    font-size: 13px;
}

/* ========= Layout ========= */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    overflow-y: auto;
    transition: background-color 200ms ease, border-color 200ms ease;
}

.sidebar-brand {
    padding: 18px 20px;
    font-size: 15px;
    font-weight: 600;
    color: var(--sidebar-text);
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--border);
    letter-spacing: -0.01em;
}
.sidebar-brand i {
    font-size: 18px;
    color: var(--primary);
}

.sidebar-nav {
    flex: 1;
    padding: 10px 8px;
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.sidebar-nav a {
    padding: 7px 10px;
    color: var(--sidebar-text-muted);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: var(--transition);
}
.sidebar-nav a:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text);
}
.sidebar-nav a.active {
    background: var(--sidebar-active);
    color: var(--sidebar-text);
    font-weight: 600;
}
.sidebar-nav a i {
    font-size: 15px;
    width: 18px;
    text-align: center;
    opacity: 0.85;
}
.sidebar-nav a.active i { opacity: 1; color: var(--primary); }

.sidebar-divider {
    height: 1px;
    background: var(--border);
    margin: 12px 8px;
}

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--border);
}
.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
}
.avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
    flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--sidebar-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.logout-link {
    font-size: 11.5px;
    color: var(--text-dim);
    text-decoration: none;
    transition: var(--transition);
}
.logout-link:hover { color: var(--danger); }

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 32px 40px;
    max-width: calc(100vw - var(--sidebar-width));
    background: var(--bg);
}

/* ========= Theme Toggle ========= */
.theme-toggle {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: var(--radius);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    padding: 0;
    font-size: 15px;
}
.theme-toggle:hover {
    background: var(--surface-hover);
    color: var(--text);
    border-color: var(--border-hover);
}
.theme-toggle .icon-dark { display: none; }
.theme-toggle .icon-light { display: inline; }
body.dark-mode .theme-toggle .icon-dark { display: inline; }
body.dark-mode .theme-toggle .icon-light { display: none; }

/* ========= Page header ========= */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 16px;
}
.page-header h1 {
    font-size: 28px;
    font-weight: 700;
    margin: 0;
    color: var(--text);
    letter-spacing: -0.02em;
    line-height: 1.2;
}
.page-header .subtitle {
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 6px;
}

/* ========= Cards ========= */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: none;
    transition: var(--transition);
}
.card:hover { border-color: var(--border-hover); }
.card-body { padding: 20px; }
.card-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    background: transparent;
    font-weight: 600;
    color: var(--text);
    font-size: 14px;
}

/* ========= Stat cards ========= */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 28px;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    transition: var(--transition);
    position: relative;
}
.stat-card:hover {
    border-color: var(--border-hover);
}
.stat-card .stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
}
.stat-card .stat-value {
    font-size: 28px;
    font-weight: 700;
    margin-top: 4px;
    color: var(--text);
    letter-spacing: -0.02em;
    line-height: 1.1;
    font-family: 'JetBrains Mono', monospace;
}
.stat-card .stat-change {
    font-size: 12px;
    margin-top: 8px;
    color: var(--text-muted);
}
.stat-icon {
    width: 32px; height: 32px;
    border-radius: var(--radius);
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    float: right;
}

/* ========= Tables ========= */
.table-wrap, .card > .table-responsive {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
table.table {
    margin: 0;
    font-size: 13.5px;
    color: var(--text);
    border-collapse: collapse;
    width: 100%;
}
table.table thead th {
    background: var(--bg-elevated);
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 10.5px;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--border);
    border-top: none;
    padding: 12px 16px;
    text-align: left;
}
table.table tbody td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--border);
    border-top: none;
    vertical-align: middle;
    background: transparent;
    color: var(--text);
}
table.table tbody tr:last-child td { border-bottom: 0; }
table.table tbody tr { transition: background 100ms ease; }
table.table tbody tr:hover td { background: var(--surface-hover); }

/* ========= Badges ========= */
.badge, .badge-status {
    font-size: 10.5px;
    padding: 3px 9px;
    border-radius: 999px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: 1px solid transparent;
    line-height: 1.4;
}
.badge::before, .badge-status::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
}
.badge-status.status-sent,
.badge-status.status-delivered,
.badge-status.status-active {
    background: var(--success-bg);
    color: var(--success-text);
    border-color: var(--success-border);
}
.badge-status.status-queued,
.badge-status.status-sending {
    background: var(--info-bg);
    color: var(--info-text);
    border-color: var(--info-border);
}
.badge-status.status-scheduled {
    background: var(--warning-bg);
    color: var(--warning-text);
    border-color: var(--warning-border);
}
.badge-status.status-failed,
.badge-status.status-undelivered,
.badge-status.status-opted_out {
    background: var(--danger-bg);
    color: var(--danger-text);
    border-color: var(--danger-border);
}
.badge-status.status-draft {
    background: var(--surface-active);
    color: var(--text-muted);
    border-color: var(--border);
}

/* ========= Buttons ========= */
.btn {
    font-weight: 500;
    font-size: 13.5px;
    padding: 7px 14px;
    border-radius: var(--radius);
    transition: var(--transition);
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    line-height: 1.4;
}
.btn-primary,
.btn-primary:not(:disabled):not(.disabled) {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #fff !important;
    font-weight: 500 !important;
    box-shadow: none !important;
}
.btn-primary:hover, .btn-primary:focus {
    background: var(--primary-hover) !important;
    border-color: var(--primary-hover) !important;
    box-shadow: 0 2px 8px var(--primary-glow) !important;
}
.btn-outline-secondary, .btn-secondary {
    background: var(--surface) !important;
    border: 1px solid var(--border-hover) !important;
    color: var(--text-secondary) !important;
}
.btn-outline-secondary:hover, .btn-secondary:hover {
    background: var(--surface-hover) !important;
    border-color: var(--border-strong) !important;
    color: var(--text) !important;
}
.btn-danger {
    background: var(--danger) !important;
    border-color: var(--danger) !important;
    color: #fff !important;
}
.btn-danger:hover {
    background: var(--danger-text) !important;
    border-color: var(--danger-text) !important;
}
.btn-success {
    background: var(--success) !important;
    border-color: var(--success) !important;
    color: #fff !important;
}
.btn-lg { padding: 10px 20px; font-size: 14px; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ========= SMS Composer ========= */
.sms-composer {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 24px;
}
@media (max-width: 900px) { .sms-composer { grid-template-columns: 1fr; } }
.sms-textarea {
    width: 100%;
    min-height: 180px;
    padding: 14px;
    background: var(--surface);
    border: 1px solid var(--border-hover);
    border-radius: var(--radius);
    font-family: 'Inter', inherit;
    font-size: 14px;
    color: var(--text);
    resize: vertical;
    transition: var(--transition);
}
.sms-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--glow);
}
.sms-meta {
    display: flex;
    justify-content: space-between;
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 8px;
    padding: 0 4px;
    font-family: 'JetBrains Mono', monospace;
}
.sms-meta .segments-warning { color: var(--warning-text); }

.phone-preview {
    background: var(--phone-screen);
    border-radius: 32px;
    padding: 24px 16px;
    border: 10px solid var(--phone-bezel);
    max-width: 280px;
    margin: 0 auto;
    min-height: 400px;
    position: relative;
    box-shadow: var(--shadow-lg);
}
.phone-preview::before {
    content: '';
    position: absolute;
    top: 10px; left: 50%;
    transform: translateX(-50%);
    width: 50px; height: 4px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}
.phone-preview .from {
    text-align: center;
    font-size: 11px;
    color: var(--text-dim);
    margin-bottom: 16px;
    margin-top: 16px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
}
.phone-bubble {
    background: var(--phone-bubble);
    color: var(--text);
    padding: 12px 16px;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    font-size: 14px;
    line-height: 1.45;
    word-wrap: break-word;
    white-space: pre-wrap;
    max-width: 85%;
    box-shadow: var(--shadow-sm);
}
.phone-bubble.empty {
    color: var(--text-dim);
    font-style: italic;
    background: transparent;
    border: 1px dashed var(--border-hover);
}

/* ========= Forms ========= */
.form-label {
    font-weight: 500;
    font-size: 12.5px;
    margin-bottom: 6px;
    color: var(--text-secondary);
}
.form-control, .form-select {
    background: var(--surface) !important;
    border: 1px solid var(--border-hover) !important;
    border-radius: var(--radius) !important;
    color: var(--text) !important;
    font-size: 13.5px !important;
    padding: 7px 12px !important;
    transition: var(--transition);
}
.form-control::placeholder { color: var(--text-dim); }
.form-control:focus, .form-select:focus {
    background: var(--surface) !important;
    border-color: var(--primary) !important;
    box-shadow: var(--glow) !important;
    color: var(--text) !important;
}
.form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23787774' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    background-size: 14px 14px !important;
    padding-right: 32px !important;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}
body.dark-mode .form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%239b9b9b' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    background-size: 14px 14px !important;
}
.form-hint {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 4px;
}
.form-check-input {
    background: var(--surface);
    border: 1px solid var(--border-hover);
}
.form-check-input:checked {
    background: var(--primary);
    border-color: var(--primary);
}
.form-check-label { color: var(--text-secondary); font-size: 13.5px; }
.input-group-text {
    background: var(--bg-elevated) !important;
    border-color: var(--border-hover) !important;
    color: var(--text-muted) !important;
    font-size: 13px;
}

/* ========= Alerts ========= */
.alert {
    border-radius: var(--radius);
    border-width: 1px;
    padding: 12px 16px;
    font-size: 13px;
}
.alert-info {
    background: var(--info-bg) !important;
    border-color: var(--info-border) !important;
    color: var(--info-text) !important;
}
.alert-success {
    background: var(--success-bg) !important;
    border-color: var(--success-border) !important;
    color: var(--success-text) !important;
}
.alert-warning {
    background: var(--warning-bg) !important;
    border-color: var(--warning-border) !important;
    color: var(--warning-text) !important;
}
.alert-danger {
    background: var(--danger-bg) !important;
    border-color: var(--danger-border) !important;
    color: var(--danger-text) !important;
}

/* ========= API key display ========= */
.api-key-box {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 14px;
    font-family: 'JetBrains Mono', Menlo, Monaco, Consolas, monospace;
    font-size: 12.5px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
}
.api-key-box code {
    flex: 1;
    color: var(--text);
    background: transparent;
    padding: 0;
    word-break: break-all;
}

/* ========= Empty state ========= */
.empty-state {
    text-align: center;
    padding: 64px 20px;
    color: var(--text-muted);
}
.empty-state i {
    font-size: 44px;
    display: block;
    margin-bottom: 16px;
    color: var(--text-dim);
    opacity: 0.5;
}
.empty-state h3 {
    font-size: 16px;
    color: var(--text);
    margin-bottom: 8px;
    font-weight: 600;
}
.empty-state p {
    margin-bottom: 20px;
    font-size: 13.5px;
}

/* ========= Modals ========= */
.modal-content {
    background: var(--surface) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-lg) !important;
    color: var(--text);
    box-shadow: var(--shadow-modal);
}
.modal-header {
    border-bottom: 1px solid var(--border) !important;
    padding: 16px 20px;
}
.modal-body { padding: 20px; }
.modal-footer {
    border-top: 1px solid var(--border) !important;
    padding: 12px 20px;
}
.modal-title { color: var(--text); font-weight: 600; font-size: 15px; }
body.dark-mode .btn-close {
    filter: invert(1) opacity(0.7);
}
body.dark-mode .btn-close:hover { filter: invert(1) opacity(1); }

/* ========= List group ========= */
.list-group-item {
    background: transparent !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
    padding: 12px 16px;
}
.list-group-item-action:hover {
    background: var(--surface-hover) !important;
    color: var(--text) !important;
}

/* ========= Accordion ========= */
.accordion-item {
    background: var(--surface) !important;
    border: 1px solid var(--border) !important;
}
.accordion-button {
    background: var(--surface) !important;
    color: var(--text) !important;
    box-shadow: none !important;
}
.accordion-button:not(.collapsed) {
    background: var(--bg-elevated) !important;
    color: var(--text) !important;
}
body.dark-mode .accordion-button::after {
    filter: invert(1) opacity(0.7);
}
.accordion-body { background: var(--bg) !important; }

/* ========= Pagination ========= */
.pagination .page-link {
    background: var(--surface) !important;
    border: 1px solid var(--border) !important;
    color: var(--text-secondary) !important;
    padding: 6px 12px;
    font-size: 13px;
    transition: var(--transition);
}
.pagination .page-link:hover {
    background: var(--surface-hover) !important;
    color: var(--text) !important;
}
.pagination .page-item.active .page-link {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #fff !important;
    font-weight: 600;
}
.pagination .page-item.disabled .page-link {
    background: var(--bg-elevated) !important;
    color: var(--text-dim) !important;
}

/* ========= Pre / code blocks ========= */
pre {
    background: var(--bg-elevated) !important;
    border: 1px solid var(--border) !important;
    color: var(--text) !important;
    border-radius: var(--radius) !important;
    padding: 12px 14px;
    font-size: 12.5px;
    font-family: 'JetBrains Mono', monospace;
}

/* ========= Dropdown ========= */
.dropdown-menu {
    background: var(--surface) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-lg) !important;
    padding: 4px;
}
.dropdown-item {
    color: var(--text-secondary) !important;
    padding: 7px 12px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    transition: var(--transition);
}
.dropdown-item:hover, .dropdown-item:focus {
    background: var(--surface-hover) !important;
    color: var(--text) !important;
}
.dropdown-divider { border-color: var(--border) !important; }

/* ========= Utilities ========= */
.text-muted { color: var(--text-muted) !important; }
.text-success { color: var(--success-text) !important; }
.text-danger { color: var(--danger-text) !important; }
.text-warning { color: var(--warning-text) !important; }
.text-info { color: var(--info-text) !important; }

.vr {
    background-color: var(--border);
    opacity: 1;
}

:focus-visible { outline: none; }

#controlRoom * { box-sizing: border-box; }

/* ========= Responsive ========= */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 200ms cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 100;
    }
    .sidebar.open { transform: translateX(0); }
    .main-content {
        margin-left: 0;
        padding: 20px 16px;
        max-width: 100vw;
    }
    .page-header h1 { font-size: 22px; }
    .stat-card .stat-value { font-size: 24px; }
}
/* ============================================================================
   APOLLO SMS — MOBILE RESPONSIVE
   Append this to the END of /var/www/apollo/public/assets/css/app.css
   Only affects screens below 768px — desktop stays untouched.
   ============================================================================ */

/* --- Mobile hamburger toggle button (injected via JS) --- */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 1100;
    background: var(--bg-surface, #fff);
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

@media (max-width: 768px) {

    /* --- Show hamburger --- */
    .mobile-menu-btn {
        display: block;
    }

    /* --- Sidebar: off-canvas on mobile --- */
    .sidebar {
        position: fixed !important;
        top: 0;
        left: -280px;
        width: 260px;
        height: 100vh;
        z-index: 1050;
        transition: left 0.25s ease;
        box-shadow: none;
    }

    .sidebar.open {
        left: 0;
        box-shadow: 4px 0 20px rgba(0,0,0,0.15);
    }

    /* Backdrop when sidebar is open */
    .sidebar-backdrop {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0,0,0,0.3);
        z-index: 1040;
    }

    .sidebar-backdrop.show {
        display: block;
    }

    /* --- Main content: full width --- */
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
        padding-top: 56px; /* space for hamburger */
    }

    .app-shell {
        flex-direction: column;
    }

    /* --- Container padding --- */
    .container-fluid {
        padding-left: 12px !important;
        padding-right: 12px !important;
        padding-top: 8px !important;
    }

    /* --- Page headers --- */
    .container-fluid > .d-flex.justify-content-between {
        flex-direction: column;
        gap: 12px;
    }

    .container-fluid h1.h3 {
        font-size: 1.2rem;
    }

    /* --- Tables: horizontal scroll --- */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table th, .table td {
        white-space: nowrap;
        font-size: 0.8rem;
        padding: 8px 10px;
    }

    /* Hide less important columns on mobile */
    .table .d-none-mobile {
        display: none !important;
    }

    /* --- Cards grid: single column --- */
    .row.g-3 > [class*="col-md"],
    .row.g-3 > [class*="col-lg"] {
        flex: 0 0 100%;
        max-width: 100%;
    }

    /* --- Modals: full width on mobile --- */
    .modal-dialog {
        margin: 8px;
        max-width: calc(100vw - 16px);
    }

    .modal-lg {
        max-width: calc(100vw - 16px);
    }

    /* --- Buttons: stack on mobile --- */
    .d-flex.gap-2 {
        flex-wrap: wrap;
    }

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

    /* --- Alerts: tighter --- */
    .alert {
        padding: 8px 12px;
        font-size: 0.85rem;
    }

    /* --- Breadcrumbs: smaller --- */
    .breadcrumb {
        font-size: 0.75rem;
    }

    /* --- Cards: tighter padding --- */
    .card-body {
        padding: 12px;
    }

    /* --- Form elements --- */
    .form-control-sm, .form-select-sm {
        font-size: 0.85rem;
    }

    /* --- Flow editor: mobile warning --- */
    .editor-shell {
        position: relative;
    }

    .editor-palette {
        display: none;
    }

    .editor-props {
        display: none;
    }

    .editor-canvas {
        width: 100% !important;
    }

    .editor-body {
        flex-direction: column;
    }

    .editor-topbar {
        flex-wrap: wrap;
        gap: 8px;
        padding: 8px;
    }

    .editor-topbar .flow-name-input {
        font-size: 0.95rem;
        min-width: 120px;
    }

    .editor-bottombar {
        flex-direction: column;
        gap: 8px;
        padding: 8px;
    }

    .editor-bottombar .d-flex {
        flex-wrap: wrap;
    }

    /* Mobile banner for editor */
    .editor-canvas::before {
        content: "Tap and zoom to view. Use desktop for full editing.";
        display: block;
        background: #fef3c7;
        color: #92400e;
        text-align: center;
        padding: 6px 12px;
        font-size: 0.75rem;
        border-bottom: 1px solid #fcd34d;
    }

    /* --- Pagination --- */
    .pagination {
        flex-wrap: wrap;
    }

    /* --- Flow run view: stack columns --- */
    .row.g-4 > .col-lg-4,
    .row.g-4 > .col-lg-8 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    /* --- Dropdown menus --- */
    .dropdown-menu {
        font-size: 0.85rem;
    }

    /* --- Sidebar user chip --- */
    .sidebar-footer {
        padding: 12px;
    }

    /* --- Badge sizing --- */
    .badge {
        font-size: 0.7rem;
    }

    /* --- Custom fields / templates tables: hide description column --- */
    .table th:nth-child(5),
    .table td:nth-child(5) {
        display: none;
    }

    /* --- Input groups tighter --- */
    .input-group-sm > .form-control,
    .input-group-sm > .form-select {
        font-size: 0.8rem;
    }

    /* --- Bottom spacing for fixed elements --- */
    body {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* --- Small phones (below 480px) --- */
@media (max-width: 480px) {
    .container-fluid h1.h3 {
        font-size: 1.05rem;
    }

    .table th, .table td {
        font-size: 0.75rem;
        padding: 6px 8px;
    }

    .btn {
        font-size: 0.78rem;
    }

    .card-title {
        font-size: 1rem;
    }

    .editor-topbar .flow-name-input {
        font-size: 0.85rem;
        min-width: 80px;
    }
}
