html {
    font-size: 14px;
}

.rental-reserve-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-weight: 400 !important;
    color: #333333;
    padding: 0;
    background: #ffffff;
    max-width: 100%;
    margin: 0 auto;
}

/* --- Responsive Header Controls --- */
.rental-header-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    width: 100%;
}

.rental-header-controls h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: #2c3e50;
    line-height: 1.2;
}

.header-item {
    display: flex;
    align-items: center;
}

/* Desktop View Layout (1 Row) */
@media (min-width: 992px) {
    .rental-header-controls {
        flex-wrap: nowrap;
    }
    .header-title {
        margin-right: 20px;
        order: 1;
    }
    .header-nav {
        margin-right: 20px;
        order: 2;
    }
    .header-filter {
        margin-right: auto;
        order: 3;
    }
    .header-user {
        margin-right: 12px;
        order: 4;
    }
    .header-toggle {
        order: 5;
    }
}

/* Tablet View Layout (2 Rows: 481px - 991px) */
@media (min-width: 481px) and (max-width: 991px) {
    .rental-header-controls {
        display: grid;
        grid-template-columns: auto 1fr auto;
        gap: 12px 16px;
    }
    
    .header-title {
        grid-column: 1;
        grid-row: 1;
        justify-self: start;
        order: 1;
    }
    
    .header-nav {
        grid-column: 2;
        grid-row: 1;
        justify-self: start;
        order: 2;
    }
    
    .header-user {
        grid-column: 3;
        grid-row: 1;
        justify-self: end;
        order: 4;
    }
    
    .header-filter {
        grid-column: 1 / span 2;
        grid-row: 2;
        justify-self: start;
        order: 3;
    }
    
    .header-toggle {
        grid-column: 3;
        grid-row: 2;
        justify-self: end;
        order: 5;
    }
}

/* Mobile View Layout (3 Rows: <= 480px) */
@media (max-width: 480px) {
    .rental-header-controls {
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto auto;
        gap: 12px 16px;
    }
    
    .header-title {
        grid-column: 1;
        grid-row: 1;
        justify-self: start;
        order: 1;
    }
    
    .header-user {
        grid-column: 2;
        grid-row: 1;
        justify-self: end;
        order: 2;
    }
    
    .header-nav {
        grid-column: 1 / span 2;
        grid-row: 2;
        justify-self: start;
        order: 3;
    }
    
    .header-filter {
        grid-column: 1;
        grid-row: 3;
        justify-self: start;
        order: 4;
    }
    
    .header-toggle {
        grid-column: 2;
        grid-row: 3;
        justify-self: end;
        order: 5;
    }
}

/* Extra Small Screen Optimization (<= 480px) */
@media (max-width: 480px) {
    .rental-header-controls h2 {
        font-size: 1.25rem;
    }
    
    .date-display-btn {
        min-width: auto;
        padding: 6px 10px;
        font-size: 0.9rem;
        white-space: nowrap;
    }
    
    .btn-nav {
        padding: 6px 8px;
        font-size: 0.8rem;
    }
    
    .btn-switch {
        padding: 6px 10px;
        font-size: 0.8rem;
    }
    
    .group-filter-select {
        font-size: 0.85rem;
        padding: 6px 24px 6px 8px;
    }
}


.group-filter-select {
    height: 36px;
    box-sizing: border-box;
    padding: 0 30px 0 12px;
    border: 1px solid #cccccc;
    border-radius: 4px;
    background-color: #ffffff;
    font-size: 0.95rem;
    cursor: pointer;
    color: #333333;
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 12px 12px;
    min-width: 140px;
    transition: border-color 0.15s ease-in-out;
}

.group-filter-select:focus {
    border-color: #80bdff;
}

.action-buttons {
    display: flex;
    gap: 8px;
}

.date-input {
    padding: 5px 10px;
    border: 1px solid #cccccc;
    border-radius: 4px;
}

.btn {
    height: 36px;
    box-sizing: border-box;
    padding: 0 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
    border: 1px solid #cccccc;
    background: #ffffff;
}

.btn-primary {
    background: #f8f9fa;
    border-color: #cccccc;
}

.btn-primary:hover {
    background: #e2e6ea;
}

/* グリッドテーブルのデザイン */
.timeline-scroll-container {
    overflow-x: auto;
    margin-top: 10px;
    border: 1px solid #dddddd;
}

.rental-grid-table {
    display: table;
    width: max-content;
    min-width: 100%;
    border-collapse: collapse !important;
    background-color: #ffffff;
}

.rental-grid-table thead {
    display: table-header-group;
}

.rental-grid-table tbody {
    display: table-row-group;
}

.rental-grid-table,
.rental-grid-table *,
.rental-grid-table *::before,
.rental-grid-table *::after {
    box-sizing: border-box;
}

.rental-grid-table th, 
.rental-grid-table td {
    border: 1px solid #888888 !important;
    padding: 6px;
    text-align: center;
    font-size: 0.85rem;
}

.time-col-header {
    min-width: 3rem;
    max-width: 3rem;
    position: sticky;
    left: 0;
    z-index: 11;
    background-color: #ffffff !important;
    box-shadow: 2px 0 5px -2px rgba(0,0,0,0.15);
}

.date-header {
    background-color: #ffffff;
    font-weight: 500;
}

.date-header.today-header {
    background-color: #fcf8e3;
}

.date-header.sat {
    color: #0000ff;
}

.date-header.sun {
    color: #ff0000;
}

/* マシーンヘッダーの色 */
.rental-header-cell {
    font-weight: 500;
    font-size: 0.8rem;
    padding: 3px 3px !important;
    min-width: 4.2rem;
    background-color: #ffffff !important;
}

.rental-header-badge {
    display: block;
    padding: 4px 6px;
    border-radius: 4px;
    font-weight: 500;
    font-size: 0.85rem;
    text-align: center;
    box-sizing: border-box;
    width: 100%;
}

.vision-header {
    background-color: #aed6f1 !important;
    color: #1b4f72;
}

.gdr-header {
    background-color: #f9ebd2 !important; /* 薄いオレンジ・ピンク */
    color: #7e5109;
}

/* 各マシーン用のスロットの背景色 */
.slot-cell {
    height: 18px;
    padding: 0 !important;
    cursor: pointer;
    transition: background-color 0.1s;
    min-width: 4.2rem;
}

.rental-header-cell.c1,
.slot-cell.c1 {
    min-width: 8rem;
    max-width: 8rem;
}

/* 空席スロット */
td[data-rental-name="VISION"].available-slot,
td[data-rental-name="VISION"].booked-slot {
    background-color: #85c1e9; /* VISIONはブルー */
}

td[data-rental-name="GDR"].available-slot,
td[data-rental-name="GDR"].booked-slot {
    background-color: #f5b7b1; /* GDRはピンク・赤 */
}

/* 空席ホバー効果 */
td[data-rental-name="VISION"].available-slot:hover {
    background-color: #5dade2;
}

td[data-rental-name="GDR"].available-slot:hover {
    background-color: #ec7063;
}

/* 予約済スロット */
.booked-slot {
    position: relative !important;
    padding: 0 !important;
}

/* 予約枠インナーアイテム */
.booking-inner-item {
    position: absolute;
    top: 2px;
    bottom: 2px;
    left: 2px;
    right: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: normal;
    border-radius: 2px;
    box-sizing: border-box;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* 他の人の予約 (グレー表示、文字なし) */
.booking-inner-item.other-booking {
    background-color: lightgray !important;
    border: 1px solid gray !important;
    color: transparent !important;
}

/* 自分の予約：一般枠 (white) */
.booking-inner-item.my-booking.booking-type-general {
    background-color: white !important;
    border: 1px solid gray !important;
    color: #000000 !important;
}

/* 自分の予約：月額枠 (orange) */
.booking-inner-item.my-booking.booking-type-subsc {
    background-color: orange !important;
    border: 1px solid gray !important;
    color: #000000 !important;
}

/* 営業時間外 (薄いグレー) */
.closed-slot {
    background-color: #f9f9f9 !important;
    cursor: default;
    border-bottom: none !important;
    border-top: none !important;
}

.time-label-cell {
    position: sticky;
    left: 0;
    z-index: 10;
    background-color: #ffffff !important;
    font-weight: normal;
    min-width: 3rem;
    max-width: 3rem;
    font-size: 0.8rem;
    vertical-align: middle;
    box-shadow: 2px 0 5px -2px rgba(0,0,0,0.15);
}

/* モーダル */
.rental-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.modal-content {
    background: #ffffff;
    border-radius: 4px;
    width: 90%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    border: 1px solid #cccccc;
    overflow: visible !important;
    padding: 0;
}

.modal-header {
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e9ecef;
    background-color: #e9ecef;
    color: #333333;
    border-top-left-radius: 4px;
    border-top-right-radius: 4px;
}

.modal-header .modal-title {
    margin: 0;
    font-size: 1.2rem;
    font-weight: bold;
    color: inherit;
}

.modal-header .close-modal {
    font-size: 1.8rem;
    cursor: pointer;
    color: inherit;
    line-height: 1;
    opacity: 0.5;
    transition: opacity 0.15s;
    user-select: none;
}

.modal-header .close-modal:hover {
    opacity: 0.9;
}

.modal-body {
    padding: 24px;
    background-color: #ffffff;
    overflow: visible !important;
}

.modal-row {
    display: flex;
    margin-bottom: 16px;
    align-items: flex-start;
    font-size: 0.95rem;
}

.modal-label {
    width: 100px;
    font-weight: bold;
    color: #555555;
    flex-shrink: 0;
    padding-top: 3px;
}

.modal-value {
    flex-grow: 1;
    color: #333333;
}

.time-inputs-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.time-select {
    padding: 5px 8px;
    border: 1px solid #cccccc;
    border-radius: 4px;
    background-color: #ffffff;
    font-size: 0.95rem;
    color: #333333;
    outline: none;
}

.time-separator {
    font-weight: bold;
    color: #555555;
}

.koma-select {
    padding: 5px 8px;
    border: 1px solid #cccccc;
    border-radius: 4px;
    background-color: #ffffff;
    font-size: 0.95rem;
    color: #333333;
    outline: none;
}

.koma-label {
    font-size: 0.95rem;
    color: #333333;
    margin-left: 4px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 24px;
    border-top: 1px solid #999999;
    background-color: #ffffff;
}

.btn-primary {
    background-color: #007bff;
    color: #ffffff;
    border: 1px solid #007bff;
    padding: 8px 16px;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    font-size: 0.95rem;
    transition: background-color 0.15s;
}

.btn-primary:hover {
    background-color: #0056b3;
    border-color: #004085;
}

.btn-secondary {
    background-color: #6c757d;
    color: #ffffff;
    border: 1px solid #6c757d;
    padding: 8px 16px;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    font-size: 0.95rem;
    transition: background-color 0.15s;
}

.btn-secondary:hover {
    background-color: #5a6268;
    border-color: #545b62;
}

.btn-danger {
    background-color: #dc3545;
    color: #ffffff;
    border: 1px solid #dc3545;
    padding: 8px 16px;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    font-size: 0.95rem;
    transition: background-color 0.15s;
}

.btn-danger:hover {
    background-color: #bd2130;
    border-color: #b21f2d;
}

/* 日付ナビゲーター・ビュー切り替え */
.date-navigator-group {
    display: inline-flex;
    align-items: center;
    border: 1px solid #cccccc;
    border-radius: 4px;
    overflow: hidden;
    background: #ffffff;
    height: 36px;
    box-sizing: border-box;
}

.btn-nav {
    border: none;
    background: #ffffff;
    height: 100%;
    padding: 0 12px;
    cursor: pointer;
    font-size: 0.9rem;
    color: #666666;
    transition: background 0.1s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-nav:focus {
    outline: none;
}

.btn-nav:hover {
    background: #f0f0f0;
}

.date-display-btn {
    border-left: 1px solid #cccccc;
    border-right: 1px solid #cccccc;
    border-top: none;
    border-bottom: none;
    background: #ffffff;
    height: 100%;
    padding: 0 16px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    min-width: 140px;
    text-align: center;
    color: #333333;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.date-display-btn:focus {
    outline: none;
}

.date-display-btn:hover {
    background: #f9f9f9;
}

.view-switch-group {
    display: inline-flex;
    border: 1px solid #cccccc;
    border-radius: 4px;
    overflow: hidden;
    background: #ffffff;
    margin-left: auto;
    height: 36px;
    box-sizing: border-box;
}

.btn-switch {
    border: none;
    background: #ffffff;
    height: 100%;
    padding: 0 16px;
    font-size: 0.9rem;
    cursor: pointer;
    color: #555555;
    transition: all 0.1s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-switch:focus {
    outline: none;
}

.btn-switch.active {
    background: #6c757d;
    color: #ffffff;
    font-weight: 500;
}

.btn-switch:not(.active):hover {
    background: #f0f0f0;
}

/* 月カレンダーのデザイン */
.rental-month-table {
    width: 100%;
    border-collapse: collapse;
    background-color: #ffffff;
    table-layout: fixed;
}

.rental-month-table th,
.rental-month-table td {
    border: 1px solid #888888;
    padding: 8px;
    vertical-align: top;
    height: 90px;
}

.rental-month-table th {
    height: auto;
    text-align: center;
    font-weight: bold;
    background-color: #f8f9fa;
    padding: 6px;
    font-size: 0.9rem;
}

.rental-month-table th.sun,
.rental-month-table td .day-label.sun {
    color: #ff0000;
}

.rental-month-table th.sat,
.rental-month-table td .day-label.sat {
    color: #0000ff;
}

.rental-month-table td {
    cursor: pointer;
    transition: background-color 0.1s;
}

.rental-month-table td:hover {
    background-color: #f1f3f5;
}

.rental-month-table td.today-cell {
    background-color: #e8f5e9;
    border: 2px solid #2e7d32;
}

.edit-mode-active .rental-month-table td.closed-day-cell,
.edit-mode-active .rental-grid-table th.closed-day-cell {
    background-color: #f8d7da !important;
    color: #721c24 !important;
}

.rental-month-table td.past-cell {
    background-color: #f8f9fa;
}

.day-label {
    font-weight: bold;
    font-size: 0.95rem;
    margin-bottom: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.schedule-msg {
    font-size: 0.75rem;
    font-weight: normal;
    background: #ffeeba;
    color: #856404;
    padding: 1px 4px;
    border-radius: 2px;
}

.group-tag {
    font-size: 0.75rem;
    padding: 4px 6px;
    margin-top: 5px;
    border-radius: 3px;
    text-align: center;
    font-weight: bold;
    display: block;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    box-sizing: border-box;
    width: 100%;
}

/* 機器タイプのカラー設定 */
.ritem-tag-vision {
    background-color: #aed6f1;
    color: #1b4f72;
}

.ritem-tag-gdr {
    background-color: #f9ebd2;
    color: #7e5109;
}

/* ユーザーメニューのドロップダウン */
.user-menu-dropdown {
    position: relative;
    display: inline-block;
}

.user-menu-btn {
    background: #f8f9fa;
    border: 1px solid #cccccc;
    border-radius: 50% !important;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s;
    outline: none;
    padding: 0;
}

.user-menu-btn:hover {
    background: #e2e6ea;
}

.user-menu-btn .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
    color: #555555;
}

.user-menu-content {
    position: absolute;
    right: 0;
    top: 42px;
    background-color: #ffffff;
    min-width: 180px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 1px solid #dee2e6;
    border-radius: 4px;
    z-index: 1000;
    padding: 8px 0;
}

.user-menu-header {
    padding: 8px 16px;
    font-size: 0.9rem;
    color: #333333;
    text-align: left;
}

.user-menu-divider {
    height: 1px;
    background-color: #dee2e6;
    margin: 6px 0;
}

.user-menu-item {
    display: block;
    padding: 8px 16px;
    color: #333333;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background-color 0.1s;
    text-align: left;
}

.user-menu-item:hover {
    background-color: #f8f9fa;
    color: #007bff;
    text-decoration: none;
}

.user-menu-item.logout-item:hover {
    color: #dc3545;
}

/* --- Edit Mode Styles --- */
.edit-mode-active .date-header {
    cursor: pointer !important;
}
.edit-mode-active .date-header:hover {
    background-color: #dee2e6 !important;
}
.edit-mode-active .closed-slot {
    cursor: pointer !important;
}
.edit-mode-active .closed-slot:hover {
    background-color: #e9ecef !important;
}
.edit-mode-active .closed-day-cell {
    cursor: pointer !important;
}
.edit-mode-active .closed-day-cell:hover {
    background-color: #f5c6cb !important;
}

#menu-toggle-edit-mode.active {
    background-color: #ffc107;
    color: #212529 !important;
    font-weight: bold;
}

#menu-toggle-show-name.active {
    background-color: #007bff;
    color: #ffffff !important;
    font-weight: bold;
}

/* 非公開・下書き枠のスタイル (編集モード時のみ) */
.edit-mode-active .slot-cell.private-slot {
    background-image: linear-gradient(45deg, rgba(0, 0, 0, 0.05) 25%, transparent 25%, transparent 50%, rgba(0, 0, 0, 0.05) 50%, rgba(0, 0, 0, 0.05) 75%, transparent 75%, transparent) !important;
    background-size: 10px 10px !important;
    border-style: dashed !important;
    opacity: 0.8;
}

/* 非公開の日の月表示カラーバー */
.group-tag.private-draft {
    opacity: 0.65;
    border: 1px dashed rgba(0, 0, 0, 0.4) !important;
}

/* 表示名表示ONの時は他人の予約文字も表示する */
.show-name-active .booking-inner-item.other-booking {
    color: #333333 !important;
}

/* 予約種別セレクト：背景色をJSから確実に制御するため appearance をリセット */
#booking-type-select {
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%236c757d' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 8px center !important;
    background-size: 12px 12px !important;
    padding-right: 28px !important;
    border: 1px solid #cccccc !important;
    border-radius: 4px !important;
    font-weight: normal !important;
    font-size: 0.95rem !important;
    cursor: pointer !important;
    transition: background-color 0.2s ease !important;
}

/* 予約種別静的表示ラベル */
#booking-type-static {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 4px;
    border: 1px solid #cccccc;
    font-weight: normal;
    font-size: 0.95rem;
    transition: background-color 0.2s ease;
}

/* Select2 選択肢ドロップダウンのスタイル崩れ・位置ズレ調整 */
.select2-container {
    width: 100% !important;
    max-width: 250px !important;
}
.select2-container .select2-selection--single {
    height: 36px !important;
    border: 1px solid #cccccc !important;
    border-radius: 4px !important;
    display: flex !important;
    align-items: center !important;
}
.select2-dropdown {
    z-index: 100001 !important; /* モーダル(10000)より上にする */
    border: 1px solid #cccccc !important;
    font-family: Consolas, Monaco, "Courier New", Courier, monospace !important; /* 等幅にして縦列を揃える */
    font-size: 0.9rem !important;
}
.select2-results__option {
    white-space: pre !important; /* タブ・連続スペースの崩れ防止 */
}

/* カスタムテーブル型ドロップダウンのスタイル */
.table-hover-rental td {
    padding: 8px 12px;
    border-bottom: 1px solid #eeeeee;
    text-align: left !important;
    white-space: nowrap !important;
}
.table-hover-rental tr:last-child td {
    border-bottom: none;
}
.table-hover-rental tr:hover {
    background-color: #f5f5f5 !important;
}
.table-hover-rental tr.selected {
    background-color: #e3f2fd !important;
    font-weight: bold;
}



