/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; font-size: 13px; color: #1d2327; background: #f0f0f1; display: flex; min-height: 100vh; }
a { text-decoration: none; color: inherit; }
code { background: #f0f0f1; padding: 1px 5px; border-radius: 3px; font-size: 12px; }
.hidden { display: none !important; }
.w-full { width: 100%; }

/* ── Sidebar ──────────────────────────────────────────────────────────────── */
#sidebar { width: 200px; min-height: 100vh; background: #1d2327; color: #a7aaad; display: flex; flex-direction: column; flex-shrink: 0; position: fixed; top: 0; left: 0; bottom: 0; z-index: 100; }
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 20px 16px 16px; border-bottom: 1px solid #2c3338; }
.brand-icon { font-size: 22px; }
.brand-name { font-size: 16px; font-weight: 700; color: #fff; letter-spacing: -0.3px; }
.sidebar-nav { flex: 1; padding: 12px 0; }
.nav-group-label { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; color: #6c7781; padding: 8px 16px 4px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 8px 16px; color: #a7aaad; transition: background .15s, color .15s; cursor: pointer; border-left: 3px solid transparent; }
.nav-item:hover { background: #2c3338; color: #fff; }
.nav-item.active { background: #2c3338; color: #fff; border-left-color: #2271b1; }
.nav-icon { font-size: 15px; width: 18px; text-align: center; }
.sidebar-footer { padding: 12px 16px; font-size: 11px; color: #50575e; border-top: 1px solid #2c3338; }

/* ── Main Wrap ────────────────────────────────────────────────────────────── */
#main-wrap { margin-left: 200px; flex: 1; display: flex; flex-direction: column; min-height: 100vh; }

/* ── Topbar ───────────────────────────────────────────────────────────────── */
#topbar { background: #fff; border-bottom: 1px solid #dcdcde; padding: 0 24px; height: 56px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 50; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.topbar-title { font-size: 20px; font-weight: 600; color: #1d2327; }
.topbar-actions { display: flex; gap: 8px; }

/* ── Content ──────────────────────────────────────────────────────────────── */
#content { padding: 24px; flex: 1; }

/* ── Stats Grid ───────────────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: #fff; border: 1px solid #dcdcde; border-radius: 4px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,.04); }
.stat-value { font-size: 32px; font-weight: 700; line-height: 1; }
.stat-label { font-size: 12px; color: #646970; margin-top: 6px; text-transform: capitalize; }
.stat-active   { color: #00a32a; }
.stat-archived { color: #dba617; }
.stat-not_found{ color: #d63638; }
.stat-pending  { color: #2271b1; }
.stat-error    { color: #d63638; }
.stat-total    { color: #1d2327; }

/* ── WP Card ──────────────────────────────────────────────────────────────── */
.wp-card { background: #fff; border: 1px solid #dcdcde; border-radius: 4px; box-shadow: 0 1px 3px rgba(0,0,0,.04); margin-bottom: 20px; }
.wp-card-header { padding: 12px 16px; border-bottom: 1px solid #dcdcde; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.wp-card-header h2 { font-size: 14px; font-weight: 600; color: #1d2327; }
.wp-card-body { padding: 16px; }
.wp-card-footer { padding: 12px 16px; border-top: 1px solid #dcdcde; display: flex; align-items: center; gap: 10px; }

/* ── Table ────────────────────────────────────────────────────────────────── */
.wp-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.wp-table th { text-align: left; padding: 8px 12px; background: #f6f7f7; border-bottom: 1px solid #dcdcde; font-weight: 600; color: #1d2327; white-space: nowrap; }
.wp-table td { padding: 10px 12px; border-bottom: 1px solid #f0f0f1; vertical-align: middle; }
.wp-table tbody tr:hover { background: #f6f7f7; }
.wp-table tbody tr:last-child td { border-bottom: none; }
.repo-name { font-weight: 600; color: #2271b1; }
.repo-name:hover { text-decoration: underline; }
.repo-url { font-size: 11px; color: #646970; }

/* ── Status Badge ─────────────────────────────────────────────────────────── */
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.badge-active    { background: #edfaef; color: #00a32a; }
.badge-archived  { background: #fcf9e8; color: #9a6700; }
.badge-not_found { background: #fce8e8; color: #d63638; }
.badge-pending   { background: #e8f0fa; color: #2271b1; }
.badge-error     { background: #fce8e8; color: #d63638; }

/* ── Tags ─────────────────────────────────────────────────────────────────── */
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 11px; background: #e8f0fa; color: #2271b1; }
.tag-gray { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 11px; background: #f0f0f1; color: #646970; }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.wp-btn { display: inline-flex; align-items: center; gap: 5px; padding: 6px 14px; border-radius: 3px; font-size: 13px; font-weight: 500; cursor: pointer; border: 1px solid transparent; transition: all .15s; }
.wp-btn-primary { background: #2271b1; color: #fff; border-color: #2271b1; }
.wp-btn-primary:hover { background: #135e96; border-color: #135e96; }
.wp-btn-secondary { background: #f6f7f7; color: #2c3338; border-color: #dcdcde; }
.wp-btn-secondary:hover { background: #f0f0f1; border-color: #c3c4c7; }
.wp-btn-danger { background: #d63638; color: #fff; border-color: #d63638; }
.wp-btn-danger:hover { background: #b32d2e; }
.wp-btn-sm { padding: 3px 10px; font-size: 12px; }
.wp-btn-link { background: none; border: none; color: #2271b1; padding: 0; font-size: 12px; cursor: pointer; }
.wp-btn-link:hover { text-decoration: underline; }

/* ── Form Elements ────────────────────────────────────────────────────────── */
.wp-input, .wp-select, .wp-textarea {
  border: 1px solid #dcdcde; border-radius: 3px; padding: 6px 10px;
  font-size: 13px; color: #1d2327; background: #fff; outline: none;
  transition: border-color .15s;
}
.wp-input:focus, .wp-select:focus, .wp-textarea:focus { border-color: #2271b1; box-shadow: 0 0 0 1px #2271b1; }
.wp-textarea { width: 100%; resize: vertical; font-family: monospace; font-size: 12px; }
.wp-label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 5px; color: #1d2327; }
.help-text { font-size: 12px; color: #646970; margin-bottom: 12px; line-height: 1.6; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { display: flex; flex-direction: column; }

/* ── Filter Bar ───────────────────────────────────────────────────────────── */
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filter-bar .wp-input { min-width: 180px; }
.search-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.search-bar .wp-input { flex: 1; min-width: 280px; }

/* ── Pagination ───────────────────────────────────────────────────────────── */
.page-info { font-size: 13px; color: #646970; flex: 1; text-align: center; }

/* ── Two Col ──────────────────────────────────────────────────────────────── */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.col-stack { display: flex; flex-direction: column; gap: 20px; }

/* ── Drop Zone ────────────────────────────────────────────────────────────── */
.drop-zone { border: 2px dashed #dcdcde; border-radius: 4px; padding: 32px; text-align: center; cursor: pointer; transition: border-color .15s; }
.drop-zone:hover { border-color: #2271b1; }
.drop-icon { font-size: 32px; margin-bottom: 8px; }
.drop-zone p { color: #646970; font-size: 13px; }

/* ── Search Results ───────────────────────────────────────────────────────── */
.results-grid { display: grid; gap: 12px; margin-top: 16px; }
.result-card { background: #fff; border: 1px solid #dcdcde; border-radius: 4px; padding: 16px; box-shadow: 0 1px 3px rgba(0,0,0,.04); cursor: pointer; transition: border-color .15s; }
.result-card:hover { border-color: #2271b1; }
.result-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.result-score { font-size: 12px; color: #646970; background: #f0f0f1; padding: 2px 8px; border-radius: 10px; }

/* ── Modal ────────────────────────────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-box { background: #fff; border-radius: 4px; width: 100%; max-width: 680px; max-height: 85vh; overflow-y: auto; box-shadow: 0 4px 24px rgba(0,0,0,.2); }
.modal-header { padding: 16px 20px; border-bottom: 1px solid #dcdcde; display: flex; justify-content: space-between; align-items: center; }
.modal-header h2 { font-size: 16px; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: #646970; line-height: 1; }
.modal-close:hover { color: #1d2327; }
.modal-body { padding: 20px; }
.modal-footer { padding: 12px 20px; border-top: 1px solid #dcdcde; display: flex; gap: 8px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px 0; }
.detail-item { font-size: 13px; }
.detail-label { color: #646970; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 2px; }
.detail-value { font-weight: 500; }
.detail-summary { font-size: 13px; color: #3c434a; line-height: 1.7; margin: 12px 0; padding: 12px; background: #f6f7f7; border-radius: 3px; border-left: 3px solid #2271b1; }
.error-box { background: #fce8e8; border: 1px solid #f8b4b4; border-radius: 3px; padding: 10px 12px; font-size: 12px; color: #d63638; margin: 10px 0; }

/* ── Toast ────────────────────────────────────────────────────────────────── */
.toast { position: fixed; bottom: 24px; right: 24px; background: #1d2327; color: #fff; padding: 10px 18px; border-radius: 4px; font-size: 13px; z-index: 300; box-shadow: 0 2px 8px rgba(0,0,0,.3); }
.toast.success { background: #00a32a; }
.toast.error   { background: #d63638; }

/* ── Notice ───────────────────────────────────────────────────────────────── */
.notice { padding: 10px 14px; border-radius: 3px; font-size: 13px; border-left: 4px solid; margin-bottom: 12px; }
.notice-success { background: #edfaef; border-color: #00a32a; color: #1d2327; }
.notice-error   { background: #fce8e8; border-color: #d63638; color: #1d2327; }

/* ── Checkbox col ─────────────────────────────────────────────────────────── */
.wp-table th:first-child, .wp-table td:first-child { width: 32px; }
