/* App shell: sidebar, topbar, workspace container, responsive layout */

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--brand-dark);
  color: #e9edf4;
  display: flex;
  flex-direction: column;
  padding: 18px 14px 16px;
  border-right: 1px solid var(--brand-dark-line);
  z-index: 30;
}

.sb-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 4px 8px 16px;
  border-bottom: 1px solid var(--brand-dark-line);
  margin-bottom: 14px;
}

.sb-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #e5c68a 0%, var(--brand-accent) 60%, #7d5b27 100%);
  color: #14110b;
  font: 800 17px/1 var(--font-head);
  display: grid;
  place-items: center;
  flex: none;
  box-shadow: 0 4px 14px rgba(166, 130, 70, 0.3);
}

.sb-title {
  min-width: 0;
}

.sb-title strong {
  display: block;
  font: 700 14px/1.2 var(--font-head);
  color: #fff;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sb-title small {
  display: block;
  font-size: 11.5px;
  color: #9aa5b6;
  margin-top: 2px;
}

.sb-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: #c5cedc;
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  text-align: left;
  transition: background 0.14s ease, color 0.14s ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.nav-item.is-active {
  background: rgba(166, 130, 70, 0.18);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--brand-accent);
}

.nav-item .nav-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.nav-icon {
  width: 18px;
  text-align: center;
  opacity: 0.85;
  flex: none;
}

.nav-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: #dce3ee;
}

.nav-badge.is-alert {
  background: rgba(185, 56, 56, 0.25);
  color: #ffb8b8;
}

.sb-footer {
  border-top: 1px solid var(--brand-dark-line);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sb-user {
  padding: 8px 10px;
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.04);
}

.sb-user strong {
  display: block;
  font-size: 13px;
  color: #fff;
}

.sb-user small {
  display: block;
  font-size: 11.5px;
  color: #d7be8f;
}

.sb-back {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  border: 1px solid var(--brand-dark-line);
  color: #aeb8c8;
  font-size: 12.5px;
  font-weight: 600;
  transition: border-color 0.15s, color 0.15s;
}

.sb-back:hover {
  border-color: var(--brand-accent);
  color: #fff;
}

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

.topbar {
  position: sticky;
  top: 0;
  min-height: var(--topbar-h);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  z-index: 20;
}

.tb-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.tb-title {
  margin: 0;
  font: 700 17px/1.2 var(--font-head);
  color: var(--ink);
}

.demo-pill {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--brand-accent-soft);
  color: var(--brand-accent-strong);
  border: 1px solid var(--brand-accent-border);
}

.tb-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.seg-switch {
  display: inline-flex;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 2px;
  gap: 2px;
}

.seg-switch button {
  border: 0;
  background: transparent;
  padding: 5px 11px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.14s ease;
}

.seg-switch button.is-active {
  background: var(--brand-dark);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.seg-switch.is-role button.is-active[data-role="owner"] {
  background: var(--brand-dark);
  color: #f0d7a7;
}

.seg-switch.is-role button.is-active[data-role="manager"] {
  background: var(--info);
  color: #fff;
}

.workspace {
  padding: 20px 24px 40px;
  max-width: 1520px;
  width: 100%;
}

/* Role Notice Banner */
.role-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  margin-bottom: 16px;
  border-radius: var(--r-md);
  background: var(--info-bg);
  border: 1px solid var(--info-border);
  color: var(--info);
  font-size: 13px;
}

.role-banner strong {
  color: var(--ink);
}

/* Guided Tour Bar */
.tour-bar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  margin-bottom: 16px;
  border-radius: var(--r-md);
  background: linear-gradient(90deg, var(--brand-dark) 0%, var(--brand-dark-2) 100%);
  color: #eef2f8;
  border-left: 4px solid var(--brand-accent);
  box-shadow: var(--shadow-md);
}

.tour-step-badge {
  font: 800 11.5px/1 var(--font-head);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #e4c58c;
  background: rgba(166, 130, 70, 0.18);
  padding: 6px 10px;
  border-radius: 6px;
}

.tour-copy strong {
  display: block;
  font-size: 13.5px;
  color: #fff;
}

.tour-copy span {
  display: block;
  font-size: 12.5px;
  color: #c2ccdc;
  margin-top: 2px;
}

.tour-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

@media (max-width: 980px) {
  .shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: static;
    height: auto;
    padding: 12px 14px;
  }
  .sb-nav {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 4px;
  }
  .nav-item {
    width: auto;
    white-space: nowrap;
  }
  .sb-footer {
    display: none;
  }
  .topbar {
    padding: 10px 14px;
  }
  .workspace {
    padding: 14px 14px 36px;
  }
  .tour-bar {
    grid-template-columns: 1fr;
  }
}
