:root {
  --bg: #0b1020;
  --bg-soft: rgba(255,255,255,0.06);
  --panel: rgba(17, 24, 39, 0.82);
  --panel-border: rgba(255,255,255,0.08);
  --text: #f8fafc;
  --muted: #9ca3af;
  --primary: #7c3aed;
  --primary-2: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --shadow: 0 20px 50px rgba(0,0,0,0.25);
  --radius: 24px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: Inter, Arial, sans-serif; background: linear-gradient(135deg, #0b1020 0%, #151b2f 40%, #1b1130 100%); color: var(--text); }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
.hidden { display: none; }

body.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(460px, 100%);
  background: var(--panel);
  backdrop-filter: blur(20px);
  border: 1px solid var(--panel-border);
  border-radius: 30px;
  box-shadow: var(--shadow);
  padding: 32px;
}

.login-card h1, .login-card h2 { margin-top: 0; }
.login-subtitle { color: var(--muted); margin-bottom: 24px; }

.app-shell {
  display: grid;
  grid-template-columns: 290px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: rgba(255,255,255,0.04);
  backdrop-filter: blur(16px);
  border-right: 1px solid var(--panel-border);
  padding: 24px;
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 28px;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary), #a855f7);
  font-weight: 700;
}

.brand span, .topbar p, .muted { color: var(--muted); }

.menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.menu a {
  padding: 14px 16px;
  border-radius: 16px;
  color: #dbe4ff;
  transition: 0.2s ease;
}

.menu a:hover, .menu a.active {
  background: rgba(124,58,237,0.2);
  border: 1px solid rgba(124,58,237,0.35);
}

.main-content {
  padding: 24px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.topbar h1 { margin: 0 0 4px; }
.topbar-user {
  padding: 14px 18px;
  border-radius: 16px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--panel-border);
}

.alert {
  padding: 14px 16px;
  border-radius: 16px;
  margin-bottom: 20px;
  border: 1px solid transparent;
}
.alert.success { background: rgba(34,197,94,0.16); border-color: rgba(34,197,94,0.35); }
.alert.error { background: rgba(239,68,68,0.16); border-color: rgba(239,68,68,0.35); }
.alert.warning { background: rgba(245,158,11,0.16); border-color: rgba(245,158,11,0.35); }

.card {
  background: var(--panel);
  backdrop-filter: blur(18px);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 22px;
}

.grid {
  display: grid;
  gap: 18px;
}

.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.metric {
  position: relative;
  overflow: hidden;
}

.metric strong {
  display: block;
  font-size: 28px;
  margin-top: 10px;
}

.metric::after {
  content: '';
  position: absolute;
  right: -20px;
  top: -20px;
  width: 120px;
  height: 120px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(124,58,237,0.25), transparent 65%);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.btn, button, input[type='submit'] {
  border: 0;
  border-radius: 14px;
  padding: 12px 16px;
  cursor: pointer;
  font-weight: 600;
  transition: .2s ease;
}

.btn-primary, button, input[type='submit'] {
  background: linear-gradient(135deg, var(--primary), #9333ea);
  color: white;
}

.btn-secondary {
  background: rgba(255,255,255,0.08);
  color: white;
  border: 1px solid var(--panel-border);
}

.btn-success { background: linear-gradient(135deg, #16a34a, var(--primary-2)); color: white; }
.btn-danger { background: linear-gradient(135deg, #dc2626, var(--danger)); color: white; }

.btn:hover, button:hover, input[type='submit']:hover { transform: translateY(-1px); opacity: .95; }

form .form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field.full { grid-column: 1 / -1; }

label { font-size: 14px; color: #e5e7eb; }
input, select, textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: white;
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: rgba(124,58,237,0.7);
  box-shadow: 0 0 0 4px rgba(124,58,237,0.14);
}
textarea { min-height: 120px; resize: vertical; }

.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
}
th, td {
  padding: 14px 12px;
  text-align: left;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  vertical-align: top;
}
th { color: #cbd5e1; font-size: 14px; }
td small { color: var(--muted); display: block; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  font-size: 12px;
}
.badge.success { background: rgba(34,197,94,0.16); }
.badge.warning { background: rgba(245,158,11,0.16); }
.badge.danger { background: rgba(239,68,68,0.16); }

.progress {
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255,255,255,0.08);
}
.progress > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), #a855f7);
}

.kbd {
  font-family: monospace;
  background: rgba(255,255,255,0.08);
  padding: 3px 7px;
  border-radius: 8px;
}

.preview-image {
  width: 160px;
  border-radius: 18px;
  border: 1px solid var(--panel-border);
  margin-top: 10px;
}

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 30px 10px;
}

.inline-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.split-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.section-title { margin: 0; }

@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 880px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--panel-border); }
  form .form-grid, .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; align-items: flex-start; }
}
