/* App shell layouts */

/**
 * Desktop: .tn-tx-bar \u0111\u01b0\u1ee3c desktop-app-shell chuy\u1ec3n xu\u1ed1ng cu\u1ed1i <main>,
 * kh\u00f4ng d\u00f9ng fixed/sticky \u0111\u1ec3 lu\u00f4n th\u1ea5y n\u00fat H\u1ee7y/L\u01b0u (tr\u00e1nh clip trong v\u00f9ng cu\u1ed9n).
 */
.tn-tx-bar.tn-tx-bar--desktop-dock {
  position: static !important;
  inset: auto !important;
  z-index: auto !important;
  flex-shrink: 0;
  width: 100%;
  margin-left: 0 !important;
  margin-right: 0 !important;
  border-bottom-width: 0 !important;
  border-top: 1px solid color-mix(in srgb, var(--tn-color-outline-variant) 15%, transparent);
  box-shadow: 0 -8px 24px rgba(25, 27, 36, 0.04);
}

.tn-auth-layout {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(135deg, var(--tn-color-primary) 0%, var(--tn-color-primary-container) 100%);
}

.tn-auth-layout__header {
  padding: var(--tn-space-4) var(--tn-space-5);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  gap: var(--tn-space-2);
}

.tn-auth-layout__brand {
  font-family: var(--tn-font-headline);
  font-weight: 800;
  font-size: var(--tn-text-xl);
}

.tn-auth-layout__main {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: var(--tn-space-8) var(--tn-space-5) var(--tn-space-10);
}

.tn-auth-layout__card {
  width: 100%;
  max-width: 26rem;
  background: #fff;
  border-radius: var(--tn-radius-xl);
  padding: var(--tn-space-6);
  box-shadow: var(--tn-shadow-md);
}

.dark .tn-auth-layout__card {
  background: var(--tn-color-surface-container);
}

/* Mobile shell */
.tn-mobile-shell {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  background: var(--tn-color-surface);
}

.tn-mobile-shell__main {
  flex: 1;
  min-height: 0;
}

/* Desktop shell */
.tn-desktop-shell {
  display: flex;
  min-height: 100dvh;
  background: var(--tn-color-surface);
}

.tn-desktop-shell__sidebar {
  width: var(--tn-sidebar-width);
  flex-shrink: 0;
  background: var(--tn-color-surface-low);
  border-right: 1px solid var(--tn-color-outline-variant);
  display: flex;
  flex-direction: column;
  padding: var(--tn-space-6) 0;
}

.tn-desktop-shell__brand {
  display: flex;
  align-items: center;
  gap: var(--tn-space-3);
  padding: 0 var(--tn-space-5) var(--tn-space-6);
}

.tn-desktop-shell__brand-mark {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--tn-radius-lg);
  background: var(--tn-color-primary-container);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tn-desktop-shell__brand-title {
  font-family: var(--tn-font-headline);
  font-weight: 800;
  font-size: var(--tn-text-lg);
  color: var(--tn-color-primary);
}

.tn-desktop-shell__brand-sub {
  font-size: var(--tn-text-xs);
  color: var(--tn-color-on-surface-variant);
}

.tn-desktop-shell__content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.tn-desktop-shell__header {
  height: var(--tn-header-height);
  border-bottom: 1px solid var(--tn-color-outline-variant);
  display: flex;
  align-items: center;
  padding: 0 var(--tn-space-6);
  justify-content: space-between;
  background: color-mix(in srgb, var(--tn-color-surface) 90%, transparent);
  backdrop-filter: blur(10px);
}

.tn-desktop-shell__scroll {
  flex: 1;
  overflow: auto;
  padding: var(--tn-space-6);
}

/* Bottom tab */
.tn-bottom-tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--tn-mobile-tab-height);
  background: color-mix(in srgb, var(--tn-color-surface) 92%, transparent);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--tn-color-outline-variant);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: var(--tn-z-sticky);
}

.tn-bottom-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.125rem;
  font-size: 0.625rem;
  font-weight: 700;
  color: var(--tn-color-on-surface-variant);
  text-decoration: none;
  padding: var(--tn-space-2);
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
}

.tn-bottom-tab .tn-material {
  font-size: var(--tn-icon-md);
}

.tn-bottom-tab--active {
  color: var(--tn-color-primary);
}

.tn-bottom-tab:focus-visible {
  outline: 2px solid var(--tn-color-primary);
  outline-offset: 2px;
}

/* Sidebar link */
.tn-side-link {
  display: flex;
  align-items: center;
  gap: var(--tn-space-3);
  padding: var(--tn-space-3) var(--tn-space-5);
  margin: 0 var(--tn-space-3) var(--tn-space-1);
  border-radius: 0 var(--tn-radius-full) var(--tn-radius-full) 0;
  font-family: var(--tn-font-headline);
  font-weight: 600;
  font-size: var(--tn-text-sm);
  color: var(--tn-color-on-surface);
  text-decoration: none;
  transition:
    background var(--tn-duration-normal) var(--tn-ease-standard),
    transform var(--tn-duration-fast) var(--tn-ease-standard);
}

.tn-side-link:hover {
  background: color-mix(in srgb, var(--tn-color-surface) 70%, var(--tn-color-primary));
}

.tn-side-link--active {
  background: var(--tn-color-surface-variant);
  color: var(--tn-color-primary);
  font-weight: 800;
}

/* Top bar mobile */
.tn-topbar {
  position: sticky;
  top: 0;
  z-index: var(--tn-z-sticky);
  min-height: var(--tn-header-height);
  padding: var(--tn-space-3) var(--tn-space-4);
  display: flex;
  align-items: center;
  gap: var(--tn-space-3);
  border-bottom: 1px solid var(--tn-color-outline-variant);
  background: var(--tn-color-surface);
}

.tn-topbar__title {
  font-family: var(--tn-font-headline);
  font-weight: 800;
  font-size: var(--tn-text-lg);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (min-width: 1024px) {
  .tn-hide-desktop {
    display: none !important;
  }
}

@media (max-width: 1023.98px) {
  .tn-hide-mobile {
    display: none !important;
  }
}

/* POS split */
.tn-pos-grid {
  display: grid;
  gap: var(--tn-space-4);
  min-height: 22rem;
}

@media (min-width: 1024px) {
  .tn-pos-grid {
    grid-template-columns: 1.4fr 1fr;
    align-items: stretch;
  }
}

.tn-pos-catalog {
  max-height: 70vh;
  border: 1px solid var(--tn-color-outline-variant);
  border-radius: var(--tn-radius-lg);
  padding: var(--tn-space-3);
  background: #fff;
}

.dark .tn-pos-catalog {
  background: var(--tn-color-surface-container);
}

.tn-pos-side {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.tn-pos-side .tn-card {
  flex: 1;
  min-height: 10rem;
  overflow: auto;
}

/**
 * Customer detail mobile: space for fixed action bar + bottom tab.
 * Tailwind CDN may not scan classes only in .js — use static CSS + in-flow spacer.
 */
.tn-cd-mobile-scroll-gap {
  width: 100%;
  flex-shrink: 0;
  height: calc(17rem + env(safe-area-inset-bottom, 0px));
}

@media (min-width: 1024px) {
  .tn-cd-mobile-scroll-gap {
    display: none;
    height: 0;
    margin: 0;
    padding: 0;
  }
}
