/* ==========================================
   Baseball Hot Finance MVP
   css/finance.css
   只處理 finance.html 專用樣式
   主分頁 .bh-tabs / .bh-tab 使用 common-ui.css
   ========================================== */

/* ==========================================
   Layout
   ========================================== */

.finance-page-wrapper {
    box-sizing: border-box;
}

.finance-page {
    width: 100%;
    max-width: 1180px;
    margin: 0 auto 40px auto;
    box-sizing: border-box;
}

.finance-main-tabs {
    margin: 12px 0 24px 0;
}

/* ==========================================
   狀態提示
   ========================================== */

.finance-status-box {
    display: none;
    margin: 0 0 14px 0;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid #d9e2d6;
    background: #f7faf6;
    color: #305030;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.5;
}

.finance-status-box.active {
    display: block;
}

.finance-status-box.error {
    display: block;
    border-color: #ef9a9a;
    background: #fff5f5;
    color: #b71c1c;
}

.finance-status-box.success {
    display: block;
    border-color: #a5d6a7;
    background: #f1fff1;
    color: #1b5e20;
}

/* ==========================================
   分頁內容
   ========================================== */

.finance-tab-panel {
    display: none;
}

.finance-tab-panel.active {
    display: block;
}

/* ==========================================
   共用卡片
   ========================================== */

.finance-card {
    width: 100%;
    margin: 0 0 18px 0;
    padding: 18px 20px;
    box-sizing: border-box;
    background: #ffffff;
    border: 1px solid #d9e2d6;
    border-radius: 12px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.06);
}

.finance-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
}

.finance-card-title {
    margin: 0;
    color: #054700;
    font-size: 22px;
    font-weight: 900;
    letter-spacing: 0.5px;
}

.finance-card-subtitle {
    margin-top: 4px;
    color: #667266;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.4;
}

/* ==========================================
   財政總表：左右雙欄
   ========================================== */

.finance-summary-card {
    padding: 20px 22px;
}

.finance-summary-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: stretch;
}

.finance-summary-block,
.finance-projection-box {
    display: flex;
    flex-direction: column;
    min-height: 335px;
    padding: 16px 18px;
    border-radius: 14px;
    border: 1px solid #d9e8d4;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(247, 251, 246, 0.95));
    box-sizing: border-box;
}

.finance-panel-mini-title,
.finance-projection-title {
    margin: 0;
    color: #054700;
    font-size: 21px;
    font-weight: 900;
    letter-spacing: 0.5px;
}

.finance-panel-mini-title {
    margin-bottom: 12px;
}

.finance-summary-table,
.finance-projection-summary-table {
    width: 100%;
    max-width: none;
    margin-top: 4px;
}

/* ==========================================
   財政總表：左側實績
   ========================================== */

.finance-summary-row {
    display: grid;
    grid-template-columns: 140px minmax(0, 1fr);
    align-items: center;
    gap: 16px;
    min-height: 45px;
    padding: 8px 0;
}

.finance-summary-label {
    color: #445044;
    font-size: 15px;
    font-weight: 800;
}

.finance-summary-value {
    color: #1d2a1d;
    font-size: 21px;
    font-weight: 900;
    text-align: right;
    letter-spacing: 0.3px;
}

.finance-cash-row {
    min-height: 60px;
    padding: 6px 0 12px 0;
}

.finance-cash-row .finance-summary-label {
    color: #054700;
    font-size: 17px;
}

.finance-cash-row .finance-summary-value {
    color: #054700;
    font-size: 30px;
}

.finance-summary-divider {
    height: 1px;
    margin: 4px 0 8px 0;
    background: #e5ece3;
}

.finance-summary-value.income,
.finance-money.income {
    color: #1b7f34;
}

.finance-summary-value.expense,
.finance-money.expense {
    color: #c62828;
}

.finance-summary-value.positive {
    color: #1b7f34;
}

.finance-summary-value.negative {
    color: #c62828;
}

/* ==========================================
   財政總表：右側本季預估
   ========================================== */

.finance-projection-box.simple {
    justify-content: flex-start;
}

.finance-projection-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.finance-projection-note {
    margin-top: 3px;
    color: #657465;
    font-size: 12px;
    font-weight: 800;
}

.finance-projection-summary-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px;
    padding: 8px 0;
}

.finance-projection-summary-row small {
    display: block;
    margin-top: 2px;
    color: #7a887a;
    font-size: 11px;
    font-weight: 700;
}

.finance-projection-summary-row strong {
    color: #054700;
    font-size: 21px;
    font-weight: 900;
    text-align: right;
    white-space: nowrap;
    letter-spacing: 0.3px;
}

.finance-projection-cash-row {
    padding: 6px 0 12px 0;
}

.finance-projection-cash-row .finance-summary-label {
    color: #054700;
    font-size: 17px;
}

.finance-projection-cash-row strong {
    color: #054700;
    font-size: 30px;
}

.finance-projection-summary-row strong.income,
.finance-projection-summary-row strong.positive {
    color: #1b7f34;
}

.finance-projection-summary-row strong.expense,
.finance-projection-summary-row strong.negative {
    color: #c62828;
}

/* ==========================================
   會計師意見
   ========================================== */

.accountant-opinion {
    margin-top: 18px;
    padding: 14px 0 0 0;
    border-top: 1px solid #e5ece3;
    background: transparent;
    box-sizing: border-box;
}

.accountant-opinion-row {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr);
    align-items: start;
    gap: 0;
}

.accountant-opinion-label {
    color: #445044;
    font-size: 15px;
    font-weight: 800;
    line-height: 1.5;
}

.accountant-opinion-content {
    text-align: left;
    padding-right: 8px;
}

.accountant-opinion-content strong {
    display: block;
    color: #054700;
    font-size: 15px;
    font-weight: 900;
    line-height: 1.5;
}

.accountant-opinion-content small {
    display: block;
    margin-top: 4px;
    color: #1d2a1d;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.5;
}

.accountant-opinion.good .accountant-opinion-content strong {
    color: #1b7f34;
}

.accountant-opinion.normal .accountant-opinion-content strong {
    color: #054700;
}

.accountant-opinion.bad .accountant-opinion-content strong {
    color: #ef6c00;
}

.accountant-opinion.danger .accountant-opinion-content strong {
    color: #c62828;
}

/* ==========================================
   週次選擇 + 本週摘要
   ========================================== */

.finance-week-header {
    align-items: flex-end;
}

.finance-week-selector-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.finance-week-selector-wrap label {
    color: #425042;
    font-size: 14px;
    font-weight: 800;
}

.finance-week-select {
    min-width: 180px;
    height: 38px;
    padding: 0 10px;
    border: 1px solid #cad8c6;
    border-radius: 8px;
    background: #ffffff;
    color: #123512;
    font-size: 14px;
    font-weight: 800;
    outline: none;
}

.finance-week-select:focus {
    border-color: #1b5e20;
    box-shadow: 0 0 0 3px rgba(27, 94, 32, 0.12);
}

.finance-weekly-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 16px;
    margin: 4px 0 14px 0;
    padding: 10px 12px;
    border-radius: 10px;
    background: #f4f8f3;
    border: 1px solid #dfe8dc;
    color: #344534;
    font-size: 14px;
    font-weight: 800;
}

.finance-weekly-summary span {
    display: inline-flex;
    align-items: center;
}

/* ==========================================
   表格
   ========================================== */

.finance-table-wrap {
    width: 100%;
    overflow-x: auto;
}

.finance-table {
    width: 100%;
    min-width: 620px;
    border-collapse: collapse;
    background: #ffffff;
    font-size: 14px;
}

.finance-table th {
    padding: 11px 10px;
    border-bottom: 2px solid #1b5e20;
    background: #f3f7f2;
    color: #054700;
    font-size: 14px;
    font-weight: 900;
    text-align: left;
    white-space: nowrap;
}

.finance-table td {
    padding: 11px 10px;
    border-bottom: 1px solid #e2e9df;
    color: #263326;
    font-weight: 700;
    vertical-align: middle;
}

.finance-table tbody tr:hover {
    background: #f8fbf7;
}

.finance-table tfoot td {
    padding: 12px 10px;
    border-top: 2px solid #d7e2d4;
    border-bottom: 0;
    background: #f7faf6;
    color: #054700;
    font-weight: 900;
}

.finance-table .money-col {
    text-align: right;
}

.finance-money {
    font-weight: 900;
    text-align: right;
    white-space: nowrap;
}

.finance-empty-row {
    padding: 18px 10px !important;
    text-align: center !important;
    color: #7a877a !important;
    font-weight: 800 !important;
}

.finance-empty-block {
    padding: 18px 14px;
    border-radius: 10px;
    background: #f7faf6;
    border: 1px dashed #cddbcc;
    color: #6f7d6f;
    font-size: 14px;
    font-weight: 800;
    text-align: center;
}

/* ==========================================
   VIP 財政明細展開
   ========================================== */

.finance-log-item-cell {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.finance-detail-toggle-btn {
    flex: 0 0 auto;
    border: 1px solid #bfd4bb;
    border-radius: 999px;
    padding: 3px 10px;
    background: #f6faf5;
    color: #1b5e20;
    font-size: 12px;
    font-weight: 900;
    cursor: pointer;
}

.finance-detail-toggle-btn:hover,
.finance-detail-toggle-btn.active {
    background: #1b5e20;
    color: #ffffff;
    border-color: #1b5e20;
}

.finance-log-detail-row td {
    padding: 0 10px 10px 560px !important;
    background: #fbfdfb;
    border-bottom: 1px solid #dfe8dc;
}

.finance-log-detail-box {
    margin: 0 0 2px 0;
    padding: 10px 12px;
    border-top: 1px dashed #c6d8c0;
    background: #f7faf6;
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
}

.finance-log-detail-item {
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    color: #3a4a3a;
    font-size: 13px;
    font-weight: 700;
}

.finance-log-detail-item span {
    color: #5c6a5c;
}

.finance-log-detail-item strong {
    color: #054700;
    font-weight: 900;
    text-align: left;
}

@media (max-width: 720px) {
    .finance-log-detail-row td {
        padding: 0 10px 10px 10px !important;
    }

    .finance-log-detail-box {
        grid-template-columns: 1fr;
    }

    .finance-log-item-cell {
        align-items: flex-start;
        flex-direction: column;
        gap: 6px;
    }
}

/* ==========================================
   小標籤 / 類型文字
   ========================================== */

.finance-type-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 46px;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
    white-space: nowrap;
}

.finance-type-badge.income {
    background: #e8f5e9;
    color: #1b7f34;
}

.finance-type-badge.expense {
    background: #ffebee;
    color: #c62828;
}

/* ==========================================
   贊助商：目前合約
   ========================================== */

.sponsor-current-box {
    display: grid;
    gap: 12px;
}

.sponsor-current-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 14px 16px;
    border-radius: 12px;
    background: linear-gradient(135deg, #f6fbf4, #ffffff);
    border: 1px solid #dce8d9;
}

.sponsor-current-title {
    display: inline-flex;
    align-items: center;
    padding: 7px 12px;
    border-radius: 10px;
    background: #054700;
    color: #ffffff;
    font-size: 22px;
    font-weight: 900;
    letter-spacing: 0.5px;
    box-shadow: 0 3px 8px rgba(5, 71, 0, 0.18);
}

.sponsor-current-meta {
    margin-top: 4px;
    color: #627062;
    font-size: 13px;
    font-weight: 800;
}

.sponsor-current-amount {
    color: #1b7f34;
    font-size: 24px;
    font-weight: 900;
    white-space: nowrap;
}

.sponsor-current-details {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.sponsor-current-detail-item {
    padding: 11px 12px;
    border-radius: 10px;
    background: #f7faf6;
    border: 1px solid #e1eadf;
}

.sponsor-current-detail-label {
    color: #6a786a;
    font-size: 12px;
    font-weight: 800;
}

.sponsor-current-detail-value {
    margin-top: 3px;
    color: #1d2a1d;
    font-size: 15px;
    font-weight: 900;
}

.sponsor-rank-bonus-note {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    background: #fff8e1;
    border: 1px solid #f0d98a;
    color: #6a5200;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.5;
}

.sponsor-rank-bonus-note strong {
    color: #054700;
    font-weight: 900;
}

/* ==========================================
   贊助方案卡片
   ========================================== */

.sponsor-plan-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.sponsor-plan-card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 100%;
    padding: 16px;
    border-radius: 12px;
    border: 1px solid #d9e2d6;
    background: #ffffff;
    box-shadow: 0 2px 7px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease,
        border-color 0.15s ease;
}

.sponsor-plan-card:hover {
    transform: translateY(-2px);
    border-color: #9fbea0;
    box-shadow: 0 5px 13px rgba(0, 0, 0, 0.08);
}

.sponsor-plan-card.selected,
.sponsor-plan-card.active {
    border: 2px solid #054700;
    background: linear-gradient(180deg, #f3fbef 0%, #ffffff 58%);
    box-shadow:
        0 0 0 4px rgba(5, 71, 0, 0.12),
        0 8px 20px rgba(5, 71, 0, 0.12);
}

.sponsor-signed-stamp {
    position: absolute;
    top: 6px;
    right: 8px;
    width: 115px;
    height: auto;
    opacity: 0.96;
    pointer-events: none;
    z-index: 6;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.18));
}

.sponsor-plan-card.selected .sponsor-plan-title,
.sponsor-plan-card.selected .sponsor-plan-main {
    padding-right: 112px;
}

.sponsor-plan-card.selected .sponsor-plan-tag {
    padding: 4px 9px;
    width: fit-content;
    max-width: max-content;
}

.sponsor-plan-title {
    color: #054700;
    font-size: 20px;
    font-weight: 900;
}

.sponsor-plan-tag {
    display: inline-flex;
    align-self: flex-start;
    margin: 8px 0 10px 0;
    padding: 4px 9px;
    border-radius: 999px;
    background: #e8f3e5;
    color: #1b5e20;
    font-size: 12px;
    font-weight: 900;
}

.sponsor-plan-main {
    margin-bottom: 10px;
    color: #1d2a1d;
    font-size: 16px;
    font-weight: 900;
    line-height: 1.4;
}

.sponsor-plan-desc {
    flex: 1;
    color: #5b675b;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.55;
}

.sponsor-mini-table {
    margin: 10px 0 12px 0;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #e1eadf;
}

.sponsor-mini-table div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 7px 9px;
    background: #fafdfa;
    border-bottom: 1px solid #e1eadf;
    font-size: 13px;
}

.sponsor-mini-table div:last-child {
    border-bottom: 0;
}

.sponsor-mini-table span {
    color: #586558;
    font-weight: 800;
}

.sponsor-mini-table strong {
    color: #1b5e20;
    font-weight: 900;
    white-space: nowrap;
}

.sponsor-select-btn {
    width: 100%;
    height: 38px;
    margin-top: 12px;
    border: 0;
    border-radius: 8px;
    background: #054700;
    color: #ffffff;
    font-size: 14px;
    font-weight: 900;
    cursor: pointer;
    transition:
        background-color 0.15s ease,
        transform 0.12s ease,
        opacity 0.15s ease;
}

.sponsor-select-btn:hover {
    background: #0b6b10;
    transform: translateY(-1px);
}

.sponsor-select-btn:disabled {
    cursor: not-allowed;
    opacity: 0.55;
    transform: none;
}

/* ==========================================
   RWD
   ========================================== */

@media (max-width: 900px) {
    .finance-page {
        max-width: 100%;
    }

    .finance-card {
        padding: 16px 14px;
    }

    .finance-card-header {
        flex-direction: column;
        align-items: stretch;
    }

    .finance-summary-layout {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .finance-summary-block,
    .finance-projection-box {
        min-height: auto;
    }

    .finance-week-header {
        align-items: stretch;
    }

    .finance-week-selector-wrap {
        justify-content: space-between;
    }

    .finance-week-select {
        flex: 1;
        min-width: 0;
    }

    .sponsor-current-details {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .sponsor-plan-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .finance-page {
        padding: 0;
    }

    .finance-summary-row,
    .finance-projection-summary-row,
    .accountant-opinion-row {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .finance-summary-value,
    .finance-projection-summary-row strong {
        text-align: left;
        font-size: 20px;
    }

    .finance-cash-row .finance-summary-value,
    .finance-projection-cash-row strong {
        font-size: 28px;
    }

    .accountant-opinion-content {
        padding-right: 0;
    }

    .finance-weekly-summary {
        flex-direction: column;
        align-items: flex-start;
    }

    .sponsor-current-main {
        grid-template-columns: 1fr;
    }

    .sponsor-current-amount {
        font-size: 22px;
    }

    .sponsor-current-details {
        grid-template-columns: 1fr;
    }

    .sponsor-signed-stamp {
        width: 96px;
    }

    .sponsor-plan-card.selected .sponsor-plan-title,
    .sponsor-plan-card.selected .sponsor-plan-main {
        padding-right: 92px;
    }
}