/* po-ledger.css - マスター専用 工事注文書・注文請書 全社台帳スタイル */

.po-ledger-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(4px);
    z-index: 10005;
    justify-content: center;
    align-items: center;
    padding: 12px;
    box-sizing: border-box;
}

.po-ledger-container {
    background: #ffffff;
    width: 100%;
    max-width: 1120px;
    max-height: 94vh;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    animation: poLedgerFadeIn 0.22s ease-out;
}

@keyframes poLedgerFadeIn {
    from { opacity: 0; transform: scale(0.98) translateY(6px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

/* ヘッダー */
.po-ledger-header {
    padding: 16px 22px;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: #ffffff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.po-ledger-header h3 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #f8fafc;
}

.po-ledger-badge-master {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
    font-size: 0.72rem;
    padding: 2px 8px;
    border-radius: 6px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.po-ledger-close-btn {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s;
}

.po-ledger-close-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

/* フィルターバー */
.po-ledger-filter-bar {
    padding: 14px 20px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.po-ledger-filter-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.po-ledger-filter-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: #475569;
}

.po-ledger-select,
.po-ledger-input {
    padding: 7px 12px;
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    background: white;
    color: #1e293b;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.po-ledger-select:focus,
.po-ledger-input:focus {
    border-color: #0284c7;
    box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.15);
}

.po-ledger-btn-csv {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border: none;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.25);
    margin-left: auto;
    transition: all 0.2s;
}

.po-ledger-btn-csv:hover {
    background: linear-gradient(135deg, #059669, #047857);
    transform: translateY(-1px);
}

/* 集計サマリーバー */
.po-ledger-summary-bar {
    padding: 12px 20px;
    background: #ffffff;
    border-bottom: 2px solid #e2e8f0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    align-items: center;
}

.po-summary-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.po-summary-card.highlight {
    background: #f0f9ff;
    border-color: #0284c7;
}

.po-summary-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: #64748b;
}

.po-summary-card.highlight .po-summary-label {
    color: #0369a1;
}

.po-summary-val {
    font-size: 1.25rem;
    font-weight: 800;
    color: #0f172a;
}

.po-summary-card.highlight .po-summary-val {
    color: #0284c7;
    font-size: 1.35rem;
}

.po-summary-sub {
    font-size: 0.72rem;
    color: #64748b;
}

/* テーブル領域 */
.po-ledger-body {
    padding: 14px 20px;
    overflow: visible;
    flex: none;
}

.po-ledger-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.83rem;
    min-width: 900px;
}

.po-ledger-table th {
    background: #f1f5f9;
    color: #475569;
    font-weight: 700;
    padding: 9px 10px;
    border-bottom: 2px solid #cbd5e1;
    text-align: left;
    white-space: nowrap;
}

.po-ledger-table td {
    padding: 10px;
    border-bottom: 1px solid #e2e8f0;
    color: #1e293b;
    vertical-align: middle;
}

.po-ledger-table tr:hover {
    background: #f8fafc;
}

/* バッジ */
.po-badge-accepted {
    display: inline-block;
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.3;
}

.po-badge-pending {
    display: inline-block;
    background: #fff7ed;
    color: #c2410c;
    border: 1px solid #fed7aa;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.3;
}

/* 操作ボタン */
.po-action-btn-order {
    background: #f0f9ff;
    color: #0284c7;
    border: 1px solid #bae6fd;
    padding: 5px 9px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.15s;
    white-space: nowrap;
}

.po-action-btn-order:hover {
    background: #0284c7;
    color: #ffffff;
}

.po-action-btn-confirm {
    background: #f8fafc;
    color: #475569;
    border: 1px solid #cbd5e1;
    padding: 5px 9px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.15s;
    white-space: nowrap;
}

.po-action-btn-confirm.is-accepted {
    background: #ecfdf5;
    color: #059669;
    border-color: #a7f3d0;
}

.po-action-btn-confirm:hover {
    background: #059669;
    color: #ffffff;
    border-color: #059669;
}

.po-ledger-site-link {
    color: #0f172a;
    font-weight: 700;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.po-ledger-site-link:hover {
    color: #0284c7;
    text-decoration: underline;
}

/* フッターバー */
.po-ledger-footer {
    padding: 12px 20px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.po-ledger-footer-count {
    font-size: 0.82rem;
    font-weight: 600;
    color: #64748b;
}

.po-ledger-footer-close-btn {
    background: #334155;
    color: #ffffff;
    border: none;
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.po-ledger-footer-close-btn:hover {
    background: #0f172a;
    transform: translateY(-1px);
}

/* スマホ対応 */
@media (max-width: 768px) {
    .po-ledger-overlay {
        padding: 8px 6px;
    }
    .po-ledger-container {
        max-height: 96vh;
        border-radius: 12px;
    }
    .po-ledger-header {
        padding: 12px 14px;
    }
    .po-ledger-filter-bar {
        padding: 10px 12px;
    }
    .po-ledger-summary-bar {
        grid-template-columns: repeat(2, 1fr);
        padding: 10px 12px;
        gap: 8px;
    }
    .po-ledger-body {
        padding: 10px 12px;
    }
    .po-ledger-footer {
        padding: 10px 14px;
    }
    .po-ledger-btn-csv {
        width: 100%;
        justify-content: center;
        margin-left: 0;
    }
}
