:root {
  --bg-main: #031a1b;
  --bg-sidebar: #041314;
  --border: rgba(88, 163, 156, 0.18);
  --text: #ecf7f6;
  --muted: #9ec7c3;
  --link: #dff8f4;
  --accent: #2fb7a7;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
}

html,
body {
  min-height: 100%;
}

body {
  background: linear-gradient(135deg, #021516 0%, #052224 50%, #031a1b 100%);
  color: var(--text);
}

.app-shell {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* Sidebar */
.sidebar {
  width: 260px;
  min-width: 260px;
  background: rgba(2, 16, 17, 0.96);
  border-right: 1px solid var(--border);
  padding: 18px 16px 20px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
  z-index: 20;
}

.sidebar-brand {
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--link);
  text-decoration: none;
}

.brand-link:hover {
  color: #ffffff;
  text-decoration: none;
}

.brand-link img {
  width: 46px;
  height: 46px;
  object-fit: contain;
  border-radius: 10px;
  background: #ffffff;
  padding: 4px;
  display: block;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.16);
}

.brand-link strong {
  display: block;
  font-size: 15px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.brand-link span {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.2;
}

/* Nav */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}

.nav-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #79bdb6;
  margin: 0 0 2px;
  padding: 0 10px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--link);
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 10px;
  line-height: 1.2;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.sidebar-nav a:hover {
  background: rgba(47, 183, 167, 0.15);
  color: #ffffff;
  transform: translateX(2px);
  text-decoration: none;
}

.sidebar-nav a i,
.sidebar-nav a svg {
  width: 18px;
  height: 18px;
  min-width: 18px;
  min-height: 18px;
  opacity: 0.88;
}

.sidebar-nav a.active {
  background: linear-gradient(90deg, rgba(47, 183, 167, 0.22) 0%, rgba(47, 183, 167, 0.10) 100%);
  color: #ffffff;
  box-shadow: inset 3px 0 0 0 var(--accent), inset 0 0 0 1px rgba(47, 183, 167, 0.28);
  font-weight: 600;
}

.sidebar-nav a.active i,
.sidebar-nav a.active svg {
  opacity: 1;
  color: var(--accent);
}

/* Main content */
.main {
  flex: 1;
  min-width: 0;
  padding: 22px 24px 28px;
}

.main > * {
  max-width: 1480px;
  margin-left: 0;
  margin-right: 0;
}

/* Topbar */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
  padding: 0;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.page-title {
  margin: 0;
  font-size: 30px;
  line-height: 1.1;
  font-weight: 700;
  color: #ffffff;
}

.sidebar-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(47, 183, 167, 0.14);
  color: #ffffff;
  cursor: pointer;
}

.topbar-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.top-search {
  display: flex;
  align-items: center;
  gap: 10px;
}

.top-search input {
  width: 300px;
  max-width: 42vw;
  height: 38px;
  padding: 6px 12px;
  border-radius: 8px;
}

.theme-toggle,
.user-pill {
  white-space: nowrap;
}

.user-pill {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 12px;
  background: rgba(47, 183, 167, 0.08);
  border: 1px solid var(--border);
  color: #f3fbfa;
  font-weight: 600;
}

.card {
  margin-bottom: 18px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  margin-top: 10px;
}

table {
  width: 100%;
}

/* Responsive */
@media (min-width: 1400px) {
  .main {
    padding-right: 30px;
  }
}

@media (max-width: 1100px) {
  .sidebar {
    width: 230px;
    min-width: 230px;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-right {
    justify-content: flex-start;
  }

  .top-search {
    width: 100%;
  }

  .top-search input {
    width: 100%;
    max-width: none;
  }
}

@media (max-width: 820px) {
  .app-shell {
    flex-direction: column;
  }

  .sidebar {
    position: relative;
    width: 100%;
    min-width: 0;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
    overflow: visible;
  }

  .main {
    padding: 18px 14px 24px;
  }

  .page-title {
    font-size: 24px;
  }

  .topbar-right {
    width: 100%;
  }

  .user-pill {
    width: 100%;
  }
}