/*
  Khung Shell desktop (A-01): sidebar trai co dinh + topbar + vung noi dung.
  Chi dung bien token khai bao trong tokens.css — khong hard-code ma mau.
*/

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

:focus-visible {
  outline: 2px solid var(--pri-500);
  outline-offset: 2px;
}

.app {
  display: grid;
  grid-template-columns: var(--sidebar) 1fr;
  min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
  background: linear-gradient(180deg, var(--sidebar-top), var(--sidebar-bot));
  color: #FCE3E1;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, .14);
}

.brand .crest {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: #fff;
  display: grid;
  place-items: center;
  color: var(--brand);
  font-weight: 800;
  font-size: 15px;
  flex: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
}

.brand h1 {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  margin: 0;
  letter-spacing: .01em;
}

.brand p {
  font-size: 11.5px;
  margin: 2px 0 0;
  color: rgba(255, 255, 255, .75);
}

.nav {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px;
}

.nav-group {
  margin-bottom: 6px;
}

.nav-group > .grp-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .6);
  padding: 12px 12px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: 8px;
  color: rgba(255, 255, 255, .85);
  font-weight: 500;
  cursor: pointer;
  position: relative;
  margin-bottom: 2px;
}

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

.nav-item.active {
  background: var(--nav-active-bg);
  color: var(--nav-active-fg);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .18);
}

.nav-item .ico {
  width: 18px;
  height: 18px;
  flex: none;
  opacity: .95;
}

.nav-item .count {
  margin-left: auto;
  background: rgba(255, 255, 255, .22);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 999px;
  display: grid;
  place-items: center;
}

.side-foot {
  padding: 12px;
  border-top: 1px solid rgba(255, 255, 255, .14);
  font-size: 11.5px;
  color: rgba(255, 255, 255, .6);
}

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

.topbar {
  height: 60px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 22px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.crumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  min-width: 0;
}

.crumb .sep {
  opacity: .5;
}

.crumb .cur {
  color: var(--text-strong);
  font-weight: 600;
}

.search {
  margin-left: 8px;
  flex: 1;
  max-width: 360px;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 13px;
}

.search input {
  border: 0;
  background: transparent;
  outline: none;
  color: var(--text);
  width: 100%;
  font-size: 13px;
}

.top-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--text-muted);
  position: relative;
}

.icon-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 8px 5px 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
}

.user:hover {
  background: var(--surface-2);
}

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: var(--pri-600);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 12px;
  flex: none;
}

.user .u-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-strong);
  line-height: 1.1;
}

.user .u-role {
  font-size: 11px;
  color: var(--text-muted);
}

/* CONTENT */
.content {
  padding: 22px;
  overflow: auto;
  flex: 1;
}

.page-head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.page-head h2 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-strong);
  margin: 0;
}

.page-head p {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

svg {
  display: block;
}

/* RESPONSIVE — an toan co ban duoi desktop; chi tiet drawer mobile A-02 o shell-mobile.css */
@media (max-width: 1023px) {
  .search {
    display: none;
  }
}

/* Dropdown thong bao (J-02) + Chip nguoi dung/menu tai khoan (N-11) */
.noti-widget,
.user-chip {
  position: relative;
}

.icon-btn .num {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  background: var(--brand);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 999px;
  display: grid;
  place-items: center;
  border: 2px solid var(--surface);
  font-variant-numeric: tabular-nums;
}

.dropdown {
  position: absolute;
  top: 52px;
  right: 0;
  width: 360px;
  max-width: calc(100vw - 24px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
  display: none;
  z-index: 30;
}

.dropdown.open {
  display: block;
}

.dd-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.dd-head b {
  font-size: 13px;
  color: var(--text-strong);
}

.dd-link {
  border: 0;
  background: transparent;
  padding: 0;
  font: inherit;
  font-size: 12px;
  color: var(--pri-500);
  cursor: pointer;
}

.dd-link:disabled {
  color: var(--text-muted);
  cursor: not-allowed;
}

.user-menu {
  width: 220px;
  padding: 6px;
}

.user-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 7px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.user-menu-item:hover {
  background: var(--surface-2);
  color: var(--text-strong);
}

.user-menu-form {
  margin: 0;
}

/* Trang thai rong / loi tai du lieu (N-10) */
.state {
  text-align: center;
  padding: 32px 20px;
}

.state .si {
  width: 52px;
  height: 52px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  margin: 0 auto 12px;
}

.state.empty .si {
  background: var(--pri-50);
  color: var(--pri-500);
}

.state.error .si {
  background: var(--danger-bg);
  color: var(--danger);
}

.state h3 {
  font-size: 14px;
  color: var(--text-strong);
  margin: 0 0 5px;
}

.state p {
  font-size: 12.5px;
  color: var(--text-muted);
  margin: 0 auto;
  max-width: 40ch;
}

/* Khung mobile A-02 (hamburger, header rut gon, drawer, bottom nav) — an mac dinh o
   desktop, chi tiet hien thi/kich hoat o shell-mobile.css */
.mobile-topbar,
.mobile-topbar-hamburger,
.mobile-scrim,
.mobile-drawer,
.bottom-nav {
  display: none;
}

/* J-02 dropdown thong bao: danh sach gan day + trang thai rong */
.dd-item {
  display: flex;
  gap: 11px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.dd-item:hover {
  background: var(--surface-2);
}

.dd-item.unread {
  background: var(--pri-50);
}

.dd-item .di {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  flex: none;
  display: grid;
  place-items: center;
}

.dd-body {
  min-width: 0;
}

.dd-text {
  display: block;
  font-size: 12.5px;
  color: var(--text);
  line-height: 1.35;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.dd-item .nt {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
}

.dd-foot {
  display: block;
  padding: 11px;
  text-align: center;
  font-size: 13px;
  color: var(--pri-500);
  font-weight: 600;
  cursor: pointer;
}

.dd-empty {
  padding: 26px 18px;
  text-align: center;
  color: var(--text-muted);
}

.dd-empty-ic {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  margin: 0 auto 10px;
  color: var(--text-faint);
}

.dd-empty b {
  display: block;
  color: var(--text-strong);
  font-size: 13.5px;
  margin-bottom: 3px;
}

.dd-empty span {
  font-size: 12px;
}

.di.cat-blue { background: var(--tint-blue-bg); color: var(--tint-blue-fg); }
.di.cat-violet { background: var(--tint-violet-bg); color: var(--tint-violet-fg); }
.di.cat-cam { background: var(--tint-cam-bg); color: var(--tint-cam-fg); }
.di.cat-rose { background: var(--tint-rose-bg); color: var(--tint-rose-fg); }
.di.cat-green { background: var(--tint-green-bg); color: var(--tint-green-fg); }
.di.cat-teal { background: var(--tint-teal-bg); color: var(--tint-teal-fg); }
.di.cat-amber { background: var(--tint-amber-bg); color: var(--tint-amber-fg); }
