body{font-family: -apple-system,BlinkMacSystemFont,"Helvetica Neue",Helvetica,Arial,sans-serif;margin:20px}
.container{max-width:980px;margin:0 auto;padding: 0 10px;}
header{display:flex;justify-content:space-between;align-items:center}
.calendar{display:grid;grid-template-columns:repeat(7,1fr);gap:6px;margin-top:12px}
.calendar-header{display:flex;justify-content:space-between;align-items:center;margin:16px 0 4px 0;}

/* prevent the month label from wrapping onto multiple lines */
.calendar-header { flex-wrap: nowrap; }
.calendar-month { white-space: nowrap; }
.calendar-month{font-size:1.3em;font-weight:600;}
#view-toggle button {
    padding: 4px 8px;
    border: 1px solid #ccc;
    background-color: #f0f0f0;
    cursor: pointer;
    border-radius: 4px;
}
.chart-container .chart-header #toggle-chart-btn {
    padding: 4px 8px;
    border: 1px solid #ccc;
    background-color: #f0f0f0;
    cursor: pointer;
    border-radius: 4px;
}
.day-header {
    display: flex;
    align-items: baseline;
    gap: 4px;
}
.day{border:1px solid #ddd;min-height:120px;padding:6px;background:#fff}
.day .date{font-weight:600;margin-bottom:6px}
.day .items{font-size:13px; line-height: 1.4;}
.day-label {
    font-size: 13px;
    margin-top: 2px;
    margin-bottom: 2px;
}
.day-total {
    font-size: 13px;
    margin-top: 2px;
    margin-bottom: 2px;
}
.day-total.plus { color: #007bff; }
.day-total.minus { color: #dc3545; }
.account-dots-container {
    margin-top: 4px;
    display: block; /* Ensure it's on a new line */
}
.account-dot {
    display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 5px; vertical-align: middle;
    cursor: pointer;
    border: 1px solid rgba(0,0,0,0.1);
    transition: transform 0.2s;
}
.account-dot.total-dot {
    background-color: #ccc;
}
.account-dot.active {
    transform: scale(1.3);
    border: 2px solid #333;
}
.day.clickable{cursor:pointer}

.day.saturday { background-color: #f0f8ff; } /* 土曜日: 薄い青 */
.day.sunday { background-color: #fff0f0; } /* 日曜日: 薄い赤 */
.day.today {
    background-color: #fffacd; /* 薄い黄色 */
    border: 1px solid #f0e68c;
}

.day.holiday {
    background-color: #fff0f0; /* 日曜日と同じ薄い赤 */
}

.holiday .date {
    color: #d9534f; /* 祝日の日付を赤色に */
}
.holiday-name {
    font-size: 11px;
    color: #d9534f;
    font-weight: bold;
    margin-bottom: 4px;
}

/* modal */
.modal{position:fixed;left:0;top:0;right:0;bottom:0;background:rgba(0,0,0,0.5);display:none;align-items:center;justify-content:center}
.modal .box{background:#fff;padding:16px;max-width:720px;width:90%;max-height:80vh;overflow:auto;border-radius:6px}
.modal .close{float:right;cursor:pointer}

/* SP表示用スタイル */
/* ボタンクリックによるSP表示 */
.sp-view .calendar { grid-template-columns: 1fr; }
.sp-view .day { min-height: 70px; }

/* 画面幅による自動SP表示 */
@media(max-width: 640px) {
    .calendar {
        grid-template-columns: 1fr;
    }
    .day {
        min-height: 70px;
    }
}

/* SP時はカレンダーのヘッダを縦並びにして、年月を1行目、コントロールを2行目にする */
@media (max-width: 640px) {
    .calendar-header {
        flex-direction: column;
        align-items: center;
        gap: 8px;
        text-align: center;
    }
    .calendar-month {
        white-space: nowrap;
        order: 1;
        margin-bottom: 0;
    }
    .period-controls {
        order: 2;
        width: 100%;
        display: flex;
        justify-content: center;
    }
    .period-controls form { width: auto; }
}

/* PC表示 / SP表示 切替ボタンはモバイル幅では非表示にする */
@media (max-width: 640px) {
    #view-toggle { display: none !important; }
}

.sp-weekday {
    display: inline;
    font-size: 12px;
    color: #888;
    font-weight: normal;
}

.controls{margin-top:12px}
.upload-box{border:1px dashed #aaa;padding:12px;background:#fafafa}
.success{color:green}
.error{color:red}
.small{font-size:12px;color:#555}
/* upload message styles */
.upload-message { padding: 10px; border-radius: 6px; margin-top: 8px; font-weight: 500; }
.upload-message.upload-info { background: #fffbe6; border: 1px solid #ffe58f; color: #855700; }
.upload-message.upload-success { background: #e6ffed; border: 1px solid #b7eb8f; color: #135200; }
.upload-message.upload-error { background: #fff1f0; border: 1px solid #ffa39e; color: #a8071a; }
.chart-container {
    position: relative;
    width: 100%;
    margin-top: 20px;
    margin-bottom: 50px;
}

/* period controls styling */
.period-controls form {
    display: flex;
    align-items: center;
    gap: 8px;
}
.period-controls select,
.period-controls input[type="month"],
.period-controls input[type="date"] {
    padding: 6px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
}
.period-controls button {
    padding: 6px 12px;
    border-radius: 4px;
    border: 1px solid #ccc;
    background: #4CAF50;
    color: white;
    cursor: pointer;
}
.period-controls a {
    color: #333;
    text-decoration: none;
}

/* icon toggle button */
.icon-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    border: 1px solid rgba(0,0,0,0.08);
    background: rgba(0,0,0,0.03);
    color: #333;
    cursor: pointer;
    transition: transform 0.12s ease, background-color 0.12s ease, box-shadow 0.12s ease;
}
.icon-toggle-btn svg { display:block; }
.icon-toggle-btn:hover { background: rgba(0,0,0,0.06); box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.icon-toggle-btn:focus { outline: none; box-shadow: 0 0 0 3px rgba(66,133,244,0.12); }
.icon-toggle-btn.clicked, .icon-toggle-btn:active { transform: scale(0.92); }

/* smaller on mobile */
@media(max-width:640px) {
    .icon-toggle-btn { width: 32px; height: 32px; }
}

@media (max-width: 640px) {
    .period-controls form { flex-wrap: wrap; gap: 6px; }
    .period-controls input[type="month"], .period-controls select { width: 140px; }
    .period-controls #range-inputs { width: 100%; display: flex; gap: 6px; }
}

/* chart loading / error */
#chart-loading { color: #555; font-style: italic; }
#chart-error { color: #c00; }
#chart-totals { font-size: 1.05em; }
.chart-container #chart-body {
    height: 280px;
}
.chart-container .chart-header { /* グラフタイトルとボタンを横並びにする */
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px; /* グラフ本体との間に余白を確保 */
}
.monthly-summary {
    text-align: center;
    margin-top: 10px;
    font-size: 1.1em;
    font-weight: bold;
}
.monthly-summary .summary-profit,
.monthly-summary .summary-pips {
    margin-left: 8px;
}
.monthly-summary .plus {
    color: #28a745;
}
.monthly-summary .minus {
    color: #dc3545;
}
.total-summary {
    text-align: left;
    padding: 10px;
    margin-top: 15px;
    margin-bottom: 15px;
    font-size: 1.1em;
    font-weight: bold;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 8px;
}
.total-summary .plus { color: #28a745; }
.total-summary .minus { color: #dc3545; }
.admin-menu-container {
    position: fixed;
    bottom: 10px;
    left: 10px;
}
.admin-icon {
    cursor: pointer;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    color: #555; /* アイコンの色 */
}
.admin-menu-list {
    margin-top: 20px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px;
}
.admin-menu-list ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.admin-menu-list li a {
    display: block;
    padding: 12px 15px;
    text-decoration: none;
    color: #333;
    border-bottom: 1px solid #eee;
}
.admin-menu-list li:last-child a {
    border-bottom: none;
}
.admin-menu-list li a:hover {
    background-color: #f0f0f0;
}
.admin-section {
    margin-bottom: 20px;
}
.danger-btn {
    background-color: #dc3545;
    color: white;
    border: 1px solid #dc3545;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
}
.form-group {
    margin-bottom: 15px;
}
.account-list-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}
.account-list-table th, .account-list-table td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
}
.account-list-table th {
    background-color: #f2f2f2;
}
.small-btn {
    padding: 4px 8px;
    font-size: 12px;
}
.update-btn {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}

.account-selector {
    margin-top: 20px;
    padding: 10px;
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 8px;
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 15px;
}
.account-selector h4 {
    margin-top: 0;
    margin-bottom: 0;
    flex-shrink: 0; /* タイトルが縮まないようにする */
}
.account-selector .checkbox-list {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
}
.account-selector label {
    cursor: pointer;
    display: flex;
    align-items: center;
}
.account-selector-actions {
    margin-left: auto; /* ボタンを右端に寄せる */
    flex-shrink: 0;
}
.negative-days-list {
    margin-top: 30px;
    padding: 15px;
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 8px;
}
.negative-days-list h4 {
    margin-top: 0;
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}
.negative-days-list ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.negative-days-list li.negative-day-item {
    border-bottom: 1px solid #eee;
}
.negative-days-list li:last-child {
    border-bottom: none;
}
.negative-days-list .summary-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 10px;
}
.negative-days-list .summary-row .total.minus {
    font-weight: bold;
    color: #dc3545; /* カレンダー内のマイナス色に合わせる */
}
.negative-days-list .trade-details {
    padding: 0 10px 15px 10px;
}
.negative-days-list .trade-details table {
    width: 100%;
    font-size: 12px;
    border-collapse: collapse;
}
.negative-days-list .trade-details th,
.negative-days-list .trade-details td {
    border: 1px solid #ddd;
    padding: 4px 6px;
    text-align: right;
}
.negative-days-list .trade-details th {
    background-color: #f2f2f2;
}
