:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-2: #334155;
  --text: #f8fafc;
  --muted: #94a3b8;
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --success: #22c55e;
  --danger: #ef4444;
  --border: #475569;
  --radius: 12px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

.container { width: min(92%, 1200px); margin: 0 auto; padding: 1.5rem 0; }

.topbar { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100; }
.topbar .container { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 0; flex-wrap: wrap; }
.logo { font-size: 1.5rem; font-weight: 800; }
.logo span { color: var(--primary); }

.tabs { display: flex; gap: 0.5rem; }
.tab { padding: 0.5rem 1rem; background: transparent; border: 1px solid transparent; border-radius: 6px; color: var(--muted); cursor: pointer; font-weight: 500; }
.tab:hover, .tab.active { color: var(--text); background: var(--surface-2); }

.panel { display: none; }
.panel.active { display: block; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); }
.card h2 { font-size: 1.15rem; margin-bottom: 1.25rem; }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1.5rem; }
.mt-3 { margin-top: 1.5rem; }

.field { margin-bottom: 1rem; }
label { display: block; margin-bottom: 0.4rem; font-size: 0.9rem; color: var(--muted); font-weight: 500; }
input, select, textarea { width: 100%; padding: 0.65rem 0.9rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-size: 0.95rem; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2); }
input[type="checkbox"], input[type="file"] { width: auto; }

.checkbox label, .radio-row label { display: flex; align-items: center; gap: 0.5rem; color: var(--text); cursor: pointer; }
.radio-row { display: flex; gap: 1.25rem; flex-wrap: wrap; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; padding: 0.65rem 1.25rem; border: none; border-radius: 8px; font-size: 0.95rem; font-weight: 600; cursor: pointer; transition: background 0.2s, transform 0.1s; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-danger { background: var(--danger); color: #fff; }

.inline-form { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: flex-start; }
.inline-form input, .inline-form select { flex: 1; min-width: 160px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { padding: 0.75rem; text-align: left; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.stat { text-align: center; padding: 1rem; background: var(--surface-2); border-radius: 8px; }
.stat-value { font-size: 1.75rem; font-weight: 800; }
.stat-label { font-size: 0.85rem; color: var(--muted); }

.result { margin-top: 1rem; padding: 0.75rem 1rem; border-radius: 8px; font-size: 0.9rem; }
.result.success { background: rgba(34, 197, 94, 0.1); color: var(--success); }
.result.error { background: rgba(239, 68, 68, 0.1); color: var(--danger); }
.spinner { color: var(--muted); margin-left: 1rem; }
.muted { color: var(--muted); font-size: 0.9rem; }
code { background: var(--surface-2); padding: 0.15rem 0.35rem; border-radius: 4px; font-size: 0.85em; }
.hidden { display: none !important; }

@media (max-width: 640px) {
  .topbar .container { flex-direction: column; align-items: flex-start; }
  .tabs { width: 100%; overflow-x: auto; }
}
