:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --border: #e4e7ec;
  --text: #1d2939;
  --muted: #667085;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --green: #16a34a;
  --red: #dc2626;
  --amber: #d97706;
  --radius: 10px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; background: #0f172a; color: #cbd5e1; padding: 20px 0; flex-shrink: 0;
}
.sidebar .brand { color: #fff; font-weight: 700; font-size: 16px; padding: 0 20px 16px; }
.sidebar a { display: block; color: #cbd5e1; padding: 10px 20px; }
.sidebar a:hover, .sidebar a.active { background: #1e293b; color: #fff; text-decoration: none; }
.main { flex: 1; padding: 24px 32px; max-width: 1200px; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.topbar h1 { font-size: 20px; margin: 0; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px;
}
.card .num { font-size: 30px; font-weight: 700; }
.card .label { color: var(--muted); font-size: 13px; }

table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: var(--radius); overflow: hidden; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
th { background: #f9fafb; color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; }
tr:last-child td { border-bottom: 0; }

.btn { display: inline-block; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border);
  background: #fff; color: var(--text); cursor: pointer; font-size: 13px; }
.btn:hover { text-decoration: none; background: #f9fafb; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12px; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.green { background: #dcfce7; color: #166534; }
.badge.red { background: #fee2e2; color: #991b1b; }
.badge.amber { background: #fef3c7; color: #92400e; }
.badge.gray { background: #f1f5f9; color: #475569; }

form .field { margin-bottom: 14px; }
label { display: block; font-weight: 600; margin-bottom: 4px; font-size: 13px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url],
select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px;
  font-family: inherit; background: #fff;
}
textarea { min-height: 80px; resize: vertical; }
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.row > .field { flex: 1; min-width: 200px; }
.section { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; }
.section h2 { margin-top: 0; font-size: 16px; }
.help { color: var(--muted); font-size: 12px; }

.flex { display: flex; gap: 8px; align-items: center; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.right { text-align: right; }

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.login-box { background: #fff; padding: 32px; border-radius: 12px; border: 1px solid var(--border); width: 340px; }
.login-box h1 { font-size: 18px; margin-top: 0; }
.error { background: #fee2e2; color: #991b1b; padding: 10px; border-radius: 8px; margin-bottom: 12px; font-size: 13px; }
.success { background: #dcfce7; color: #166534; padding: 10px; border-radius: 8px; margin-bottom: 12px; font-size: 13px; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
pre { background: #0f172a; color: #e2e8f0; padding: 12px; border-radius: 8px; overflow-x: auto; font-size: 12px; }
.chat-bubble { padding: 8px 12px; border-radius: 12px; margin: 6px 0; max-width: 80%; }
.chat-bubble.user { background: var(--primary); color: #fff; margin-left: auto; }
.chat-bubble.bot { background: #f1f5f9; color: var(--text); }
