
  :root {
    --primary: #2563eb; --primary-dark: #1d4ed8; --success: #16a34a;
    --danger: #dc2626; --warning: #d97706; --gray: #6b7280;
    --bg: #f1f5f9; --card: #ffffff; --border: #e2e8f0;
    --text: #1e293b; --text-muted: #64748b;
  }
  * { box-sizing: border-box; margin: 0; padding: 0; }
  body { font-family: 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }

  /* HEADER */
  .header { background: linear-gradient(135deg, #1e3a8a, #2563eb); color: white; padding: 20px 24px; display: flex; align-items: center; justify-content: space-between; box-shadow: 0 2px 8px rgba(0,0,0,.2); }
  .header h1 { font-size: 20px; font-weight: 700; }
  .header .subtitle { font-size: 12px; opacity: .8; margin-top: 2px; }
  .header-actions { display: flex; gap: 8px; align-items: center; }

  /* NAV */
  .nav { background: white; border-bottom: 1px solid var(--border); display: flex; gap: 0; padding: 0 24px; overflow-x: auto; }
  .nav-btn { padding: 12px 18px; border: none; background: none; cursor: pointer; font-size: 13px; font-weight: 500; color: var(--text-muted); border-bottom: 2px solid transparent; white-space: nowrap; transition: all .2s; }
  .nav-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
  .nav-btn:hover { color: var(--primary); }

  /* LAYOUT */
  .container { max-width: 1400px; margin: 0 auto; padding: 20px 24px; }
  .page { display: none; } .page.active { display: block; }

  /* STATS BAR */
  .stats-bar { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
  .stat-card { background: white; border-radius: 10px; padding: 14px 16px; border: 1px solid var(--border); text-align: center; }
  .stat-card .val { font-size: 28px; font-weight: 700; }
  .stat-card .lbl { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
  .stat-card.total .val { color: var(--primary); }
  .stat-card.pass .val { color: var(--success); }
  .stat-card.fail .val { color: var(--danger); }
  .stat-card.skip .val { color: var(--warning); }
  .stat-card.rate .val { color: #7c3aed; }

  /* PROGRESS */
  .progress-wrap { background: white; border-radius: 10px; padding: 16px 20px; border: 1px solid var(--border); margin-bottom: 20px; }
  .progress-wrap h3 { font-size: 13px; color: var(--text-muted); margin-bottom: 10px; }
  .progress-bar { height: 12px; background: #e2e8f0; border-radius: 6px; overflow: hidden; display: flex; }
  .progress-pass { background: var(--success); transition: width .5s; }
  .progress-fail { background: var(--danger); transition: width .5s; }
  .progress-skip { background: var(--warning); transition: width .5s; }
  .progress-todo { background: #cbd5e1; transition: width .5s; }
  .progress-legend { display: flex; gap: 16px; margin-top: 8px; flex-wrap: wrap; }
  .legend-item { display: flex; align-items: center; gap: 5px; font-size: 12px; }
  .legend-dot { width: 10px; height: 10px; border-radius: 50%; }

  /* TOOLBAR */
  .toolbar { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
  .toolbar select, .toolbar input { padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; background: white; }
  .btn { padding: 7px 14px; border: none; border-radius: 6px; cursor: pointer; font-size: 13px; font-weight: 500; display: inline-flex; align-items: center; gap: 5px; transition: all .15s; }
  .btn-primary { background: var(--primary); color: white; } .btn-primary:hover { background: var(--primary-dark); }
  .btn-success { background: var(--success); color: white; } .btn-success:hover { background: #15803d; }
  .btn-danger { background: var(--danger); color: white; } .btn-danger:hover { background: #b91c1c; }
  .btn-warning { background: var(--warning); color: white; } .btn-warning:hover { background: #b45309; }
  .btn-gray { background: #e2e8f0; color: var(--text); } .btn-gray:hover { background: #cbd5e1; }
  .btn-sm { padding: 4px 10px; font-size: 12px; }
  .ml-auto { margin-left: auto; }

  /* SECTION */
  .section { background: white; border-radius: 10px; border: 1px solid var(--border); margin-bottom: 16px; overflow: hidden; }
  .section-header { padding: 12px 16px; background: #f8fafc; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
  .section-header h3 { font-size: 14px; font-weight: 600; flex: 1; }
  .section-header .badge { font-size: 11px; padding: 2px 8px; border-radius: 99px; font-weight: 600; }
  .badge-blue { background: #dbeafe; color: #1d4ed8; }
  .badge-green { background: #dcfce7; color: #15803d; }
  .badge-red { background: #fee2e2; color: #b91c1c; }
  .badge-yellow { background: #fef9c3; color: #854d0e; }
  .badge-gray { background: #f1f5f9; color: #475569; }
  .section-body { display: block; }
  .section-body.collapsed { display: none; }
  .toggle-icon { font-size: 12px; transition: transform .2s; }
  .collapsed-icon { transform: rotate(-90deg); }

  /* TABLE */
  .tc-table { width: 100%; border-collapse: collapse; }
  .tc-table thead tr { background: #f8fafc; }
  .tc-table th { padding: 10px 12px; text-align: left; font-size: 12px; font-weight: 600; color: var(--text-muted); border-bottom: 1px solid var(--border); white-space: nowrap; }
  .tc-table td { padding: 10px 12px; border-bottom: 1px solid #f1f5f9; vertical-align: top; }
  .tc-table tr:last-child td { border-bottom: none; }
  .tc-table tr:hover td { background: #fafbff; }
  .tc-id { font-family: monospace; font-size: 12px; color: var(--text-muted); white-space: nowrap; }
  .tc-name { font-weight: 500; line-height: 1.4; }
  .tc-desc { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
  .tc-role { font-size: 11px; padding: 2px 7px; border-radius: 99px; background: #e0e7ff; color: #3730a3; font-weight: 500; white-space: nowrap; display: inline-block; }
  .tc-priority { font-size: 11px; padding: 2px 7px; border-radius: 99px; font-weight: 600; }
  .priority-high { background: #fee2e2; color: #b91c1c; }
  .priority-medium { background: #fef9c3; color: #854d0e; }
  .priority-low { background: #f0fdf4; color: #15803d; }

  /* STATUS SELECT */
  .status-select { padding: 4px 8px; border: 1px solid var(--border); border-radius: 5px; font-size: 12px; cursor: pointer; background: white; min-width: 110px; }
  .status-pass { border-color: var(--success); color: var(--success); background: #f0fdf4; }
  .status-fail { border-color: var(--danger); color: var(--danger); background: #fef2f2; }
  .status-skip { border-color: var(--warning); color: var(--warning); background: #fffbeb; }
  .status-todo { border-color: #94a3b8; color: #64748b; background: #f8fafc; }

  /* ERROR NOTE */
  .error-zone { margin-top: 6px; display: none; }
  .error-zone.show { display: block; }
  .error-note { width: 100%; padding: 6px 8px; border: 1px solid var(--border); border-radius: 5px; font-size: 12px; resize: vertical; min-height: 50px; font-family: inherit; }
  .img-upload { margin-top: 5px; }
  .img-upload input[type=file] { font-size: 12px; }
  .img-thumbnails { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 5px; }
  .img-thumb { width: 60px; height: 60px; object-fit: cover; border-radius: 4px; border: 1px solid var(--border); cursor: pointer; }
  .img-thumb-wrap { position: relative; }
  .img-thumb-del { position: absolute; top: -4px; right: -4px; background: var(--danger); color: white; border: none; border-radius: 50%; width: 16px; height: 16px; font-size: 10px; cursor: pointer; display: flex; align-items: center; justify-content: center; line-height: 1; }

  /* MODAL */
  .modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 1000; align-items: center; justify-content: center; }
  .modal-overlay.open { display: flex; }
  .modal { background: white; border-radius: 12px; padding: 24px; width: 90%; max-width: 640px; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
  .modal h2 { font-size: 17px; font-weight: 700; margin-bottom: 20px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
  .form-row { margin-bottom: 14px; }
  .form-row label { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 5px; text-transform: uppercase; letter-spacing: .5px; }
  .form-row input, .form-row select, .form-row textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; font-family: inherit; transition: border-color .15s; }
  .form-row input:focus, .form-row select:focus, .form-row textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(37,99,235,.15); }
  .form-row textarea { resize: vertical; min-height: 80px; }
  .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .modal-footer { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--border); }

  /* SUPABASE CONFIG */
  .config-card { background: white; border: 1px solid var(--border); border-radius: 10px; padding: 20px; margin-bottom: 16px; }
  .config-card h3 { font-size: 15px; font-weight: 700; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
  .status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
  .dot-green { background: var(--success); }
  .dot-red { background: var(--danger); }
  .dot-gray { background: var(--gray); }
  .code-block { background: #1e293b; color: #e2e8f0; padding: 16px; border-radius: 8px; font-family: monospace; font-size: 12px; line-height: 1.6; overflow-x: auto; white-space: pre; margin-top: 10px; }
  .alert { padding: 10px 14px; border-radius: 6px; font-size: 13px; margin-bottom: 12px; }
  .alert-info { background: #dbeafe; color: #1d4ed8; border: 1px solid #bfdbfe; }
  .alert-success { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
  .alert-error { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }

  /* IMAGE MODAL */
  .img-modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.85); z-index: 2000; align-items: center; justify-content: center; cursor: zoom-out; }
  .img-modal.open { display: flex; }
  .img-modal img { max-width: 90vw; max-height: 90vh; border-radius: 8px; object-fit: contain; }

  /* RESPONSIVE */
  @media (max-width: 768px) {
    .form-grid { grid-template-columns: 1fr; }
    .stats-bar { grid-template-columns: repeat(3, 1fr); }
    .tc-table th:nth-child(3), .tc-table td:nth-child(3) { display: none; }
  }

  .row-pass td { background: #f0fdf4 !important; }
  .row-fail td { background: #fef2f2 !important; }
  .row-skip td { background: #fffbeb !important; }
  .no-data { text-align: center; padding: 30px; color: var(--text-muted); font-style: italic; }
  .chip { display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 4px; margin: 1px; }
  .save-indicator { font-size: 11px; color: var(--success); opacity: 0; transition: opacity .5s; }
  .save-indicator.show { opacity: 1; }
  /* EXCEL IMPORT */
  .excel-drop-zone { border: 2px dashed var(--border); border-radius: 10px; padding: 32px 20px; text-align: center; cursor: pointer; transition: all .2s; background: #fafbff; user-select: none; }
  .excel-drop-zone:hover, .excel-drop-zone.drag-over { border-color: var(--primary); background: #eff6ff; }