/* ═══════════════════════════════════════════════════════════════
   Dashboard layout (sidebar + main)
   Design System.html L1437–1459
   ═══════════════════════════════════════════════════════════════ */

.dash {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
  background: var(--sam-white);
}

.dash__sidebar {
  background: #faf7f4;
  border-right: 1px solid var(--sam-light);
  padding: 24px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

/* Brand */
.dash__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 16px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--sam-light);
}
.dash__brand img { height: 24px; width: auto; display: block; }

/* User chip */
.dash__user {
  padding: 12px 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  cursor: pointer;
  border-radius: 8px;
  transition: background .15s;
}
.dash__user:hover { background: rgba(0,0,0,.04); }
.dash__user .avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--sam-red);
  color: #fff;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.dash__user .avatar img { width: 100%; height: 100%; object-fit: cover; }
.dash__user .meta { min-width: 0; flex: 1; }
.dash__user .name {
  font-weight: 600;
  font-size: 14px;
  color: var(--sam-dark);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dash__user .role {
  font-size: 12px;
  color: var(--sam-medium);
}
.dash__user .chev {
  width: 14px; height: 14px;
  stroke: var(--sam-medium);
  fill: none; stroke-width: 2;
  flex-shrink: 0;
  transition: transform .2s;
}
.dash__user.is-open .chev { transform: rotate(180deg); }

/* Avatar dropdown */
.dash__avatar-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 12px; right: 12px;
  background: var(--sam-white);
  border: 1px solid var(--sam-light);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.08);
  padding: 6px;
  display: none;
  z-index: 50;
}
.dash__user.is-open + .dash__avatar-menu { display: block; }
.dash__avatar-menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 6px;
  color: var(--sam-dark);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: background .12s;
}
.dash__avatar-menu a:hover { background: var(--sam-brown-light); }
.dash__avatar-menu a svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; }
.dash__avatar-menu hr {
  border: 0;
  border-top: 1px solid var(--sam-light);
  margin: 6px 0;
}
.dash__avatar-menu a.is-danger { color: var(--sam-error); }

/* Nav links */
.dash__nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}
.dash__nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--sam-dark);
  font-weight: 500;
  font-size: 14px;
  text-decoration: none;
  transition: background .12s, color .12s;
  min-height: 44px; /* touch target */
}
.dash__nav a:hover { background: rgba(0,0,0,.04); }
.dash__nav a.is-active {
  background: var(--sam-red);
  color: #fff;
  font-weight: 600;
}
.dash__nav a svg {
  width: 18px; height: 18px;
  stroke: currentColor; fill: none;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  flex-shrink: 0;
}

/* Badges in nav */
.dash__nav .badge {
  margin-left: auto;
  background: var(--sam-brown-light);
  color: var(--sam-dark);
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 999px;
  font-weight: 600;
  min-width: 20px;
  text-align: center;
}
.dash__nav .badge--urgent {
  background: var(--sam-red);
  color: #fff;
}
.dash__nav a.is-active .badge {
  background: rgba(255,255,255,.22);
  color: #fff;
}

/* Footer (Inställningar) */
.dash__nav-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--sam-light);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.dash__nav-footer a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--sam-medium);
  font-weight: 500;
  font-size: 14px;
  text-decoration: none;
  min-height: 44px;
  transition: color .12s, background .12s;
}
.dash__nav-footer a:hover { color: var(--sam-dark); background: rgba(0,0,0,.04); }
.dash__nav-footer a svg {
  width: 18px; height: 18px;
  stroke: currentColor; fill: none; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
  flex-shrink: 0;
}

/* Main content */
.dash__main {
  padding: 32px;
  min-width: 0;
  background: var(--sam-white);
}
.dash__crumbs {
  color: var(--sam-medium);
  font-size: 13px;
  margin-bottom: 8px;
  display: flex; gap: 6px; align-items: center;
}
.dash__crumbs a { color: var(--sam-medium); text-decoration: none; }
.dash__crumbs a:hover { color: var(--sam-dark); }

/* Mobile top-bar + backdrop (hidden on desktop) */
.dash__topbar { display: none; }
.dash__backdrop { display: none; }

/* ── Mobile ── */
@media (max-width: 768px) {
  .dash { grid-template-columns: 1fr; }
  .dash__sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 280px;
    transform: translateX(-100%);
    transition: transform .24s ease;
    z-index: 60;
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
    height: 100vh;
  }
  .dash.is-open .dash__sidebar { transform: translateX(0); }
  .dash__backdrop {
    display: block;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.45);
    opacity: 0; pointer-events: none;
    transition: opacity .24s ease;
    z-index: 55;
  }
  .dash.is-open .dash__backdrop { opacity: 1; pointer-events: auto; }

  .dash__topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--sam-white);
    border-bottom: 1px solid var(--sam-light);
    position: sticky; top: 0; z-index: 40;
  }
  .dash__topbar .brand img { height: 22px; }
  .dash__topbar .actions { display: flex; align-items: center; gap: 8px; }
  .dash__topbar button.icon-btn {
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    background: transparent; border: none; color: var(--sam-dark); cursor: pointer;
    border-radius: 8px;
    position: relative;
  }
  .dash__topbar button.icon-btn:hover { background: var(--sam-brown-light); }
  .dash__topbar .msg-badge {
    position: absolute; top: 6px; right: 6px;
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--sam-red);
    border: 2px solid var(--sam-white);
  }

  .dash__main { padding: 20px 16px 40px; }
}

/* ── Responsive: tablet ── */
@media (max-width: 1024px) and (min-width: 769px) {
  .dash { grid-template-columns: 220px 1fr; }
  .dash__sidebar { padding: 20px 10px; }
  .dash__main { padding: 24px; }
}
