/* MyElectrica dashboard — fac.php */
:root {
    --me-blue: #0071bc;
    --me-blue-dark: #005a96;
    --me-blue-light: #0088de;
    --me-bg: #f4f6f9;
    --me-white: #ffffff;
    --me-text: #1f2d3d;
    --me-muted: #6b7a90;
    --me-border: #e4e9f0;
    --me-green: #2e9e5b;
    --me-green-bg: #e8f7ee;
    --me-orange: #e67e22;
    --me-orange-bg: #fff4e8;
    --me-red: #d64545;
    --me-red-bg: #fdecec;
    --me-sidebar-w: 248px;
    --me-topbar-h: 56px;
    --me-radius: 12px;
    --me-shadow: 0 2px 12px rgba(15, 35, 70, 0.06);
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, Helvetica, sans-serif;
    font-size: 14px;
    color: var(--me-text);
    background: var(--me-bg);
    -webkit-font-smoothing: antialiased;
}

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

/* Sidebar */
.me-sidebar {
    width: var(--me-sidebar-w);
    flex-shrink: 0;
    background: var(--me-white);
    border-right: 1px solid var(--me-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}

.me-sidebar-logo {
    padding: 16px 18px 14px;
    border-bottom: 1px solid var(--me-border);
}

.me-logo-mark {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    color: inherit;
}

.me-logo-img {
    display: block;
    height: 34px;
    width: auto;
    max-width: 100%;
}

.me-logo-img--sm {
    height: 28px;
}

.me-nav {
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
}

.me-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 20px;
    color: var(--me-muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
}

.me-nav-item i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
}

.me-nav-item:hover {
    background: #f0f4fa;
    color: var(--me-blue);
}

.me-nav-item.active {
    background: var(--me-blue);
    color: #fff;
    font-weight: 600;
}

.me-nav-item .me-chevron {
    margin-left: auto;
    font-size: 0.7rem;
    opacity: 0.6;
}

.me-sidebar-foot {
    padding: 16px 20px 20px;
    border-top: 1px solid var(--me-border);
}

.me-sidebar-foot a {
    display: block;
    font-size: 0.78rem;
    color: var(--me-muted);
    text-decoration: none;
    margin-bottom: 8px;
}

.me-sidebar-foot a:hover {
    color: var(--me-blue);
}

/* Main area */
.me-main-wrap {
    flex: 1;
    margin-left: var(--me-sidebar-w);
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.me-topbar {
    height: var(--me-topbar-h);
    background: var(--me-white);
    border-bottom: 1px solid var(--me-border);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.me-topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.me-theme-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--me-border);
    border-radius: 50%;
    background: #fff;
    color: var(--me-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.me-topbar-logo {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.me-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.me-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--me-blue);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.me-user-info {
    line-height: 1.25;
}

.me-user-name {
    font-size: 0.85rem;
    font-weight: 600;
}

.me-user-code {
    font-size: 0.72rem;
    color: var(--me-muted);
}

/* Content */
.me-content {
    padding: 20px 24px 40px;
    flex: 1;
}

.me-breadcrumb {
    font-size: 0.78rem;
    color: var(--me-muted);
    margin-bottom: 6px;
}

.me-breadcrumb a {
    color: var(--me-muted);
    text-decoration: none;
}

.me-breadcrumb a:hover {
    color: var(--me-blue);
}

.me-page-title {
    font-size: 1.65rem;
    font-weight: 700;
    margin: 0 0 20px;
    letter-spacing: -0.02em;
}

/* Grid */
.me-grid-top {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 20px;
    margin-bottom: 20px;
}

.me-grid-bottom {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* Cards */
.me-card {
    background: var(--me-white);
    border-radius: var(--me-radius);
    box-shadow: var(--me-shadow);
    overflow: hidden;
}

.me-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--me-border);
}

.me-card-head h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
}

.me-card-link {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--me-red);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 0.7rem;
}

.me-card-body {
    padding: 18px 20px 20px;
}

/* Hero payment card */
.me-hero {
    --hero-blue: #0071bc;
    --hero-panel: rgba(0, 45, 98, 0.28);
    background: var(--hero-blue);
    border-radius: 14px;
    color: #fff;
    padding: 18px 20px 22px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 28px rgba(0, 113, 188, 0.28);
}

.me-hero-skyline {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 800 220'%3E%3Cg fill='none' stroke='%23a8d8f0' stroke-width='1.2' opacity='0.55'%3E%3Cpath d='M40 170h35l8-28 10 28h22l12-42 14 42h28l10-35 12 35h30l8-22 10 22h25l14-48 16 48h32l11-38 13 38h28l9-30 11 30h40'/%3E%3Crect x='120' y='118' width='28' height='52'/%3E%3Crect x='155' y='102' width='18' height='68'/%3E%3Crect x='178' y='95' width='14' height='75'/%3E%3Crect x='196' y='108' width='20' height='62'/%3E%3Cpath d='M250 170V95l18-12 18 12v75'/%3E%3Crect x='310' y='88' width='34' height='82'/%3E%3Crect x='350' y='105' width='22' height='65'/%3E%3Cpath d='M400 170V78l24-18 24 18v92'/%3E%3Crect x='470' y='112' width='26' height='58'/%3E%3Crect x='505' y='98' width='18' height='72'/%3E%3Cpath d='M560 170V110l16-24 16 24v60'/%3E%3Crect x='610' y='100' width='40' height='70'/%3E%3Cpath d='M680 170V85l20-15 20 15v85'/%3E%3C/g%3E%3Cg fill='%23a8d8f0' opacity='0.35'%3E%3Ccircle cx='90' cy='60' r='2'/%3E%3Ccircle cx='140' cy='45' r='2'/%3E%3Ccircle cx='220' cy='70' r='2'/%3E%3Ccircle cx='310' cy='50' r='2'/%3E%3Ccircle cx='390' cy='65' r='2'/%3E%3Ccircle cx='480' cy='42' r='2'/%3E%3Ccircle cx='560' cy='58' r='2'/%3E%3Ccircle cx='640' cy='48' r='2'/%3E%3Ccircle cx='720' cy='62' r='2'/%3E%3C/g%3E%3Cg stroke='%23a8d8f0' stroke-width='0.8' opacity='0.25'%3E%3Cline x1='90' y1='60' x2='140' y2='45'/%3E%3Cline x1='140' y1='45' x2='220' y2='70'/%3E%3Cline x1='220' y1='70' x2='310' y2='50'/%3E%3Cline x1='310' y1='50' x2='390' y2='65'/%3E%3Cline x1='390' y1='65' x2='480' y2='42'/%3E%3Cline x1='480' y1='42' x2='560' y2='58'/%3E%3Cline x1='560' y1='58' x2='640' y2='48'/%3E%3Cline x1='640' y1='48' x2='720' y2='62'/%3E%3C/g%3E%3C/svg%3E") bottom center / 100% auto no-repeat;
    opacity: 0.95;
}

.me-hero-top {
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    gap: 14px;
    position: relative;
    z-index: 1;
}

.me-hero-panel {
    background: var(--hero-panel);
    border-radius: 10px;
    padding: 14px 16px;
    backdrop-filter: blur(2px);
}

.me-hero-panel-stats {
    display: flex;
    align-items: center;
    gap: 14px;
}

.me-hero-panel-dates {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 14px;
}

.me-progress-ring {
    width: 78px;
    height: 78px;
    position: relative;
    flex-shrink: 0;
}

.me-progress-ring svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.me-progress-ring .ring-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.22);
    stroke-width: 7;
}

.me-progress-ring .ring-fill {
    fill: none;
    stroke: #fff;
    stroke-width: 7;
    stroke-linecap: round;
}

.me-progress-pct {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 700;
}

.me-stats-list {
    flex: 1;
    min-width: 0;
}

.me-stat-line {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    font-size: 0.78rem;
    line-height: 1.35;
    margin-bottom: 4px;
}

.me-stat-line span {
    opacity: 0.92;
}

.me-stat-line strong {
    font-size: 0.95rem;
    font-weight: 700;
}

.me-stat-bar {
    height: 4px;
    background: rgba(255, 255, 255, 0.22);
    border-radius: 4px;
    margin: 6px 0 8px;
    overflow: hidden;
}

.me-stat-bar span {
    display: block;
    height: 100%;
    background: #fff;
    border-radius: 4px;
}

.me-date-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.me-date-icon {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.85rem;
    opacity: 0.95;
}

.me-date-text {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 0.78rem;
}

.me-date-label {
    opacity: 0.92;
}

.me-date-text strong {
    font-size: 0.88rem;
    font-weight: 700;
}

.me-hero-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-top: 22px;
    position: relative;
    z-index: 1;
    flex-wrap: wrap;
}

.me-balance-block {
    display: flex;
    align-items: center;
    gap: 14px;
}

.me-wallet-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #fff;
}

.me-wallet-icon svg {
    width: 22px;
    height: 22px;
}

.me-balance-label {
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    opacity: 0.88;
    margin-bottom: 2px;
}

.me-balance-value {
    font-size: clamp(1.85rem, 4vw, 2.5rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.05;
}

.me-hero-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.me-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: background 0.15s, opacity 0.15s;
}

.me-btn-white {
    background: #fff;
    color: #0071bc;
    padding: 11px 22px;
    font-weight: 700;
}

.me-btn-white:hover {
    background: #f3f8fc;
}

.me-btn-outline {
    background: rgba(0, 45, 98, 0.15);
    color: #fff;
    border: 1.5px solid rgba(255, 255, 255, 0.75);
    padding: 11px 20px;
}

.me-btn-outline:hover {
    background: rgba(255, 255, 255, 0.08);
}

.me-btn-blue {
    background: var(--me-blue-light);
    color: #fff;
    width: 100%;
    padding: 12px;
}

.me-btn-blue:hover {
    background: var(--me-blue);
}

/* Alert boxes */
.me-alert {
    display: flex;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 8px;
    font-size: 0.82rem;
    line-height: 1.5;
    margin-bottom: 16px;
}

.me-alert i {
    font-size: 1.1rem;
    margin-top: 2px;
    flex-shrink: 0;
}

.me-alert-green {
    background: var(--me-green-bg);
    color: #1a5c34;
}

.me-alert-green i {
    color: var(--me-green);
}

.me-alert-red {
    background: var(--me-red-bg);
    color: #8b2e2e;
}

.me-alert-red i {
    color: var(--me-red);
}

.me-alert-red strong {
    color: var(--me-red);
}

/* Toggles */
.me-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--me-border);
}

.me-toggle-row:last-of-type {
    border-bottom: none;
}

.me-toggle-label {
    font-size: 0.85rem;
    font-weight: 500;
}

.me-toggle {
    position: relative;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.me-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.me-toggle-slider {
    position: absolute;
    inset: 0;
    background: #cbd5e1;
    border-radius: 24px;
    cursor: pointer;
    transition: background 0.2s;
}

.me-toggle-slider::before {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.me-toggle input:checked + .me-toggle-slider {
    background: var(--me-green);
}

.me-toggle input:checked + .me-toggle-slider::before {
    transform: translateX(20px);
}

.me-toggle-status {
    font-size: 0.75rem;
    color: var(--me-green);
    font-weight: 600;
    margin-left: 8px;
}

/* Index card */
.me-index-box {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    border: 1px solid var(--me-border);
    border-radius: 10px;
    background: #fafbfc;
}

.me-index-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    background: #eef3fa;
    color: var(--me-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.me-index-text h3 {
    margin: 0 0 4px;
    font-size: 0.9rem;
    font-weight: 600;
}

.me-index-text p {
    margin: 0;
    font-size: 0.82rem;
    color: var(--me-muted);
}

/* Stats tiles */
.me-stats-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 4px;
}

.me-stat-tile {
    padding: 16px;
    border-radius: 10px;
    text-align: center;
}

.me-stat-tile.orange {
    background: var(--me-orange-bg);
}

.me-stat-tile.green {
    background: var(--me-green-bg);
}

.me-stat-num {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 4px;
}

.me-stat-tile.orange .me-stat-num {
    color: var(--me-orange);
}

.me-stat-tile.green .me-stat-num {
    color: var(--me-green);
}

.me-stat-label {
    font-size: 0.78rem;
    color: var(--me-muted);
}

.me-pay-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 8px;
}

.me-pay-stat {
    text-align: center;
}

.me-pay-stat .val {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--me-text);
}

.me-pay-stat .lbl {
    font-size: 0.75rem;
    color: var(--me-muted);
    margin-top: 4px;
}

.me-pay-source {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--me-border);
    font-size: 0.78rem;
    color: var(--me-muted);
}

.me-pay-source strong {
    display: block;
    color: var(--me-text);
    font-weight: 600;
    margin-bottom: 2px;
}

/* Responsive */
@media (max-width: 1100px) {
    .me-grid-top {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .me-sidebar {
        transform: translateX(-100%);
    }

    .me-main-wrap {
        margin-left: 0;
    }

    .me-grid-bottom {
        grid-template-columns: 1fr;
    }

    .me-hero-top {
        grid-template-columns: 1fr;
    }

    .me-hero-bottom {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 600px) {
    .me-content {
        padding: 16px;
    }

    .me-user-info {
        display: none;
    }

    .me-stats-row,
    .me-pay-stats {
        grid-template-columns: 1fr;
    }
}
