/* =========================
   THEME VARIABLES
========================= */
:root {
  --primary: #00b0ff;
  --primary-2: #0078d7;
  --dark: #0b1220;
  --muted: #9aa6b2;
  --bg: #071026;
  --card: rgba(255, 255, 255, 0.03);
  --glass: rgba(255, 255, 255, 0.04);
  --accent: #6af2c8;
  --danger: #f31212;
  --glass-blur: 8px;
}

/* =========================
   RESET & BASE
========================= */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0;
  font-family: Inter, "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  background: linear-gradient(180deg, #020417 0%, #071026 60%);
  color: #e6f0ff;
}

#app {
  display: flex;
  min-height: 100vh;
}

/* =========================
   SIDEBAR
========================= */
#sidebar {
  width: 260px;
  background: linear-gradient(180deg, var(--primary), var(--primary-2));
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 4px 6px 24px rgba(0,0,0,0.45);
  transition: width 0.22s ease;
}

#sidebar.collapsed {
  width: 84px;
}

/* Brand */
.brand {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand-left {
  display: flex;
  gap: 12px;
  align-items: center;
}

.brand-logo {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  border: 2px solid rgba(255,255,255,0.12);
  object-fit: cover;
}

.brand-title {
  font-weight: 700;
  font-size: 1.05rem;
  color: #fff;
}

#sidebarToggle {
  background: none;
  border: none;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
}

/* Navigation */
nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

nav li {
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
}

nav li:hover,
nav li.active {
  background: rgba(255,255,255,0.08);
}

.sidebar-footer {
  margin-top: auto;
  font-size: 12px;
  opacity: 0.9;
}

/* =========================
   MAIN CONTENT
========================= */
main {
  flex: 1;
  padding: 18px 22px;
  overflow-y: auto;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.greeting h2 {
  margin: 0;
  font-size: 18px;
}

.greeting p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

/* =========================
   FORMS & BUTTONS
========================= */
input,
select,
textarea {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.06);
  padding: 8px 10px;
  border-radius: 8px;
  color: #e6f0ff;
}

input::placeholder {
  color: rgba(230,240,255,0.4);
}

label {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 6px;
  display: block;
}

.btn {
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
  border: none;
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  color: #041226;
  box-shadow: 0 6px 18px rgba(0,146,255,0.12);
}

.btn.small {
  padding: 6px 8px;
  font-size: 0.9rem;
}

.btn.ghost {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.06);
  color: #dceeff;
}

/* =========================
   CARDS
========================= */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 14px;
}

.card {
  padding: 14px;
  border-radius: 12px;
  background: linear-gradient(
    180deg,
    rgba(255,255,255,0.02),
    rgba(255,255,255,0.01)
  );
  backdrop-filter: blur(var(--glass-blur));
  border: 1px solid rgba(255,255,255,0.03);
  box-shadow: 0 10px 30px rgba(2,6,23,0.6);
}

.card h3 {
  margin: 0 0 8px;
}

/* Neon Stat */
.neon {
  border-left: 6px solid var(--accent);
  position: relative;
}

.neon::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 6px;
  width: 40px;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), transparent);
}

/* =========================
   TABLES
========================= */
.table-wrap {
  overflow-x: auto;
  border-radius: 10px;
}

table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

thead th {
  position: sticky;
  top: 0;
  padding: 12px;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
  color: #041226;
  text-align: left;
}

tbody td {
  padding: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}

tbody tr:hover {
  background: rgba(255,255,255,0.02);
}

/* =========================
   TOAST & LOADER
========================= */
.toast {
  position: fixed;
  bottom: 18px;
  right: 18px;
  padding: 12px 16px;
  background: linear-gradient(90deg, var(--dark), #112233);
  border-radius: 10px;
  display: none;
  z-index: 9999;
}

.loading {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.35);
}

.loader {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 6px solid rgba(255,255,255,0.06);
  border-top-color: var(--accent);
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* =========================
   RESPONSIVE
========================= */
@media (max-width: 1100px) {
  .cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 780px) {
  #app {
    flex-direction: column;
  }

  #sidebar {
    width: 100%;
    flex-direction: row;
    padding: 10px;
  }

  .cards-grid {
    grid-template-columns: 1fr;
  }

  table {
    min-width: 600px;
  }
}
