/* ==========================================================================
   StreOps — Shared layout: Sidebar, Topbar, page shell, generic components
   ========================================================================== */

.app {
  display: flex;
  align-items: flex-start;
  width: 100%;
  min-height: 100vh;
  background: var(--bg-base);
}

/* ---------- Sidebar ---------- */

.sidebar {
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 100vh;
  align-items: flex-start;
  padding: 20px 14px;
  flex-shrink: 0;
  width: var(--sidebar-width);
}

.sidebar__brand {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 2px 0 18px 8px;
}

.sidebar__mark {
  display: flex;
  height: 34px;
  width: 34px;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--accent-gradient);
  flex-shrink: 0;
}

.sidebar__mark span {
  font-weight: 700;
  font-size: 18px;
  line-height: 22px;
  color: #fff;
}

.sidebar__brand-name {
  font-weight: 700;
  font-size: 17px;
  line-height: 22px;
  letter-spacing: -0.3px;
  color: var(--text-primary);
  white-space: nowrap;
}

.sidebar__brand-tag {
  font-weight: 600;
  font-size: 10px;
  line-height: 13px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--accent-primary);
  white-space: nowrap;
}

.sidebar__section-label {
  font-weight: 600;
  font-size: 10px;
  line-height: 13px;
  letter-spacing: 0.9px;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 14px 12px 6px;
  white-space: nowrap;
}

.sidebar__nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  height: 40px;
  width: 100%;
  padding: 0 10px 0 12px;
  border-radius: 10px;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 13.5px;
  line-height: 20px;
  white-space: nowrap;
  border: 1px solid transparent;
}

.sidebar__nav-item:hover {
  background: rgba(255, 255, 255, 0.03);
}

.sidebar__nav-item .icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.sidebar__nav-item span.label {
  flex: 1 0 0;
  min-width: 0;
}

.sidebar__nav-item.is-active {
  background: var(--accent-primary-soft);
  border-color: var(--accent-primary-border);
  color: var(--text-primary);
  font-weight: 600;
}

.sidebar__badge {
  display: flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: var(--radius-pill);
  background: var(--status-warning-soft);
  flex-shrink: 0;
}

.sidebar__badge span {
  font-weight: 700;
  font-size: 9px;
  line-height: 12px;
  letter-spacing: 0.5px;
  color: var(--status-warning-text);
  white-space: nowrap;
}

.sidebar__spacer {
  flex: 1 0 0;
  min-height: 0;
  width: 100%;
}

.sidebar__upsell {
  background: var(--accent-primary-soft);
  border: 1px solid var(--accent-primary-border-2);
  border-radius: var(--radius-lg);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.sidebar__upsell-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar__upsell-head .icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.sidebar__upsell-head span {
  font-weight: 600;
  font-size: 13px;
  line-height: 18px;
  color: var(--text-primary);
  white-space: nowrap;
}

.sidebar__upsell p {
  margin: 0;
  font-weight: 400;
  font-size: 11.5px;
  line-height: 16px;
  color: var(--text-secondary);
  width: 192px;
}

.sidebar__upsell-btn {
  display: flex;
  height: 34px;
  width: 192px;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  background: var(--accent-primary);
  border: none;
  font-weight: 600;
  font-size: 13px;
  line-height: 18px;
  color: #fff;
}

/* ---------- Main column ---------- */

.main {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  flex: 1 0 0;
  min-width: 0;
  min-height: 100vh;
}

/* ---------- Topbar ---------- */

.topbar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  height: var(--topbar-height);
  width: 100%;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  flex-shrink: 0;
}

.topbar__title {
  font-weight: 600;
  font-size: 19px;
  line-height: 26px;
  letter-spacing: -0.3px;
  color: var(--text-primary);
  white-space: nowrap;
}

.topbar__subtitle {
  font-weight: 400;
  font-size: 12.5px;
  line-height: 17px;
  color: var(--text-muted);
  white-space: nowrap;
}

.topbar__right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.topbar__live {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 13px 7px 11px;
  border-radius: var(--radius-pill);
  background: var(--status-danger-live-wash);
  border: 1px solid var(--status-danger-live-border);
}

.topbar__live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--status-danger-live);
  flex-shrink: 0;
}

.topbar__live span {
  font-weight: 600;
  font-size: 12px;
  line-height: 16px;
  color: var(--status-danger-live-text);
  white-space: nowrap;
}

.topbar__bell {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
}

.topbar__user {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 12px 5px 5px;
  border-radius: var(--radius-pill);
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
}

.topbar__avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  background: linear-gradient(90deg, #9146ff 0%, #f273b5 100%);
}

.topbar__user span {
  font-weight: 500;
  font-size: 13px;
  line-height: 18px;
  color: var(--text-primary);
  white-space: nowrap;
}

/* ---------- Page content wrapper ---------- */

.page {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: flex-start;
  width: 100%;
  padding: 24px 28px 28px;
}

/* ---------- Generic card ---------- */

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: 100%;
}

.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.card__title {
  font-weight: 600;
  font-size: 15px;
  line-height: 21px;
  color: var(--text-primary);
  margin: 0;
}

.card__meta {
  font-weight: 400;
  font-size: 12px;
  line-height: 16px;
  color: var(--text-muted);
  white-space: nowrap;
}

.row {
  display: flex;
  gap: 16px;
  align-items: stretch;
  width: 100%;
}

.row > .card {
  flex: 1 0 0;
  min-width: 0;
}

.divider {
  background: var(--border-subtle);
  height: 1px;
  width: 100%;
  flex-shrink: 0;
}

/* ---------- Icon chip ---------- */

.icon-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-xs);
  flex-shrink: 0;
}

/* ---------- Status pill ---------- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: 11px;
  line-height: 14px;
  white-space: nowrap;
}

.pill__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.pill--success { background: var(--status-success-wash-2); color: var(--status-success); }
.pill--success .pill__dot { background: var(--status-success); }
.pill--warning { background: var(--status-warning-wash-3); color: var(--status-warning-text); }
.pill--warning .pill__dot { background: var(--status-warning-text); }
.pill--warning2 { background: var(--status-warning-wash-2); color: var(--status-warning); }
.pill--warning2 .pill__dot { background: var(--status-warning); }
.pill--neutral { background: var(--status-neutral-wash); color: var(--text-muted); }
.pill--neutral .pill__dot { background: var(--text-muted); }
.pill--danger { background: var(--status-danger-wash-2); color: var(--status-danger); }
.pill--danger .pill__dot { background: var(--status-danger); }

/* ---------- Trend badge (small up/down %) ---------- */

.trend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px 4px 7px;
  border-radius: var(--radius-pill);
  background: var(--status-success-wash);
}

.trend span {
  font-weight: 600;
  font-size: 12px;
  line-height: 16px;
  color: var(--status-success);
  white-space: nowrap;
}

.trend svg { width: 12px; height: 12px; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px 0 15px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 13.5px;
  line-height: 18px;
  border: 1px solid var(--border-default);
  background: var(--bg-surface-2);
  color: #e4e4ee;
  white-space: nowrap;
}

.btn .icon { width: 16px; height: 16px; flex-shrink: 0; }

.btn--danger {
  background: var(--status-danger-soft);
  border-color: var(--status-danger-border);
  color: var(--status-danger);
}

.btn--primary {
  background: var(--accent-primary);
  border: none;
  color: #fff;
}

/* ---------- Toggle switch ---------- */

.toggle {
  position: relative;
  width: 46px;
  height: 26px;
  border-radius: 13px;
  background: var(--border-default);
  border: none;
  flex-shrink: 0;
  transition: background 0.15s ease;
}

.toggle::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: left 0.15s ease;
}

.toggle.is-on {
  background: var(--accent-primary);
}

.toggle.is-on::after {
  left: 23px;
}

/* ---------- Empty avatar / thumb placeholder ---------- */

.avatar {
  border-radius: 50%;
  flex-shrink: 0;
  background: linear-gradient(90deg, #9146ff 0%, #f273b5 100%);
}

.thumb {
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
}

/* ---------- Responsive note ----------
   The source design is a fixed 1440px desktop dashboard; this port keeps the
   1440 canvas as the natural layout width and allows horizontal scroll on
   narrower viewports rather than reflowing the grid, to preserve exact
   pixel spacing from Figma. */

.app { min-width: 1280px; }

@media (max-width: 1280px) {
  html { overflow-x: auto; }
}
