/* =================================
   CSS Variables (変数)
   ================================= */
:root {
    /* Colors */
    --primary-color: #32c5ff;
    --primary-color-dark: #00a3e0;
    --primary-color-light: #e0f6ff;
    --secondary-color: #6c757d;
    --background-color: #fff;
    --text-color: #333;
    --text-color-light: #6c757d;
    --white-color: #fff;
    --border-color: #dee2e6;
    --disabled-color: #e9ecef;
    --disabled-text-color: #adb5bd;
    --danger-color: #d9534f;
    --success-color: var(--primary-color); /* 取Eはメイン色 */
    --warning-color: #ff864a; /* 補Eはサブ色 */
    --warning-color-dark: #e06a2a;
    --warning-color-light: #fff3e0;
    --danger-color-dark: #b94440;
    --modal-overlay-bg: rgba(0, 0, 0, 0.6);

    /* Spacing */
    --spacing-unit: 1rem;

    /* Border Radius */
    --border-radius-sm: 0.25rem;
    --border-radius-md: 0.5rem;
    --border-radius-lg: 0.75rem;
}

/* =================================
   Basic Reset & Body
   ================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent; /* タチEE晁Eハイライトを無効匁E*/
}

html, body {
    height: 100%;
    overflow: hidden; /* スクロールをJSで制御 */
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #e9ecef; /* アプリ外E背景色 */
    color: var(--text-color);
    font-size: 16px;
}

button {
    cursor: pointer;
    border: none;
    font-size: 1rem;
}

/* =================================
   App Layout
   ================================= */
#app {
    max-width: 600px; /* スマEトフォンを想定した最大幁E*/
    margin: 0 auto;
    height: 100%;
    display: flex;
    flex-direction: column;    
    background-color: var(--background-color);
    position: relative; /* ドロワーメニューの位置基溁E*/
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

/* =================================
   Screen Management
   ================================= */
.screen {
    display: none; /* 基本は非表示 */
    flex-direction: column;
    width: 100%;
    height: 100%;
}

.screen.active {
    display: flex; /* .activeクラスを持つ画面のみ表示 */
}

/* =================================
   Header, Main, Footer Layout
   ================================= */
.screen > header {    
    background-color: var(--white-color);
    padding: var(--spacing-unit);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 10;
}

.list-title {
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: center;
    align-items: baseline;
}

.header-nav {
    display: flex;
    align-items: center;
    position: relative; /* ドロチEEダウンメニューの位置基溁E*/
    justify-content: space-between;
}

.header-title-wrapper {
    flex-grow: 1;
    text-align: center;
    padding: 0 0.5rem;
}

.header-nav h1, .header-nav h2 {
    margin: 0;
}

.menu-toggle-button {
    background: none;
    border: none;
    padding: 0.5rem;
    margin-left: -0.5rem; /* アイコンの見た目上E余白を調整 */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-color);
    transition: background-color 0.2s;
}

.menu-toggle-button:active {
    background-color: var(--disabled-color);
}

.header-icon-button {
    background: none;
    border: none;
    padding: 0.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-color);
    transition: background-color 0.2s, color 0.2s;
}

.header-icon-button:active {
    background-color: var(--disabled-color);
}

.header-icon-button.active {
    color: var(--primary-color);
}

#home-screen > header h1 {
    font-size: 1.8rem;
}

.summary-card {
    background-color: var(--primary-color-light);
    border-radius: var(--border-radius-md);
    padding: 1rem;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    border: 1px solid var(--primary-color);
    cursor: pointer;
    transition: background-color 0.2s;
}

.summary-card h3 {
    grid-column: 1 / -1; /* span across both columns */
    margin-bottom: 0.5rem;
}

.summary-card:active {
    background-color: #d0f1ff; /* A bit darker than --primary-color-light */
}

.header-sub-text {
    font-size: 0.9rem;
    color: var(--text-color-light);
}

.screen > main {
    flex: 1;
    /* flexアイチEがコンチEを趁Eて伸びるEを防ぁE*/
    min-height: 0;
    overflow-y: auto;
    padding: 0 var(--spacing-unit);
    background-color: #f8f9fa;
}

.screen > footer {
    padding: var(--spacing-unit);
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: var(--spacing-unit);
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.footer-button {
    flex: 1;
    padding: 1rem;
    min-height: 54px; /* スマEでのタチEE領域を確俁E*/
    border-radius: var(--border-radius-lg);
    background-color: var(--primary-color);
    color: var(--white-color);
    font-weight: bold;
    font-size: 1.1rem;
    transition: background-color 0.2s, transform 0.1s;
}

.footer-button:active {
    background-color: var(--primary-color-dark);
    transform: scale(0.97); /* タチEE晁EフィードバチE */
}

.footer-button-outline {
    background-color: var(--white-color);
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.footer-button-outline:active {
    background-color: var(--primary-color-light);
}

.footer-button-charge-outline {
    background-color: var(--white-color);
    color: var(--warning-color);
    border: 2px solid var(--warning-color);
}

.footer-button-charge-outline:active {
    background-color: #fff3e0; /* Light orange */
}

.footer-button-charge {
    background-color: var(--warning-color);
}

.footer-button-charge:active {
    background-color: var(--warning-color-dark);
}

.footer-button-danger {
    background-color: var(--danger-color);
}

.footer-button-danger:active {
    background-color: var(--danger-color-dark);
}


button:disabled {
    background-color: var(--disabled-color) !important;
    color: var(--disabled-text-color) !important;
    border-color: var(--disabled-color) !important;
    cursor: not-allowed;
    transform: none !important;
}

/* =================================
   Modal / Bottom Sheet
   ================================= */
.modal-overlay {
    position: fixed;
    inset: 0;
    background-color: var(--modal-overlay-bg);
    display: flex;
    align-items: flex-end;
    z-index: 1000;
    opacity: 1;
    transition: opacity 280ms ease;
    pointer-events: auto;
}

.modal-overlay.peek-mode {
    /* シート以外は背面の画面へタップを通す。 */
    position: fixed;
    opacity: 1;
    pointer-events: none;
    background-color: transparent;
    inset: auto;
}

.modal-content {
    background-color: var(--background-color);
    border-radius: 28px 28px 0 0;
    box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.08), 0 -8px 24px rgba(0, 0, 0, 0.12);
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1001;
    pointer-events: auto !important;
    transform: translateY(0);
    transition: transform 280ms cubic-bezier(0.2, 0, 0, 1);
    touch-action: none;
    user-select: none;
    will-change: transform;
    overflow: hidden;
}

.modal-content.dragging {
    transition: none !important;
}

/* 最小化時はドラッグハンドルとヘッダー以外を確実に隠す。 */
.modal-content.bottom-sheet-peek > :not(.drag-handle-area):not(.modal-header) {
    visibility: hidden;
    pointer-events: none !important;
}

/*
 * 最小表示中は、シートを再び開くためのドラッグハンドルだけを操作対象にする。
 * シート本体やヘッダーがタップを受けると、背面のボタンを最初の1回で操作できないため、
 * それ以外の領域は背面の画面へイベントを通す。
 */
.modal-content.bottom-sheet-peek {
    pointer-events: none !important;
}

.modal-content.bottom-sheet-peek .drag-handle-area {
    pointer-events: auto !important;
}

/* ドラッグハンドル */
.drag-handle-area {
    flex: 0 0 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    touch-action: none;
}

.drag-handle {
    width: 32px;
    height: 4px;
    border-radius: 999px;
    background: #79747e;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem var(--spacing-unit);
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: 1.2rem;
    margin: 0;
}

.modal-close,
.close-button {
    display: none !important;
}

.modal-header .header-button {
    background-color: var(--secondary-color);
    color: var(--white-color);
    border: none;
    border-radius: var(--border-radius-md);
    padding: 0.3rem 0.8rem;
    margin-right: 0.5rem;
    font-size: 0.9rem;
    font-weight: bold;
}

.modal-header .header-button:active {
    background-color: #5a6268;
    transform: scale(0.98);
}

.modal-header .header-button-transparent {
    background: transparent;
    border: none;
    color: var(--primary-color);
    font-weight: 500;
    padding: 0.3rem 0.8rem;
    margin-right: 0.5rem;
    font-size: 1rem;
    border-radius: var(--border-radius-md);
    transition: background-color 0.2s;
}

.count-display-wrapper {
    display: flex;
    align-items: center;
}

.add-button {
    background-color: var(--primary-color); /* プライマリカラーを背景に */
    color: var(--white-color); /* 斁E色は白 */
    border: none;
    border-radius: 50%; /* 冁Eにする */
    width: 28px;   /* 幁E*/
    height: 28px;  /* 高さ */
    font-size: 1.5rem; /* プラス記号のサイズ */
    line-height: 1; /* 行E高さを調整 */
    font-weight: bold; /* 斁Eを太ぁE*/
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s; /* アニメーション効极E*/
    margin-left: 0.75rem; /* 左側のチEストとの間隔 */
}

.add-button:active {
    background-color: var(--primary-color-dark); /* 少し暗い色に */
    transform: scale(0.9); /* 少し小さくすめE*/
}

.icon-button {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    padding: 0.25rem;
    margin: -0.25rem; /* ヒットエリアを確保しつつレイアウトを崩さなぁE*/
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.icon-button:active {
    background-color: var(--disabled-color);
}

.icon-button .material-symbols-outlined {
    font-size: 1.8rem;
    font-variation-settings: 'FILL' 1;
}

/*.modal-overlay.charge-flow #btn-edit-manual {
    display: none;
}*/

.modal-body {
    flex: 1;
    min-height: 0;
    padding: var(--spacing-unit);
    overflow-y: auto;
    touch-action: pan-y;
}

.modal-footer {
    display: flex;
    gap: var(--spacing-unit);
    padding: var(--spacing-unit);
    border-top: 1px solid var(--border-color);
}

/* =================================
   Form Elements
   ================================= */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-color-light);
    margin-bottom: 0.5rem;
}

.form-control {
    width: 100%;
    padding: 0.8rem;
    font-size: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    background-color: var(--white-color);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-color-light);
}

.datetime-input-group {
    display: flex;
    gap: 0.5rem;
}

/* =================================
   Area Buttons
   ================================= */
.area-buttons-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.area-button {
    padding: 0.8rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    background-color: var(--white-color);
    text-align: center;
    transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}

.area-button span {
    display: block;
    font-size: 0.8rem;
    color: var(--text-color-light);
    margin-top: 0.2rem;
}

.area-button.active {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--white-color);
}

.area-button.active span {
    color: var(--primary-color-light);
}

/* =================================
   Custom Checkbox
   ================================= */
.charge-list-item {
    list-style: none;
    display: block;
    margin-bottom: 0.5rem;
}

.custom-checkbox-label {
    display: flex;
    align-items: center;
    padding: 1rem;
    background-color: var(--white-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
}

.custom-checkbox-label:has(input:checked) {
    background-color: var(--primary-color-light);
    border-color: var(--primary-color);
}

.custom-checkbox-label input[type="checkbox"] {
    display: none; /* or appearance: none; */
}

.custom-checkbox-label .checkbox-visual {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-color);
    border-radius: 50%; /* 丸形 */
    margin-right: 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: border-color 0.2s, background-color 0.2s;
}

.custom-checkbox-label .checkbox-visual::after {
    content: 'check';
    color: var(--white-color);
    font-size: 16px;
    opacity: 0;
    transition: opacity 0.2s;
}

.custom-checkbox-label input:checked + .checkbox-visual {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.custom-checkbox-label input:checked + .checkbox-visual::after {
    opacity: 1;
}

/* =================================
   Custom Radio Buttons
   ================================= */
.custom-radio-label {
    display: flex;
    align-items: center;
    padding: 1rem;
    background-color: var(--white-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
    margin-bottom: 0.5rem;
}

.custom-radio-label:has(input:checked) {
    background-color: var(--primary-color-light);
    border-color: var(--primary-color);
}

.custom-radio-label input[type="radio"] {
    margin-right: 1rem;
    /* Use modern accent-color for styling */
    accent-color: var(--primary-color);
    width: 1.15em;
    height: 1.15em;
    transform: translateY(-0.075em);
}


/* =================================
   Confirmation List
   ================================= */
.confirmation-list-container {
    max-height: 180px;
    overflow-y: auto;
    background-color: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 0.5rem;
    margin-bottom: 1.5rem;
}

.confirmation-list-item {
    list-style: none;
    padding: 0.6rem 0.8rem;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
    background-color: var(--white-color);
    border-radius: var(--border-radius-sm);
    border: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.confirmation-list-item + .confirmation-list-item {
    margin-top: 0.5rem;
}

/* =================================
   Keypad
   ================================= */
.keypad-display-container {
    display: flex;
    align-items: baseline;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.keypad-display {
    font-size: 2.5rem;
    font-weight: bold;
    text-align: right;
    border: none;
    border-bottom: 3px solid var(--primary-color);
    width: 100px;
    padding: 0.5rem;
    background: transparent;
    color: var(--text-color);
}

.battery-number-display {
    width: 100%;
    max-width: 280px;
    letter-spacing: 0.2em; /* 斁E間を調整 */
    text-align: center;    
}

.keypad-display.input-error {
    border-bottom-color: var(--danger-color);
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
    transform: translate3d(0, 0, 0);
}

.keypad-display:focus {
    outline: none;
}

.keypad-display-container span {
    font-size: 1.5rem;
    margin-left: 0.5rem;
    color: var(--secondary-color);
}

.keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.keypad-btn {
    padding: 1.2rem 0;
    font-size: 1.8rem;
    border-radius: var(--border-radius-md);
    background-color: var(--white-color);
    color: var(--text-color);
    transition: background-color 0.2s, transform 0.1s;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px solid #ced4da;
}

.keypad-btn:active {
    background-color: #f1f3f5;
    transform: scale(0.95);
}

.keypad-btn-utility {
    background-color: #f8f9fa;
}

.keypad-btn .material-symbols-outlined {
    font-size: 1.8rem;
}

/* =================================
   Toast Notification
   ================================= */
.toast-notification {
    position: fixed;
    bottom: 100px; /* フッターボタンの上あたり */
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 500px;
    background-color: var(--danger-color);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 25px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    z-index: 2000;
    font-size: 0.9rem;
    font-weight: 500;
    pointer-events: none;
    animation: fadeIn 0.3s, fadeOut 0.3s 2.7s forwards;
    display: flex;
    justify-content: center;
}

/* =================================
   List View
   ================================= */
.battery-list-item {
    list-style: none;
    background-color: var(--white-color);
    padding: 1rem;
    border-radius: var(--border-radius-md);
    margin: 1rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--border-color);
}

.battery-list-item {
    cursor: pointer;
    transition: background-color 0.2s;
}
.battery-list-item:active { background-color: #f1f3f5; }

.battery-info {
    display: flex;
    flex-direction: column;
}

.battery-id {
    font-size: 1.1rem;
    font-weight: bold;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
    color: var(--text-color);
}

.battery-duration {
    font-size: 0.9rem;
    color: var(--text-color-light);
    margin-top: 0.25rem;
}

.battery-id-wrapper {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
}

.battery-deadline {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--white-color);
    padding: 3px 9px;
    border-radius: 9px;
    line-height: 1.3;
}

.deadline-early {
    background-color: var(--primary-color);
}

.deadline-warning {
    background-color: var(--warning-color);
}

.list-empty-message {
    list-style: none;
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-color-light);
}

/* =================================
   History List
   ================================= */

#history-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 1rem 0;
}

.history-list-item {
    list-style: none;
    background-color: var(--white-color);
    padding: 1rem;
    border-radius: var(--border-radius-md);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    gap: 1rem;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: background-color 0.2s;
}

.history-list-item:active {
    background-color: #f1f3f5;
}

.history-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--white-color);
}

.history-icon.take-out { background-color: var(--success-color); }
.history-icon.charge { background-color: var(--warning-color); }

.history-icon svg {
    width: 24px;
    height: 24px;
}

.history-details {
    flex-grow: 1;
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: 0.1rem 0.5rem;
}

.history-title {
    font-weight: 500;
    grid-column: 1 / 2;
}

.history-title .type { font-weight: bold; }

.history-date {
    grid-column: 2 / 3;
    grid-row: 1 / 2;
    text-align: right;
    font-size: 0.85rem;
    color: var(--text-color-light);
}

.history-meta {
    grid-column: 1 / 3;
    font-size: 0.9rem;
    color: var(--text-color-light);
    display: flex;
    gap: 0.75rem;
}

/* =================================
   Detail List (in Modal)
   ================================= */
.detail-list {
    display: grid;
    grid-template-columns: 64px 1fr;
    gap: 1rem;
}

.detail-list dt {
    font-weight: 500;
    color: var(--text-color-light);
    display: flex;
    align-items: center;
}

.detail-list dd {
    font-weight: 500;
    word-break: break-all;
}

.detail-list dd.take-out {
    color: var(--success-color);
    font-weight: bold;
}

.detail-list dd.charge {
    color: var(--warning-color);
    font-weight: bold;
}

.detail-list dt.full-width,
.detail-list dd.full-width {
    grid-column: 1 / -1;
}

.detail-list dt.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.remuneration .detail-list {
    grid-template-columns: 80px 1fr;
}

.detail-battery-list-container {
    max-height: 150px;
    overflow-y: auto;
    background-color: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 0.5rem;
}

.detail-battery-list-container .confirmation-list-item {
    font-size: 0.9rem;
}

/* =================================
   QR Scanner
   ================================= */
.qr-reader-wrapper {
    position: relative;
    border-radius: var(--border-radius-md);
    overflow: hidden; /* To keep the video inside the rounded corners */
}

#qr-reader, #qr-reader-edit, #qr-reader-charge, #qr-reader-filter {
    border: 1px solid var(--border-color);
    /* border-radius and overflow are now handled by the wrapper */
    display: block; /* Ensure it takes up space */
}

.flash-toggle-button {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.5);
    color: var(--white-color);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    z-index: 10; /* Make sure it's above the video stream */
}

.flash-toggle-button.active {
    background-color: var(--primary-color);
}

.qr-scan-status {
    text-align: center;
    margin-top: 1rem;
    color: var(--text-color-light);
}

.detail-battery-list-container .confirmation-list-item {
    font-size: 0.9rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.delete-battery-btn {
    background: none; border: none; color: var(--danger-color); cursor: pointer; font-size: 1.5rem; line-height: 1; padding: 0 0.5rem;
    margin: -0.5rem; /* ヒットエリアを調整 */
    transition: transform 0.1s;
}

.early-charge-badge {
    background-color: var(--primary-color);
    color: var(--white-color);
    padding: 3px 8px;
    border-radius: 10px; /* pill shape */
    font-size: 0.75rem;
    font-weight: bold;
    white-space: nowrap; /* Prevent wrapping */
}

.error-target-badge {
    background-color: var(--danger-color);
    color: var(--white-color);
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: bold;
    white-space: nowrap;
}
.charged-badge {
    background-color: var(--warning-color);
    color: var(--white-color);
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: bold;
    white-space: nowrap;
}

.deleted-badge {
    background-color: var(--secondary-color);
    color: var(--white-color);
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: bold;
    white-space: nowrap;
}

.history-detail-battery-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-grow: 1; /* Take up available space */
}


/* =================================
   Filter Mode Toggle
   ================================= */
.filter-mode-toggle {
    display: flex;
    border: 1px solid var(--primary-color);
    border-radius: var(--border-radius-md);
    overflow: hidden;
}

.filter-mode-btn {
    flex: 1;
    padding: 0.75rem;
    background-color: var(--white-color);
    color: var(--primary-color);
    border: none;
    transition: background-color 0.2s, color 0.2s;
}
.filter-mode-btn.active {
    background-color: var(--primary-color);
    color: var(--white-color);
}

/* =================================
   Filter Options Modal
   ================================= */
.filter-options-list {
    list-style: none;
}

.filter-option-item {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: background-color 0.2s;
}

.filter-option-item:first-child {
    border-top: 1px solid var(--border-color);
}

.filter-option-item:active {
    background-color: #f1f3f5;
}

.filter-option-label {
    font-weight: 500;
}

.filter-option-value {
    color: var(--text-color-light);
    font-size: 0.9rem;
}

/* =================================
   Reward List
   ================================= */
.reward-list-item {
    list-style: none;
    background-color: var(--white-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 1rem 1.25rem;
    margin: 1rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.reward-list-item:active {
    background-color: #f1f3f5;
}

.reward-date {
    font-weight: 500;
    color: var(--text-color-light);
}

.reward-total {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--primary-color);
}

.table-container {
    overflow-x: auto;
    margin-top: 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
}

.reward-detail-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    white-space: nowrap; /* セル冁Eの改行を防ぁE*/
}

.reward-detail-table th,
.reward-detail-table td {
    padding: 0.75rem 0.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.reward-detail-table th {
    background-color: #f8f9fa;
    font-weight: 500;
    color: var(--text-color-light);
}

.reward-detail-table td:nth-child(3), /* 数釁E*/
.reward-detail-table td:nth-child(4), /* 報酬 */
.reward-detail-table tfoot td:nth-child(2) { /* 合計顁E*/
    text-align: right;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
}

/* =================================
   Simulation Screen
   ================================= */
.sim-step-card, .sim-target-card, .sim-result-card {
    background-color: var(--white-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 1.25rem;
    margin: 1.5rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.sim-step-card h3, .sim-result-card h3 {
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

.sim-step-card .detail-list {
    grid-template-columns: 112px 1fr;
}

.sim-target-card {
    text-align: center;
    background-color: var(--primary-color-light);
    border-color: var(--primary-color);
}

.sim-target-card p {
    color: var(--text-color-light);
    font-size: 0.9rem;
}

.sim-target-card strong {
    font-size: 2rem;
    color: var(--primary-color-dark);
}

.sim-distribution-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.sim-distribution-grid .form-group {
    margin-bottom: 0;
}

.sim-result-card .sim-result-main {
    text-align: center;
    margin-bottom: 1.5rem;
}

.sim-result-card .sim-result-main p {
    font-size: 1rem;
    color: var(--text-color-light);
}

.sim-result-card .sim-result-main strong {
    font-size: 2.5rem;
    color: var(--success-color);
}

.sim-result-card .detail-list hr.full-width {
    grid-column: 1 / -1;
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 0.5rem 0;
}

.sim-result-card .detail-list {
    grid-template-columns: 180px 1fr;
}

.custom-toggle-label {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    font-size: 1rem;
    color: var(--text-color);
}

.custom-toggle-label input[type="checkbox"] {
    display: none;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    background-color: #ccc;
    border-radius: 12px;
    transition: background-color 0.2s;
    margin-right: 0.75rem;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: white;
    top: 2px;
    left: 2px;
    transition: transform 0.2s;
}

.custom-toggle-label input:checked + .toggle-switch {
    background-color: var(--primary-color);
}

.custom-toggle-label input:checked + .toggle-switch::after {
    transform: translateX(20px);
}

.chart-container {
    position: relative;
    height: 250px;
    width: 100%;
    margin-top: 1rem;
}

/* =================================
   Stats Screen
   ================================= */

.stats-card {
    background-color: var(--white-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 1.25rem;
    margin: 1.5rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.stats-card h3 {
    margin-bottom: 1rem;
}

.stats-list {
    list-style: none;
}

.stats-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid #f1f3f5;
}

.stats-list-item:last-child {
    border-bottom: none;
}

.stats-list-item.clickable-stat {
    cursor: pointer;
    transition: background-color 0.2s;
}

.stats-list-item.clickable-stat:active {
    background-color: #f1f3f5;
}

.stats-list-item .value {
    font-weight: bold;
    white-space: nowrap;
}

/* =================================
   Import/Export & Conflict Resolution
   ================================= */
.import-export-card {
    background-color: var(--white-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 1.25rem;
    margin-top: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.import-export-card p {
    color: var(--text-color-light);
    margin-bottom: 1rem;
    font-size: 0.9rem;
    line-height: 1.5;
}

.conflict-card {
    background-color: var(--white-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    overflow: hidden;
}

.conflict-header {
    background-color: #f8f9fa;
    padding: 0.75rem 1.25rem;
    font-weight: bold;
    border-bottom: 1px solid var(--border-color);
}

.conflict-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.conflict-option {
    padding: 1.25rem;
    border-right: 1px solid var(--border-color);
}

.conflict-option:last-child {
    border-right: none;
}

.conflict-option .detail-list {
    grid-template-columns: 30px 1fr;
    gap: 0.5rem 1rem;
    font-size: 0.9rem;
}


/* =================================
   Drawer Menu
   ================================= */
#drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--modal-overlay-bg);
    z-index: 1100;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#drawer-overlay.active {
    opacity: 1;
    visibility: visible;
}

#drawer-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 80%;
    max-width: 300px;
    height: 100%;
    background-color: var(--white-color);
    z-index: 1200;
    transform: translateX(-100%);
    transition: transform 0.3s ease-out;
    display: flex;
    flex-direction: column;
}

#drawer-menu.active {
    transform: translateX(0);
}

.drawer-header {
    padding: 1.25rem var(--spacing-unit);
    border-bottom: 1px solid var(--border-color);
}

.drawer-link {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1rem 1.25rem;
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    transition: background-color 0.2s;
}

.drawer-link.active {
    background-color: var(--primary-color);
    color: var(--background-color);
    font-variation-settings: 'FILL' 1;
}

/* =================================
   Animations
   ================================= */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes slideOutDown {
    from { transform: translateY(0); }
    to { transform: translateY(100%); }
}

@keyframes shake {
  10%, 90% {
    transform: translate3d(-1px, 0, 0);
  }
  20%, 80% {
    transform: translate3d(2px, 0, 0);
  }
  30%, 50%, 70% {
    transform: translate3d(-4px, 0, 0);
  }
  40%, 60% {
    transform: translate3d(4px, 0, 0);
  }
}

/* =================================
   Find Battery Result
   ================================= */
.find-result-container {
    margin-top: 1rem;
    min-height: 100px;
}

.find-result-container .placeholder {
    text-align: center;
    color: var(--text-color-light);
    padding: 1rem;
}

.find-result-card {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem;
    border-radius: var(--border-radius-md);
    background-color: #f8f9fa;
    border: 1px solid var(--border-color);
    text-align: center;
    animation: fadeIn 0.3s;
}

.find-result-card.result-found {
    cursor: pointer;
    transition: background-color 0.2s;
}

.find-result-card.result-found {
    background-color: var(--primary-color-light); /* 水色 */
    border-color: var(--primary-color);
    box-shadow: 0 0 10px rgba(50, 197, 255, 0.3);
}

.find-result-card.result-early-warning {
    background-color: var(--primary-color-light);
    border-color: var(--primary-color);
    box-shadow: 0 0 10px rgba(50, 197, 255, 0.3);
}

.find-result-card.result-near-deadline {
    background-color: #fff2eb;
    border-color: var(--warning-color-dark);
    box-shadow: 0 0 10px rgba(255, 134, 74, 0.3);
}

.find-result-card .result-id {
    font-size: 1.5rem;
    font-weight: bold;
    font-family: monospace;
}

.result-additional-info {
    overflow: hidden;
    text-align: center;
    border-radius: 4px;
}

.result-additional-info p {
    white-space: nowrap;
}

.result-additional-info p.scrolling {
    display: inline-block;
    padding-left: 100%;
    animation: scroll-text 15s linear infinite;
}

.find-scanner-wrapper {
    max-height: 475px;
    margin-left: auto;
    margin-right: auto;
}

/* =================================
   Header Dropdown Menu
   ================================= */
.header-menu-container {
    position: relative;
}

.header-menu-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background-color: var(--white-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 20;
    width: 200px;
    overflow: hidden;
}

.header-menu-dropdown ul { list-style: none; }
.header-menu-dropdown li {
    padding: 0.8rem 1.2rem;
    cursor: pointer;
    transition: background-color 0.2s;
}
.header-menu-dropdown li:hover,
.header-menu-dropdown li:active { background-color: #f1f3f5; }

.header-menu-dropdown li.active {
    background-color: var(--primary-color-light);
    color: var(--primary-color-dark);
    font-weight: bold;
}

/* =================================
   Reservation List
   ================================= */
.reservation-list-item {
    list-style: none;
    background-color: var(--white-color);
    padding: 1rem;
    border-radius: var(--border-radius-md);
    margin: 1rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    gap: 1rem;
    border: 1px solid var(--border-color);
    transition: background-color 0.2s, opacity 0.3s;
}

.reservation-list-item.cancelled {
    opacity: 0.6;
    background-color: #f8f9fa;
}

.cancelled-tag {
    font-size: 0.8rem;
    font-weight: bold;
    color: var(--danger-color);
}

.reservation-list-item.clickable {
    cursor: pointer;
}

.reservation-list-item.clickable:active {
    background-color: #f1f3f5;
}

.collapsible-list .collapsible-item {
    display: none;
}

.collapsible-list.expanded .collapsible-item {
    display: flex;
}

.btn-toggle-collapse {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    padding: 0.5rem 0;
    margin-top: 0.5rem;
    font-weight: bold;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.form-control-sm {
    padding: 0.5rem 0.8rem;
    font-size: 0.9rem;
    height: auto;
    border-radius: var(--border-radius-md);
    background-color: var(--white-color);
}

.stats-header-with-control {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.stats-header-with-control h3 {
    margin-bottom: 0;
}

.ranking-controls {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.radio-label {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.radio-label.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.radio-label input {
    display: none;
}

.area-stats-list .stats-list-item {
    flex-direction: column;
    align-items: stretch; /* 横幁E揁EめE*/
    gap: 0.5rem;
    padding: 1rem; /* パディングを調整 */
    background-color: var(--white-color);
    border: 1px solid var(--border-color); /* 枠線を追加してカード風に */
    border-radius: var(--border-radius-md);
    margin: 0 0 0.75rem 0;
}

.area-stats-list .stats-list-item:last-child {
    margin-bottom: 0;
}


.area-stats-list .area-name {
    font-weight: bold;
    font-size: 1rem;
}

.stats-value-group {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 0.9rem;
    padding: 0.25rem 0;
}

.stats-value-group .value-label {
    color: var(--text-color-light);
    font-size: 0.85rem;
}

.area-stats-list .stats-list-item .value {
    font-weight: 500;
    text-align: right;
}

.confirmation-list-item.clickable {
    cursor: pointer;
    transition: background-color 0.2s;
}

.confirmation-list-item.clickable:active {
    background-color: #f1f3f5;
}

/* =================================
   Ranking History Modal
   ================================= */
.history-table-section {
    margin-bottom: 1.5rem;
}

.history-table-section:last-child {
    margin-bottom: 0;
}

.history-summary {
    font-size: 0.9rem;
    color: var(--text-color-light);
}

.store-history-table td:nth-child(3) {
    text-align: left;
}

/* =================================
   Rewards Screen Footer
   ================================= */
.rewards-footer {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    text-align: center;
}

.rewards-footer-item,
.rewards-footer-item-single {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.5rem;
}

.rewards-footer-item-single {
    grid-column: 1 / -1; /* 1つの場合に中央に配置 */
}

.rewards-footer-item span,
.rewards-footer-item-single span {
    font-size: 0.9rem;
    color: var(--text-color-light);
}

.rewards-footer-item strong,
.rewards-footer-item-single strong {
    font-size: 1.5rem;
    color: var(--primary-color);
}





.flex-between {


    display: flex;


    justify-content: space-between;


}





/* =================================


   Reservation Status Bar


   ================================= */


#reservation-status-bar {


    position: fixed;


    /* フッターの高さ(padding 1rem * 2 + button height 54px = approx 86px)を老EE */


    bottom: 86px; 


    left: 0;


    width: 100%;


    max-width: 600px; /* #appのmax-widthと合わせる */


    background-color: var(--danger-color);


    color: var(--white-color);


    padding: 0.5rem 0;


    font-size: 0.9rem;


    font-weight: 500;


    cursor: pointer;


    overflow: hidden; /* はみ出したチEストを隠ぁE*/


    white-space: nowrap; /* チEストを改行させなぁE*/


    z-index: 5; /* 他E要素より手前に */


    display: none; /* JSで表示を制御 */


}





#reservation-status-bar.visible {


    display: block;


}





#reservation-status-bar p {


    display: inline-block;


    padding-left: 100%; /* 右端からスタートさせる */


    animation: scroll-text 15s linear infinite;


}





@keyframes scroll-text {


    0% {


        transform: translateX(0);


    }


    100% {


        transform: translateX(-100%);


    }


}

/* =================================
   Data Management Tabs
   ================================= */
.data-management-tabs {
    display: flex;
    justify-content: space-around;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.data-management-tabs .tab {
    background: none;
    border: none;
    padding: 0.75rem 0.5rem;
    font-size: 1rem;
    color: var(--text-color-light);
    position: relative;
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: color 0.2s;
}

.data-management-tabs .tab .tab-text {
    display: none;
}

.data-management-tabs .tab.active {
    color: var(--primary-color);
    font-weight: bold;
}

.data-management-tabs .tab.active span.material-symbols-outlined {
    font-variation-settings: 'FILL' 1;
}

.data-management-tabs .tab.active .tab-text {
    display: inline;
}

.data-management-tabs .tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 10%;
    right: 10%;
    height: 3px;
    background-color: var(--primary-color);
    border-radius: 3px 3px 0 0;
}

.data-management-tabs .tab:not(.active) {
    font-size: 1.2rem; /* アイコンのみの場吁Eサイズを調整 */
}

/* =================================
   Modal Timeline
   ================================= */
.modal-timeline {
    list-style: none;
    padding: 0;
}
.modal-timeline .history-list-item {
    box-shadow: none;
    border: 1px solid var(--border-color);
}

/* =================================
   Data Purge Styles
   ================================= */
.delete-history-controls {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.delete-history-controls .footer-button-outline {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    flex-grow: 0;
    border-width: 1px;
}

.delete-history-list {
    list-style: none;
    max-height: 60vh;
    overflow-y: auto;
}

.history-list-item-delete {
    list-style: none;
    background-color: var(--white-color);
    border-radius: var(--border-radius-md);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    border: 1px solid var(--border-color);
    transition: background-color 0.2s;
}

.history-list-item-delete .custom-checkbox-label {
    padding: 1rem;
    border: none;
    background: none;
    margin-bottom: 0;
    flex-shrink: 0;
}
.history-list-item-delete .custom-checkbox-label:has(input:checked) {
    background: none;
    border: none;
}

.history-list-item-delete .history-details {
    padding: 0.75rem 1rem 0.75rem 0;
}

.history-list-item-delete.selected {
    background-color: var(--primary-color-light);
    border-color: var(--primary-color);
}

/* Reservation Detail Modal Customization */
.modal-header div {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.use-reservation-btn {
    font-size: 1rem;
    color: var(--primary-color);
    cursor: pointer;
    font-weight: 500;
    transition: color 0.2s;
}

.use-reservation-btn:active {
    color: var(--primary-color-dark);
}
.modal-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* =================================
   Modal Timeline (Special View for Single Item)
   ================================= */
.timeline-item-special {
    list-style: none;
    padding: 2rem 1rem;
    text-align: center;
    color: var(--text-color-light);
}

.timeline-item-special-content p {
    font-weight: 500;
}

.delete-history-footer {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}


/* =================================
   Simulation Screen Tabs
   ================================= */
/* =================================
   Battery Detail Modal
   ================================= */
#battery-detail-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1001; /* 他�Eモーダルより手前に */
}

#battery-detail-modal .modal-content {
    background-color: var(--white-color);
    width: calc(100% - 2rem);
    max-width: 500px;
    border-radius: var(--border-radius-lg);
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    animation: fadeIn 0.3s ease-out;
}

#battery-detail-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

#battery-detail-modal .modal-header h2 {
    font-size: 1.2rem;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
}

#battery-detail-modal .close-button {
    background: none;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: background-color 0.2s;
}

#battery-detail-modal .close-button:active {
    background-color: var(--disabled-color);
}

#battery-detail-modal .modal-body {
    padding: 1.25rem;
    overflow-y: auto;
}

#battery-detail-modal .detail-group {
    margin-bottom: 1.5rem;
}

#battery-detail-modal .detail-group:last-child {
    margin-bottom: 0;
}

#battery-detail-modal .detail-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-color-light);
    margin-bottom: 0.5rem;
}

#battery-detail-modal select,
#battery-detail-modal textarea {
    width: 100%;
    padding: 0.8rem;
    font-size: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    background-color: #f8f9fa; /* disabled look */
    transition: background-color 0.2s, border-color 0.2s;
}

#battery-detail-modal select:disabled,
#battery-detail-modal textarea:disabled {
    background-color: #e9ecef;
    color: #6c757d;
    cursor: not-allowed;
}

#battery-detail-modal select:not(:disabled),
#battery-detail-modal textarea:not(:disabled) {
    background-color: var(--white-color);
    border-color: var(--primary-color);
}

#modal-history-list {
    list-style: none;
    max-height: 150px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 0.5rem;
}

#modal-history-list .history-type-charge { color: var(--warning-color); font-weight: bold; }
#modal-history-list .history-type-take-out { color: var(--success-color); font-weight: bold; }

#modal-history-list li:not(.timeline-divider) {
    padding: 0.5rem 0.75rem;
    display: flex;
    justify-content: center;
    margin: 0;
}

.modal-timeline .timeline-divider {
    list-style: none;
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 0.75rem 0;
    height: 0;
}

.modal-timeline .timeline-arrow {
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-color-light);
    margin: 0.25rem 0;
}

#battery-detail-modal .modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-color);
}

#battery-detail-modal .button {
    padding: 0.6rem 1.2rem;
    border-radius: var(--border-radius-md);
    font-weight: bold;
    background-color: var(--primary-color);
    color: var(--white-color);
    min-width: 80px;
    text-align: center;
}

#battery-detail-modal .button:active {
    background-color: var(--primary-color-dark);
    transform: scale(0.97);
}

.sim-tabs, .stats-tabs {
    display: flex;
    justify-content: space-around;
    background-color: #f8f9fa;
    border-bottom: 1px solid var(--border-color);
    padding: 0 var(--spacing-unit);
}

.sim-tab-button, .stats-tab {
    flex: 1;
    background: none;
    border: none;
    padding: 0.85rem 0.5rem;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-color-light);
    position: relative;
    transition: color 0.2s;
    cursor: pointer;
    flex-grow: 1;
}

.sim-tab-button.active, .stats-tab.active {
    color: var(--primary-color);
    font-weight: bold;
}

.sim-tab-button.active::after, .stats-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 10%;
    right: 10%;
    height: 3px;
    background-color: var(--primary-color);
    border-radius: 3px 3px 0 0;
}

.sim-tab-content {
    display: none;
}

.sim-tab-content.active {
    display: block;
}

.sim-sort-btn {
    font-size: 1rem;
    padding: 0.2rem;
    width: 28px;
    height: 28px;
    line-height: 1;
}
.sim-sort-btn:disabled {
    opacity: 0.2;
    cursor: not-allowed;
    background-color: transparent !important;
    color: var(--primary-color) !important;
}

/* =================================
   Simulation Reservation Tab
   ================================= */
.sim-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    /* h3のスタイルをここに適用 */
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

.sim-card-header h3 {
    /* h3の允E�EスタイルをリセチE�� */
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
}

.button-sm {
    padding: 0.4rem 0.8rem;
    border-radius: var(--border-radius-md);
    background-color: var(--white-color);
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap; /* ボタンチE��ストが改行しなぁE��ぁE�� */
    transition: background-color 0.2s, transform 0.1s;
}

.button-sm:active {
    background-color: var(--primary-color-light);
    transform: scale(0.97);
}

/* =================================
   Simulation Reservation Tab Items
   ================================= */
.stats-list-item .sim-item-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    overflow: hidden; /* for text-overflow */
    justify-content: center;
}

.stats-list-item .sim-item-text {
    font-size: 0.9rem;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stats-list-item .sim-item-content .value {
    font-size: 1.1rem;
    font-weight: bold;
}

.sim-item-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sim-item-controls .sim-delete-btn {
    color: var(--secondary-color);
}
.sim-item-controls .sim-delete-btn .material-symbols-outlined {
    font-size: 1.2rem;
}


.sim-sort-controls {
    display: flex;
    flex-direction: column;
}

/* =================================
   Filter Category Buttons
   ================================= */
.date-filter-container {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
}

.date-filter-container .filter-option-item {
    border-bottom: 1px solid var(--border-color);
}
.date-filter-container .filter-option-item:first-child {
    border-top: none;
}


.filter-category-selector {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1rem;
}

.category-buttons {
    display: flex;
    gap: 0.5rem;
}

.category-btn {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    background-color: var(--disabled-color);
    color: var(--text-color-light);
    border: 1px solid var(--border-color);
    font-size: 0.9rem;
    transition: all 0.2s;
}

.category-btn.active {
    background-color: var(--primary-color);
    color: var(--white-color);
    border-color: var(--primary-color);
    font-weight: 500;
}


/* �o�b�e���[�ڍ׃��[�_���̉����уX�^�C�� */
.modal-body .detail-item {
    display: flex;
    align-items: baseline; /* �e�L�X�g�̃x�[�X���C���𑵂��� */
    gap: 0.8em;
    margin-bottom: 0;
}

.modal-body .detail-item .form-label {
    flex: 0 0 80px; /* ���x���̕���80px�ɌŒ� */
    margin-bottom: 0;
    padding-top: 0.5rem; /* ���e��padding�ƍ��������킹�� */
}

.modal-body .detail-item .detail-item-content {
    flex: 1;
}

/* p�^�O�ɂ̓f�t�H���g�ŏ㉺�}�[�W��������̂Ń��Z�b�g���A����padding��K�p */
.modal-body .detail-item .detail-item-content p {
    margin: 0;
    padding: 0.5rem 0;
}

/* バッテリー詳細モーダルのメモ入力欄のリサイズを無効化 */
#modal-battery-memo-input,
#modal-battery-temp-memo-input,
#store-settings-memo,
#modal-store-memo-input {
    resize: none;
}

/* 店舗設定セクションのスタイル */
.store-settings-card {
    background-color: var(--bg-card, #f8f9fa);
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: var(--border-radius-md, 8px);
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.store-settings-card h3 {
    color: var(--text-color, #333333);
    font-weight: 600;
}

.store-settings-card input:disabled,
.store-settings-card select:disabled {
    background-color: #e9ecef;
    color: #6c757d;
    cursor: not-allowed;
    opacity: 0.8;
}
