:root {
    --primary: #FF0000;
    --secondary: #FFFFFF;
    --background: #1B1B1C;
    --surface: #1B1B1C;
    --error: #B00020;
    --on-primary: #FFFFFF;
    --on-secondary: #000000;
    --on-background: #FFFFFF;
    --on-surface: #FFFFFF;
    --on-error: #FFFFFF;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { -webkit-tap-highlight-color: transparent; }

html, body, main, .card, .pair-grid, .actions-row {
    touch-action: pan-x pan-y !important;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--background);
    color: var(--on-background);
    line-height: 1.6;
    padding: 16px;
    max-width: 100%;
    overflow-x: hidden;
}

[hidden] {
    display: none !important;
}

input, select, textarea, button { font-size: 16px; }

.top-strip {
    height: 44px;
    width: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 6px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.top-strip img {
    height: 80%;
    width: auto;
    max-height: 80%;
    display: block;
    pointer-events: none;
}

.day-selector {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    margin-bottom: 12px;
}

.day-tab {
    background: #2A2A2B;
    color: var(--on-surface);
    border: 1px solid #333;
    padding: 8px 6px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
}

.day-tab.active {
    background: var(--primary);
    color: var(--on-primary);
    border-color: var(--primary);
}

.card {
    background: var(--surface);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    border: 1px solid #333;
}

.input-group { margin-bottom: 0; }

label {
    display: block;
    font-size: 14px;
    color: var(--on-surface);
    margin-bottom: 6px;
    font-weight: 500;
}

.time-input {
    width: 100%;
    padding: 14px;
    min-height: 50px;
    box-sizing: border-box;
    border-radius: 8px;
    border: 1px solid #444;
    background: #2A2A2B;
    color: var(--on-surface);
    font-size: 16px;
    -webkit-appearance: none;
    appearance: none;
}

.time-input:focus { outline: none; border-color: var(--primary); }

.button {
    background: var(--primary);
    color: var(--on-primary);
    border: none;
    padding: 14px 20px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    width: 100%;
    transition: background 0.2s;
}
.button:hover {
    background: var(--secondary);
    color: var(--primary);
}
.button.secondary { background: var(--secondary); color: var(--on-secondary); }
.button.danger { background: var(--error); color: var(--on-error); }

.actions-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}
.actions-row .button.small {
    flex: 1 1 0;
    width: auto;
    padding: 10px 12px;
}

.break-row {
    background: #2A2A2B;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
}

.break-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.break-title { font-size: 14px; font-weight: 500; color: var(--on-surface); }

/* Stats panel */
.stats-panel { padding: 12px 16px; }
.stats-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}
.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #333;
}
.stat-item:last-child { border-bottom: 0; }
.stat-label { color: var(--on-surface); font-size: 14px; }
.stat-value { font-weight: 600; font-size: 16px; color: var(--secondary); }
.delta-positive { color: #4CAF50; }
.delta-negative { color: var(--error); }

.day-off-panel {
    text-align: center;
}

.day-off-message {
    font-size: 18px;
    font-weight: 600;
    color: var(--secondary);
}

/* Inputs paired in two columns */
.pair-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    column-gap: 16px;
    row-gap: 12px;
}

@media (min-width: 480px) {
    .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* Time grids inside breaks */
.time-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}
@media (min-width: 480px) {
    .time-grid { grid-template-columns: 1fr 1fr; }
}

.footer-buttons { display: flex; gap: 12px; margin-top: 16px; }
.footer-buttons .button { flex: 1; }

.settings-panel .settings-day + .settings-day {
    border-top: 1px solid #333;
    padding-top: 12px;
    margin-top: 12px;
}

.settings-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
}

.settings-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #444;
    background: #2A2A2B;
    font-size: 16px;
    font-weight: 500;
    color: var(--on-surface);
}

.radio-option input {
    accent-color: var(--primary);
}

.settings-actions {
    grid-template-columns: 1fr;
}

.settings-actions .button {
    width: 100%;
}

.settings-hint {
    margin-top: 12px;
    font-size: 12px;
    color: #cfcfcf;
}

.export-report {
    background: var(--background);
    color: var(--on-background);
    padding: 24px;
    border-radius: 12px;
    border: 1px solid #333;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

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

.export-title {
    font-size: 20px;
    font-weight: 700;
}

.export-subtitle {
    font-size: 14px;
    color: #cfcfcf;
}

.export-meta {
    font-size: 12px;
    color: #cfcfcf;
    text-align: right;
}

.export-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.export-summary-item {
    background: #2A2A2B;
    border: 1px solid #333;
    border-radius: 10px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.export-summary-item strong {
    font-size: 18px;
    color: var(--secondary);
}

.export-days {
    display: grid;
    gap: 12px;
}

.export-day-card {
    background: #2A2A2B;
    border: 1px solid #333;
    border-radius: 12px;
    padding: 12px;
}

.export-day-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 8px;
}

.export-day-title {
    font-size: 16px;
    font-weight: 600;
}

.export-day-goal {
    font-size: 12px;
    color: #cfcfcf;
}

.export-day-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px;
    margin-bottom: 10px;
}

.export-stat {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    border-bottom: 1px solid #333;
    padding-bottom: 6px;
}

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

.export-stamps {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

.export-stamp {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid #333;
    padding: 6px 0;
    font-size: 13px;
}

.export-stamp:last-child {
    border-bottom: 0;
}

.export-day-off {
    font-size: 14px;
    color: #cfcfcf;
}

.export-footer {
    margin-top: 16px;
    font-size: 12px;
    color: #cfcfcf;
    text-align: center;
}

body.is-printing main,
body.is-printing .top-strip {
    display: none;
}

body.is-printing #exportReport {
    display: block;
}

@media print {
    body {
        padding: 0;
        background: var(--background);
        color: var(--on-background);
    }

    main,
    .top-strip,
    .modal-backdrop {
        display: none !important;
    }

    #exportReport {
        display: block !important;
        border: none;
    }
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 999;
}

.modal {
    width: 100%;
    max-width: 420px;
    background: #2A2A2B;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #333;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 10px;
}

.modal-body {
    font-size: 14px;
    color: var(--on-surface);
    margin-bottom: 16px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    flex-direction: column;
}

@media (min-width: 480px) {
    .modal-actions {
        flex-direction: row;
    }
}

@media (min-width: 480px) {
    .day-selector { gap: 8px; }
    .day-tab { font-size: 13px; }
    .settings-grid { grid-template-columns: repeat(2, 1fr); }
}
