   :root {
            --primary: #D40000;
            --secondary: #ffaa0b;
            --bg: #ffffff;
            --card: #f7f7f7;
            --muted: #8b93a7;
            --text: #222;
            --success: #2ecc71;
            --warning: #f1c40f;
            --danger: #e74c3c;
            --radius: 16px;
            --ring: 0 0 0 2px rgba(212, 0, 0, .25);
            --shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
            --glass: rgba(0, 0, 0, 0.03);
            --gradient: linear-gradient(135deg, var(--primary), var(--secondary));
            --sidebar-w: 280px;
            --sidebar-w-collapsed: 86px;
            --transition-fast: 160ms cubic-bezier(.2, .65, .3, 1);
            --transition-slow: 360ms cubic-bezier(.2, .65, .3, 1);
        }

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

        html,
        body {
            height: 100%
        }

        body {
            margin: 0;
            font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
            color: var(--text);
            background: var(--bg);
            overflow: hidden;
        }

        /* Layout */
        .app {
            display: grid;
            grid-template-columns: var(--sidebar-w) 1fr;
            grid-template-rows: 72px 1fr;
            height: 100vh;
            transition: grid-template-columns var(--transition-slow);
        }

        .app.collapsed {
            grid-template-columns: var(--sidebar-w-collapsed) 1fr
        }

        /* Sidebar */
        .sidebar {
            grid-row: 1 / span 2;
            background: rgb(243, 239, 239);
            border-right: 1px solid rgba(0, 0, 0, 0.06);
            position: relative;
            overflow: hidden;
            backdrop-filter: blur(4px);
        }

        .brand {
            display: flex;
            align-items: center;
            gap: 12px;
            height: 72px;
            padding: 0 16px;
            background: linear-gradient(180deg, rgba(255, 255, 255, 0.10), transparent);
        }

        .brand .logo {
            width: 42px;
            height: 42px;
            border-radius: 14px;
            background: var(--gradient);
            display: grid;
            place-items: center;
            color: white;
            box-shadow: 0 8px 20px rgba(212, 0, 0, .18);
        }

        .brand .title {
            font-weight: 800;
            letter-spacing: 0.6px
        }

        .brand .title span {
            opacity: .85;
            font-weight: 700
        }

        .nav {
            height: calc(100% - 72px);
            overflow-y: auto;
            padding: 12px 0px 24px 0px;
            scrollbar-width: thin
        }

        .nav-group {
            margin: 10px 0
        }

        .nav-item {
            list-style: none;
            margin: 8px 0;
            position: relative;
        }

        .link {
            display: flex;
            align-items: center;
            gap: 14px;
            padding: 12px 14px;
            border-radius: 14px;
            color: var(--text);
            text-decoration: none;
            background: transparent;
            transition: background var(--transition-fast), transform var(--transition-fast), color var(--transition-fast);
            outline: none;
            position: relative;
        }

        .link .icon {
            width: 38px;
            height: 38px;
            border-radius: 12px;
            display: grid;
            place-items: center;
            background: var(--glass);
            box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.04);
        }

        .link:hover {
            background: rgba(0, 0, 0, 0.06);
            transform: translateY(-1px)
        }

        .link:active {
            transform: translateY(0)
        }

        .link .chev {
            margin-left: auto;
            transition: transform var(--transition-fast)
        }

        .link.active {
            background: rgba(212, 0, 0, 0.18);
            box-shadow: var(--ring)
        }

        .link.active .icon {
            background: rgba(212, 0, 0, 0.22)
        }

        .submenu {
            height: 0;
            overflow: hidden;
            transition: height var(--transition-slow);
            padding-left: 24px
        }

        .submenu a {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 10px 12px;
            border-radius: 12px;
            margin: 6px 0;
            text-decoration: none;
            color: var(--text);
            background: transparent;
        }

        .submenu a:hover {
            background: rgba(0, 0, 0, 0.06)
        }

        /* Remove button border for sidebar dropdowns */
        .sidebar .nav-item > button.link {
            border: none;
            background: transparent;
            box-shadow: none;
            width: 100%;
            text-align: left;
            padding: 12px 14px;
        }

        /* Remove focus/active border for dropdowns */
        .sidebar .nav-item > button.link:focus,
        .sidebar .nav-item > button.link:active {
            border: none;
            box-shadow: none;
            outline: none;
        }
       .rotate {
    transform: rotate(180deg);
}

.link.active {
    background: rgba(212, 0, 0, 0.18);
}

.submenu a.active {
    background: rgba(0, 0, 0, 0.08);
    font-weight: 600;
}


        /* Header */
        .header {
            background: rgb(243, 239, 239);
            border-bottom: 1px solid rgba(0, 0, 0, 0.06);
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 0 16px;
            position: sticky;
            top: 0;
            z-index: 3;
            backdrop-filter: blur(6px);
        }

        .header .toggle {
            width: 42px;
            height: 42px;
            border: none;
            border-radius: 12px;
            background: var(--gradient);
            color: white;
            cursor: pointer;
            display: grid;
            place-items: center;
            box-shadow: 0 8px 20px rgba(212, 0, 0, .18);
            transition: transform var(--transition-fast);
        }

        .header .toggle:hover {
            transform: translateY(-1px)
        }

        .header .title-wrap {
            display: grid;
            gap: 2px
        }

        .header .title {
            font-weight: 800;
            letter-spacing: .4px
        }

        .header .muted {
            color: var(--muted);
            font-size: 12px
        }

        .header .search {
            margin-left: auto;
            display: flex;
            align-items: center;
            gap: 10px;
            background: rgba(0, 0, 0, 0.04);
            border: 1px solid rgba(0, 0, 0, 0.08);
            border-radius: 14px;
            padding: 6px 10px;
        }

        .header .search input {
            background: transparent;
            border: none;
            outline: none;
            color: var(--text);
            min-width: 200px
        }

        .header .pill {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            padding: 8px 12px;
            border-radius: 999px;
            background: rgba(0, 0, 0, 0.04);
            border: 1px solid rgba(0, 0, 0, 0.08);
            font-size: 12px
        }

        .header .avatar {
            width: 38px;
            height: 38px;
            border-radius: 50%;
            background: var(--gradient)
        }

        /* Main */
        .main {
            overflow-y: auto;
            padding: 22px;
            background: var(--bg);
        }

        .grid {
            display: grid;
            grid-template-columns: repeat(12, 1fr);
            gap: 18px;
        }

        .card {
            background: var(--card);
            border: 1px solid rgba(0, 0, 0, 0.08);
            border-radius: var(--radius);
            padding: 18px;
        }

        .kpi {
            display: grid;
            grid-template-columns: auto 1fr auto;
            align-items: center;
            gap: 14px
        }

        .kpi .icon {
            width: 46px;
            height: 46px;
            border-radius: 14px;
            display: grid;
            place-items: center;
            background: var(--glass)
        }

        .kpi .value {
            font-size: 26px;
            font-weight: 800
        }

        .kpi .trend {
            font-size: 12px
        }

        .kpi .trend.up {
            color: var(--success)
        }

        .kpi .trend.down {
            color: var(--danger)
        }

        .section-title {
            font-weight: 700;
            margin-bottom: 10px
        }

        /* Faux bar chart (pure CSS) */
        .bar-chart {
            display: grid;
            grid-template-columns: repeat(7, 1fr);
            gap: 10px;
            align-items: end;
            height: 160px
        }

        .bar {
            position: relative;
            height: 60px;
            border-radius: 10px;
            background: linear-gradient(180deg, var(--secondary), rgba(255,165,0,.3));
            box-shadow: inset 0 -2px 10px rgba(0, 0, 0, 0.08), 0 8px 16px rgba(0, 0, 0, 0.08);
            transition: transform var(--transition-fast)
        }

        .bar:hover {
            transform: translateY(-4px)
        }

        .bar::after {
            content: attr(data-label);
            position: absolute;
            inset: auto 0 -22px 0;
            text-align: center;
            font-size: 12px;
            color: var(--muted)
        }

        table {
            width: 100%;
            border-collapse: collapse;
            overflow: hidden;
            border-radius: 12px;
        }

        thead {
            background: rgba(0, 0, 0, 0.04)
        }

        th,
        td {
            padding: 12px 14px;
            text-align: left;
            border-bottom: 1px solid rgba(0, 0, 0, 0.06)
        }

        tbody tr {
            transition: background var(--transition-fast)
        }

        tbody tr:hover {
            background: rgba(0, 0, 0, 0.04)
        }

        .status {
            padding: 6px 10px;
            border-radius: 999px;
            font-size: 12px;
            border: 1px solid rgba(0, 0, 0, 0.08)
        }

        .status.success {
            background: rgba(46, 204, 113, 0.12);
            color: #2ecc71;
            border-color: rgba(46, 204, 113, 0.3)
        }

        .status.pending {
            background: rgba(241, 196, 15, 0.12);
            color: #FFA500;
            border-color: rgba(241, 196, 15, 0.3)
        }

        .status.failed {
            background: rgba(231, 76, 60, 0.12);
            color: #e74c3c;
            border-color: rgba(231, 76, 60, 0.3)
        }

        /* Footer */
        .footer {
            color: var(--muted);
            font-size: 12px;
            padding: 18px;
            text-align: center
        }

        /* Responsive */
        @media (max-width: 1200px) {
            .grid {
                grid-template-columns: repeat(12, 1fr)
            }
        }

        @media (max-width: 980px) {
            .app {
                grid-template-rows: 64px 1fr
            }

            .main {
                padding: 16px
            }

            .header .search input {
                min-width: 120px
            }
        }

        /* Responsive: Sidebar, Header, Main Content, Cards, Table */
        @media (max-width: 860px) {
            .app {
                grid-template-columns: 1fr;
                grid-template-rows: 56px 1fr;
                height: 100vh;
            }
            .sidebar {
                position: fixed;
                left: 0;
                top: 0;
                bottom: 0;
                width: var(--sidebar-w);
                max-width: 90vw;
                z-index: 100;
                transform: translateX(-100%);
                transition: transform var(--transition-slow);
                box-shadow: 20px 0 60px rgba(0,0,0,0.10);
                background: rgb(243, 239, 239);
                border-right: 1px solid rgba(0,0,0,0.06);
                display: flex;
                flex-direction: column;
            }
            .sidebar.open {
                transform: translateX(0);
            }
            .sidebar .close-mobile {
                display: flex !important;
            }
            .main {
                padding: 10px 4px 4px 4px;
            }
            .header {
                flex-wrap: wrap;
                flex-direction: column;
                align-items: stretch;
                gap: 4px;
                padding: 8px 6px 6px 6px;
                min-height: unset;
            }
            .header .toggle {
                order: 1;
                align-self: flex-start;
                margin-bottom: 4px;
            }
            .header .title-wrap {
                order: 2;
                width: 100%;
                min-width: 0;
                margin-bottom: 2px;
            }
            .header .title {
                font-size: 1.15rem;
                word-break: break-word;
            }
            .header .muted {
                font-size: 0.97rem;
                word-break: break-word;
            }
            .header .pill {
                order: 3;
                margin-bottom: 4px;
                width: 100%;
                justify-content: flex-start;
            }
            .header .search {
                order: 4;
                width: 100%;
                margin: 0 0 4px 0;
                flex: unset;
            }
            .header .search input {
                width: 100%;
                min-width: 0;
            }
            .header .toggle#collapseToggle,
            .header .avatar,
            .header > div[style*="width:1px"],
            .header i.fa-bell {
                order: 5;
                margin-bottom: 4px;
                margin-right: 0;
            }
            .header .avatar {
                align-self: flex-end;
                margin-left: auto;
            }
            .header > * {
                min-width: 0;
            }
            .grid {
                grid-template-columns: 1fr !important;
                gap: 12px;
            }
            .card {
                grid-column: span 1 !important;
                padding: 12px;
            }
            section.card[style*="grid-template-columns"] {
                grid-template-columns: 1fr !important;
                display: block !important;
            }
            /* Quick actions row: stack vertically */
            section.card[style*="grid-template-columns"] button.link {
                min-width: 0;
                width: 100%;
                margin-bottom: 8px;
            }
            /* Table responsiveness */
            table, thead, tbody, th, td, tr {
                display: block;
                width: 100%;
            }
            thead {
                display: none;
            }
            tbody tr {
                margin-bottom: 16px;
                border-bottom: 2px solid #eee;
                background: #fff;
                border-radius: 8px;
                box-shadow: 0 2px 8px rgba(0,0,0,0.03);
                padding: 8px 0;
            }
            td {
                padding: 8px 12px;
                text-align: left;
                position: relative;
            }
            td:before {
                content: attr(data-label);
                font-weight: 600;
                color: var(--muted);
                display: block;
                margin-bottom: 2px;
                font-size: 12px;
            }
            .footer {
                padding: 10px 2px;
                font-size: 11px;
            }
        }

        /* Show sidebar when open on mobile */
        @media (max-width: 860px) {
            body {
                overflow: auto;
            }
        }

        /* Hide close arrow by default */
        .sidebar .close-mobile {
            display: none;
            position: absolute;
            top: 16px;
            right: 16px;
            background: #fff;
            color: var(--secondary);
            border: none;
            border-radius: 50%;
            width: 36px;
            height: 36px;
            align-items: center;
            justify-content: center;
            font-size: 20px;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.10);
            cursor: pointer;
            z-index: 101;
            transition: background 0.2s;
        }

        .sidebar .close-mobile:hover {
            background: #ffe5b2;
        }

        /* Focus styles */
        .link:focus-visible,
        .submenu a:focus-visible,
        .header .toggle:focus-visible {
            outline: none;
            box-shadow: 0 0 0 2px rgba(0, 0, 0, .12), 0 0 0 4px rgba(212, 0, 0, .18);
        }
        
        /* Customer-specific styles */
        .customer-actions {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            gap: 12px;
            margin-top: 16px;
        }
        
        .customer-actions button {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 12px 16px;
            background: white;
            border: 1px solid rgba(0, 0, 0, 0.08);
            border-radius: 12px;
            cursor: pointer;
            transition: all var(--transition-fast);
            font-weight: 500;
        }
        
        .customer-actions button:hover {
            background: rgba(212, 0, 0, 0.05);
            transform: translateY(-2px);
        }
        
        .customer-actions button i {
            color: var(--primary);
        }
        
        .customer-segments {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
            gap: 12px;
            margin-top: 16px;
        }
        
        .segment-card {
            background: white;
            border-radius: 12px;
            padding: 16px;
            text-align: center;
            border: 1px solid rgba(0, 0, 0, 0.08);
        }
        
        .segment-card h4 {
            font-size: 14px;
            margin-bottom: 8px;
            color: var(--muted);
        }
        
        .segment-card .value {
            font-size: 24px;
            font-weight: 800;
            color: var(--primary);
        }
        
        .customer-table-actions {
            display: flex;
            gap: 8px;
        }
        
        .customer-table-actions button {
            padding: 6px 10px;
            border: none;
            border-radius: 8px;
            background: rgba(0, 0, 0, 0.04);
            cursor: pointer;
            transition: background var(--transition-fast);
        }
        
        .customer-table-actions button:hover {
            background: rgba(0, 0, 0, 0.08);
        }
        
        .customer-table-actions button.view {
            color: var(--primary);
        }
        
        .customer-table-actions button.edit {
            color: var(--secondary);
        }
        
        .customer-table-actions button.delete {
            color: var(--danger);
        }
        
        /* Renewal specific styles */
        .renewal-stats {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            gap: 12px;
            margin-top: 16px;
        }
        
        .renewal-stat-card {
            background: white;
            border-radius: 12px;
            padding: 16px;
            text-align: center;
            border: 1px solid rgba(0, 0, 0, 0.08);
        }
        
        .renewal-stat-card h4 {
            font-size: 14px;
            margin-bottom: 8px;
            color: var(--muted);
        }
        
        .renewal-stat-card .value {
            font-size: 24px;
            font-weight: 800;
        }
        
        .pending-renewal {
            color: var(--warning);
        }
        
        .completed-renewal {
            color: var(--success);
        }
        
        .recovery-renewal {
            color: var(--primary);
        }
        
        .renewal-reasons {
            margin-top: 16px;
        }
        
        .reason-item {
            display: flex;
            justify-content: space-between;
            padding: 10px 0;
            border-bottom: 1px solid rgba(0, 0, 0, 0.06);
        }
        
        .reason-item:last-child {
            border-bottom: none;
        }