:root {
  --bg: #eef1f6;
  --surface: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --radius: 12px;
  --shadow: 0 8px 30px rgba(15, 23, 42, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}

.app-header {
  background: var(--header-gradient, linear-gradient(135deg, #1e3c72, #2a5298));
  color: #fff;
  padding: 28px 32px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.app-header h1 {
  margin: 0 0 6px;
  font-size: 1.75rem;
  font-weight: 700;
}

.app-header p {
  margin: 0;
  opacity: 0.92;
}

.app-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  background: #111827;
  padding: 10px 12px;
  border-radius: var(--radius);
  margin-bottom: 24px;
}

.app-nav a, .app-nav button.nav-btn {
  color: #f9fafb;
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.95rem;
  border: none;
  background: transparent;
  cursor: pointer;
}

.app-nav a:hover, .app-nav button.nav-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.app-nav .nav-spacer { flex: 1; }

.user-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.14);
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.9rem;
}

.user-badge strong { font-weight: 600; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.card h2 {
  margin: 0 0 8px;
  font-size: 1.25rem;
}

.card .subtitle {
  color: var(--muted);
  margin-bottom: 20px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.form-group { margin-bottom: 16px; }

label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 0.92rem;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="file"],
textarea,
select {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  background: #fff;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent, #2563eb);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent, #2563eb);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
}

.btn:hover { filter: brightness(0.95); }

.btn.secondary { background: #4b5563; }
.btn.danger { background: #dc2626; }
.btn.ghost { background: transparent; color: var(--accent, #2563eb); border: 1px solid var(--border); }

.alert {
  padding: 12px 14px;
  border-radius: 8px;
  margin-top: 12px;
  font-size: 0.95rem;
}

.alert.success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.alert.error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert.info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.alert.warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

.info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; padding: 12px 14px; border-radius: 8px; margin: 10px 0; font-size: 0.95rem; }
.success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; padding: 12px 14px; border-radius: 8px; margin: 10px 0; }
.error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; padding: 12px 14px; border-radius: 8px; margin: 10px 0; }

.auth-layout {
  max-width: 460px;
  margin: 0 auto;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.auth-tab {
  padding: 10px;
  border: 1px solid var(--border);
  background: #f9fafb;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}

.auth-tab.active {
  background: var(--accent, #2563eb);
  color: #fff;
  border-color: transparent;
}

.auth-note {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

th, td {
  border-bottom: 1px solid var(--border);
  padding: 10px 8px;
  text-align: left;
  vertical-align: top;
}

th {
  background: #f9fafb;
  font-weight: 600;
  color: #374151;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stat-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}

.stat-box h3 {
  margin: 0;
  font-size: 1.8rem;
  color: var(--accent, #2563eb);
}

.stat-box p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

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

.tool-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.muted { color: var(--muted); font-size: 0.9rem; }
