/* MixPlatform Admin */
:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --surface2: #243044;
  --border: #2d3a4f;
  --text: #e7ecf3;
  --muted: #8b9cb3;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --success: #22c55e;
  --warn: #f59e0b;
  --danger: #ef4444;
  --radius: 8px;
  --sidebar-w: 220px;
}

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

body {
  font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
}

.hidden { display: none !important; }

/* Login */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
}
.login-card h1 { font-size: 1.5rem; margin-bottom: 8px; }
.login-card p { color: var(--muted); margin-bottom: 24px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 12px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--surface2); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.error-msg { color: var(--danger); font-size: 13px; margin-top: 12px; }

/* Layout */
.app-layout { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.sidebar-brand {
  padding: 20px 16px;
  font-weight: 700;
  font-size: 1.1rem;
  border-bottom: 1px solid var(--border);
}
.sidebar-brand span { color: var(--accent); }
.nav { flex: 1; padding: 12px 8px; }
.nav-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: var(--radius);
  cursor: pointer;
  margin-bottom: 4px;
  font-size: 13px;
}
.nav-item:hover, .nav-item.active { background: var(--surface2); color: var(--text); }
.nav-item.active { border-left: 3px solid var(--accent); }
.sidebar-footer { padding: 12px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
}
.topbar h2 { font-size: 1.15rem; font-weight: 600; }
.content { padding: 24px; flex: 1; overflow: auto; }

/* Cards & stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.stat-card .label { color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.stat-card .value { font-size: 1.5rem; font-weight: 700; }
.stat-card .sub { color: var(--muted); font-size: 11px; margin-top: 4px; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 20px;
  overflow: hidden;
}
.panel-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.panel-header h3 { font-size: 14px; font-weight: 600; }
.panel-body { padding: 16px; overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 500; font-size: 11px; text-transform: uppercase; }
tr:hover td { background: rgba(255,255,255,0.02); }
.mono { font-family: ui-monospace, monospace; font-size: 11px; word-break: break-all; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
}
.badge-pending { background: rgba(245,158,11,0.2); color: var(--warn); }
.badge-success { background: rgba(34,197,94,0.2); color: var(--success); }
.badge-fail { background: rgba(239,68,68,0.2); color: var(--danger); }
.badge-muted { background: var(--surface2); color: var(--muted); }

.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  z-index: 999;
  max-width: 400px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.toast.ok { border-color: var(--success); }
.toast.err { border-color: var(--danger); }

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.detail-item { font-size: 13px; }
.detail-item .k { color: var(--muted); font-size: 11px; margin-bottom: 4px; }

@media (max-width: 768px) {
  .app-layout { flex-direction: column; }
  .sidebar { width: 100%; }
  .nav { display: flex; overflow-x: auto; padding: 8px; }
  .nav-item { white-space: nowrap; margin-right: 4px; margin-bottom: 0; }
}
