/* Reset */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  font-family: var(--font-primary);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  color: var(--text-primary);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font: inherit; color: inherit; }

/* Proto-bar (служебная плашка прототипа) */
.proto-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--proto-bar-height);
  background: #0F172A;
  color: #E2E8F0;
  display: flex;
  align-items: center;
  padding: 0 var(--space-2xl);
  font-size: var(--text-sm);
  z-index: 100;
  gap: var(--space-2xl);
}
.proto-bar__back {
  color: #93C5FD;
  font-weight: var(--weight-medium);
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
}
.proto-bar__back:hover { color: #BFDBFE; }
.proto-bar__crumbs { color: #94A3B8; flex: 1; }
.proto-bar__code {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: #64748B;
  letter-spacing: 0.5px;
}
.proto-bar__questions {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  color: #FCD34D;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
}
.proto-bar__questions:hover { color: #FDE68A; }

body.with-proto-bar { padding-top: var(--proto-bar-height); }

/* Page layout: sidebar + main */
.page {
  display: flex;
  min-height: 100vh;
}
body.with-proto-bar .page { min-height: calc(100vh - var(--proto-bar-height)); }

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  padding: var(--space-2xl) var(--space-xl);
}

.sidebar__logo {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  letter-spacing: 1.5px;
  color: var(--text-primary);
  padding: 0 var(--space-sm);
  margin-bottom: var(--space-3xl);
}

.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar__nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 10px var(--space-sm);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: var(--text-md);
  font-weight: var(--weight-medium);
  position: relative;
}
.sidebar__nav-item:hover { background: var(--bg-subtle); color: var(--text-primary); }
.sidebar__nav-item--active { color: var(--accent-primary); background: var(--accent-primary-soft); }
.sidebar__nav-item--active::before {
  content: '';
  width: 4px; height: 4px;
  background: var(--accent-primary);
  border-radius: 50%;
  position: absolute;
  left: -2px;
}
.sidebar__nav-icon {
  width: 18px; height: 18px;
  flex-shrink: 0;
  opacity: 0.85;
}
/* Lucide icons inside sidebar nav */
.sidebar__nav-item > svg {
  width: 18px; height: 18px;
  stroke-width: 2;
  flex-shrink: 0;
}
/* Lucide icons inside header buttons / cart */
.header__icon-btn > svg,
.header__cart > svg {
  width: 18px; height: 18px;
  stroke-width: 2;
}
.sidebar__nav-badge {
  margin-left: auto;
  background: var(--accent-primary);
  color: var(--text-inverse);
  font-size: 10px;
  font-weight: var(--weight-semibold);
  min-width: 20px;
  height: 20px;
  border-radius: var(--radius-full);
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sidebar__spacer { flex: 1; }

.sidebar__user {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border-subtle);
}
.sidebar__avatar {
  width: 36px; height: 36px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-secondary);
  flex-shrink: 0;
}
.sidebar__user-info { display: flex; flex-direction: column; min-width: 0; }
.sidebar__user-name {
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar__user-role {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

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

.header {
  height: var(--header-height);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: var(--space-xl);
  padding: 0 var(--space-3xl);
  position: sticky;
  top: 0;
  z-index: 50;
}
body.with-proto-bar .header { top: var(--proto-bar-height); }
.header__breadcrumbs {
  font-size: var(--text-md);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.header__breadcrumbs a:hover { color: var(--accent-primary); }
.header__breadcrumbs-sep { color: var(--text-muted); }
.header__breadcrumbs-current { color: var(--text-primary); font-weight: var(--weight-medium); }

.header__spacer { flex: 1; }

.header__status {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  color: var(--success-text);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
}
.header__status::before {
  content: '';
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--success);
}

.header__icon-btn {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  position: relative;
}
.header__icon-btn:hover { background: var(--bg-subtle); color: var(--text-primary); }

.header__cart {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 8px var(--space-md);
  border-radius: var(--radius-sm);
  background: var(--accent-primary-soft);
  color: var(--accent-primary);
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
}
.header__cart:hover { background: #DBEAFE; }

.main__content {
  flex: 1;
  padding: var(--space-3xl) var(--space-3xl);
  display: flex;
  flex-direction: column;
  gap: var(--space-2xl);
}

/* Auth-only layout (no sidebar/header) */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-page);
  padding: var(--space-3xl);
}
body.with-proto-bar .auth-page {
  min-height: calc(100vh - var(--proto-bar-height));
}
