:root {
  --primary: #173b35;
  --primary-soft: #176b53;
  --surface: #ffffff;
  --muted: #667581;
  --border: #dfe7eb;
  --bg: #f4f6f9;
}

body {
  background: var(--bg);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  box-shadow: 0 2px 10px rgba(17, 43, 35, 0.12);
}

.topright {
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.user-name {
  max-width: 130px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.logout-link,
.install-btn,
.mobile-nav-toggle,
.sidebar-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.08);
  color: #fff;
  text-decoration: none;
}

.install-btn {
  background: #eaf3ef;
  color: var(--primary);
  border: none;
}

.install-btn.hidden {
  display: none;
}

.desktop-nav {
  display: flex;
}

.mobile-nav-toggle {
  display: none !important;
}

.mobile-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: min(82vw, 320px);
  background: var(--surface);
  box-shadow: 12px 0 32px rgba(17, 43, 35, 0.2);
  transform: translateX(-110%);
  transition: transform 0.25s ease;
  z-index: 40;
  padding: 18px 14px 14px;
  display: none !important;
  flex-direction: column;
  gap: 12px;
}

.mobile-sidebar.open {
  transform: translateX(0);
  display: flex !important;
}

.mobile-sidebar::before {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 30, 0.28);
  z-index: -1;
  opacity: 0;
  pointer-events: none;
}

.mobile-sidebar.open::before {
  opacity: 1;
}

.sidebar-header,
.sidebar-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 4px 10px;
  border-bottom: 1px solid var(--border);
}

.sidebar-header {
  font-size: 15px;
  font-weight: 800;
  color: var(--primary);
}

.sidebar-close {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--primary);
  padding: 6px 10px;
  min-height: 32px;
}

.mobile-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 8px;
}

.mobile-nav a,
.sidebar-footer a {
  display: flex;
  align-items: center;
  min-height: 46px;
  padding: 12px 12px;
  border-radius: 12px;
  color: var(--primary);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.mobile-nav a:hover,
.sidebar-footer a:hover {
  background: #edf3f0;
}

.container {
  padding-top: 18px;
}

.grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

form {
  grid-template-columns: 1fr;
}

.loginbox {
  max-width: 420px;
  margin: 40px auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 24px 18px 20px;
  box-shadow: 0 8px 28px rgba(17, 43, 35, 0.08);
}

.loginbox h1 {
  margin-top: 0;
  font-size: 28px;
  text-align: center;
}

.muted {
  color: var(--muted);
  text-align: center;
}

.inline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.inline .btn,
.inline a {
  flex: 1 1 180px;
  text-align: center;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

@media (max-width: 640px) {
  .mobile-sidebar {
    display: flex !important;
  }

  .desktop-nav {
    display: none;
  }

  .mobile-nav-toggle {
    display: inline-flex !important;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.25);
    color: #fff;
    font-size: 18px;
    min-width: 42px;
    min-height: 38px;
  }

  .container {
    padding: 16px 12px 30px;
  }

  h1 {
    font-size: 22px;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    padding: 12px 14px;
  }

  .brand {
    font-size: 16px;
  }

  .nav {
    top: 60px;
    padding: 8px 10px;
  }

  .nav a {
    padding: 8px 10px;
  }

  .panel,
  .card {
    padding: 14px;
  }

  .table-wrap {
    margin: 12px -2px 0;
  }

  .loginbox {
    margin: 24px 12px;
  }
}
