:root {
    --bg-0: #0b0d10;
    --bg-1: #15191f;
    --bg-2: #222831;
    --panel: #f4f6f8;
    --panel-soft: #e8ecef;
    --ink: #111827;
    --muted: #64707d;
    --line: #d6dbe0;
    --line-dark: rgba(255, 255, 255, 0.12);
    --white: #ffffff;
    --accent: #2f80ed;
    --accent-strong: #1f6ed4;
    --success: #13945f;
    --danger: #c43b43;
    --warning: #b7791f;
    --shadow: 0 20px 55px rgba(0, 0, 0, 0.32);
}

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

body {
    min-height: 100vh;
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        linear-gradient(145deg, #060708 0%, #171a1f 38%, #2c3138 72%, #111417 100%);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(90deg, rgba(255,255,255,0.055) 1px, transparent 1px),
        linear-gradient(180deg, rgba(255,255,255,0.04) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: linear-gradient(to bottom, rgba(0,0,0,0.52), transparent 72%);
}

.container {
    position: relative;
    width: min(1440px, 100%);
    margin: 0 auto;
    padding: 28px;
}

.site-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 18px clamp(18px, 4vw, 56px);
    color: #ffffff;
    background: linear-gradient(180deg, rgba(7, 8, 10, 0.86), rgba(7, 8, 10, 0));
}

.brand-lockup,
.site-nav a,
.app-brand {
    color: #ffffff;
    text-decoration: none;
}

.brand-lockup {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 820;
}

.brand-mark {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    color: #d7f7ff;
    font-size: 0.86rem;
    letter-spacing: 0;
}

.site-nav nav {
    display: flex;
    align-items: center;
    gap: 18px;
    font-size: 0.92rem;
    font-weight: 690;
}

.site-nav nav a {
    color: #d3d9df;
}

.site-nav nav a:hover {
    color: #ffffff;
}

.landing-hero {
    position: relative;
    min-height: 92vh;
    display: grid;
    align-items: end;
    overflow: hidden;
    padding: 120px clamp(18px, 5vw, 72px) 72px;
}

.hero-image,
.hero-overlay {
    position: absolute;
    inset: 0;
}

.hero-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-overlay {
    background:
        linear-gradient(90deg, rgba(5, 7, 9, 0.95) 0%, rgba(10, 13, 16, 0.74) 42%, rgba(10, 13, 16, 0.22) 100%),
        linear-gradient(180deg, rgba(4, 5, 7, 0.28) 0%, rgba(4, 5, 7, 0.38) 66%, #0b0d10 100%);
}

.hero-content {
    position: relative;
    width: min(760px, 100%);
    color: #ffffff;
}

.eyebrow {
    color: #90c7d7;
    font-size: 0.78rem;
    font-weight: 820;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-bottom: 14px;
}

.hero-content h1 {
    font-size: clamp(3.2rem, 8vw, 7.2rem);
    line-height: 0.92;
    font-weight: 820;
    letter-spacing: 0;
    max-width: 760px;
}

.hero-copy {
    width: min(640px, 100%);
    color: #d3d9df;
    font-size: clamp(1.05rem, 1.7vw, 1.3rem);
    line-height: 1.55;
    margin-top: 24px;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 30px;
}

.primary-action,
.secondary-action,
.text-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 780;
}

.primary-action {
    background: #f5f7f9;
    color: #0c1116;
    padding: 0 18px;
}

.secondary-action {
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.24);
    background: rgba(255, 255, 255, 0.08);
    padding: 0 18px;
}

.landing-band {
    padding: 64px clamp(18px, 5vw, 72px);
    background: #0b0d10;
    color: #ffffff;
}

.product-band {
    background: linear-gradient(180deg, #0b0d10, #161a1f);
}

.section-heading {
    width: min(760px, 100%);
    margin-bottom: 26px;
}

.section-heading h2,
.access-band h2 {
    color: #ffffff;
    font-size: clamp(2rem, 4vw, 3.7rem);
    line-height: 1.02;
    letter-spacing: 0;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.product-card {
    min-height: 250px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 24px;
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.055);
    padding: 22px;
}

.featured-product {
    background: linear-gradient(180deg, rgba(54, 93, 118, 0.34), rgba(255, 255, 255, 0.065));
    border-color: rgba(161, 213, 230, 0.28);
}

.product-status {
    color: #95d8b7;
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 12px;
}

.product-card h3,
.platform-points h3 {
    color: #ffffff;
    font-size: 1.22rem;
    margin-bottom: 10px;
}

.product-card p,
.platform-points p,
.access-band p {
    color: #c8d0d8;
    line-height: 1.55;
}

.text-link {
    align-self: flex-start;
    color: #d9f6ff;
}

.split-band {
    display: grid;
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
    gap: 46px;
    align-items: start;
    background: linear-gradient(135deg, #15191e, #252a31);
}

.platform-points {
    display: grid;
    gap: 14px;
}

.platform-points > div {
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    padding-top: 18px;
}

.access-band {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
    background: #0b0d10;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.access-band > div {
    width: min(720px, 100%);
}

.access-band .primary-action {
    flex: 0 0 auto;
}

.app-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 24px;
    align-items: end;
    color: var(--white);
    margin-bottom: 22px;
}

.app-brand {
    display: inline-block;
    color: #bfe8f5;
    font-size: 0.9rem;
    font-weight: 760;
    margin-bottom: 10px;
}

.app-header h1 {
    font-size: clamp(2rem, 4vw, 4.4rem);
    line-height: 0.98;
    font-weight: 760;
    letter-spacing: 0;
    max-width: 820px;
}

.app-header p {
    color: #c3c9d0;
    font-size: 1rem;
    margin-top: 14px;
}

.app-header::after {
    content: "Protected backend analysis";
    justify-self: end;
    align-self: start;
    color: #d7dde4;
    border: 1px solid var(--line-dark);
    border-radius: 999px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.07);
    font-size: 0.88rem;
    font-weight: 650;
}

.upload-section,
.analysis-section {
    background: rgba(244, 246, 248, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.upload-section {
    display: grid;
    grid-template-columns: minmax(320px, 1fr) minmax(280px, 420px);
    gap: 18px;
    margin-bottom: 26px;
    padding: 18px;
}

.notice-card {
    background: var(--white);
    border: 1px solid var(--line);
    border-left: 4px solid var(--success);
    border-radius: 8px;
    color: #26313b;
    line-height: 1.45;
    padding: 14px 16px;
}

.notice-card.warning {
    border-left-color: var(--warning);
}

.upload-section .notice-card {
    grid-column: 2;
}

.upload-area {
    grid-column: 1;
    grid-row: 1 / span 4;
    min-height: 255px;
    display: grid;
    place-items: center;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.92), rgba(232,236,239,0.92));
    border: 1px dashed #96a1ad;
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--accent);
    background: #ffffff;
    transform: translateY(-1px);
}

.upload-content {
    text-align: center;
    padding: 28px;
}

.upload-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 76px;
    height: 76px;
    border: 1px solid #aab4bf;
    border-radius: 8px;
    color: #17202a;
    background: #ffffff;
    font-size: 0.95rem;
    font-weight: 760;
    margin-bottom: 18px;
    box-shadow: 0 10px 26px rgba(20, 24, 29, 0.12);
}

.upload-content h3,
.sheet-selector h3,
.analysis-section h2,
#calendarSection h3,
#hourSelectionSection h3,
#hourlyStatsTable h3,
.card h3 {
    color: #121820;
    font-weight: 720;
    letter-spacing: 0;
}

.upload-content h3 {
    margin-bottom: 8px;
    font-size: 1.45rem;
}

.upload-content p {
    color: var(--muted);
    font-size: 0.98rem;
}

.upload-status {
    grid-column: 2;
    align-self: start;
    display: none;
    border-radius: 8px;
    font-weight: 700;
    padding: 12px 14px;
}

.upload-status.success {
    background: #e4f6ed;
    color: #0f6845;
    border: 1px solid #b8e4ce;
}

.upload-status.error {
    background: #fae8ea;
    color: #8a252b;
    border: 1px solid #efc4c8;
}

.upload-status.loading {
    background: #e7f0fb;
    color: #174d86;
    border: 1px solid #bdd5f1;
}

.debug-info {
    grid-column: 1 / -1;
    background: #101418;
    border: 1px solid #2a313a;
    border-radius: 8px;
    color: #d7dde4;
    padding: 16px;
    max-height: 280px;
    overflow-y: auto;
}

.debug-info h3 {
    color: #ffffff;
    margin-bottom: 10px;
}

.debug-info pre {
    color: #d7dde4;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: 12px;
}

.sheet-selector {
    grid-column: 1 / -1;
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
}

.sheet-selector h3 {
    font-size: 1rem;
}

.sheet-selector select,
#selectedHoursOutput {
    height: 42px;
    min-width: 220px;
    border: 1px solid #b8c0ca;
    border-radius: 8px;
    background: #ffffff;
    color: var(--ink);
    font-size: 0.95rem;
    padding: 0 12px;
}

button,
.control-btn,
.sheet-selector button {
    min-height: 42px;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 720;
    letter-spacing: 0;
    color: #ffffff;
    background: var(--accent);
    padding: 0 16px;
    transition: background 160ms ease, transform 160ms ease;
}

button:hover,
.control-btn:hover,
.sheet-selector button:hover {
    background: var(--accent-strong);
    transform: translateY(-1px);
}

.analysis-section {
    padding: 22px;
}

.analysis-section h2 {
    font-size: 1.6rem;
    margin-bottom: 18px;
}

.summary-cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}

.card {
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
}

.card h3 {
    margin-bottom: 12px;
    font-size: 1.05rem;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    padding: 10px 0;
    border-bottom: 1px solid #e6eaee;
}

.stat-item:last-child {
    border-bottom: 0;
}

.stat-label {
    color: var(--muted);
    font-weight: 650;
}

.stat-value {
    color: #111827;
    font-weight: 800;
}

#chartContainer {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin: 18px 0 28px;
}

#chartContainer canvas {
    width: 100% !important;
    height: 320px !important;
    max-height: 320px !important;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
}

#calendarSection,
#hourSelectionSection,
#hourlyStatsTable {
    margin-top: 28px;
}

#calendarSection h3,
#hourSelectionSection h3,
#hourlyStatsTable h3 {
    font-size: 1.18rem;
    margin-bottom: 14px;
}

.calendar-month-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.month-nav-btn {
    min-height: 36px;
    padding: 0 14px;
    background: #2b333d;
}

.month-nav-btn:hover {
    background: #111820;
}

.current-month {
    min-width: 190px;
    color: #121820;
    text-align: center;
    font-weight: 780;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 4px;
}

.calendar-header {
    background: #202730;
    color: #ffffff;
    border-radius: 6px;
    padding: 9px 6px;
    text-align: center;
    font-weight: 750;
    font-size: 0.86rem;
}

.calendar-day {
    min-height: 84px;
    border: 1px solid #d9dee4;
    border-radius: 6px;
    background: #ffffff;
    padding: 8px;
    cursor: pointer;
    transition: transform 160ms ease, border-color 160ms ease;
}

.calendar-day:hover {
    transform: translateY(-1px);
    border-color: #a9b3bf;
}

.calendar-day.profitable {
    background: #e7f6ef;
    border-color: #98d6b8;
}

.calendar-day.losing {
    background: #fae9ea;
    border-color: #efb3b8;
}

.calendar-day.breakeven {
    background: #fff5df;
    border-color: #e7c477;
}

.day-number {
    color: #17202a;
    font-weight: 800;
    margin-bottom: 5px;
}

.day-stats {
    color: #4e5b68;
    font-size: 0.72rem;
    line-height: 1.25;
}

.day-profit,
.positive {
    color: var(--success);
    font-weight: 800;
}

.day-profit.negative,
.negative {
    color: var(--danger);
    font-weight: 800;
}

.day-profit.zero {
    color: var(--warning);
}

.day-winrate {
    color: #566371;
}

.day-drawdown {
    color: var(--danger);
}

.selection-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 14px 0 18px;
}

.update-btn {
    background: var(--success);
}

.update-btn:hover {
    background: #0f7d50;
}

.fixed-width-btn {
    min-width: 180px;
}

#copySelectedHours {
    background: #2b333d !important;
}

#copySelectedHours:hover {
    background: #111820 !important;
}

#selectedHoursOutput {
    max-width: min(420px, 100%);
    margin-left: 0 !important;
}

.hours-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}

.hour-checkbox {
    min-height: 92px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.hour-checkbox:hover {
    border-color: #9da8b4;
    transform: translateY(-1px);
}

.hour-checkbox.selected {
    background: #202730;
    border-color: #202730;
    color: #ffffff;
}

.hour-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    accent-color: var(--accent);
}

.hour-checkbox label {
    flex: 1;
    cursor: pointer;
}

.hour-checkbox.selected label {
    color: #ffffff;
}

.hour-checkbox.selected .positive {
    color: #5ee0a2 !important;
}

.hour-checkbox.selected .negative {
    color: #ff7b83 !important;
}

.table-container {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
}

.stats-table,
table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
}

th,
td {
    padding: 13px 14px;
    text-align: left;
    border-bottom: 1px solid #e5e9ee;
}

th,
.stats-table th {
    background: #202730;
    color: #ffffff;
    font-weight: 760;
    position: sticky;
    top: 0;
}

td,
.stats-table td {
    color: #17202a;
}

tbody tr:hover {
    background: #f2f5f7;
}

.loading-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 3px solid rgba(47, 128, 237, 0.22);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
    vertical-align: middle;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@media (max-width: 980px) {
    .container {
        padding: 18px;
    }

    .app-header,
    .upload-section,
    .summary-cards,
    #chartContainer,
    .product-grid,
    .split-band {
        grid-template-columns: 1fr;
    }

    .app-header::after,
    .upload-section .notice-card,
    .upload-area,
    .upload-status {
        grid-column: 1;
    }

    .upload-area {
        grid-row: auto;
    }
}

@media (max-width: 640px) {
    .container {
        padding: 12px;
    }

    .site-nav {
        position: absolute;
        align-items: flex-start;
    }

    .site-nav nav {
        flex-direction: column;
        align-items: flex-end;
        gap: 8px;
    }

    .landing-hero {
        min-height: 90vh;
        padding-top: 150px;
    }

    .hero-actions,
    .access-band {
        align-items: stretch;
        flex-direction: column;
    }

    .primary-action,
    .secondary-action {
        width: 100%;
    }

    .app-header h1 {
        font-size: 2.1rem;
    }

    .upload-section,
    .analysis-section {
        padding: 12px;
    }

    .selection-controls {
        align-items: stretch;
    }

    .selection-controls button,
    #selectedHoursOutput {
        width: 100%;
    }

    .calendar-grid {
        gap: 3px;
    }

    .calendar-day {
        min-height: 72px;
        padding: 6px;
    }
}
