:root {
  --text: #334155; --muted: #64748b; --muted-2: #94a3b8;
  --border: #e2e8f0; --surface: #ffffff; --bg: #f6f7fb;
  --blue: #3b82f6; --purple: #8b5cf6; --teal: #14b8a6;
  --green: #22c55e; --orange: #f59e0b; --red: #f43f5e;
  --shadow-sm: 0 2px 10px rgba(51, 65, 85, 0.06);
  --radius: 14px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--blue); }

.shell { display: flex; min-height: 100vh; }
.sidebar { width: 224px; background: var(--surface); border-right: 1px solid var(--border); padding: 22px 18px; flex-shrink: 0; }
.sidebar .brand {
  font-weight: 800; font-size: 19px; margin-bottom: 26px; letter-spacing: -0.3px;
  background: linear-gradient(90deg, var(--blue), var(--purple) 40%, var(--teal) 70%, var(--orange));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.sidebar nav { display: flex; flex-direction: column; gap: 3px; }
.sidebar nav a { color: var(--muted); text-decoration: none; padding: 10px 13px; border-radius: 10px; font-size: 14px; font-weight: 500; }
.sidebar nav a:hover { background: #f1f5f9; color: var(--text); }
.sidebar nav a.active { background: linear-gradient(135deg, var(--blue), var(--purple)); color: white; }
.sidebar nav a.logout { margin-top: 18px; color: var(--red); }

.content { flex: 1; padding: 32px 38px; max-width: 1120px; }
h1 { margin-top: 0; color: var(--text); }
h2 { color: var(--text); }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin: 22px 0 38px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm); }
.stat-card .num { display: block; font-size: 30px; font-weight: 800; color: var(--text); }
.stat-card .label { color: var(--muted); font-size: 13px; }
.stat-card:nth-child(1) .num { color: var(--blue); }
.stat-card:nth-child(2) .num { color: var(--purple); }
.stat-card:nth-child(3) .num { color: var(--teal); }
.stat-card:nth-child(4) .num { color: var(--orange); }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; margin-bottom: 28px; box-shadow: var(--shadow-sm); }
.panel h2 { margin-top: 0; font-size: 16px; }
.hint { color: var(--muted-2); font-size: 12px; margin: 10px 0 0; }

.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline-form input, .inline-form select {
  background: #f8fafc; border: 1px solid var(--border); color: var(--text);
  padding: 9px 12px; border-radius: 10px; font-size: 14px;
}
.inline-form input:focus, .inline-form select:focus { outline: 2px solid #dbeafe; border-color: var(--blue); }
.inline-form button {
  background: linear-gradient(135deg, var(--blue), var(--purple)); color: white; border: none; padding: 9px 20px;
  border-radius: 10px; cursor: pointer; font-weight: 600;
}
.inline-form button:hover { filter: brightness(1.06); }
.checkbox-label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }

.data-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.data-table th, .data-table td { text-align: left; padding: 13px 14px; border-bottom: 1px solid var(--border); font-size: 14px; }
.data-table th { color: var(--muted-2); font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: 0.03em; background: #fafbfd; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: #fafbff; }
.data-table input[type=text], .data-table select { background: #f8fafc; border: 1px solid var(--border); color: var(--text); padding: 6px 8px; border-radius: 8px; }
.data-table .actions { display: flex; gap: 10px; align-items: center; white-space: nowrap; }
.data-table .actions > * { margin-right: 4px; }
.data-table .actions > *:last-child { margin-right: 0; }
.data-table .actions button { background: #f1f5f9; color: var(--text); border: 1px solid var(--border); padding: 6px 12px; border-radius: 8px; cursor: pointer; font-weight: 600; }
.data-table .actions button:hover { background: #e2e8f0; }
.data-table a.danger { color: var(--red); text-decoration: none; font-weight: 500; }
.muted { color: var(--muted-2); font-size: 12px; }
.empty { color: var(--muted); text-align: center; padding: 30px !important; }

.badge { padding: 4px 11px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.badge-pending { background: #f1f5f9; color: var(--muted); }
.badge-crawling { background: #fef3c7; color: #b45309; }
.badge-done { background: #dcfce7; color: #15803d; }
.badge-error { background: #ffe4e6; color: #be123c; }
.badge-paused { background: #f1f5f9; color: var(--muted); }
.badge-ext { background: #ede9fe; color: var(--purple); margin-left: 6px; }

.notice { background: #dcfce7; color: #15803d; padding: 11px 16px; border-radius: 10px; margin-bottom: 18px; font-size: 14px; font-weight: 500; }
.error { color: var(--red); }

.pagination { display: flex; gap: 6px; margin-top: 20px; }
.pagination a { text-decoration: none; padding: 6px 12px; border-radius: 8px; border: 1px solid var(--border); color: var(--muted); background: var(--surface); }
.pagination a.active { color: white; background: var(--blue); border-color: var(--blue); }

body.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--bg); }
.login-box {
  background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 34px;
  width: 320px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 12px 40px rgba(51,65,85,0.1);
}
.login-box h1 {
  margin: 0 0 6px; font-size: 24px; font-weight: 800;
  background: linear-gradient(90deg, var(--blue), var(--purple) 40%, var(--teal) 70%, var(--orange));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.login-box label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.login-box label.checkbox-label { flex-direction: row; align-items: center; gap: 8px; }
.login-box label.checkbox-label input { width: auto; }
.login-box input { background: #f8fafc; border: 1px solid var(--border); color: var(--text); padding: 10px 12px; border-radius: 10px; font-size: 14px; }
.login-box input:focus { outline: 2px solid #dbeafe; border-color: var(--blue); }
.login-box button {
  background: linear-gradient(135deg, var(--blue), var(--purple)); color: white; border: none; padding: 12px;
  border-radius: 10px; font-weight: 700; cursor: pointer; margin-top: 6px;
}
.login-box button:hover { filter: brightness(1.06); }
