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

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #0a0a0a;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #e0e0e0;
}

.container {
    text-align: center;
    max-width: 720px;
    padding: 2rem 2rem 4rem;
    width: 100%;
}

.neon-title {
    font-size: 3rem;
    font-weight: 800;
    color: #fff;
    text-shadow:
        0 0 7px #ff003c,
        0 0 10px #ff003c,
        0 0 21px #ff003c,
        0 0 42px #00f0ff;
    margin-bottom: 0.5rem;
    letter-spacing: 4px;
}

.subtitle {
    font-size: 1.1rem;
    color: #00f0ff;
    text-shadow: 0 0 8px rgba(0, 240, 255, 0.4);
    margin-bottom: 2rem;
}

.neon-btn {
    padding: 14px 36px;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 2px;
    color: #0a0a0a;
    background: #ffe600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-transform: uppercase;
    box-shadow:
        0 0 6px #ffe600,
        0 0 14px #ffe600,
        0 0 30px #ffe600;
    transition: all 0.25s ease;
}

.neon-btn:hover {
    background: #fff;
    box-shadow:
        0 0 8px #ffe600,
        0 0 20px #ffe600,
        0 0 40px #ffe600,
        0 0 60px #ff003c;
    transform: scale(1.05);
}

.neon-btn:active {
    transform: scale(0.97);
}

.back-link {
    display: inline-block;
    margin-bottom: 1.5rem;
    color: #00f0ff;
    text-decoration: none;
    font-size: 1rem;
    letter-spacing: 1px;
    text-shadow: 0 0 8px rgba(0, 240, 255, 0.4);
    transition: color 0.2s;
}

.back-link:hover {
    color: #ffe600;
    text-shadow: 0 0 8px rgba(255, 230, 0, 0.4);
}

.period-wrapper {
    text-align: center;
    max-width: 400px;
    margin: 0 auto 2rem;
}

.stats-container {
    margin-top: 2.5rem;
}

.stats-title {
    font-size: 1.6rem;
    color: #ff003c;
    text-shadow: 0 0 8px rgba(255, 0, 60, 0.5);
    margin-bottom: 1.2rem;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.stat-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(0, 240, 255, 0.25);
    border-radius: 10px;
    padding: 1.2rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.1);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, #ff003c, #ffe600, #00f0ff);
}

.stat-card:hover {
    border-color: #ff003c;
    box-shadow: 0 0 16px rgba(255, 0, 60, 0.25);
}

.stat-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #00f0ff;
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: #ffe600;
    text-shadow: 0 0 10px rgba(255, 230, 0, 0.5);
}

.stat-unit {
    font-size: 0.75rem;
    color: #888;
}

.click-hint {
    font-size: 0.65rem;
    color: #ff003c;
    text-shadow: 0 0 6px rgba(255, 0, 60, 0.4);
    margin-top: 4px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.modal-label {
    display: block;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #00f0ff;
    margin-bottom: 0.5rem;
}

.modal-select {
    display: block;
    width: 100%;
    padding: 10px 14px;
    font-size: 1rem;
    color: #e0e0e0;
    background: #1a1a1a;
    border: 1px solid rgba(0, 240, 255, 0.3);
    border-radius: 6px;
    margin-bottom: 1rem;
    cursor: pointer;
    outline: none;
}

.modal-select:focus {
    border-color: #ffe600;
    box-shadow: 0 0 8px rgba(255, 230, 0, 0.3);
}

.loader {
    color: #ffe600;
    text-align: center;
    font-size: 1rem;
    letter-spacing: 2px;
    text-shadow: 0 0 10px rgba(255, 230, 0, 0.4);
}

.chart-wrap {
    position: relative;
    width: 100%;
    height: 360px;
    margin-top: 1rem;
}

.error {
    color: #ff003c;
    text-align: center;
    margin-top: 0.8rem;
    font-size: 0.9rem;
    text-shadow: 0 0 6px rgba(255, 0, 60, 0.4);
}

.stat-card {
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    border-color: #ff003c;
    box-shadow: 0 0 16px rgba(255, 0, 60, 0.25);
}

.table-wrap {
    max-height: 360px;
    overflow-y: auto;
    margin-bottom: 2rem;
    border: 1px solid rgba(0, 240, 255, 0.2);
    border-radius: 8px;
}

#rhr-table {
    width: 100%;
    border-collapse: collapse;
}

#rhr-table thead {
    position: sticky;
    top: 0;
    z-index: 1;
}

#rhr-table th {
    background: rgba(255, 0, 60, 0.2);
    color: #ff003c;
    text-shadow: 0 0 6px rgba(255, 0, 60, 0.4);
    padding: 10px 16px;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    border-bottom: 2px solid rgba(255, 0, 60, 0.4);
}

#rhr-table td {
    padding: 8px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    font-size: 0.9rem;
}

#rhr-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

#rhr-table tbody tr:hover {
    background: rgba(0, 240, 255, 0.08);
}

#rhr-table td:last-child {
    color: #ffe600;
    font-weight: 700;
    text-shadow: 0 0 6px rgba(255, 230, 0, 0.3);
}

.table-wrap::-webkit-scrollbar {
    width: 6px;
}

.table-wrap::-webkit-scrollbar-track {
    background: transparent;
}

.table-wrap::-webkit-scrollbar-thumb {
    background: rgba(0, 240, 255, 0.3);
    border-radius: 3px;
}

.hidden {
    display: none;
}

/* ---- Homepage panels ---- */
.panel {
    margin: 1.5rem 0;
    padding: 1.2rem 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(0, 240, 255, 0.2);
    border-radius: 10px;
    text-align: left;
}

.panel-title {
    font-size: 1.1rem;
    color: #ff003c;
    text-shadow: 0 0 6px rgba(255, 0, 60, 0.4);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 0.9rem;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.5rem 1rem;
}

.check-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: rgba(0, 240, 255, 0.05);
    border: 1px solid rgba(0, 240, 255, 0.2);
    border-radius: 6px;
    cursor: pointer;
    color: #e0e0e0;
    font-size: 0.95rem;
    transition: border-color 0.15s, background 0.15s;
}

.check-item:hover {
    border-color: #ffe600;
    background: rgba(255, 230, 0, 0.06);
}

.check-item input[type="checkbox"] {
    accent-color: #ff003c;
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.panel-actions {
    display: flex;
    gap: 0.6rem;
    margin-top: 0.9rem;
}

.action-row {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.ghost-btn {
    padding: 8px 14px;
    background: transparent;
    color: #00f0ff;
    border: 1px solid rgba(0, 240, 255, 0.4);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    transition: all 0.2s;
}

.ghost-btn:hover {
    color: #ffe600;
    border-color: #ffe600;
    box-shadow: 0 0 8px rgba(255, 230, 0, 0.3);
}

.ghost-link {
    color: #00f0ff;
    text-decoration: none;
    font-size: 0.95rem;
    letter-spacing: 1px;
    text-shadow: 0 0 6px rgba(0, 240, 255, 0.3);
}

.ghost-link:hover {
    color: #ffe600;
}

.hint {
    margin-top: 0.8rem;
    font-size: 0.8rem;
    color: #888;
    line-height: 1.4;
}

.hint code {
    color: #ffe600;
    background: rgba(255, 230, 0, 0.08);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 0.8rem;
}

.success {
    color: #7fff9f;
    text-align: center;
    margin-top: 0.8rem;
    font-size: 0.9rem;
    text-shadow: 0 0 6px rgba(127, 255, 159, 0.4);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.auth-form .field {
    display: block;
    margin-bottom: 0.3rem;
}

.mfa-block {
    margin-top: 1rem;
    padding: 0.9rem 1rem;
    border: 1px dashed rgba(255, 230, 0, 0.5);
    border-radius: 8px;
    background: rgba(255, 230, 0, 0.04);
}

.mfa-title {
    color: #ffe600;
    text-shadow: 0 0 8px rgba(255, 230, 0, 0.4);
    font-size: 0.95rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 0.4rem;
}

.container-wide {
    max-width: 1200px;
}

/* ---- Comparisons table ---- */
.cmp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.cmp-table thead th {
    background: rgba(0, 240, 255, 0.12);
    color: #00f0ff;
    text-shadow: 0 0 6px rgba(0, 240, 255, 0.4);
    padding: 10px 14px;
    text-align: right;
    font-size: 0.8rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    border-bottom: 2px solid rgba(0, 240, 255, 0.4);
    position: sticky;
    top: 0;
    z-index: 1;
}

.cmp-table thead th:first-child,
.cmp-table thead th:nth-child(2),
.cmp-table thead th:last-child {
    text-align: left;
}

.cmp-table tbody td,
.cmp-table tfoot td {
    padding: 8px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.cmp-table td.col-date,
.cmp-table td.col-weekday,
.cmp-table td.col-winner {
    text-align: left;
}

.cmp-table td.col-date {
    color: #e0e0e0;
    font-weight: 600;
}

.cmp-table td.col-weekday {
    color: #888;
    font-size: 0.8rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.cmp-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

.cmp-table tbody tr:hover {
    background: rgba(0, 240, 255, 0.06);
}

.cmp-table td.cell-winner {
    color: #ffe600;
    font-weight: 700;
    text-shadow: 0 0 6px rgba(255, 230, 0, 0.35);
}

.cmp-table td.cell-loser {
    color: #ff6a80;
}

.cmp-table td.cell-tie {
    color: #b0b0b0;
    font-style: italic;
}

.cmp-table td.col-diff {
    color: #7fff9f;
    font-weight: 600;
}

.cmp-table tr.row-tie td.col-diff {
    color: #888;
    font-weight: 400;
}

.cmp-table tbody tr.row-totals td {
    background: rgba(255, 0, 60, 0.08);
    border-top: 2px solid rgba(255, 0, 60, 0.4);
    color: #ffe600;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-size: 0.85rem;
}

.subpanel-title {
    color: #00f0ff;
    font-size: 0.85rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin: 1.2rem 0 0.6rem;
    opacity: 0.85;
}

.metric-direction {
    display: inline-block;
    margin-left: 0.6rem;
    font-size: 0.7rem;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(0, 240, 255, 0.1);
    color: #00f0ff;
    border: 1px solid rgba(0, 240, 255, 0.3);
    letter-spacing: 1px;
    text-transform: none;
    vertical-align: middle;
}

#metric-select {
    min-height: 130px;
}

#metric-select option {
    padding: 6px 8px;
}

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.badge-winner {
    background: rgba(255, 230, 0, 0.15);
    color: #ffe600;
    border: 1px solid rgba(255, 230, 0, 0.4);
    text-shadow: 0 0 6px rgba(255, 230, 0, 0.4);
}

.badge-tie {
    background: rgba(200, 200, 200, 0.1);
    color: #b0b0b0;
    border: 1px solid rgba(200, 200, 200, 0.3);
}

.stats-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.stats-column {
    margin-top: 0;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(0, 240, 255, 0.2);
    border-radius: 10px;
}

.stats-column .stats-title {
    color: #ffe600;
    text-shadow: 0 0 8px rgba(255, 230, 0, 0.4);
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.log-panel {
    background: #050505;
    color: #b0e0ff;
    border: 1px solid rgba(0, 240, 255, 0.2);
    border-radius: 6px;
    padding: 0.9rem 1rem;
    font-family: 'SFMono-Regular', Menlo, Consolas, monospace;
    font-size: 0.8rem;
    max-height: 320px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
    margin-top: 0.4rem;
}

/* ---- Activities page ---- */
.act-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.act-table thead th {
    position: sticky;
    top: 0;
    background: rgba(0, 240, 255, 0.15);
    color: #00f0ff;
    text-shadow: 0 0 6px rgba(0, 240, 255, 0.4);
    padding: 10px 12px;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    border-bottom: 2px solid rgba(0, 240, 255, 0.4);
    text-align: left;
    z-index: 1;
}

.act-table tbody td {
    padding: 7px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    white-space: nowrap;
}

.act-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

.act-table tbody tr:hover {
    background: rgba(0, 240, 255, 0.08);
}

.act-table .col-month {
    color: #ffe600;
    font-weight: 700;
    letter-spacing: 1px;
}

.act-table .col-count {
    color: #fff;
    font-weight: 700;
    text-align: right;
    width: 90px;
}

.act-table .col-bar {
    width: 55%;
    min-width: 160px;
}

.bar-outer {
    background: rgba(255, 255, 255, 0.06);
    border-radius: 4px;
    height: 10px;
    overflow: hidden;
}

.bar-inner {
    height: 100%;
    background: linear-gradient(90deg, #ff003c, #ffe600, #00f0ff);
    box-shadow: 0 0 8px rgba(0, 240, 255, 0.4);
    transition: width 0.4s ease;
}

/* ---- Activities chart ---- */
.chart-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
}

.chart-metric-row,
.chart-types-row {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.chart-metric-row {
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.chart-container {
    position: relative;
    width: 100%;
    overflow-x: auto;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(0, 240, 255, 0.2);
    border-radius: 8px;
    padding: 0.5rem;
}

.chart-tooltip {
    position: absolute;
    pointer-events: none;
    background: rgba(10, 10, 10, 0.95);
    border: 1px solid rgba(0, 240, 255, 0.5);
    border-radius: 6px;
    padding: 0.6rem 0.7rem;
    color: #e0e0e0;
    font-size: 0.8rem;
    box-shadow: 0 0 12px rgba(0, 240, 255, 0.35);
    z-index: 5;
    max-width: 320px;
    min-width: 200px;
}

.chart-tooltip .tt-title {
    color: #ffe600;
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 0.2rem;
}

.chart-tooltip .tt-sub {
    color: #00f0ff;
    font-size: 0.8rem;
    margin-bottom: 0.4rem;
}

.chart-tooltip .tt-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
}

.chart-tooltip .tt-table td {
    padding: 2px 6px;
    vertical-align: middle;
    white-space: nowrap;
}

.chart-tooltip .tt-table td.tt-val {
    text-align: right;
    color: #fff;
    font-weight: 600;
}

.chart-tooltip .tt-table td.tt-pct {
    text-align: right;
    color: #ffe600;
    font-weight: 700;
}

.chart-tooltip .tt-row-active td {
    background: rgba(0, 240, 255, 0.12);
    border-top: 1px solid rgba(0, 240, 255, 0.35);
    border-bottom: 1px solid rgba(0, 240, 255, 0.35);
}

.chart-tooltip .tt-swatch {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    margin-right: 6px;
    vertical-align: middle;
    box-shadow: 0 0 4px rgba(0, 240, 255, 0.4);
}

.act-chart-svg {
    width: 100%;
    height: auto;
    min-width: 640px;
    display: block;
}

.chart-grid {
    stroke: rgba(255, 255, 255, 0.06);
    stroke-width: 1;
}

.chart-axis {
    stroke: rgba(0, 240, 255, 0.5);
    stroke-width: 1;
}

.chart-axis-label {
    fill: #b0e0ff;
    font-size: 11px;
    font-family: 'Segoe UI', Tahoma, sans-serif;
}

.chart-axis-title {
    fill: #00f0ff;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.chart-total-label {
    fill: #ffe600;
    font-size: 10px;
    font-weight: 700;
}

.chart-bar {
    transition: opacity 0.15s ease;
    stroke: rgba(0, 0, 0, 0.35);
    stroke-width: 0.5;
}

.chart-bar:hover {
    opacity: 0.75;
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem 1rem;
    margin-top: 0.8rem;
}

.chart-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: #e0e0e0;
}

.legend-swatch {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    display: inline-block;
    box-shadow: 0 0 6px rgba(0, 240, 255, 0.3);
}

