/* ---- Member focus sales progress ---- */
.member-focus-list {
  display: grid;
  gap: 12px;
}

.member-focus-empty {
  color: var(--text-muted);
  text-align: center;
  padding: 18px 10px;
  font-size: 13px;
}

.member-focus-branch {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--bg-surface) 72%, transparent);
  overflow: hidden;
}

.member-focus-branch-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--text-primary) 4%, transparent);
  color: var(--text-primary);
  font-size: 13px;
}

.member-focus-branch-head span {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 800;
}

.member-focus-rows {
  display: grid;
}

.member-focus-row {
  padding: 12px;
  border-bottom: 1px solid var(--border);
}

.member-focus-row:last-child {
  border-bottom: 0;
}

.member-focus-row.is-current {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.member-focus-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
}

.member-focus-name {
  color: var(--text-primary);
  font-size: 13.5px;
  font-weight: 900;
  line-height: 1.3;
}

.member-focus-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 5px;
}

.member-focus-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-hover);
  color: var(--text-secondary);
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 800;
}

.member-focus-amount {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.member-focus-amount strong {
  color: var(--accent);
  font-size: 15px;
  font-weight: 950;
}

.member-focus-amount span {
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 700;
}

.member-focus-progress {
  margin-top: 10px;
}

.member-focus-bar {
  height: 9px;
  border-radius: 999px;
  background: var(--bg-hover);
  overflow: hidden;
}

.member-focus-bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand-green), var(--brand-mint));
  transition: width 520ms var(--transition);
}

.member-focus-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 7px;
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 800;
}

.member-focus-growth.up {
  color: var(--success);
}

.member-focus-growth.down {
  color: var(--danger);
}

.member-focus-growth.flat {
  color: var(--text-muted);
}

.member-focus-list.compact .member-focus-row {
  padding: 10px;
}

.member-focus-list.compact .member-focus-main {
  grid-template-columns: 1fr;
}

.member-focus-list.compact .member-focus-amount {
  text-align: left;
}

@media (max-width: 640px) {
  .member-focus-main {
    grid-template-columns: 1fr;
  }

  .member-focus-amount {
    text-align: left;
  }

  .member-focus-foot {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* =============================================
   MPLUS BANANA — Main Stylesheet
============================================= */

@import url('https://fonts.googleapis.com/css2?family=Sarabun:wght@300;400;500;600;700;800&display=swap');

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

html {
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: 'Sarabun', sans-serif;
  background: var(--app-background);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  isolation: isolate;
  transition: background var(--transition), color var(--transition);
}

body::before {
  content: "";
  position: fixed;
  inset: -10%;
  z-index: 0;
  pointer-events: none;
  background-image: var(--ambient-grid);
  background-size: var(--ambient-grid-size);
  opacity: var(--ambient-opacity);
  animation: mbAuroraDrift 18s ease-in-out infinite alternate;
  will-change: transform;
}

@keyframes mbAuroraDrift {
  0%   { transform: translate(-2%, -1%) scale(1.02); }
  50%  { transform: translate(3.5%, -3%) scale(1.06); }
  100% { transform: translate(-2.5%, 2.2%) scale(1.04); }
}

body::after {
  content: "";
  position: fixed;
  inset: -12%;
  z-index: 0;
  pointer-events: none;
  background:
    var(--ambient-sheen),
    linear-gradient(
      115deg,
      transparent 16%,
      rgba(47, 107, 79, 0.075) 42%,
      rgba(168, 213, 186, 0.075) 50%,
      rgba(220, 235, 225, 0.12) 58%,
      transparent 82%
    );
  background-size: 100% 100%, 230% 230%;
  background-position: 50% 50%, 0% 50%;
  opacity: 1;
  transform: translateZ(0);
  animation: mbPrismSweep 26s ease-in-out infinite alternate;
  will-change: transform, background-position;
}

@keyframes mbPrismSweep {
  0% {
    background-position: 50% 50%, 0% 50%;
    transform: translate3d(-1.5%, -1%, 0) scale(1.02);
  }
  50% {
    background-position: 52% 48%, 100% 50%;
    transform: translate3d(1.5%, 1%, 0) scale(1.04);
  }
  100% {
    background-position: 48% 52%, 0% 50%;
    transform: translate3d(-1%, 1.5%, 0) scale(1.03);
  }
}

.app-layout,
.auth-page {
  position: relative;
  z-index: 1;
}

/* =============================================
   SHARED COMMAND CENTER COMPONENTS
============================================= */

.app-card {
  background:
    var(--surface-highlight),
    var(--glass-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-glass);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  min-width: 0;
}

.app-card-pad {
  padding: 20px;
}

.command-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.btn-primary,
.btn-secondary,
.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-family: 'Sarabun', sans-serif;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition), transform var(--transition), box-shadow var(--transition);
}

.btn-primary {
  background: linear-gradient(180deg, var(--brand-green-500) 0%, var(--brand-green) 62%, var(--brand-green-700) 100%);
  border-color: color-mix(in srgb, var(--brand-green-700) 55%, transparent);
  color: var(--text-on-accent);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.28),
    0 8px 20px -6px rgba(47, 107, 79, 0.30);
}

.btn-primary:hover {
  background: linear-gradient(180deg, #5F9B78 0%, var(--brand-green) 58%, var(--brand-green-700) 100%);
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.32),
    0 12px 26px -6px rgba(47, 107, 79, 0.34);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: color-mix(in srgb, var(--text-primary) 7%, transparent);
  border-color: var(--border-strong);
  color: var(--text-primary);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.10);
}

.btn-secondary:hover {
  background: color-mix(in srgb, var(--text-primary) 12%, transparent);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: color-mix(in srgb, var(--text-primary) 6%, transparent);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 3px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-hover);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
}

.status-badge.success {
  color: var(--success);
  background: color-mix(in srgb, var(--success) 12%, transparent);
  border-color: color-mix(in srgb, var(--success) 32%, transparent);
}

.status-badge.warning {
  color: var(--warning);
  background: color-mix(in srgb, var(--warning) 12%, transparent);
  border-color: color-mix(in srgb, var(--warning) 32%, transparent);
}

.status-badge.danger {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  border-color: color-mix(in srgb, var(--danger) 32%, transparent);
}

.nav-icon,
.bottom-nav-icon,
.ui-icon {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-icon svg,
.bottom-nav-icon svg,
.ui-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}

.metric-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
}

/* =============================================
   LAYOUT
============================================= */

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

/* =============================================
   TOPBAR
============================================= */

.topbar {
  grid-column: 1 / -1;
  height: var(--topbar-h);
  background: var(--glass-surface);
  backdrop-filter: blur(18px) saturate(var(--glass-saturate));
  -webkit-backdrop-filter: blur(18px) saturate(var(--glass-saturate));
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  width: var(--sidebar-w);
  padding-right: 20px;
  flex-shrink: 0;
}

.brand-logo {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, var(--brand-green), var(--brand-green-700));
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  color: var(--text-on-brand);
  letter-spacing: -0.5px;
  flex-shrink: 0;
}

.brand-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.2px;
}

.brand-name span {
  color: var(--accent);
}

.topbar-center {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}

.branch-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  border-opacity: 0.3;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
}

.branch-scope-pill {
  background: var(--accent-soft);
  border-color: var(--border-strong);
  color: var(--brand-green-700);
}

.branch-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all var(--transition);
}

.icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.avatar-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid var(--brand-green);
  background: var(--brand-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--brand-green);
  transition: all var(--transition);
}

.avatar-btn:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* =============================================
   SIDEBAR
============================================= */

.sidebar {
  background: var(--glass-surface);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  border-right: 1px solid var(--border-soft);
  padding: 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
}

.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 12px 10px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  transition: all var(--transition);
  text-decoration: none;
  position: relative;
  user-select: none;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-dim);
  color: var(--accent);
  font-weight: 600;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 20%;
  height: 60%;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

.nav-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: var(--text-on-accent);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
}

.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 10px;
}

.sidebar-bottom {
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

/* =============================================
   MAIN CONTENT
============================================= */

.main-content {
  padding: 24px;
  overflow-y: auto;
  max-height: calc(100vh - var(--topbar-h));
  min-width: 0;
}

/* =============================================
   PAGE HEADER
============================================= */

.page-header {
  margin-bottom: 24px;
}

.page-greeting {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 3px;
}

/* =============================================
   CARDS
============================================= */

.card {
  background:
    var(--surface-highlight),
    var(--glass-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-glass);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  min-width: 0;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 10px;
  min-width: 0;
}

.card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.1px;
}

.card-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.card-action {
  font-size: 12px;
  color: var(--accent);
  cursor: pointer;
  font-weight: 600;
  transition: opacity var(--transition);
}

.card-action:hover { opacity: 0.7; }

/* =============================================
   HOME GRID
============================================= */

.home-grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 16px;
}

.home-left {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.home-right {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

/* =============================================
   ANNOUNCEMENT CARD
============================================= */

.announcement-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.announcement-item {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  transition: border-color var(--transition);
}

.announcement-item:hover {
  border-color: var(--border-strong);
}

.announcement-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  margin-top: 4px;
}

.announcement-body {
  flex: 1;
  min-width: 0;
}

.announcement-text {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.5;
}

.announcement-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
}

.announcement-time {
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
  white-space: nowrap;
}

.empty-state {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 28px;
  margin-bottom: 8px;
  opacity: 0.5;
}

.empty-state-text {
  font-size: 13px;
}

/* =============================================
   STAT CARDS (ยอดโฟกัส)
============================================= */

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.stat-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.stat-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.stat-value.accent { color: var(--accent); }

.stat-unit {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-left: 2px;
}

.stat-change {
  font-size: 11px;
  margin-top: 5px;
  font-weight: 500;
}

.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* =============================================
   ONLINE STATUS
============================================= */

.member-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.member-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}

.member-item:hover {
  background: var(--bg-hover);
}

.member-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  position: relative;
  flex-shrink: 0;
}

.member-avatar.has-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.online-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 2px solid var(--bg-card);
}

.online-dot.online { background: var(--online); }
.online-dot.offline { background: var(--offline); }

.member-info {
  flex: 1;
  min-width: 0;
}

.member-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.member-branch-label {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 600;
}

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

.member-status-text {
  font-size: 11px;
  font-weight: 500;
}

.member-status-text.online { color: var(--online); }
.member-status-text.offline { color: var(--text-muted); }

/* =============================================
   SECTION LABEL ACCENT
============================================= */

.section-accent {
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-accent::before {
  content: '';
  width: 3px;
  height: 14px;
  background: var(--accent);
  border-radius: 2px;
  flex-shrink: 0;
}

/* =============================================
   RESPONSIVE — MOBILE
============================================= */

@media (max-width: 768px) {
  html {
    scroll-padding-bottom: var(--mobile-bottom-nav-space);
  }

  .app-layout {
    grid-template-columns: 1fr;
    grid-template-rows: var(--topbar-h) 1fr auto;
  }

  .topbar {
    padding: 0 8px;
    gap: 6px;
    overflow: hidden;
  }

  .topbar-brand {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    padding-right: 0;
    gap: 6px;
  }

  .brand-name {
    min-width: 0;
    max-width: 90px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .topbar-center {
    flex: 0 1 auto;
    min-width: 0;
  }

  .branch-badge {
    flex: 0 1 auto;
    max-width: 72px;
    min-width: 0;
    min-height: 30px;
    padding: 4px 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 11px;
  }

  .branch-badge::before {
    flex-shrink: 0;
  }

  .topbar-right {
    flex-shrink: 0;
    gap: 6px;
  }

  .icon-btn,
  .avatar-btn {
    width: 32px;
    height: 32px;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: min(344px, calc(100vw - 12px));
    height: 100dvh;
    z-index: 250;
    transform: translateX(calc(-100% - 12px));
    transition: transform 280ms cubic-bezier(0.16,1,0.3,1);
    box-shadow: var(--mobile-drawer-shadow);
    padding-top: 16px;
    background: var(--mobile-drawer-bg, #FFFFFF);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .sidebar.mobile-open {
    left: 0;
    transform: translateX(0);
  }

  .mobile-drawer-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: var(--mobile-drawer-scrim);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 180ms ease, visibility 180ms ease;
    z-index: 240;
  }

  .mobile-drawer-backdrop.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  body.mobile-menu-open {
    overflow: hidden;
  }

  body.mobile-menu-open .bottom-nav {
    z-index: 0;
    pointer-events: none;
  }

  .hamburger-btn {
    display: flex !important;
  }

  .main-content {
    padding: 12px;
    max-height: unset;
    padding-bottom: var(--mobile-bottom-nav-space);
  }

  .card,
  .app-card,
  .chart-card {
    overflow: hidden;
  }

  .card-header {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 10px;
  }

  .card-header > * {
    min-width: 0;
  }

  .card-title,
  .card-label,
  .card-action,
  .section-accent {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .sidebar .nav-item {
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 700;
  }

  .sidebar .nav-section-label {
    color: var(--text-secondary);
  }

  .btn-primary,
  .btn-secondary,
  .btn-ghost {
    min-height: 44px;
    max-width: 100%;
    white-space: normal;
  }

  input,
  select,
  textarea {
    max-width: 100%;
    min-height: 42px;
  }

  .home-grid {
    grid-template-columns: 1fr;
  }

  .topbar-brand {
    width: auto;
  }

  .bottom-nav {
    display: flex !important;
  }
}

@media (max-width: 430px) {
  .topbar-brand {
    flex: 0 0 auto;
  }

  .topbar-center {
    flex: 1 1 auto;
  }

  .brand-name {
    display: none;
  }

  .branch-badge {
    max-width: 128px;
  }
}

@media (max-width: 360px) {
  .topbar {
    padding: 0 6px;
    gap: 4px;
  }

  .topbar-right {
    gap: 4px;
  }

  .icon-btn,
  .avatar-btn {
    width: 30px;
    height: 30px;
  }

  .branch-badge {
    max-width: 92px;
    padding-inline: 7px;
  }
}

.hamburger-btn {
  display: none;
  width: 34px; height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  align-items: center; justify-content: center;
  font-size: 18px; cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}

.hamburger-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.sidebar-close-btn {
  display: none;
}

@media (max-width: 768px) {
  .sidebar-close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px; height: 28px;
    border-radius: 50%;
    background: var(--bg-hover);
    color: var(--text-secondary);
    border: none;
    font-size: 16px;
    cursor: pointer;
  }
}

/* Bottom Nav (mobile only) — Liquid Glass floating dock */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom, 0px) + var(--mobile-bottom-nav-offset));
  left: 12px;
  right: 12px;
  height: var(--mobile-bottom-nav-height);
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  border: 1px solid var(--border-soft);
  border-radius: 31px;
  box-shadow: var(--shadow-glass-hover);
  z-index: 100;
  padding: 0 10px;
  align-items: center;
  justify-content: space-around;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 7px 13px;
  border-radius: 999px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  transition: color var(--transition), background var(--transition);
  text-decoration: none;
}

.bottom-nav-item.active {
  color: var(--accent);
  background: var(--accent-dim);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
}

.bottom-nav-icon {
  font-size: 20px;
}

/* =============================================
   SCROLLBAR
============================================= */

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* =============================================
   SKELETON LOADING
============================================= */

.skeleton {
  background: linear-gradient(90deg,
    var(--bg-hover) 25%,
    var(--bg-surface) 50%,
    var(--bg-hover) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* =============================================
   FADE IN
============================================= */

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeInUp 300ms ease both;
}

.fade-in-delay-1 { animation-delay: 60ms; }
.fade-in-delay-2 { animation-delay: 120ms; }
.fade-in-delay-3 { animation-delay: 180ms; }

/* =============================================
   COLOR ACCENTS — Subtle Visual Enhancement
============================================= */

/* Announcement — left accent bar + soft bg */
.announcement-item {
  border-left: 3px solid transparent;
  background: linear-gradient(to right, var(--accent-glow), transparent 60%);
}

.announcement-item:nth-child(1) { border-left-color: var(--accent); }
.announcement-item:nth-child(2) { border-left-color: var(--brand-green-500); background: linear-gradient(to right, rgba(168,213,186,0.12), transparent 60%); }
.announcement-item:nth-child(3) { border-left-color: var(--success); background: linear-gradient(to right, rgba(52,211,153,0.05), transparent 60%); }

.announcement-dot { flex-shrink: 0; }
.announcement-item:nth-child(2) .announcement-dot { background: var(--brand-green-500); }
.announcement-item:nth-child(3) .announcement-dot { background: var(--success); }

/* Stat Cards — top accent line */
.stat-card {
  border-top: 2px solid transparent;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.stat-card:nth-child(1) { border-top-color: var(--accent); }
.stat-card:nth-child(2) { border-top-color: var(--brand-green-500); }
.stat-card:nth-child(3) { border-top-color: var(--success); }
.stat-card:nth-child(4) { border-top-color: var(--brand-mint); }

/* KPI Cards — icon glow */
.kpi-card:nth-child(1) .kpi-icon { filter: drop-shadow(0 0 6px var(--accent)); }
.kpi-card:nth-child(2) .kpi-icon { filter: drop-shadow(0 0 6px rgba(79,138,103,0.34)); }
.kpi-card:nth-child(3) .kpi-icon { filter: drop-shadow(0 0 6px var(--success)); }
.kpi-card:nth-child(4) .kpi-icon { filter: drop-shadow(0 0 6px rgba(168,213,186,0.42)); }

.kpi-card:nth-child(1)::after { background: rgba(168,213,186,0.14); }
.kpi-card:nth-child(2)::after { background: rgba(220,235,225,0.32); }
.kpi-card:nth-child(3)::after { background: rgba(52,211,153,0.06); }
.kpi-card:nth-child(4)::after { background: rgba(47,107,79,0.08); }

/* Member Avatars — rotating accent colors */
.member-avatar:nth-child(4n+1) { background: rgba(168,213,186,0.22); color: var(--brand-green); }
.member-avatar:nth-child(4n+2) { background: rgba(220,235,225,0.55); color: var(--brand-green-700); }
.member-avatar:nth-child(4n+3) { background: rgba(52,211,153,0.15); color: var(--success); }
.member-avatar:nth-child(4n+4) { background: rgba(47,107,79,0.12); color: var(--brand-green-500); }

/* Nav active — soft glow */
.nav-item.active {
  box-shadow: inset 0 0 12px var(--accent-glow);
}

/* Brand Tags — soft color */
.brand-tag:nth-child(3n+1) { background: var(--accent-dim); color: var(--accent); border-color: var(--accent-soft); }
.brand-tag:nth-child(3n+2) { background: var(--brand-sage); color: var(--brand-green-700); border-color: var(--border-strong); }
.brand-tag:nth-child(3n+3) { background: rgba(168, 213, 186, 0.24); color: var(--brand-green); border-color: var(--brand-mint); }
.brand-tag.muted { color: var(--text-muted); border-style: dashed; background: var(--bg-soft); }

/* Card Section Accent bar color variants */
.card:nth-child(even) .section-accent::before { background: var(--brand-green-500); }

/* Rank badges in tables */
.rank-badge { transition: transform var(--transition); }
.rank-badge:hover { transform: scale(1.15); }

/* Stock Low Badge pulse */
.low-badge {
  animation: pulse-danger 2s infinite;
}

@keyframes pulse-danger {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* Type badges — sharper colors */
.type-badge.cash {
  background: rgba(52,211,153,0.12);
  color: var(--success);
  border: 1px solid rgba(52,211,153,0.3);
}

.type-badge.installment {
  background: var(--brand-sage);
  color: var(--brand-green-700);
  border: 1px solid var(--border-strong);
}

.type-badge.trade {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid var(--accent-soft);
}

/* Online dot — glow effect */
.online-dot.online {
  box-shadow: 0 0 0 2px rgba(52,211,153,0.3);
}

/* Section label accent — thin gradient line under */
.nav-section-label {
  background: linear-gradient(to right, var(--accent-dim), transparent);
  border-radius: 3px;
  padding-left: 12px;
}

/* Profile hero gradient stronger */
.profile-hero::before {
  background: linear-gradient(135deg, var(--accent-dim) 0%, rgba(168,213,186,0.18) 50%, transparent 80%);
}

/* AI avatar shimmer */
.ai-avatar {
  animation: ai-glow 3s ease-in-out infinite;
}

@keyframes ai-glow {
  0%, 100% { box-shadow: 0 0 0 3px var(--accent-glow); }
  50% { box-shadow: 0 0 0 6px var(--accent-glow), 0 0 20px var(--accent-glow); }
}

/* =============================================
   NOTIFICATION CENTER
============================================= */

.global-toast {
  position: fixed;
  right: 24px;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  width: min(420px, calc(100vw - 32px));
  min-height: 46px;
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--toast-accent, var(--success));
  border-radius: var(--radius-md);
  padding: 12px 16px;
  color: var(--text-primary);
  font-family: 'Sarabun', sans-serif;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
  box-shadow: var(--shadow-lg);
  z-index: 900;
  transform: translateY(80px);
  opacity: 0;
  pointer-events: none;
  transition: transform 300ms ease, opacity 300ms ease;
}

.global-toast.show {
  transform: translateY(0);
  opacity: 1;
}

.notif-badge {
  position: absolute; top: 2px; right: 2px;
  min-width: 16px; height: 16px; border-radius: 8px;
  background: var(--danger); color: #fff;
  font-size: 9px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px; border: 2px solid var(--bg-surface);
}

.notif-panel {
  position: absolute; top: 44px; right: 0;
  width: 390px; max-height: 540px;
  background:
    var(--surface-highlight),
    var(--glass-card-strong);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-glass-hover);
  z-index: 500; display: none; flex-direction: column;
  overflow: hidden;
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
}

.notif-panel.notif-panel-layer {
  position: fixed;
  top: calc(var(--topbar-h) + 10px);
  right: 24px;
  z-index: 760;
}

.notif-panel.open { display: flex; }

.notif-panel-header {
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; font-weight: 700; color: var(--text-primary);
}

.notif-header-meta {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
}

.notif-clear-all {
  font-size: 11px; font-weight: 600; color: var(--accent);
  cursor: pointer; background: none; border: none; font-family: 'Sarabun', sans-serif;
}

.notif-filter-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: rgba(15,23,42,0.025);
}

.notif-filter-btn {
  min-width: 0;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 7px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-family: 'Sarabun', sans-serif;
  font-size: 10.5px;
  font-weight: 850;
  cursor: pointer;
}

.notif-filter-btn svg {
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
}

.notif-filter-btn span:not([data-icon]) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notif-filter-btn b {
  min-width: 17px;
  height: 17px;
  display: inline-grid;
  place-items: center;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--bg-hover);
  color: var(--text-primary);
  font-size: 9px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.notif-filter-btn.active {
  border-color: color-mix(in srgb, var(--accent) 44%, transparent);
  background: var(--accent-dim);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 12%, transparent);
}

.notif-filter-btn.active b {
  background: var(--accent);
  color: var(--text-on-accent);
}

.notif-list { overflow-y: auto; flex: 1; }

.notif-item {
  display: flex; gap: 10px; padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background var(--transition);
  position: relative;
}

.notif-item:hover { background: var(--bg-hover); }
.notif-item:last-child { border-bottom: none; }

.notif-item.unread {
  background: var(--accent-glow);
}

.notif-item.unread::before {
  content: ''; position: absolute; left: 6px; top: 50%; transform: translateY(-50%);
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
}

.notif-icon {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 14px;
  background: var(--bg-hover);
}

.notif-icon.type-stock { background: rgba(248,113,113,0.15); }
.notif-icon.type-target { background: rgba(52,211,153,0.15); }
.notif-icon.type-announce { background: var(--accent-dim); }
.notif-icon.type-chat { background: rgba(168,213,186,0.22); }
.notif-icon.type-pending { background: rgba(245,184,0,0.16); }
.notif-icon.type-password-reset { background: rgba(168,85,247,0.16); }
.notif-icon.type-sales-audit { background: rgba(34,197,94,0.16); }
.notif-icon svg, .notif-empty-icon svg { width: 17px; height: 17px; }

.notif-body { flex: 1; min-width: 0; }
.notif-text { font-size: 12.5px; font-weight: 500; color: var(--text-primary); line-height: 1.4; }
.notif-time { font-size: 10.5px; color: var(--text-muted); margin-top: 2px; }

.notif-empty { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.notif-empty.compact { padding: 30px 16px; }
.notif-empty-icon { font-size: 28px; margin-bottom: 8px; opacity: 0.4; }

.notif-panel-footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  background: rgba(15,23,42,0.025);
}

.notif-footer-btn {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-family: 'Sarabun', sans-serif;
  font-size: 11px;
  font-weight: 850;
  cursor: pointer;
}

.notif-footer-btn:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.notif-footer-btn.danger {
  color: var(--danger);
}

.notif-footer-btn svg {
  width: 14px;
  height: 14px;
}

@media (max-width: 480px) {
  .global-toast {
    left: 12px;
    right: 12px;
    bottom: calc(var(--mobile-bottom-nav-space) + 12px + env(safe-area-inset-bottom, 0px));
    width: auto;
    font-size: 12.5px;
    border-radius: var(--radius-lg);
  }

  .notif-panel {
    position: fixed;
    top: calc(var(--topbar-h) + 10px);
    left: 12px;
    right: 12px;
    width: auto;
    max-height: calc(100dvh - var(--topbar-h) - var(--mobile-bottom-nav-space) - 22px);
    z-index: 760;
  }
  .notif-panel.notif-panel-layer {
    left: 12px;
    right: 12px;
  }
  .notif-filter-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* =============================================
   ADMIN COMMAND CENTER
============================================= */

.admin-command-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: 22px;
  align-items: stretch;
  margin-bottom: 16px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 28px;
  background:
    linear-gradient(135deg, rgba(47, 107, 79, 0.18), transparent 42%),
    linear-gradient(315deg, rgba(74,144,226,0.10), transparent 36%),
    var(--bg-card);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  position: relative;
}

.admin-command-hero::after {
  content: "";
  position: absolute;
  inset: auto -16% -38% 42%;
  height: 62%;
  background: linear-gradient(90deg, rgba(47, 107, 79, 0.20), rgba(255,255,255,0.06), rgba(168, 213, 186, 0.16));
  filter: blur(34px);
  transform: rotate(-8deg);
  opacity: 0.74;
  pointer-events: none;
}

.admin-command-copy,
.admin-command-status {
  position: relative;
  z-index: 1;
}

.admin-command-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(47, 107, 79, 0.34);
  background: rgba(47, 107, 79, 0.10);
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
}

.admin-command-kicker svg {
  width: 16px;
  height: 16px;
}

.admin-command-title {
  margin: 16px 0 10px;
  color: var(--text-primary);
  font-size: 31px;
  line-height: 1.22;
  font-weight: 900;
}

.admin-command-text {
  margin: 0;
  max-width: 640px;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.72;
}

.admin-command-status {
  display: grid;
  gap: 10px;
  align-content: center;
}

.admin-status-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255,255,255,0.72);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 700;
}

.admin-status-row svg {
  width: 18px;
  height: 18px;
  color: var(--accent);
  flex: 0 0 auto;
}

.admin-command-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 18px;
}

.admin-command-tile {
  min-height: 118px;
  display: grid;
  align-content: space-between;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--bg-card);
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  font-family: 'Sarabun', sans-serif;
}

.admin-command-tile:hover {
  border-color: rgba(47, 107, 79, 0.48);
  box-shadow: 0 14px 36px rgba(0,0,0,0.18);
  transform: translateY(-1px);
}

.admin-command-tile-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--accent-dim);
  color: var(--accent);
}

.admin-command-tile-icon svg {
  width: 19px;
  height: 19px;
}

.admin-command-tile-title {
  display: block;
  font-size: 15px;
  font-weight: 900;
  color: var(--text-primary);
}

.admin-command-tile-meta {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-muted);
}

.sync-monitor-panel {
  margin-bottom: 14px;
  overflow: hidden;
}

.sales-audit-panel {
  border-color: color-mix(in srgb, var(--success) 20%, var(--border-soft));
}

.sales-audit-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.sales-audit-table {
  min-width: 820px;
}

.admin-system-health-panel {
  border-color: color-mix(in srgb, var(--accent) 18%, var(--border-soft));
}

.admin-system-health-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.admin-system-health-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}

.admin-system-health-filter {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font: inherit;
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition), border-color var(--transition), color var(--transition), transform var(--transition);
}

.admin-system-health-filter span {
  min-width: 20px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--bg-hover);
  color: var(--text-muted);
  font-size: 11px;
  text-align: center;
}

.admin-system-health-filter:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.admin-system-health-filter.active {
  border-color: color-mix(in srgb, var(--accent) 52%, var(--border));
  background: color-mix(in srgb, var(--accent) 14%, var(--bg-surface));
  color: var(--accent);
}

.admin-system-health-filter.active span {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--accent);
}

.admin-system-health-table {
  min-width: 860px;
}

.admin-system-health-row {
  cursor: pointer;
  transition: background var(--transition), box-shadow var(--transition), transform var(--transition);
}

.admin-system-health-row:hover td {
  background: color-mix(in srgb, var(--accent) 7%, transparent);
}

.admin-system-health-row:active {
  transform: scale(0.998);
}

.admin-system-health-action-summary {
  display: grid;
  gap: 10px;
  margin: 10px 0 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--bg-hover) 72%, transparent);
}

.admin-system-health-action-summary.muted {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 800;
}

.admin-system-health-action-summary.ready {
  border-color: rgba(52,211,153,0.24);
  background: rgba(52,211,153,0.08);
}

.admin-health-summary-head,
.admin-health-summary-ready {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.admin-health-summary-head strong,
.admin-health-summary-ready strong {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 950;
}

.admin-health-summary-ready span {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 800;
}

.admin-health-summary-more {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 900;
}

.admin-health-summary-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-health-summary-item {
  display: inline-grid;
  grid-template-columns: auto auto auto;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  font: inherit;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.admin-health-summary-item span,
.admin-health-summary-item small {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 900;
}

.admin-health-summary-item strong {
  font-size: 12px;
  font-weight: 950;
}

.admin-health-summary-item.danger {
  border-color: rgba(248,113,113,0.34);
  background: rgba(248,113,113,0.09);
}

.admin-health-summary-item.warning {
  border-color: rgba(245,184,0,0.34);
  background: rgba(245,184,0,0.1);
}

.admin-health-summary-item:hover {
  border-color: color-mix(in srgb, var(--accent) 54%, var(--border));
  box-shadow: 0 0 0 4px var(--accent-glow);
}

.admin-health-summary-item:active {
  transform: scale(0.98);
}

.sync-card-focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 72%, transparent);
  outline-offset: 4px;
  box-shadow: 0 0 0 8px var(--accent-glow), var(--shadow-glass-hover) !important;
}

.admin-system-health-chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-hover);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.admin-system-health-chip.success {
  border-color: rgba(52,211,153,0.32);
  background: rgba(52,211,153,0.12);
  color: var(--success);
}

.admin-system-health-chip.warning {
  border-color: rgba(245,184,0,0.34);
  background: rgba(245,184,0,0.12);
  color: #F5B800;
}

.admin-system-health-chip.danger {
  border-color: rgba(248,113,113,0.36);
  background: rgba(248,113,113,0.12);
  color: var(--danger);
}

.admin-system-health-chip.accent {
  border-color: rgba(47, 107, 79, 0.34);
  background: rgba(47, 107, 79, 0.12);
  color: var(--accent);
}

.admin-system-health-meta {
  display: inline-block;
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.35;
}

.admin-system-health-issues {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.admin-system-health-next {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin: 0 0 7px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-hover);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.admin-system-health-next.danger {
  border-color: rgba(248,113,113,0.36);
  background: rgba(248,113,113,0.12);
  color: var(--danger);
}

.admin-system-health-next.warning {
  border-color: rgba(245,184,0,0.34);
  background: rgba(245,184,0,0.12);
  color: #F5B800;
}

.admin-system-health-next.success {
  border-color: rgba(52,211,153,0.26);
  background: rgba(52,211,153,0.1);
  color: var(--success);
}

.admin-system-health-next.accent {
  border-color: rgba(47, 107, 79, 0.34);
  background: rgba(47, 107, 79, 0.12);
  color: var(--accent);
}

.admin-system-health-issue,
.admin-system-health-ok {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}

.admin-system-health-issue {
  border: 1px solid rgba(248,113,113,0.28);
  background: rgba(248,113,113,0.1);
  color: var(--danger);
}

.admin-system-health-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent) 34%, var(--border));
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--accent);
  font: inherit;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.admin-system-health-action:hover {
  border-color: color-mix(in srgb, var(--accent) 62%, var(--border));
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  box-shadow: 0 0 0 4px var(--accent-glow);
}

.admin-system-health-action:active {
  transform: scale(0.97);
}

.sync-target-focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 72%, transparent);
  outline-offset: 3px;
  box-shadow: 0 0 0 5px var(--accent-glow) !important;
}

.admin-system-health-ok {
  border: 1px solid rgba(52,211,153,0.26);
  background: rgba(52,211,153,0.1);
  color: var(--success);
}

.sync-monitor-note {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.sync-monitor-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 18px;
}

.sync-monitor-table {
  width: 100%;
  min-width: 780px;
  border-collapse: collapse;
}

.sync-monitor-table th,
.sync-monitor-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 12.5px;
}

.sync-monitor-table th {
  background: var(--bg-surface);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.sync-monitor-table td {
  color: var(--text-secondary);
}

.sync-monitor-table tr:last-child td {
  border-bottom: 0;
}

.sync-monitor-table strong {
  display: block;
  color: var(--text-primary);
  font-size: 13px;
}

.sync-monitor-branch-id {
  display: block;
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 11px;
}

.sync-monitor-message {
  max-width: 420px;
  line-height: 1.55;
}

.sync-monitor-empty {
  padding: 24px !important;
  color: var(--text-muted);
  text-align: center !important;
}

.sync-status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-hover);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.sync-status-chip.success {
  border-color: rgba(52,211,153,0.32);
  background: rgba(52,211,153,0.12);
  color: var(--success);
}

.sync-status-chip.warning {
  border-color: rgba(245,184,0,0.34);
  background: rgba(245,184,0,0.12);
  color: #F5B800;
}

.sync-status-chip.danger {
  border-color: rgba(248,113,113,0.36);
  background: rgba(248,113,113,0.12);
  color: var(--danger);
}

.sync-status-chip.accent {
  border-color: rgba(47, 107, 79, 0.34);
  background: rgba(47, 107, 79, 0.12);
  color: var(--accent);
}

@media (max-width: 1080px) {
  .admin-command-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .admin-command-hero {
    grid-template-columns: 1fr;
    padding: 20px;
    border-radius: 22px;
  }

  .admin-command-title {
    font-size: 25px;
  }

  .admin-command-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .admin-system-health-filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
  }

  .admin-system-health-filters::-webkit-scrollbar {
    display: none;
  }

  .admin-system-health-filter {
    flex: 0 0 auto;
  }

  .sync-monitor-table-wrap {
    max-width: 100%;
    overflow-x: visible;
    border: 0;
    border-radius: 0;
  }

  .sync-monitor-table,
  .sales-audit-table {
    min-width: 0;
    border-collapse: separate;
    border-spacing: 0 10px;
  }

  .sync-monitor-table {
    min-width: 0;
    border-spacing: 0 10px;
  }

  .sync-monitor-table thead {
    display: none;
  }

  .sync-monitor-table tbody,
  .sync-monitor-table tr,
  .sync-monitor-table td {
    display: block;
    width: 100%;
  }

  .sync-monitor-table tr {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
  }

  .sync-monitor-table th,
  .sync-monitor-table td {
    overflow-wrap: anywhere;
  }

  .sync-monitor-table td {
    display: grid;
    grid-template-columns: minmax(112px, 38%) minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    background: transparent;
  }

  .sync-monitor-table td:last-child {
    border-bottom: 0;
  }

  .sync-monitor-table td::before {
    content: attr(data-label);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 900;
    line-height: 1.25;
  }

  .sync-monitor-empty {
    display: block !important;
    text-align: center !important;
  }

  .sync-monitor-empty::before {
    content: none !important;
  }

  .sync-monitor-message {
    max-width: none;
  }
}

/* =============================================
   AUTH EXPERIENCE
============================================= */

.auth-page {
  min-height: 100vh;
  margin: 0;
  display: grid;
  place-items: center;
  padding: 28px;
  background: var(--app-background);
  color: var(--text-primary);
  overflow-x: hidden;
}

.auth-page::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: var(--ambient-grid);
  background-size: var(--ambient-grid-size);
}

.auth-page::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.05;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  mix-blend-mode: overlay;
}


.auth-shell {
  width: min(1120px, 100%);
  min-height: min(720px, calc(100vh - 56px));
  display: grid;
  grid-template-columns: minmax(360px, 1.08fr) minmax(360px, 0.92fr);
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 30px;
  background: color-mix(in srgb, var(--bg-card) 92%, transparent);
  box-shadow: 0 28px 80px rgba(35,75,54,0.16), 0 1px 0 rgba(255,255,255,0.72) inset;
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
}

.auth-page-register .auth-shell {
  width: min(1180px, 100%);
  grid-template-columns: minmax(360px, 0.96fr) minmax(420px, 1.04fr);
}

.auth-visual-panel,
.auth-form-panel {
  position: relative;
  z-index: 1;
}

.auth-visual-panel {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 36px;
  padding: 42px;
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--brand-green) 22%, transparent), transparent 48%),
    linear-gradient(0deg, rgba(255,255,255,0.045), transparent),
    var(--bg-surface);
  border-right: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.auth-visual-panel::before {
  content: "";
  position: absolute;
  inset: -20%;
  pointer-events: none;
  background:
    radial-gradient(46% 38% at 22% 20%, rgba(47, 107, 79, 0.28), transparent 70%),
    radial-gradient(50% 42% at 82% 70%, rgba(220,235,225,0.20), transparent 72%),
    radial-gradient(40% 36% at 60% 95%, rgba(168, 213, 186, 0.20), transparent 70%);
  filter: blur(6px);
}

@media (prefers-reduced-motion: no-preference) {
  .auth-visual-panel::before {
    animation: mbAuthGlowDrift 18s ease-in-out infinite alternate;
  }
  .auth-visual-panel::after {
    animation: mbAuthGlowFade 9s ease-in-out infinite alternate;
  }
}

@keyframes mbAuthGlowDrift {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(3%, -3%) scale(1.06); }
}

@keyframes mbAuthGlowFade {
  0%   { opacity: 0.45; }
  100% { opacity: 0.85; }
}

.auth-visual-panel::after {
  content: "";
  position: absolute;
  inset: auto -20% -24% 12%;
  height: 42%;
  background: linear-gradient(90deg, rgba(168, 213, 186, 0.20), rgba(255,255,255,0.06), rgba(47, 107, 79, 0.18));
  transform: rotate(-8deg);
  filter: blur(28px);
  opacity: 0.7;
}

.auth-brand-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.auth-logo-mark {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: linear-gradient(115deg, var(--brand-green), #6DAF8C, #A8D5BA, #DCEBE1, var(--brand-green));
  background-size: 400% 400%;
  color: var(--text-on-brand);
  font-size: 19px;
  font-weight: 900;
  box-shadow: 0 14px 34px rgba(47,107,79,0.24);
}

@media (prefers-reduced-motion: no-preference) {
  .auth-logo-mark {
    animation: mbLogoHueDrift 16s ease-in-out infinite;
  }
}

@keyframes mbLogoHueDrift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.auth-brand-name {
  font-size: 18px;
  font-weight: 900;
  color: var(--text-primary);
}

.auth-brand-subtitle {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 700;
}

.auth-hero-copy {
  position: relative;
  z-index: 1;
  max-width: 520px;
}

.auth-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(47, 107, 79, 0.34);
  background: rgba(47, 107, 79, 0.10);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.auth-eyebrow svg {
  width: 16px;
  height: 16px;
}

.auth-hero-title {
  margin: 22px 0 12px;
  font-size: 34px;
  line-height: 1.18;
  font-weight: 900;
  color: var(--text-primary);
}

.auth-hero-text {
  margin: 0;
  max-width: 460px;
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.75;
}

.auth-kpi-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.auth-kpi {
  min-height: 112px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: rgba(255,255,255,0.72);
}

.auth-kpi-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: var(--text-on-accent);
  background: var(--accent);
  margin-bottom: 16px;
}

.auth-kpi-icon svg {
  width: 18px;
  height: 18px;
}

.auth-kpi-value {
  display: block;
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.auth-kpi-label {
  display: block;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.auth-form-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 42px;
  background: color-mix(in srgb, var(--bg-card) 94%, transparent);
}

.auth-form-card {
  width: min(100%, 430px);
}

.auth-page-register .auth-form-card {
  width: min(100%, 520px);
}

.auth-form-header {
  margin-bottom: 24px;
}

.auth-form-kicker {
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.auth-form-title {
  margin: 8px 0 8px;
  color: var(--text-primary);
  font-size: 28px;
  line-height: 1.25;
  font-weight: 900;
}

.auth-form-subtitle {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.65;
}

.auth-form {
  display: grid;
  gap: 16px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.form-group {
  display: grid;
  gap: 7px;
}

.form-label {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
}

.auth-input-wrap {
  position: relative;
}

.auth-input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
}

.auth-input-wrap .form-input {
  padding-left: 44px;
}

.form-input {
  min-height: 46px;
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: 15px;
  background: var(--input-bg);
  color: var(--text-primary);
  font-family: 'Sarabun', sans-serif;
  font-size: 14px;
  font-weight: 650;
  padding: 10px 13px;
  outline: none;
}

.form-input::placeholder {
  color: var(--text-faint);
}

.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-glow), 0 1px 2px rgba(0,0,0,0.08);
}

.btn-login.auth-submit {
  width: 100%;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--brand-green), var(--brand-green-700));
  color: var(--text-on-accent);
  font-family: 'Sarabun', sans-serif;
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 14px 30px rgba(47, 107, 79, 0.28);
}

.btn-login.auth-submit svg {
  width: 18px;
  height: 18px;
}

.btn-login.auth-submit:hover {
  filter: brightness(1.04);
  transform: translateY(-1px);
}

.btn-login.auth-submit:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.auth-feedback,
.login-error,
.login-success {
  border-radius: 16px;
  padding: 13px 14px;
  font-size: 13px;
  line-height: 1.55;
}

.login-error {
  display: none;
  margin-bottom: 16px;
  border: 1px solid rgba(239,68,68,0.34);
  background: rgba(239,68,68,0.11);
  color: var(--danger);
}

.login-success {
  display: none;
  margin-bottom: 16px;
  border: 1px solid rgba(16,185,129,0.34);
  background: rgba(16,185,129,0.12);
  color: var(--success);
}

.auth-inline-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.auth-link-button {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-family: 'Sarabun', sans-serif;
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 999px;
}

.auth-link-button:hover {
  background: var(--accent-dim);
}

.password-reset-panel {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--border-soft);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(255,255,255,0.08), rgba(255,255,255,0.03));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
}

.password-reset-panel .auth-feedback {
  margin-top: 10px;
}

.auth-success-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 8px;
  color: var(--success);
  font-weight: 900;
}

.auth-success-head svg {
  width: 18px;
  height: 18px;
}

.login-footer {
  margin-top: 20px;
  color: var(--text-muted);
  text-align: center;
  font-size: 13px;
  line-height: 1.6;
}

.login-footer a {
  color: var(--accent);
  font-weight: 900;
  text-decoration: none;
}

.login-footer a:hover {
  text-decoration: underline;
}

.auth-meta-list {
  display: grid;
  gap: 10px;
  margin-top: 22px;
}

.auth-meta-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
}

.auth-meta-item svg {
  width: 17px;
  height: 17px;
  color: var(--accent);
  flex: 0 0 auto;
  margin-top: 2px;
}

@media (max-width: 920px) {
  .auth-page {
    padding: 18px;
    place-items: start center;
  }

  .auth-shell,
  .auth-page-register .auth-shell {
    min-height: auto;
    grid-template-columns: 1fr;
    border-radius: 24px;
  }

  .auth-visual-panel {
    min-height: 330px;
    padding: 30px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .auth-hero-title {
    font-size: 28px;
  }

  .auth-form-panel {
    padding: 30px;
  }
}

@media (max-width: 620px) {
  .auth-page {
    padding: 0;
    display: block;
  }

  .auth-shell,
  .auth-page-register .auth-shell {
    width: 100%;
    min-height: 100vh;
    border: 0;
    border-radius: 0;
  }

  .auth-visual-panel {
    min-height: auto;
    gap: 18px;
    padding: 18px 18px 16px;
  }

  .auth-brand-row {
    gap: 10px;
  }

  .auth-logo-mark {
    width: 44px;
    height: 44px;
    border-radius: 15px;
    font-size: 16px;
  }

  .auth-brand-name {
    font-size: 16px;
  }

  .auth-brand-subtitle {
    font-size: 11.5px;
  }

  .auth-eyebrow {
    min-height: 30px;
    font-size: 11.5px;
  }

  .auth-hero-title {
    margin: 14px 0 8px;
    font-size: 24px;
    line-height: 1.2;
  }

  .auth-hero-text {
    font-size: 13px;
    line-height: 1.55;
  }

  .auth-kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .auth-kpi {
    min-height: auto;
    display: block;
    padding: 10px 8px;
    border-radius: 16px;
  }

  .auth-kpi-icon {
    width: 30px;
    height: 30px;
    margin-bottom: 8px;
    border-radius: 11px;
  }

  .auth-kpi-value {
    font-size: 15px;
  }

  .auth-kpi-label {
    font-size: 10.5px;
    line-height: 1.35;
  }

  .auth-form-panel {
    padding: 22px 18px 32px;
  }

  .auth-form-title {
    font-size: 24px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }
}

/* =============================================
   PREMIUM POLISH PASS
   ภาพรวม: เพิ่มมิติ ความนุ่มนวล และความพรีเมียมทั่วระบบ
============================================= */

/* ---- Refined elevation: cards ยกตัวนุ่มนวลเมื่อ hover ---- */
.card {
  transition: box-shadow 280ms cubic-bezier(0.4,0,0.2,1), border-color 280ms cubic-bezier(0.4,0,0.2,1), transform 280ms cubic-bezier(0.4,0,0.2,1);
}

.card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-glass-hover);
}

/* ---- Topbar: subtle depth gradient ---- */
.topbar {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--glass-surface) 92%, var(--bg-base)) 0%, var(--glass-surface) 100%);
  box-shadow: 0 1px 0 var(--border), 0 6px 18px -10px rgba(0,0,0,0.4);
}

/* ---- Sidebar: refined depth + subtle inner gradient ---- */
.sidebar {
  background: var(--glass-surface);
  box-shadow: 1px 0 0 var(--border);
}

/* ---- Nav items: smoother micro-interaction ---- */
.nav-item {
  transition: background 200ms cubic-bezier(0.4,0,0.2,1), color 200ms cubic-bezier(0.4,0,0.2,1), transform 150ms ease, box-shadow 200ms ease;
}

.nav-item:hover {
  transform: translateX(2px);
}

.nav-item.active {
  box-shadow: inset 0 0 0 1px rgba(47, 107, 79, 0.20), inset 0 0 16px var(--accent-glow);
}

/* ---- Buttons: premium press feedback ---- */
.btn, .btn-primary, .btn-ghost, .btn-add, .btn-export, .btn-login, .btn-calc,
.act-btn, .icon-btn, .branch-btn, .pill, .quick-btn, .export-btn, .send-btn,
.ai-send-btn, .target-edit-btn, .btn-approve, .btn-reject {
  transition: all 180ms cubic-bezier(0.4,0,0.2,1);
}

.btn:active, .btn-primary:active, .btn-add:active, .btn-export:active,
.btn-login:active, .btn-calc:active, .send-btn:active, .ai-send-btn:active {
  transform: scale(0.97);
}

.btn-primary, .btn-add, .btn-login, .btn-calc {
  box-shadow: 0 2px 10px rgba(47, 107, 79, 0.22);
}

.btn-primary:hover, .btn-add:hover, .btn-login:hover, .btn-calc:hover {
  box-shadow: 0 4px 16px rgba(47, 107, 79, 0.32);
  transform: translateY(-1px);
}

.btn-primary:active, .btn-add:active, .btn-login:active, .btn-calc:active {
  transform: translateY(0) scale(0.97);
}

/* ---- Inputs: refined focus glow ---- */
.form-input, .form-select, .form-select-sm, .form-textarea, .search-box {
  transition: border-color 200ms ease, box-shadow 200ms ease, background 200ms ease;
}

.form-input:focus, .form-textarea:focus {
  box-shadow: 0 0 0 4px var(--accent-glow), 0 1px 2px rgba(0,0,0,0.1);
}

/* ---- Page title: subtle premium gradient text ---- */
.page-title {
  background: linear-gradient(135deg, var(--text-primary) 40%, var(--accent) 150%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.4px;
}

/* ---- Card titles: refined letter-spacing for premium feel ---- */
.card-title {
  letter-spacing: 0.1px;
}

/* ---- Stat values: tighter, more confident numerals ---- */
.stat-value, .kpi-value, .result-big, .report-kpi-value {
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.8px;
}

/* ---- Avatar: subtle ring glow on key avatars ---- */
.avatar-btn, .profile-avatar {
  transition: box-shadow 220ms ease, transform 220ms ease;
}

.avatar-btn:hover {
  box-shadow: 0 0 0 4px var(--accent-glow);
  transform: scale(1.04);
}

/* ---- Empty states: gentle breathing animation ---- */
.empty-state-icon, .notif-empty-icon, .result-empty-icon {
  animation: gentle-float 3.2s ease-in-out infinite;
}

@keyframes gentle-float {
  0%, 100% { transform: translateY(0); opacity: 0.55; }
  50% { transform: translateY(-4px); opacity: 0.8; }
}

/* ---- Progress bars: smoother fill + subtle shine ---- */
.progress-bar-lg-fill, .progress-mini-fill, .chart-bar-fill {
  position: relative;
  overflow: hidden;
}

.progress-bar-lg-fill::after, .progress-mini-fill::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.18), transparent);
  animation: shine-sweep 2.6s ease-in-out infinite;
}

@keyframes shine-sweep {
  0% { transform: translateX(-100%); }
  60%, 100% { transform: translateX(100%); }
}

/* ---- Branding logo: subtle premium glow ---- */
.brand-logo, .auth-logo-mark {
  box-shadow: 0 2px 12px rgba(227,27,47,0.34);
}

/* ---- Tables: refined row hover ---- */
.user-table tr:hover td, .branch-table tr:hover td, .sheet-view tbody tr:hover td,
.compare-table tr:hover td {
  transition: background 150ms ease;
}

/* ---- Modal: refined entrance ---- */
.edit-modal {
  transition: transform 260ms cubic-bezier(0.16,1,0.3,1), opacity 220ms ease;
}

.edit-overlay {
  transition: opacity 220ms ease;
  backdrop-filter: blur(6px);
}

/* ---- Toast: refined shadow + spring feel ---- */
#global-toast, .toast {
  box-shadow: 0 8px 30px rgba(0,0,0,0.35), 0 2px 8px rgba(0,0,0,0.2);
  transition: transform 320ms cubic-bezier(0.16,1,0.3,1), opacity 280ms ease;
}

/* ---- Branch badge: refined premium pill ---- */
.branch-badge {
  box-shadow: 0 1px 4px rgba(47, 107, 79, 0.20);
}

/* ---- Reduced motion respect ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* =============================================
   PHASE 2 — LIQUID GLASS COMPONENTS
   หมายเหตุ: ใช้ selector ซ้อน (เช่น .kpi-card.kpi-card)
   เพื่อ override สไตล์เดิมใน <style> ของแต่ละหน้า
   จากศูนย์กลางไฟล์เดียว โดยไม่ต้องแก้ทีละหน้า
============================================= */

/* ---- KPI Cards (dashboard) ---- */
.kpi-card.kpi-card {
  background:
    var(--surface-highlight),
    var(--glass-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-glass);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.kpi-card.kpi-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-glass-hover);
  transform: translateY(-2px);
}

.kpi-label.kpi-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.9px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.kpi-value.kpi-value {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}

.kpi-unit.kpi-unit {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

.kpi-icon.kpi-icon {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.08), transparent 70%),
    color-mix(in srgb, var(--text-primary) 5%, transparent);
  border: 1px solid var(--border-soft);
  opacity: 1;
}

/* ตัวเลขเปลี่ยนแปลงเป็น chip แคปซูล */
.kpi-change.up,
.kpi-change.down {
  width: fit-content;
  padding: 3px 9px;
  border-radius: 999px;
  font-weight: 700;
  margin-top: 10px;
}

.kpi-change.up {
  color: var(--success);
  background: color-mix(in srgb, var(--success) 13%, transparent);
  border: 1px solid color-mix(in srgb, var(--success) 26%, transparent);
}

.kpi-change.down {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 13%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger) 26%, transparent);
}

/* ---- KPI + Chart Cards (reports) ---- */
.report-kpi-card.report-kpi-card,
.chart-card.chart-card {
  background:
    var(--surface-highlight),
    var(--glass-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-glass);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
}

.report-kpi-value.report-kpi-value {
  font-size: 27px;
  font-weight: 700;
  letter-spacing: -0.4px;
  font-variant-numeric: tabular-nums;
}

.report-kpi-sub.up,
.report-kpi-sub.down {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-weight: 700;
  margin-top: 8px;
}

.report-kpi-sub.up {
  color: var(--success);
  background: color-mix(in srgb, var(--success) 13%, transparent);
}

.report-kpi-sub.down {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 13%, transparent);
}

/* ---- Segmented Control (ตัวเลือกสาขา สไตล์ iOS) ---- */
.branch-selector.branch-selector {
  display: inline-flex;
  gap: 3px;
  padding: 4px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--text-primary) 6%, transparent);
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.10);
  flex-wrap: wrap;
}

.branch-btn.branch-btn {
  padding: 6px 15px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
}

.branch-btn.branch-btn:hover {
  background: color-mix(in srgb, var(--text-primary) 7%, transparent);
  color: var(--text-primary);
}

.branch-btn.branch-btn.active {
  background: linear-gradient(180deg, var(--brand-green-500) 0%, var(--brand-green) 62%, var(--brand-green-700) 100%);
  border-color: transparent;
  color: var(--text-on-accent);
  font-weight: 700;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.26),
    0 4px 12px -3px rgba(47, 107, 79, 0.40);
}

/* ---- Selects เป็นแคปซูลกระจก ---- */
.form-select-sm.form-select-sm,
.period-select.period-select {
  appearance: none;
  -webkit-appearance: none;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.06), transparent 60%),
    var(--input-bg);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  color: var(--text-primary);
  font-family: 'Sarabun', sans-serif;
  font-size: 12.5px;
  font-weight: 600;
  padding: 8px 30px 8px 14px;
  outline: none;
  cursor: pointer;
  background-image:
    linear-gradient(180deg, rgba(255,255,255,0.06), transparent 60%),
    url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2398A0AD' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat, no-repeat;
  background-position: 0 0, right 12px center;
  background-size: 100% 100%, 10px 6px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-select-sm.form-select-sm:focus,
.period-select.period-select:focus {
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.btn-refresh.btn-refresh {
  border-radius: 999px;
}

/* ---- Tables: อ่านง่ายขึ้น (ยกเว้น sheet-view ที่มีหัวสีเฉพาะ) ---- */
.branch-table th,
.compare-table th,
.monthly-detail-table th,
.report-detail-table th,
.home-ranking-table th,
.user-table th {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.branch-table td,
.compare-table td,
.monthly-detail-table td,
.report-detail-table td,
.home-ranking-table td {
  font-variant-numeric: tabular-nums;
}

.branch-table tbody tr,
.compare-table tbody tr,
.monthly-detail-table tbody tr,
.report-detail-table tbody tr,
.home-ranking-table tbody tr {
  transition: background var(--transition);
}

/* =============================================
   PHASE 4 — FINAL POLISH
   เก็บ panel เฉพาะหน้าที่ยังทึบให้เป็นกระจก,
   modal/toast, tab, และ performance มือถือ
============================================= */

/* ---- Panel เฉพาะหน้า → กระจก (วัสดุเท่านั้น ไม่แตะขนาด/ตำแหน่ง) ---- */
.loan-panel.loan-panel,
.export-card.export-card,
.formal-metric-card.formal-metric-card,
.summary-card.summary-card,
.stock-sum-card.stock-sum-card,
.stock-table-shell.stock-table-shell,
.branch-target-card.branch-target-card,
.my-target-hero.my-target-hero,
.branch-card.branch-card,
.report-month-detail.report-month-detail {
  background:
    var(--surface-highlight),
    var(--glass-card);
  border-color: var(--border-soft);
  box-shadow: var(--shadow-glass);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
}

/* ---- Modal เป็นแผ่นกระจกหนา ---- */
.edit-modal.edit-modal {
  background:
    var(--surface-highlight),
    var(--glass-card-strong);
  border-color: var(--border-soft);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-glass-hover);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
}

.edit-overlay.edit-overlay {
  background: rgba(15, 23, 42, 0.32);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* ---- Toast กระจก (คง border-left สีสถานะเดิม) ---- */
.toast.toast,
#global-toast {
  background:
    var(--surface-highlight),
    var(--glass-card-strong);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  box-shadow: var(--shadow-glass-hover);
}

/* ---- แถบพิมพ์ข้อความ chat / ai ---- */
.ai-input-wrap.ai-input-wrap,
.chat-input-wrap.chat-input-wrap {
  background:
    var(--surface-highlight),
    var(--glass-card-strong);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
}

/* bubble ฝั่งรับ: โปร่งเล็กน้อยแต่ไม่ blur (จำนวนเยอะ เปลืองเครื่อง) */
.msg-bubble.msg-bubble,
.ai-msg-bubble.ai-msg-bubble {
  background: var(--glass-card-strong);
}

/* ---- Tabs เป็นแทร็ก/ชิปกระจก + active ยกตัวด้วย gradient แบรนด์ ---- */
.target-tabs.target-tabs {
  background: color-mix(in srgb, var(--text-primary) 6%, transparent);
  border-color: var(--border);
  border-radius: 999px;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.10);
}

.target-tab.target-tab,
.period-tab.period-tab {
  border-radius: 999px;
}

.admin-tab.admin-tab {
  font-weight: 700;
  background: color-mix(in srgb, var(--text-primary) 6%, transparent);
  border-color: var(--border);
}

.admin-tab.admin-tab.active,
.target-tab.target-tab.active,
.period-tab.period-tab.active {
  background: linear-gradient(180deg, var(--brand-green-500) 0%, var(--brand-green) 62%, var(--brand-green-700) 100%);
  border-color: transparent;
  color: var(--text-on-accent);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.26),
    0 4px 12px -3px rgba(47, 107, 79, 0.40);
}

/* ---- ช่องค้นหา / select เฉพาะหน้า เป็นแคปซูล ---- */
.search-box.search-box,
.form-select.form-select {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.06), transparent 60%),
    var(--input-bg);
  border-radius: 999px;
}

/* ---- Performance มือถือ: การ์ดเกือบทึบอยู่แล้ว (Phase 1)
   ปิด blur รายการ์ดเพื่อประหยัด GPU — คงกระจกจริงไว้ที่
   topbar, dock, modal, toast, แถบพิมพ์ ซึ่งลอยเหนือเนื้อหา ---- */
@media (max-width: 768px) {
  .card,
  .app-card,
  .kpi-card.kpi-card,
  .report-kpi-card.report-kpi-card,
  .chart-card.chart-card,
  .loan-panel.loan-panel,
  .export-card.export-card,
  .formal-metric-card.formal-metric-card,
  .summary-card.summary-card,
  .stock-sum-card.stock-sum-card,
  .stock-table-shell.stock-table-shell,
  .branch-target-card.branch-target-card,
  .my-target-hero.my-target-hero,
  .branch-card.branch-card,
  .report-month-detail.report-month-detail {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  body.mobile-menu-open .sidebar {
    width: min(344px, calc(100vw - 12px));
    background: var(--mobile-drawer-bg, #FFFFFF);
    border-right: 1px solid var(--border-strong);
    box-shadow: var(--mobile-drawer-shadow);
    overscroll-behavior: contain;
  }

  body.mobile-menu-open .sidebar.mobile-open {
    left: 0;
    transform: translateX(0);
  }

}
