:root {
    /* 
      OKLCH Palette: "Slate & Cyan"
      A deep, cool slate background with electric cyan/blue accents.
    */
    --bg-color: oklch(0.18 0.02 250); 
    --surface-color: oklch(0.22 0.02 250);
    --surface-border: oklch(0.3 0.02 250);
    
    --text-main: oklch(0.98 0.01 250);
    --text-muted: oklch(0.7 0.02 250);
    --text-dim: oklch(0.5 0.02 250);
    
    --accent: oklch(0.7 0.15 250); /* Cyan/Electric blue */
    --accent-dim: oklch(0.3 0.06 250);
    
    --success: oklch(0.75 0.15 150); /* Cool green */
    --danger: oklch(0.65 0.2 25);   /* Crisp red */

    /* Telegram Fallbacks */
    --tg-bg: var(--telegram-theme-bg-color, var(--bg-color));
    --tg-text: var(--telegram-theme-text-color, var(--text-main));
    --tg-hint: var(--telegram-theme-hint-color, var(--text-muted));
    --tg-btn: var(--telegram-theme-button-color, var(--accent));
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    padding: 20px;
    font-size: 15px;
    line-height: 1.4;
    min-height: 100vh;
    /* Impeccable modern gradient: subtle radial glow from top corners */
    background-image: 
        radial-gradient(circle at 100% 0%, color-mix(in srgb, var(--accent) 15%, transparent), transparent 50%),
        radial-gradient(circle at 0% 50%, color-mix(in srgb, var(--accent) 5%, transparent), transparent 40%),
        linear-gradient(to bottom, rgba(0,0,0,0.1), rgba(0,0,0,0));
    background-attachment: fixed;
}

body.telegram-light {
    --bg-color: oklch(0.98 0.01 250);
    --surface-color: oklch(0.95 0.01 250);
    --surface-border: oklch(0.9 0.02 250);
    --text-main: oklch(0.2 0.02 250);
    --text-muted: oklch(0.4 0.02 250);
    --text-dim: oklch(0.6 0.02 250);
}

.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 80vh;
    font-size: 15px;
    color: var(--text-muted);
}

.dashboard {
    max-width: 600px;
    margin: 0 auto;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.bot-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-main);
    background-color: var(--surface-color);
    padding: 4px 10px;
    border-radius: 12px;
    border: 1px solid var(--surface-border);
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--success);
    box-shadow: 0 0 6px var(--success);
    animation: pulse 2s infinite;
}

.status-dot.offline {
    background-color: var(--danger);
    box-shadow: 0 0 6px var(--danger);
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.subtitle {
    font-size: 13px;
    color: var(--text-dim);
}

/* Typography Scales */
.section-title {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-main);
    margin-bottom: 12px;
    letter-spacing: -0.01em;
}

/* Hero Section */
.hero {
    margin-bottom: 32px;
}

.hero-label {
    font-size: 15px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.hero-value {
    font-size: clamp(48px, 12vw, 64px);
    font-weight: 700;
    letter-spacing: -0.04em;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    margin-bottom: 8px;
}

.hero-value .currency {
    font-size: clamp(24px, 6vw, 32px);
    color: var(--accent);
    font-weight: 500;
    letter-spacing: 0;
}

.hero-sub {
    font-size: 16px;
    color: var(--success);
    font-weight: 500;
}

/* Shops List (Rows instead of cards) */
.shops-section {
    margin-bottom: 32px;
}

.shops-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.shop-row {
    background-color: var(--surface-color);
    border: 1px solid var(--surface-border);
    border-radius: 8px;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.shop-main {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.shop-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.shop-id {
    font-weight: 600;
    font-size: 15px;
}

.shop-status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.shop-status-indicator.rented {
    background-color: var(--danger);
    box-shadow: 0 0 8px var(--danger);
}

.shop-status-indicator.free {
    background-color: var(--success);
    box-shadow: 0 0 8px var(--success);
}

.shop-state {
    font-size: 14px;
    color: var(--text-muted);
}

.shop-details {
    text-align: right;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.shop-renter {
    font-weight: 500;
    font-size: 14px;
}

.shop-meta {
    font-size: 13px;
    color: var(--text-dim);
}

/* Progress Section */
.progress-section {
    margin-bottom: 32px;
    background-color: var(--surface-color);
    border: 1px solid var(--surface-border);
    border-radius: 8px;
    padding: 20px;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 12px;
}

.progress-text {
    font-size: 15px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.progress-current {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-main);
}

.progress-slash {
    color: var(--text-dim);
    margin: 0 4px;
}

.progress-pct {
    font-weight: 600;
    color: var(--accent);
}

.progress-bar {
    width: 100%;
    height: 6px;
    background-color: var(--accent-dim);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background-color: var(--accent);
    border-radius: 3px;
    transition: width 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.progress-fill.highlight {
    background-color: var(--success);
}

/* Stats Row */
.stats-row {
    display: flex;
    justify-content: space-between;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--surface-border);
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-item:last-child {
    text-align: right;
}

.stat-label {
    font-size: 13px;
    color: var(--text-muted);
}

.stat-value {
    font-size: 16px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

/* Chart Section */
.chart-section {
    margin-bottom: 32px;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 16px;
}

.chart-total {
    font-size: 20px;
    font-weight: 600;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
}

.chart-container {
    height: 220px;
    width: 100%;
    background-color: var(--surface-color);
    border: 1px solid var(--surface-border);
    border-radius: 8px;
    padding: 16px;
}

/* Animations */
.anim-item {
    opacity: 0;
    transform: translateY(10px);
    animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Skeleton Loader */
.skeleton-container {
    display: flex;
    flex-direction: column;
}
.skeleton {
    background: linear-gradient(90deg, var(--surface-color) 25%, var(--surface-border) 50%, var(--surface-color) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite linear;
    border-radius: 8px;
}
.skeleton-header { height: 24px; width: 60%; margin-bottom: 8px; }
.skeleton-hero { height: 64px; width: 50%; margin-bottom: 8px; }
.skeleton-title { height: 20px; width: 40%; }
.skeleton-shop { height: 80px; width: 100%; border-radius: 8px; }
.skeleton-chart { height: 220px; width: 100%; border-radius: 8px; }

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Downtime Card */
.downtime-card {
    background: var(--surface-color);
    border-radius: 12px;
    padding: 16px;
    border: 1px solid var(--surface-border);
    transition: all 0.3s ease;
}
.downtime-card.high {
    background: rgba(255, 59, 48, 0.1);
    border-color: rgba(255, 59, 48, 0.3);
}
.downtime-card.medium {
    background: rgba(255, 149, 0, 0.1);
    border-color: rgba(255, 149, 0, 0.3);
}
.downtime-card.low {
    background: rgba(52, 199, 89, 0.1);
    border-color: rgba(52, 199, 89, 0.3);
}

.downtime-header {
    display: flex;
    align-items: center;
    gap: 12px;
}
.downtime-icon {
    font-size: 20px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-color);
    border-radius: 8px;
}
.downtime-info {
    flex-grow: 1;
}
.downtime-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-color);
}
.downtime-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}
.downtime-value {
    font-size: 20px;
    font-weight: 700;
    font-family: 'tabular-nums', sans-serif;
}
.downtime-card.high .downtime-value { color: #ff3b30; }
.downtime-card.medium .downtime-value { color: #ff9500; }
.downtime-card.low .downtime-value { color: #34c759; }

.downtime-bar {
    height: 6px;
    background: var(--surface-border);
    border-radius: 3px;
    margin-top: 12px;
    overflow: hidden;
}
.downtime-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}
.downtime-card.high .downtime-fill { background: #ff3b30; }
.downtime-card.medium .downtime-fill { background: #ff9500; }
.downtime-card.low .downtime-fill { background: #34c759; }

/* Chart Controls */
.chart-controls {
    display: flex;
    gap: 8px;
    background-color: var(--surface-color);
    padding: 4px;
    border-radius: 8px;
    border: 1px solid var(--surface-border);
}
.chart-btn {
    background: transparent;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}
.chart-btn.active {
    background-color: var(--accent);
    color: var(--bg-color);
}
