/* SmartSale shared navigation (ui-shell). Every class is prefixed ss- so module CSS can't collide. */
html:has(body.ss-on) { font-size: clamp(14px, 0.5vw + 8px, 19px); } /* 14.4px at 1280, 15.2px at 1440: chat text stays readable on laptops */
:root { --accent: #2563eb; } /* same default as crm brand.js; the shop colour (Settings → Doanh nghiệp) replaces it */
body.ss-on { margin: 0; font-family: Inter, system-ui, -apple-system, sans-serif; }

.ss-top { position: sticky; top: 0; z-index: 1000; display: flex; align-items: center; gap: .25rem; height: 3.4rem; padding: 0 1rem; background: #fff; color: #0f172a; border-bottom: 1px solid #e5e7eb; box-sizing: border-box; font-family: Inter, system-ui, sans-serif; }
.ss-top * { box-sizing: border-box; }
.ss-brand { display: flex; align-items: center; gap: .6rem; color: #0f172a; text-decoration: none; font-weight: 700; font-size: 1.1rem; margin-right: 1rem; white-space: nowrap; }
.ss-logo { width: 2.2rem; height: 2.2rem; border-radius: .6rem; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 800; overflow: hidden; flex: none; }
.ss-logo img { width: 100%; height: 100%; object-fit: cover; }
.ss-logo:has(img) { background: none; }
.ss-nav, .ss-right { display: flex; align-items: center; gap: .2rem; }
.ss-nav { flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.ss-nav::-webkit-scrollbar { display: none; }
.ss-item { position: relative; display: flex; align-items: center; justify-content: center; gap: .3rem; padding: .4rem .8rem; border-radius: .6rem; color: #475569; text-decoration: none; font: 500 .85rem/1.2 Inter, system-ui, sans-serif; white-space: nowrap; background: none; border: 0; cursor: pointer; }
.ss-item .ss-badge { position: static; margin: 0; }
.ss-item:hover { background: #f1f5f9; color: #0f172a; }
.ss-item[hidden], .ss-prod[hidden] { display: none; }
.ss-item.ss-on { background: #eff6ff; color: var(--accent); font-weight: 600; }
.ss-item:focus-visible, .ss-tab:focus-visible, .ss-avatar:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; }
.ss-badge { position: absolute; top: .15rem; right: .3rem; min-width: 1.1rem; padding: 0 .3rem; border-radius: .6rem; background: #ef4444; color: #fff; font: 600 .7rem/1.1rem Inter, sans-serif; font-style: normal; text-align: center; }
.ss-user { position: relative; margin-left: .4rem; }
.ss-avatar { width: 2.3rem; height: 2.3rem; border-radius: 50%; border: 0; background: #eff6ff; color: var(--accent); font: 700 1rem Inter, sans-serif; cursor: pointer; }
.ss-menu { display: none; position: absolute; right: 0; top: calc(100% + .5rem); min-width: 14rem; background: #fff; color: #1f2937; border: 1px solid #e5e7eb; border-radius: .8rem; box-shadow: 0 .8rem 2rem rgba(15, 30, 58, .18); padding: .35rem; }
.ss-user.ss-open .ss-menu { display: block; }
.ss-menu-head { padding: .55rem .7rem; font-weight: 600; border-bottom: 1px solid #e5e7eb; margin-bottom: .25rem; }
.ss-menu-head small { display: block; margin-top: .1rem; font-weight: 400; font-size: .8rem; color: #64748b; } /* role: Quản trị, Quản lý, Nhân viên, Chỉ xem */
.ss-menu button { display: block; width: 100%; text-align: left; padding: .55rem .7rem; border: 0; background: none; border-radius: .5rem; font: 400 .9rem Inter, sans-serif; color: #1f2937; cursor: pointer; }
.ss-menu button:hover { background: #f3f4f6; }

.ss-sub { position: sticky; top: var(--ss-bar, 3.4rem); z-index: 999; height: var(--ss-sub, 3rem); box-sizing: border-box; display: flex; gap: .2rem; padding: 0 1rem; background: #fff; border-bottom: 1px solid #e5e7eb; overflow-x: auto; scrollbar-width: none; font-family: Inter, system-ui, sans-serif; }
.ss-sub::-webkit-scrollbar { display: none; } /* tabs scroll sideways by swipe/wheel; a Windows scrollbar would eat the 3rem row */
.ss-tab { position: relative; display: flex; align-items: center; gap: .1rem; padding: 0 .9rem; border: 0; border-bottom: 2.5px solid transparent; background: none; color: #4b5563; font: 500 .9rem Inter, sans-serif; text-decoration: none; white-space: nowrap; cursor: pointer; }
.ss-tab:hover { color: #111827; }
.ss-tab.ss-on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.ss-tab .ss-badge { position: static; margin-left: .3rem; }

@media (max-width: 1280px) { .ss-name { display: none; } .ss-item { padding: .4rem .55rem; } }
@media (max-width: 720px) {
  .ss-top { padding: 0 .4rem; }
  .ss-item { padding: .3rem .4rem; font-size: .65rem; }
}

/* Bar height for module layouts: calc(100vh - var(--ss-bar)). */
:root { --ss-bar: 3.4rem; --ss-sub: 3rem; } /* --ss-sub: height of the module tabs row */

/* 🔔 Việc cần làm */
.ss-notify { position: relative; }
.ss-npanel { display: none; position: absolute; right: 0; top: calc(100% + .5rem); min-width: 20rem; background: #fff; color: #1f2937; border: 1px solid #e5e7eb; border-radius: .8rem; box-shadow: 0 .8rem 2rem rgba(15, 30, 58, .18); padding: .35rem; z-index: 1001; font-family: Inter, system-ui, sans-serif; }
.ss-notify.ss-open .ss-npanel { display: block; }
.ss-nrow { display: flex; align-items: center; gap: .6rem; padding: .6rem .7rem; border-radius: .5rem; color: #1f2937; text-decoration: none; font-size: .92rem; }
.ss-nrow:hover { background: #eff6ff; }
.ss-nrow span { flex: 1; }
.ss-nrow i { font-style: normal; color: #9ca3af; }
.ss-nempty { padding: .8rem .7rem; color: #64748b; font-size: .9rem; }

/* Product name next to the shop's, and the product switcher */
.ss-product { padding-left: .7rem; border-left: 1px solid #e5e7eb; color: var(--accent); }
.ss-product:empty { display: none; }
.ss-apps { position: relative; }
.ss-apps .ss-item { font-size: 1.25rem; }
.ss-apanel { display: none; position: absolute; right: 0; top: calc(100% + .5rem); width: 22rem; max-width: calc(100vw - 1rem); grid-template-columns: 1fr 1fr; gap: .35rem; background: #fff; border: 1px solid #e5e7eb; border-radius: .8rem; box-shadow: 0 .8rem 2rem rgba(15, 30, 58, .18); padding: .6rem; }
.ss-apps.ss-open .ss-apanel { display: grid; }
.ss-prod { display: block; padding: .7rem .8rem; border-radius: .6rem; color: #0f172a; text-decoration: none; }
.ss-prod:hover, .ss-prod.ss-on { background: #eff6ff; }
.ss-prod b { display: block; font-size: .95rem; }
.ss-prod small { color: #64748b; font-size: .78rem; }

/* Bán hàng: the tab row becomes a left menu */
body.ss-side { --ss-sub: 0px; --ss-side: 13.5rem; padding-left: var(--ss-side); }
body.ss-side .ss-top { margin-left: calc(-1 * var(--ss-side)); }
body.ss-side .ss-sub { position: fixed; top: var(--ss-bar); left: 0; bottom: 0; width: var(--ss-side); height: auto; flex-direction: column; gap: .15rem; padding: .8rem .6rem; border-right: 1px solid #e5e7eb; border-bottom: 0; overflow: hidden auto; z-index: 90; }
body.ss-side .ss-tab { flex: none; width: 100%; padding: .6rem .8rem; border: 0; border-radius: .6rem; box-sizing: border-box; text-align: left; cursor: pointer; }
body.ss-side .ss-tab:hover { background: #f1f5f9; }
body.ss-side .ss-tab.ss-on { background: #eff6ff; }
body.ss-side .ss-tab .ss-badge { margin-left: auto; }
.ss-more summary { padding: .6rem .8rem; color: #64748b; font: 500 .9rem Inter, sans-serif; cursor: pointer; }
body.ss-side .ss-more .ss-tab { padding-left: 1.6rem; }
.ss-burger { display: none; }
@media (max-width: 900px) {
  body.ss-side { --ss-side: 0px; }
  .ss-burger { display: flex; font-size: 1.2rem; }
  body.ss-side .ss-sub { width: 15rem; z-index: 1001; transform: translateX(-100%); visibility: hidden; transition: transform .2s; }
  body.ss-side.ss-side-open .ss-sub { transform: none; visibility: visible; box-shadow: 0 0 0 100vmax rgba(15, 23, 42, .35); }
}
@media (max-width: 720px) {
  .ss-brand { margin-right: .2rem; }
  .ss-product { padding-left: 0; border: 0; }
  .ss-item { font-size: .75rem; }
  .ss-user { margin-left: 0; }
  .ss-npanel { min-width: 0; width: 18rem; max-width: 90vw; }
}
/* icon buttons in the bar (bell, settings, apps): square, the count sits on the icon */
.ss-item.ss-icon { position: relative; display: inline-grid; place-items: center; width: 2.25rem; height: 2.25rem; padding: 0; }
.ss-item.ss-icon .ss-badge { position: absolute; top: .05rem; right: .05rem; }
/* Empty state, every module (SmartShell.emptyHtml): icon, what the page is for, the next step */
.ss-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 48px 24px; text-align: center; color: #6b7280; }
.ss-empty-ico { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: color-mix(in srgb, var(--accent, #2563eb) 10%, #fff); color: var(--accent, #2563eb); }
.ss-empty b { color: #111827; font-size: 16px; font-weight: 600; }
.ss-empty p { margin: 0; max-width: 440px; font-size: 14px; line-height: 1.55; }
.ss-empty .ss-empty-act { margin-top: 8px; display: inline-flex; align-items: center; height: 38px; padding: 0 16px; border: 0; border-radius: 999px; background: var(--accent, #2563eb); color: #fff; font: 600 14px Inter, system-ui, sans-serif; text-decoration: none; cursor: pointer; }
.ss-empty .ss-empty-act:hover { filter: brightness(.92); }
/* ===== Left rail (owner 2026-11-28, like Zalo / Pancake) ===== */
body.ss-has-rail { --ss-rail: 5.4rem; padding-left: var(--ss-rail); } /* wide enough for "Khách hàng", "Livestream" on one line */
.ss-rail { position: fixed; left: 0; top: 0; bottom: 0; z-index: 1002; width: var(--ss-rail); box-sizing: border-box; display: flex; flex-direction: column; align-items: stretch; padding: .5rem .35rem; background: #0f1b3d; color: #c7d2fe; font-family: Inter, system-ui, sans-serif; }
.ss-rail * { box-sizing: border-box; }
/* a small logo with the shop's name under it (owner 2026-11-30: the bare 2.4rem logo looked big and odd) */
.ss-rail-logo { display: flex; flex-direction: column; align-items: center; gap: .2rem; padding: .2rem 0 .45rem; margin-bottom: .35rem; border-bottom: 1px solid rgba(255, 255, 255, .12); text-decoration: none; }
.ss-rail-logo .ss-logo { width: 1.75rem; height: 1.75rem; border-radius: .45rem; }
.ss-rail-name { max-width: 100%; /* stays in the icons-only rail too: the owner asked for the name under the logo */ color: #fff; font: 700 max(10px, .6rem)/1.15 Inter, system-ui, sans-serif; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ss-rail-main { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: .3rem; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .3) transparent; } /* a visible bar: items below the edge must show they are there */
.ss-rail-foot { display: flex; flex-direction: column; align-items: stretch; gap: .3rem; padding-top: .4rem; border-top: 1px solid rgba(255, 255, 255, .12); }
.ss-ri { position: relative; display: flex; flex-direction: column; align-items: center; gap: .25rem; width: 100%; padding: .42rem .15rem; border: 0; border-radius: .7rem; background: none; color: #c7d2fe; text-decoration: none; font: 500 max(11px, .66rem)/1.15 Inter, system-ui, sans-serif; text-align: center; cursor: pointer; }
.ss-ri span { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } /* one line per label: the items stay one height */
.ss-ri > svg { width: var(--ri-icon, 1.6rem); height: var(--ri-icon, 1.6rem); flex: none; stroke-width: 1.8; } /* grows with the rail (rem), not a fixed 22px that looked small on big screens (owner 2026-11-28) */
.ss-ri:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.ss-ri.ss-on { background: var(--accent); color: #fff; }
.ss-ri[hidden] { display: none; }
.ss-ri:focus-visible { outline: 3px solid #fff; outline-offset: -3px; }
.ss-rail .ss-badge { position: absolute; top: .15rem; right: .45rem; }
.ss-rail .ss-user { display: flex; justify-content: center; margin: .3rem 0 0; }
.ss-rail .ss-avatar { width: 2.3rem; height: 2.3rem; }
/* when the items with labels do not fit the window height (shell.js fitRail measures it; the type grows with the
   width, so wide-but-short screens are short too): icons only, in a narrow rail, the icon nearly as wide as the rail
   (owner 2026-11-28); the label stays in title/aria-label */
@media (min-width: 769px) {
  body.ss-rail-icons { --ss-rail: 3.9rem; }
  body.ss-rail-icons .ss-ri { padding: .3rem .1rem; gap: 0; --ri-icon: 2.1rem; }
  body.ss-rail-icons .ss-ri span { display: none; }
  body.ss-rail-icons .ss-rail-logo { padding-bottom: .3rem; margin: 0 -.3rem .2rem; } /* the name uses the rail's full width: "SmartSale" fits uncut */
}
/* menus open to the right of the rail, from the bottom */
.ss-rail .ss-notify { position: relative; }
.ss-rail .ss-npanel { left: calc(100% + .5rem); right: auto; top: auto; bottom: 0; }
.ss-rail .ss-menu { left: calc(100% + .5rem); right: auto; top: auto; bottom: 0; }
/* the top bar: the page name only */
.ss-page { font-weight: 700; font-size: 1.05rem; color: #0f172a; margin-right: 1rem; white-space: nowrap; }
.ss-rail-more { display: none; }
/* phones: the rail becomes a bottom bar with 4 items + Thêm; Thêm opens the rest as a grid above the bar (no sideways scrolling to find an item) */
@media (max-width: 768px) {
  body.ss-has-rail { padding-left: 0; padding-bottom: 3.8rem; }
  .ss-rail { top: auto; right: 0; width: auto; height: 3.8rem; flex-direction: row; align-items: stretch; padding: .25rem; gap: .15rem; }
  .ss-rail-logo { display: none; }
  .ss-rail-main { flex: 4 1 0; flex-direction: row; overflow: visible; gap: .15rem; }
  .ss-rail-main > .ss-ri:nth-child(n+5):not(.ss-on), .ss-rail-foot { display: none; } /* the open page always stays in the bar */
  .ss-rail-main:has(> .ss-ri:nth-child(n+5).ss-on) > .ss-ri:nth-child(4) { display: none; } /* ...in the 4th slot: always 5 slots, labels never cut */
  .ss-ri { flex: 1 1 0; min-width: 0; width: auto; padding: .35rem .15rem; --ri-icon: 1.45rem; } /* phone bar: 4 items + Thêm, one row high */
  .ss-ri span { display: block; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .ss-rail-more { display: flex; flex: 1 1 0; }
  .ss-rail:not(.ss-rail-open):has(.ss-rail-foot .ss-on) .ss-rail-more { background: var(--accent); color: #fff; } /* Bảng tin / Cài đặt open: Thêm shows where you are */
  .ss-rail .ss-npanel, .ss-rail .ss-menu { position: fixed; left: .5rem; right: .5rem; bottom: 4.2rem; }
  /* Thêm open: the bar grows upward into a grid of every item, Thêm (now Đóng) stays bottom right */
  .ss-rail.ss-rail-open { height: auto; max-height: 85vh; overflow-y: auto; flex-wrap: wrap; align-content: flex-end; padding: .6rem .4rem .25rem; border-radius: 1rem 1rem 0 0; box-shadow: 0 -12px 32px rgba(15, 23, 42, .35); }
  .ss-rail.ss-rail-open .ss-rail-main, .ss-rail.ss-rail-open .ss-rail-foot { flex: 1 1 100%; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .3rem; }
  .ss-rail.ss-rail-open .ss-rail-main > .ss-ri { display: flex; }
  .ss-rail.ss-rail-open .ss-rail-main > .ss-ri[hidden] { display: none; }
  .ss-rail.ss-rail-open .ss-rail-foot { border-top: 1px solid rgba(255, 255, 255, .12); padding-top: .4rem; margin-top: .3rem; align-items: center; }
  .ss-rail.ss-rail-open .ss-ri { padding: .6rem .2rem; }
  .ss-rail.ss-rail-open .ss-rail-foot .ss-notify, .ss-rail.ss-rail-open .ss-rail-foot .ss-user { display: flex; justify-content: center; margin: 0; }
  .ss-rail.ss-rail-open .ss-rail-more { flex: 0 0 25%; margin: .3rem 0 0 auto; }
  .ss-rail.ss-rail-open .ss-rail-foot .ss-ri[hidden] { display: none; }
}
/* with the rail there is no top bar (owner 2026-11-28): the rail shows where you are, each page has its own title.
   --ss-bar 0 lets every module layout (calc(100vh - var(--ss-bar))) fill the screen */
body.ss-has-rail { --ss-bar: 0px; }
body.ss-has-rail .ss-top { display: none; }
