<?php
/**
 * GT BOGO Engine — Enterprise UI Wrapper Start
 * Full design system. NO <!DOCTYPE html> — WP owns the document.
 */
if (!defined('ABSPATH')) exit;

$_gt_tab    = isset($_GET['tab'])  ? sanitize_text_field(wp_unslash($_GET['tab']))  : 'dashboard';
$_gt_page   = isset($_GET['page']) ? sanitize_text_field(wp_unslash($_GET['page'])) : 'gt-bogo-engine';
$_gt_url    = defined('GT_BOGO_ENGINE_URL') ? GT_BOGO_ENGINE_URL : plugin_dir_url(dirname(dirname(__FILE__)));
$_gt_ver    = defined('GT_BOGO_VERSION')    ? GT_BOGO_VERSION    : '3.10.1';
$_gt_is_pro = get_option('gtbogo_license_status') === 'active';
$_gt_expires= get_option('gtbogo_license_expires', '');
$_gt_days   = 0;
if ($_gt_is_pro && $_gt_expires) {
    $_gt_days = (int) ceil((strtotime($_gt_expires) - time()) / 86400);
}

function _gt_nav($tab, $label, $icon, $badge = '') {
    global $_gt_tab;
    $active = $_gt_tab === $tab ? 'gt-nav-active' : '';
    $url = admin_url('admin.php?page=gt-bogo-engine&tab=' . $tab);
    $b = $badge ? '<span class="gt-nav-badge">' . esc_html($badge) . '</span>' : '';
    echo '<li><a href="' . esc_url($url) . '" class="gt-nav-link ' . $active . '">'
       . '<span class="gt-nav-icon">' . $icon . '</span>'
       . '<span class="gt-nav-label">' . esc_html($label) . '</span>'
       . $b . '</a></li>';
}
?>
<link href="https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800;900&family=DM+Mono:wght@400;500&display=swap" rel="stylesheet">
<style>
/* ═══════════════════════════════════════════════════
   GT BOGO ENGINE — OBSIDIAN COMMAND CENTER
   Design System v4.0
═══════════════════════════════════════════════════ */
:root {
  --gt-bg:         #020617;
  --gt-nav:        #060d1f;
  --gt-card:       #0a1628;
  --gt-card-hover: #0d1c32;
  --gt-border:     rgba(255,255,255,0.06);
  --gt-border-md:  rgba(255,255,255,0.10);
  --gt-red:        #e10000;
  --gt-red-glow:   rgba(225,0,0,0.35);
  --gt-red-soft:   rgba(225,0,0,0.12);
  --gt-green:      #22c55e;
  --gt-yellow:     #f59e0b;
  --gt-blue:       #3b82f6;
  --gt-white:      #ffffff;
  --gt-soft:       #94a3b8;
  --gt-subtle:     #475569;
  --gt-r:          12px;
  --gt-r-lg:       16px;
  --gt-sidebar-w:  252px;
}

/* ── WP isolation ── */
#wpadminbar,#wpfooter,.update-nag,.notice:not(.gt-keep),.wp-header-end{display:none!important}
#wpbody-content,#wpcontent{padding:0!important;background:var(--gt-bg)!important}
body.wp-admin{background:var(--gt-bg)!important;font-family:'Outfit',sans-serif!important}
#wpbody-content>.wrap{margin:0;padding:0}

/* ── Layout shell ── */
.gt-shell{display:flex;min-height:100vh;background:var(--gt-bg);font-family:'Outfit',sans-serif;color:var(--gt-white);position:relative}

/* ── Animated background grid ── */
.gt-shell::before{
  content:'';position:fixed;inset:0;pointer-events:none;
  background-image:
    linear-gradient(rgba(255,255,255,0.018) 1px,transparent 1px),
    linear-gradient(90deg,rgba(255,255,255,0.018) 1px,transparent 1px);
  background-size:48px 48px;z-index:0;
}

/* ── Sidebar ── */
.gt-sidebar{
  width:var(--gt-sidebar-w);min-width:var(--gt-sidebar-w);
  background:var(--gt-nav);
  border-right:1px solid var(--gt-border);
  display:flex;flex-direction:column;
  position:fixed;top:32px;left:160px;height:calc(100vh - 32px);overflow-y:auto;z-index:9999;
  scrollbar-width:none;
}
.gt-sidebar::-webkit-scrollbar{display:none}

.gt-brand{
  display:flex;align-items:center;gap:12px;
  padding:20px 16px;
  border-bottom:1px solid var(--gt-border);
  text-decoration:none;
  background:linear-gradient(180deg,rgba(225,0,0,0.06) 0%,transparent 100%);
}
.gt-brand:hover{background:linear-gradient(180deg,rgba(225,0,0,0.1) 0%,transparent 100%)}
.gt-brand-icon{
  width:52px;height:52px;border-radius:10px;
  display:flex;align-items:center;justify-content:center;
  flex-shrink:0;
  box-shadow:0 0 24px var(--gt-red-glow),0 4px 12px rgba(0,0,0,0.4);
}
.gt-brand-text{display:flex;flex-direction:column;gap:3px}
.gt-brand-name{font-size:14px;font-weight:800;letter-spacing:1.5px;color:var(--gt-white);line-height:1;text-transform:uppercase}
.gt-brand-sub{font-size:10px;color:var(--gt-red);margin-top:0;letter-spacing:1px;font-weight:700;text-transform:uppercase}

/* License pill */
.gt-lic-pill{
  display:flex;align-items:center;gap:8px;
  margin:12px 14px 4px;
  padding:8px 12px;border-radius:50px;
  font-size:11px;font-weight:700;letter-spacing:0.5px;
  border:1px solid;
}
.gt-lic-pill.pro{background:rgba(34,197,94,0.08);border-color:rgba(34,197,94,0.25);color:#86efac}
.gt-lic-pill.free{background:rgba(100,116,139,0.08);border-color:rgba(100,116,139,0.2);color:var(--gt-soft)}
.gt-pulse{
  width:7px;height:7px;border-radius:50%;flex-shrink:0;
  background:var(--gt-green);
  box-shadow:0 0 8px var(--gt-green);
  animation:gtp-pulse 2s ease-in-out infinite;
}
.gt-pulse.gray{background:var(--gt-subtle);box-shadow:none;animation:none}
@keyframes gtp-pulse{0%,100%{opacity:1;transform:scale(1)}50%{opacity:0.5;transform:scale(0.85)}}

/* Nav */
.gt-nav-section{padding:10px 0 4px;flex:1}
.gt-nav-sep{padding:10px 18px 4px;font-size:9px;font-weight:700;letter-spacing:1.5px;text-transform:uppercase;color:var(--gt-subtle)}
.gt-nav-list{list-style:none;margin:0;padding:0 8px}
.gt-nav-link{
  display:flex;align-items:center;gap:10px;
  padding:9px 10px;border-radius:8px;
  color:var(--gt-soft);font-size:13px;font-weight:500;
  text-decoration:none;transition:all 0.18s;
  position:relative;cursor:pointer;
}
.gt-nav-link:hover{color:var(--gt-white);background:rgba(255,255,255,0.04)}
.gt-nav-active{
  color:var(--gt-white)!important;
  background:rgba(225,0,0,0.1)!important;
  font-weight:600!important;
}
.gt-nav-active::before{
  content:'';position:absolute;left:-8px;top:50%;transform:translateY(-50%);
  width:3px;height:18px;border-radius:3px;
  background:var(--gt-red);box-shadow:0 0 10px var(--gt-red-glow);
}
.gt-nav-icon{font-size:15px;width:20px;text-align:center;flex-shrink:0;margin-right:8px}
.gt-nav-label{flex:1}
.gt-nav-badge{
  font-size:9px;font-weight:800;letter-spacing:0.8px;
  padding:2px 7px;border-radius:50px;
  background:var(--gt-red);color:#fff;
  box-shadow:0 0 8px var(--gt-red-glow);
}

/* Sidebar footer */
.gt-sidebar-foot{
  padding:14px 18px;
  border-top:1px solid var(--gt-border);
}
.gt-sidebar-ver{font-size:10px;color:var(--gt-subtle);font-family:'DM Mono',monospace}

/* Upgrade box */
.gt-upgrade-box{
  margin:12px;padding:14px;border-radius:10px;
  background:linear-gradient(135deg,rgba(225,0,0,0.12),rgba(225,0,0,0.04));
  border:1px solid rgba(225,0,0,0.2);
}
.gt-upgrade-box h4{font-size:12px;font-weight:700;color:var(--gt-white);margin:0 0 4px}
.gt-upgrade-box p{font-size:11px;color:var(--gt-soft);margin:0 0 10px;line-height:1.4}
.gt-upgrade-btn{
  display:block;text-align:center;
  padding:7px;border-radius:50px;
  background:var(--gt-red);color:#fff;
  font-size:11px;font-weight:700;text-decoration:none;
  box-shadow:0 0 12px var(--gt-red-glow);
  transition:all 0.2s;
}
.gt-upgrade-btn:hover{background:#c50000;box-shadow:0 0 20px var(--gt-red-glow);color:#fff}

/* ── Main ── */
.gt-main{
  flex:1;padding:32px 36px;overflow-x:hidden;
  background:var(--gt-bg);z-index:1;position:relative;
  min-width:0;margin-left:var(--gt-sidebar-w);
}

/* ── Page header ── */
.gt-page-head{
  display:flex;align-items:flex-start;justify-content:space-between;
  margin-bottom:28px;gap:16px;flex-wrap:wrap;
}
.gt-page-title{
  font-size:28px;font-weight:800;color:var(--gt-white);
  margin:0 0 5px;letter-spacing:-0.5px;
}
.gt-page-sub{font-size:14px;color:var(--gt-soft);margin:0}
.gt-page-actions{display:flex;gap:10px;align-items:center;flex-wrap:wrap}

/* ── Cards ── */
.gt-card{
  background:var(--gt-card);
  border:1px solid var(--gt-border);
  border-radius:var(--gt-r-lg);
  padding:24px;margin-bottom:20px;
  transition:border-color 0.2s,background 0.2s;
}
.gt-card:hover{border-color:var(--gt-border-md)}
.gt-card-head{
  display:flex;align-items:center;justify-content:space-between;
  margin-bottom:20px;padding-bottom:16px;
  border-bottom:1px solid var(--gt-border);
}
.gt-card-title{font-size:15px;font-weight:700;color:var(--gt-white);margin:0}
.gt-card-label{
  font-size:10px;font-weight:700;letter-spacing:1.2px;
  text-transform:uppercase;color:var(--gt-subtle);margin-bottom:8px;
}

/* Gradient border card */
.gt-card-premium{
  position:relative;background:var(--gt-card);border-radius:var(--gt-r-lg);
  padding:24px;margin-bottom:20px;
}
.gt-card-premium::before{
  content:'';position:absolute;inset:0;border-radius:var(--gt-r-lg);
  padding:1px;
  background:linear-gradient(135deg,rgba(225,0,0,0.4),rgba(255,255,255,0.04),rgba(59,130,246,0.2));
  -webkit-mask:linear-gradient(#fff 0 0) content-box,linear-gradient(#fff 0 0);
  -webkit-mask-composite:xor;mask-composite:exclude;
  pointer-events:none;
}

/* ── Metric Grid ── */
.gt-metrics{
  display:grid;grid-template-columns:repeat(4,1fr);gap:16px;margin-bottom:20px;
}
.gt-metric{
  background:var(--gt-card);border:1px solid var(--gt-border);
  border-radius:var(--gt-r-lg);padding:20px;
  border-top:2px solid var(--gt-metric-c,var(--gt-red));
  position:relative;overflow:hidden;transition:all 0.2s;
}
.gt-metric::after{
  content:'';position:absolute;top:-20px;right:-20px;
  width:80px;height:80px;border-radius:50%;
  background:var(--gt-metric-c,var(--gt-red));opacity:0.05;
  filter:blur(20px);
}
.gt-metric:hover{transform:translateY(-2px);border-color:var(--gt-metric-c,var(--gt-red))}
.gt-metric-icon{font-size:22px;margin-bottom:14px;display:block;line-height:1}
.gt-metric-label{font-size:10px;font-weight:700;letter-spacing:1px;text-transform:uppercase;color:var(--gt-soft);margin-bottom:6px}
.gt-metric-value{font-size:28px;font-weight:800;color:var(--gt-white);font-family:'DM Mono',monospace;letter-spacing:-1px;margin-bottom:4px}
.gt-metric-trend{font-size:11px;color:var(--gt-subtle)}

/* ── Grid layouts ── */
.gt-grid-3{display:grid;grid-template-columns:repeat(3,1fr);gap:16px}
.gt-grid-2{display:grid;grid-template-columns:repeat(2,1fr);gap:16px}
.gt-grid-4{display:grid;grid-template-columns:repeat(4,1fr);gap:16px}

/* ── Buttons ── */
.gt-btn{
  display:inline-flex;align-items:center;gap:7px;
  padding:10px 22px;border-radius:50px;
  font-size:13px;font-weight:700;font-family:'Outfit',sans-serif;
  cursor:pointer;text-decoration:none;border:none;
  transition:all 0.2s;white-space:nowrap;letter-spacing:0.3px;
}
.gt-btn-primary{
  background:var(--gt-red);color:#fff;
  box-shadow:0 0 20px var(--gt-red-glow);
}
.gt-btn-primary:hover{background:#c50000;box-shadow:0 0 32px var(--gt-red-glow);transform:translateY(-1px);color:#fff}
.gt-btn-ghost{
  background:rgba(255,255,255,0.06);color:var(--gt-white);
  border:1px solid var(--gt-border-md);
}
.gt-btn-ghost:hover{background:rgba(255,255,255,0.1);color:#fff}
.gt-btn-sm{padding:7px 16px;font-size:12px}
.gt-btn-xs{padding:5px 12px;font-size:11px}

/* ── Status badges ── */
.gt-badge{
  display:inline-flex;align-items:center;gap:5px;
  padding:4px 10px;border-radius:50px;
  font-size:11px;font-weight:700;
}
.gt-badge-active{background:rgba(34,197,94,0.1);border:1px solid rgba(34,197,94,0.25);color:#86efac}
.gt-badge-expiring{background:rgba(245,158,11,0.1);border:1px solid rgba(245,158,11,0.25);color:#fcd34d}
.gt-badge-expired{background:rgba(225,0,0,0.1);border:1px solid rgba(225,0,0,0.25);color:#fca5a5}
.gt-badge-free{background:rgba(100,116,139,0.1);border:1px solid rgba(100,116,139,0.2);color:var(--gt-soft)}
.gt-badge-pro{background:rgba(225,0,0,0.12);border:1px solid rgba(225,0,0,0.3);color:#ff6666}
.gt-badge-owned{background:rgba(34,197,94,0.1);border:1px solid rgba(34,197,94,0.3);color:#86efac}

/* ── Dot status ── */
.gt-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0;display:inline-block}
.gt-dot-green{background:var(--gt-green);box-shadow:0 0 8px var(--gt-green);animation:gtp-pulse 2s infinite}
.gt-dot-yellow{background:var(--gt-yellow);box-shadow:0 0 8px var(--gt-yellow)}
.gt-dot-red{background:var(--gt-red);box-shadow:0 0 8px var(--gt-red)}
.gt-dot-gray{background:var(--gt-subtle)}

/* ── Forms ── */
.gt-form-group{margin-bottom:20px}
.gt-form-label{display:block;font-size:13px;font-weight:600;color:var(--gt-white);margin-bottom:8px}
.gt-form-hint{font-size:12px;color:var(--gt-soft);margin-top:5px}
.gt-input{
  width:100%;padding:11px 14px;
  background:rgba(255,255,255,0.04);
  border:1px solid var(--gt-border-md);
  border-radius:8px;color:var(--gt-white);
  font-size:14px;font-family:'Outfit',sans-serif;
  transition:border-color 0.2s,box-shadow 0.2s;
  box-sizing:border-box;
}
.gt-input:focus{outline:none;border-color:var(--gt-red);box-shadow:0 0 0 3px var(--gt-red-soft)}
.gt-select{
  appearance:none;width:100%;padding:11px 36px 11px 14px;
  background:rgba(255,255,255,0.04) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394a3b8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 12px center;
  border:1px solid var(--gt-border-md);border-radius:8px;
  color:var(--gt-white);font-size:14px;font-family:'Outfit',sans-serif;
  cursor:pointer;
}
.gt-select:focus{outline:none;border-color:var(--gt-red)}
select:not(.gt-select){background-image:none!important}
.gt-toggle{
  position:relative;display:inline-block;width:44px;height:24px;
}
.gt-toggle input{opacity:0;width:0;height:0}
.gt-toggle-slider{
  position:absolute;cursor:pointer;inset:0;border-radius:24px;
  background:rgba(255,255,255,0.1);border:1px solid var(--gt-border-md);
  transition:0.3s;
}
.gt-toggle-slider::before{
  content:'';position:absolute;height:16px;width:16px;
  left:3px;bottom:3px;background:var(--gt-soft);
  border-radius:50%;transition:0.3s;
}
.gt-toggle input:checked + .gt-toggle-slider{background:var(--gt-red);border-color:var(--gt-red);box-shadow:0 0 10px var(--gt-red-glow)}
.gt-toggle input:checked + .gt-toggle-slider::before{transform:translateX(20px);background:#fff}

/* ── Notices ── */
.gt-notice{
  padding:14px 18px;border-radius:10px;margin-bottom:20px;
  font-size:13px;font-weight:500;display:flex;align-items:center;gap:10px;
}
.gt-notice-success{background:rgba(34,197,94,0.08);border:1px solid rgba(34,197,94,0.2);color:#86efac}
.gt-notice-error{background:rgba(225,0,0,0.08);border:1px solid rgba(225,0,0,0.2);color:#fca5a5}
.gt-notice-warn{background:rgba(245,158,11,0.08);border:1px solid rgba(245,158,11,0.2);color:#fcd34d}
.gt-notice-info{background:rgba(59,130,246,0.08);border:1px solid rgba(59,130,246,0.2);color:#93c5fd}

/* ── License banner ── */
.gt-lic-banner{
  display:flex;align-items:center;justify-content:space-between;gap:16px;
  padding:16px 20px;border-radius:10px;margin-bottom:20px;
}
.gt-lic-banner.expired{background:rgba(225,0,0,0.06);border:1px solid rgba(225,0,0,0.2)}
.gt-lic-banner.expiring{background:rgba(245,158,11,0.06);border:1px solid rgba(245,158,11,0.2)}
.gt-lic-banner h3{font-size:14px;font-weight:700;color:var(--gt-white);margin:0 0 3px}
.gt-lic-banner p{font-size:12px;color:var(--gt-soft);margin:0}

/* ── Divider ── */
.gt-hr{border:none;border-top:1px solid var(--gt-border);margin:24px 0}

/* ── Tables ── */
.gt-table{width:100%;border-collapse:collapse;font-size:13px}
.gt-table th{
  padding:10px 14px;text-align:left;
  font-size:10px;font-weight:700;letter-spacing:1px;text-transform:uppercase;
  color:var(--gt-subtle);border-bottom:1px solid var(--gt-border);
}
.gt-table td{padding:12px 14px;border-bottom:1px solid rgba(255,255,255,0.03);color:var(--gt-white)}
.gt-table tr:last-child td{border-bottom:none}
.gt-table tr:hover td{background:rgba(255,255,255,0.02)}

/* ── Animations ── */
.gt-fade{opacity:0;transform:translateY(12px);animation:gt-fadein 0.4s ease forwards}
.gt-fade:nth-child(1){animation-delay:0.05s}
.gt-fade:nth-child(2){animation-delay:0.10s}
.gt-fade:nth-child(3){animation-delay:0.15s}
.gt-fade:nth-child(4){animation-delay:0.20s}
.gt-fade:nth-child(5){animation-delay:0.25s}
.gt-fade:nth-child(6){animation-delay:0.30s}
.gt-fade:nth-child(7){animation-delay:0.35s}
.gt-fade:nth-child(8){animation-delay:0.40s}
@keyframes gt-fadein{to{opacity:1;transform:translateY(0)}}

/* ── Misc utils ── */
.gt-flex{display:flex;align-items:center}
.gt-flex-between{display:flex;align-items:center;justify-content:space-between}
.gt-gap-sm{gap:8px}
.gt-gap{gap:14px}
.gt-gap-lg{gap:20px}
.gt-text-sm{font-size:13px}
.gt-text-xs{font-size:11px}
.gt-soft{color:var(--gt-soft)}
.gt-white{color:var(--gt-white)}
.gt-mono{font-family:'DM Mono',monospace}
.gt-mt{margin-top:16px}
.gt-mt-lg{margin-top:24px}
.gt-mb{margin-bottom:16px}
.gt-mb-lg{margin-bottom:24px}
.gt-fw-800{font-weight:800}
.gt-truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

/* ── Counter animation ── */
.gt-counter{display:inline-block}

/* ── PRO Pack vault ── */
.gt-vault-grid{
  display:grid;grid-template-columns:repeat(3,1fr);gap:18px;
}
.gt-pack-card{
  background:var(--gt-card);border:1px solid var(--gt-border);
  border-radius:var(--gt-r-lg);overflow:hidden;
  transition:all 0.25s;position:relative;
}
.gt-pack-card:hover{
  border-color:rgba(225,0,0,0.3);
  transform:translateY(-3px);
  box-shadow:0 12px 40px rgba(0,0,0,0.4);
}
.gt-pack-card.owned{border-color:rgba(34,197,94,0.2)}
.gt-pack-head{
  padding:18px 18px 14px;
  border-bottom:1px solid var(--gt-border);
  background:linear-gradient(135deg,rgba(255,255,255,0.02),transparent);
}
.gt-pack-icon{font-size:28px;margin-bottom:8px;display:block}
.gt-pack-name{font-size:14px;font-weight:700;color:var(--gt-white);margin:0 0 4px}
.gt-pack-desc{font-size:12px;color:var(--gt-soft);line-height:1.4;margin:0}
.gt-pack-foot{
  padding:14px 18px;
  display:flex;align-items:center;justify-content:space-between;
}
.gt-pack-price{font-size:16px;font-weight:800;color:var(--gt-white);font-family:'DM Mono',monospace}
.gt-pack-owned-check{color:var(--gt-green);font-size:13px;font-weight:700;display:flex;align-items:center;gap:5px}

/* ── PayPal modal ── */
.gt-modal-overlay{
  display:none;position:fixed;inset:0;z-index:99999;
  background:rgba(2,6,23,0.88);backdrop-filter:blur(8px);
  align-items:center;justify-content:center;
}
.gt-modal-overlay.open{display:flex}
.gt-modal{
  background:var(--gt-card);border:1px solid var(--gt-border-md);
  border-radius:20px;padding:32px;width:460px;max-width:90vw;
  position:relative;
  box-shadow:0 32px 80px rgba(0,0,0,0.7);
  animation:gt-modal-in 0.3s ease;
}
@keyframes gt-modal-in{from{opacity:0;transform:scale(0.9) translateY(20px)}to{opacity:1;transform:scale(1) translateY(0)}}
.gt-modal-close{
  position:absolute;top:16px;right:16px;
  background:rgba(255,255,255,0.06);border:none;
  width:30px;height:30px;border-radius:50%;
  color:var(--gt-soft);font-size:16px;cursor:pointer;
  display:flex;align-items:center;justify-content:center;
  transition:all 0.2s;
}
.gt-modal-close:hover{background:rgba(255,255,255,0.12);color:var(--gt-white)}
.gt-modal h3{font-size:20px;font-weight:800;color:var(--gt-white);margin:0 0 6px}
.gt-modal p{font-size:14px;color:var(--gt-soft);margin:0 0 20px}
.gt-paypal-wrap{min-height:48px;display:flex;align-items:center;justify-content:center}

/* ── Bundle cards ── */
.gt-bundle-card{
  background:linear-gradient(135deg,var(--gt-card) 0%,rgba(225,0,0,0.04) 100%);
  border:1px solid rgba(225,0,0,0.15);
  border-radius:var(--gt-r-lg);padding:24px;
  transition:all 0.25s;
}
.gt-bundle-card:hover{border-color:rgba(225,0,0,0.35);transform:translateY(-2px);box-shadow:0 12px 40px rgba(225,0,0,0.1)}
.gt-bundle-price{font-size:32px;font-weight:900;color:var(--gt-white);font-family:'DM Mono',monospace;letter-spacing:-1px}
.gt-bundle-name{font-size:16px;font-weight:700;color:var(--gt-white);margin-bottom:4px}
.gt-bundle-packs{font-size:12px;color:var(--gt-soft);margin-bottom:16px}
.gt-bundle-features{list-style:none;padding:0;margin:0 0 20px;display:flex;flex-direction:column;gap:6px}
.gt-bundle-features li{font-size:12px;color:var(--gt-soft);display:flex;align-items:center;gap:6px}
.gt-bundle-features li::before{content:'✓';color:var(--gt-green);font-weight:700;font-size:11px}

/* ── Pro gate ── */
.gt-pro-gate{
  text-align:center;padding:60px 40px;
  background:var(--gt-card);border:1px solid var(--gt-border);
  border-radius:var(--gt-r-lg);margin-bottom:20px;
}
.gt-pro-gate-icon{font-size:48px;display:block;margin-bottom:16px}
.gt-pro-gate h2{font-size:22px;font-weight:800;color:var(--gt-white);margin:0 0 10px}
.gt-pro-gate p{font-size:14px;color:var(--gt-soft);margin:0 0 24px;max-width:480px;display:inline-block}
.gt-pro-gate .gt-flex{gap:12px}

/* ── Button secondary ── */
.gt-btn-secondary{
  background:rgba(255,255,255,0.08);color:var(--gt-white)!important;
  border:1px solid var(--gt-border-md);
}
.gt-btn-secondary:hover{background:rgba(255,255,255,0.14);color:var(--gt-white)!important}

/* ── Page header ── */
.gt-page-header{display:flex;align-items:flex-start;justify-content:space-between;margin-bottom:28px;gap:16px;flex-wrap:wrap}
.gt-page-title{font-size:28px;font-weight:800;color:var(--gt-white);margin:0 0 5px;letter-spacing:-0.5px}
.gt-page-subtitle,.gt-page-sub{font-size:14px;color:var(--gt-soft);margin:0}
.gt-page-actions{display:flex;gap:10px;align-items:center;flex-wrap:wrap}

/* ── Card header ── */
.gt-card-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:20px;padding-bottom:16px;border-bottom:1px solid var(--gt-border)}

/* ── Animate in ── */
.gt-animate-in{animation:gt-fadein 0.35s ease forwards}

/* ── Text utils ── */
.gt-text-center{text-align:center}
.gt-text-white{color:var(--gt-white)!important}
.gt-text-soft{color:var(--gt-soft)!important}
.gt-text-sm{font-size:13px}
.gt-space-sm{gap:8px}

/* ── Form utils ── */
.gt-feature-grid{display:grid;gap:16px}
.gt-feature-grid--2col{grid-template-columns:repeat(2,1fr)}
@media(max-width:700px){.gt-feature-grid--2col{grid-template-columns:1fr}}

/* ── Pro gate ── */
.gt-pro-gate{
  text-align:center;padding:60px 40px;
  background:var(--gt-card);border:1px solid var(--gt-border);
  border-radius:var(--gt-r-lg);margin-bottom:20px;
}
.gt-pro-gate-icon{font-size:48px;display:block;margin-bottom:16px}
.gt-pro-gate h2{font-size:22px;font-weight:800;color:var(--gt-white);margin:0 0 10px}
.gt-pro-gate p{font-size:14px;color:var(--gt-soft);margin:0 0 24px;max-width:480px;display:inline-block}
.gt-pro-gate .gt-flex{gap:12px}

/* ── Button secondary ── */
.gt-btn-secondary{
  background:rgba(255,255,255,0.08);color:var(--gt-white)!important;
  border:1px solid var(--gt-border-md);
}
.gt-btn-secondary:hover{background:rgba(255,255,255,0.14);color:var(--gt-white)!important}

/* ── Page header ── */
.gt-page-header{display:flex;align-items:flex-start;justify-content:space-between;margin-bottom:28px;gap:16px;flex-wrap:wrap}
.gt-page-title{font-size:28px;font-weight:800;color:var(--gt-white);margin:0 0 5px;letter-spacing:-0.5px}
.gt-page-subtitle,.gt-page-sub{font-size:14px;color:var(--gt-soft);margin:0}
.gt-page-actions{display:flex;gap:10px;align-items:center;flex-wrap:wrap}

/* ── Card header ── */
.gt-card-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:20px;padding-bottom:16px;border-bottom:1px solid var(--gt-border)}

/* ── Animate in ── */
.gt-animate-in{animation:gt-fadein 0.35s ease forwards}

/* ── Text utils ── */
.gt-text-center{text-align:center}
.gt-text-white{color:var(--gt-white)!important}
.gt-text-soft{color:var(--gt-soft)!important}
.gt-text-sm{font-size:13px}

/* ── Form utils ── */
.gt-feature-grid{display:grid;gap:16px}
.gt-feature-grid--2col{grid-template-columns:repeat(2,1fr)}
@media(max-width:700px){.gt-feature-grid--2col{grid-template-columns:1fr}}

/* ── Pro gate ── */
.gt-pro-gate{text-align:center;padding:60px 40px;background:var(--gt-card);border:1px solid var(--gt-border);border-radius:var(--gt-r-lg);margin-bottom:20px}
.gt-pro-gate-icon{font-size:48px;display:block;margin-bottom:16px}
.gt-pro-gate h2{font-size:22px;font-weight:800;color:var(--gt-white);margin:0 0 10px}
.gt-pro-gate p{font-size:14px;color:var(--gt-soft);margin:0 0 24px;max-width:480px;display:inline-block}
.gt-pro-gate .gt-flex{gap:12px}

/* ── Button secondary ── */
.gt-btn-secondary{background:rgba(255,255,255,0.08);color:var(--gt-white)!important;border:1px solid var(--gt-border-md)}
.gt-btn-secondary:hover{background:rgba(255,255,255,0.14);color:var(--gt-white)!important}

/* ── Page header ── */
.gt-page-header{display:flex;align-items:flex-start;justify-content:space-between;margin-bottom:28px;gap:16px;flex-wrap:wrap}
.gt-page-title{font-size:28px;font-weight:800;color:var(--gt-white);margin:0 0 5px;letter-spacing:-0.5px}
.gt-page-subtitle,.gt-page-sub{font-size:14px;color:var(--gt-soft);margin:0}
.gt-page-actions{display:flex;gap:10px;align-items:center;flex-wrap:wrap}

/* ── Card header ── */
.gt-card-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:20px;padding-bottom:16px;border-bottom:1px solid var(--gt-border)}

/* ── Animate in ── */
.gt-animate-in{animation:gt-fadein 0.35s ease forwards}

/* ── Text utils ── */
.gt-text-center{text-align:center}
.gt-text-white{color:var(--gt-white)!important}
.gt-text-soft{color:var(--gt-soft)!important}
.gt-text-sm{font-size:13px}
.gt-text-xs{font-size:11px}

/* ── Form utils ── */
.gt-form-group{margin-bottom:20px}
.gt-form-label{display:block;font-size:13px;font-weight:600;color:var(--gt-white);margin-bottom:8px}
.gt-form-hint{font-size:12px;color:var(--gt-soft);margin-top:5px}
.gt-feature-grid{display:grid;gap:16px}
.gt-feature-grid--2col{grid-template-columns:repeat(2,1fr)}
@media(max-width:700px){.gt-feature-grid--2col{grid-template-columns:1fr}}

/* ── Space vars ── */
:root{
  --gt-space-xs:4px;--gt-space-sm:8px;--gt-space-md:16px;
  --gt-space-lg:24px;--gt-space-xl:32px;--gt-space-2xl:48px;
}

/* ── Section labels ── */
.gt-section-label{font-size:10px;font-weight:700;letter-spacing:1.5px;text-transform:uppercase;color:var(--gt-subtle);margin-bottom:8px}

/* ── Settings rows ── */
.gt-setting-row{display:flex;align-items:center;justify-content:space-between;padding:16px 0;border-bottom:1px solid var(--gt-border);gap:16px}
.gt-setting-row:last-child{border-bottom:none}
.gt-setting-label{font-size:14px;font-weight:600;color:var(--gt-white)}
.gt-setting-desc{font-size:12px;color:var(--gt-soft);margin-top:3px}

/* ── Code blocks ── */
code{background:rgba(255,255,255,0.06);border:1px solid var(--gt-border);color:#e2e8f0;padding:2px 6px;border-radius:4px;font-family:'DM Mono',monospace;font-size:12px}

/* ── Import/Export ── */
.gt-import-zone{border:2px dashed var(--gt-border-md);border-radius:var(--gt-r-lg);padding:40px;text-align:center;transition:border-color 0.2s}
.gt-import-zone:hover{border-color:var(--gt-red)}
.gt-import-zone h3{color:var(--gt-white);margin:12px 0 6px}
.gt-import-zone p{color:var(--gt-soft);font-size:13px;margin:0}

/* ── Documentation ── */
.gt-doc-section{margin-bottom:32px}
.gt-doc-section h2{font-size:18px;font-weight:700;color:var(--gt-white);margin:0 0 12px;padding-bottom:10px;border-bottom:1px solid var(--gt-border)}
.gt-doc-section h3{font-size:15px;font-weight:600;color:var(--gt-white);margin:20px 0 8px}
.gt-doc-section p,.gt-doc-section li{font-size:14px;color:var(--gt-soft);line-height:1.7}
.gt-doc-section ul,.gt-doc-section ol{padding-left:20px;color:var(--gt-soft)}
.gt-doc-section strong{color:var(--gt-white)}
.gt-doc-section a{color:var(--gt-red);text-decoration:none}
.gt-doc-section a:hover{text-decoration:underline}

/* ── Welcome page ── */
.gt-welcome-hero{text-align:center;padding:48px 24px}
.gt-welcome-hero h1{font-size:36px;font-weight:900;color:var(--gt-white);margin:0 0 12px}
.gt-welcome-hero p{font-size:16px;color:var(--gt-soft);max-width:560px;margin:0 auto 32px}
.gt-step-card{background:var(--gt-card);border:1px solid var(--gt-border);border-radius:var(--gt-r-lg);padding:24px;text-align:center}
.gt-step-card h3{font-size:15px;font-weight:700;color:var(--gt-white);margin:12px 0 6px}
.gt-step-card p{font-size:13px;color:var(--gt-soft);margin:0}
.gt-step-num{width:32px;height:32px;border-radius:50%;background:var(--gt-red);color:#fff;font-weight:800;font-size:14px;display:flex;align-items:center;justify-content:center;margin:0 auto}

/* ── License page ── */
.gt-license-input-wrap{position:relative}
.gt-license-input-wrap .gt-input{padding-right:120px;font-family:'DM Mono',monospace;letter-spacing:1px}
.gt-license-status-card{padding:20px;border-radius:var(--gt-r-lg);margin-bottom:20px}
.gt-license-status-card h3{font-size:16px;font-weight:700;color:var(--gt-white);margin:0 0 6px}
.gt-license-status-card p{font-size:13px;color:var(--gt-soft);margin:0}

/* ── Dashboard stat cards ── */
.gt-stat-label{font-size:10px;font-weight:700;letter-spacing:1px;text-transform:uppercase;color:var(--gt-soft);margin-bottom:6px}
.gt-stat-value{font-size:28px;font-weight:800;color:var(--gt-white);font-family:'DM Mono',monospace;letter-spacing:-1px}
.gt-stat-trend{font-size:11px;color:var(--gt-subtle);margin-top:4px}

/* ── Activity feed ── */
.gt-feed-item{display:flex;align-items:center;gap:12px;padding:12px 0;border-bottom:1px solid rgba(255,255,255,0.03)}
.gt-feed-item:last-child{border-bottom:none}
.gt-feed-icon{width:32px;height:32px;border-radius:8px;background:rgba(255,255,255,0.04);display:flex;align-items:center;justify-content:center;font-size:14px;flex-shrink:0}
.gt-feed-text{flex:1;font-size:13px;color:var(--gt-white)}
.gt-feed-sub{font-size:11px;color:var(--gt-subtle);margin-top:2px}
.gt-feed-time{font-size:11px;color:var(--gt-subtle);white-space:nowrap}

/* ── PRO packs vault ── */
.gt-vault-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:20px;overflow:hidden}
.gt-pack-card{background:rgba(255,255,255,0.02);border:1px solid rgba(255,255,255,0.06);border-radius:12px;padding:20px;transition:all 0.2s;display:flex;flex-direction:column;overflow:hidden;word-break:break-word;min-width:0}
.gt-pack-card:hover{background:rgba(255,255,255,0.04);border-color:rgba(225,0,0,0.2);transform:translateY(-2px)}
.gt-pack-card-top{display:flex;align-items:center;justify-content:space-between;margin-bottom:12px}
.gt-pack-icon{font-size:24px}
.gt-pack-name{color:var(--gt-white);font-size:15px;font-weight:600;margin:0 0 8px}
.gt-pack-desc{color:var(--gt-soft);font-size:13px;line-height:1.5;margin:0;flex:1}
.gt-pack-actions{margin-top:16px}

/* ── Modal ── */
.gt-modal h3{color:var(--gt-white)!important}
.gt-modal p{color:var(--gt-soft)!important}
.gt-modal label{color:var(--gt-white)!important}

/* ── Tables ── */
.gt-table th{color:var(--gt-subtle)!important}
.gt-table td{color:var(--gt-white)!important}
.gt-table td a{color:var(--gt-white)!important}
.gt-table td strong{color:var(--gt-white)!important}

/* ── All headings white ── */
.gt-card h1,.gt-card h2,.gt-card h3,.gt-card h4{color:var(--gt-white)!important}
.gt-card p{color:var(--gt-soft)}
.gt-card label{color:var(--gt-white)}
.gt-card strong{color:var(--gt-white)}
select.gt-select option{background:var(--gt-card);color:var(--gt-white)}

/* ── Brand strip ── */
.gt-brand-strip{
  display:flex;align-items:center;justify-content:space-between;
  padding:10px 16px;margin:-32px -36px 28px;
  background:linear-gradient(90deg,rgba(225,0,0,0.08) 0%,rgba(7,12,28,0.6) 50%,rgba(225,0,0,0.04) 100%);
  border-bottom:1px solid rgba(225,0,0,0.15);
  flex-wrap:wrap;gap:8px;
}
.gt-brand-strip-left{display:flex;align-items:center;gap:10px}
.gt-brand-strip-name{font-size:12px;font-weight:800;letter-spacing:1.5px;color:var(--gt-white);text-transform:uppercase}
.gt-brand-strip-edition{font-size:10px;font-weight:700;letter-spacing:1px;color:var(--gt-red);text-transform:uppercase;padding:2px 8px;border-radius:50px;border:1px solid rgba(225,0,0,0.3);background:rgba(225,0,0,0.08)}
.gt-brand-strip-right{display:flex;align-items:center;gap:10px}
.gt-brand-strip-badge{font-size:10px;font-weight:700;letter-spacing:0.8px;padding:3px 10px;border-radius:50px;text-transform:uppercase}
.gt-brand-strip-badge.pro{background:rgba(34,197,94,0.1);border:1px solid rgba(34,197,94,0.25);color:#86efac}
.gt-brand-strip-badge.warn{background:rgba(245,158,11,0.1);border:1px solid rgba(245,158,11,0.25);color:#fcd34d}
.gt-brand-strip-badge.upgrade{background:rgba(225,0,0,0.1);border:1px solid rgba(225,0,0,0.3);color:#fca5a5;text-decoration:none}
.gt-brand-strip-badge.upgrade:hover{background:rgba(225,0,0,0.2);color:#fff}
.gt-brand-strip-ver{font-size:10px;color:var(--gt-subtle);font-family:'DM Mono',monospace}

/* ── Responsive ── */
@media (max-width:1024px){
  .gt-metrics{grid-template-columns:repeat(2,1fr)}
  .gt-vault-grid{grid-template-columns:repeat(2,1fr)}
  .gt-grid-3{grid-template-columns:repeat(2,1fr)}
}
@media (max-width:768px){
  .gt-sidebar{display:none}
  .gt-main{padding:16px}
  .gt-metrics{grid-template-columns:1fr 1fr}
  .gt-vault-grid{grid-template-columns:1fr}
}

/* ── ROI chart container ── */
.gt-chart-wrap{position:relative;height:220px}
</style>

<div class="gt-shell">
  <!-- ═══ SIDEBAR ═══ -->
  <aside class="gt-sidebar">

    <a href="<?php echo esc_url(admin_url('admin.php?page=gt-bogo-engine')); ?>" class="gt-brand">
      <div class="gt-brand-icon" style="background:none;box-shadow:none;padding:0;overflow:hidden;border-radius:10px;flex-shrink:0"><img src="<?php echo esc_url($_gt_url); ?>assets/images/icon-256x256.png" width="52" height="52" style="display:block;border-radius:10px;" alt="GT BOGO"></div>
      <div class="gt-brand-text">
        <span class="gt-brand-name" style="font-size:14px;letter-spacing:1.5px">GT BOGO ENGINE</span>
        <span class="gt-brand-sub" style="font-size:10px;color:var(--gt-red);letter-spacing:1px;font-weight:700">ENTERPRISE EDITION</span>
      </div>
    </a>

    <div class="gt-lic-pill <?php echo $_gt_is_pro ? 'pro' : 'free'; ?>">
      <span class="gt-pulse <?php echo $_gt_is_pro ? '' : 'gray'; ?>"></span>
      <?php if ($_gt_is_pro): ?>
        <span>PRO Active</span>
        <?php if ($_gt_days > 0 && $_gt_days <= 30): ?>
          <span style="margin-left:auto;font-size:10px;color:var(--gt-yellow)"><?php echo (int)$_gt_days; ?>d left</span>
        <?php endif; ?>
      <?php else: ?>
        <span style="color:#ffffff;font-weight:600;">Free Plan</span>
        <a href="<?php echo esc_url(admin_url('admin.php?page=gt-bogo-engine&tab=license')); ?>" style="margin-left:auto;color:var(--gt-red);font-size:10px;font-weight:800;text-decoration:none">UPGRADE</a>
      <?php endif; ?>
    </div>

    <nav class="gt-nav-section">
      <p class="gt-nav-sep">MAIN</p>
      <ul class="gt-nav-list">
        <?php
        _gt_nav('dashboard',    'Dashboard',      '📊');
        _gt_nav('free-rule',      'Free Core Rule',     '🎁');
        _gt_nav('pro-rules',      'PRO Rules / Packs',  '⚡', $_gt_is_pro ? '' : 'PRO');
        _gt_nav('scheduler',      'Campaign Scheduler',          '📅', $_gt_is_pro ? '' : 'PRO');
        _gt_nav('segments',       'Customer Segments',           '🎯', $_gt_is_pro ? '' : 'PRO');
        _gt_nav('roi-projector',  'ROI Projector',      '📈', $_gt_is_pro ? '' : 'PRO');
        _gt_nav('audit-log',      'Audit Log',          '🔍', $_gt_is_pro ? '' : 'PRO');
        _gt_nav('analytics',      'Analytics',          '📉', $_gt_is_pro ? '' : 'PRO');
        _gt_nav('ab-testing',     'A/B Testing',        '🧪', $_gt_is_pro ? '' : 'PRO');
        _gt_nav('system-status',  'System Status',      '🖥️');
        _gt_nav('white-label',    'White Label',        '🏷️', $_gt_is_pro ? '' : 'PRO');
        _gt_nav('integrations',   'Integrations',       '🔌', $_gt_is_pro ? '' : 'PRO');
        echo '<li class="gt-nav-sep">⚙️ PRECISION</li>';
        _gt_nav('conditions',     'Rule Conditions',    '🎛️', $_gt_is_pro ? '' : 'PRO');
        _gt_nav('conflicts',      'Conflict Resolver',  '⚔️', $_gt_is_pro ? '' : 'PRO');
        _gt_nav('deal-lockout',   'Deal Lockout',       '🔒', $_gt_is_pro ? '' : 'PRO');
        _gt_nav('geo-targeting',  'Geo Targeting',      '🌍', $_gt_is_pro ? '' : 'PRO');
        _gt_nav('variant-rules',  'Variant Rules',      '🎨', $_gt_is_pro ? '' : 'PRO');
        echo '<li class="gt-nav-sep">🚀 GROWTH</li>';
        _gt_nav('deal-page',      'Deal Page',          '🛍️', $_gt_is_pro ? '' : 'PRO');
        _gt_nav('templates',      'My Packs',           '📦', $_gt_is_pro ? '' : 'PRO');
        _gt_nav('rest-api',       'REST API',           '🔗', $_gt_is_pro ? '' : 'PRO');
        _gt_nav('multi-currency', 'Multi-Currency',     '💱', $_gt_is_pro ? '' : 'PRO');
        _gt_nav('pdf-export',     'PDF Export',         '📄', $_gt_is_pro ? '' : 'PRO');
        ?>
      </ul>
      <p class="gt-nav-sep">TOOLS</p>
      <ul class="gt-nav-list">
        <?php
        _gt_nav('settings',      'Settings',       '⚙️');
        _gt_nav('import-export', 'Import / Export', '📦');
        _gt_nav('license',       'License',         $_gt_is_pro ? '✅' : '🔑');
        _gt_nav('documentation', 'Documentation',   '📚');
        _gt_nav('welcome',       'Welcome',         '👋');
        ?>
      </ul>
    </nav>

    <?php if (!$_gt_is_pro): ?>
    <div class="gt-upgrade-box">
      <h4>Unlock PRO Features</h4>
      <p>PRO Packs, stackable rules &amp; advanced analytics.</p>
      <a href="<?php echo esc_url(admin_url('admin.php?page=gt-bogo-engine&tab=license')); ?>" class="gt-upgrade-btn">Activate PRO — $19.99/yr</a>
    </div>
    <?php endif; ?>

    <div class="gt-sidebar-foot">
      <div class="gt-sidebar-ver">v<?php echo esc_html($_gt_ver); ?> · <a href="https://graphictshirts.shop" target="_blank" rel="noopener" style="color:var(--gt-white);text-decoration:none;font-weight:800;letter-spacing:1px;font-size:11px;font-family:'Outfit',sans-serif">GRAPHIC T-SHIRTS</a></div>
    </div>

  </aside>

  <!-- ═══ MAIN CONTENT ═══ -->
  <main class="gt-main">
    <!-- ── GT Brand Strip — consistent on every page ── -->
    <div class="gt-brand-strip">
        <div class="gt-brand-strip-left">
            <img src="<?php echo esc_url($_gt_url); ?>assets/images/icon-128x128.png" width="22" height="22" style="border-radius:5px;display:block" alt="">
            <span class="gt-brand-strip-name">GT BOGO ENGINE</span>
            <span class="gt-brand-strip-edition">ENTERPRISE EDITION</span>
        </div>
        <div class="gt-brand-strip-right">
            <?php if ($_gt_is_pro): ?>
            <span class="gt-brand-strip-badge pro">⚡ PRO ACTIVE</span>
            <?php if ($_gt_days > 0 && $_gt_days <= 30): ?>
            <span class="gt-brand-strip-badge warn">⚠ Expires in <?php echo $_gt_days; ?> days</span>
            <?php endif; ?>
            <?php else: ?>
            <a href="https://graphictshirts.shop/bogo/" target="_blank" rel="noopener" class="gt-brand-strip-badge upgrade">🔒 Upgrade to PRO</a>
            <?php endif; ?>
            <span class="gt-brand-strip-ver">v<?php echo esc_html($_gt_ver); ?></span>
        </div>
    </div>
