/**
 * Form Common CSS
 * File: /B-management/CONFIG/css_v2/form.css
 * Version: 2.11.0
 * Updated: 2025-10-26
 */

/* Reset CSS */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 基本スタイル */
body {
    font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Meiryo", "Yu Gothic Medium", "游ゴシック Medium", "Yu Gothic", "游ゴシック", "Noto Sans CJK JP", "Takao Gothic", "IPAexGothic", "IPAPGothic", "VL PGothic", "Noto Sans CJK JP", "MS PGothic", "MS UI Gothic", sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
    font-size: 14px;
}

/* コンテナ */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}


.guest-form-container {
    width: 100%;
}

.guest-form-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e9ecef;
}

.guest-form-title {
    font-size: 28px;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 10px;
}

.guest-form-subtitle {
    font-size: 18px;
    color: #666;
}

/* フォーム本体 */
.guest-form-main {
    width: 100%;
}

/* セクション区切り */
.guest-section-divider {
    border-bottom: 2px solid #e0e0e0;
    margin-bottom: 15px;
    padding-bottom: 8px;
}

/* 横並びレイアウト */
.guest-form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.guest-form-col {
    flex: 1;
}

/* ラベル */
.guest-form-label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #2c3e50;
}

.guest-form-label-small {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #2c3e50;
    font-size: 14px;
}

.guest-required {
    color: #e74c3c;
}

/* 入力フィールド */
input:not([type="image" i], [type="range" i], [type="checkbox" i], [type="radio" i]) {
    width: 100%;
    padding:  12px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    transition: border-color 0.3s;
    box-sizing: border-box;
    background-color: white;
    font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Meiryo", "Yu Gothic Medium", "游ゴシック Medium", "Yu Gothic", "游ゴシック", "Noto Sans CJK JP", "Takao Gothic", "IPAexGothic", "IPAPGothic", "VL PGothic", "Noto Sans CJK JP", "MS PGothic", "MS UI Gothic", sans-serif;
}

input:not([type="image" i], [type="range" i], [type="checkbox" i], [type="radio" i]):focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.3);
    background-color: white;
}

/* Safari対応: 日付と時間入力の背景色を強制的に白に */
input[type="date"],
input[type="time"],
input[type="datetime-local"] {
    background-color: white !important;
    padding: 12px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    background-color: transparent;
}


/* select要素のスタイル */
select {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    background-color: white;
    transition: border-color 0.3s;
    box-sizing: border-box;
    font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Meiryo", "Yu Gothic Medium", "游ゴシック Medium", "Yu Gothic", "游ゴシック", "Noto Sans CJK JP", "Takao Gothic", "IPAexGothic", "IPAPGothic", "VL PGothic", "Noto Sans CJK JP", "MS PGothic", "MS UI Gothic", sans-serif;
}

select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.3);
}

/* textarea要素のスタイル */
textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    transition: border-color 0.3s;
    box-sizing: border-box;
    font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Meiryo", "Yu Gothic Medium", "游ゴシック Medium", "Yu Gothic", "游ゴシック", "Noto Sans CJK JP", "Takao Gothic", "IPAexGothic", "IPAPGothic", "VL PGothic", "Noto Sans CJK JP", "MS PGothic", "MS UI Gothic", sans-serif;
    resize: vertical;
    min-height: 100px;
}

textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.3);
}

.guest-form-input {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

.guest-form-input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.3);
}

.guest-form-input-small {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

.guest-form-input-small:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.3);
}

.guest-form-select {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    background-color: white;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

.guest-form-select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.3);
}

/* 住所セクション */
.guest-address-section {
    margin-bottom: 20px;
}

.guest-address-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

/* ボタンスタイルは下部で定義 */

/* 送信ボタン */
button[type="submit"] {
    background-color:var(--unit-color);
    color: white;
    padding: 15px 30px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    /* width: 100%; */
    transition: background-color 0.3s;
}

button[type="submit"]:hover {
    background-color: #218838;
}

.guest-btn {
    display: inline-block;
    background-color: #f8f9fa;
    color: #333;
    padding: 8px 16px;
    border: 1px solid #ddd;
    text-decoration: none;
    border-radius: 3px;
    transition: all 0.3s ease;
}

.guest-btn:hover {
    background-color: #e9ecef;
    border-color: #adb5bd;
}

/* ログイン状態表示 */
.guest-login-status {
    margin-top: 15px;
    padding: 10px;
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 5px;
}

.guest-login-status-text {
    margin: 0;
    color: #155724;
    font-weight: bold;
}

.guest-login-status-subtext {
    margin: 5px 0 0 0;
    font-size: 14px;
    color: #155724;
}

/* デバッグ情報 */
.guest-debug-info {
    margin-top: 10px;
    padding: 10px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 3px;
    font-size: 12px;
}

/* メッセージ表示 */
.message-success {
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message-error {
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.message-warning {
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* 申し込み情報セクション - 最高優先度で適用 */
body .unit_main .guest-form-container .info-section {
    background-color: #e8f4fd !important;
    border: 1px solid #bee5eb !important;
    border-radius: 5px !important;
    padding: 15px !important;
    margin-bottom: 20px !important;
    display: block !important;
    box-sizing: border-box !important;
    width: 100% !important;
    position: relative !important;
}

body .unit_main .guest-form-container .info-section h3 {
    margin-top: 0 !important;
    margin-bottom: 10px !important;
    font-size: 16px !important;
    font-weight: bold !important;
    color: #2c3e50 !important;
    line-height: 1.4 !important;
}

body .unit_main .guest-form-container .info-section p {
    margin: 0 0 10px 0 !important;
    font-size: 14px !important;
    color: #333 !important;
    line-height: 1.5 !important;
}

body .unit_main .guest-form-container .info-section p:last-child {
    margin-bottom: 0 !important;
}

.required-asterisk {
    color: #e74c3c;
}

/* ログイン状態表示 */
.login-status {
    margin-top: 15px;
    padding: 10px;
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 5px;
}

.login-status-text {
    margin: 0;
    color: #155724;
    font-weight: bold;
}

.login-status-subtext {
    margin: 5px 0 0 0;
    font-size: 14px;
    color: #155724;
}

.login-info {
    margin-top: 15px;
    text-align: center;
}

.login-info p {
    margin-top: 8px;
    font-size: 14px;
    color: #666;
}

.user-id-info {
    font-size: 12px;
    color: #666;
    font-weight: normal;
}

/* フォームセクション */
.form-section {
    margin-bottom: 20px;
}

.form-section label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #2c3e50;
}

.form-section input[type="text"],
.form-section input[type="email"],
.form-section input[type="tel"],
.form-section input[type="url"],
.form-section input[type="file"],
.form-section textarea,
.form-section select {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    box-sizing: border-box;
}

.form-section textarea {
    font-family: inherit;
    resize: vertical;
}

.form-section small {
    color: #666;
    font-size: 14px;
}

/* 警告メッセージ */
.warning-message {
    margin: 6px 0 10px;
    color: #856404;
    background: #fff3cd;
    border: 1px solid #ffeeba;
    padding: 8px 10px;
    border-radius: 4px;
    font-size: 13px;
}

/* 検索機能 */
.search-container {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 5px;
}

.search-input {
    flex: 1;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    box-sizing: border-box;
}

.search-button {
    padding: 12px 16px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
}

.search-results {
    display: none;
    border: 2px solid #ddd;
    border-top: none;
    max-height: 200px;
    overflow-y: auto;
    background: white;
    position: relative;
    z-index: 1001;
}

.search-result-item {
    padding: 12px;
    border-bottom: 1px solid #f1f1f1;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

.search-result-item:hover {
    background-color: #f8f9fa;
}

.search-result-item.search-result-selected {
    background-color: #e3f2fd;
    border-left: 3px solid #2196F3;
}

.search-result-name {
    font-weight: bold;
}

.search-result-info {
    color: #666;
    font-size: 12px;
}

.search-no-results {
    padding: 12px;
    color: #666;
    text-align: center;
}

.search-error {
    padding: 12px;
    color: #e74c3c;
    text-align: center;
}

/* フッター（廃止予定 - 新しい .form-footer を使用） */
.form-footer-old {
    margin-top: 30px;
    text-align: center;
    color: #666;
    font-size: 14px;
    padding: 20px;
    border-top: 1px solid #e9ecef;
}

.form-footer-old a {
    color: #007bff;
    text-decoration: none;
}

.form-footer-old a:hover {
    color: #0056b3;
    text-decoration: underline;
}

/* その他の要素 */
textarea {
    font-family: inherit;
    resize: vertical;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .guest-form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .guest-address-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    

    .container {
        padding: 10px;
    }
    
    .guest-form-container {
        padding: 10px;
    }
    
    .guest-form-main {
        padding: 20px;
    }

    input:not([type="image" i], [type="range" i], [type="checkbox" i], [type="radio" i]) {
        width: 100%;
        padding-bottom: 12px;
        border: 2px solid #ddd;
        border-radius: 5px;
        font-size: 16px;
        transition: border-color 0.3s;
        box-sizing: border-box;
        font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Meiryo", "Yu Gothic Medium", "游ゴシック Medium", "Yu Gothic", "游ゴシック", "Noto Sans CJK JP", "Takao Gothic", "IPAexGothic", "IPAPGothic", "VL PGothic", "Noto Sans CJK JP", "MS PGothic", "MS UI Gothic", sans-serif;
        padding-top: 12px;
    }
    
}

/* ログインボタンのスタイル */
.login-info {
    text-align: center;
    padding: 15px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    margin: 15px 0;
}

/* ログインボタンのスタイルは下部で定義 */

.login-info p {
    margin: 0;
    color: #666;
    font-size: 14px;
    line-height: 1.5;
}


/* ユーザー名不一致の警告スタイル */
.user-mismatch-warning {
    margin: 8px 0 0 0;
    padding: 12px;
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 4px;
    font-size: 13px;
    color: #856404;
    line-height: 1.4;
}

.user-mismatch-warning p {
    margin: 0 0 10px 0;
    font-size: 13px;
    color: #856404;
}

.logout-button {
    display: inline-block;
    padding: 8px 16px;
    background-color: #dc3545;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: bold;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s;
}

.logout-button:hover {
    background-color: #c82333;
    color: white;
    text-decoration: none;
}

/* ボタン基本スタイル */
.btn {
    display: inline-block;
    padding: 7px 10px;
    background-color: var(--unit-color);
    color: white;
    text-decoration: none;
    border-radius: 5px;
    font-weight: bold;
    transition: background-color 0.3s;
    border: none;
    cursor: pointer;
    font-size: 16px;
}

.btn:hover {
    background-color: #2980b9;
    color: white;
    text-decoration: none;
}

/* ログインボタン専用スタイル */
.login-info .btn {
    background-color: #3498db;
    padding: 12px 24px;
    border-radius: 5px;
    box-shadow: none;
    position: static;
    overflow: visible;
}

.login-info .btn:before {
    display: none;
}

.login-info .btn:hover {
    background-color: #2980b9;
    transform: none;
    box-shadow: none;
}

.login-info .btn:active {
    transform: none;
}

/* ========================================
   基本ボタンスタイル
   ======================================== */


.btn:hover {
    background-color: #555;
}

.btn_center {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
}

.btn_left {
    display: block;
    margin: 0;
    margin-top: 1rem;
}

.btn_short {
    display: inline-block;
    justify-content: center;
}

/* ========================================
   フォームコンテナ（ヘッダー・ボディー・フッター構造）
   ======================================== */
.form-container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.form-container-middle {
    max-width: 900px;
}

.form-container-small {
    max-width: 600px;
}

/* フォームヘッダー */
.form-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 20px 30px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 2px solid var(--unit-color);
}

.form-header h3 {
    margin: 0;
    color: var(--unit-color);
    font-size: 1.3em;
    font-weight: 600;
    flex: 0 0 auto;
}

.form-header .btn-back {
    flex: 0 0 auto;
    margin-left: auto;
}

/* 一覧に戻るボタン */
.btn-back {
    background-color: #6c757d;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 0 !important;  /* button.cssの margin: 0 auto を上書き */
}

.btn-back:hover {
    background-color: #5a6268;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.btn-back::before {
    content: '←';
    font-size: 16px;
}

/* フォームボディー */
.form-body {
    padding: 30px;
}

/* フォームフッター（ボタンエリア） */
.form-footer {
    padding: 20px 30px;
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
}

/* 編集フォームアクション */
.edit-form-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

/* ボタン行 */
.button-row {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.button-row .btn {
    flex: 1 1 0;
}

.button-row .btn-delete {
    max-width: 150px;
}

.form-footer .btn {
    margin-left: 0;
}

/* 保存ボタン */
.button-row .btn-save {
    background-color: var(--unit-color);
    color: white;
}

.button-row .btn-save:hover {
    background-color: rgb(81, 123, 169);
}

/* キャンセルボタン */
.button-row .btn-cancel {
    background-color: #6c757d;
    color: white;
}

.button-row .btn-cancel:hover {
    background-color: #545b62;
}

/* 削除ボタン */
.btn-delete {
    background-color: #dc3545;
    color: white;
}

.btn-delete:hover {
    background-color: #c82333;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .form-header {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    
    .form-header h3 {
        margin-right: 0;
    }
    
    /* モバイルでは一覧に戻るボタンを非表示 */
    .form-header .btn-back,
    a.btn-back,
    .btn.btn-back {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        width: 0 !important;
        height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .form-header .btn {
        width: 100%;
        text-align: center;
    }
    
    .form-body {
        padding: 20px 15px;
    }
    
    .form-footer {
        padding: 15px;
    }
    
    .form-footer {
        flex-direction: column;
    }
    
    .form-footer .btn {
        width: 100%;
        margin-bottom: 10px;
    }
}

/* OCRセクション */
.ocr-section {
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
}

.loading {
    display: none;
    text-align: center;
    padding: 1.5rem 1rem;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    margin-top: 1rem;
}

.spinner {
    width: 20px;
    height: 20px;
    margin: 0 auto;
    position: relative;
}

.spinner::before {
    content: '';
    display: block;
    width: 100%;
    height: 100%;
    border: 2px solid #e3e3e3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.result {
    display: none;
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
}

.error {
    display: none;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
    color: #721c24;
}

/* マークリスト */
.marks-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #ddd;
    padding: 10px;
    border-radius: 8px;
    background-color: #f8f9fa;
}

.mark-item {
    display: block;
    margin-bottom: 8px;
    cursor: pointer;
}

.mark-item input[type="checkbox"] {
    margin-right: 8px;
    cursor: pointer;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.guest-limit-section {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 15px;
    margin-top: 20px;
}

.current-image {
    text-align: center;
    margin-bottom: 10px;
}

.current-image img {
    display: block;
    margin: 0 auto;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* イベントフォームアクションボタンは modal.css に移行 */

@media screen and (max-width: 768px) {
    .form-container .form-grid {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }
}

/* ========================================
   明細入力フォーム用スタイル（見積・請求書・領収書など）
   ======================================== */

/* ページヘッダー */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
}

/* 明細入力フォーム（見積・請求書・領収書共通） */
.estimate-form,
.invoice-form,
.receipt-form,
.document-form {
    width: 100%;
}

/* 明細入力用フォームセクション */
.estimate-form .form-section,
.invoice-form .form-section,
.receipt-form .form-section,
.document-form .form-section {
    margin-bottom: 20px;
    padding: 0;
    border: none;
    background: transparent;
}

.estimate-form .form-section h3,
.invoice-form .form-section h3,
.receipt-form .form-section h3,
.document-form .form-section h3 {
    margin: 0 0 15px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid #e9ecef;
    color: var(--unit-color);
    font-size: 1.05em;
    font-weight: 600;
}

/* 一般的なフォームセクション（設定ページなど） */
.form-section {
    margin-bottom: 25px;
    padding: 0;
    border: none;
    background: transparent;
}

.form-section h3 {
    margin: 0 0 15px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid #e9ecef;
    color: var(--unit-color);
    font-size: 1.1em;
    font-weight: 600;
}

/* フォーム行 */
.form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 12px;
}

.form-row label {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-weight: 500;
    color: #333;
    font-size: 13px;
}

.form-row input,
.form-row select,
.form-row textarea {
    padding: 8px 10px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
    outline: none;
    border-color: var(--unit-color);
}

/* ========================================
   明細入力エリア
   ======================================== */

/* 明細行コンテナ（見積・請求書用） */
#details-container {
    background: transparent;
    padding: 0;
    margin-bottom: 10px;
}

/* 明細行（見積・請求書用） */
#details-container .detail-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    transition: all 0.3s ease;
}

#details-container .detail-row:hover {
    background: var(--unit-color-bg);
}

#details-container .detail-row.dragging {
    opacity: 0.5;
}

/* 明細追加ボタンエリア（見積・請求書用） */
#details-container ~ .details-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    padding: 0;
    border: none;
}

/* 明細行ドラッグハンドル */
.drag-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    cursor: grab;
    color: #666;
    user-select: none;
}

.drag-handle:active {
    cursor: grabbing;
}

.drag-icon {
    font-size: 16px;
    line-height: 1;
}

/* 明細入力項目 */
.detail-item {
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
}

.detail-item label {
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 3px;
    color: #666;
}

.detail-item input,
.detail-item select {
    padding: 6px 8px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 13px;
    transition: border-color 0.2s ease;
}

.detail-item input:focus,
.detail-item select:focus {
    outline: none;
    border-color: var(--unit-color);
}

/* 明細入力項目の幅調整 */
.detail-item-name {
    flex: 3;
    min-width: 200px;
}

.detail-item-price {
    flex: 1.5;
    min-width: 100px;
    position: relative;
}

.detail-item-price input,
.detail-item-quantity input {
    text-align: right;
}

/* 金額入力用スタイル */
.price-input-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}

.yen-suffix {
    color: #666;
    font-size: 12px;
    white-space: nowrap;
}

/* 明細の単位・数量・税区分・合計 */
.detail-item-unit {
    flex: 0.6;
    min-width: 50px;
}

.detail-item-quantity {
    flex: 0.4;
    min-width: 40px;
}

input.quantity {
    width: 45px;
}

.detail-item-tax {
    flex: 1;
    min-width: 90px;
}

.detail-item-tax select {
    font-size: 13px;
}

.detail-item-total {
    flex: 1.2;
    min-width: 80px;
    padding-top: 18px;
}

/* 明細削除ボタン */
.detail-item-delete {
    flex: 0 0 auto;
    min-width: 50px;
    display: flex;
    align-items: center;
    padding-top: 18px;
}

.detail-item-delete button {
    padding: 6px 10px;
    background-color: #f8d7da;
    color: #dc3545;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: normal;
    transition: all 0.3s ease;
}

.detail-item-delete button:hover {
    background-color: #f1aeb5;
    color: #b02a37;
    transform: scale(1.05);
}

.detail-item-delete button i {
    pointer-events: none;
}

/* 明細小計表示 */
.subtotal-amount {
    font-weight: bold;
    color: #333;
    font-size: 16px;
}

/* ========================================
   明細合計エリア
   ======================================== */

/* 合計セクション（見積・請求書用） */
#details-container ~ .total-section {
    margin-top: 30px;
    padding: 25px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 8px;
    border: 2px solid var(--unit-color);
    box-shadow: 0 2px 8px rgba(244, 165, 131, 0.15);
}

#details-container ~ .total-section .total-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    font-size: 16px;
}

#details-container ~ .total-section .total-final,
#details-container ~ .total-section .total-row.total-final {
    border-top: 3px solid var(--unit-color);
    margin-top: 15px;
    padding-top: 20px;
    font-size: 22px;
    font-weight: 700;
    color: var(--unit-color);
}

/* ========================================
   明細入力用選択コンポーネント
   ======================================== */

/* ネットワーク・商品選択コンテナ */
.network-select-container,
.product-select-container {
    display: flex;
    gap: 10px;
    align-items: center;
}

.network-select-container input,
.product-select-container input {
    flex: 1;
}

/* 明細行内の商品選択コンテナ */
.details-container .product-select-container {
    display: flex;
    gap: 5px;
    align-items: center;
    width: 100%;
}

.details-container .product-select-container input.item-display {
    flex: 1;
    width: 100%;
}

.details-container .product-select-container .btn-select-small {
    flex-shrink: 0;
    width: 50px;
    padding: 8px 8px;
    font-size: 12px;
}

/* 選択ボタン */
.btn-select,
.btn-select-small {
    background: var(--unit-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    padding: 6px 12px;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.btn-select-small {
    padding: 4px 8px;
    font-size: 11px;
}

.btn-select:hover,
.btn-select-small:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* 明細入力用：ネットワーク・商品選択リスト */
.network-item,
.product-item {
    padding: 12px;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    margin-bottom: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.network-item:hover,
.product-item:hover {
    background: #f8fbff;
    border-color: var(--unit-color);
    transform: translateX(3px);
}

/* 選択状態のスタイルは下部（2001行目以降）に統合 */

.network-company,
.product-name {
    font-weight: 600;
    margin-bottom: 4px;
    color: #333;
    font-size: 14px;
}

.network-info,
.product-info {
    color: #666;
    font-size: 12px;
}

/* 選択状態の文字色は下部（2008行目以降）に統合 */

.network-info small,
.product-info small {
    display: block;
    margin-bottom: 2px;
    font-size: 12px;
}

/* ========================================
   明細入力用レイアウト・ボタン
   ======================================== */

/* ページレイアウト */
.unit-main {
    width: 100%;
    margin: 0;
    padding: 0;
}

.main-content {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

/* 明細追加ボタン（見積・請求書用） */
#details-container ~ .details-actions .btn-add {
    background: var(--unit-color);
    color: white;
    border: none;
    padding: 12px 40px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

#details-container ~ .details-actions .btn-add:hover {
    background: var(--unit-color-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

#details-container ~ .details-actions .btn-add:active {
    background: var(--unit-color-dark);
    transform: translateY(0);
}

/* ネットワーク追加ボタン */
.btn-add-network {
    background: var(--unit-color);
    color: white;
    width: 100%;
    padding: 10px;
    font-size: 14px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-add-network:hover {
    opacity: 0.9;
}

/* 商品一覧サイドバー */
.product-list-sidebar {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
}

.product-item-sidebar {
    padding: 10px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background-color 0.2s;
}

.product-item-sidebar:hover {
    background-color: #f0f0f0;
}

.product-item-sidebar.selected {
    background-color: #4caf50;
    color: white;
}

.product-item-sidebar:last-child {
    border-bottom: none;
}

.product-name-sidebar {
    font-weight: bold;
    margin-bottom: 4px;
    color: #333;
    font-size: 14px;
}

.product-item-sidebar.selected .product-name-sidebar {
    color: white;
}

.product-info-sidebar {
    color: #666;
    font-size: 12px;
}

.product-item-sidebar.selected .product-info-sidebar {
    color: #e8f5e8;
}

.product-info-sidebar small {
    display: block;
    margin-bottom: 2px;
    font-size: 12px;
}

/* ========================================
   明細入力用レスポンシブ対応
   ======================================== */
@media (max-width: 768px) {
    .main-content {
        padding: 0 10px;
    }
    
    /* 選択コンテナをモバイルで縦並び */
    .network-select-container,
    .product-select-container {
        flex-direction: column;
        gap: 8px;
    }
    
    /* 選択ボタンをモバイルで全幅 */
    .btn-select,
    .btn-select-small {
        width: 100%;
    }
}

/* ========================================
   明細フォーム用CSS（追加コンポーネント - 明細専用）
   ======================================== */
.details-section {
    background: white;
    border-radius: 8px;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    margin: 20px 0;
    width: 100%;
}

.details-container {
    background: #fff;
    border: 1px solid var(--unit-color);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(244, 165, 131, 0.1);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.details-container .details-header {
    display: flex;
    gap: 10px;
    padding: 15px;
    background: var(--unit-color);
    color: white;
    font-weight: 600;
    font-size: 14px;
}

.details-container .detail-col-header {
    text-align: center;
}

/* 単価・数量・小計のヘッダーは右寄せ */
.details-container .details-header .detail-col-header:nth-child(2),
.details-container .details-header .detail-col-header:nth-child(3),
.details-container .details-header .detail-col-header:nth-child(6) {
    text-align: right;
}

.details-container #details-list {
    max-height: 600px;
    overflow-y: auto;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.details-container #details-list .detail-row {
    display: flex;
    gap: 0px;
    padding: 8px 0;
    align-items: center;
    transition: all 0.3s ease;
    cursor: move;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.details-container #details-list .detail-row:hover {
    background: var(--unit-color-bg);
}

.details-container #details-list .detail-row.dragging {
    opacity: 0.5;
    background: #e3f2fd;
}

/* ドラッグハンドル */
.details-container .drag-handle {
    cursor: grab;
    color: #999;
    font-size: 16px;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.details-container .drag-handle:active {
    cursor: grabbing;
}

/* フリー行のスタイル */
.details-container #details-list .detail-row.row-free {
    background: #fffbf0;
    flex-wrap: nowrap;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.details-container #details-list .detail-row.row-free:hover {
    background: #fff4e0;
}

.details-container #details-list .detail-row.row-free input[disabled],
.details-container #details-list .detail-row.row-free select[disabled] {
    background: #f0f0f0;
    color: #999;
    cursor: not-allowed;
}

/* フリー行の商品名フィールドを全幅に */
.details-container #details-list .detail-row.row-free .detail-col:nth-child(3) {
    flex: 5.8 1 auto !important;
    width: auto !important;
    max-width: 97% !important;
    min-width: 0 !important;
    overflow: hidden;
}

/* フリー行のコメント入力フィールドの幅制限 */
.details-container #details-list .detail-row.row-free .detail-col:nth-child(3) input[name="detail_item_display[]"] {
    max-width: 96% !important;
    width: 100% !important;
}

.details-container #details-list .detail-row.row-free .detail-col:nth-child(3) input {
    width: 100% !important;
    max-width: 100% !important;
    min-width: auto !important;
    box-sizing: border-box !important;
    font-size: 16px;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: #fff;
    flex: none !important;
}

.details-container #details-list .detail-row.row-free .detail-col:nth-child(3) .product-select-container {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* フリー行で非表示にするカラム（削除ボタン以外） */
.details-container #details-list .detail-row.row-free .detail-col:nth-child(4),
.details-container #details-list .detail-row.row-free .detail-col:nth-child(5),
.details-container #details-list .detail-row.row-free .detail-col:nth-child(6),
.details-container #details-list .detail-row.row-free .detail-col:nth-child(7),
.details-container #details-list .detail-row.row-free .detail-col:nth-child(8) {
    display: none !important;
}

/* フリー行の削除ボタンを表示 */
.details-container #details-list .detail-row.row-free .detail-col:last-child {
    display: flex !important;
}

.details-container .detail-col {
    display: flex;
    align-items: center;
}

/* PC版：ラジオボタングループを非表示 */
.details-container .row-type-radio-group {
    display: none;
}

/* 商品名カラムは100%幅を確保 */
.details-container #details-list .detail-row .detail-col:first-child {
    width: 100%;
}

/* 小計カラムを右寄せ */
.details-container #details-list .detail-row .detail-col {
    justify-content: flex-start;
}

.details-container #details-list .detail-row .detail-col:has(.subtotal-display),
.details-container #details-list .detail-row .detail-col:has(.subtotal-amount) {
    justify-content: flex-end;
}

.details-container .form-control-sm {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.3s ease;
    margin-left: 10px;
}

.details-container .form-control-sm:focus {
    outline: none;
    border-color: var(--unit-color);
    box-shadow: 0 0 0 3px rgba(244, 165, 131, 0.2);
}

.details-container .unit-price,
.details-container .quantity {
    text-align: right;
}

.details-container .subtotal-display,
.details-container .subtotal-amount {
    display: block;
    text-align: right;
    width: 100%;
}

/* 商品名フィールド */
.details-container .item-display {
    background: white !important;
    padding: 8px 10px !important;
    border: 1px solid #ced4da !important;
    border-radius: 6px !important;
    font-size: 14px !important;
}

/* 単位フィールド */
.details-container .unit {
    background: white !important;
    padding: 8px 10px !important;
    border: 1px solid #ced4da !important;
    border-radius: 6px !important;
    font-size: 14px !important;
}

.details-container .btn-remove {
    border: none;
    border-radius: 4px;
    width: 32px;
    height: 32px;
    font-size: 14px;
    font-weight: normal;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.details-container .btn-remove i {
    pointer-events: none;
}

.details-container .btn-remove:hover {
    transform: scale(1.05);
}

.details-section .details-actions {
    margin-top: 20px;
    text-align: center;
}

.details-section .details-actions .btn-add {
    background: var(--unit-color);
    color: white;
    border: none;
    padding: 12px 40px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.details-section .details-actions .btn-add:hover {
    background: var(--unit-color-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

.details-section .details-actions .btn-add:active {
    background: var(--unit-color-dark);
    transform: translateY(0);
}

.details-section .total-section {
    margin-top: 30px;
    padding: 30px;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 50%, #ffffff 100%);
    border-radius: 12px;
    border: 3px solid var(--unit-color);
    box-shadow: 0 4px 16px rgba(244, 165, 131, 0.2), 
                0 2px 8px rgba(0, 0, 0, 0.1);
    position: relative;
}

.details-section .total-section::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    background: linear-gradient(135deg, var(--unit-color) 0%, var(--unit-color-dark) 100%);
    border-radius: 12px;
    z-index: -1;
    opacity: 0.1;
}

.details-section .total-section .total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    font-size: 18px;
    border-bottom: 1px dashed #e0e0e0;
}

.details-section .total-section .total-row:last-child {
    border-bottom: none;
}

.details-section .total-section .total-row.total-final {
    border-top: 3px double var(--unit-color);
    border-bottom: none;
    margin-top: 20px;
    padding-top: 25px;
    font-size: 26px;
    font-weight: 700;
    color: var(--unit-color);
    background: linear-gradient(135deg, rgba(244, 165, 131, 0.05) 0%, rgba(244, 165, 131, 0.1) 100%);
    padding: 20px;
    margin-left: -10px;
    margin-right: -10px;
    border-radius: 8px;
}

.details-section .total-label {
    font-weight: 600;
    color: #555;
    display: flex;
    align-items: center;
    gap: 8px;
}

.details-section .total-label::before {
    content: '■';
    color: var(--unit-color);
    font-size: 12px;
}

.details-section .total-row.total-final .total-label::before {
    content: '▶';
    font-size: 16px;
}

.details-section .total-value {
    font-family: 'Courier New', monospace, 'Hiragino Kaku Gothic ProN', 'Meiryo', sans-serif;
    font-weight: 700;
    color: #333;
    font-size: 20px;
    letter-spacing: 0.5px;
}

.details-section .total-row.total-final .total-value {
    color: var(--unit-color);
    font-size: 30px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.05);
}

/* CSS Class Styles for Items - シンプルな背景色のみ */
.details-container #details-list .detail-row.item-highlight {
    background: #fff8e8 !important;
}

.details-container #details-list .detail-row.item-discount {
    background: #f0f8f0 !important;
}

.details-container #details-list .detail-row.item-special {
    background: #f8f0f8 !important;
}

.details-container #details-list .detail-row.item-note {
    background: #f0f6fc !important;
}

/* 明細フォーム用レスポンシブ対応 */
@media (max-width: 1200px) {
    .details-container .details-header {
        font-size: 13px;
    }
    
    .details-container .form-control-sm {
        padding: 6px 8px;
        font-size: 13px;
    }
}

@media (max-width: 768px) {
    input.form-control-sm.item-display {
        font-weight: bold;
    }
    
    /* 第1カラム（上下移動ボタン）と第2カラム（行種別）を横並びに */
    .details-container #details-list .detail-row > .detail-col:first-child,
    .details-container #details-list .detail-row > .detail-col:nth-child(2) {
        display: inline-block !important;
        vertical-align: top;
        margin-bottom: 10px;
    }
    
    .details-container #details-list .detail-row > .detail-col:first-child {
        width: 50px !important;
        margin-right: 10px;
    }
    
    .details-container #details-list .detail-row > .detail-col:nth-child(2) {
        width: calc(100% - 65px) !important;
    }
    
    .details-section {
        margin: 10px 0 !important;
        padding: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    
    .details-container {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important;
    }
    
    .details-container .details-header {
        display: none;
    }
    
    .details-container #details-list {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        max-height: none !important;  /* 高さ制限を解除 */
        overflow-y: visible !important;  /* 内部スクロールを無効化 */
    }
    
    .details-container #details-list .detail-row {
        display: block !important;  /* flexを完全に無効化 */
        padding: 12px;
        margin-bottom: 12px;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        border: 1px solid #e0e0e0;
        border-radius: 8px;
        background: #fafafa;
    }
    
    .details-container .detail-col {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        display: block !important;  /* flexをblockに変更 */
        margin-bottom: 10px;
    }
    
    .details-container .detail-col:last-child {
        margin-bottom: 0;
    }
    
    /* モバイルでラベルを表示 */
    .details-container .detail-col::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 14px;
        color: #666;
        display: block;
        margin-bottom: 5px;
    }
    
    /* ドラッグハンドルと削除ボタンはラベルなし */
    .details-container .detail-col:first-child::before,
    .details-container .detail-col:last-child::before {
        content: none;
    }
    
    /* ドラッグハンドルを中央配置 */
    .details-container .detail-col:first-child {
        text-align: center !important;
    }
    
    /* 削除ボタンを中央配置 */
    .details-container .detail-col:last-child {
        text-align: center !important;
    }
    
    .details-container .btn-remove {
        margin: 0 auto !important;
        display: block !important;
    }
    
    /* 商品選択コンテナもブロック表示に */
    .details-container .product-select-container {
        display: block !important;
        width: 100% !important;
    }
    
    .details-container .product-select-container input,
    .details-container .product-select-container .btn-select-small {
        display: block !important;
        width: 100% !important;
        margin-bottom: 5px;
    }
    
    .details-container .product-select-container .btn-select-small {
        width: 100% !important;
        padding: 12px !important;
    }
    
    .details-container .form-control-sm {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        margin-left: 0 !important;
        font-size: 16px !important;  /* モバイルで読みやすく */
        padding: 12px !important;
    }
    
    .details-container .detail-col select {
        font-size: 16px !important;
        padding: 12px !important;
    }
    
    /* モバイル版：行種別のセレクトボックスを非表示 */
    .details-container .detail-col select.row-type {
        display: none !important;
    }
    
    /* モバイル版：ラジオボタングループを表示 */
    .details-container .row-type-radio-group {
        display: flex !important;
        gap: 15px;
        justify-content: center;
        padding: 10px;
        border-radius: 8px;
    }
    
    .details-container .row-type-radio-group label {
        display: flex !important;
        align-items: center;
        gap: 8px;
        font-size: 16px !important;
        cursor: pointer;
        padding: 8px 16px;
        border-radius: 6px;
        transition: background 0.2s;
    }
    
    .details-container .row-type-radio-group label:hover {
        background: #f0f0f0;
    }
    
    .details-container .row-type-radio-group input[type="radio"] {
        width: 20px !important;
        height: 20px !important;
        margin: 0 !important;
        cursor: pointer;
    }
    
    .details-container .detail-col label {
        font-size: 14px !important;
        font-weight: 600;
        margin-bottom: 5px;
        display: block;
    }
    
    .details-container .subtotal-amount {
        font-size: 16px !important;
    }
    
    .details-section .total-section {
        padding: 15px !important;
        margin-top: 20px !important;
    }
    
    .details-section .total-section .total-row {
        font-size: 18px !important;
    }
    
    .details-section .total-section .total-row.total-final {
        font-size: 24px !important;
    }
    
    .details-container .drag-handle {
        font-size: 20px !important;
    }
    
    .details-container .btn-remove {
        width: 44px !important;
        height: 44px !important;
        font-size: 18px !important;
    }
    
    .details-section .details-actions .btn-add {
        font-size: 18px !important;
        padding: 14px 50px !important;
    }
}

/* ========================================
   モーダル検索スタイル
   ======================================== */
.modal-search {
    margin-bottom: 20px;
}

.modal-search input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.modal-search input:focus {
    outline: none;
    border-color: var(--unit-color, #F4A583);
    box-shadow: 0 0 0 3px rgba(244, 165, 131, 0.1);
}

/* モーダルリストアイテム */
.network-item,
.product-item {
    cursor: pointer;
    padding: 12px;
    border-bottom: 1px solid #eee;
    transition: background-color 0.2s ease;
    user-select: none;
}

/* 商品アイテムを横並びに */
.product-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.product-item .product-name {
    flex: 1;
    font-weight: 600;
}

.product-item .product-info {
    flex-shrink: 0;
    text-align: right;
}

.product-item .product-info small {
    display: inline;
    margin-left: 10px;
}

.product-item .product-price {
    font-size: 14px;
    font-weight: 600;
    color: #666;
}

.network-item:hover,
.product-item:hover {
    background-color: #f8f9fa;
}

.network-item:active,
.product-item:active {
    background-color: #e9ecef;
}

.network-item.selected,
.product-item.selected {
    background-color: rgba(244, 165, 131, 0.2);
    border-left: 4px solid var(--unit-color, #F4A583);
    color: #000;
}

.network-item.selected .network-company,
.network-item.selected .network-info {
    color: #000;
    font-weight: 700;
}

.product-item.selected .product-name {
    color: #000;
    font-weight: 700;
}

.product-item.selected .product-price {
    color: var(--unit-color);
    font-weight: 700;
}

/* ========================================
   商品名オートコンプリート（サジェスト）
   ======================================== */
.product-suggestions {
    position: fixed;
    background: white;
    border: 2px solid var(--unit-color);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    max-height: 250px;
    overflow-y: auto;
    z-index: 10001;  /* モーダルより上に表示 */
    opacity: 1;  /* 完全不透明 */
}

.suggestion-item {
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
    background: white;  /* 確実に白背景 */
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover,
.suggestion-item.highlighted {
    background: var(--unit-color);
}

.suggestion-item:hover .suggestion-name,
.suggestion-item.highlighted .suggestion-name {
    color: white;
}

.suggestion-item:hover .suggestion-price,
.suggestion-item.highlighted .suggestion-price {
    color: white;
}

.suggestion-name {
    font-weight: 600;
    color: #333;
    transition: color 0.2s ease;
}

.suggestion-price {
    color: var(--unit-color);
    font-weight: 700;
    font-size: 14px;
    transition: color 0.2s ease;
}

/* モバイル版用の上下移動ボタン */
.row-move-buttons {
    display: none;
    flex-direction: column;
    gap: 5px;
}

.row-move-buttons button {
    background: var(--unit-color);
    color: white;
    border: none;
    border-radius: 6px;
    width: 36px;
    height: 36px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.row-move-buttons button:hover {
    background: var(--unit-color-dark);
    transform: scale(1.1);
}

.row-move-buttons button:active {
    transform: scale(0.95);
}

.row-move-buttons button:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.5;
}

/* モバイル版：選択された商品・ネットワークの文字をより濃く */
@media (max-width: 768px) {
    /* ドラッグハンドルを非表示 */
    .details-container .drag-handle {
        display: none !important;
    }
    
    /* 上下移動ボタンを表示 */
    .details-container .row-move-buttons {
        display: flex !important;
    }
    
    .network-item.selected,
    .product-item.selected {
        background-color: rgba(244, 165, 131, 0.25) !important;
        border-left: 5px solid var(--unit-color, #F4A583) !important;
    }
    
    .network-item.selected .network-company,
    .network-item.selected .network-info,
    .product-item.selected .product-name {
        color: #000 !important;
        font-weight: 700 !important;
        font-size: 17px !important;
    }
    
    .product-item.selected .product-price {
        color: var(--unit-color) !important;
        font-weight: 700 !important;
        font-size: 16px !important;
    }
}
.details-container .item-display, 
.details-container .unit {
    background: white !important;
    cursor: pointer;
    padding: 8px 10px !important;
    border: 1px solid #ced4da !important;
    border-radius: 6px !important;
    font-size: 14px !important;
}

/* Discount Row Styles */
.detail-row.row-discount {
    background-color: #fff5f5 !important;
}

.detail-row.row-discount .item-display {
    color: #d32f2f;
    font-weight: 600;
}

.detail-row.row-discount .unit-price,
.detail-row.row-discount .quantity,
.detail-row.row-discount .subtotal-amount {
    color: #d32f2f !important;
    font-weight: 600 !important;
}