:root { 
    --primary: #4a90e2; 
    --success: #48bb78; 
    --danger: #f56565;
    --gray: #718096;
    --bg: #f5f7fa; 
}

/* 全体の基本設定 */
body { 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; 
    background: var(--bg); 
    margin: 0; 
    padding: 10px; 
    color: #2d3748; 
}

.container { max-width: 600px; margin: auto; }

.card { 
    background: white; 
    border-radius: 12px; 
    padding: 15px; 
    margin-bottom: 15px; 
    box-shadow: 0 2px 4px rgba(0,0,0,0.05); 
}

/* カレンダーナビゲーション */
.calendar-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.nav-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.nav-center h4 { margin: 0; font-size: 1.15rem; }

.side-btn {
    width: 75px !important;
    height: 38px;
    font-size: 0.85rem;
    cursor: pointer;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
}

.today-btn {
    background: #fff;
    border: 1px solid var(--primary);
    color: var(--primary);
    border-radius: 4px;
    padding: 4px 12px;
    font-size: 0.75rem;
    cursor: pointer;
    margin-top: 4px;
}

/* カレンダー本体 */
#calendar { 
    display: grid; 
    grid-template-columns: repeat(7, 1fr); 
    gap: 5px; 
}

.day { 
    aspect-ratio: 1; 
    border: 1px solid #f1f5f9; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: center;
    border-radius: 8px; 
    font-size: 0.75rem;
    background: white;
    cursor: pointer;
}

.has-data { background: #f0fff4; border-bottom: 3px solid var(--success); }
.is-today { border: 2px solid var(--primary); background: #ebf8ff; }

/* レイアウト・入力欄 */
.grid-2 { 
    display: flex; 
    gap: 10px; 
    margin-bottom: 12px; 
}

.grid-2 > * { flex: 1; min-width: 0; }

.input-group label { 
    display: block; 
    font-size: 0.85rem; 
    font-weight: bold; 
    margin-bottom: 6px; 
    color: #4a5568;
}

/* スマホでグレーにならないための修正 */
input { 
    width: 100%; 
    padding: 12px; 
    box-sizing: border-box; 
    border: 1px solid #cbd5e0; 
    border-radius: 8px; 
    background-color: #ffffff !important; /* 強制的に白 */
    font-size: 16px; /* iPhoneの自動ズーム防止 */
    color: #2d3748;
    -webkit-appearance: none; /* iOSのデフォルトスタイルをリセット */
    appearance: none;
}

/* 時間と日付入力のアイコンを表示させる */
input[type="time"], input[type="date"] {
    min-height: 48px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="4" width="18" height="18" rx="2" ry="2"></rect><line x1="16" y1="2" x2="16" y2="6"></line><line x1="8" y1="2" x2="8" y2="6"></line><line x1="3" y1="10" x2="21" y2="10"></line></svg>');
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 18px;
}

/* ボタン */
.btn { 
    padding: 14px 5px; 
    border: none; 
    border-radius: 8px; 
    cursor: pointer; 
    font-weight: bold; 
    text-align: center; 
    width: 100%; 
    color: white; 
    font-size: 0.95rem;
}

.btn-main { background: var(--primary); }
.btn-save { background: var(--success); }
.btn-delete { background: var(--danger); }
.btn-gray { background: var(--gray); }

/* 集計エリア */
.summary-grid { display: flex; gap: 10px; }
.stat { flex: 1; text-align: center; }
.stat-val { display: block; font-size: 1.3rem; font-weight: bold; color: var(--primary); }
.stat-hour { display: block; font-size: 0.8rem; color: #718096; }

/* 消失対策カード */
.backup-card { 
    background: #fff5f5; 
    border: 1px dashed var(--danger); 
}

/* ★スマホ専用レスポンシブ：横並びを縦にする */
@media (max-width: 600px) {
    .grid-2 {
        flex-direction: column; 
        gap: 15px;
    }
    
    .grid-2 > .btn {
        width: 100%;
    }

    input {
        height: 50px;
    }
}

.ad-banner {
    margin: 20px 0;
    text-align: center;
}
.ad-label {
    font-size: 10px;
    color: #cbd5e0;
    margin-bottom: 5px;
}
.ad-placeholder {
    min-height: 50px;
    background: #fdfdfd;
    border: 1px dashed #e2e8f0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #a0aec0;
    font-size: 0.8rem;
}