
:root {
    --primary: #007bff;
    --secondary: #6f42c1;
    --success: #28a745;
    --danger: #dc3545;
    --bg: #f0f2f5;
    --card-bg: #fff;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg);
    margin: 0;
    padding: 0 0 80px 0;
    color: #333;
}

.bottom-nav {
    position: fixed;
    bottom: 0;
    width: 100%;
    height: 65px;
    background: #fff;
    display: flex;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: #888;
    cursor: pointer;
}

.nav-item.active {
    color: var(--primary);
    font-weight: bold;
}

.nav-icon {
    font-size: 22px;
    margin-bottom: 2px;
}

.page {
    display: none;
    padding: 15px;
    max-width: 500px;
    margin: auto;
}

.page.active {
    display: block;
}

.card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 18px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 15px;
}

h2 {
    font-size: 1.1em;
    margin: 0 0 15px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

label {
    display: block;
    margin: 12px 0 6px;
    font-weight: bold;
    font-size: 0.85em;
    color: #555;
}

select,
input,
button {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #ddd;
    font-size: 16px;
    box-sizing: border-box;
}

.item-row {
    display: flex;
    align-items: center;
    background: #f8f9fa;
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 8px;
    gap: 10px;
    border: 1px solid #eee;
}

.item-info {
    flex: 1;
    font-size: 0.9em;
    font-weight: bold;
}

.qty-input {
    width: 80px !important;
    padding: 6px !important;
    text-align: center;
}

.del-btn {
    width: auto !important;
    background: var(--danger);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8em;
}

.history-card {
    border-left: 5px solid #ddd;
    margin-bottom: 10px;
    padding: 12px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    position: relative;
}

.history-card.paid {
    border-left-color: var(--primary);
}

.history-card.free {
    border-left-color: var(--success);
}

.h-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75em;
    color: #999;
    margin-bottom: 6px;
}

.h-date-display {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #f0f0f0;
    padding: 2px 8px;
    border-radius: 4px;
    color: #555;
    font-weight: bold;
    cursor: pointer;
}

.h-del-x {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #fee2e2;
    border: none;
    color: var(--danger);
    border-radius: 50%;
    width: 26px;
    height: 26px;
    font-size: 14px;
    cursor: pointer;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
}

.grade-badge {
    position: absolute;
    top: 40px;
    right: 12px;
    font-size: 1.4em;
    font-weight: 900;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.stat-box {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 10px;
    border: 1px solid #eee;
    text-align: center;
}

.stat-label {
    font-size: 0.7em;
    color: #777;
    display: block;
    margin-bottom: 4px;
}

.stat-val {
    font-size: 1em;
    font-weight: bold;
}

.chart-container {
    position: relative;
    height: 180px;
    width: 100%;
    margin: 10px 0;
}

.btn {
    border: none;
    font-weight: bold;
    padding: 12px;
    cursor: pointer;
    border-radius: 8px;
    margin-top: 10px;
}

.btn-main {
    background: var(--primary);
    color: #fff;
    width: auto;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
}

/* カレンダーを画面中央表示 */
.flatpickr-calendar {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    z-index: 9999 !important;
}

/* スマホサイズでも中央に */
@media (max-width: 600px) {
    .flatpickr-calendar {
        width: 90% !important;
        left: 50% !important;
        top: 50% !important;
        transform: translate(-50%, -50%) !important;
    }
}

/* --- アコーディオン (details/summary) 用スタイル --- */

/* セクション全体の枠組み */
.temp-section {
    background: var(--card-bg);
    border: 1px solid #eee;
    border-radius: 10px;
    margin-bottom: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* ヘッダー部分（タップ領域） */
.temp-summary {
    padding: 14px 18px;
    background: #f8f9fa;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    list-style: none; /* デフォルトの矢印を消す（Chrome/Safari） */
    font-size: 0.95em;
    user-select: none;
    transition: background 0.2s;
}

/* Firefox用のデフォルト矢印消し */
.temp-summary::-webkit-details-marker {
    display: none;
}

.temp-summary:active {
    background: #f1f3f5;
}

/* 開いている時のヘッダー背景 */
.temp-section[open] .temp-summary {
    background: #fff;
    border-bottom: 1px solid #f0f0f0;
}

/* 右側に「▼」アイコンを擬似的に表示 */
.temp-summary::after {
    content: '▼';
    font-size: 0.7em;
    color: #bbb;
    transition: transform 0.3s;
}

/* 開いている時はアイコンを回転 */
.temp-section[open] .temp-summary::after {
    transform: rotate(180deg);
}

/* アコーディオンの中身（アイテムリスト） */
.temp-content {
    padding: 10px;
    background: #fff;
}

/* リスト内の各アイテム行の微調整 */
.temp-content .item-row {
    background: #fff;
    border: none;
    border-bottom: 1px solid #f4f4f4;
    border-radius: 0;
    margin-bottom: 0;
    padding: 10px 5px;
}

.temp-content .item-row:last-child {
    border-bottom: none;
}

/* バッジ（個数表示）のスタイル */
.temp-summary .badge {
    background: #eee;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.8em;
    color: #666;
}

/* 履歴画面の日付変更ボタンの見た目 */
.clickable-date {
    cursor: pointer;          /* マウスを乗せると指マークになる */
    color: #007bff;          /* リンクらしい青色に */
    text-decoration: underline dotted #007bff; /* 下線を引いて「何かある」感を出す */
    padding: 2px 4px;
    transition: background 0.2s;
}

.clickable-date:hover {
    background: #e7f1ff;     /* ホバー時に少し明るくして反応を示す */
    border-radius: 4px;
}