*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:       #f4f5f7;
    --surface:  #ffffff;
    --border:   #e2e4e9;
    --text:     #1a1d23;
    --muted:    #6b7280;
    --accent:   #2563eb;
    --accent-h: #1d4ed8;
    --green:    #16a34a;
    --red:      #dc2626;
    --amber:    #d97706;
    --purple:   #7c3aed;
    --radius:   8px;
    --shadow:   0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
}

body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 14px; color: var(--text); background: var(--bg); display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar { width: 220px; min-height: 100vh; background: #111827; color: #e5e7eb; display: flex; flex-direction: column; flex-shrink: 0; position: fixed; top: 0; left: 0; bottom: 0; }
.sidebar-logo { display: flex; align-items: center; gap: 10px; padding: 1.25rem 1rem; border-bottom: 1px solid #1f2937; font-size: 13px; font-weight: 600; line-height: 1.3; color: #fff; }
.sidebar-logo svg { flex-shrink: 0; opacity: .7; }
nav { flex: 1; padding: .5rem 0; overflow-y: auto; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 16px; color: #9ca3af; text-decoration: none; font-size: 13px; font-weight: 500; transition: background .1s, color .1s; }
.nav-item:hover { background: #1f2937; color: #f3f4f6; }
.nav-item.active { background: #1d4ed8; color: #fff; }
.nav-item svg { flex-shrink: 0; }
.sidebar-footer { padding: 1rem; font-size: 11px; color: #4b5563; border-top: 1px solid #1f2937; }

/* Badges */
.badge { margin-left: auto; background: #374151; color: #d1d5db; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 99px; }
.badge-red { background: #7f1d1d; color: #fca5a5; }

/* Main */
.main { margin-left: 220px; flex: 1; padding: 2rem; max-width: 1400px; }

/* Page header */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; flex-wrap: wrap; gap: .75rem; }
.page-header h1 { font-size: 1.25rem; font-weight: 700; }
.page-header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Alert */
.alert { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .75rem 1rem; border-radius: var(--radius); margin-bottom: 1.25rem; font-size: 13px; font-weight: 500; }
.alert-success { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.alert-error   { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-info    { background: #dbeafe; color: #1d4ed8; border: 1px solid #bfdbfe; }
.alert-warning { background: #fef9c3; color: #92400e; border: 1px solid #fde68a; }
.alert-close   { background: none; border: none; font-size: 1.2rem; cursor: pointer; color: inherit; opacity: .7; flex-shrink: 0; }

/* Stat grid */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 1.5rem; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem 1rem; border-left: 4px solid var(--border); }
.stat-num  { font-size: 1.75rem; font-weight: 700; line-height: 1; }
.stat-lbl  { font-size: 12px; color: var(--muted); margin-top: 4px; }
.stat-card.c-green  { border-left-color: var(--green);  } .stat-card.c-green  .stat-num { color: var(--green); }
.stat-card.c-red    { border-left-color: var(--red);    } .stat-card.c-red    .stat-num { color: var(--red); }
.stat-card.c-accent { border-left-color: var(--accent); } .stat-card.c-accent .stat-num { color: var(--accent); }
.stat-card.c-amber  { border-left-color: var(--amber);  } .stat-card.c-amber  .stat-num { color: var(--amber); }
.stat-card.c-purple { border-left-color: var(--purple); } .stat-card.c-purple .stat-num { color: var(--purple); }

/* Card */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; margin-bottom: 1.25rem; box-shadow: var(--shadow); }
.card h2 { font-size: .95rem; font-weight: 700; margin-bottom: 1rem; }
.card-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
@media (max-width: 900px) { .card-row { grid-template-columns: 1fr; } }
.card-warning { border-left: 4px solid var(--amber); }
.card-danger  { border-left: 4px solid var(--red); }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); font-size: 13px; font-weight: 500; cursor: pointer; text-decoration: none; transition: background .1s, border-color .1s; white-space: nowrap; }
.btn:hover { background: var(--bg); border-color: #c1c5cd; }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-h); border-color: var(--accent-h); }
.btn-danger  { background: var(--red); color: #fff; border-color: var(--red); }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* Forms */
label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
input[type=text], input[type=url], input[type=password], select, textarea {
    width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius);
    font-size: 13px; color: var(--text); background: var(--surface);
    transition: border-color .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.form-group { margin-bottom: 1.25rem; }
.form-hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }

/* Drop zone */
.drop-zone { border: 2px dashed var(--border); border-radius: var(--radius); padding: 2.5rem 1rem; text-align: center; cursor: pointer; transition: all .15s; background: #fafbfc; }
.drop-zone:hover, .drop-zone.drag { border-color: var(--accent); background: #eff6ff; }
.drop-zone svg { color: var(--muted); display: block; margin: 0 auto .75rem; }
.drop-zone p { color: var(--muted); font-size: 13px; margin: .25rem 0; }
.drop-zone small { font-size: 11px; color: #9ca3af; }
.file-chosen { display: flex; align-items: center; gap: 10px; padding: .75rem; background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: var(--radius); color: #15803d; font-size: 13px; }

/* Table */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { background: #f8f9fb; text-align: left; padding: 9px 12px; font-weight: 600; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafbfc; }

/* Status badges */
.status { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 99px; }
.status-found   { background: #dcfce7; color: #15803d; }
.status-missing { background: #fee2e2; color: #b91c1c; }
.status-pending { background: #fef9c3; color: #92400e; }
.status-skipped { background: #f3f4f6; color: #6b7280; }
.status-synced  { background: #dbeafe; color: #1d4ed8; }

/* Filter bar */
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.filter-bar input[type=text] { width: 200px; }
.filter-bar select { width: auto; }

/* Pagination */
.pagination { display: flex; align-items: center; gap: 8px; margin-top: 1rem; font-size: 13px; color: var(--muted); }

/* Empty state */
.empty-state { text-align: center; padding: 3rem 1rem; }
.empty-state svg { color: #d1d5db; display: block; margin: 0 auto 1rem; }
.empty-state h2 { font-size: 1rem; font-weight: 600; margin-bottom: .5rem; }
.empty-state p { color: var(--muted); margin-bottom: 1.5rem; }

/* Code / mono */
code { font-family: 'Courier New', monospace; font-size: 12px; background: #f3f4f6; padding: 1px 5px; border-radius: 3px; }
pre { background: #1e293b; color: #e2e8f0; padding: 1rem; border-radius: var(--radius); font-size: 12px; overflow-x: auto; line-height: 1.6; }

/* Spinner */
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid #c7d2fe; border-top-color: var(--accent); border-radius: 50%; animation: spin .6s linear infinite; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Progress bar */
.progress-bar { height: 6px; background: var(--border); border-radius: 99px; overflow: hidden; margin-top: .5rem; }
.progress-fill { height: 100%; background: var(--accent); border-radius: 99px; transition: width .3s; }
