/* Daikin Heating Controller Styles */

* {
    box-sizing: border-box;
}

:root {
    --bg-dark: #0d1117;
    --bg-card: #161b22;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --accent-blue: #58a6ff;
    --accent-green: #3fb950;
    --accent-red: #f85149;
    --accent-orange: #d29922;
}

/* Bootstrap badge overrides for dark mode */
.badge.bg-warning {
    color: #1a1a1a !important;
}

.badge.bg-success {
    color: #fff !important;
}

.badge.bg-danger {
    color: #fff !important;
}

.badge.bg-info {
    color: #1a1a1a !important;
}

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #0d1117 0%, #161b22 100%);
    color: var(--text-primary);
    min-height: 100vh;
}

.install-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: linear-gradient(135deg, #238636 0%, #2ea043 100%);
    color: white;
    border: none;
    border-radius: 24px;
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 600;
    box-shadow: 0 8px 25px rgba(35, 134, 54, 0.4);
    cursor: pointer;
    z-index: 9999;
    animation: pulse-install 2s infinite;
}

@keyframes pulse-install {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.install-btn:hover {
    filter: brightness(1.08);
    animation: none;
    transform: scale(1.05);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Page Shell - Main Layout Container */
.page-shell {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    overflow: hidden;
}

.dashboard-grid {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

/* Keep dashboard-grid as single column - dial+COP are side-by-side via thermostat-grid */
/* secondary-panel (info cards) goes underneath, not beside */

.primary-panel,
.secondary-panel {
    min-width: 0;
    overflow: hidden;
}

/* Setup Required */
.setup-required {
    text-align: center;
    padding: 60px 20px;
    background: var(--bg-card);
    border-radius: 16px;
    margin-top: 40px;
}

.setup-required h2 {
    margin-bottom: 20px;
}

/* Dashboard */
.dashboard {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Dashboard Header */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 10px;
}

.dashboard-header h1 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
}

.settings-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-card);
    text-decoration: none;
    font-size: 24px;
    transition: all 0.2s;
    border: 1px solid #333;
}

.settings-btn:hover {
    background: #2d333b;
    transform: rotate(45deg);
}

/* Thermostat */
.thermostat-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.thermostat-grid {
    display: flex;
    flex-direction: column;
    gap: 24px;
    width: 100%;
    overflow: hidden;
}

/* Side-by-side dial + COP at 768px and above */
@media (min-width: 768px) {
    .thermostat-grid {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 340px);
        align-items: flex-start;
        gap: 32px;
    }
}

.cop-card {
    background: var(--bg-card);
    border: 1px solid #2b3138;
    border-radius: 24px;
    padding: 20px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow: hidden;
    max-width: 100%;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
}

.cop-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.cop-card-updated {
    font-size: 13px;
    color: var(--text-secondary);
}

.cop-dataset-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.cop-dataset-btn {
    flex: 1;
    min-width: 90px;
    border: 1px solid #2f3844;
    border-radius: 14px;
    padding: 8px 12px;
    background: #111623;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cop-dataset-btn.active {
    background: linear-gradient(135deg, #1f6feb, #3b82f6);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 8px 20px rgba(63, 137, 255, 0.35);
}

.cop-period-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    overflow-x: auto;
}

.cop-period-btn {
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid #2f3844;
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.cop-period-btn.active {
    background: var(--accent-blue);
    border-color: transparent;
    color: #fff;
}

.cop-card-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cop-loading,
.cop-error,
.cop-empty {
    border: 1px dashed #2b3138;
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
}

.cop-error {
    border-color: var(--accent-red);
    color: var(--accent-red);
}

.cop-metric {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cop-metric-label {
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 1px;
    color: var(--text-secondary);
}

.cop-metric-value {
    font-size: 48px;
    font-weight: 700;
    line-height: 1;
    color: var(--text-primary);
}

.cop-metric-value small {
    font-size: 16px;
    margin-left: 6px;
    color: var(--text-secondary);
}

.cop-metric-subtext {
    margin: 0;
    font-size: 13px;
    color: var(--text-secondary);
}

.cop-energy-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 13px;
    color: var(--text-secondary);
}

.cop-chart {
    position: relative;
    width: 100%;
    height: 80px;
    border-radius: 16px;
    background: #111623;
    border: 1px solid #1f2430;
    overflow: hidden;
}

.cop-chart svg {
    width: 100%;
    height: 100%;
}

.cop-chart polyline {
    fill: none;
    stroke: var(--accent-blue);
    stroke-width: 2.5;
    stroke-linecap: round;
}

.cop-chart-label {
    position: absolute;
    bottom: 8px;
    right: 12px;
    font-size: 11px;
    color: var(--text-secondary);
}

.cop-chart.empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
}

@media (max-width: 640px) {
    .cop-dataset-btn {
        flex: 1 1 100%;
    }

    .cop-card {
        padding: 16px;
    }
}

/* ========== Efficiency Dashboard ========== */
.efficiency-dashboard {
    position: relative;
}

.efficiency-dashboard .cop-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.add-series-btn {
    padding: 8px 16px;
    border-radius: 20px;
    background: linear-gradient(135deg, #1f6feb, #3b82f6);
    border: none;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.add-series-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(63, 137, 255, 0.4);
}

/* Fullscreen Chart Overlay */
.chart-fullscreen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.chart-fullscreen-content {
    width: 100%;
    max-width: 1200px;
    max-height: 90vh;
    background: #fff;
    border-radius: 16px;
    padding: 24px;
    overflow: auto;
}

.chart-fullscreen-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.chart-fullscreen-header h2 {
    margin: 0;
    color: #333;
    font-size: 24px;
}

.close-fullscreen-btn {
    background: #f0f0f0;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    color: #666;
    transition: all 0.2s;
}

.close-fullscreen-btn:hover {
    background: #e0e0e0;
    color: #333;
}

.cop-card.efficiency-dashboard.hidden {
    display: none;
}

.cop-card.efficiency-dashboard {
    cursor: pointer;
}

.series-selector {
    position: absolute;
    top: 80px;
    right: 20px;
    width: 260px;
    background: var(--bg-card);
    border: 1px solid #2b3138;
    border-radius: 16px;
    padding: 16px;
    z-index: 100;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

.series-selector-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
}

.series-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.series-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 10px;
    background: #111623;
    cursor: pointer;
    transition: all 0.2s;
}

.series-option:hover {
    background: #1a2030;
}

.series-option.enabled {
    border: 1px solid #2f3844;
}

.series-option input {
    accent-color: var(--accent-blue);
}

.series-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.series-name {
    flex: 1;
    color: var(--text-primary);
    font-size: 14px;
}

.series-unit {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Time Period Tabs */
.time-period-tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: #111623;
    border-radius: 10px;
    margin-bottom: 12px;
}

.time-tab {
    flex: 1;
    padding: 6px 8px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.time-tab:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.time-tab.active {
    background: var(--accent-blue);
    color: #fff;
    box-shadow: 0 2px 8px rgba(63, 137, 255, 0.3);
}

/* Bar Chart Styles */
.efficiency-chart.bar-chart rect {
    transition: opacity 0.2s;
}

.efficiency-chart.bar-chart rect:hover {
    opacity: 1 !important;
}

.bar-legend {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 8px;
    font-size: 10px;
    color: var(--text-secondary);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.legend-color {
    width: 10px;
    height: 10px;
    border-radius: 2px;
}

/* Line Graph Legend */
.line-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-top: 10px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
}

.line-legend .legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
}

.line-legend .legend-label {
    color: var(--text-secondary);
}

.line-legend .legend-value {
    color: var(--text-primary);
    font-weight: 600;
    font-family: 'SF Mono', 'Consolas', monospace;
}

.active-series {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-height: 28px;
}

.series-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    border: 1px solid;
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.3);
    font-size: 10px;
    font-weight: 500;
}

.series-pill strong {
    font-weight: 700;
}

.remove-pill {
    background: none;
    border: none;
    color: inherit;
    font-size: 12px;
    cursor: pointer;
    opacity: 0.6;
    padding: 0;
    margin-left: 2px;
}

.remove-pill:hover {
    opacity: 1;
}

.chart-container {
    position: relative;
    width: 100%;
    background: transparent;
    padding: 0;
    margin-top: 4px;
    box-sizing: border-box;
}

.chart-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 120px;
    color: var(--text-secondary);
}

.efficiency-chart {
    width: 100%;
    height: 180px;
}

.efficiency-chart .chart-grid line {
    stroke: #1f2430;
    stroke-width: 1;
}

.efficiency-chart .data-line {
    stroke-linecap: round;
    stroke-linejoin: round;
}

.efficiency-chart .data-area {
    opacity: 0.8;
}

.efficiency-chart .data-area.cop-area {
    opacity: 0.9;
}

.efficiency-chart .data-line.cop-line {
    filter: drop-shadow(0 0 6px rgba(251, 191, 36, 0.6));
}

.efficiency-chart.area-chart {
    height: 180px;
}

.chart-time-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 9px;
    color: var(--text-secondary);
}

/* Open Energy Monitor Style Chart */
.oem-chart-wrapper {
    width: 100%;
    max-width: 100%;
    background: #fff;
    border-radius: 8px;
    padding: 6px 8px;
    margin-top: 0;
    cursor: pointer;
    box-sizing: border-box;
    overflow: hidden;
    border: 1px solid #e0e0e0;
}

.oem-chart-wrapper.compact {
    padding: 6px;
}

.oem-chart-wrapper.compact .oem-legend {
    padding: 0 4px 4px 4px;
    font-size: 10px;
    gap: 12px;
    justify-content: center;
}

.oem-chart-wrapper.compact .oem-y-axis {
    font-size: 8px;
    min-width: 20px;
    padding: 0 4px;
}

.oem-chart-wrapper.compact .oem-chart-svg {
    height: 70px;
}

.oem-chart-wrapper.compact .oem-x-axis {
    padding: 2px 4px 0 4px;
    font-size: 9px;
}

.oem-chart-wrapper.fullscreen .oem-chart-svg {
    height: 400px;
}

.oem-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding: 8px 0 12px 40px;
    font-size: 12px;
    color: #333;
}

.oem-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.oem-legend-box {
    width: 14px;
    height: 14px;
    border-radius: 2px;
    opacity: 0.7;
}

.oem-legend-line {
    width: 20px;
    height: 3px;
    border-radius: 2px;
}

.oem-chart-container {
    display: flex;
    align-items: stretch;
}

.oem-y-axis {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 0 8px;
    font-size: 11px;
    color: #666;
    min-width: 40px;
}

.oem-y-axis.multi-scale {
    min-width: 50px;
    gap: 4px;
}

.oem-y-axis.multi-scale .axis-section {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex: 1;
    padding: 2px 0;
    border-left: 2px solid transparent;
}

.oem-y-axis.right.multi-scale .axis-section {
    border-left: none;
    border-right: 2px solid transparent;
}

.oem-y-axis.multi-scale .axis-section.cop-axis {
    border-color: #fbbf24;
}

.oem-y-axis.multi-scale .axis-section.temp-axis {
    border-color: #ef4444;
}

.oem-y-axis.multi-scale .axis-section.thermal-axis {
    border-color: #f97316;
}

.oem-y-axis.multi-scale .axis-section.elec-axis {
    border-color: #3b82f6;
}

.oem-y-axis.multi-scale .axis-label {
    font-weight: 600;
    font-size: 9px;
    margin-bottom: 2px;
}

.oem-y-axis.compact-scale {
    min-width: 35px;
    font-size: 9px;
}

.oem-y-axis.left {
    text-align: right;
}

.oem-y-axis.right {
    text-align: left;
}

.oem-chart-svg {
    flex: 1;
    height: 250px;
    background: #fff;
    border: 1px solid #e0e0e0;
}

/* Chart Tooltip */
.chart-tooltip {
    position: absolute;
    background: rgba(30, 40, 55, 0.95);
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 11px;
    pointer-events: none;
    z-index: 1000;
    min-width: 100px;
    max-width: 180px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: -12px;
}

.tooltip-time {
    font-size: 11px;
    color: #a0aec0;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.tooltip-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 0;
}

.tooltip-color {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    flex-shrink: 0;
}

.tooltip-label {
    flex: 1;
    color: #cbd5e0;
}

.tooltip-value {
    font-weight: 600;
    color: #fff;
}

.oem-chart-area {
    position: relative;
    flex: 1;
    cursor: crosshair;
    min-height: 70px;
}

.oem-chart-area svg {
    display: block;
    width: 100%;
    height: 100%;
}

.oem-legend-value {
    font-weight: 600;
    color: #333;
    min-width: 50px;
    text-align: right;
}

.oem-grid line {
    stroke: #e8e8e8;
    stroke-width: 1;
}

.oem-x-axis {
    display: flex;
    justify-content: space-between;
    padding: 4px 8px 0 8px;
    font-size: 10px;
    color: #888;
}

.quiet-mode-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-radius: 12px;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
}

.quiet-icon {
    font-size: 18px;
}

.cop-metrics-footer {
    display: flex;
    gap: 12px;
    padding: 16px 0 8px 0;
    border-top: 1px solid #1f2430;
}

.cop-metric-item {
    flex: 1;
    text-align: center;
}

.cop-metric-item .metric-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px;
    border-radius: 8px;
    background: #111623;
    border: 1px solid #1f2430;
    color: var(--text-primary);
    width: 100%;
}

.cop-metric-item .metric-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.cop-metric-item .metric-value {
    font-size: 18px;
    font-weight: 700;
    color: #fbbf24;
}

.cop-metric-item.scop .metric-value {
    color: #22c55e;
}

.energy-summary {
    display: flex;
    gap: 16px;
    justify-content: center;
}

.energy-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #111623;
    border-radius: 12px;
    border: 1px solid #1f2430;
}

.energy-icon {
    font-size: 18px;
}

.energy-label {
    font-size: 12px;
    color: var(--text-secondary);
}

.energy-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.energy-item.electrical .energy-value {
    color: #3b82f6;
}

.energy-item.thermal .energy-value {
    color: #ef4444;
}

@media (max-width: 640px) {
    .series-selector {
        right: 10px;
        left: 10px;
        width: auto;
    }
    
    .cop-metrics-footer {
        flex-wrap: wrap;
    }
    
    .cop-metric-item {
        flex: 1 1 45%;
    }
    
    .energy-summary {
        flex-direction: column;
        gap: 8px;
    }
    
    .energy-item {
        justify-content: center;
    }
}

.thermostat {
    width: 280px;
    cursor: pointer;
    transition: transform 0.2s;
}

.thermostat:hover {
    transform: scale(1.02);
}

.thermostat-svg {
    width: 100%;
    height: auto;
    filter: drop-shadow(0 4px 20px rgba(0,0,0,0.5));
}

.thermostat-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-top: 16px;
}

.temp-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid var(--accent-blue);
    background: transparent;
    color: var(--accent-blue);
    font-size: 24px;
    cursor: pointer;
    transition: all 0.2s;
}

.temp-btn:hover {
    background: var(--accent-blue);
    color: var(--bg-dark);
}

.target-temp {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-secondary);
}

.power-toggle {
    margin-top: 10px;
}

.power-btn {
    padding: 12px 32px;
    border-radius: 24px;
    border: none;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.power-btn.on {
    background: var(--accent-green);
    color: white;
}

.power-btn.off {
    background: var(--text-secondary);
    color: var(--bg-dark);
}

.power-btn:hover {
    transform: scale(1.05);
}

.power-btn .btn-text {
    position: relative;
    z-index: 2;
}

.power-btn .hold-progress {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0;
    background: rgba(255, 255, 255, 0.2);
    transition: width 0.05s linear;
    z-index: 1;
}

.power-btn.off .hold-progress {
    background: rgba(0, 0, 0, 0.15);
}

.power-btn .hold-hint {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    font-weight: 500;
    opacity: 0.8;
    z-index: 2;
}

.power-btn.holding {
    transform: scale(0.98);
}

/* Mode Toggle */
.mode-toggle {
    display: flex;
    gap: 8px;
    background: var(--bg-card);
    padding: 4px;
    border-radius: 24px;
    border: 1px solid #30363d;
}

.mode-btn {
    padding: 8px 20px;
    border-radius: 20px;
    border: none;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    background: transparent;
    color: var(--text-secondary);
}

.mode-btn.active {
    background: var(--accent-blue);
    color: white;
}

.mode-btn.night {
    border-color: #6c5ce7;
    color: #6c5ce7;
}

.mode-btn.night:hover:not(.active) {
    background: rgba(108, 92, 231, 0.2);
}

.mode-btn.night.active {
    background: #6c5ce7;
    color: white;
}

.mode-btn:hover:not(.active) {
    background: #21262d;
}

/* Offset Controls */
.offset-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    background: var(--bg-card);
    padding: 16px 24px;
    border-radius: 12px;
    border: 1px solid #30363d;
}

.offset-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.offset-buttons {
    display: flex;
    align-items: center;
    gap: 16px;
}

.offset-btn {
    padding: 10px 20px;
    border-radius: 8px;
    border: 2px solid var(--accent-orange);
    background: transparent;
    color: var(--accent-orange);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.offset-btn:hover {
    background: var(--accent-orange);
    color: var(--bg-dark);
}

.current-offset {
    font-size: 24px;
    font-weight: 700;
    min-width: 60px;
    text-align: center;
}

.current-offset.positive {
    color: var(--accent-red);
}

.current-offset.negative {
    color: var(--accent-blue);
}

/* Night Mode Settings */
.night-settings {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    background: var(--bg-card);
    padding: 16px 20px;
    border-radius: 12px;
    border: 1px solid #6c5ce7;
}

.night-toggle-row,
.night-reduction-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.toggle-btn {
    padding: 6px 16px;
    border-radius: 16px;
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.toggle-btn.on {
    background: #6c5ce7;
    color: white;
}

.toggle-btn.off {
    background: #444;
    color: #888;
}

.toggle-btn:hover {
    transform: scale(1.05);
}

.effective-target {
    font-size: 14px;
    color: #6c5ce7;
    font-weight: 600;
}

.night-reduction {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-card);
    padding: 10px 16px;
    border-radius: 8px;
    border: 1px solid #30363d;
}

.night-label {
    font-size: 12px;
    color: var(--text-secondary);
}

.reduction-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid #6c5ce7;
    background: transparent;
    color: #6c5ce7;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
}

.reduction-btn:hover {
    background: #6c5ce7;
    color: white;
}

.reduction-value {
    font-size: 18px;
    font-weight: 600;
    color: #6c5ce7;
    min-width: 60px;
    text-align: center;
}

.reduction-value.cooler {
    color: var(--accent-blue);
}

.reduction-value.warmer {
    color: var(--accent-red);
}

.night-hint {
    font-size: 12px;
    color: var(--text-secondary);
}

.effective-target {
    font-size: 14px;
    color: #6c5ce7;
    font-weight: 600;
}

/* Info Grid */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.info-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 16px;
    border: 1px solid #30363d;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    cursor: grab;
    transition: transform 0.2s, opacity 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.info-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.info-card.dragging {
    opacity: 0.5;
    transform: scale(0.95);
    cursor: grabbing;
}

.info-card:active {
    cursor: grabbing;
}

.info-card h3 {
    margin: 0 0 12px 0;
    font-size: 14px;
    color: var(--text-secondary);
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid #21262d;
}

.info-row:last-child {
    border-bottom: none;
}

.info-row .positive {
    color: var(--accent-red);
}

.info-row .negative {
    color: var(--accent-blue);
}

/* Rate limiting */
.info-row.rate-limited {
    color: var(--accent-red);
    font-weight: 600;
}

.info-row.rate-warning {
    color: var(--accent-orange);
}

.rate-limit-warning {
    margin-top: 8px;
    padding: 8px;
    background: rgba(248, 81, 73, 0.15);
    border: 1px solid rgba(248, 81, 73, 0.3);
    border-radius: 8px;
    color: var(--accent-red);
    font-size: 12px;
    text-align: center;
}

.no-data {
    color: var(--text-secondary);
    font-style: italic;
    font-size: 14px;
}

.stable-indicator {
    margin-top: 12px;
    padding: 8px;
    background: rgba(63, 185, 80, 0.1);
    border-radius: 8px;
    color: var(--accent-green);
    font-size: 13px;
    text-align: center;
}

/* Curve Graph Container */
.curve-graph-container {
    width: 100%;
    height: 180px;
    position: relative;
    margin: 8px 0;
    overflow: hidden;
    box-sizing: border-box;
}

.curve-graph-container canvas {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
}

.curve-graph-stats {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #21262d;
}

.curve-graph-stats .stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
}

.curve-graph-stats .stat-label {
    color: var(--text-secondary);
}

.curve-graph-stats .stat-value {
    color: var(--text-primary);
    font-family: 'SF Mono', Monaco, monospace;
}

.curve-graph-stats .stat-value.actual {
    color: var(--accent-green);
}

/* Curve Graph Card */
.curve-graph-card {
    min-width: 280px;
    overflow: hidden;
}

.curve-graph-card h3 {
    margin-bottom: 8px;
}

/* Actions */
.actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.action-btn {
    padding: 10px 20px;
    border-radius: 8px;
    border: 1px solid #30363d;
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

.action-btn:hover {
    border-color: var(--accent-blue);
    background: rgba(88, 166, 255, 0.1);
}

.action-btn.danger {
    border-color: var(--accent-red);
    color: var(--accent-red);
}

.action-btn.danger:hover {
    background: rgba(248, 81, 73, 0.1);
}

.btn-primary {
    background: var(--accent-blue);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    text-decoration: none;
    display: inline-block;
    margin-top: 16px;
}

/* Curve Learning Page */

/* Curve Adjustment Alert */
.curve-adjustment-alert {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.15), rgba(255, 152, 0, 0.1));
    border: 1px solid #ffc107;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
}

.curve-adjustment-alert h3 {
    margin: 0 0 12px 0;
    color: #ffc107;
}

.curve-adjustment-alert > p {
    margin: 0 0 16px 0;
    color: var(--text-secondary);
}

.adjustment-details {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.adjustment-item {
    background: var(--bg-card);
    border-radius: 8px;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.adjustment-item.increase {
    border-left: 3px solid #ff6b6b;
}

.adjustment-item.decrease {
    border-left: 3px solid #4dabf7;
}

.adjustment-item span {
    font-weight: 600;
}

.adjustment-item.increase span {
    color: #ff6b6b;
}

.adjustment-item.decrease span {
    color: #4dabf7;
}

.adjustment-note {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 0;
}

.adjustment-tip {
    font-size: 13px;
    color: #ffc107;
    margin: 8px 0 0 0;
    font-style: italic;
}

h1 {
    text-align: center;
    margin-bottom: 24px;
}

.curve-summary {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px 32px;
    text-align: center;
    border: 1px solid #30363d;
}

.stat-value {
    display: block;
    font-size: 32px;
    font-weight: 700;
    color: var(--accent-blue);
}

.stat-label {
    color: var(--text-secondary);
    font-size: 12px;
    margin-top: 4px;
}

.curve-chart {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
    border: 1px solid #30363d;
}

.curve-chart h3 {
    margin: 0 0 16px 0;
    text-align: center;
}

.chart-container {
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    height: 200px;
    position: relative;
    padding-bottom: 40px;
}

.chart-bar {
    flex: 1;
    max-width: 60px;
    position: relative;
    height: 100%;
}

.bar {
    position: absolute;
    width: 70%;
    left: 15%;
    border-radius: 4px 4px 0 0;
    transition: height 0.3s;
}

.bar-label {
    position: absolute;
    bottom: -25px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 11px;
    color: var(--text-secondary);
}

.bar-value {
    position: absolute;
    top: 30%;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 10px;
    color: white;
}

.bins-table {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
    border: 1px solid #30363d;
}

.bins-table h3 {
    margin: 0 0 16px 0;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px 8px;
    text-align: left;
    border-bottom: 1px solid #21262d;
}

th {
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

td.positive {
    color: var(--accent-red);
}

td.negative {
    color: var(--accent-blue);
}

.confidence-bar {
    position: relative;
    background: #21262d;
    border-radius: 10px;
    height: 20px;
    overflow: hidden;
}

.confidence-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-green));
    border-radius: 10px;
    transition: width 0.3s;
}

.confidence-bar span {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    color: white;
}

.no-data-message {
    text-align: center;
    padding: 60px 20px;
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid #30363d;
}

.no-data-message h3 {
    margin-bottom: 16px;
}

.no-data-message p {
    color: var(--text-secondary);
    margin: 8px 0;
}

/* Responsive */
@media (max-width: 1000px) {
    .info-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
    
    .info-card {
        min-width: 0;
    }
}

@media (max-width: 600px) {
    .info-grid {
        grid-template-columns: 1fr;
    }
    
    .info-card {
        min-width: unset;
    }
    
    .thermostat {
        width: 240px;
    }
    
    .curve-summary {
        flex-direction: column;
        align-items: center;
    }
    
    table {
        font-size: 12px;
    }
    
    th, td {
        padding: 8px 4px;
    }
}

/* PWA Install Banner */
.pwa-install-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #1e3a5f 0%, #0d1117 100%);
    border-top: 1px solid var(--accent-blue);
    padding: 16px 20px;
    z-index: 1000;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.pwa-install-content {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 16px;
}

.pwa-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.pwa-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.pwa-text strong {
    font-size: 16px;
    color: var(--text-primary);
}

.pwa-text small {
    font-size: 12px;
    color: var(--text-secondary);
}

.pwa-install-btn {
    padding: 10px 24px;
    background: var(--accent-blue);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.pwa-install-btn:hover {
    background: #4c9aed;
    transform: scale(1.05);
}

.pwa-dismiss-btn {
    width: 32px;
    height: 32px;
    background: transparent;
    border: 1px solid var(--text-secondary);
    border-radius: 50%;
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.pwa-dismiss-btn:hover {
    border-color: var(--accent-red);
    color: var(--accent-red);
}

/* Mobile PWA adjustments */
@media (max-width: 480px) {
    .pwa-install-content {
        flex-wrap: wrap;
    }
    
    .pwa-icon {
        display: none;
    }
    
    .pwa-text {
        flex: 1 1 calc(100% - 50px);
    }
    
    .pwa-install-btn {
        flex: 1;
        margin-top: 8px;
    }
    
    .pwa-dismiss-btn {
        position: absolute;
        top: 8px;
        right: 8px;
        width: 28px;
        height: 28px;
    }
    
    .pwa-install-banner {
        padding-top: 40px;
    }
}

/* iOS-specific install instructions */
.ios-install-hint {
    background: var(--bg-card);
    border: 1px solid #30363d;
    border-radius: 12px;
    padding: 16px;
    margin-top: 16px;
    text-align: center;
    display: none;
}

.ios-install-hint.visible {
    display: block;
}

.ios-install-hint p {
    margin: 8px 0;
    color: var(--text-secondary);
    font-size: 14px;
}

.ios-install-hint .share-icon {
    display: inline-block;
    width: 20px;
    height: 20px;
    vertical-align: middle;
}

/* Standalone mode adjustments (when installed as PWA) */
@media (display-mode: standalone) {
    .pwa-install-banner {
        display: none !important;
    }
    
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* Hot Water Controls */
.hot-water-card {
    background: linear-gradient(135deg, #1a2332 0%, #1e2a3a 100%);
}

.hot-water-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 16px;
}

.hw-btn {
    width: 100%;
    padding: 10px 16px;
    border-radius: 8px;
    border: none;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.hw-btn .btn-text {
    position: relative;
    z-index: 2;
}

.hw-btn .hold-progress {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.3);
    transition: width 0.05s linear;
    z-index: 1;
}

.hw-btn .hold-hint {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    opacity: 0.8;
    z-index: 2;
}

.hw-btn.holding {
    transform: scale(0.98);
}

.hw-btn.on {
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
    color: white;
}

.hw-btn.off {
    background: #2d3748;
    color: #a0aec0;
    border: 1px solid #4a5568;
}

.hw-btn.off:hover {
    background: #3d4a5c;
}

.hw-btn.off.active {
    background: linear-gradient(135deg, #4a90a4 0%, #2d6a7d 100%);
    color: white;
    border: none;
}

.hw-btn.schedule {
    background: #2d3748;
    color: #a0aec0;
    border: 1px solid #4a5568;
}

.hw-btn.schedule:hover {
    background: #4a5568;
}

.hw-btn.schedule.active {
    background: linear-gradient(135deg, #ff8c42 0%, #ff6b35 100%);
    color: white;
    border: none;
}

.hw-btn.boost {
    background: #2d3748;
    color: #a0aec0;
    border: 1px solid #4a5568;
}

.hw-btn.boost:hover:not(:disabled) {
    background: #4a5568;
}

.hw-btn.boost.active {
    background: linear-gradient(135deg, #ff5252 0%, #d32f2f 100%);
    color: white;
    border: none;
    animation: pulse-boost 1.5s infinite;
}

.hw-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

@keyframes pulse-boost {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 82, 82, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(255, 82, 82, 0); }
}

.temp-hot {
    color: #ff6b35;
    font-weight: bold;
}

.temp-warm {
    color: #f6e05e;
}

.temp-cold {
    color: #63b3ed;
}

.status-on {
    color: #48bb78;
    font-weight: bold;
}

.status-off {
    color: #a0aec0;
}

.powerful-badge {
    display: inline-block;
    background: linear-gradient(135deg, #f6e05e 0%, #ecc94b 100%);
    color: #744210;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
    margin-left: 8px;
    animation: pulse-boost 1.5s infinite;
}

/* ==================== */
/* Login Page           */
/* ==================== */

.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    font-size: 28px;
    margin-bottom: 10px;
}

.login-header p {
    color: var(--text-secondary);
}

.login-card .form-group {
    margin-bottom: 20px;
}

.login-card label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 14px;
}

.login-card input[type="text"],
.login-card input[type="password"] {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #333;
    border-radius: 8px;
    background: #0d1117;
    color: var(--text-primary);
    font-size: 16px;
}

.login-card input:focus {
    outline: none;
    border-color: var(--accent-blue);
}

.login-card .remember {
    display: flex;
    align-items: center;
    gap: 8px;
}

.login-card .remember label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    margin: 0;
}

.btn-login {
    width: 100%;
    padding: 14px;
    background: var(--accent-blue);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-login:hover {
    background: #4090e0;
}

.btn-login:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.error-message {
    background: rgba(248, 81, 73, 0.1);
    border: 1px solid var(--accent-red);
    color: var(--accent-red);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
}

/* First Run Notice */
.first-run-notice {
    background: rgba(63, 185, 80, 0.1);
    border: 1px solid var(--accent-green);
    color: var(--accent-green);
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
}

.first-run-notice strong {
    display: block;
    font-size: 16px;
    margin-bottom: 8px;
}

.first-run-notice p {
    margin: 0;
    font-size: 14px;
    color: var(--text-secondary);
}

/* ==================== */
/* Setup Page           */
/* ==================== */

.setup-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    background: var(--bg-dark);
}

.setup-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    border: 1px solid #30363d;
}

.setup-header {
    text-align: center;
    margin-bottom: 30px;
}

.setup-header h1 {
    font-size: 22px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.setup-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

.setup-card .form-group,
.setup-form .form-group {
    margin-bottom: 20px;
}

.setup-card .form-group label,
.setup-form .form-group label {
    display: block;
    color: var(--text-secondary);
    font-size: 12px;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.setup-card input[type="text"],
.setup-card input[type="password"],
.setup-form input[type="text"],
.setup-form input[type="password"],
.setup-container input[type="text"],
.setup-container input[type="password"] {
    width: 100% !important;
    padding: 14px 16px !important;
    border: 1px solid #30363d !important;
    border-radius: 8px !important;
    background: #0d1117 !important;
    color: #e6edf3 !important;
    font-size: 16px !important;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.setup-card input:focus,
.setup-form input:focus,
.setup-container input:focus {
    outline: none !important;
    border-color: #58a6ff !important;
}

.setup-card input::placeholder,
.setup-form input::placeholder,
.setup-container input::placeholder {
    color: #6e7681 !important;
}

.credentials-display {
    background: var(--bg-dark);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid #30363d;
}

.credential-item {
    margin-bottom: 16px;
}

.credential-item:last-child {
    margin-bottom: 0;
}

.credential-item label {
    display: block;
    color: var(--text-secondary);
    font-size: 11px;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.credential-value {
    background: #1a1f26;
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid #30363d;
}

.credential-value code {
    font-size: 15px;
    color: var(--accent-green);
    word-break: break-all;
    font-family: 'Consolas', 'Monaco', monospace;
}

.success-box {
    background: rgba(63, 185, 80, 0.1);
    border: 1px solid var(--accent-green);
    color: var(--accent-green);
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
}

.success-box strong {
    display: block;
    font-size: 16px;
    margin-bottom: 4px;
}

.success-box p {
    margin: 0;
    font-size: 14px;
    opacity: 0.9;
}

.warning-box {
    background: rgba(210, 153, 34, 0.1);
    border: 1px solid var(--accent-orange);
    color: var(--accent-orange);
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.warning-box strong {
    display: block;
    margin-bottom: 8px;
}

.warning-box p {
    margin: 4px 0;
    font-size: 14px;
}

/* Timer Box for Setup Page */
.timer-box {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: rgba(88, 166, 255, 0.1);
    border: 1px solid var(--accent-blue);
    color: var(--accent-blue);
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 16px;
}

.timer-icon {
    font-size: 20px;
}

.timer-text strong {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 18px;
}

/* Expired Box */
.expired-box {
    background: rgba(248, 81, 73, 0.1);
    border: 1px solid var(--accent-red);
    color: var(--accent-red);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
}

.expired-box strong {
    display: block;
    font-size: 18px;
    margin-bottom: 12px;
}

.expired-box p {
    margin: 8px 0;
    font-size: 14px;
    color: var(--text-secondary);
}

.expired-box code {
    background: rgba(0,0,0,0.3);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
}

/* Copy Button */
.credential-value {
    display: flex;
    align-items: center;
    gap: 8px;
}

.copy-btn {
    background: transparent;
    border: 1px solid var(--text-secondary);
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 14px;
    opacity: 0.7;
    transition: all 0.2s;
}

.copy-btn:hover {
    opacity: 1;
    border-color: var(--accent-blue);
    background: rgba(88, 166, 255, 0.1);
}

/* Copy Toast Notification */
.copy-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent-green);
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: bold;
    animation: fadeInOut 1.5s ease-in-out;
    z-index: 1000;
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translateX(-50%) translateY(20px); }
    20% { opacity: 1; transform: translateX(-50%) translateY(0); }
    80% { opacity: 1; transform: translateX(-50%) translateY(0); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-10px); }
}

.api-credentials {
    background: #0d1117;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.api-credentials h3 {
    margin-top: 0;
    margin-bottom: 12px;
}

.btn-primary {
    display: block;
    width: 100%;
    padding: 16px;
    background: var(--accent-green);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: #2ea043;
}

/* ==================== */
/* Settings Page        */
/* ==================== */

.settings-container {
    max-width: 700px;
    margin: 0 auto;
    padding: 30px 20px;
}

.settings-container h2 {
    margin-bottom: 24px;
}

.settings-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
}

.settings-card h3 {
    margin-top: 0;
    margin-bottom: 16px;
    font-size: 18px;
}

.settings-card .description {
    color: var(--text-secondary);
    margin-bottom: 16px;
    font-size: 14px;
}

.settings-card .form-group {
    margin-bottom: 20px;
}

.settings-card label {
    display: block;
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 8px;
}

.settings-card input[type="text"],
.settings-card input[type="password"] {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #333;
    border-radius: 6px;
    background: #0d1117;
    color: var(--text-primary);
    font-size: 14px;
    margin-bottom: 8px;
}

.input-row {
    display: flex;
    gap: 10px;
}

.input-row input {
    flex: 1;
}

.credential-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.credential-row label {
    width: 100px;
    margin: 0;
}

.credential-row .key-box {
    flex: 1;
    background: #0d1117;
    padding: 10px 14px;
    border-radius: 6px;
    border: 1px solid #333;
    min-width: 200px;
}

.credential-row code {
    color: var(--accent-green);
    font-size: 13px;
    word-break: break-all;
}

.btn-small {
    padding: 8px 12px;
    background: #333;
    border: none;
    border-radius: 6px;
    color: white;
    cursor: pointer;
    font-size: 14px;
}

.btn-small:hover {
    background: #444;
}

.btn-secondary {
    padding: 10px 16px;
    background: #333;
    border: none;
    border-radius: 6px;
    color: white;
    cursor: pointer;
    font-size: 14px;
}

.btn-secondary:hover {
    background: #444;
}

.btn-danger {
    padding: 10px 16px;
    background: var(--accent-red);
    border: none;
    border-radius: 6px;
    color: white;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    display: inline-block;
}

.btn-danger:hover {
    background: #d63d36;
}

.action-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 16px;
}

.success-message {
    color: var(--accent-green);
    font-size: 14px;
    margin-top: 8px;
}

.download-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.btn-download {
    padding: 14px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.2s;
}

.btn-download:hover {
    transform: scale(1.02);
}

.btn-download.android {
    background: linear-gradient(135deg, #3ddc84 0%, #2da866 100%);
    color: white;
}

.btn-download.windows {
    background: linear-gradient(135deg, #0078d4 0%, #005a9e 100%);
    color: white;
}

.btn-download.wizard {
    background: linear-gradient(135deg, #9333ea 0%, #7e22ce 100%);
    color: white;
}

.setup-instructions {
    background: #0d1117;
    border-radius: 8px;
    padding: 16px;
}

.setup-instructions h4 {
    margin-top: 0;
    margin-bottom: 12px;
}

.setup-instructions ol {
    margin: 0;
    padding-left: 20px;
}

.setup-instructions li {
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.setup-instructions code {
    background: #1a1a2e;
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--accent-blue);
}

.back-link {
    display: inline-block;
    color: var(--accent-blue);
    text-decoration: none;
    margin-top: 10px;
}

.version-info {
    text-align: center;
    margin-top: 20px;
    padding: 10px;
    color: #8b949e;
}

.version-info .app-logo {
    width: 64px;
    height: 64px;
    margin-bottom: 8px;
}

.version-info .app-name {
    font-weight: 600;
    color: #e6edf3;
    margin-bottom: 4px;
}

/* Token Status Section */
.token-status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.token-status-item {
    background: #0d1117;
    border-radius: 8px;
    padding: 16px;
    border: 1px solid #30363d;
}

.token-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.token-label {
    font-weight: bold;
    font-size: 16px;
}

.token-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
}

.token-badge.status-healthy {
    background: rgba(63, 185, 80, 0.2);
    color: var(--accent-green);
}

.token-badge.status-warning {
    background: rgba(210, 153, 34, 0.2);
    color: var(--accent-orange);
}

.token-badge.status-error {
    background: rgba(248, 81, 73, 0.2);
    color: var(--accent-red);
}

.token-badge.status-unknown {
    background: rgba(139, 148, 158, 0.2);
    color: var(--text-secondary);
}

.token-expiry {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.token-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-warning {
    background: var(--accent-orange) !important;
    color: #1a1a1a !important;
}

.btn-warning:hover {
    background: #e5a822 !important;
}

/* Auth Pages */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    background: var(--bg-dark);
}

.auth-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    border: 1px solid #30363d;
    text-align: center;
}

.auth-card h1 {
    margin-bottom: 20px;
}

.auth-card .description {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.status-box {
    padding: 16px;
    border-radius: 8px;
    margin: 20px 0;
}

.status-box.info {
    background: rgba(88, 166, 255, 0.1);
    border: 1px solid var(--accent-blue);
    color: var(--accent-blue);
}

.status-box.success {
    background: rgba(63, 185, 80, 0.1);
    border: 1px solid var(--accent-green);
    color: var(--accent-green);
}

.status-box.error {
    background: rgba(248, 81, 73, 0.1);
    border: 1px solid var(--accent-red);
    color: var(--accent-red);
}

.device-code-box {
    margin: 20px 0;
}

.auth-link {
    display: block;
    background: #0d1117;
    padding: 12px;
    border-radius: 8px;
    color: var(--accent-blue);
    word-break: break-all;
    margin: 10px 0;
}

.code-display {
    margin: 20px 0;
}

.user-code {
    font-size: 36px;
    font-weight: bold;
    font-family: 'Consolas', 'Monaco', monospace;
    letter-spacing: 4px;
    background: #0d1117;
    padding: 20px;
    border-radius: 8px;
    color: var(--accent-green);
    margin: 10px 0;
}

.timer {
    font-size: 14px;
    color: var(--text-secondary);
}

.back-link:hover {
    text-decoration: underline;
}

/* Ngrok Status Styles */
.ngrok-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-weight: 500;
}

.ngrok-status.active {
    background: rgba(40, 167, 69, 0.15);
    color: var(--accent-green);
}

.ngrok-status.inactive {
    background: rgba(108, 117, 125, 0.15);
    color: var(--text-secondary);
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.status-indicator.online {
    background: var(--accent-green);
    box-shadow: 0 0 8px var(--accent-green);
    animation: pulse 2s infinite;
}

.status-indicator.offline {
    background: #6c757d;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.ngrok-url-box {
    background: #0d1117;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 16px;
}

.ngrok-url-box p {
    margin: 0 0 8px 0;
    color: var(--text-secondary);
}

.ngrok-url-box code {
    display: block;
    color: var(--accent-blue);
    font-size: 16px;
    word-break: break-all;
    margin-bottom: 10px;
}

.qr-box {
    background: #0d1117;
    padding: 16px;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 16px;
}

.qr-box p {
    margin: 0 0 12px 0;
    color: var(--text-secondary);
}

.qr-image {
    border-radius: 8px;
    background: white;
    padding: 8px;
}

.qr-hint {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 12px;
    opacity: 0.8;
}

.qr-setup-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.qr-setup-section h4 {
    margin: 0 0 12px 0;
    color: var(--text-primary);
}

.description.warning {
    color: #ffc107;
    background: rgba(255, 193, 7, 0.1);
    padding: 8px 12px;
    border-radius: 6px;
    border-left: 3px solid #ffc107;
}

.section-divider {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 20px 0;
}

.field-description {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 4px 0 8px 0;
}

.current-url {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.current-url code {
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
}

/* Weather Widget */
.weather-card {
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(64, 128, 196, 0.1) 100%);
}

.cold-spell-warning {
    background: linear-gradient(90deg, rgba(100, 180, 255, 0.2) 0%, rgba(64, 196, 255, 0.1) 100%);
    border: 1px solid rgba(100, 180, 255, 0.4);
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 12px;
    font-size: 13px;
    color: #7dd3fc;
    text-align: center;
    animation: pulse-cold 2s infinite;
}

@keyframes pulse-cold {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.temp-freezing { color: #7dd3fc; }
.temp-cold { color: #4dabf7; }
.temp-cool { color: #74c0fc; }
.temp-mild { color: #ffd43b; }
.temp-warm { color: #ff922b; }

.trend-rising { color: var(--accent-red); }
.trend-falling { color: var(--accent-blue); }

.forecast-section {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #30363d;
}

.forecast-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.forecast-items {
    display: flex;
    justify-content: center;
    gap: 2px;
    flex-wrap: nowrap;
    padding: 0 4px;
}

.forecast-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 3px 4px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    min-width: 32px;
    max-width: 42px;
    flex: 1 1 0;
}

.forecast-item.nighttime {
    background: rgba(0, 0, 0, 0.4);
    opacity: 0.85;
}

.forecast-time {
    font-size: 10px;
    color: var(--text-secondary);
}

.forecast-temp {
    font-size: 12px;
    font-weight: 600;
}

.forecast-icon {
    font-size: 14px;
    line-height: 1;
    filter: brightness(0.90);
}

.weather-credit {
    font-size: 9px;
    color: var(--text-secondary);
    text-align: right;
    opacity: 0.7;
    margin-top: 4px;
}

/* Address Lookup */
.address-input {
    display: flex;
    gap: 8px;
}

.address-input input {
    flex: 1;
}

.address-input button {
    flex-shrink: 0;
}

.location-buttons {
    margin-top: 8px;
}

.resolved-location {
    margin-top: 8px;
    padding: 8px 12px;
    background: rgba(63, 185, 80, 0.1);
    border: 1px solid rgba(63, 185, 80, 0.3);
    border-radius: 6px;
    color: var(--accent-green);
    font-size: 13px;
}

/* Mobile Setup Page */
.mobile-setup-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #0d1117 0%, #161b22 100%);
}

.setup-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 40px;
    max-width: 500px;
    width: 100%;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.app-logo-large {
    width: 80px;
    height: 80px;
    margin-bottom: 16px;
}

.setup-card h1 {
    margin: 0 0 8px 0;
    font-size: 24px;
    color: var(--text-primary);
}

.setup-card .tagline {
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.step-section {
    text-align: left;
    margin-bottom: 32px;
}

.step {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
}

.step-number {
    width: 32px;
    height: 32px;
    background: var(--accent-blue);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    flex-shrink: 0;
}

.step-content h3 {
    margin: 0 0 8px 0;
    font-size: 16px;
    color: var(--text-primary);
}

.step-content p {
    margin: 0 0 12px 0;
    color: var(--text-secondary);
    font-size: 14px;
}

.btn-download, .btn-configure {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    margin-bottom: 8px;
}

.btn-download {
    background: linear-gradient(135deg, #238636, #2ea043);
    color: white;
}

.btn-configure {
    background: linear-gradient(135deg, #1f6feb, #388bfd);
    color: white;
}

.btn-download:hover, .btn-configure:hover {
    filter: brightness(1.1);
}

.step-content .hint {
    font-size: 12px;
    color: var(--text-secondary);
    opacity: 0.8;
}

.config-info {
    background: rgba(31, 111, 235, 0.1);
    border: 1px solid rgba(31, 111, 235, 0.3);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 24px;
    text-align: left;
}

.config-info h4 {
    margin: 0 0 12px 0;
    color: var(--text-primary);
    font-size: 14px;
}

.config-info p {
    margin: 4px 0;
    font-size: 13px;
    color: var(--text-secondary);
}

.config-info .security-note {
    color: var(--accent-green);
    margin-top: 8px;
}

.error-section {
    padding: 24px;
    background: rgba(248, 81, 73, 0.1);
    border: 1px solid rgba(248, 81, 73, 0.3);
    border-radius: 8px;
    margin-bottom: 24px;
}

.error-section .error-message {
    color: #f85149;
    font-weight: 600;
    margin-bottom: 8px;
}

.manual-section {
    text-align: left;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.manual-section h4 {
    margin: 0 0 12px 0;
    color: var(--text-primary);
    font-size: 14px;
}

.manual-section p, .manual-section ol {
    font-size: 13px;
    color: var(--text-secondary);
}

.manual-section ol {
    padding-left: 20px;
    margin: 12px 0 0 0;
}

.manual-section li {
    margin-bottom: 6px;
}

/* PWA Install Page Styles */
.platform-section {
    margin: 24px 0;
}

.platform-card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 16px;
}

.platform-card.ios {
    border: 1px solid rgba(0, 122, 255, 0.3);
}

.platform-card.android {
    border: 1px solid rgba(61, 220, 132, 0.3);
}

.platform-card.windows {
    border: 1px solid rgba(0, 120, 215, 0.3);
}

.platform-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.platform-card h3 {
    margin: 0 0 20px 0;
    color: var(--text-primary);
    font-size: 18px;
}

.install-steps {
    text-align: left;
}

.install-steps .step {
    margin-bottom: 16px;
}

.install-steps .step p {
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.6;
}

.icon-hint {
    opacity: 0.7;
}

.result-hint {
    color: var(--accent-green);
    font-weight: 500;
    margin-top: 20px;
}

.btn-install {
    display: inline-block;
    padding: 14px 32px;
    background: linear-gradient(135deg, #238636, #2ea043);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 16px;
    transition: all 0.2s;
}

.btn-install:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.all-platforms h3 {
    margin-bottom: 20px;
    color: var(--text-primary);
}

.platform-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.platform-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px 24px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.platform-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.platform-btn.ios:hover {
    border-color: rgba(0, 122, 255, 0.5);
}

.platform-btn.android:hover {
    border-color: rgba(61, 220, 132, 0.5);
}

.platform-btn.windows:hover {
    border-color: rgba(0, 120, 215, 0.5);
}

.btn-link {
    background: none;
    border: none;
    color: var(--accent-blue);
    cursor: pointer;
    font-size: 14px;
    margin-top: 16px;
}

.btn-link:hover {
    text-decoration: underline;
}

.already-installed {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.already-installed p {
    color: var(--text-secondary);
    font-size: 14px;
}

.already-installed a {
    color: var(--accent-blue);
}


