:root {
    --bg: #080B12;
    --bg2: #0E1420;
    --bg3: #141C2E;
    --surface: #1A2340;
    --surface2: #1F2A4A;
    --border: rgba(255,255,255,0.07);
    --border2: rgba(255,255,255,0.12);
    --green: #00E87A;
    --green-dim: rgba(0,232,122,0.12);
    --green-glow: rgba(0,232,122,0.25);
    --text: #E8EDF8;
    --text2: #8892AA;
    --text3: #4F5B75;
    --accent: #3B82F6;
    --accent2: #F59E0B;
    --danger: #EF4444;
    --radius: 10px;
    --radius-lg: 16px;
  }
  * { box-sizing: border-box; margin: 0; padding: 0; }
  body { background: var(--bg); color: var(--text); font-family: 'Inter', sans-serif; min-height: 100vh; display: flex; overflow: hidden; }

  /* SIDEBAR */
  .sidebar {
    width: 260px; min-width: 260px; background: var(--bg2); border-right: 1px solid var(--border);
    display: flex; flex-direction: column; height: 100vh; position: relative; z-index: 10;
  }
  .logo { padding: 24px 20px 16px; border-bottom: 1px solid var(--border); }
  .logo-mark { display: flex; align-items: center; gap: 10px; }
  .logo-icon {
    width: 34px; height: 34px; background: var(--green); border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
  }
  .logo-icon svg { width: 20px; height: 20px; }
  .logo-name { font-family: 'Space Grotesk', sans-serif; font-size: 20px; font-weight: 700; letter-spacing: -0.5px; }
  .logo-sub { font-size: 10px; color: var(--text3); letter-spacing: 1.5px; text-transform: uppercase; margin-top: 2px; }

  .nav-section { padding: 16px 12px 8px; }
  .nav-label { font-size: 10px; color: var(--text3); letter-spacing: 1.5px; text-transform: uppercase; padding: 0 8px; margin-bottom: 6px; }
  .nav-item {
    display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px;
    font-size: 13.5px; color: var(--text2); cursor: pointer; transition: all 0.15s; margin-bottom: 2px;
    border: 1px solid transparent;
  }
  .nav-item:hover { background: var(--surface); color: var(--text); }
  .nav-item.active { background: var(--green-dim); color: var(--green); border-color: rgba(0,232,122,0.2); }
  .nav-icon { width: 18px; height: 18px; opacity: 0.7; flex-shrink: 0; }
  .nav-item.active .nav-icon { opacity: 1; }

  .nav-dropdown-header {
    display: flex; align-items: center; justify-content: space-between; padding: 9px 10px;
    border-radius: 8px; cursor: pointer; transition: all 0.15s; margin-bottom: 2px;
    border: 1px solid transparent; color: var(--text2); font-size: 13.5px;
  }
  .nav-dropdown-header:hover { background: var(--surface); color: var(--text); }
  .nav-dropdown-header.open { color: var(--text); }
  .nav-dd-left { display: flex; align-items: center; gap: 10px; }
  .nav-dd-arrow { width: 14px; height: 14px; transition: transform 0.2s; }
  .nav-dropdown-header.open .nav-dd-arrow { transform: rotate(180deg); }
  .nav-dropdown-body { overflow: hidden; transition: max-height 0.25s ease; max-height: 0; }
  .nav-dropdown-body.open { max-height: 300px; }
  .nav-sub-item {
    display: flex; align-items: center; gap: 8px; padding: 7px 10px 7px 38px;
    font-size: 13px; color: var(--text3); cursor: pointer; border-radius: 8px; transition: all 0.15s;
    border: 1px solid transparent;
  }
  .nav-sub-item:hover { color: var(--text2); background: var(--surface); }
  .nav-sub-item.active { color: var(--green); background: var(--green-dim); border-color: rgba(0,232,122,0.15); }

  .sidebar-footer { margin-top: auto; padding: 16px; border-top: 1px solid var(--border); }
  .user-pill { display: flex; align-items: center; gap: 10px; }
  .user-avatar { width: 32px; height: 32px; background: var(--surface2); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; color: var(--green); border: 1.5px solid rgba(0,232,122,0.3); }
  .user-info { flex: 1; }
  .user-name { font-size: 13px; font-weight: 500; }
  .user-role { font-size: 11px; color: var(--text3); }

  /* MAIN */
  .main { flex: 1; display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
  .topbar {
    height: 56px; border-bottom: 1px solid var(--border); display: flex; align-items: center;
    padding: 0 24px; gap: 16px; background: var(--bg); flex-shrink: 0;
  }
  .topbar-title { font-family: 'Space Grotesk', sans-serif; font-size: 16px; font-weight: 600; }
  .topbar-breadcrumb { font-size: 13px; color: var(--text3); }
  .topbar-sep { color: var(--text3); }
  .topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
  .btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 8px; font-size: 13px; font-weight: 500; cursor: pointer; border: 1px solid var(--border2); background: var(--surface); color: var(--text); transition: all 0.15s; font-family: inherit; }
  .btn:hover { background: var(--surface2); border-color: rgba(255,255,255,0.18); }
  .btn-green { background: var(--green); color: #000; border-color: transparent; font-weight: 600; }
  .btn-green:hover { background: #00d46e; }
  .btn-danger { background: rgba(239,68,68,0.12); color: var(--danger); border-color: rgba(239,68,68,0.2); }
  .btn-danger:hover { background: rgba(239,68,68,0.2); }
  .btn svg { width: 15px; height: 15px; }

  /* CONTENT AREA */
  .content { flex: 1; overflow-y: auto; padding: 24px; }
  .panel { display: none; }
  .panel.active { display: block; }

  /* DASHBOARD */
  .stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px; }
  .stat-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px 20px; }
  .stat-label { font-size: 11px; color: var(--text3); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; }
  .stat-value { font-family: 'Space Grotesk', sans-serif; font-size: 26px; font-weight: 700; }
  .stat-sub { font-size: 12px; color: var(--text3); margin-top: 4px; }
  .stat-green { color: var(--green); }
  .stat-accent { color: var(--accent); }
  .stat-amber { color: var(--accent2); }

  .section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
  .section-title { font-family: 'Space Grotesk', sans-serif; font-size: 15px; font-weight: 600; }

  /* PITCH OVERVIEW */
  .pitch-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; margin-bottom: 20px; }
  .pitch-svg-wrap { width: 100%; max-width: 500px; margin: 0 auto; }

  /* HEATMAP PANEL */
  .tool-layout { display: grid; grid-template-columns: 1fr 340px; gap: 18px; height: calc(100vh - 130px); }
  .tool-main { display: flex; flex-direction: column; gap: 14px; overflow-y: auto; }
  .tool-side { display: flex; flex-direction: column; gap: 14px; overflow-y: auto; }

  .card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px; }
  .card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
  .card-title { font-size: 13px; font-weight: 600; color: var(--text2); text-transform: uppercase; letter-spacing: 0.8px; }

  /* VIDEO ZONE */
  .video-zone {
    background: var(--bg3); border: 1.5px dashed var(--border2); border-radius: var(--radius-lg);
    min-height: 280px; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 12px; cursor: pointer; transition: all 0.2s; position: relative; overflow: hidden;
  }
  .video-zone:hover { border-color: var(--green); background: rgba(0,232,122,0.03); }
  .video-zone.has-video { border-style: solid; border-color: var(--border); cursor: default; }
  .video-zone video { width: 100%; border-radius: var(--radius); display: none; }
  .video-zone.has-video video { display: block; }
  .video-zone.has-video .upload-hint { display: none; }
  .upload-hint { text-align: center; pointer-events: none; }
  .upload-icon { width: 44px; height: 44px; background: var(--surface); border-radius: 12px; display: flex; align-items: center; justify-content: center; margin: 0 auto 10px; }
  .upload-title { font-size: 14px; font-weight: 500; color: var(--text); margin-bottom: 4px; }
  .upload-sub { font-size: 12px; color: var(--text3); }
  #videoInput { display: none; }

  /* URL INPUT */
  .url-row { display: flex; gap: 8px; margin-top: 10px; }
  .url-input {
    flex: 1; background: var(--bg3); border: 1px solid var(--border2); border-radius: 8px;
    padding: 8px 12px; font-size: 13px; color: var(--text); font-family: inherit; outline: none;
    transition: border-color 0.15s;
  }
  .url-input:focus { border-color: var(--green); }
  .url-input::placeholder { color: var(--text3); }

  /* CANVAS */
  .canvas-wrap { position: relative; background: var(--bg3); border-radius: var(--radius); overflow: hidden; }
  canvas { display: block; width: 100%; cursor: crosshair; }
  .canvas-overlay { position: absolute; inset: 0; pointer-events: none; }

  /* COORDINATE TABLE */
  .coord-table-wrap { max-height: 220px; overflow-y: auto; }
  .coord-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
  .coord-table th { padding: 6px 10px; text-align: left; color: var(--text3); font-weight: 500; font-size: 11px; text-transform: uppercase; letter-spacing: 0.8px; border-bottom: 1px solid var(--border); background: var(--bg3); position: sticky; top: 0; }
  .coord-table td { padding: 7px 10px; border-bottom: 1px solid var(--border); color: var(--text2); }
  .coord-table tr:hover td { background: var(--surface); color: var(--text); }
  .coord-table tr:last-child td { border-bottom: none; }
  .badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 500; }
  .badge-green { background: var(--green-dim); color: var(--green); }
  .badge-blue { background: rgba(59,130,246,0.12); color: var(--accent); }
  .delete-row { background: none; border: none; color: var(--text3); cursor: pointer; padding: 2px 5px; border-radius: 4px; transition: all 0.15s; }
  .delete-row:hover { color: var(--danger); background: rgba(239,68,68,0.1); }

  /* HEATMAP CANVAS */
  .heatmap-wrap { background: var(--bg3); border-radius: var(--radius); position: relative; overflow: hidden; }

  /* MINUTE INPUT */
  .minute-row { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
  .minute-label { font-size: 12px; color: var(--text3); white-space: nowrap; }
  .minute-input { width: 64px; background: var(--bg3); border: 1px solid var(--border2); border-radius: 6px; padding: 5px 8px; font-size: 13px; color: var(--text); font-family: inherit; outline: none; text-align: center; }
  .minute-input:focus { border-color: var(--green); }
  .player-input { flex: 1; background: var(--bg3); border: 1px solid var(--border2); border-radius: 6px; padding: 5px 10px; font-size: 13px; color: var(--text); font-family: inherit; outline: none; }
  .player-input:focus { border-color: var(--green); }

  /* EXCEL UPLOAD ZONE */
  .excel-zone { background: var(--bg3); border: 1.5px dashed var(--border2); border-radius: var(--radius); padding: 28px; text-align: center; cursor: pointer; transition: all 0.2s; }
  .excel-zone:hover { border-color: var(--accent2); background: rgba(245,158,11,0.03); }
  .excel-zone.drag-over { border-color: var(--green); background: var(--green-dim); }

  /* PITCH SVG */
  .pitch-field { background: #1e4620; border-radius: 8px; overflow: hidden; }

  /* TABS */
  .tab-row { display: flex; gap: 4px; background: var(--bg3); border-radius: 8px; padding: 3px; margin-bottom: 14px; }
  .tab-btn { flex: 1; padding: 6px 8px; border-radius: 6px; font-size: 12.5px; font-weight: 500; color: var(--text3); background: none; border: none; cursor: pointer; transition: all 0.15s; font-family: inherit; }
  .tab-btn.active { background: var(--surface2); color: var(--text); }
  .tab-pane { display: none; }
  .tab-pane.active { display: block; }

  /* TOAST */
  .toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; }
  .toast { background: var(--surface2); border: 1px solid var(--border2); border-radius: 10px; padding: 12px 16px; font-size: 13px; display: flex; align-items: center; gap: 10px; min-width: 280px; animation: slideIn 0.3s ease; }
  .toast.success { border-color: rgba(0,232,122,0.3); }
  .toast.error { border-color: rgba(239,68,68,0.3); }
  .toast-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
  .toast.success .toast-dot { background: var(--green); }
  .toast.error .toast-dot { background: var(--danger); }
  @keyframes slideIn { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: translateX(0); } }

  /* PROGRESS */
  .progress-bar { height: 3px; background: var(--surface); border-radius: 99px; overflow: hidden; margin-top: 6px; }
  .progress-fill { height: 100%; background: var(--green); border-radius: 99px; transition: width 0.3s; }

  /* SCROLLBAR */
  ::-webkit-scrollbar { width: 4px; height: 4px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: var(--surface2); border-radius: 99px; }
  ::-webkit-scrollbar-thumb:hover { background: var(--border2); }

  /* PITCH CANVAS (tracking) */
  #pitchCanvas { cursor: crosshair; }

  /* ANNOTATIONS */
  .annotation-list { display: flex; flex-direction: column; gap: 6px; max-height: 180px; overflow-y: auto; }
  .annotation-item { display: flex; align-items: center; gap: 10px; padding: 7px 10px; background: var(--bg3); border-radius: 8px; font-size: 12.5px; }
  .color-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
  .annotation-label { flex: 1; color: var(--text2); }
  .annotation-count { color: var(--text3); font-size: 11px; }

  /* SELECT */
  select { background: var(--bg3); border: 1px solid var(--border2); border-radius: 8px; padding: 7px 10px; font-size: 13px; color: var(--text); font-family: inherit; outline: none; cursor: pointer; }
  select:focus { border-color: var(--green); }

  /* EMPTY STATE */
  .empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 40px; text-align: center; color: var(--text3); }
  .empty-icon { width: 48px; height: 48px; background: var(--surface); border-radius: 12px; display: flex; align-items: center; justify-content: center; }
  .empty-title { font-size: 14px; font-weight: 500; color: var(--text2); }
  .empty-sub { font-size: 13px; }

  /* FIELD LINE NUMBERS */
  .field-label { fill: rgba(255,255,255,0.5); font-size: 10px; font-family: Inter, sans-serif; }