:root {
  --brand: #509ee3;
  --brand-dark: #2d7fcb;
  --bg: #f9fbfc;
  --sidebar-bg: #ffffff;
  --border: #eeecec;
  --text: #4c5773;
  --text-strong: #2e353b;
  --muted: #949aab;
  --hover: #f1f6fb;
  --active-bg: #e8f2fc;
  --sidebar-w: 270px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  font-family: Lato, "Segoe UI", -apple-system, Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
}

.app {
  display: flex;
  height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  flex: none;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: margin-left .2s;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  font-weight: 700;
  font-size: 18px;
  color: var(--text-strong);
}

.logo {
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #509ee3, #2d7fcb);
  box-shadow: 0 2px 6px rgba(45, 127, 203, .45);
  color: #fff;
  display: grid;
  place-items: center;
}

.logo svg {
  width: 24px;
  height: 24px;
}

.menu {
  flex: 1;
  overflow-y: auto;
  padding: 4px 10px 16px;
}

.menu ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.menu-header {
  padding: 18px 12px 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}

.menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  margin: 1px 0;
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  user-select: none;
}

.menu a:hover {
  background: var(--hover);
  color: var(--brand-dark);
}

.menu a.active {
  background: var(--active-bg);
  color: var(--brand-dark);
  font-weight: 700;
}

.menu .ico {
  width: 18px;
  text-align: center;
  flex: none;
}

.menu .label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.menu .caret {
  font-size: 10px;
  transition: transform .15s;
  color: var(--muted);
}

.menu li.open>a>.caret {
  transform: rotate(90deg);
}

.submenu {
  display: none;
}

li.open>.submenu {
  display: block;
}

/* indentation for levels 2 and 3 */
/* level 1 text starts at 40px (padding + icon + gap); each level indents 16px more */
.menu a {
  padding-left: 20px;
}

.submenu a {
  font-size: 13.5px;
  padding-left: 30px;
}

.submenu .submenu a {
  font-size: 13px;
  padding-left: 40px;
}

.sidebar-foot {
  border-top: 1px solid var(--border);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
}

.sidebar-foot small {
  display: block;
  color: var(--muted);
}

/* Main */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  height: 60px;
  flex: none;
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 24px;
}

.burger {
  display: none;
  border: 0;
  background: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--text);
}

.search {
  flex: 1;
  max-width: 480px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  font: inherit;
}

.search:focus {
  outline: 2px solid var(--brand);
  background: #fff;
}

.spacer {
  flex: 1;
}

.btn {
  background: var(--brand);
  color: #fff;
  border: 0;
  border-radius: 6px;
  padding: 8px 16px;
  font-weight: 700;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

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

.content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 5px;
  display: flex;
  flex-direction: column;
}

#page {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

h1 {
  margin: 0;
  font-size: 20px;
  color: var(--text-strong);
}

.dash {
  flex: 1;
  min-height: 0;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .05);
}

.card .k {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.card .v {
  font-size: 30px;
  font-weight: 700;
  color: var(--text-strong);
  margin-top: 6px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

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

th {
  font-size: 12px;
  text-transform: uppercase;
  color: var(--muted);
  background: #fcfdfd;
}

tr:last-child td {
  border-bottom: 0;
}

@media (max-width: 800px) {
  .sidebar {
    position: fixed;
    z-index: 10;
    height: 100%;
    margin-left: calc(-1 * var(--sidebar-w));
  }

  .sidebar.show {
    margin-left: 0;
    box-shadow: 0 0 30px rgba(0, 0, 0, .25);
  }

  .burger {
    display: block;
  }

  .content {
    padding: 5px;
  }
}

.empty-page {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--muted);
}

.empty-icon {
  font-size: 48px;
}

.empty-text {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.brand {
  cursor: pointer;
}

.home-page {
  text-align: center;
  padding: 0 24px;
}

.home-title {
  margin: 0;
  max-width: 640px;
  font-size: 28px;
  line-height: 1.4;
  color: var(--text-strong);
}
