<?php
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
?>
<link rel="stylesheet" href="<?php echo $skin_url;?>/assets/css/morris.css">
<script src="<?php echo $skin_url;?>/assets/js/raphael-min.js"></script>
<script src="<?php echo $skin_url;?>/assets/js/morris.min.js"></script>

<style>
/* ═══════════════════════════════════════════════════════
   Dashboard Modern Layout — light + dark adaptive
   ═══════════════════════════════════════════════════════ */

.db-section { margin-bottom: 28px; }

/* ── Page header ── */
.db-header {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 0;      /* top=bottom → 아이콘·텍스트가 전체 높이 기준 수직 중앙 */
    margin-bottom: 14px;
    border-bottom: 1px solid #e5e7eb;
}
.db-header-icon {
    width: 36px; height: 36px;
    border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    color: #fff !important; font-size: 16px; flex-shrink: 0;
}
.db-header-text { min-width: 0; }
.db-header-title {
    font-size: 16px; font-weight: 700;
    margin: 0 !important; line-height: 1.3;
    color: #111827; letter-spacing: -0.2px;
    white-space: nowrap;
}
.db-header-sub {
    display: inline;
    font-size: 11.5px; font-weight: 400; color: #9ca3af;
    margin-left: 10px;
    padding-left: 10px;
    border-left: 1px solid #d1d5db;
    white-space: nowrap;
    vertical-align: baseline;
}

/* ── Stat cards grid ── */
.db-stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 20px;
}
.db-stat-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 20px 18px 0;
    display: flex; flex-direction: column;
    text-decoration: none !important;
    color: inherit !important;
    transition: box-shadow 0.18s, transform 0.18s;
    overflow: hidden;
}
.db-stat-card:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}
.db-stat-top {
    display: flex; align-items: flex-start;
    justify-content: space-between; gap: 12px;
    margin-bottom: 16px;
}
.db-stat-icon {
    width: 52px; height: 52px;
    border-radius: 13px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; flex-shrink: 0;
    /* 항상 흰색 아이콘 — 라이트/다크 모드 불문 */
    color: #fff !important;
}
.db-stat-right { text-align: right; min-width: 0; }
.db-stat-number {
    font-size: 30px; font-weight: 800; line-height: 1;
    color: #111827; letter-spacing: -0.5px;
    font-variant-numeric: tabular-nums;
}
.db-stat-label {
    font-size: 11.5px; color: #9ca3af; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.06em; margin-top: 5px;
}
.db-stat-footer {
    display: flex; align-items: center; justify-content: space-between;
    padding: 11px 0;
    border-top: 1px solid #f3f4f6;
    font-size: 12.5px; color: #6b7280;
    margin-top: auto;
}
.db-stat-footer i { font-size: 11px; }
.db-stat-card:hover .db-stat-footer { color: #4f46e5; }

/* ── Accent colors (icon bubble — always vivid) ── */
.db-c-indigo  .db-stat-icon { background: linear-gradient(135deg, #4338ca, #6366f1); }
.db-c-amber   .db-stat-icon { background: linear-gradient(135deg, #b45309, #f59e0b); }
.db-c-rose    .db-stat-icon { background: linear-gradient(135deg, #be123c, #f43f5e); }
.db-c-emerald .db-stat-icon { background: linear-gradient(135deg, #047857, #10b981); }
.db-c-violet  .db-stat-icon { background: linear-gradient(135deg, #6d28d9, #a78bfa); }
.db-c-orange  .db-stat-icon { background: linear-gradient(135deg, #c2410c, #fb923c); }

/* ── Chart panel ── */
.db-chart-panel {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    overflow: hidden;
    margin-bottom: 20px;
}
.db-chart-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid #f3f4f6;
}
.db-chart-title {
    font-size: 13.5px; font-weight: 600;
    display: flex; align-items: center; gap: 7px;
    color: #374151; margin: 0;
}
.db-chart-link {
    font-size: 12.5px; color: #4f46e5;
    text-decoration: none;
    display: flex; align-items: center; gap: 3px;
}
.db-chart-link:hover { color: #3730a3; text-decoration: none; }
.db-chart-body { padding: 16px 20px 8px; }
#morris-chart-sales, #morris-chart-profit { min-height: 200px; }

/* ── Info grid ── */
.db-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 20px;
}
.db-info-panel {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    overflow: hidden;
}
.db-info-header {
    padding: 13px 18px;
    border-bottom: 1px solid #f3f4f6;
    font-size: 13px; font-weight: 600; color: #374151;
    display: flex; align-items: center; gap: 7px;
}
.db-info-table { width: 100%; border-collapse: collapse; }
.db-info-table td {
    padding: 10px 18px; font-size: 13px; color: #374151;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: middle;
}
.db-info-table tr:last-child td { border-bottom: none; }
.db-info-table .db-th td {
    background: #f9fafb; font-weight: 700; font-size: 12px;
    color: #6b7280; text-transform: uppercase; letter-spacing: 0.04em;
    padding: 8px 18px;
}
.db-badge {
    display: inline-block; padding: 2px 8px; border-radius: 999px;
    font-size: 11px; font-weight: 600;
}
.db-badge-green  { background: #d1fae5; color: #065f46; }
.db-badge-blue   { background: #dbeafe; color: #1e40af; }
.db-badge-gray   { background: #f3f4f6; color: #374151; }
.db-badge-red    { background: #fee2e2; color: #991b1b; }

/* ── Notice banner ── */
.db-notice {
    background: #f0fdf4; border: 1px solid #bbf7d0;
    border-radius: 10px; padding: 13px 18px;
    margin-bottom: 18px; font-size: 13.5px; color: #065f46;
    display: flex; align-items: flex-start; gap: 10px;
}
.db-notice-close {
    margin-left: auto; background: none; border: none;
    cursor: pointer; color: inherit; opacity: 0.6; font-size: 16px;
    line-height: 1; padding: 0; flex-shrink: 0;
}

/* ── Divider between seller/marketer sections ── */
.db-section-divider {
    border: none; border-top: 1px solid #e5e7eb;
    margin: 28px 0;
}

/* ═══════════════════════════════════════════════════════
   DARK MODE
   ═══════════════════════════════════════════════════════ */
[data-site-theme="dark"] .db-header { border-bottom-color: #3a3a42; }
[data-site-theme="dark"] .db-header-title { color: #f0f0f4; }
[data-site-theme="dark"] .db-header-sub   { color: #71717a; border-left-color: #3a3a42; }

[data-site-theme="dark"] .db-stat-card {
    background: #252530;
    border-color: #3a3a42;
}
[data-site-theme="dark"] .db-stat-card:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.35);
}
[data-site-theme="dark"] .db-stat-number { color: #f0f0f4; }
[data-site-theme="dark"] .db-stat-label  { color: #71717a; }
[data-site-theme="dark"] .db-stat-footer {
    border-top-color: #3a3a42; color: #71717a;
}
[data-site-theme="dark"] .db-stat-card:hover .db-stat-footer { color: #818cf8; }

[data-site-theme="dark"] .db-chart-panel,
[data-site-theme="dark"] .db-info-panel {
    background: #252530;
    border-color: #3a3a42;
}
[data-site-theme="dark"] .db-chart-header,
[data-site-theme="dark"] .db-info-header {
    border-bottom-color: #3a3a42; color: #d4d4d8;
}
[data-site-theme="dark"] .db-chart-title { color: #d4d4d8; }
[data-site-theme="dark"] .db-chart-link  { color: #818cf8; }
[data-site-theme="dark"] .db-chart-link:hover { color: #a5b4fc; }

[data-site-theme="dark"] .db-info-table td {
    color: #c4c4cc; border-bottom-color: #3a3a42;
}
[data-site-theme="dark"] .db-info-table .db-th td {
    background: #1e1e22; color: #71717a;
}
[data-site-theme="dark"] .db-badge-green  { background: #022c22; color: #6ee7b7; }
[data-site-theme="dark"] .db-badge-blue   { background: #1e3a5f; color: #93c5fd; }
[data-site-theme="dark"] .db-badge-gray   { background: #3a3a42; color: #c4c4cc; }
[data-site-theme="dark"] .db-badge-red    { background: #450a0a; color: #fca5a5; }
[data-site-theme="dark"] .db-notice {
    background: #022c22; border-color: #064e3b; color: #6ee7b7;
}
[data-site-theme="dark"] .db-section-divider { border-top-color: #3a3a42; }

/* Morris chart SVG text in dark mode */
[data-site-theme="dark"] #morris-chart-sales text,
[data-site-theme="dark"] #morris-chart-profit text { fill: #71717a !important; }

/* ── Responsive ── */
@media (max-width: 991px) {
    .db-stat-grid  { grid-template-columns: repeat(2, 1fr); }
    .db-info-grid  { grid-template-columns: 1fr; }
}
@media (max-width: 575px) {
    .db-stat-grid  { grid-template-columns: 1fr; }
}
</style>

<?php /* ════════════════════════════════════════════════════
         SELLER DASHBOARD
         ════════════════════════════════════════════════════ */
if (IS_SELLER): ?>

<div class="db-section" style="margin-top:36px">
    <div class="db-header" style="display:flex;flex-direction:row;align-items:center;gap:11px;padding-bottom:14px;margin-bottom:14px;border-bottom:1px solid #e5e7eb;">
        <div class="db-header-icon" style="width:36px;height:36px;min-width:36px;border-radius:9px;background:linear-gradient(135deg,#4338ca,#6366f1);display:flex;align-items:center;justify-content:center;color:#fff;font-size:16px;flex-shrink:0;">
            <i class="fa fa-shopping-cart"></i>
        </div>
        <div class="db-header-text" style="line-height:36px;overflow:hidden;">
            <span class="db-header-title" style="vertical-align:middle;">판매자(셀러) 대시보드</span><span class="db-header-sub" style="vertical-align:middle;margin-left:10px;padding-left:10px;border-left:1px solid #d1d5db;"><?php echo date('Y년 m월 d일', G5_SERVER_TIME); ?> 기준</span>
        </div>
    </div>

    <div class="db-stat-grid">

        <a href="./?ap=saleitem" class="db-stat-card db-c-indigo">
            <div class="db-stat-top">
                <div class="db-stat-icon"><i class="fa fa-shopping-cart fa-lg"></i></div>
                <div class="db-stat-right">
                    <div class="db-stat-number"><?php echo number_format($today_sales); ?></div>
                    <div class="db-stat-label">Today's Sales</div>
                </div>
            </div>
            <div class="db-stat-footer">판매자료 보기 <i class="fa fa-angle-right"></i></div>
        </a>

        <a href="./?ap=comment" class="db-stat-card db-c-amber">
            <div class="db-stat-top">
                <div class="db-stat-icon"><i class="fa fa-comments fa-lg"></i></div>
                <div class="db-stat-right">
                    <div class="db-stat-number"><?php echo number_format($today_comments); ?></div>
                    <div class="db-stat-label">Today's Comments</div>
                </div>
            </div>
            <div class="db-stat-footer">댓글관리 보기 <i class="fa fa-angle-right"></i></div>
        </a>

        <a href="./?ap=qalist" class="db-stat-card db-c-rose">
            <div class="db-stat-top">
                <div class="db-stat-icon"><i class="fa fa-question-circle fa-lg"></i></div>
                <div class="db-stat-right">
                    <div class="db-stat-number"><?php echo number_format($today_questions); ?></div>
                    <div class="db-stat-label">Today's Questions</div>
                </div>
            </div>
            <div class="db-stat-footer">문의관리 보기 <i class="fa fa-angle-right"></i></div>
        </a>

        <a href="./?ap=uselist" class="db-stat-card db-c-emerald">
            <div class="db-stat-top">
                <div class="db-stat-icon"><i class="fa fa-star fa-lg"></i></div>
                <div class="db-stat-right">
                    <div class="db-stat-number"><?php echo number_format($today_reviews); ?></div>
                    <div class="db-stat-label">Today's Reviews</div>
                </div>
            </div>
            <div class="db-stat-footer">후기관리 보기 <i class="fa fa-angle-right"></i></div>
        </a>

    </div><!-- /.db-stat-grid -->

    <div class="db-chart-panel">
        <div class="db-chart-header">
            <span class="db-chart-title">
                <i class="fa fa-line-chart" style="color:#4f46e5"></i> 최근 30일 판매 추이
            </span>
            <a href="./?ap=salelist" class="db-chart-link">
                전체 보기 <i class="fa fa-angle-right"></i>
            </a>
        </div>
        <div class="db-chart-body" style="position:relative;">
            <div id="morris-chart-sales"></div>
            <div id="morris-chart-sales-empty" style="display:none;position:absolute;inset:0;flex-direction:column;align-items:center;justify-content:center;gap:8px;pointer-events:none;">
                <i class="fa fa-bar-chart" style="font-size:28px;color:#9ca3af;opacity:0.45;"></i>
                <span style="font-size:12.5px;color:#9ca3af;">최근 30일 판매 내역이 없습니다</span>
            </div>
        </div>
    </div>
</div><!-- /.db-section seller -->

<script>
(function(){
    var salesData = [
        <?php for ($i = 0; $i < count($list); $i++): ?>
        { d: '<?php echo $list[$i]['date']; ?>', sales: <?php echo (int)$list[$i]['sale']; ?> },
        <?php endfor; ?>
    ];
    var hasData = salesData.length > 0;

    /* 데이터 없을 때: 최근 7일 0값 플레이스홀더 */
    if (!hasData) {
        var now = new Date();
        for (var i = 6; i >= 0; i--) {
            var d = new Date(now); d.setDate(d.getDate() - i);
            var yy = d.getFullYear();
            var mm = String(d.getMonth()+1).padStart(2,'0');
            var dd = String(d.getDate()).padStart(2,'0');
            salesData.push({ d: yy+'-'+mm+'-'+dd, sales: 0 });
        }
    }

    var salesChart = null;
    function drawSalesChart() {
        var isDark = document.documentElement.getAttribute('data-site-theme') === 'dark';
        var el = document.getElementById('morris-chart-sales');
        if (!el) return;
        el.innerHTML = '';
        salesChart = Morris.Area({
            element: 'morris-chart-sales',
            data: salesData,
            xkey: 'd',
            ykeys: ['sales'],
            labels: ['판매액'],
            lineColors: ['#4f46e5'],
            fillOpacity: hasData ? 0.12 : 0.04,
            smooth: true,
            gridTextColor: isDark ? '#6b7280' : '#9ca3af',
            gridLineColor: isDark ? '#3a3a42' : '#e5e7eb',
            gridTextSize: 11,
            resize: true,
        });
        /* 빈 데이터 오버레이 표시/숨김 */
        var ov = document.getElementById('morris-chart-sales-empty');
        if (ov) ov.style.display = hasData ? 'none' : 'flex';
    }
    drawSalesChart();
    new MutationObserver(drawSalesChart)
        .observe(document.documentElement, { attributes: true, attributeFilter: ['data-site-theme'] });
})();
</script>

<?php endif; /* IS_SELLER */ ?>


<?php /* ════════════════════════════════════════════════════
         MARKETER DASHBOARD
         ════════════════════════════════════════════════════ */
if (IS_MARKETER): ?>

<?php if (IS_SELLER): ?><hr class="db-section-divider"><?php endif; ?>

<div class="db-section"<?php if (!IS_SELLER): ?> style="margin-top:36px"<?php endif; ?>>
    <div class="db-header" style="display:flex;flex-direction:row;align-items:center;gap:11px;padding-bottom:14px;margin-bottom:14px;border-bottom:1px solid #e5e7eb;">
        <div class="db-header-icon" style="width:36px;height:36px;min-width:36px;border-radius:9px;background:linear-gradient(135deg,#047857,#10b981);display:flex;align-items:center;justify-content:center;color:#fff;font-size:16px;flex-shrink:0;">
            <i class="fa fa-database"></i>
        </div>
        <div class="db-header-text" style="line-height:36px;overflow:hidden;">
            <span class="db-header-title" style="vertical-align:middle;">추천인(마케터) 대시보드</span><span class="db-header-sub" style="vertical-align:middle;margin-left:10px;padding-left:10px;border-left:1px solid #d1d5db;"><?php echo date('Y년 m월 d일', G5_SERVER_TIME); ?> 기준</span>
        </div>
    </div>

    <div class="db-stat-grid">

        <a href="./?ap=mitemlist" class="db-stat-card db-c-indigo">
            <div class="db-stat-top">
                <div class="db-stat-icon"><i class="fa fa-won fa-lg"></i></div>
                <div class="db-stat-right">
                    <div class="db-stat-number"><?php echo number_format($today_profit); ?></div>
                    <div class="db-stat-label">Today's Profit</div>
                </div>
            </div>
            <div class="db-stat-footer">수익내역 보기 <i class="fa fa-angle-right"></i></div>
        </a>

        <div class="db-stat-card db-c-orange">
            <div class="db-stat-top">
                <div class="db-stat-icon"><i class="fa fa-fire fa-lg"></i></div>
                <div class="db-stat-right">
                    <div class="db-stat-number">Lv.<?php echo (int)$partner['pt_level']; ?></div>
                    <div class="db-stat-label">My Level</div>
                </div>
            </div>
            <div class="db-stat-footer">
                <span>보너스 × <?php echo number_format($partner['pt_level_benefit']); ?>%</span>
                <i class="fa fa-bolt"></i>
            </div>
        </div>

        <div class="db-stat-card db-c-violet">
            <div class="db-stat-top">
                <div class="db-stat-icon"><i class="fa fa-gift fa-lg"></i></div>
                <div class="db-stat-right">
                    <div class="db-stat-number"><?php echo number_format($partner['pt_benefit']); ?>%</div>
                    <div class="db-stat-label">My Incentive</div>
                </div>
            </div>
            <div class="db-stat-footer">
                <span>기본 인센티브율</span>
                <i class="fa fa-percent"></i>
            </div>
        </div>

        <div class="db-stat-card db-c-emerald">
            <div class="db-stat-top">
                <div class="db-stat-icon"><i class="fa fa-cubes fa-lg"></i></div>
                <div class="db-stat-right">
                    <div class="db-stat-number"><?php echo number_format($partner['pt_level_benefit'] + $partner['pt_benefit']); ?>%</div>
                    <div class="db-stat-label">Total Incentive</div>
                </div>
            </div>
            <div class="db-stat-footer">
                <span>레벨 보너스 포함 총합</span>
                <i class="fa fa-check"></i>
            </div>
        </div>

    </div><!-- /.db-stat-grid -->

    <div class="db-chart-panel">
        <div class="db-chart-header">
            <span class="db-chart-title">
                <i class="fa fa-line-chart" style="color:#059669"></i> 최근 30일 수익 추이
            </span>
            <a href="./?ap=mlist" class="db-chart-link">
                전체 보기 <i class="fa fa-angle-right"></i>
            </a>
        </div>
        <div class="db-chart-body" style="position:relative;">
            <div id="morris-chart-profit"></div>
            <div id="morris-chart-profit-empty" style="display:none;position:absolute;inset:0;flex-direction:column;align-items:center;justify-content:center;gap:8px;pointer-events:none;">
                <i class="fa fa-bar-chart" style="font-size:28px;color:#9ca3af;opacity:0.45;"></i>
                <span style="font-size:12.5px;color:#9ca3af;">최근 30일 수익 내역이 없습니다</span>
            </div>
        </div>
    </div>
</div><!-- /.db-section marketer -->

<script>
(function(){
    var profitData = [
        <?php for ($i = 0; $i < count($list2); $i++): ?>
        { d: '<?php echo $list2[$i]['date']; ?>', profit: <?php echo (int)$list2[$i]['profit']; ?> },
        <?php endfor; ?>
    ];
    var hasData = profitData.length > 0;

    /* 데이터 없을 때: 최근 7일 0값 플레이스홀더 */
    if (!hasData) {
        var now = new Date();
        for (var i = 6; i >= 0; i--) {
            var d = new Date(now); d.setDate(d.getDate() - i);
            var yy = d.getFullYear();
            var mm = String(d.getMonth()+1).padStart(2,'0');
            var dd = String(d.getDate()).padStart(2,'0');
            profitData.push({ d: yy+'-'+mm+'-'+dd, profit: 0 });
        }
    }

    var profitChart = null;
    function drawProfitChart() {
        var isDark = document.documentElement.getAttribute('data-site-theme') === 'dark';
        var el = document.getElementById('morris-chart-profit');
        if (!el) return;
        el.innerHTML = '';
        profitChart = Morris.Area({
            element: 'morris-chart-profit',
            data: profitData,
            xkey: 'd',
            ykeys: ['profit'],
            labels: ['수익액'],
            lineColors: ['#10b981'],
            fillOpacity: hasData ? 0.12 : 0.04,
            smooth: true,
            gridTextColor: isDark ? '#6b7280' : '#9ca3af',
            gridLineColor: isDark ? '#3a3a42' : '#e5e7eb',
            gridTextSize: 11,
            resize: true,
        });
        /* 빈 데이터 오버레이 표시/숨김 */
        var ov = document.getElementById('morris-chart-profit-empty');
        if (ov) ov.style.display = hasData ? 'none' : 'flex';
    }
    drawProfitChart();
    new MutationObserver(drawProfitChart)
        .observe(document.documentElement, { attributes: true, attributeFilter: ['data-site-theme'] });
})();
</script>

<?php endif; /* IS_MARKETER */ ?>


<?php /* ════════════════════════════════════════════════════
         COMMON: Notice + Account + Info
         ════════════════════════════════════════════════════ */
?>

<?php if ($notice): ?>
<div class="db-notice" id="db-notice-banner">
    <i class="fa fa-bullhorn" style="margin-top:2px;flex-shrink:0"></i>
    <span><?php echo $notice; ?></span>
    <button class="db-notice-close" onclick="this.parentNode.style.display='none'" type="button">&times;</button>
</div>
<?php endif; ?>

<div class="db-info-grid">

    <div class="db-info-panel">
        <div class="db-info-header">
            <i class="fa fa-calculator" style="color:#4f46e5"></i> 최근 출금내역
        </div>
        <table class="db-info-table">
            <tr class="db-th">
                <td class="text-center">상태</td>
                <td class="text-center">신청일</td>
                <td class="text-center">접수번호</td>
                <td class="text-right">신청금액</td>
                <td class="text-center">방법</td>
            </tr>
            <?php if (count($account) > 0): ?>
                <?php foreach ($account as $acc): ?>
                <tr>
                    <td class="text-center">
                        <?php
                        $bc = 'gray';
                        if ($acc['pp_confirm'] === '완료') $bc = 'green';
                        elseif ($acc['pp_confirm'] === '취소') $bc = 'red';
                        elseif ($acc['pp_confirm'] === '신청') $bc = 'blue';
                        ?>
                        <span class="db-badge db-badge-<?php echo $bc; ?>"><?php echo $acc['pp_confirm']; ?></span>
                    </td>
                    <td class="text-center"><?php echo $acc['pp_date']; ?></td>
                    <td class="text-center"><?php echo $acc['pp_no']; ?></td>
                    <td class="text-right"><?php echo number_format($acc['pp_amount']); ?></td>
                    <td class="text-center"><?php echo $acc['pp_means']; ?></td>
                </tr>
                <?php endforeach; ?>
            <?php else: ?>
                <tr><td colspan="5" class="text-center" style="padding:20px;color:#9ca3af">등록된 자료가 없습니다.</td></tr>
            <?php endif; ?>
        </table>
    </div>

    <div class="db-info-panel">
        <div class="db-info-header">
            <i class="fa fa-user-circle-o" style="color:#4f46e5"></i> 내 정보
        </div>
        <table class="db-info-table">
            <tr>
                <td style="width:90px;color:#9ca3af;font-size:12px;font-weight:600">기업정보</td>
                <td><?php echo $company_info; ?></td>
            </tr>
            <tr>
                <td style="color:#9ca3af;font-size:12px;font-weight:600">담당정보</td>
                <td><?php echo ($partner['pt_name']) ? htmlspecialchars($partner['pt_name']).' ('.htmlspecialchars($partner['pt_hp']).', '.htmlspecialchars($partner['pt_email']).')' : '<span style="color:#9ca3af">미등록</span>'; ?></td>
            </tr>
            <tr>
                <td style="color:#9ca3af;font-size:12px;font-weight:600">정산유형</td>
                <td><?php echo ($partner['pt_company']) ? htmlspecialchars($partner['pt_company']) : '<span style="color:#9ca3af">미등록</span>'; ?></td>
            </tr>
            <tr>
                <td style="color:#9ca3af;font-size:12px;font-weight:600">정산방법</td>
                <td><?php echo $account_info; ?></td>
            </tr>
            <tr>
                <td style="color:#9ca3af;font-size:12px;font-weight:600">입금계좌</td>
                <td>
                    <?php if ($partner['pt_bank_name']): ?>
                        <?php echo htmlspecialchars($partner['pt_bank_name']); ?>
                        <?php echo htmlspecialchars($partner['pt_bank_account']); ?>
                        <?php echo htmlspecialchars($partner['pt_bank_holder']); ?>
                    <?php else: ?>
                        <span style="color:#9ca3af">미등록</span>
                    <?php endif; ?>
                </td>
            </tr>
            <?php if ($message): ?>
            <tr>
                <td colspan="2" style="padding:12px 18px">
                    <div style="background:#f0f9ff;border:1px solid #bae6fd;border-radius:8px;padding:10px 14px;font-size:13px;color:#0369a1">
                        <?php echo $message; ?>
                    </div>
                </td>
            </tr>
            <?php endif; ?>
        </table>
    </div>

</div><!-- /.db-info-grid -->
