/* SmartGolf Admin Dashboard UI v0.2 (Full Replace)
   Font: English IBM Plex Sans (fallback), Korean Malgun Gothic
*/
:root{
  --sg-bg: #0b1220;
  --sg-panel: rgba(255,255,255,0.06);
  --sg-panel-2: rgba(255,255,255,0.08);
  --sg-border: rgba(255,255,255,0.12);
  --sg-text: rgba(255,255,255,0.92);
  --sg-muted: rgba(255,255,255,0.62);
  --sg-accent: #9CFF00;
  --sg-accent-2: #63ff6b;
  --sg-danger: #ff5a5f;
  --sg-warn: #ffcc00;
  --sg-ok: #2dd4bf;
  --sg-radius: 16px;
  --sg-gap: 14px;
  --sg-shadow: 0 10px 28px rgba(0,0,0,0.35);
}

/* Base */
.sg-dashboard{
  font-family: "IBM Plex Sans","Malgun Gothic",system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  color: var(--sg-text);
}

.sg-wrap{
  max-width: 1800px;
  width: min(1920px, calc(100vw - 48px));
  margin: 0 auto;
  padding: 18px 0 60px 0;
}

/* Topbar */
.sg-topbar{
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(10px);
  background: linear-gradient(to bottom, rgba(15,23,42,0.92), rgba(15,23,42,0.68));
  border: 1px solid var(--sg-border);
  border-radius: var(--sg-radius);
  box-shadow: var(--sg-shadow);
}

.sg-topbar-inner{
  display:flex;
  flex-wrap:wrap;
  gap:12px;
  align-items:center;
  padding: 12px 12px;
}

.sg-title{
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.2px;
  flex: 1 1 260px;
  min-width: 220px;
}

.sg-pill{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--sg-border);
  background: rgba(255,255,255,0.05);
  color: var(--sg-text);
  font-size: 13px;
}

.sg-pill label{
  color: var(--sg-muted);
  font-size: 12px;
}

.sg-input, .sg-select{
  background: rgba(0,0,0,0.18);
  border: 1px solid var(--sg-border);
  color: var(--sg-text);
  border-radius: 10px;
  padding: 6px 10px;
  outline: none;
  font-size: 13px;
}

.sg-btn{
  border: 1px solid rgba(156,255,0,0.28);
  background: rgba(156,255,0,0.12);
  color: rgba(255,255,255,0.92);
  border-radius: 12px;
  padding: 8px 12px;
  font-weight: 750;
  cursor: pointer;
  transition: transform 0.06s ease, background 0.16s ease, border-color 0.16s ease;
  user-select: none;
}
.sg-btn:hover{ background: rgba(156,255,0,0.16); border-color: rgba(156,255,0,0.36); }
.sg-btn:active{ transform: translateY(1px); }

.sg-tabs{
  display:flex;
  gap:8px;
  padding: 0 12px 12px 12px;
  flex-wrap:wrap;
}

.sg-tab{
  border: 1px solid var(--sg-border);
  background: rgba(255,255,255,0.04);
  color: var(--sg-muted);
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 750;
  font-size: 13px;
}
.sg-tab.is-active{
  color: #0b1220;
  background: var(--sg-accent);
  border-color: rgba(0,0,0,0.12);
}

/* Layout */
.sg-section{ margin-top: 16px; }

.sg-grid{
  display:grid;
  gap: var(--sg-gap);
}
.sg-grid.kpi{
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
@media (max-width: 1200px){
  .sg-grid.kpi{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px){
  .sg-grid.kpi{ grid-template-columns: 1fr; }
}

.sg-two-col{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sg-gap);
}
@media (max-width: 1200px){
  .sg-two-col{ grid-template-columns: 1fr; }
}

/* Cards */
.sg-card{
  background: var(--sg-panel);
  border: 1px solid var(--sg-border);
  border-radius: var(--sg-radius);
  box-shadow: var(--sg-shadow);
  overflow: hidden;
}
.sg-card-header{
  padding: 14px 14px 8px 14px;
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  gap:10px;
}
.sg-card-title{
  font-size: 14px;
  font-weight: 800;
}
.sg-card-sub{
  font-size: 12px;
  color: var(--sg-muted);
}
.sg-card-body{
  padding: 0 14px 14px 14px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.sg-metric{
  font-size: 34px;
  font-weight: 900;
  letter-spacing: -0.6px;
  margin-top: 4px;
}
.sg-metric small{
  font-size: 12px;
  color: var(--sg-muted);
  font-weight: 700;
  margin-left: 6px;
}

.sg-badge{
  font-size: 12px;
  font-weight: 800;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--sg-border);
  background: rgba(255,255,255,0.04);
  color: var(--sg-muted);
}

.sg-right{ text-align:right; }
.sg-muted{ color: var(--sg-muted); }

/* Status chips */
.sg-status{
  display:inline-flex;
  align-items:center;
  gap:6px;
  font-weight: 800;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--sg-border);
  white-space: nowrap;
}
.sg-status.ok{ background: rgba(45,212,191,0.12); color: rgba(255,255,255,0.92); }
.sg-status.warn{ background: rgba(255,204,0,0.12); color: rgba(255,255,255,0.92); }
.sg-status.bad{ background: rgba(255,90,95,0.12); color: rgba(255,255,255,0.92); }

.sg-footer-note{
  margin-top: 12px;
  color: var(--sg-muted);
  font-size: 12px;
}

/* Charts */
.sg-chart{
  height: 240px;
  border-radius: 14px;
  border: 1px dashed rgba(255,255,255,0.18);
  background: rgba(0,0,0,0.10);
  display:flex;
  align-items:center;
  justify-content:center;
  color: var(--sg-muted);
  font-weight: 700;
}

/* TABLES (Global Fix) */
.sg-table{
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  border-radius: 14px;
  border: 1px solid var(--sg-border);
  background: rgba(0,0,0,0.10);
}

.sg-table th,
.sg-table td{
  min-width: 0;
  text-align: left;
  padding: 8px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sg-table th{
  color: rgba(255,255,255,0.78);
  font-weight: 800;
  background: rgba(255,255,255,0.04);
}

.sg-table tr:hover td{
  background: rgba(255,255,255,0.03);
}

/* Make action/status always visible-ish by keeping them narrow */
.sg-table th:last-child,
.sg-table td:last-child{
  width: 84px;
}
.sg-table th:nth-last-child(2),
.sg-table td:nth-last-child(2){
  width: 110px;
}

/* User panel (side drawer) */
.sg-userpanel-overlay{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 9998;
}

.sg-userpanel{
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: min(520px, 92vw);
  background: rgba(10,16,24,0.98);
  border-left: 1px solid rgba(255,255,255,0.08);
  box-shadow: -20px 0 60px rgba(0,0,0,0.6);
  z-index: 9999;
  padding: 16px;
  overflow: auto;
}

.sg-userpanel-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding: 10px 10px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 14px;
}

.sg-userpanel-title{ font-size: 16px; font-weight: 900; }
.sg-userpanel-sub{ font-size: 12px; opacity: 0.7; margin-top: 2px; }

.sg-userpanel-close{
  width: 36px; height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.9);
  font-size: 22px;
  line-height: 32px;
  cursor: pointer;
}

.sg-up-grid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 10px;
}
.sg-up-item{
  border: 1px solid rgba(255,255,255,0.07);
  background: rgba(255,255,255,0.03);
  border-radius: 14px;
  padding: 10px 12px;
}
.sg-up-k{ font-size: 11px; opacity: 0.65; margin-bottom: 6px; }
.sg-up-v{ font-size: 14px; font-weight: 800; }

.sg-up-card{
  margin-top:16px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  overflow:hidden;
}
.sg-up-card-head{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:12px;
  padding:14px 14px 10px 14px;
}
.sg-up-card-title{ font-weight:800; font-size:14px; letter-spacing:0.2px; }
.sg-up-card-sub{ margin-top:4px; font-size:12px; opacity:0.75; }
.sg-up-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:6px 10px;
  border-radius:999px;
  font-size:11px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.25);
  opacity:0.9;
}
.sg-up-card-body{ padding: 10px 14px 14px 14px; }

/* View switch (keep as you had) */
.sg-dashboard .sg-section[data-sg-view]{ display:none; }
.sg-dashboard .sg-section[data-sg-view="overview"]{ display:block; }

.sg-dashboard[data-sg-active] .sg-section[data-sg-view]{ display:none !important; }
.sg-dashboard[data-sg-active="overview"] .sg-section[data-sg-view="overview"]{ display:block !important; }
.sg-dashboard[data-sg-active="users"] .sg-section[data-sg-view="users"]{ display:block !important; }
.sg-dashboard[data-sg-active="web3"] .sg-section[data-sg-view="web3"]{ display:block !important; }
.sg-dashboard[data-sg-active="coach"] .sg-section[data-sg-view="coach"]{ display:block !important; }
.sg-dashboard[data-sg-active="settings"] .sg-section[data-sg-view="settings"]{ display:block !important; }

/* Dark canvas (dashboard only) */
body:has(.sg-dashboard){
  background: var(--sg-bg) !important;
  color: var(--sg-text);
}
body:has(.sg-dashboard) .wp-site-blocks,
body:has(.sg-dashboard) main,
body:has(.sg-dashboard) .site-content,
body:has(.sg-dashboard) .entry-content{
  background: transparent !important;
}
body:has(.sg-dashboard) .wp-block-post-title{ display:none !important; }
body:has(.sg-dashboard) .wp-block-shortcode{ margin-bottom: 0 !important; }