:root {
    --bg-main: #0b0f19;
    --bg-card: #131b2e;
    --bg-hover: #1c2742;
    --border-color: #233152;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.5;
    min-height: 100vh;
}

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

.flash-app-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.flash-sidebar {
    width: 260px;
    background-color: #0d1424;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 24px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-logo {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 1px;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-logo .badge-flash {
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    color: #fff;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: bold;
}

.sidebar-nav {
    padding: 16px 12px;
    flex: 1;
    overflow-y: auto;
}

.nav-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: #64748b;
    padding: 12px 12px 6px;
    letter-spacing: 0.5px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    color: var(--text-muted);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
    transition: all 0.15s ease-in-out;
}

.nav-item:hover, .nav-item.active {
    background-color: var(--bg-card);
    color: #fff;
    text-decoration: none;
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.15) 0%, rgba(59, 130, 246, 0.05) 100%);
    border-left: 3px solid var(--primary);
    color: var(--primary);
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    font-size: 13px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Main Content */
.flash-main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

.flash-navbar {
    height: 70px;
    background-color: #0d1424;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
}

.nav-page-title {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
}

.user-role-badge {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}
.role-superadmin { background-color: rgba(139, 92, 246, 0.2); color: #a78bfa; border: 1px solid rgba(139, 92, 246, 0.4); }
.role-tenant { background-color: rgba(59, 130, 246, 0.2); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.4); }

.content-body {
    padding: 32px;
    flex: 1;
}

/* Grid & Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 22px;
    position: relative;
    overflow: hidden;
}

.stat-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 28px;
    font-weight: 800;
    color: #fff;
}

.stat-subtext {
    font-size: 12px;
    color: #64748b;
    margin-top: 4px;
}

/* Tables */
.flash-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 28px;
}

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

.card-title {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
}

.flash-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    text-align: left;
}

.flash-table th {
    background-color: rgba(13, 20, 36, 0.5);
    color: #94a3b8;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-color);
}

.flash-table td {
    padding: 14px 20px;
    border-bottom: 1px solid rgba(35, 49, 82, 0.5);
    color: #cbd5e1;
}

.flash-table tr:hover {
    background-color: var(--bg-hover);
}

/* Badges */
.badge {
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}

.badge-success { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-danger { background: rgba(239, 68, 68, 0.15); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3); }
.badge-info { background: rgba(59, 130, 246, 0.15); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.3); }
.badge-secondary { background: rgba(100, 116, 139, 0.15); color: #94a3b8; border: 1px solid rgba(100, 116, 139, 0.3); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
}

.btn-primary { background-color: var(--primary); color: #fff; }
.btn-primary:hover { background-color: var(--primary-hover); text-decoration: none; }
.btn-secondary { background-color: #334155; color: #f8fafc; }
.btn-secondary:hover { background-color: #475569; text-decoration: none; }
.btn-danger { background-color: var(--danger); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12px; }

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

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #cbd5e1;
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    background-color: #0b0f19;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: #fff;
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s ease-in-out;
}

.form-control-sm {
    padding: 6px 10px;
    font-size: 13px;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

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

/* Modals */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 999;
    align-items: center;
    justify-content: center;
}

.modal-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 100%;
    max-width: 540px;
    overflow: hidden;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
}

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

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    background-color: #0d1424;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Flash Messages */
.alert {
    padding: 14px 18px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}
.alert-success { background: rgba(16, 185, 129, 0.2); border: 1px solid rgba(16, 185, 129, 0.4); color: #34d399; }
.alert-warning { background: rgba(245, 158, 11, 0.2); border: 1px solid rgba(245, 158, 11, 0.4); color: #fbbf24; }
.alert-danger { background: rgba(239, 68, 68, 0.2); border: 1px solid rgba(239, 68, 68, 0.4); color: #f87171; }
.alert-info { background: rgba(59, 130, 246, 0.2); border: 1px solid rgba(59, 130, 246, 0.4); color: #60a5fa; }

/* Slide-in Channels Drawer */
.flash-drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(3px);
    z-index: 1040;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease-in-out;
}
.flash-drawer-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.flash-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 520px;
    max-width: 95vw;
    height: 100vh;
    background-color: #0f172a;
    border-left: 1px solid #1e293b;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.7);
    z-index: 1050;
    transform: translateX(100%);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
}
.flash-drawer.active {
    transform: translateX(0);
}

.flash-drawer-header {
    padding: 18px 22px;
    background: #090e17;
    border-bottom: 1px solid #1e293b;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.flash-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.flash-drawer-footer {
    padding: 14px 20px;
    background: #090e17;
    border-top: 1px solid #1e293b;
    display: flex;
    justify-content: flex-end;
}

/* KPI Summary Cards */
.drawer-kpi-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}
.drawer-kpi-card {
    padding: 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    text-align: center;
}
.drawer-kpi-card.kpi-approved {
    background: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.25);
}
.drawer-kpi-card.kpi-pending {
    background: rgba(245, 158, 11, 0.08);
    border-color: rgba(245, 158, 11, 0.25);
}
.drawer-kpi-card.kpi-rejected {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.25);
}
.drawer-kpi-value {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.2;
}
.drawer-kpi-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

/* Drawer Filter Tabs */
.drawer-tabs {
    display: flex;
    background: #090e17;
    padding: 4px;
    border-radius: 8px;
    border: 1px solid #1e293b;
    gap: 4px;
}
.drawer-tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: #94a3b8;
    padding: 6px 8px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
}
.drawer-tab-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}
.drawer-tab-btn.active {
    background: #1e293b;
    color: #38bdf8;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* Channel Card inside Drawer */
.channel-status-card {
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 8px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: transform 0.15s, border-color 0.15s;
}
.channel-status-card:hover {
    border-color: rgba(255, 255, 255, 0.16);
    transform: translateY(-1px);
}
.channel-status-card.border-approved {
    border-left: 3px solid #10b981;
}
.channel-status-card.border-pending {
    border-left: 3px solid #f59e0b;
}
.channel-status-card.border-rejected {
    border-left: 3px solid #ef4444;
}
.channel-status-card.border-error {
    border-left: 3px solid #ef4444;
}
.channel-status-card.border-missing {
    border-left: 3px solid #64748b;
}

/* WhatsApp Message Preview Bubble */
.wa-preview-box {
    background: #0b141a;
    background-image: radial-gradient(#1f2c34 1px, transparent 1px);
    background-size: 16px 16px;
    padding: 24px;
    border-radius: 12px;
    display: flex;
    justify-content: center;
}
.wa-bubble {
    background: #202c33;
    color: #e9edef;
    max-width: 360px;
    border-radius: 8px;
    border-top-left-radius: 0;
    padding: 10px 14px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.3);
    font-size: 13.5px;
    line-height: 1.45;
    position: relative;
    word-break: break-word;
}
.wa-bubble-header {
    font-weight: 700;
    margin-bottom: 6px;
    color: #fff;
}
.wa-bubble-body {
    white-space: pre-wrap;
}
.wa-bubble-footer {
    font-size: 11px;
    color: #8696a0;
    margin-top: 6px;
}
.wa-bubble-time {
    text-align: right;
    font-size: 10px;
    color: #8696a0;
    margin-top: 4px;
}
.wa-btn-container {
    margin-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
}
.wa-btn {
    padding: 8px 12px;
    text-align: center;
    color: #53bdeb;
    font-size: 13px;
    font-weight: 500;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.wa-btn:last-child {
    border-bottom: none;
}

