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

body {
    font-family: 'Microsoft JhengHei', '微軟正黑體', Arial, sans-serif;
    background-image: url('base.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    min-height: 100vh;
    padding: 20px;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

.container {
    max-width: 95%;
    margin: 0 auto;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    transition: box-shadow 0.3s ease;
    width: 100%;
    box-sizing: border-box;
}

@media (max-width: 768px) {
    .container {
        max-width: 100%;
        border-radius: 0;
        margin: 0;
    }
}

/* admin 頁面專用寬度 */
body.admin-page .container {
    max-width: 98%;
}

/* Sticky 表頭 top 配合 toolbar 高度，避免被遮住 */
:root {
    --toolbar-sticky-h: 56px;
}

header {
    background-image: url('0112.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    color: white;
    padding: 30px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.company-logo {
    max-width: 180px;
    max-height: 75px;
    width: auto;
    height: auto;
    object-fit: contain;
}

header h1 {
    font-size: 36px;
    margin: 0;
    font-weight: 600;
    overflow: hidden;
}

.split-text {
    display: inline-block;
}

.split-char {
    display: inline-block;
    opacity: 0;
    transform: translateY(40px);
    animation: splitTextIn 0.8s ease forwards;
}

@keyframes splitTextIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}


main {
    padding: 40px;
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

@media (max-width: 768px) {
    main {
        padding: 25px 15px;
    }
}

.form-container {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

@media (max-width: 768px) {
    .form-container {
        gap: 24px;
    }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.form-group > label {
    font-weight: 600;
    color: #0f172a;
    font-size: 15px;
    margin-bottom: 2px;
}

.form-group select,
.form-group input[type="text"],
.form-group input[type="number"]:not(.qty-input) {
    padding: 12px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 16px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    font-family: inherit;
    background: #fff;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.form-group select {
    cursor: pointer;
}

.form-group select:hover,
.form-group input[type="text"]:hover,
.form-group input[type="number"]:not(.qty-input):hover {
    border-color: #94a3b8;
}

.form-group select:focus,
.form-group input[type="text"]:focus,
.form-group input[type="number"]:not(.qty-input):focus {
    outline: none;
    border-color: #2d8659;
    box-shadow: 0 0 0 3px rgba(45, 134, 89, 0.12);
}

.form-group input[type="text"]:focus,
.form-group input[type="number"]:not(.qty-input):focus {
    background: #fff;
}

.form-section {
    background: #fafbfc;
    padding: 28px;
    border-radius: 12px;
    margin-top: 20px;
    border: 1px solid #e2e8f0;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.form-section:hover {
    border-color: #cbd5e1;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

/* 地址欄位 */
.address-fields {
    display: flex;
    gap: 12px;
}

.address-fields select,
.address-fields input {
    padding: 12px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 16px;
    font-family: inherit;
    background: #fff;
    box-sizing: border-box;
    transition: all 0.2s ease;
}

.address-fields select {
    cursor: pointer;
}

.address-fields select:hover,
.address-fields input:hover {
    border-color: #94a3b8;
}

.address-fields select:focus,
.address-fields input:focus {
    outline: none;
    border-color: #2d8659;
    box-shadow: 0 0 0 3px rgba(45, 134, 89, 0.12);
}

/* 縣市|區域|詳細地址 同一排橫向排列（如參考圖） */
.address-inline {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 10px;
    align-items: stretch;
    width: 100%;
}

.address-inline select {
    flex: 0 0 auto;
    min-width: 120px;
    width: auto;
}

.address-inline #addressDetail {
    flex: 1 1 200px;
    min-width: 180px;
}

/* 手機版：縣市+區域同一排，詳細地址下一排，縮減高度 */
@media (max-width: 480px) {
    .address-inline {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
    }
    .address-inline select {
        flex: 1 1 calc(50% - 4px);
        min-width: 0;
        width: auto;
        padding: 10px 10px;
        font-size: 15px;
    }
    .address-inline #addressDetail {
        flex: 1 1 100%;
        min-width: 0;
        padding: 10px 12px;
        font-size: 15px;
    }
}

/* 768px 以下也縮減地址區塊間距 */
@media (max-width: 768px) {
    .form-group.address-group {
        gap: 6px;
    }
    .address-fields select,
    .address-fields input {
        padding: 10px 12px;
        font-size: 15px;
    }
}

.form-section h3 {
    color: #2d8659;
    margin-bottom: 24px;
    font-size: 20px;
    font-weight: 700;
    padding-bottom: 12px;
    border-bottom: 2px solid #e0e0e0;
}

@media (max-width: 768px) {
    .form-section h3 {
        font-size: 18px;
        margin-bottom: 20px;
    }
}

.equipment-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap: nowrap;
    padding: 14px 16px;
    background: #fff;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    transition: border-color 0.2s ease;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.equipment-row:hover {
    border-color: #cbd5e1;
}

.equipment-label-wrapper {
    display: flex;
    flex-direction: column;
    min-width: 70px;
    max-width: 100px;
    flex-shrink: 1;
    flex-grow: 0;
    overflow: hidden;
    word-wrap: break-word;
}

.equipment-label {
    font-weight: 500;
    color: #555;
    margin-bottom: 4px;
}

.qty-input {
    width: 70px !important;
    min-width: 50px !important;
    max-width: 80px !important;
    padding: 10px 6px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 16px;
    flex-shrink: 0;
    flex-grow: 0;
    transition: all 0.2s ease;
    text-align: center;
    background: #fff;
    box-sizing: border-box;
}

.qty-input:hover {
    border-color: #c0c0c0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.qty-input:focus {
    outline: none;
    border-color: #2d8659;
    box-shadow: 0 0 0 3px rgba(45, 134, 89, 0.1);
}

/* 滅火器、偵煙器 同一排橫向排列 */
.equipment-row-group {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 16px;
}

/* 設備單選樣式（每項最多選 1 個） */
.equipment-single-row {
    flex: 1;
    min-width: 200px;
    flex-wrap: wrap;
    gap: 12px;
}

/* 自訂圓形 checkbox - From Uiverse.io by Praashoo7（改為綠色主題） */
.equipment-checkbox-custom {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background: #fff;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.equipment-checkbox-custom:hover {
    border-color: #2d8659;
    background: #f8fbf9;
}

.equipment-checkbox-custom:has(input:checked) {
    border-color: #2d8659;
    background: #e8f5ec;
}

.equipment-checkbox-custom input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.equipment-checkbox-custom {
    position: relative;
}

.equipment-checkbox-custom .checkmark {
    position: relative;
    top: 0;
    left: 0;
    height: 2.2em;
    width: 2.2em;
    min-width: 2.2em;
    background-color: #d1d5db;
    border-radius: 50%;
    transition: all 0.4s ease;
    flex-shrink: 0;
}

.equipment-checkbox-custom:hover .checkmark {
    box-shadow: inset 8px 8px 8px #b3b3b3, inset -8px -8px 8px #ffffff;
}

.equipment-checkbox-custom input:checked ~ .checkmark {
    box-shadow: none;
    background-color: #2d8659;
    transform: rotateX(360deg);
}

.equipment-checkbox-custom input:checked ~ .checkmark:hover {
    box-shadow: 2px 2px 6px rgba(45, 134, 89, 0.4);
}

.equipment-checkbox-custom .checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.equipment-checkbox-custom input:checked ~ .checkmark:after {
    display: block;
}

.equipment-checkbox-custom .checkmark:after {
    left: 0.75em;
    top: 0.45em;
    width: 0.35em;
    height: 0.65em;
    border: solid white;
    border-width: 0 0.15em 0.15em 0;
    box-shadow: 0.1em 0.1em 0 0 rgba(0, 0, 0, 0.2);
    transform: rotate(45deg);
}

.equipment-single-option .check-label {
    font-weight: 500;
    color: #333;
}

.unit {
    color: #666;
    font-size: 15px;
    font-weight: 500;
    flex-shrink: 0;
    white-space: nowrap;
    margin-left: 2px;
}

.remaining-qty {
    color: #2d8659;
    font-size: 12px;
    line-height: 1.4;
    margin-top: 2px;
}

.remaining-qty strong {
    color: #1e5d3f;
    font-weight: 600;
}

/* 庫存警告樣式 */
.inventory-warning {
    font-size: 11px;
    line-height: 1.4;
    margin-top: 3px;
    padding: 3px 6px;
    border-radius: 3px;
    display: block;
}

.warning-zero {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.warning-low {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* admin.html 庫存警告樣式 */
.stock-zero {
    background: #f8d7da !important;
    color: #721c24 !important;
    font-weight: 600;
}

.stock-low {
    background: #fff3cd !important;
    color: #856404 !important;
    font-weight: 600;
}

.stock-warning-row {
    background: #fff;
}

.stock-warning-cell {
    font-size: 11px;
    padding: 5px;
    text-align: center;
    background: #fff3cd;
    color: #856404;
    border-top: 1px solid #ffeaa7;
}

/* 當警告訊息包含「已無庫存」時的特殊樣式 */
.stock-warning-cell[data-warning-type="zero"] {
    background: #f8d7da;
    color: #721c24;
    border-top: 1px solid #f5c6cb;
}

/* 手機版響應式調整 */
@media (max-width: 768px) {
    .equipment-row-group {
        flex-direction: column;
    }
    .equipment-single-row {
        min-width: 0;
        flex-direction: column;
        align-items: flex-start;
    }
    .equipment-row {
        gap: 6px;
        margin-bottom: 20px;
        flex-wrap: nowrap;
        align-items: center;
        padding: 10px 8px;
        width: 100%;
        max-width: 100%;
        overflow: hidden;
    }
    
    .equipment-label-wrapper {
        min-width: 55px;
        max-width: 70px;
        width: auto;
        flex: 0 0 auto;
        margin-bottom: 0;
        overflow: hidden;
    }
    
    .equipment-label {
        font-size: 13px;
        margin-bottom: 3px;
        word-wrap: break-word;
        overflow: hidden;
    }
    
    .remaining-qty {
        font-size: 10px;
        line-height: 1.3;
        margin-top: 1px;
        word-wrap: break-word;
    }
    
    .qty-input {
        width: 55px;
        min-width: 45px;
        max-width: 65px;
        font-size: 16px; /* 防止 iOS 自動縮放 */
        padding: 10px 4px;
        flex-shrink: 0;
        flex-grow: 0;
        box-sizing: border-box;
    }
    
    .unit {
        font-size: 13px;
        flex-shrink: 0;
        white-space: nowrap;
        margin-left: 2px;
    }
}

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    justify-content: center;
    flex-wrap: wrap;
}

/* 送出按鈕 - 手機友善，避免卡住（移除外層 icon 動畫） */
.btn-submit {
    background: #2d8659;
    color: white;
    padding: 14px 32px;
    min-width: 120px;
    min-height: 48px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.btn-submit:hover {
    background: #1e5d3f;
}

.btn-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.2s ease;
    font-family: inherit;
    position: relative;
    overflow: hidden;
}

.btn:active {
    transform: translateY(1px);
}

/* From Uiverse.io by adamgiebl - 修改為綠色主題 */
.cssbuttons-io-button {
    background: #2d8659;
    color: white;
    font-family: inherit;
    padding: 0.35em;
    padding-left: 1.2em;
    font-size: 17px;
    font-weight: 500;
    border-radius: 0.9em;
    border: none;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    box-shadow: inset 0 0 1.6em -0.6em #1e5d3f;
    overflow: hidden;
    position: relative;
    height: 2.8em;
    padding-right: 3.3em;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.cssbuttons-io-button:hover {
    transform: translateY(-1px);
}

.cssbuttons-io-button:active {
    transform: translateY(0);
}

.cssbuttons-io-button .icon {
    background: white;
    margin-left: 1em;
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 2.2em;
    width: 2.2em;
    border-radius: 0.7em;
    box-shadow: 0.1em 0.1em 0.6em 0.2em #1e5d3f;
    right: 0.3em;
    transition: all 0.3s;
}

.cssbuttons-io-button:hover .icon {
    width: calc(100% - 0.6em);
}

.cssbuttons-io-button .icon svg {
    width: 1.1em;
    transition: transform 0.3s;
    color: #2d8659;
}

.cssbuttons-io-button:hover .icon svg {
    transform: translateX(0.1em);
}

.cssbuttons-io-button:active .icon {
    transform: scale(0.95);
}

/* 保留原有的 btn-primary 作為備用 */
.btn-primary {
    background: linear-gradient(135deg, #2d8659 0%, #1e5d3f 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(45, 134, 89, 0.2);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(45, 134, 89, 0.4);
    background: linear-gradient(135deg, #349d6b 0%, #2d8659 100%);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(45, 134, 89, 0.3);
}

.btn-secondary {
    background: #6c757d;
    color: white;
    box-shadow: 0 2px 8px rgba(108, 117, 125, 0.2);
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3);
}

.btn-secondary:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(108, 117, 125, 0.2);
}

.message {
    margin-top: 20px;
    padding: 16px 20px;
    border-radius: 10px;
    text-align: center;
    font-weight: 500;
    display: none;
    animation: messageSlideIn 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    display: block;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    display: block;
}

/* 庫存驗證對話框樣式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: white;
    margin: 10% auto;
    padding: 30px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-width: calc(100vw - 40px);
    animation: modalFadeIn 0.3s ease;
    box-sizing: border-box;
    overflow-y: auto;
    overflow-x: hidden;
    max-height: 85vh;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    .modal-content {
        margin: 10px auto;
        padding: 20px;
        width: 95%;
        max-width: none;
        border-radius: 12px;
        max-height: calc(100vh - 20px);
        -webkit-overflow-scrolling: touch;
    }
    
    .modal-buttons {
        padding-top: 10px;
        margin-top: 15px;
        border-top: 1px solid #e2e8f0;
        flex-wrap: wrap;
        gap: 12px;
    }
    .modal-buttons .btn {
        flex: 1;
        min-width: 80px;
    }
}

.modal-content h2 {
    color: #2d8659;
    margin-bottom: 20px;
    text-align: center;
}

/* 成功動畫樣式 */
.success-modal-content {
    max-width: 300px;
    padding: 50px 30px;
    text-align: center;
}

.success-animation {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.success-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #2d8659;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    position: relative;
}

.success-checkmark {
    width: 52px;
    height: 52px;
}

.success-checkmark-circle {
    stroke: #fff;
    stroke-width: 2;
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    stroke-linecap: round;
    fill: none;
}

.success-checkmark-check {
    stroke: #fff;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
}

@keyframes success-circle-animation {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes success-checkmark-animation {
    0% {
        stroke-dashoffset: 48;
    }
    50% {
        stroke-dashoffset: 0;
    }
    100% {
        stroke-dashoffset: 0;
    }
}

.success-checkmark-circle {
    animation: success-checkmark-circle-animation 0.6s ease-in-out both;
}

@keyframes success-checkmark-circle-animation {
    0% {
        stroke-dashoffset: 166;
    }
    100% {
        stroke-dashoffset: 0;
    }
}

.success-title {
    color: #2d8659;
    font-size: 24px;
    font-weight: 700;
    margin: 0;
    animation: success-title-fade-in 0.5s ease-in-out 0.4s both;
}

@keyframes success-title-fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Excel 匯入回寫結果 Modal */
.import-result-modal {
    max-width: 900px;
    width: 95%;
}

.import-result-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 16px 24px;
    margin-bottom: 20px;
    padding: 12px 16px;
    background: #f8fafc;
    border-radius: 8px;
}

.import-summary-row {
    font-size: 15px;
}

.import-summary-label {
    color: #64748b;
    margin-right: 4px;
}

.import-summary-updated {
    color: #15803d;
}

.import-summary-invalid {
    color: #dc2626;
}

.import-summary-batch {
    flex-basis: 100%;
    margin-top: 4px;
}

.import-batch-id {
    font-size: 12px;
    background: #e2e8f0;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
}

.import-result-details {
    margin-bottom: 20px;
    max-height: 400px;
    overflow-y: auto;
}

.import-result-details h4 {
    margin: 16px 0 8px;
    font-size: 14px;
    color: #475569;
}

.import-result-details h4:first-child {
    margin-top: 0;
}

.import-detail-table-wrap {
    overflow-x: auto;
    margin-bottom: 12px;
}

.import-detail-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.import-detail-table th,
.import-detail-table td {
    padding: 6px 8px;
    border: 1px solid #e2e8f0;
    text-align: left;
}

.import-detail-table th {
    background: #f1f5f9;
    font-weight: 600;
    white-space: nowrap;
}

.import-detail-table td {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 768px) {
    .success-modal-content {
        max-width: 250px;
        padding: 40px 20px;
    }
    
    .success-circle {
        width: 70px;
        height: 70px;
    }
    
    .success-checkmark {
        width: 45px;
        height: 45px;
    }
    
    .success-title {
        font-size: 20px;
    }
}

.inventory-info {
    margin-bottom: 20px;
}

.inventory-info p {
    margin-bottom: 20px;
    font-size: 16px;
    color: #333;
}

.inventory-questions {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.inventory-question {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.inventory-question label {
    font-weight: 600;
    min-width: 80px;
}

.inventory-question input[type="number"] {
    padding: 10px 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    width: 90px;
    font-size: 16px;
    text-align: center;
    transition: all 0.2s ease;
    background: #fff;
}

.inventory-question input[type="number"]:hover {
    border-color: #bbb;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.inventory-question input[type="number"]:focus {
    outline: none;
    border-color: #2d8659;
    box-shadow: 0 0 0 3px rgba(45, 134, 89, 0.1);
}

.inventory-question span {
    color: #666;
    font-size: 16px;
    margin-left: 5px;
}

.inventory-error {
    background: #f8d7da;
    color: #721c24;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 20px;
    text-align: center;
    border: 1px solid #f5c6cb;
}

/* 庫存警告顯示（在驗證對話框中） */
.inventory-warning-display {
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 15px;
    text-align: center;
    font-size: 14px;
    line-height: 1.6;
    display: none;
}

.inventory-warning-display.warning-zero {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.inventory-warning-display.warning-low {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* 提交確認對話框樣式 */
.confirm-info {
    margin-bottom: 20px;
}

.confirm-item {
    margin-bottom: 22px;
    padding-bottom: 18px;
    border-bottom: 1px solid #e0e0e0;
    transition: padding 0.2s ease;
}

.confirm-item:hover {
    padding-left: 8px;
    border-left: 3px solid #2d8659;
}

.confirm-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.confirm-item label {
    display: block;
    font-weight: 600;
    color: #2d8659;
    margin-bottom: 8px;
    font-size: 15px;
}

.confirm-item span {
    display: block;
    color: #333;
    font-size: 15px;
    line-height: 1.6;
}

.confirm-equipment {
    margin-top: 8px;
}

.confirm-equipment-item {
    margin-bottom: 10px;
    line-height: 1.8;
}

.confirm-equipment-item:last-child {
    margin-bottom: 0;
}

.confirm-equipment-item strong {
    color: #2d8659;
    font-size: 16px;
}

.confirm-remaining {
    color: #666;
    font-size: 13px;
    margin-left: 10px;
}

.confirm-remaining strong {
    color: #1e5d3f;
    font-weight: 600;
}

.modal-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

.modal-buttons .btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    min-width: 90px;
    -webkit-tap-highlight-color: transparent;
}

.modal-buttons .btn-secondary {
    background: #6c757d;
    color: white;
}

.modal-buttons .btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.modal-buttons .btn-primary {
    background: #2d8659;
    color: white;
}

.modal-buttons .btn-primary:hover {
    background: #1e5d3f;
    transform: translateY(-2px);
}

/* 後台樣式 */
.admin-controls {
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.admin-filters {
    display: flex;
    gap: 15px;
    flex: 1;
    min-width: 300px;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.search-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 14px;
    min-width: 200px;
    max-width: 100%;
    transition: all 0.2s ease;
    background: #fff;
    box-sizing: border-box;
}

.search-input:hover {
    border-color: #c0c0c0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.search-input:focus {
    outline: none;
    border-color: #2d8659;
    box-shadow: 0 0 0 3px rgba(45, 134, 89, 0.1);
}

.store-filter {
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 14px;
    background: white;
    min-width: 150px;
    max-width: 100%;
    transition: all 0.2s ease;
    cursor: pointer;
    box-sizing: border-box;
}

.store-filter:hover {
    border-color: #c0c0c0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.store-filter:focus {
    outline: none;
    border-color: #2d8659;
    box-shadow: 0 0 0 3px rgba(45, 134, 89, 0.1);
}

.admin-buttons {
    display: flex;
    gap: 10px;
}

/* 專業 SaaS 風格工具列 */
.admin-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    background: #fafbfc;
    border-radius: 12px;
    border: 1px solid #e8eaed;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    width: 100%;
    box-sizing: border-box;
    position: sticky;
    top: 0;
    z-index: 50;
}

.admin-toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.toolbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 40px;
    padding: 0 16px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    box-sizing: border-box;
}

.toolbar-btn-icon {
    font-size: 1em;
    line-height: 1;
}

.toolbar-btn-refresh {
    background: #10b981;
    color: #fff;
    box-shadow: 0 1px 2px rgba(16, 185, 129, 0.3);
}
.toolbar-btn-refresh:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}
.toolbar-btn-refresh:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(16, 185, 129, 0.25);
}

.toolbar-btn-add {
    background: #3b82f6;
    color: #fff;
    box-shadow: 0 1px 2px rgba(59, 130, 246, 0.3);
}
.toolbar-btn-add:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
}
.toolbar-btn-add:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(59, 130, 246, 0.25);
}

.toolbar-btn-import {
    background: #8b5cf6;
    color: #fff;
    box-shadow: 0 1px 2px rgba(139, 92, 246, 0.3);
}
.toolbar-btn-import:hover {
    background: #7c3aed;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.35);
}
.toolbar-btn-import:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(139, 92, 246, 0.25);
}

.toolbar-btn-export {
    background: #f59e0b;
    color: #fff;
    box-shadow: 0 1px 2px rgba(245, 158, 11, 0.3);
}
.toolbar-btn-export:hover {
    background: #d97706;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35);
}
.toolbar-btn-export:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(245, 158, 11, 0.25);
}

.toolbar-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.toolbar-btn:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.admin-toolbar-right {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.toolbar-loading {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: 2px solid #e2e8f0;
    border-top-color: #10b981;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.toolbar-loading.active {
    opacity: 1;
    animation: toolbar-spin 0.7s linear infinite;
}

.toolbar-record-count {
    font-size: 13px;
    color: #64748b;
    font-weight: 500;
}

@keyframes toolbar-spin {
    to { transform: rotate(360deg); }
}

.admin-toolbar-badges {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}

.filter-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    border-radius: 20px;
    border: 1px solid #e2e8f0;
    color: #475569;
    white-space: nowrap;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.filter-badge--neutral {
    background: #f1f5f9;
    color: #64748b;
}

.filter-badge--active.filter-badge--store {
    background: #e0f2fe;
    border-color: #7dd3fc;
    color: #0369a1;
}

.filter-badge--active.filter-badge--type-usage {
    background: #ffedd5;
    border-color: #fed7aa;
    color: #9a3412;
}

.filter-badge--active.filter-badge--type-stock {
    background: #dbeafe;
    border-color: #93c5fd;
    color: #1d4ed8;
}

.filter-badge--active.filter-badge--type-other {
    background: #f0fdf4;
    border-color: #86efac;
    color: #15803d;
}

.filter-badge--active.filter-badge--search {
    background: #ede9fe;
    border-color: #c4b5fd;
    color: #5b21b6;
}

.filter-badge-label {
    color: inherit;
    opacity: 0.85;
    font-weight: 500;
}

.filter-badge--neutral .filter-badge-label {
    color: #64748b;
}

.filter-badge-clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 4px;
    padding: 0 4px;
    border: none;
    background: transparent;
    color: inherit;
    opacity: 0.7;
    cursor: pointer;
    border-radius: 4px;
    font-size: 12px;
    line-height: 1;
    transition: opacity 0.15s ease;
}

.filter-badge-clear:hover {
    opacity: 1;
}

.filter-badge-clear:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 1px;
}

.filter-badge[title] {
    cursor: help;
}

.loading {
    text-align: center;
    padding: 60px 40px;
    color: #666;
    font-size: 18px;
    font-weight: 500;
}

.loading::after {
    content: '...';
    animation: loadingDots 1.5s steps(4, end) infinite;
}

@keyframes loadingDots {
    0%, 20% {
        content: '.';
    }
    40% {
        content: '..';
    }
    60%, 100% {
        content: '...';
    }
}

@media (max-width: 768px) {
    .loading {
        padding: 40px 20px;
        font-size: 16px;
    }
}

.reports-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* 表格樣式（Excel 風格） */
.store-table-section {
    background: white;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 30px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid #f0f0f0;
}

@media (max-width: 768px) {
    .store-table-section {
        padding: 15px;
        border-radius: 10px;
        margin-bottom: 20px;
    }
}

.store-table-title {
    font-size: 20px;
    font-weight: 600;
    color: #2d8659;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #2d8659;
}

.table-wrapper {
    overflow-x: auto;
    margin-top: 15px;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
}

@media (max-width: 768px) {
    .table-wrapper {
        margin: 0;
        padding: 0;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .store-table-section {
        padding: 15px 10px;
        overflow-x: auto; /* 允許橫向捲動，避免右側欄位被裁切 */
    }
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    background: white;
    table-layout: auto;
}

.data-table thead {
    background: #2d8659;
    color: white;
}

#mainDataTable thead {
    background: transparent !important;
}
#mainDataTable thead th {
    background: #2d8659;
    color: white;
    top: 0 !important;
}

.data-table thead th {
    position: sticky;
    top: var(--toolbar-sticky-h, 0);
    z-index: 5;
    background: #2d8659;
    box-shadow: 0 2px 2px -1px rgba(0,0,0,0.1);
}

/* 【修正】消除雙 header 視覺：thead 不塗綠（避免多餘空白綠帶），僅 th 塗綠；強制 border 收合 */
#mainDataTable {
    border-collapse: collapse;
    border-spacing: 0;
}
#mainDataTable thead {
    margin: 0;
    padding: 0;
    background: transparent;
}
#mainDataTable thead tr {
    margin: 0;
    padding: 0;
}
#mainDataTable thead th {
    padding: 8px 10px;
    line-height: 1.2;
    margin: 0;
    vertical-align: middle;
    background: #2d8659;
    color: white;
}

.data-table th {
    padding: 14px 10px;
    text-align: center;
    vertical-align: middle;
    font-weight: 700;
    border: 1px solid #1e5d3f;
    white-space: nowrap; /* 避免欄位名稱折行造成高度不一致 */
    font-size: 14px;
    letter-spacing: 0.3px;
}

@media (max-width: 768px) {
    .data-table th {
        padding: 10px 6px;
        font-size: 12px;
    }
}

/* 設備異動類型欄位 - 不換行 */
.data-table .action-type-取用,
.data-table .action-type-入庫,
.data-table .action-type-進貨,
.data-table .action-type-退回 {
    white-space: nowrap;
}

.data-table td {
    padding: 12px 10px;
    border: 1px solid #ddd;
    vertical-align: middle;
}

@media (max-width: 768px) {
    .data-table td {
        padding: 8px 6px;
        font-size: 13px;
    }
}

.data-table tbody tr {
    background: white;
}

.data-table tbody tr:nth-child(even) {
    background: #f8f9fa;
}

.data-table tbody tr {
    transition: background-color 0.15s ease;
}

.data-table tbody tr:hover {
    background: #e8f5e9;
    cursor: default;
}

.data-table .number-cell {
    text-align: right;
    font-family: 'Courier New', monospace;
}

.data-table .stock-cell {
    font-weight: 600;
    color: #2d8659;
}

.data-table .action-type-取用 {
    color: #856404;
    font-weight: 500;
}

.data-table .action-type-入庫,
.data-table .action-type-進貨 {
    color: #0c5460;
    font-weight: 500;
}

.data-table .action-type-退回 {
    color: #6f42c1;
    font-weight: 500;
}

/* 退回申請區塊 */
.return-table-wrap {
    margin-top: 16px;
    overflow-x: auto;
}

.return-list-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.return-list-table th,
.return-list-table td {
    padding: 8px 10px;
    border: 1px solid #ddd;
    text-align: left;
}

.return-list-table th {
    background: #f1f5f9;
    font-weight: 600;
}

.return-empty {
    margin-top: 16px;
    color: #666;
    font-style: italic;
}

.return-modal-info {
    margin-bottom: 16px;
    padding: 12px;
    background: #f8fafc;
    border-radius: 8px;
}

.return-modal-info p {
    margin: 4px 0;
}

.btn-return {
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.match-number-input {
    width: 100%;
    padding: 6px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    background: white;
}

.match-number-input:focus {
    outline: none;
    border-color: #2d8659;
    background: #fff;
    box-shadow: 0 0 0 2px rgba(45, 134, 89, 0.2);
}

/* 可編輯輸入框 */
.editable-input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    transition: all 0.2s ease;
}

.editable-input:hover {
    border-color: #999;
    background: #fafafa;
}

/* 各店庫存紀錄區塊 */
.store-inventory-summary {
    margin-bottom: 24px;
    padding: 20px;
    background: #f8fbf9;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.store-inventory-title {
    font-size: 16px;
    font-weight: 600;
    color: #2d8659;
    margin-bottom: 16px;
}

.store-inventory-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.store-inventory-card {
    flex: 1;
    min-width: 140px;
    padding: 12px 16px;
    background: #fff;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    text-align: center;
}

.store-inventory-card .store-name {
    font-weight: 600;
    color: #333;
    font-size: 14px;
    margin-bottom: 8px;
}

.store-inventory-card .store-stock {
    font-size: 13px;
    color: #555;
}

.store-inventory-card .store-stock .stock-zero {
    color: #721c24;
    font-weight: 600;
}

.store-inventory-card .store-stock .stock-low {
    color: #856404;
    font-weight: 600;
}

.store-inventory-card .stock-warning {
    font-size: 11px;
    color: #856404;
    margin-top: 4px;
}

.store-inventory-card .stock-warning.zero {
    color: #721c24;
}

@media (max-width: 768px) {
    .store-inventory-cards {
        flex-direction: column;
    }
}

/* 媒合編號欄位 - 需容納「嘉禾新北B2M14100151-1」等長字串 */
.match-number-cell {
    min-width: 220px;
    width: 220px;
}

.match-number-cell .editable-input {
    width: 100%;
    min-width: 0;
}

/* 實際金額欄位 - 數字輸入，與發票/媒合同風格 */
.actual-amount-cell {
    min-width: 100px;
    width: 100px;
}

.actual-amount-cell .editable-input {
    width: 100%;
    min-width: 0;
}

/* 發票號碼欄位 - 需容納「VV29476464」等長字串 */
.invoice-number-cell {
    min-width: 130px;
    width: 130px;
}

.invoice-number-cell .editable-input {
    width: 100%;
    min-width: 0;
}

/* 窄欄位（保留給其他使用） */
.narrow-cell {
    min-width: 80px;
    max-width: 100px;
    width: 90px;
}

.narrow-cell .editable-input {
    width: 100%;
    min-width: 0;
}

/* 寬文字欄位（保留給其他欄位使用） */
.wide-text-cell {
    min-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 姓名欄位（業務、買受人）- 確保文字完整顯示、不被截斷 */
.name-cell {
    min-width: 90px;
    max-width: 140px;
    width: 110px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 8px;
}

.editable-input:focus {
    outline: none;
    border-color: #2d8659;
    background: #fff;
    box-shadow: 0 0 0 2px rgba(45, 134, 89, 0.2);
}

.editable-textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    resize: vertical;
    font-family: inherit;
    transition: all 0.2s ease;
}

.editable-textarea:hover {
    border-color: #999;
    background: #fafafa;
}

.editable-textarea:focus {
    outline: none;
    border-color: #2d8659;
    background: #fff;
    box-shadow: 0 0 0 2px rgba(45, 134, 89, 0.2);
}

/* 寬欄位（備註等）- 確保內容完整顯示 */
.wide-cell {
    min-width: 180px;
    max-width: 320px;
    overflow: visible;
}
.wide-cell .editable-textarea {
    min-height: 48px;
}

/* 取用數量和庫存表格 */
.nested-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    margin: 0;
}

.nested-table th,
.nested-table td {
    border: 1px solid #ddd;
    padding: 4px 6px;
    text-align: center;
}

.nested-table th {
    background: #f0f0f0;
    font-weight: 600;
}

.nested-table .number-cell {
    text-align: center;
    font-family: 'Courier New', monospace;
}

.nested-table .stock-value {
    font-weight: 600;
    color: #2d8659;
}

.quantity-cell,
.stock-cell {
    padding: 4px !important;
    vertical-align: middle;
}

/* 取用數量欄位 - 寬一點 */
.quantity-cell {
    min-width: 120px;
    width: 130px;
}

/* 小計欄位 - 窄一點，最多5個數字 */
.subtotal-cell {
    font-weight: 600;
    color: #d9534f;
    min-width: 70px;
    max-width: 90px;
    width: 80px;
    white-space: nowrap;
}

/* 會計確認按鈕 */
.accounting-cell {
    text-align: center;
}

.btn-confirm {
    padding: 8px 16px;
    border: 2px solid #2d8659;
    border-radius: 6px;
    background: white;
    color: #2d8659;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 70px;
}

.btn-confirm:hover {
    background: #2d8659;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(45, 134, 89, 0.3);
}

.btn-confirm:active {
    transform: translateY(0);
}

.btn-confirmed {
    padding: 8px 16px;
    border: 2px solid #5cb85c;
    border-radius: 6px;
    background: #5cb85c;
    color: white;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 70px;
}

.btn-confirmed:hover {
    background: #449d44;
    border-color: #449d44;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(92, 184, 92, 0.3);
}

.btn-confirmed:active {
    transform: translateY(0);
}

/* 繳款方式樣式 */
.payment-cell {
    text-align: center;
    vertical-align: middle;
}

.payment-options {
    display: flex;
    gap: 15px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

.payment-options input[type="checkbox"] {
    margin-right: 6px;
    cursor: pointer;
    width: 18px;
    height: 18px;
    accent-color: #2d8659;
    transition: transform 0.1s ease;
}

.payment-options input[type="checkbox"]:hover {
    transform: scale(1.1);
}

.payment-options label {
    cursor: pointer;
    font-size: 13px;
    user-select: none;
    display: flex;
    align-items: center;
    transition: color 0.2s ease;
}

.payment-options label:hover {
    color: #2d8659;
}

/* 時間欄位樣式 - 兩行顯示 */
.time-cell {
    white-space: normal;
    font-size: 13px;
    color: #666;
    line-height: 1.4;
    min-width: 100px;
}

.time-cell .time-date {
    font-weight: 500;
    margin-bottom: 2px;
}

.time-cell .time-time {
    font-size: 12px;
    color: #888;
}

/* 店別欄位 - 不換行 */
.store-cell {
    white-space: nowrap;
    min-width: 120px;
}

/* 地址欄位 - 確保可讀、必要時換行避免被蓋 */
.address-cell {
    white-space: normal;
    word-break: break-all;
    overflow-wrap: break-word;
    min-width: 180px;
    max-width: 320px;
    line-height: 1.35;
}

/* 儲存狀態指示器 */
.save-indicator {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 600;
    pointer-events: none;
    z-index: 10;
    white-space: nowrap;
}

.save-success {
    background: #28a745;
    color: white;
}

.save-error {
    background: #dc3545;
    color: white;
}

/* inline 儲存中 spinner */
.field-saving::after {
    content: '';
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    border: 2px solid #e0e0e0;
    border-top-color: #2d8659;
    border-radius: 50%;
    animation: field-spin 0.7s linear infinite;
}

@keyframes field-spin {
    to { transform: translateY(-50%) rotate(360deg); }
}

/* 剛改過的欄位閃一下 */
.editable-input.field-just-saved,
.actual-amount-input.field-just-saved {
    animation: field-flash 1.2s ease-out;
}

@keyframes field-flash {
    0% { box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.5); }
    100% { box-shadow: none; }
}

/* 儲存失敗紅框 */
.editable-input.field-save-failed,
.actual-amount-input.field-save-failed {
    animation: field-flash-fail 1.2s ease-out;
}

@keyframes field-flash-fail {
    0% { box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.6); }
    100% { box-shadow: none; }
}

/* 確保可編輯欄位有相對定位 */
.data-table td {
    position: relative;
}

.store-section {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 25px;
    border: 2px solid #e0e0e0;
}

.store-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #2d8659;
}

.store-name {
    font-size: 24px;
    font-weight: 600;
    color: #2d8659;
}

.store-count {
    background: #2d8659;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
}

.records-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.record-item {
    background: white;
    padding: 20px;
    border-radius: 12px;
    border-left: 4px solid #2d8659;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.record-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.record-type {
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
}

.record-type.取用 {
    background: #fff3cd;
    color: #856404;
}

.record-type.入庫 {
    background: #d1ecf1;
    color: #0c5460;
}

.record-time {
    color: #666;
    font-size: 14px;
}

.record-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.detail-label {
    font-size: 12px;
    color: #888;
    font-weight: 500;
}

.detail-value {
    font-size: 16px;
    color: #333;
    font-weight: 600;
}

.equipment-summary {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.equipment-badge {
    background: #e9ecef;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 14px;
    color: #495057;
}

.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: #999;
}

.empty-state p {
    font-size: 16px;
    margin-top: 20px;
    color: #666;
}

@media (max-width: 768px) {
    .empty-state {
        padding: 60px 15px;
    }
}

.empty-state-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

@media (max-width: 768px) {
    body {
        padding: 10px;
        overflow-x: hidden;
        width: 100%;
        max-width: 100vw;
    }

    header {
        padding: 20px 15px;
        gap: 15px;
    }

    .company-logo {
        max-width: 140px;
        max-height: 60px;
    }

    header h1 {
        font-size: 22px;
        line-height: 1.3;
    }

    main {
        padding: 20px 15px;
    }

    .form-section {
        padding: 20px 15px;
        border-radius: 10px;
    }

    .form-group {
        gap: 10px;
    }

    .form-group label {
        font-size: 15px;
    }

    .form-group select,
    .form-group input[type="text"],
    .form-group input[type="number"]:not(.qty-input) {
        padding: 14px 16px;
        font-size: 16px; /* 防止 iOS 自動縮放 */
        border-radius: 10px;
    }
    
    .qty-input {
        width: 55px !important;
        min-width: 45px !important;
        max-width: 65px !important;
        padding: 10px 4px !important;
    }

    .form-actions {
        flex-direction: column;
        gap: 12px;
    }

    .btn {
        width: 100%;
        padding: 14px 30px;
        font-size: 16px;
    }

    .record-details {
        grid-template-columns: 1fr;
    }

    .admin-controls {
        flex-direction: column;
        gap: 15px;
    }

    .admin-filters {
        flex-direction: column;
        width: 100%;
    }

    .search-input,
    .store-filter {
        width: 100%;
        min-width: auto;
    }

    .admin-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .admin-toolbar-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .admin-toolbar-right {
        width: 100%;
        padding-top: 10px;
        border-top: 1px solid #e8eaed;
    }

    .admin-toolbar-badges {
        width: 100%;
        justify-content: flex-start;
    }
}

@media (max-width: 480px) {
    .admin-toolbar-actions {
        flex-direction: column;
    }

    .toolbar-btn {
        width: 100%;
        justify-content: center;
    }
}