/* CANDUCODING — Clean, Modern, Glassmorphic Design System */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

/* Default Theme: Modern Clean Light SaaS */
:root,
html[data-theme="light"],
body[data-theme="light"] {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #eef2ff;
    --secondary: #7c3aed;
    
    --bg-main: #f8fafc;
    --bg-surface: rgba(255, 255, 255, 0.90);
    --bg-card: rgba(255, 255, 255, 0.94);
    --bg-card-hover: #ffffff;
    
    --border-color: #e2e8f0;
    --border-focus: rgba(79, 70, 229, 0.4);
    
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    
    --logo-gradient: linear-gradient(135deg, #1e1b4b, #4338ca);
    --nav-hover-bg: rgba(79, 70, 229, 0.06);
    --table-header-bg: #f1f5f9;
    --table-hover-bg: #f8fafc;
    
    --success: #059669;
    --success-bg: #ecfdf5;
    --warning: #d97706;
    --warning-bg: #fffbeb;
    --danger: #dc2626;
    --danger-bg: #fef2f2;
    
    --sidebar-width: 240px;
    --header-height: 64px;
    --bottom-nav-height: 60px;
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    
    --shadow-card: 0 4px 18px -2px rgba(15, 23, 42, 0.05), 0 2px 6px -1px rgba(15, 23, 42, 0.03);
    --shadow-glow: 0 0 20px rgba(79, 70, 229, 0.15);
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Optional Dark Obsidian Mode (When User Toggles to Dark) */
html[data-theme="dark"],
body[data-theme="dark"],
[data-theme="dark"] {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: rgba(99, 102, 241, 0.15);
    --secondary: #8b5cf6;
    
    --bg-main: #090d16;
    --bg-surface: rgba(17, 24, 39, 0.88);
    --bg-card: rgba(22, 31, 51, 0.90);
    --bg-card-hover: #1c2742;
    
    --border-color: rgba(255, 255, 255, 0.08);
    --border-focus: rgba(99, 102, 241, 0.5);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --logo-gradient: linear-gradient(to right, #fff, #cbd5e1);
    --nav-hover-bg: rgba(255, 255, 255, 0.04);
    --table-header-bg: rgba(0, 0, 0, 0.25);
    --table-hover-bg: rgba(255, 255, 255, 0.02);
    
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.15);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.15);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.15);
    
    --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 25px rgba(99, 102, 241, 0.25);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    -webkit-font-smoothing: antialiased;
}

html, body {
    background-color: var(--bg-main) !important;
    color: var(--text-primary) !important;
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
    transition: background-color 0.25s ease, color 0.25s ease;
}

/* Canvas Background for Brain Neural / Obsidian Network */
#candu-neural-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 0;
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
    max-width: 100%;
    position: relative;
    z-index: 1;
    background: transparent;
    overflow-x: hidden;
}

/* Sidebar (Desktop) */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-surface);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 40;
    transition: var(--transition);
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    border-bottom: 1px solid var(--border-color);
    gap: 0.75rem;
}

.logo-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: #fff;
    box-shadow: var(--shadow-glow);
}

.logo-text {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: var(--logo-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-nav {
    padding: 1.25rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.85rem;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
}

.nav-item:hover {
    background: var(--nav-hover-bg);
    color: var(--primary);
}

.nav-item.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

.nav-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Main Area */
.main-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-width: 0;
    width: calc(100% - var(--sidebar-width));
    max-width: 100%;
}

/* Header */
.topbar {
    height: var(--header-height);
    background: var(--bg-surface);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 30;
    width: 100%;
    max-width: 100%;
    transition: var(--transition);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.topbar-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.3;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 0.45rem 0.85rem;
    border-radius: var(--radius-full);
    width: 280px;
    font-size: 0.85rem;
    color: var(--text-muted);
    transition: var(--transition);
}

.search-box:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--border-focus);
}

.search-box input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    width: 100%;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Segmented Theme Switcher [ ☀️ Cerah ] [ 🌙 Gelap ] */
.candu-theme-segmented {
    display: inline-flex;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 3px;
    border-radius: var(--radius-full);
    gap: 3px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.theme-seg-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.34rem 0.78rem;
    border-radius: var(--radius-full);
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    line-height: 1.2;
}

.theme-seg-pill:hover {
    color: var(--text-primary);
    background: var(--nav-hover-bg);
}

.theme-seg-pill.active {
    background: var(--primary) !important;
    color: #ffffff !important;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.35);
}

[data-theme="dark"] .theme-seg-pill.active {
    background: var(--primary) !important;
    color: #ffffff !important;
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.45);
}

/* Legacy Theme Toggle Button (Light/Dark Switcher) */
.theme-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.42rem 0.9rem;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 600;
    transition: var(--transition);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    user-select: none;
}

.theme-toggle-btn:hover {
    border-color: var(--primary);
    box-shadow: 0 0 12px rgba(79, 70, 229, 0.18);
    transform: translateY(-1px);
}

.theme-toggle-icon {
    font-size: 0.95rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

.theme-toggle-btn:hover .theme-toggle-icon {
    transform: rotate(20deg) scale(1.15);
}

.theme-toggle-text {
    font-size: 0.8rem;
    letter-spacing: -0.01em;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
}
}

.user-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
}

/* Content */
.content-area {
    padding: 2rem;
    flex: 1;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

/* Typography & Headings */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.page-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1.25rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    color: var(--primary);
    background: var(--nav-hover-bg);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

/* Grid & Cards */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.card {
    background: var(--bg-card);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-card);
    transition: var(--transition);
}

.card:hover {
    border-color: var(--border-focus);
    box-shadow: var(--shadow-glow);
}

.card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.card-title {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.info-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.8rem;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    transition: var(--transition);
}

.info-btn:hover {
    color: var(--primary);
    background: var(--nav-hover-bg);
}

.card-value {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0.75rem;
}

/* Progress bar */
.progress-track {
    width: 100%;
    height: 6px;
    background: rgba(0, 0, 0, 0.07);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: 0.75rem;
}

[data-theme="dark"] .progress-track {
    background: rgba(255, 255, 255, 0.08);
}

.progress-fill {
    height: 100%;
    border-radius: var(--radius-full);
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    transition: width 0.4s ease;
}

.progress-fill.danger {
    background: linear-gradient(90deg, #ef4444, #dc2626) !important;
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.4) !important;
}

.progress-fill.warning {
    background: linear-gradient(90deg, #f59e0b, #d97706) !important;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.35) !important;
}

.card.card-danger {
    border: 1px solid rgba(239, 68, 68, 0.45) !important;
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.12) !important;
    background: var(--danger-bg) !important;
}

.card.card-warning {
    border: 1px solid rgba(245, 158, 11, 0.4) !important;
    box-shadow: 0 0 18px rgba(245, 158, 11, 0.10) !important;
    background: var(--warning-bg) !important;
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.65rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.status-badge.live {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.35);
}

.status-badge.active {
    background: var(--primary-light);
    color: var(--primary);
    border: 1px solid rgba(79, 70, 229, 0.35);
}

.status-badge.pending {
    background: var(--warning-bg);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.35);
}

.status-badge.failed {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.35);
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* Tabs */
.tabs-nav {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    overflow-x: auto;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.75rem 0.25rem;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    position: relative;
    white-space: nowrap;
    transition: var(--transition);
}

.tab-btn:hover {
    color: var(--primary);
}

.tab-btn.active {
    color: var(--primary);
    font-weight: 600;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
    border-radius: var(--radius-full);
}

/* Table */
.table-container {
    background: var(--bg-card);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: var(--shadow-card);
    width: 100%;
    max-width: 100%;
    position: relative;
}

.table-container::-webkit-scrollbar {
    height: 6px;
}
.table-container::-webkit-scrollbar-track {
    background: var(--table-header-bg);
}
.table-container::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 999px;
}
.table-container::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

.data-table {
    width: 100%;
    min-width: 680px;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.875rem;
}

.data-table th {
    background: var(--table-header-bg);
    padding: 0.85rem 1.25rem;
    color: var(--text-secondary);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--border-color);
}

.data-table td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    vertical-align: middle;
}

.data-table td strong {
    color: var(--text-primary) !important;
    font-weight: 700;
}

.data-table td a {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
    transition: color 0.15s ease;
}

.data-table td a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.data-table tr:hover td {
    background: var(--table-hover-bg);
    color: var(--text-primary);
}

/* Split Screen IDE */
.ide-wrapper {
    display: grid;
    grid-template-columns: 280px 1fr 1fr;
    height: calc(100vh - var(--header-height));
    overflow: hidden;
}

.ide-sidebar {
    background: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.ide-main {
    background: var(--bg-main);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
}

.ide-preview {
    background: #000;
    display: flex;
    flex-direction: column;
}

/* AI Stepper */
.stepper-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.25);
    border-radius: var(--radius-md);
    margin: 1rem 0;
}

.step-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
}

.step-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
}

.step-item.completed .step-icon {
    background: var(--success);
    color: #fff;
}

.step-item.active .step-icon {
    background: var(--primary);
    color: #fff;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.15); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}

/* ==========================================================================
   MOBILE & TABLET RESPONSIVE SYSTEM (Android & Tablets)
   ========================================================================== */

/* Bottom Nav (Mobile & Tablet) */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--bg-surface);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-color);
    z-index: 1000;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05);
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 600;
    text-decoration: none;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    flex: 1;
    max-width: 80px;
}

.mobile-nav-item:hover,
.mobile-nav-item:active {
    color: var(--text-primary);
}

.mobile-nav-item.active {
    color: var(--primary);
    font-weight: 700;
}

.mobile-nav-item svg {
    width: 20px;
    height: 20px;
    transition: transform 0.2s ease;
}

.mobile-nav-item.active svg {
    transform: scale(1.12);
    filter: drop-shadow(0 2px 8px rgba(79, 70, 229, 0.35));
}

/* TABLETS (Max Width: 1024px) */
@media (max-width: 1024px) {
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    .content-area {
        padding: 1.5rem 1.25rem;
    }
    .topbar {
        padding: 0 1.25rem;
    }
}

/* TABLETS PORTRAIT & LARGE MOBILE (Max Width: 900px) */
@media (max-width: 900px) {
    .sidebar {
        display: none !important;
    }
    .main-wrapper {
        margin-left: 0 !important;
        margin-bottom: 0;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        padding-bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px) + 1rem);
    }
    .content-area {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
    }
    .mobile-bottom-nav {
        display: flex;
    }
    .ide-wrapper {
        grid-template-columns: 1fr;
        height: auto;
    }
}

/* STANDARD TABLETS & SMARTPHONES (Max Width: 768px) */
@media (max-width: 768px) {
    .content-area {
        padding: 1.15rem 0.85rem;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    .card {
        padding: 1.15rem;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    .data-table th,
    .data-table td {
        padding: 0.75rem 0.85rem;
    }
    .data-table th {
        font-size: 0.7rem;
    }
    .table-container {
        border-radius: var(--radius-md);
        margin: 0 0 1.25rem 0;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    
    /* Banners & blueprint cards stack nicely on mobile */
    .pro-active-banner,
    .pro-upgrade-banner,
    .pro-locked-banner,
    #pending-blueprint-card {
        padding: 1rem !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    .pro-active-banner > div,
    .pro-upgrade-banner > div,
    .pro-locked-banner > div,
    #pending-blueprint-card > div {
        flex-direction: column;
        align-items: stretch !important;
        gap: 0.85rem !important;
    }
    .pro-upgrade-banner button,
    .pro-locked-banner button,
    #pending-blueprint-card button {
        width: 100%;
        justify-content: center;
    }
    
    /* Footer spacing above mobile bottom nav */
    .app-footer {
        padding: 1.25rem 1rem calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px) + 1.25rem) 1rem !important;
        text-align: center;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    .app-footer-inner {
        flex-direction: column;
        justify-content: center;
        gap: 0.5rem;
    }
    
    /* Modals Responsive */
    #qris-payment-modal,
    #create-app-modal {
        padding: 0.5rem !important;
    }
    #qris-payment-modal > div,
    .adaptive-modal-dialog {
        max-width: 100% !important;
        width: 100% !important;
        max-height: 92vh !important;
        border-radius: 16px !important;
    }
    .adaptive-modal-dialog > div:first-child {
        padding: 0.85rem 1rem !important;
    }
    .adaptive-modal-dialog > div:nth-child(2) {
        padding: 1rem !important;
    }
    #modal-stepper-pills {
        display: none !important;
    }
    
    /* Form inputs touch target without auto-zoom on Android/iOS */
    input[type="text"],
    input[type="password"],
    input[type="email"],
    textarea,
    select {
        font-size: 16px !important;
    }
}

/* SMARTPHONES & ANDROID DEVICES (Max Width: 600px) */
@media (max-width: 600px) {
    .metrics-grid {
        grid-template-columns: 1fr;
        gap: 0.85rem;
        width: 100%;
    }
    .content-area {
        padding: 0.85rem 0.65rem;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    /* Android & Mobile Topbar Header Optimization */
    .topbar {
        padding: 0 0.85rem !important;
        height: 56px !important;
        min-height: 56px !important;
        display: flex !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 0.45rem !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        position: sticky;
        top: 0;
        z-index: 40;
    }
    .topbar-left {
        display: flex !important;
        align-items: center !important;
        gap: 0.45rem !important;
        min-width: 0 !important;
        flex: 1 !important;
        overflow: hidden !important;
    }
    .topbar h2,
    .topbar-title {
        font-size: 0.95rem !important;
        font-weight: 700 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        flex: 1 !important;
        min-width: 0 !important;
        max-width: 100% !important;
        margin: 0 !important;
        line-height: 1.25 !important;
        color: var(--text-primary) !important;
    }
    .admin-badge {
        font-size: 0.62rem !important;
        padding: 0.15rem 0.45rem !important;
        flex-shrink: 0 !important;
    }
    .topbar-right {
        display: flex !important;
        align-items: center !important;
        gap: 0.35rem !important;
        flex-shrink: 0 !important;
        margin-left: auto !important;
    }
    .candu-theme-segmented {
        padding: 2px !important;
        gap: 2px !important;
        border-radius: var(--radius-full) !important;
        flex-shrink: 0 !important;
    }
    .theme-seg-pill {
        padding: 0.28rem 0.42rem !important;
        font-size: 0.78rem !important;
        line-height: 1 !important;
        gap: 0 !important;
    }
    .theme-seg-pill .theme-label {
        display: none !important;
    }
    .topbar-right .btn-primary,
    .topbar-right .btn-secondary,
    .btn-topbar-action {
        padding: 0.38rem 0.65rem !important;
        font-size: 0.74rem !important;
        font-weight: 700 !important;
        white-space: nowrap !important;
        border-radius: 8px !important;
        flex-shrink: 0 !important;
    }
    .user-badge {
        gap: 0.35rem !important;
        flex-shrink: 0 !important;
        padding: 2px 4px !important;
    }
    .user-badge .user-name-text,
    .user-badge span:not(.user-avatar) {
        display: none !important;
    }
    .user-avatar {
        width: 30px !important;
        height: 30px !important;
        font-size: 0.75rem !important;
        flex-shrink: 0 !important;
    }
    .search-box {
        flex: 1 !important;
        min-width: 0 !important;
        max-width: 165px !important;
        width: auto !important;
        padding: 0.35rem 0.65rem !important;
        font-size: 0.76rem !important;
        border-radius: var(--radius-full) !important;
    }
    .search-box input {
        font-size: 0.76rem !important;
    }
    .btn-short-text {
        display: inline !important;
    }
    .btn-full-text {
        display: none !important;
    }
    .card {
        padding: 0.95rem;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    .card-value {
        font-size: 1.3rem;
    }
}

/* COMPACT ANDROID SCREENS (Max Width: 380px) */
@media (max-width: 380px) {
    .topbar {
        padding: 0 0.6rem !important;
        gap: 0.3rem !important;
    }
    .topbar h2,
    .topbar-title {
        font-size: 0.88rem !important;
    }
    .theme-seg-pill {
        padding: 0.22rem 0.35rem !important;
        font-size: 0.72rem !important;
    }
    .topbar-right .btn-primary,
    .topbar-right .btn-secondary,
    .btn-topbar-action {
        padding: 0.32rem 0.52rem !important;
        font-size: 0.7rem !important;
    }
    .search-box {
        max-width: 130px !important;
    }
    .mobile-nav-item span {
        font-size: 0.62rem;
    }
}

/* Responsive Button Text Helpers for Desktop */
.btn-short-text {
    display: none;
}
.btn-full-text {
    display: inline;
}

/* Modern UI Toggle Switch */
.candu-toggle-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    cursor: pointer;
    user-select: none;
}

.candu-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.candu-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.candu-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #334155;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.candu-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background-color: #f8fafc;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.candu-switch input:checked + .candu-slider {
    background: linear-gradient(135deg, #10b981, #059669);
    border-color: #10b981;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.4);
}

.candu-switch input:checked + .candu-slider:before {
    transform: translateX(20px);
    background-color: #ffffff;
}

.candu-switch input:focus + .candu-slider {
    box-shadow: 0 0 1px #10b981;
}

/* Small variant for dense toolbars */
.candu-switch.sm {
    width: 34px;
    height: 18px;
}
.candu-switch.sm .candu-slider:before {
    height: 14px;
    width: 14px;
    left: 2px;
    bottom: 2px;
}
.candu-switch.sm input:checked + .candu-slider:before {
    transform: translateX(16px);
}

/* App Footer & Corporate Attribution */
.app-footer {
    padding: 1.25rem 2rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-surface);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    margin-top: auto;
}

.app-footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.app-footer strong {
    color: var(--text-primary);
    font-weight: 600;
}

.app-footer .footer-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.app-footer .footer-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.app-footer .footer-pill {
    padding: 3px 9px;
    border-radius: var(--radius-full);
    background: var(--nav-hover-bg);
    border: 1px solid var(--border-color);
    font-size: 0.72rem;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 0.85rem 1rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.72rem;
    color: var(--text-muted);
    background: var(--nav-hover-bg);
    margin-top: auto;
}

.sidebar-footer .company-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    line-height: 1.3;
}

.sidebar-footer .company-tagline {
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Adaptive Dashboard Banners */
.pro-active-banner {
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.12), rgba(5, 150, 105, 0.16));
    border: 1px solid rgba(16, 185, 129, 0.35);
    padding: 1rem 1.4rem;
    border-radius: var(--radius-lg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
.pro-active-banner h4, .pro-active-banner strong {
    color: #059669;
}
[data-theme="dark"] .pro-active-banner h4, [data-theme="dark"] .pro-active-banner strong {
    color: #6ee7b7;
}
.pro-active-banner p {
    color: #047857;
}
[data-theme="dark"] .pro-active-banner p {
    color: #a7f3d0;
}

.pro-upgrade-banner {
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.08), rgba(124, 58, 237, 0.10));
    border: 1px solid rgba(79, 70, 229, 0.3);
    padding: 1.25rem 1.5rem;
    border-radius: var(--radius-lg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.pro-locked-banner {
    margin-bottom: 1.5rem;
    background: var(--bg-card);
    border: 1px dashed var(--border-color);
    padding: 1.15rem 1.4rem;
    border-radius: var(--radius-lg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* Adaptive Wizard Modal & Inputs */
.adaptive-modal-dialog {
    background: var(--bg-surface) !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25) !important;
    color: var(--text-primary) !important;
}

.adaptive-input {
    background: var(--bg-card) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
}
.adaptive-input:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px var(--border-focus) !important;
}

.wiz-cat-btn {
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}
.wiz-cat-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}
.wiz-cat-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.25);
}

.wiz-choice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.65rem;
}

.wiz-choice-card {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 0.85rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    cursor: pointer;
    transition: var(--transition);
}

.wiz-choice-card:hover {
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.04);
}

.wiz-choice-card.active {
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: 0 0 0 1px var(--primary);
}

.wiz-choice-card .choice-radio-circle {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    margin-top: 2px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.wiz-choice-card.active .choice-radio-circle {
    border-color: var(--primary);
    background: var(--primary);
}

.wiz-choice-card.active .choice-radio-circle::after {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #ffffff;
}

.wiz-choice-card .choice-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    margin-bottom: 2px;
}

.wiz-choice-card .choice-badge {
    font-size: 0.65rem;
    padding: 1px 6px;
    border-radius: 4px;
    background: var(--nav-hover-bg);
    color: var(--text-muted);
}

.wiz-choice-card.active .choice-badge {
    background: rgba(79, 70, 229, 0.15);
    color: var(--primary);
}

.wiz-choice-card .choice-desc {
    font-size: 0.72rem;
    color: var(--text-secondary);
    line-height: 1.35;
}

.wiz-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.65rem;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    font-size: 0.8rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
}
.wiz-checkbox-label:hover {
    border-color: var(--primary);
}

