* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --primary: #2196F3;
    --primary-dark: #1976D2;
    --success: #4CAF50;
    --danger: #f44336;
    --warning: #FF9800;
    --bg: #f5f5f5;
    --card: #ffffff;
    --text: #333;
    --text-light: #666;
    --border: #e0e0e0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    padding-bottom: 20px;
}

#app {
    max-width: 480px;
    margin: 0 auto;
    padding: 0;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 16px;
    text-align: center;
}

.header h1 {
    font-size: 20px;
    margin-bottom: 12px;
}

.date-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
}

.date-nav .current-date {
    font-size: 16px;
    font-weight: 600;
    min-width: 120px;
}

.btn-icon {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 14px;
    cursor: pointer;
}

.btn-icon:active {
    background: rgba(255,255,255,0.3);
}

/* Quick Dates */
.quick-dates {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background: white;
    border-bottom: 1px solid var(--border);
}

.quick-btn {
    flex: 1;
    padding: 10px 8px;
    border: 1px solid var(--primary);
    background: white;
    color: var(--primary);
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.quick-btn:active {
    background: var(--primary);
    color: white;
}

/* Summary Cards */
.summary-cards {
    display: flex;
    justify-content: space-around;
    padding: 16px 12px;
    gap: 8px;
}

.summary-card {
    flex: 1;
    background: var(--card);
    border-radius: 12px;
    padding: 16px 8px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.summary-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 4px;
}

.summary-label {
    font-size: 12px;
    color: var(--text-light);
}

/* Main Form */
.main-form {
    padding: 12px;
}

.form-card {
    background: var(--card);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.form-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text);
}

/* Time Range Input */
.time-range {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.time-input {
    flex: 1;
}

.time-input label {
    display: block;
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 4px;
}

.time-input input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 18px;
    text-align: center;
    background: #f8f9fa;
}

.time-sep {
    color: var(--text-light);
    font-size: 14px;
    padding-top: 20px;
}

/* Peak Info */
.peak-info {
    background: linear-gradient(135deg, #fff3e0, #ffe0b2);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 16px;
}

.peak-badge {
    font-size: 13px;
    font-weight: 600;
    color: #e65100;
    margin-bottom: 8px;
}

.peak-slots {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.peak-slot {
    background: #fff;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    color: #333;
    border: 1px solid #ffcc80;
}

.peak-slot.worked {
    background: var(--success);
    color: white;
    border-color: var(--success);
}

/* Calculated Peak */
.calculated-peak {
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    border-radius: 8px;
    padding: 14px;
    text-align: center;
    margin-bottom: 16px;
}

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

.calc-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary);
    margin: 0 4px;
}

.calc-unit {
    font-size: 14px;
    color: var(--text-light);
}

/* Divider */
.divider {
    height: 1px;
    background: var(--border);
    margin: 16px 0;
}

/* Input Groups */
.input-group {
    margin-bottom: 16px;
}

.input-group label {
    display: block;
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 6px;
}

.input-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 18px;
    text-align: center;
    transition: border-color 0.2s;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary);
}

.btn-row {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.btn-primary {
    flex: 2;
    padding: 14px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}

.btn-primary:active {
    background: var(--primary-dark);
}

.btn-danger {
    flex: 1;
    padding: 14px;
    background: white;
    color: var(--danger);
    border: 1px solid var(--danger);
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
}

.btn-danger:active {
    background: var(--danger);
    color: white;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 1000;
}

.toast.show {
    opacity: 1;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 100;
    justify-content: center;
    align-items: flex-end;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    width: 100%;
    max-width: 480px;
    max-height: 80vh;
    border-radius: 16px 16px 0 0;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 16px;
}

.btn-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg);
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-light);
}

.modal-body {
    padding: 16px;
    max-height: 60vh;
    overflow-y: auto;
}

/* History List */
.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--bg);
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
}

.history-item:active {
    background: var(--border);
}

.history-date {
    font-weight: 600;
}

.history-stats {
    font-size: 12px;
    color: var(--text-light);
}

/* Stats */
.stats-summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.stats-item {
    background: var(--bg);
    padding: 16px;
    border-radius: 8px;
    text-align: center;
}

.stats-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
}

.stats-label {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 4px;
}

/* Offline indicator */
.offline-notice {
    background: var(--warning);
    color: white;
    padding: 8px;
    text-align: center;
    font-size: 12px;
}
