:root {
  --bg-main: #090d16;
  --bg-card: #0f172a;
  --bg-card-hover: #162038;
  --bg-input: #1e293b;
  --border: #334155;
  --border-light: #1e293b;
  --primary: #38bdf8;
  --primary-hover: #0284c7;
  --accent: #818cf8;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --radius: 10px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header & Navigation */
header {
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  height: 34px;
  width: auto;
  border-radius: 4px;
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 700;
  background: linear-gradient(135deg, #38bdf8, #818cf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-badge {
  background: rgba(56, 189, 248, 0.15);
  color: var(--primary);
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: 12px;
  font-weight: 600;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: var(--radius);
  transition: all 0.2s ease;
}

nav a:hover, nav a.active {
  color: var(--text-main);
  background: var(--bg-card-hover);
}

nav a.active {
  color: var(--primary);
  border-bottom: 2px solid var(--primary);
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-tag {
  font-size: 0.82rem;
  color: var(--text-muted);
  background: var(--bg-input);
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.btn-logout {
  color: var(--danger);
  font-size: 0.82rem;
  text-decoration: none;
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 5px 12px;
  border-radius: 6px;
  transition: background 0.2s;
}

.btn-logout:hover {
  background: rgba(239, 68, 68, 0.15);
}

/* Main Container */
main {
  flex: 1;
  padding: 24px 32px;
  max-width: 1440px;
  margin: 0 auto;
  width: 100%;
}

/* Page Headers */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.page-title {
  font-size: 1.45rem;
  font-weight: 700;
}

.page-subtitle {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-top: 4px;
}

/* Metric Cards Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s ease;
}

.metric-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
}

.metric-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.metric-value {
  font-size: 1.85rem;
  font-weight: 700;
  margin: 8px 0 4px 0;
  color: var(--text-main);
}

.metric-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Standard Card */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 24px;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

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

th {
  background: #0b1120;
  color: var(--text-muted);
  font-weight: 600;
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-main);
}

tr:hover td {
  background: var(--bg-card-hover);
}

/* Badges */
.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-success { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-primary { background: rgba(56, 189, 248, 0.15); color: #38bdf8; border: 1px solid rgba(56, 189, 248, 0.3); }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-danger { background: rgba(239, 68, 68, 0.15); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3); }
.badge-purple { background: rgba(129, 140, 248, 0.15); color: #a5b4fc; border: 1px solid rgba(129, 140, 248, 0.3); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-input);
  color: var(--text-main);
  border: 1px solid var(--border);
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
}

.btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--primary);
}

.btn-primary {
  background: var(--primary);
  color: #031326;
  border: none;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-sm {
  padding: 4px 10px;
  font-size: 0.8rem;
}

/* Forms & Inputs */
.form-group {
  margin-bottom: 16px;
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}

input[type="text"], input[type="password"], input[type="email"], select, textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
}

/* Modals */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 200;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 600px;
  padding: 24px;
  max-height: 90vh;
  overflow-y: auto;
}

/* Login Card */
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 80vh;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 36px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
}
