/* 見積もり一覧ページのスタイル */

/* メインエリア */
.estimates-list-main-body {
    width: 100%;
    background-color: #fff;
    border-radius: 0 0 10px 10px;
    padding: 5px 10px;
    box-sizing: border-box;
    height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
}

/* アクションエリア */
.action-area {
    background-color: #fff;
    padding-bottom: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.search-form {
    display: flex;
    gap: 10px;
}

.search-form input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    min-width: 250px;
}

.search-form button,
.add-button-container button {
    padding: 8px 16px;
    background-color: #d9d8d8;
    color: #333;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.search-form button:hover,
.add-button-container button:hover {
    background-color: #0AA273;
    color: white;
}

#clear-search {
    background-color: #f0f0f0;
    color: #666;
}

#clear-search:hover {
    background-color: #ff6b6b;
    color: white;
}

.add-button-container button {
    background-color: #0AA273;
    color: white;
}

.add-button-container button:hover {
    background-color: #088c61;
}

/* テーブルコンテナ */
.table-container {
    flex: 1;
    overflow: auto;
    margin-bottom: 0;
    position: relative;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

/* テーブルスタイル */
.estimates-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background-color: white;
    table-layout: fixed;
}

.estimates-table thead {
    position: sticky;
    top: 0;
    z-index: 2;
    background-color: #333333;
}

.estimates-table th,
.estimates-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #ddd;
    word-break: break-word;
}

.estimates-table th {
    background-color: #333333;
    color: white;
    font-weight: bold;
}

.estimates-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

.estimates-table tr:hover {
    background-color: #e9f7fe;
}

.estimates-table tr.clickable-row {
    cursor: pointer;
    transition: background-color 0.2s;
}

/* カラム幅の調整 */
.estimates-table th:nth-child(1),
.estimates-table td:nth-child(1) {
    width: 80px; /* 見積日 */
}

.estimates-table th:nth-child(2),
.estimates-table td:nth-child(2) {
    width: 120px; /* 見積番号 */
}

.estimates-table th:nth-child(3),
.estimates-table td:nth-child(3) {
    width: 150px; /* クライアント名 */
}

.estimates-table th:nth-child(4),
.estimates-table td:nth-child(4) {
    width: 100px; /* 合計金額 */
    text-align: right;
}

.estimates-table th:nth-child(5),
.estimates-table td:nth-child(5) {
    width: 90px; /* ステータス */
    text-align: center;
}

.estimates-table th:nth-child(6),
.estimates-table td:nth-child(6) {
    width: 80px; /* 作成者 */
}

.estimates-table th:nth-child(7),
.estimates-table td:nth-child(7) {
    width: 80px; /* 更新日 */
}

.estimates-table th:nth-child(8),
.estimates-table td:nth-child(8) {
    width: 100px; /* 備考 */
}

.estimates-table th:nth-child(9),
.estimates-table td:nth-child(9) {
    width: 70px; /* 操作 */
    text-align: center;
}

.estimates-table .client-link {
    color: #0275d8;
    text-decoration: none;
    transition: color 0.2s;
}

.estimates-table .client-link:hover {
    color: #0056b3;
    text-decoration: underline;
}

/* ソート可能なヘッダースタイル */
.estimates-table th.sortable {
    cursor: pointer;
    position: relative;
    padding-right: 25px; /* アイコン用のスペース確保 */
}

.estimates-table th.sortable:hover {
    background-color: #222222;
}

.estimates-table th.sortable .sort-icon {
    color: #999;
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
}

/* ステータスバッジ */
.status-badge {
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    display: inline-block;
}

.status-sent {
    background-color: #4CAF50;
    color: white;
}

.status-unsent {
    background-color: #FFC107;
    color: #333;
}

/* 請求書バッジのスタイル */
.status-badge.status-invoice {
    background-color: #333;
    color: white;
    border-radius: 5px;
}

/* ページネーション */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
}

.pagination button {
    padding: 8px 16px;
    background-color: #d9d8d8;
    color: #333;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.pagination button:hover:not([disabled]) {
    background-color: #0AA273;
    color: white;
}

.pagination button[disabled] {
    background-color: #cccccc;
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination span {
    font-weight: bold;
    margin: 0 10px;
}

/* モーダルスタイル */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    overflow-y: auto;
}

.modal-content {
    position: relative;
    background-color: #fefefe;
    margin: 5% auto;
    padding: 20px;
    width: 90%;
    max-width: 1000px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    max-height: 80vh;
    overflow-y: auto;
}

.estimate-modal-content {
    max-width: 900px;
    width: 80%;
    min-width: 800px;
}

.new-estimate-modal-content {
    max-width: 500px;
}

.close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
}

.close:hover {
    color: #333;
}

/* 見積書スタイル */
.estimate-sheet {
    background-color: white;
    padding: 30px;
    border-radius: 6px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    border: 2px solid #0AA273;
}

.estimate-title {
    text-align: center;
    font-size: 28px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #0AA273 !important;
    color: #0AA273 !important;
}

.estimate-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 20px;
}

.client-info, .company-info {
    flex: 1;
    min-width: 300px;
}

.client-info {
    padding-right: 20px;
}

.company-info {
    padding-left: 20px;
    border-left: 1px solid #eee;
    font-size: 0.9em;
}

.company-details {
    margin-top: 25px;
}

.company-details .form-group {
    margin-bottom: 3px;
}

.client-name-wrapper {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 15px;
}

.client-name-wrapper label {
    display: none;
}

.client-name-wrapper input {
    flex: 1;
}

.client-name-wrapper select {
    width: 70px;
    flex-shrink: 0;
}

.estimate-total-summary {
    margin: 5px 0 15px;
}

.summary-box {
    display: inline-block;
    padding: 15px 30px;
    border: 2px solid #0AA273;
    border-radius: 5px;
}

.summary-label {
    font-size: 1.2em;
    font-weight: bold;
    margin-right: 20px;
}

.summary-amount {
    font-size: 1.5em;
    font-weight: bold;
    color: #0AA273;
}

.form-group {
    margin-bottom: 12px;
    width: 100%;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #555;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
}

.form-group textarea {
    resize: vertical;
    min-height: 60px;
}

.hidden-options {
    display: none;
}

/* 見積書項目テーブル */
.estimate-items {
    margin-bottom: 25px;
}

.estimate-items-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 5px;
}

.estimate-items-table th,
.estimate-items-table td {
    padding: 10px;
    border: 1px solid #ddd;
}

.estimate-items-table th {
    background-color: #f5f5f5;
    text-align: center;
}

.estimate-items-table th.estimate-label,
.estimate-items-table th.order-label {
    width: 40% !important;
    min-width: 200px !important;
}

.estimate-items-table th:nth-child(2) {
    width: 10%;
    min-width: 70px;
}

.estimate-items-table th:nth-child(3) {
    width: 10%;
    min-width: 92px;
}

.estimate-items-table th:nth-child(4) {
    width: 10%;
    min-width: 90px;
}

.estimate-items-table th:nth-child(5) {
    width: 14%;
    min-width: 120px;
}

.estimate-items-table th.item-actions-header {
    width: 6%;
    min-width: 60px;
}

.estimate-items-table input,
.estimate-items-table select {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 3px;
    box-sizing: border-box;
}

.estimate-items-table .text-right {
    text-align: right;
}

.estimate-items-table .item-quantity {
    width: 70px;
}

.estimate-items-table .item-price {
    width: 100px;
}

.estimate-items-table .item-total {
    text-align: right;
    font-weight: bold;
}

.estimate-items-table .item-unit {
    font-size: calc(1rem - 0.08rem) !important;
}

.remove-item-btn {
    padding: 3px 8px;
    background-color: #f44336;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85em;
    white-space: nowrap;
}

.remove-item-btn:hover {
    background-color: #d32f2f;
}

#add-item-btn {
    padding: 8px 16px;
    background-color: #0AA273;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 0;
}

#add-item-btn:hover {
    background-color: #088c61;
}

/* 見積書メッセージ */
.estimate-message {
    margin: 20px 0 5px;
    font-size: 1em;
}

/* 見積書サマリー */
.estimate-summary {
    margin: 20px 0;
    border-top: 1px solid #ddd;
    padding-top: 15px;
}

.summary-row {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 8px;
}

.summary-row span:first-child {
    margin-right: 20px;
    min-width: 140px;
    text-align: right;
}

.summary-row span:last-child {
    min-width: 120px;
    text-align: right;
    font-weight: bold;
}

.summary-row.total {
    font-size: 18px;
    border-top: 1px solid #ddd;
    padding-top: 10px;
    margin-top: 10px;
}

.notes-group {
    margin-top: 20px;
}

/* 会社情報 */
.company-info {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #ddd;
}

/* モーダルアクション */
.modal-actions {
    margin-top: 25px;
    display: flex;
    justify-content: space-between;
    width: 100%;
}

.left-buttons {
    display: flex;
    gap: 15px;
}

.right-buttons {
    display: flex;
    gap: 15px;
}

.modal-actions button {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s;
}

#save-estimate-btn,
#send-estimate-btn,
#print-estimate-btn {
    background-color: #0AA273;
    color: white;
}

#save-estimate-btn:hover,
#send-estimate-btn:hover,
#print-estimate-btn:hover {
    background-color: #088c61;
}

/* 古いバージョン表示時のボタン無効化スタイル */
#save-estimate-btn:disabled,
#send-estimate-btn:disabled,
.order-mode #save-estimate-btn:disabled,
.order-mode #send-estimate-btn:disabled {
    background-color: #cccccc !important;
    color: #888888 !important;
    cursor: not-allowed;
    opacity: 0.7;
}

/* プレビューボタンは無効化されない */
#print-estimate-btn:disabled,
.order-mode #print-estimate-btn:disabled {
    background-color: #0AA273;
    color: white;
    cursor: pointer;
    opacity: 1;
}

.order-mode #print-estimate-btn:disabled {
    background-color: #2196F3;
}

/* 既存のプレビューボタン個別スタイルを削除 */
#print-estimate-btn {
    background-color: #0AA273;
    color: white;
}

#print-estimate-btn:hover {
    background-color: #088c61;
}

/* 発注書モードのボタン色 */
.order-mode #save-estimate-btn,
.order-mode #send-estimate-btn,
.order-mode #print-estimate-btn,
.order-mode #add-item-btn {
    background-color: #2196F3;
    color: white;
}

.order-mode #save-estimate-btn:hover,
.order-mode #send-estimate-btn:hover,
.order-mode #print-estimate-btn:hover,
.order-mode #add-item-btn:hover {
    background-color: #0d8bf2;
}

/* モード切り替えボタン */
#toggle-order-btn {
    background-color: #2196F3;
    color: white;
}

#toggle-order-btn:hover {
    background-color: #0d8bf2;
}

/* 見積書モードのトグルボタン */
#toggle-estimate-btn {
    background-color: #0AA273;
    color: white;
}
#toggle-invoice-btn {
    color: #333;
    background-color: #fff;
}

#toggle-estimate-btn:hover {
    background-color: #088c61;
}

/* 発注書モード用スタイル */
.estimate-sheet.order-mode {
    border: 2px solid #2196F3 !important;
}

.estimate-sheet.order-mode .estimate-title {
    border-bottom: 2px solid #2196F3 !important;
    color: #2196F3 !important;
}

/* 発注書モードでの枠線色を変更 */
.order-mode .summary-box {
    border: 2px solid #2196F3 !important;
}

.order-mode .summary-amount {
    color: #2196F3 !important;
}

/* 発注書モードでの履歴セクションの色を変更 */
.order-mode ~ .estimate-history-section {
    border-top: 2px solid #2196F3;
}

/* 発注書モード時のボタン色を変更 */
.modal-actions button.order-mode-btn {
    background-color: #4285f4;
}

.modal-actions button.order-mode-btn:hover {
    background-color: #2b5cd9;
}

/* 見積履歴セクション */
.estimate-history-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #0AA273;
}

.estimate-history-section h3 {
    margin-bottom: 15px;
    color: #333;
}

.estimate-history-table {
    width: 100%;
    border-collapse: collapse;
    background-color: white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.estimate-history-table th,
.estimate-history-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.estimate-history-table th {
    background-color: #333333;
    color: white;
    font-weight: bold;
}

.estimate-history-table td button {
    padding: 5px 10px;
    background-color: #0AA273;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-right: 5px;
}

.estimate-history-table td button:hover {
    background-color: #088c61;
}

.estimate-history-table .delete-version-btn {
    background-color: #f44336;
}

.estimate-history-table .delete-version-btn:hover {
    background-color: #d32f2f;
}

/* 新規見積作成モーダル */
.client-selection {
    margin-top: 20px;
}

#create-new-estimate {
    margin-top: 20px;
    padding: 10px 20px;
    background-color: #0AA273;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}

#create-new-estimate:hover {
    background-color: #088c61;
}

/* レスポンシブ対応 */
@media screen and (max-width: 1000px) {
    .estimates-table th,
    .estimates-table td {
        padding: 8px 10px;
        font-size: 14px;
    }
    
    .action-area {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .search-form {
        margin-bottom: 10px;
        width: 100%;
    }
    
    .search-form input {
        min-width: auto;
        flex: 1;
    }
    
    .add-button-container {
        width: 100%;
    }
    
    .add-button-container button {
        width: 100%;
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
}

@media screen and (max-width: 768px) {
    .estimates-list-main-body {
        padding: 15px 10px;
    }
    
    .estimates-table {
        font-size: 13px;
    }
    
    .estimates-table th,
    .estimates-table td {
        padding: 6px 8px;
    }
    
    /* カラム幅の調整（モバイル） */
    .estimates-table th:nth-child(6),
    .estimates-table td:nth-child(6),
    .estimates-table th:nth-child(7),
    .estimates-table td:nth-child(7),
    .estimates-table th:nth-child(8),
    .estimates-table td:nth-child(8) {
        display: none;
    }
    
    .estimates-table th:nth-child(1),
    .estimates-table td:nth-child(1) {
        width: 60px;
    }
    
    .estimates-table th:nth-child(2),
    .estimates-table td:nth-child(2) {
        width: 90px;
    }
    
    .estimate-header {
        flex-direction: column;
    }
    
    .estimate-info, .client-info {
        width: 100%;
    }
    
    .form-group {
        min-width: auto;
    }
    
    .modal-content {
        width: 95%;
        padding: 15px;
    }
    
    .estimate-sheet {
        padding: 15px;
    }
    
    .modal-actions {
        flex-direction: column;
    }
    
    .modal-actions button {
        width: 100%;
        margin-bottom: 10px;
    }
}

@media screen and (max-width: 480px) {
    .estimates-list-main-body {
        padding: 10px 5px;
        height: 90%;
    }
    
    /* アクションエリアのレイアウト調整 */
    .action-area {
        display: flex;
        flex-direction: row;
        /* align-items: center; */
        justify-content: space-between;
        gap: 5px;
        width: 100%;
        padding: 5px 0;
    }
    
    /* 検索フォームのレイアウト調整 */
    .search-form {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 5px;
        flex: 1;
        margin-right: 5px;
    }
    
    .search-form input {
        width: 100%;
        font-size: 12px;
        padding: 6px 8px;
        height: 32px;
        box-sizing: border-box;
        min-width: 0;
    }
    
    .search-form button {
        font-size: 12px;
        padding: 6px 8px;
        white-space: nowrap;
        height: 32px;
        box-sizing: border-box;
        min-width: 60px;
    }
    
    /* 追加ボタンのスタイル調整 */
    .add-button-container {
        width: auto;
        flex-shrink: 0;
    }
    
    .add-button-container button {
        font-size: 12px;
        padding: 6px 8px;
        white-space: nowrap;
        margin-left: 0;
        height: 32px;
        box-sizing: border-box;
        min-width: 60px;
        width: auto;
    }
    
    /* 「＋見積もりを追加」を「＋追加」に変更 */
    /* .add-button-container button::before {
        content: '＋';
    } */
    
    /* .add-button-container button::after {
        content: '追加';
    } */
    
    .add-button-container button span {
        display: none;
    }
    
    /* テーブルヘッダとデータのフォントサイズ調整 */
    .estimates-table th {
        font-size: 12px;
        padding: 8px 5px;
    }
    
    .estimates-table td {
        font-size: 12px;
        padding: 8px 5px;
    }
    
    .estimates-table tbody td {
        font-size: 12px;
    }
    
    /* ソートアイコンを非表示にする */
    .estimates-table th.sortable .sort-icon {
        display: none;
    }
    
    /* ソートアイコンを非表示にした際のパディング調整 */
    .estimates-table th.sortable {
        padding-right: 8px;
    }
    
    /* 金額セルの調整 */
    .estimates-table .amount-cell {
        font-size: 12px;
    }
    
    /* ステータスバッジの調整 */
    .status-badge {
        font-size: 11px;
        padding: 4px 8px;
    }
    
    /* 複製ボタンの調整 */
    .duplicate-estimate-btn {
        font-size: 11px;
        padding: 4px 6px;
    }

    .pagination {
        margin: 0;
    }
}

/* 見積日と見積番号の表示調整 */
.estimate-date-wrapper,
.order-date-wrapper,
.estimate-number-wrapper,
.order-number-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.estimate-date-wrapper,
.order-date-wrapper {
    margin-bottom: 15px; /* 行間を5px追加 */
}

.estimate-date-wrapper label,
.order-date-wrapper label,
.estimate-number-wrapper label,
.order-number-wrapper label {
    width: 100px; /* 左端揃えのために幅を統一 */
    margin-bottom: 0;
    white-space: nowrap;
}

.estimate-date-wrapper input,
.order-date-wrapper input,
.estimate-number-wrapper input,
.order-number-wrapper input {
    flex: 1;
}

/* 追加情報フォームの調整 */
.additional-info {
    margin-top: 15px;
    margin-bottom: 15px;
}

/* 左端揃えのための共通クラス */
.title-wrapper,
.validity-wrapper,
.delivery-wrapper,
.payment-due-wrapper,
.payment-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.delivery-wrapper,
.payment-due-wrapper {
    margin-bottom: 15px; /* 行間を5px追加 */
}

.title-wrapper label,
.validity-wrapper label,
.delivery-wrapper label,
.payment-due-wrapper label,
.payment-wrapper label {
    width: 80px; /* 左端揃えのために幅を統一 */
    margin-bottom: 0;
    white-space: nowrap;
    display: inline-block;
}

.title-wrapper input,
.validity-wrapper input,
.delivery-wrapper input,
.payment-due-wrapper input,
.payment-wrapper select {
    flex: 1;
}

/* 件名上のスペース追加 */
.title-wrapper {
    margin-top: 20px;
}

/* 担当者欄のスタイル */
.client-person-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 25px;
}

.client-person-wrapper input {
    flex: 1;
}

.client-person-wrapper span {
    flex-shrink: 0;
    font-weight: bold;
}

.client-person-wrapper span.hide {
    display: none;
}

/* 複製ボタン */
.duplicate-estimate-btn {
    padding: 5px 10px;
    background-color: #6c757d;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.duplicate-estimate-btn:hover {
    background-color: #0AA273;
}

/* 見積書作成履歴テーブル列幅調整 */
.estimate-history-table th:nth-child(1), .estimate-history-table td:nth-child(1) {
    width: 100px;
}
.estimate-history-table th:nth-child(2), .estimate-history-table td:nth-child(2) {
    width: 100px;
}
.estimate-history-table th:nth-child(3), .estimate-history-table td:nth-child(3) {
    width: auto;
}
.estimate-history-table th:nth-child(4), .estimate-history-table td:nth-child(4) {
    width: 120px;
}
.estimate-history-table th:nth-child(5), .estimate-history-table td:nth-child(5) {
    width: 100px;
}
.estimate-history-table th:nth-child(6), .estimate-history-table td:nth-child(6) {
    width: 150px;
}

/* 見積履歴テーブルの行ホバー効果 */
.estimate-history-table tr {
    cursor: pointer;
    transition: background-color 0.2s;
}

.estimate-history-table tr:hover {
    background-color: #f0e6ff; /* 薄紫色の背景色 */
}

/* 古いバージョン表示時のスタイル */
.old-version {
    position: relative;
    border: 2px solid #e0d0ff; /* 薄紫色のボーダー */
}

/* バージョンインジケーター */
.version-indicator {
    background-color: #673ab7; /* 紫色の背景 */
    color: white;
    padding: 8px 15px;
    border-radius: 4px;
    margin-bottom: 10px;
    font-weight: bold;
    text-align: center;
}

/* 印刷時のみ表示する要素（JavaScriptで必要なクラス） */
.print-only {
    display: none;
}

/* 発注書モードのボタン色 - 古いスタイルも残しつつ拡張 */
.order-mode #save-estimate-btn,
.order-mode #send-estimate-btn,
.order-mode #print-estimate-btn,
.order-mode #add-item-btn {
    background-color: #2196F3;
    color: white;
}

.order-mode #save-estimate-btn:hover,
.order-mode #send-estimate-btn:hover,
.order-mode #print-estimate-btn:hover,
.order-mode #add-item-btn:hover {
    background-color: #0d8bf2;
}

/* 発注書モードのボタン色 */
.order-mode-btn {
    background-color: #2196F3 !important; /* 青色 */
    color: white !important;
}

.order-mode-btn:hover {
    background-color: #0d8bf2 !important; /* 濃い青色 */
}

/* モード切替時のカラム幅調整 */
/* .order-mode .estimate-items-table th.estimate-label {
    display: none !important;
} */

.order-mode .estimate-items-table th.order-label {
    display: table-cell !important;
    width: 40% !important;
}

/* 見積書モード時の摘要カラム非表示 */
.estimate-items-table th.order-label:not(.order-mode th.order-label) {
    display: none !important;
}

/* 発注書の印刷レイアウト調整 */
.delivery-wrapper label,
.payment-due-wrapper label,
.payment-wrapper label {
    font-size: 1em;
    /* font-weight: bold; */
}

/* 印刷時のフォームレイアウト */
@media print {
    .delivery-wrapper label,
    .payment-due-wrapper label,
    .payment-wrapper label {
        font-size: 1em !important;
        font-weight: bold !important;
    }
}

/* 請求書モードのボタン色 */
.invoice-mode-btn {
    background-color: #333 !important;
    color: white !important;
}

.invoice-mode-btn:hover {
    background-color: #1a1a1a !important;
}

/* 請求書モード用のボタンとスタイル */
#create-invoice-btn {
    background-color: #888; /* インディゴ色 */
    color: white;
    margin-right: 10px;
}

#create-invoice-btn:hover {
    background-color: #333; /* 濃いインディゴ色 */
}

/* 請求書モードのスタイル */
.estimate-sheet.invoice-mode {
    border: 2px solid #333 !important;
}

.estimate-sheet.invoice-mode .estimate-title {
    border-bottom: 2px solid #333 !important;
    color: #333 !important;
}

/* 請求書モードでの枠線色を変更 */
.invoice-mode .summary-box {
    border: 2px solid #333 !important;
}

.invoice-mode .summary-amount {
    color: #333 !important;
}

/* 請求書モードでの履歴セクションの色を変更 */
.invoice-mode ~ .estimate-history-section {
    border-top: 2px solid #333;
}

/* 請求書モード時のボタン色を変更 */
.modal-actions button.invoice-mode-btn {
    background-color: #333;
    color: white;
}

.modal-actions button.invoice-mode-btn:hover {
    background-color: #1a1a1a;
}

/* 請求書モードのプレビューボタン */
.invoice-mode #print-estimate-btn {
    background-color: #333333;
    color: white;
}

.invoice-mode #print-estimate-btn:hover {
    background-color: #1a1a1a;
}

/* 請求書モードの送信ボタン無効化 */
.invoice-mode #send-estimate-btn {
    background-color: #cccccc !important;
    color: #888888 !important;
    cursor: not-allowed;
    opacity: 0.7;
}

/* 請求書モードのボタン（削除ボタン以外） */
.invoice-mode .modal-actions button:not(.delete-version-btn) {
    background-color: #333;
    color: white;
}

.invoice-mode .modal-actions button:not(.delete-version-btn):hover {
    background-color: #1a1a1a;
}

/* モード切替時のカラム幅調整 */
/* .order-mode .estimate-items-table th.estimate-label {
    display: none !important;
} */

.order-mode .estimate-items-table th.order-label {
    display: table-cell !important;
    width: 40% !important;
}

/* 見積書モード時の摘要カラム非表示 */
.estimate-items-table th.order-label:not(.order-mode th.order-label) {
    display: none !important;
}

/* 発注書の印刷レイアウト調整 */
.delivery-wrapper label,
.payment-due-wrapper label,
.payment-wrapper label {
    font-size: 1em;
    /* font-weight: bold; */
}

/* 印刷時のフォームレイアウト */
@media print {
    .delivery-wrapper label,
    .payment-due-wrapper label,
    .payment-wrapper label {
        font-size: 1em !important;
        font-weight: bold !important;
    }
}

/* 見積書モードのボタン色 */
#save-estimate-btn:not(.order-mode-btn):not(.invoice-mode-btn),
#print-estimate-btn:not(.order-mode-btn):not(.invoice-mode-btn) {
    background-color: #0AA273; /* 緑色 */
    color: white;
}

#save-estimate-btn:not(.order-mode-btn):not(.invoice-mode-btn):hover,
#print-estimate-btn:not(.order-mode-btn):not(.invoice-mode-btn):hover {
    background-color: #088c61; /* 濃い緑色 */
}

/* 振込先フォームのスタイル */
.bank-account-group {
    margin: 15px 0;
}

.bank-account-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #333 !important; /* 枠線を追加 */
    border-radius: 4px;
    box-sizing: border-box;
}

/* 印刷プレビュー時の振込先フォームのスタイル */
@media print {
    .bank-account-input {
        border: 1px solid #333 !important;
        padding: 8px;
    }
    
    /* 振込先が空の場合は表示しない */
    .bank-account-group.empty {
        display: none !important;
    }
}

/* 請求書モードの項目追加ボタン */
.invoice-mode #add-item-btn {
    background-color: #333;
    color: white;
}

/* 請求書モードの項目追加ボタン */
.invoice-mode #add-item-btn {
    background-color: #333;
    color: white;
}

.invoice-mode #add-item-btn:hover {
    background-color: #1a1a1a;
}

/* 請求書のレイアウト調整 */
.invoice-date-wrapper,
.invoice-number-wrapper {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    width: 100%;
}

.invoice-date-wrapper label,
.invoice-number-wrapper label {
    width: 100px;
    display: inline-block;
    text-align: left;
}

.invoice-date-wrapper input,
.invoice-number-wrapper input {
    flex: 1;
}

/* 請求書モードのテーブルカラム幅 */
.invoice-mode .estimate-items-table th:nth-child(1),
.invoice-mode .estimate-items-table td:nth-child(1) {
    width: 40%;
}

.invoice-mode .estimate-items-table th:nth-child(2),
.invoice-mode .estimate-items-table td:nth-child(2) {
    width: 10%;
}

.invoice-mode .estimate-items-table th:nth-child(3),
.invoice-mode .estimate-items-table td:nth-child(3) {
    width: 10%;
}

.invoice-mode .estimate-items-table th:nth-child(4),
.invoice-mode .estimate-items-table td:nth-child(4) {
    width: 15%;
}

.invoice-mode .estimate-items-table th:nth-child(5),
.invoice-mode .estimate-items-table td:nth-child(5) {
    width: 15%;
}

/* 印刷時の請求書スタイル */
@media print {
    .invoice-mode .estimate-sheet {
        border-color: #333333 !important;
    }
    
    .invoice-mode .estimate-title {
        color: #333333 !important;
        border-bottom-color: #333333 !important;
    }
    
    .invoice-mode .summary-box {
        border-color: #333333 !important;
    }
    
    .invoice-mode .summary-amount {
        color: #333333 !important;
    }
    
    .invoice-mode ~ .estimate-history-section {
        border-top-color: #333333 !important;
    }
}

/* 件名フォームを2行表示に変更 */
.title-wrapper textarea {
    width: 100%;
    min-height: 50px;
    padding: 5px;
    border: 1px solid #ccc;
    border-radius: 4px;
    resize: vertical;
    font-family: inherit;
    font-size: inherit;
    line-height: 1.4;
}

/* 件名フォームのラベル位置調整 */
.title-wrapper label {
    vertical-align: top;
    line-height: 1.8;
}

/* 印刷時の請求書スタイル強化 */
.invoice-mode .estimate-sheet,
.invoice-mode .estimate-title,
.invoice-mode .summary-box,
.invoice-mode .summary-amount,
.invoice-mode ~ .estimate-history-section {
    border-color: #333333 !important;
    color: #333333 !important;
}

.invoice-mode .estimate-title {
    border-bottom-color: #333333 !important;
}

/* 印刷時の請求書テーマカラー統一 */
@media print {
    .invoice-mode {
        color: #333333 !important;
    }
    
    .invoice-mode .estimate-sheet {
        border-color: #333333 !important;
    }
    
    .invoice-mode .estimate-title {
        color: #333333 !important;
        border-bottom-color: #333333 !important;
    }
    
    .invoice-mode .summary-box {
        border-color: #333333 !important;
    }
    
    .invoice-mode .summary-amount {
        color: #333333 !important;
    }
    
    .invoice-mode ~ .estimate-history-section {
        border-top-color: #333333 !important;
    }
    
    /* 件名フォームの印刷時スタイル */
    .title-wrapper textarea {
        border: none !important;
        resize: none !important;
        overflow: visible !important;
        white-space: pre-line !important;
    }
}