/* ==========================================================================
   JMOS — App Shell, Navigation & Layout
   ========================================================================== */

/* Main Grid Shell */
.app {
  display: grid;
  grid-template-columns: var(--nav-w) 1fr;
  min-height: 100vh;
}

/* Sidebar Navigation */
.nav {
  background: var(--surface);
  border-right: 1px solid var(--line);
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 18px 13px;
  user-select: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 6px 8px 18px;
}

.brand img {
  width: 34px;
  height: 34px;
  flex: none;
  object-fit: contain;
}

.brand b {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: .02em;
  line-height: 1;
  color: var(--ink);
}

.brand span {
  display: block;
  font-size: 9.5px;
  color: var(--faint);
  letter-spacing: .15em;
  text-transform: uppercase;
  margin-top: 4px;
}

.grp {
  font-size: 9.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--faint);
  padding: 14px 10px 5px;
  font-weight: 600;
}

.nav a.item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 10px;
  border-radius: 9px;
  color: #4A4340;
  font-weight: 500;
  font-size: 13.5px;
  transition: background .15s, color .15s;
  position: relative;
  text-decoration: none;
}

.nav a.item svg {
  width: 17px;
  height: 17px;
  flex: none;
  stroke: currentColor;
  stroke-width: 1.7;
  fill: none;
}

.nav a.item:hover {
  background: var(--paper);
  color: var(--ink);
}

.nav a.item.active {
  background: var(--red-soft);
  color: var(--red-deep);
}

.nav a.item.active::before {
  content: "";
  position: absolute;
  left: -13px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--red);
}

.nav a.item .badge {
  margin-left: auto;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  background: var(--red);
  color: #fff;
  border-radius: 20px;
  padding: 1px 6px;
  font-weight: 500;
}

.nav a.item .badge.amber {
  background: var(--amber);
}

.nav-spacer {
  flex: 1;
}

.userchip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 8px;
  border-top: 1px solid var(--line);
  margin-top: 8px;
}

.userchip .av {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: #fff;
  display: grid;
  place-items: center;
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  font-size: 12px;
  flex: none;
}

.userchip .nm {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
}

.userchip .rl {
  font-size: 11px;
  color: var(--muted);
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(250, 247, 246, .85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding: 11px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: background .3s ease;
}

[data-theme="dark"] .topbar {
  background: rgba(0, 0, 0, .85);
}

.menu-btn {
  display: none;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  align-items: center;
  justify-content: center;
}

.menu-btn svg {
  width: 18px;
  height: 18px;
  stroke: var(--ink);
  stroke-width: 1.8;
  fill: none;
}

.search {
  flex: 1;
  max-width: 400px;
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  color: var(--faint);
}

.search svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
  flex: none;
}

.search input {
  border: none;
  background: none;
  outline: none;
  font-family: inherit;
  font-size: 13px;
  color: var(--ink);
  width: 100%;
}

.spacer {
  flex: 1;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--surface);
  display: grid;
  place-items: center;
  position: relative;
}

.icon-btn svg {
  width: 17px;
  height: 17px;
  stroke: var(--ink);
  stroke-width: 1.7;
  fill: none;
}

.icon-btn .ping {
  position: absolute;
  top: 7px;
  right: 8px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 2px var(--paper);
}

.icon-btn .notif-badge {
  position: absolute;
  top: -4px;
  right: -5px;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 17px;
  height: 17px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
  border: 2px solid var(--paper);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  transition: transform .2s ease, opacity .2s ease;
}

.btn.signout {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  border-radius: 9px;
  padding: 8px 12px;
  font-size: 12.5px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.btn.signout svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
}

.btn.signout:hover {
  border-color: var(--red);
  color: var(--red-deep);
}

/* Scroll Area & Page Heads */
.scroll {
  overflow-y: auto;
  padding: 24px;
}

.view {
  max-width: 1180px;
  margin: 0 auto;
}

.view[hidden] {
  display: none;
}

.rolebanner {
  display: none;
  align-items: center;
  gap: 9px;
  background: var(--amber-soft);
  border: 1px solid #EAD9AE;
  color: #6B4E12;
  border-radius: 10px;
  padding: 9px 13px;
  font-size: 12.5px;
  margin-bottom: 16px;
}

.rolebanner svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  stroke-width: 1.9;
  fill: none;
  flex: none;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

h1.pt {
  font-family: 'Poppins', sans-serif;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -.01em;
  line-height: 1.05;
}

.page-head p {
  color: var(--muted);
  margin-top: 5px;
  font-size: 13px;
}

.head-actions {
  display: flex;
  gap: 9px;
}

/* Responsive Media Queries */
@media (max-width: 960px) {
  .cols {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .app {
    grid-template-columns: 1fr;
  }
  .nav {
    position: fixed;
    z-index: 45;
    width: 250px;
    transform: translateX(-102%);
    transition: transform .28s;
    box-shadow: var(--shadow-lg);
  }
  .nav.on {
    transform: none;
  }
  .menu-btn {
    display: flex;
  }
  .search {
    max-width: none;
  }
  .scroll {
    padding: 16px;
  }
}

/* Dark mode: sidebar nav link color */
[data-theme="dark"] .nav a.item {
  color: #B3AAA5;
}

[data-theme="dark"] .nav a.item:hover {
  color: var(--ink);
}

[data-theme="dark"] .nav a.item.active {
  color: var(--red);
}
