:root {
  --bg: #eef3fb;
  --panel: #ffffff;
  --line: #d4deee;
  --text: #1f2f46;
  --muted: #667893;
  --accent: #1f5eff;
  --accent-2: #0f9f88;
  --danger: #e66b7e;
  --sidebar: #ffffff;
  --shadow: 0 12px 32px rgba(31, 47, 70, 0.1);
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Poppins", "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(circle at 88% -10%, #d5ebff 0%, transparent 34%),
    radial-gradient(circle at -10% 120%, #defceb 0%, transparent 30%),
    var(--bg);
}

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

.sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  padding: 24px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 20px;
}

.brand h1 {
  margin: 0;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.04em;
  text-transform: lowercase;
}

.brand-mark {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: linear-gradient(145deg, #17a58f, #2f63ff);
}

.menu {
  display: grid;
  gap: 8px;
}

.menu-label {
  margin: 18px 10px 4px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}

.menu-item,
.submenu a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  border: 0;
  background: transparent;
  text-decoration: none;
  color: var(--text);
  padding: 10px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.menu-item.active,
.menu-item:hover,
.submenu a:hover {
  background: #edf3ff;
  color: var(--accent);
  transform: translateX(2px);
}

.arrow {
  transition: transform 0.2s ease;
}

.menu-toggle.open .arrow {
  transform: rotate(90deg);
}

.submenu {
  display: none;
  padding-left: 10px;
  border-left: 2px dashed #d5e0f2;
  margin-left: 10px;
}

.submenu.open {
  display: block;
}

.submenu a {
  font-size: 14px;
  margin: 4px 0;
}

.main-wrap {
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.icon-btn {
  border: 1px solid var(--line);
  background: #fff;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  border-color: #c4d3ea;
  transform: translateY(-1px);
}

.search {
  width: min(420px, 55vw);
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #f4f7fc;
  font: inherit;
}

.live-search-wrap {
  position: relative;
}

.live-search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: min(640px, 70vw);
  max-height: 420px;
  overflow: auto;
  background: #fff;
  border: 1px solid #cfdaec;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(31, 47, 70, 0.14);
  z-index: 100;
}

.live-search-table-wrap .table th,
.live-search-table-wrap .table td {
  padding: 8px 10px;
}

.live-search-empty {
  padding: 14px;
  color: #667893;
}

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(150deg, #17a58f, #2f63ff);
  color: #fff;
}

.content {
  padding: 28px;
}

.content h2 {
  margin: 0 0 14px;
  font-size: 28px;
  letter-spacing: -0.03em;
}

.cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.stat-card,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.stat-card {
  padding: 18px;
}

.stat-card p {
  margin: 0;
  color: var(--muted);
  font-weight: 600;
}

.stat-card h3 {
  margin: 10px 0 14px;
  font-size: 34px;
  letter-spacing: -0.03em;
}

.up,
.down {
  font-weight: 700;
}

.up {
  color: var(--accent-2);
}

.down {
  color: var(--danger);
}

.panel-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: 1.4fr 1fr;
  margin-bottom: 16px;
}

.panel-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff, #f9fbff);
  border-top-left-radius: var(--radius);
  border-top-right-radius: var(--radius);
}

.panel-head h3 {
  margin: 0;
  font-size: 22px;
}

.chart-placeholder {
  padding: 20px;
}

.bars {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 220px;
  padding: 12px;
  border-radius: 10px;
  border: 1px dashed #c8d5ea;
  background: linear-gradient(to top, #f3f7fd, #ffffff);
}

.bars span {
  flex: 1;
  border-radius: 7px 7px 0 0;
  background: linear-gradient(180deg, #2f63ff, #5f85ff);
}

.table-wrap {
  padding: 14px;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 13px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

th {
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
}

tbody tr {
  transition: background 0.2s ease;
}

tbody tr:hover {
  background: #f7faff;
}

.badge {
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}

.badge.success {
  background: #e3fff9;
  color: #0d8a76;
}

.badge.warning {
  background: #fff9e7;
  color: #a97900;
}

.badge.danger {
  background: #ffe8ed;
  color: #c13952;
}

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

.admin-form label {
  display: grid;
  gap: 6px;
  font-weight: 700;
  color: var(--muted);
}

.admin-form input,
.admin-form select,
.admin-form textarea {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px;
  font: inherit;
  background: #fff;
}

.admin-form textarea {
  grid-column: span 2;
}

.admin-form button {
  width: fit-content;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, #2f63ff, #17a58f);
  color: #fff;
  padding: 11px 18px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

input.form-control,
select.form-select,
textarea.form-control {
  border-radius: 12px;
  border-color: #cfdaec;
  min-height: 44px;
}

textarea.form-control {
  min-height: 120px;
}

input.form-control:focus,
select.form-select:focus,
textarea.form-control:focus {
  border-color: #8db4ff;
  box-shadow: 0 0 0 0.2rem rgba(47, 99, 255, 0.14);
}

.btn {
  border-radius: 12px;
  font-weight: 600;
  min-height: 30px;
}

.btn-primary {
  background: linear-gradient(135deg, #2b63ff, #1aa88f);
  border: 0;
}

.btn-primary:hover {
  filter: brightness(0.98);
}

.alert {
  border-radius: 12px;
  border: 1px solid transparent;
}

.alert-success {
  border-color: #bfeadf;
}

.alert-danger {
  border-color: #f4c1cb;
}

.table-responsive {
  border: 1px solid #d8e3f3;
  border-radius: 12px;
  overflow: hidden;
}

.table-responsive .table {
  margin-bottom: 0;
}

.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
  border: 1px solid #cfdaec;
  border-radius: 10px;
  padding: 6px 10px;
  background: #fff;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
  border-radius: 8px !important;
}

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

  .panel-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 840px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    left: -290px;
    z-index: 40;
    width: 280px;
    transition: left 0.25s ease;
    box-shadow: var(--shadow);
  }

  .sidebar.open {
    left: 0;
  }

  .content {
    padding: 16px;
  }

  .cards {
    grid-template-columns: 1fr;
  }

  .content h2 {
    font-size: 24px;
  }

  .admin-form {
    grid-template-columns: 1fr;
  }

  .admin-form textarea {
    grid-column: span 1;
  }
}
