:root {
    --green: #22c55e;
    --green-d: #16a34a;
    --green-l: #dcfce7;
    --blue: #38bdf8;
    --blue-l: #e0f7ff;
    --gold: #f59e0b;
    --gold-l: #fef3c7;
    --teal: #2dd4bf;
    --teal-l: #ccfbf1;
    --text: #1e293b;
    --muted: #64748b;
    --border: #e2e8f0;
    --surface: #ffffff;
    --radius: 14px;
    --shadow: 0 2px 12px rgba(0,0,0,.07);
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 50; display: flex; align-items: center; justify-content: center; }
.modal-overlay.hidden { display: none; }

.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}
@keyframes slideInRight {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}
@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(34,197,94,.3); }
    50% { box-shadow: 0 0 20px 5px rgba(34,197,94,.15); }
}
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
@keyframes bounce-subtle {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}
@keyframes typing-dots {
    0%, 20% { opacity: .2; }
    50% { opacity: 1; }
    80%, 100% { opacity: .2; }
}

.animate-fade-in-up { animation: fadeInUp .5s ease-out forwards; }
.animate-fade-in { animation: fadeIn .4s ease-out forwards; }
.animate-slide-left { animation: slideInLeft .4s ease-out forwards; }
.animate-slide-right { animation: slideInRight .4s ease-out forwards; }

.stagger-1 { animation-delay: .05s; }
.stagger-2 { animation-delay: .1s; }
.stagger-3 { animation-delay: .15s; }
.stagger-4 { animation-delay: .2s; }
.stagger-5 { animation-delay: .25s; }
.stagger-6 { animation-delay: .3s; }

.kpi-gradient-green {
    background: linear-gradient(135deg, #16a34a, #22c55e);
    color: #fff;
}
.kpi-gradient-blue {
    background: linear-gradient(135deg, #0284c7, #38bdf8);
    color: #fff;
}
.kpi-gradient-gold {
    background: linear-gradient(135deg, #d97706, #f59e0b);
    color: #fff;
}
.kpi-gradient-teal {
    background: linear-gradient(135deg, #0d9488, #2dd4bf);
    color: #fff;
}
.kpi-gradient-purple {
    background: linear-gradient(135deg, #7c3aed, #a78bfa);
    color: #fff;
}
.kpi-gradient-red {
    background: linear-gradient(135deg, #dc2626, #f87171);
    color: #fff;
}

.kpi-card-icon {
    font-size: 2.2rem;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,.15));
}

.card-hover {
    transition: all .3s cubic-bezier(.4, 0, .2, 1);
}
.card-hover:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0,0,0,.1);
}

.card-glow:hover {
    box-shadow: 0 4px 20px rgba(34, 197, 94, .15);
}

.goal-ring-wrap {
    position: relative;
    width: 140px;
    margin: 0 auto;
}
.goal-ring-wrap svg { width: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--green-l); stroke-width: 12; }
.ring-fill {
    fill: none;
    stroke: var(--green-d);
    stroke-width: 12;
    stroke-linecap: round;
    transition: stroke-dashoffset 1.2s cubic-bezier(.4, 0, .2, 1);
}
.ring-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.progress-gradient-green {
    background: linear-gradient(to right, #16a34a, #22c55e);
}
.progress-gradient-blue {
    background: linear-gradient(to right, #0284c7, #7dd3fc);
}
.progress-gradient-gold {
    background: linear-gradient(to right, #d97706, #fcd34d);
}
.progress-gradient-teal {
    background: linear-gradient(to right, #0d9488, #2dd4bf);
}

.lb-row-gold {
    background: var(--gold-l);
    border-color: #fcd34d;
}
.lb-row-silver {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.badge-card {
    transition: all .3s ease;
    cursor: default;
}
.badge-card:hover {
    transform: translateY(-3px);
}
.badge-card.earned {
    border-color: var(--green);
    background: var(--green-l);
}
.badge-card.locked {
    opacity: .4;
    filter: grayscale(1);
}
.badge-icon-lg {
    font-size: 2rem;
    line-height: 1;
}

.chat-feed {
    display: flex;
    flex-direction: column;
    gap: 14px;
    overflow-y: auto;
    padding-right: 4px;
}
.chat-msg {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    opacity: 0;
    animation: fadeInUp .4s ease-out forwards;
}
.chat-msg.user {
    flex-direction: row-reverse;
}
.chat-avatar-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: .85rem;
    font-weight: 700;
}
.chat-avatar-ai {
    background: linear-gradient(135deg, #7c3aed, #a78bfa);
    color: #fff;
}
.chat-avatar-user {
    background: linear-gradient(135deg, #16a34a, #22c55e);
    color: #fff;
}
.chat-bubble-ai {
    background: #f1f5f9;
    border-radius: 16px 16px 16px 4px;
    padding: 12px 16px;
    font-size: .9rem;
    line-height: 1.6;
    max-width: 80%;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
[dir="rtl"] .chat-bubble-ai {
    border-radius: 16px 16px 4px 16px;
}
.chat-bubble-user {
    background: linear-gradient(135deg, #16a34a, #22c55e);
    color: #fff;
    border-radius: 16px 16px 4px 16px;
    padding: 12px 16px;
    font-size: .9rem;
    line-height: 1.6;
    max-width: 80%;
    box-shadow: 0 1px 3px rgba(0,0,0,.1);
}
[dir="rtl"] .chat-bubble-user {
    border-radius: 16px 16px 16px 4px;
}

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: #f1f5f9;
    border-radius: 16px 16px 16px 4px;
}
.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #94a3b8;
    animation: typing-dots 1.4s infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: .2s; }
.typing-indicator span:nth-child(3) { animation-delay: .4s; }

.bill-block-prev .bill-num { color: #ef4444; }
.bill-block-curr .bill-num { color: var(--green-d); }

.sidebar-nav a {
    transition: all .2s ease;
}
.sidebar-nav a:hover {
    transform: translateX(3px);
}
[dir="rtl"] .sidebar-nav a:hover {
    transform: translateX(-3px);
}

.bar-animated {
    transition: height .6s cubic-bezier(.4, 0, .2, 1);
}
.bar-elec {
    background: linear-gradient(to top, #16a34a, #4ade80);
}
.bar-water {
    background: linear-gradient(to top, #0284c7, #7dd3fc);
}

.carbon-circle {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0d9488, #2dd4bf);
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 15px rgba(45, 212, 191, .3);
}

.opp-row {
    transition: all .2s ease;
}
.opp-row:hover {
    background: #f0fdf4;
    border-color: #bbf7d0;
}

.redeem-card {
    transition: all .3s ease;
}
.redeem-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(34,197,94,.15);
}

.stat-number {
    background: linear-gradient(135deg, #16a34a, #22c55e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-pattern {
    position: absolute;
    top: 0;
    right: 0;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(255,255,255,.08) 0%, transparent 70%);
    border-radius: 50%;
    transform: translate(30%, -30%);
}
[dir="rtl"] .hero-pattern {
    right: auto;
    left: 0;
    transform: translate(-30%, -30%);
}

.quick-action {
    transition: all .2s ease;
    cursor: pointer;
}
.quick-action:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 15px rgba(0,0,0,.08);
}

.input-enhanced {
    transition: all .2s ease;
}
.input-enhanced:focus {
    box-shadow: 0 0 0 3px rgba(22, 163, 74, .15);
}

.notification-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ef4444;
    position: absolute;
    top: -2px;
    right: -2px;
    border: 2px solid #fff;
}

.rank-badge-bronze { background: linear-gradient(135deg, #d97706, #f59e0b); }
.rank-badge-silver { background: linear-gradient(135deg, #6b7280, #9ca3af); }
.rank-badge-gold { background: linear-gradient(135deg, #ca8a04, #eab308); }
.rank-badge-platinum { background: linear-gradient(135deg, #6366f1, #818cf8); }

.chat-send-btn {
    background: linear-gradient(135deg, #16a34a, #22c55e);
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 10px 24px;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s ease;
}
.chat-send-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 15px rgba(34, 197, 94, .3);
}
.chat-send-btn:disabled {
    opacity: .6;
    cursor: not-allowed;
    transform: none;
}

@media (max-width: 768px) {
    .chat-bubble-ai,
    .chat-bubble-user {
        max-width: 90%;
    }
}
