/* =============================================
   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(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  transition: background var(--transition), color var(--transition);
}

/* =============================================
   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(--bg-surface);
  border-bottom: 1px solid var(--border);
  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: var(--accent);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  color: #0D0D12;
  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-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(--accent);
  background: var(--accent-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  transition: all var(--transition);
}

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

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

.sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  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: #0D0D12;
  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));
}

/* =============================================
   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(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

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

.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;
}

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

/* =============================================
   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: 800;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  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-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) {
  .app-layout {
    grid-template-columns: 1fr;
    grid-template-rows: var(--topbar-h) 1fr auto;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    width: 260px;
    height: 100vh;
    z-index: 250;
    transition: left 280ms cubic-bezier(0.16,1,0.3,1);
    box-shadow: 4px 0 24px rgba(0,0,0,0.3);
    padding-top: 16px;
  }

  .sidebar.mobile-open {
    left: 0;
  }

  .mobile-drawer-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(2px);
    z-index: 240;
  }

  .mobile-drawer-backdrop.open {
    display: block;
  }

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

  .main-content {
    padding: 16px;
    max-height: unset;
    padding-bottom: 76px;
  }

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

  .topbar-brand {
    width: auto;
  }

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

.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) */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  z-index: 100;
  padding: 0 8px;
  align-items: center;
  justify-content: space-around;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  transition: color var(--transition);
  text-decoration: none;
}

.bottom-nav-item.active {
  color: var(--accent);
}

.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(--info); background: linear-gradient(to right, rgba(96,165,250,0.05), 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(--info); }
.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(--info); }
.stat-card:nth-child(3) { border-top-color: var(--success); }
.stat-card:nth-child(4) { border-top-color: #A78BFA; }

/* 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 var(--info)); }
.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 #A78BFA); }

.kpi-card:nth-child(1)::after { background: rgba(245,184,0,0.06); }
.kpi-card:nth-child(2)::after { background: rgba(96,165,250,0.06); }
.kpi-card:nth-child(3)::after { background: rgba(52,211,153,0.06); }
.kpi-card:nth-child(4)::after { background: rgba(167,139,250,0.06); }

/* Member Avatars — rotating accent colors */
.member-avatar:nth-child(4n+1) { background: rgba(245,184,0,0.15); color: var(--accent); }
.member-avatar:nth-child(4n+2) { background: rgba(96,165,250,0.15); color: var(--info); }
.member-avatar:nth-child(4n+3) { background: rgba(52,211,153,0.15); color: var(--success); }
.member-avatar:nth-child(4n+4) { background: rgba(167,139,250,0.15); color: #A78BFA; }

/* 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); }
.brand-tag:nth-child(3n+2) { background: rgba(96,165,250,0.1); color: var(--info); border-color: rgba(96,165,250,0.3); }
.brand-tag:nth-child(3n+3) { background: rgba(52,211,153,0.1); color: var(--success); border-color: rgba(52,211,153,0.3); }

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

/* 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: rgba(96,165,250,0.12);
  color: var(--info);
  border: 1px solid rgba(96,165,250,0.3);
}

.type-badge.trade {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(245,184,0,0.3);
}

/* 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(96,165,250,0.05) 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
============================================= */

.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: 800;
  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: 340px; max-height: 420px;
  background: var(--bg-card); border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  z-index: 500; display: none; flex-direction: column;
  overflow: hidden;
}

.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-clear-all {
  font-size: 11px; font-weight: 600; color: var(--accent);
  cursor: pointer; background: none; border: none; font-family: 'Sarabun', sans-serif;
}

.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(96,165,250,0.15); }

.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-icon { font-size: 28px; margin-bottom: 8px; opacity: 0.4; }

@media (max-width: 480px) {
  .notif-panel { width: 90vw; right: -60px; }
}

/* =============================================
   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: 0 4px 24px rgba(0,0,0,0.25), 0 1px 3px rgba(0,0,0,0.15);
}

[data-theme="light"] .card:hover {
  box-shadow: 0 6px 24px rgba(20,20,30,0.08), 0 2px 6px rgba(20,20,30,0.04);
}

/* ---- Topbar: subtle depth gradient ---- */
.topbar {
  background: linear-gradient(180deg, var(--bg-surface) 0%, var(--bg-base) 130%);
  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: linear-gradient(180deg, var(--bg-sidebar) 0%, var(--bg-base) 100%);
  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(245,184,0,0.15), 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(245,184,0,0.25);
}

.btn-primary:hover, .btn-add:hover, .btn-login:hover, .btn-calc:hover {
  box-shadow: 0 4px 16px rgba(245,184,0,0.35);
  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, .login-logo-icon {
  box-shadow: 0 2px 12px rgba(245,184,0,0.35);
}

/* ---- 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(245,184,0,0.2);
}

/* ---- 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;
  }
}
